// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate. // Trust me, you don't want to mess with it! import nativeModule, { type UniffiRustFutureContinuationCallback, type UniffiForeignFuture, type UniffiForeignFutureStructU8, type UniffiForeignFutureCompleteU8, type UniffiForeignFutureStructI8, type UniffiForeignFutureCompleteI8, type UniffiForeignFutureStructU16, type UniffiForeignFutureCompleteU16, type UniffiForeignFutureStructI16, type UniffiForeignFutureCompleteI16, type UniffiForeignFutureStructU32, type UniffiForeignFutureCompleteU32, type UniffiForeignFutureStructI32, type UniffiForeignFutureCompleteI32, type UniffiForeignFutureStructU64, type UniffiForeignFutureCompleteU64, type UniffiForeignFutureStructI64, type UniffiForeignFutureCompleteI64, type UniffiForeignFutureStructF32, type UniffiForeignFutureCompleteF32, type UniffiForeignFutureStructF64, type UniffiForeignFutureCompleteF64, type UniffiForeignFutureStructPointer, type UniffiForeignFutureCompletePointer, type UniffiForeignFutureStructRustBuffer, type UniffiForeignFutureCompleteRustBuffer, type UniffiForeignFutureStructVoid, type UniffiForeignFutureCompleteVoid, type UniffiVTableCallbackInterfaceEventListener, type UniffiVTableCallbackInterfaceLogger, type UniffiVTableCallbackInterfaceBitcoinChainService, type UniffiVTableCallbackInterfaceCpfpSigner, type UniffiVTableCallbackInterfaceExternalBreezSigner, type UniffiVTableCallbackInterfaceExternalSigningSigner, type UniffiVTableCallbackInterfaceExternalSparkSigner, type UniffiVTableCallbackInterfaceFiatService, type UniffiVTableCallbackInterfacePaymentObserver, type UniffiVTableCallbackInterfacePrfProvider, type UniffiVTableCallbackInterfaceRestClient, type UniffiVTableCallbackInterfaceSessionStore, type UniffiVTableCallbackInterfaceStorage, type UniffiVTableCallbackInterfaceStorageBackend, } from './breez_sdk_spark-ffi'; import { type FfiConverter, type UniffiByteArray, type UniffiHandle, type UniffiObjectFactory, type UniffiReferenceHolder, type UniffiRustArcPtr, type UniffiRustCallStatus, type UnsafeMutableRawPointer, AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterCallback, FfiConverterFloat64, FfiConverterInt32, FfiConverterMap, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt16, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCall, uniffiTraitInterfaceCallAsync, uniffiTraitInterfaceCallAsyncWithError, uniffiTypeNameSymbol, variantOrdinalSymbol, } from 'uniffi-bindgen-react-native'; // Get converters from the other files, if any. const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 })); const uniffiIsDebug = // @ts-ignore -- The process global might not be defined typeof process !== 'object' || // @ts-ignore -- The process global might not be defined process?.env?.NODE_ENV !== 'production' || false; // Public interface members begin here. /** * Connects to the Spark network using the provided configuration and mnemonic. * * # Arguments * * * `request` - The connection request object * * # Returns * * Result containing either the initialized `BreezSdk` or an `SdkError` */ export async function connect( request: ConnectRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_connect( FfiConverterTypeConnectRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_pointer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_pointer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_pointer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_pointer, /*liftFunc:*/ FfiConverterTypeBreezSdk.lift.bind( FfiConverterTypeBreezSdk ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Connects to the Spark network using an external signer. * * This method allows using a custom signer implementation instead of providing * a seed directly. * * # Arguments * * * `request` - The connection request object with external signer * * # Returns * * Result containing either the initialized `BreezSdk` or an `SdkError` */ export async function connectWithSigner( request: ConnectWithSignerRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_connect_with_signer( FfiConverterTypeConnectWithSignerRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_pointer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_pointer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_pointer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_pointer, /*liftFunc:*/ FfiConverterTypeBreezSdk.lift.bind( FfiConverterTypeBreezSdk ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Connects to the Spark network using a signing-only external signer. * * Use this instead of [`connect_with_signer`] for a signer that can't perform * the SDK's local ECIES/HMAC operations (for example a policy-restricted * enclave). The SDK keeps session tokens in plaintext and disables the features * that rely on ECIES/HMAC. * * # Arguments * * * `request` - The connection request object with a signing-only external signer * * # Returns * * Result containing either the initialized `BreezSdk` or an `SdkError` */ export async function connectWithSigningOnlySigner( request: ConnectWithSigningOnlySignerRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_connect_with_signing_only_signer( FfiConverterTypeConnectWithSigningOnlySignerRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_pointer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_pointer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_pointer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_pointer, /*liftFunc:*/ FfiConverterTypeBreezSdk.lift.bind( FfiConverterTypeBreezSdk ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Builds the Turnkey-backed Breez and Spark signers from `config`, sharing one * Turnkey client. * * The Spark signer keeps every signing operation in the Turnkey enclave; the * Breez signer does too, except ECIES and HMAC, which run locally against a * dedicated, non-Spark key exported on first use (see `TurnkeyBreezSigner`). * Exporting a non-Spark key keeps every Spark key (the identity key included) * in the enclave; ECIES/HMAC only need a stable key, not a Spark one. * * For a wallet under a deny-export policy, use * [`create_turnkey_signing_only_signer`] instead: it never exports a key. */ export async function createTurnkeySigner( config: TurnkeyConfig, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_create_turnkey_signer( FfiConverterTypeTurnkeyConfig.lower(config) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeExternalSigners.lift.bind( FfiConverterTypeExternalSigners ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Builds signing-only Turnkey-backed signers from `config`, for a wallet under * a deny-export policy. The Breez half performs signing only and never exports * a key, so no ECIES/HMAC is attempted. Pair with * [`connect_with_signing_only_signer`](crate::connect_with_signing_only_signer). */ export async function createTurnkeySigningOnlySigner( config: TurnkeyConfig, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_create_turnkey_signing_only_signer( FfiConverterTypeTurnkeyConfig.lower(config) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeSigningOnlyExternalSigners.lift.bind( FfiConverterTypeSigningOnlyExternalSigners ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Wraps a caller-supplied [`Storage`] implementation as a [`StorageBackend`]. * The tree, token-output and session stores use the in-memory defaults. */ export function customStorage(storage: Storage): StorageBackend { return FfiConverterTypeStorageBackend.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_custom_storage( FfiConverterTypeStorage.lower(storage), callStatus ); }, /*liftString:*/ FfiConverterString.lift ) ); } export function defaultConfig(network: Network): Config { return FfiConverterTypeConfig.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_default_config( FfiConverterTypeNetwork.lower(network), callStatus ); }, /*liftString:*/ FfiConverterString.lift ) ); } /** * Creates the default external signers from a mnemonic. * * This is a convenience factory method for creating the two signer halves * that can be passed to `connect_with_signer` or `SdkBuilder::new_with_signer`. * Key derivation matches the seed-based connect path: an SDK built either way * from the same mnemonic is the same wallet. * * # Arguments * * * `mnemonic` - BIP39 mnemonic phrase (12 or 24 words) * * `passphrase` - Optional passphrase for the mnemonic * * `network` - Network to use (Mainnet or Regtest) * * `account_number` - Account number in the derivation path. Unset uses the * network default: 0 on Regtest, 1 on all other networks. */ export function defaultExternalSigners( mnemonic: string, passphrase: string | undefined, network: Network, accountNumber: /*u32*/ number | undefined ): ExternalSigners /*throws*/ { return FfiConverterTypeExternalSigners.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_default_external_signers( FfiConverterString.lower(mnemonic), FfiConverterOptionalString.lower(passphrase), FfiConverterTypeNetwork.lower(network), FfiConverterOptionalUInt32.lower(accountNumber), callStatus ); }, /*liftString:*/ FfiConverterString.lift ) ); } /** * Builds a [`Config`] suitable for multi-tenant server-mode deployments. * * This preset returns the same configuration as [`default_config`] with * [`background_tasks_enabled`](Config::background_tasks_enabled) set to * `false`. In server mode, the SDK is treated as a library: the host * orchestrates sync, claiming, and event delivery (typically via webhooks) * explicitly, so an ephemeral SDK instance stays cheap and predictable. * * Config fields whose background services are gated off are reset to their * inactive shape: `real_time_sync_server_url` and `cross_chain_config` are * set to `None`, and both `leaf_optimization_config.auto_enabled` and * `token_optimization_config.auto_enabled` are set to `false`. The SDK * rejects builds where `background_tasks_enabled` is `false` and any of * those fields is left in its active shape, so flip the flag via this * helper rather than by hand. * * Explicit operations (`sync_wallet`, `claim_deposit`, * `list_unclaimed_deposits`, `refund_deposit`, * `refund_pending_conversions`, etc.) continue to work and are the intended * entry points in this mode. * * Stable Balance is not supported in this mode because its conversion worker * is a background service. * * One-time setup that the SDK normally applies automatically — notably * `private_enabled_default` — is NOT applied in this mode. Drive setup * explicitly via `update_user_settings` (and any other relevant APIs) so * ephemeral per-request SDK instances incur no implicit setup overhead. * * `get_info` reads balance directly from the spark wallet in this mode * rather than from the background-maintained storage cache, so balance * reflects the latest local sync and `ensure_synced=true` is rejected with * an invalid-input error */ export function defaultServerConfig(network: Network): Config { return FfiConverterTypeConfig.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_default_server_config( FfiConverterTypeNetwork.lower(network), callStatus ); }, /*liftString:*/ FfiConverterString.lift ) ); } /** * The session store `backend` provides for `identity` on `network` (its own * persistence: `PostgreSQL`/`MySQL` when the backend is DB-backed, else an * in-memory store). * * Returned so it can be wrapped in a decorating [`SessionStore`] and passed to * [`SdkBuilder::with_session_store`](crate::SdkBuilder::with_session_store), * keeping the backend's persistence. A typical use is at-rest encryption (the * SDK does not encrypt tokens itself): wrap it in a store that encrypts on * write and decrypts on read. `identity` is the wallet identity public key * bytes (the same value the SDK derives from the signer). */ export async function defaultSessionStore( backend: StorageBackend, network: Network, identity: ArrayBuffer, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_default_session_store( FfiConverterTypeStorageBackend.lower(backend), FfiConverterTypeNetwork.lower(network), FfiConverterArrayBuffer.lower(identity) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_pointer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_pointer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_pointer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_pointer, /*liftFunc:*/ FfiConverterTypeSessionStore.lift.bind( FfiConverterTypeSessionStore ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * File-based `SQLite` storage rooted at `storage_dir` — the default for * mobile and desktop apps. Each tenant gets its own database file under the * directory. */ export function defaultStorage(storageDir: string): StorageBackend { return FfiConverterTypeStorageBackend.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_default_storage( FfiConverterString.lower(storageDir), callStatus ); }, /*liftString:*/ FfiConverterString.lift ) ); } /** * Fetches the current status of Spark network services relevant to the SDK. * * This function queries the Spark status API and returns the worst status * across the Spark Operators and SSP services. */ export async function getSparkStatus( request: GetSparkStatusRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_get_spark_status( FfiConverterTypeGetSparkStatusRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeSparkStatus.lift.bind( FfiConverterTypeSparkStatus ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } export function initLogging( logDir: string | undefined, appLogger: Logger | undefined, logFilter: string | undefined ): void /*throws*/ { uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSdkError.lift.bind(FfiConverterTypeSdkError), /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_init_logging( FfiConverterOptionalString.lower(logDir), FfiConverterOptionalTypeLogger.lower(appLogger), FfiConverterOptionalString.lower(logFilter), callStatus ); }, /*liftString:*/ FfiConverterString.lift ); } /** * Constructs a shareable REST-based [`BitcoinChainService`]. * * Pass the returned `Arc` to multiple [`SdkBuilder`](crate::SdkBuilder)s via * [`SdkBuilder::with_chain_service`](crate::SdkBuilder::with_chain_service) * to reuse a single underlying HTTP client (and its connection pool) across * SDK instances. All SDKs sharing the service must use the same `network`. * * For one-off, non-shared use, prefer * [`SdkBuilder::with_rest_chain_service`](crate::SdkBuilder::with_rest_chain_service), * which builds on the SDK's own client and inherits its proxy automatically. */ export async function newRestChainService( url: string, network: Network, apiType: ChainApiType, credentials: Credentials | undefined, request: NewRestChainServiceRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_new_rest_chain_service( FfiConverterString.lower(url), FfiConverterTypeNetwork.lower(network), FfiConverterTypeChainApiType.lower(apiType), FfiConverterOptionalTypeCredentials.lower(credentials), FfiConverterTypeNewRestChainServiceRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_pointer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_pointer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_pointer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_pointer, /*liftFunc:*/ FfiConverterTypeBitcoinChainService.lift.bind( FfiConverterTypeBitcoinChainService ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Constructs an [`SdkContext`] from a `SdkContextConfig`. * * The returned `Arc` is cheap to clone and can back many SDK instances, * sharing their HTTP client and operator gRPC channels. */ export async function newSharedSdkContext( config: SdkContextConfig, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_new_shared_sdk_context( FfiConverterTypeSdkContextConfig.lower(config) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_pointer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_pointer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_pointer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_pointer, /*liftFunc:*/ FfiConverterTypeSdkContext.lift.bind( FfiConverterTypeSdkContext ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * A CPFP signer backed by a single private key. Signs P2WPKH and P2TR key-path * inputs only; taproot script-path spends are not supported. */ export function singleKeyCpfpSigner( secretKeyBytes: ArrayBuffer ): CpfpSigner /*throws*/ { return FfiConverterTypeCpfpSigner.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_single_key_cpfp_signer( FfiConverterArrayBuffer.lower(secretKeyBytes), callStatus ); }, /*liftString:*/ FfiConverterString.lift ) ); } /** * Trait for event listeners */ export interface EventListener { /** * Called when an event occurs */ onEvent(event: SdkEvent, asyncOpts_?: { signal: AbortSignal }): Promise; } // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceEventListener: { vtable: UniffiVTableCallbackInterfaceEventListener; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { onEvent: ( uniffiHandle: bigint, event: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeEventListener.lift(uniffiHandle); return await jsCallback.onEvent(FfiConverterTypeSdkEvent.lift(event), { signal, }); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsync( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, uniffiFree: (uniffiHandle: UniffiHandle): void => { // EventListener: this will throw a stale handle error if the handle isn't found. FfiConverterTypeEventListener.drop(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_eventlistener( uniffiCallbackInterfaceEventListener.vtable ); }, }; // FfiConverter protocol for callback interfaces const FfiConverterTypeEventListener = new FfiConverterCallback(); export interface Logger { log(l: LogEntry): void; } // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceLogger: { vtable: UniffiVTableCallbackInterfaceLogger; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { log: (uniffiHandle: bigint, l: Uint8Array) => { const uniffiMakeCall = (): void => { const jsCallback = FfiConverterTypeLogger.lift(uniffiHandle); return jsCallback.log(FfiConverterTypeLogEntry.lift(l)); }; const uniffiResult = UniffiResult.ready(); const uniffiHandleSuccess = (obj: any) => {}; const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { UniffiResult.writeError(uniffiResult, code, errBuf); }; uniffiTraitInterfaceCall( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*lowerString:*/ FfiConverterString.lower ); return uniffiResult; }, uniffiFree: (uniffiHandle: UniffiHandle): void => { // Logger: this will throw a stale handle error if the handle isn't found. FfiConverterTypeLogger.drop(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_logger( uniffiCallbackInterfaceLogger.vtable ); }, }; // FfiConverter protocol for callback interfaces const FfiConverterTypeLogger = new FfiConverterCallback(); /** * Request to add a new contact. */ export type AddContactRequest = { name: string; /** * A Lightning address (user@domain). */ paymentIdentifier: string; }; /** * Generated factory for {@link AddContactRequest} record objects. */ export const AddContactRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link AddContactRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link AddContactRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeAddContactRequest = (() => { type TypeName = AddContactRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { name: FfiConverterString.read(from), paymentIdentifier: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.name, into); FfiConverterString.write(value.paymentIdentifier, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.name) + FfiConverterString.allocationSize(value.paymentIdentifier) ); } } return new FFIConverter(); })(); /** * Payload of the AES success action, as received from the LNURL endpoint * * See [`AesSuccessActionDataDecrypted`] for a similar wrapper containing the decrypted payload */ export type AesSuccessActionData = { /** * Contents description, up to 144 characters */ description: string; /** * Base64, AES-encrypted data where encryption key is payment preimage, up to 4kb of characters */ ciphertext: string; /** * Base64, initialization vector, exactly 24 characters */ iv: string; }; /** * Generated factory for {@link AesSuccessActionData} record objects. */ export const AesSuccessActionData = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< AesSuccessActionData, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link AesSuccessActionData}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link AesSuccessActionData}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeAesSuccessActionData = (() => { type TypeName = AesSuccessActionData; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { description: FfiConverterString.read(from), ciphertext: FfiConverterString.read(from), iv: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.description, into); FfiConverterString.write(value.ciphertext, into); FfiConverterString.write(value.iv, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.description) + FfiConverterString.allocationSize(value.ciphertext) + FfiConverterString.allocationSize(value.iv) ); } } return new FFIConverter(); })(); /** * Wrapper for the decrypted [`AesSuccessActionData`] payload */ export type AesSuccessActionDataDecrypted = { /** * Contents description, up to 144 characters */ description: string; /** * Decrypted content */ plaintext: string; }; /** * Generated factory for {@link AesSuccessActionDataDecrypted} record objects. */ export const AesSuccessActionDataDecrypted = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< AesSuccessActionDataDecrypted, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link AesSuccessActionDataDecrypted}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link AesSuccessActionDataDecrypted}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeAesSuccessActionDataDecrypted = (() => { type TypeName = AesSuccessActionDataDecrypted; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { description: FfiConverterString.read(from), plaintext: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.description, into); FfiConverterString.write(value.plaintext, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.description) + FfiConverterString.allocationSize(value.plaintext) ); } } return new FFIConverter(); })(); /** * Request for [`BreezSdk::authorize_lightning_address_transfer`]. Called by * the *current owner* to authorize handing their registered username over to * `transferee_pubkey`. */ export type AuthorizeTransferRequest = { /** * The new owner's identity public key. */ transfereePubkey: string; }; /** * Generated factory for {@link AuthorizeTransferRequest} record objects. */ export const AuthorizeTransferRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< AuthorizeTransferRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link AuthorizeTransferRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link AuthorizeTransferRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeAuthorizeTransferRequest = (() => { type TypeName = AuthorizeTransferRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { transfereePubkey: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.transfereePubkey, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.transfereePubkey); } } return new FFIConverter(); })(); /** * A single payee in a batch send. */ export type BatchRecipient = { /** * Spark address or Spark invoice identifying the payee. */ paymentRequest: string; /** * Amount to send, in the base units of the asset being sent. Required * unless `payment_request` is an invoice that carries its own amount. */ amount: U128 | undefined; /** * Token to send. Unset means sats, which a batch cannot send yet, so a * plain address needs this set. An invoice that names a token does not. */ tokenIdentifier: string | undefined; }; /** * Generated factory for {@link BatchRecipient} record objects. */ export const BatchRecipient = (() => { const defaults = () => ({ amount: undefined, tokenIdentifier: undefined }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link BatchRecipient}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link BatchRecipient}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBatchRecipient = (() => { type TypeName = BatchRecipient; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { paymentRequest: FfiConverterString.read(from), amount: FfiConverterOptionalTypeu128.read(from), tokenIdentifier: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.paymentRequest, into); FfiConverterOptionalTypeu128.write(value.amount, into); FfiConverterOptionalString.write(value.tokenIdentifier, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.paymentRequest) + FfiConverterOptionalTypeu128.allocationSize(value.amount) + FfiConverterOptionalString.allocationSize(value.tokenIdentifier) ); } } return new FFIConverter(); })(); /** * What a batch debits for one asset. */ export type BatchTotal = { /** * The token debited. Unset means sats, which a batch cannot send yet. */ tokenIdentifier: string | undefined; /** * Amount in the asset's base units. */ amount: U128; }; /** * Generated factory for {@link BatchTotal} record objects. */ export const BatchTotal = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link BatchTotal}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link BatchTotal}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBatchTotal = (() => { type TypeName = BatchTotal; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { tokenIdentifier: FfiConverterOptionalString.read(from), amount: FfiConverterTypeu128.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.tokenIdentifier, into); FfiConverterTypeu128.write(value.amount, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.tokenIdentifier) + FfiConverterTypeu128.allocationSize(value.amount) ); } } return new FFIConverter(); })(); export type Bip21Details = { amountSat: /*u64*/ bigint | undefined; assetId: string | undefined; uri: string; extras: Array; label: string | undefined; message: string | undefined; paymentMethods: Array; }; /** * Generated factory for {@link Bip21Details} record objects. */ export const Bip21Details = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link Bip21Details}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Bip21Details}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBip21Details = (() => { type TypeName = Bip21Details; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { amountSat: FfiConverterOptionalUInt64.read(from), assetId: FfiConverterOptionalString.read(from), uri: FfiConverterString.read(from), extras: FfiConverterArrayTypeBip21Extra.read(from), label: FfiConverterOptionalString.read(from), message: FfiConverterOptionalString.read(from), paymentMethods: FfiConverterArrayTypeInputType.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalUInt64.write(value.amountSat, into); FfiConverterOptionalString.write(value.assetId, into); FfiConverterString.write(value.uri, into); FfiConverterArrayTypeBip21Extra.write(value.extras, into); FfiConverterOptionalString.write(value.label, into); FfiConverterOptionalString.write(value.message, into); FfiConverterArrayTypeInputType.write(value.paymentMethods, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalUInt64.allocationSize(value.amountSat) + FfiConverterOptionalString.allocationSize(value.assetId) + FfiConverterString.allocationSize(value.uri) + FfiConverterArrayTypeBip21Extra.allocationSize(value.extras) + FfiConverterOptionalString.allocationSize(value.label) + FfiConverterOptionalString.allocationSize(value.message) + FfiConverterArrayTypeInputType.allocationSize(value.paymentMethods) ); } } return new FFIConverter(); })(); export type Bip21Extra = { key: string; value: string; }; /** * Generated factory for {@link Bip21Extra} record objects. */ export const Bip21Extra = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link Bip21Extra}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Bip21Extra}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBip21Extra = (() => { type TypeName = Bip21Extra; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { key: FfiConverterString.read(from), value: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.key, into); FfiConverterString.write(value.value, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.key) + FfiConverterString.allocationSize(value.value) ); } } return new FFIConverter(); })(); export type BitcoinAddressDetails = { address: string; network: BitcoinNetwork; source: PaymentRequestSource; }; /** * Generated factory for {@link BitcoinAddressDetails} record objects. */ export const BitcoinAddressDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< BitcoinAddressDetails, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link BitcoinAddressDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link BitcoinAddressDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBitcoinAddressDetails = (() => { type TypeName = BitcoinAddressDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { address: FfiConverterString.read(from), network: FfiConverterTypeBitcoinNetwork.read(from), source: FfiConverterTypePaymentRequestSource.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.address, into); FfiConverterTypeBitcoinNetwork.write(value.network, into); FfiConverterTypePaymentRequestSource.write(value.source, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.address) + FfiConverterTypeBitcoinNetwork.allocationSize(value.network) + FfiConverterTypePaymentRequestSource.allocationSize(value.source) ); } } return new FFIConverter(); })(); export type Bolt11Invoice = { bolt11: string; source: PaymentRequestSource; }; /** * Generated factory for {@link Bolt11Invoice} record objects. */ export const Bolt11Invoice = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link Bolt11Invoice}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Bolt11Invoice}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBolt11Invoice = (() => { type TypeName = Bolt11Invoice; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { bolt11: FfiConverterString.read(from), source: FfiConverterTypePaymentRequestSource.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.bolt11, into); FfiConverterTypePaymentRequestSource.write(value.source, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.bolt11) + FfiConverterTypePaymentRequestSource.allocationSize(value.source) ); } } return new FFIConverter(); })(); export type Bolt11InvoiceDetails = { amountMsat: /*u64*/ bigint | undefined; description: string | undefined; descriptionHash: string | undefined; expiry: /*u64*/ bigint; invoice: Bolt11Invoice; minFinalCltvExpiryDelta: /*u64*/ bigint; network: BitcoinNetwork; payeePubkey: string; paymentHash: string; paymentSecret: string; routingHints: Array; timestamp: /*u64*/ bigint; }; /** * Generated factory for {@link Bolt11InvoiceDetails} record objects. */ export const Bolt11InvoiceDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< Bolt11InvoiceDetails, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link Bolt11InvoiceDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Bolt11InvoiceDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBolt11InvoiceDetails = (() => { type TypeName = Bolt11InvoiceDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { amountMsat: FfiConverterOptionalUInt64.read(from), description: FfiConverterOptionalString.read(from), descriptionHash: FfiConverterOptionalString.read(from), expiry: FfiConverterUInt64.read(from), invoice: FfiConverterTypeBolt11Invoice.read(from), minFinalCltvExpiryDelta: FfiConverterUInt64.read(from), network: FfiConverterTypeBitcoinNetwork.read(from), payeePubkey: FfiConverterString.read(from), paymentHash: FfiConverterString.read(from), paymentSecret: FfiConverterString.read(from), routingHints: FfiConverterArrayTypeBolt11RouteHint.read(from), timestamp: FfiConverterUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalUInt64.write(value.amountMsat, into); FfiConverterOptionalString.write(value.description, into); FfiConverterOptionalString.write(value.descriptionHash, into); FfiConverterUInt64.write(value.expiry, into); FfiConverterTypeBolt11Invoice.write(value.invoice, into); FfiConverterUInt64.write(value.minFinalCltvExpiryDelta, into); FfiConverterTypeBitcoinNetwork.write(value.network, into); FfiConverterString.write(value.payeePubkey, into); FfiConverterString.write(value.paymentHash, into); FfiConverterString.write(value.paymentSecret, into); FfiConverterArrayTypeBolt11RouteHint.write(value.routingHints, into); FfiConverterUInt64.write(value.timestamp, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalUInt64.allocationSize(value.amountMsat) + FfiConverterOptionalString.allocationSize(value.description) + FfiConverterOptionalString.allocationSize(value.descriptionHash) + FfiConverterUInt64.allocationSize(value.expiry) + FfiConverterTypeBolt11Invoice.allocationSize(value.invoice) + FfiConverterUInt64.allocationSize(value.minFinalCltvExpiryDelta) + FfiConverterTypeBitcoinNetwork.allocationSize(value.network) + FfiConverterString.allocationSize(value.payeePubkey) + FfiConverterString.allocationSize(value.paymentHash) + FfiConverterString.allocationSize(value.paymentSecret) + FfiConverterArrayTypeBolt11RouteHint.allocationSize( value.routingHints ) + FfiConverterUInt64.allocationSize(value.timestamp) ); } } return new FFIConverter(); })(); export type Bolt11RouteHint = { hops: Array; }; /** * Generated factory for {@link Bolt11RouteHint} record objects. */ export const Bolt11RouteHint = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link Bolt11RouteHint}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Bolt11RouteHint}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBolt11RouteHint = (() => { type TypeName = Bolt11RouteHint; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { hops: FfiConverterArrayTypeBolt11RouteHintHop.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypeBolt11RouteHintHop.write(value.hops, into); } allocationSize(value: TypeName): number { return FfiConverterArrayTypeBolt11RouteHintHop.allocationSize(value.hops); } } return new FFIConverter(); })(); export type Bolt11RouteHintHop = { /** * The `node_id` of the non-target end of the route */ srcNodeId: string; /** * The `short_channel_id` of this channel */ shortChannelId: string; /** * The fees which must be paid to use this channel */ feesBaseMsat: /*u32*/ number; feesProportionalMillionths: /*u32*/ number; /** * The difference in CLTV values between this node and the next node. */ cltvExpiryDelta: /*u16*/ number; /** * The minimum value, in msat, which must be relayed to the next hop. */ htlcMinimumMsat: /*u64*/ bigint | undefined; /** * The maximum value in msat available for routing with a single HTLC. */ htlcMaximumMsat: /*u64*/ bigint | undefined; }; /** * Generated factory for {@link Bolt11RouteHintHop} record objects. */ export const Bolt11RouteHintHop = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link Bolt11RouteHintHop}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Bolt11RouteHintHop}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBolt11RouteHintHop = (() => { type TypeName = Bolt11RouteHintHop; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { srcNodeId: FfiConverterString.read(from), shortChannelId: FfiConverterString.read(from), feesBaseMsat: FfiConverterUInt32.read(from), feesProportionalMillionths: FfiConverterUInt32.read(from), cltvExpiryDelta: FfiConverterUInt16.read(from), htlcMinimumMsat: FfiConverterOptionalUInt64.read(from), htlcMaximumMsat: FfiConverterOptionalUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.srcNodeId, into); FfiConverterString.write(value.shortChannelId, into); FfiConverterUInt32.write(value.feesBaseMsat, into); FfiConverterUInt32.write(value.feesProportionalMillionths, into); FfiConverterUInt16.write(value.cltvExpiryDelta, into); FfiConverterOptionalUInt64.write(value.htlcMinimumMsat, into); FfiConverterOptionalUInt64.write(value.htlcMaximumMsat, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.srcNodeId) + FfiConverterString.allocationSize(value.shortChannelId) + FfiConverterUInt32.allocationSize(value.feesBaseMsat) + FfiConverterUInt32.allocationSize(value.feesProportionalMillionths) + FfiConverterUInt16.allocationSize(value.cltvExpiryDelta) + FfiConverterOptionalUInt64.allocationSize(value.htlcMinimumMsat) + FfiConverterOptionalUInt64.allocationSize(value.htlcMaximumMsat) ); } } return new FFIConverter(); })(); export type Bolt12Invoice = { invoice: string; source: PaymentRequestSource; }; /** * Generated factory for {@link Bolt12Invoice} record objects. */ export const Bolt12Invoice = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link Bolt12Invoice}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Bolt12Invoice}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBolt12Invoice = (() => { type TypeName = Bolt12Invoice; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { invoice: FfiConverterString.read(from), source: FfiConverterTypePaymentRequestSource.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.invoice, into); FfiConverterTypePaymentRequestSource.write(value.source, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.invoice) + FfiConverterTypePaymentRequestSource.allocationSize(value.source) ); } } return new FFIConverter(); })(); export type Bolt12InvoiceDetails = { amountMsat: /*u64*/ bigint; invoice: Bolt12Invoice; }; /** * Generated factory for {@link Bolt12InvoiceDetails} record objects. */ export const Bolt12InvoiceDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< Bolt12InvoiceDetails, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link Bolt12InvoiceDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Bolt12InvoiceDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBolt12InvoiceDetails = (() => { type TypeName = Bolt12InvoiceDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { amountMsat: FfiConverterUInt64.read(from), invoice: FfiConverterTypeBolt12Invoice.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt64.write(value.amountMsat, into); FfiConverterTypeBolt12Invoice.write(value.invoice, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt64.allocationSize(value.amountMsat) + FfiConverterTypeBolt12Invoice.allocationSize(value.invoice) ); } } return new FFIConverter(); })(); export type Bolt12InvoiceRequestDetails = {}; /** * Generated factory for {@link Bolt12InvoiceRequestDetails} record objects. */ export const Bolt12InvoiceRequestDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< Bolt12InvoiceRequestDetails, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link Bolt12InvoiceRequestDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Bolt12InvoiceRequestDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBolt12InvoiceRequestDetails = (() => { type TypeName = Bolt12InvoiceRequestDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return {}; } write(value: TypeName, into: RustBuffer): void {} allocationSize(value: TypeName): number { return 0; } } return new FFIConverter(); })(); export type Bolt12Offer = { offer: string; source: PaymentRequestSource; }; /** * Generated factory for {@link Bolt12Offer} record objects. */ export const Bolt12Offer = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link Bolt12Offer}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Bolt12Offer}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBolt12Offer = (() => { type TypeName = Bolt12Offer; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { offer: FfiConverterString.read(from), source: FfiConverterTypePaymentRequestSource.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.offer, into); FfiConverterTypePaymentRequestSource.write(value.source, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.offer) + FfiConverterTypePaymentRequestSource.allocationSize(value.source) ); } } return new FFIConverter(); })(); export type Bolt12OfferBlindedPath = { blindedHops: Array; }; /** * Generated factory for {@link Bolt12OfferBlindedPath} record objects. */ export const Bolt12OfferBlindedPath = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< Bolt12OfferBlindedPath, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link Bolt12OfferBlindedPath}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Bolt12OfferBlindedPath}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBolt12OfferBlindedPath = (() => { type TypeName = Bolt12OfferBlindedPath; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { blindedHops: FfiConverterArrayString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayString.write(value.blindedHops, into); } allocationSize(value: TypeName): number { return FfiConverterArrayString.allocationSize(value.blindedHops); } } return new FFIConverter(); })(); export type Bolt12OfferDetails = { absoluteExpiry: /*u64*/ bigint | undefined; chains: Array; description: string | undefined; issuer: string | undefined; minAmount: Amount | undefined; offer: Bolt12Offer; paths: Array; signingPubkey: string | undefined; }; /** * Generated factory for {@link Bolt12OfferDetails} record objects. */ export const Bolt12OfferDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link Bolt12OfferDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Bolt12OfferDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBolt12OfferDetails = (() => { type TypeName = Bolt12OfferDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { absoluteExpiry: FfiConverterOptionalUInt64.read(from), chains: FfiConverterArrayString.read(from), description: FfiConverterOptionalString.read(from), issuer: FfiConverterOptionalString.read(from), minAmount: FfiConverterOptionalTypeAmount.read(from), offer: FfiConverterTypeBolt12Offer.read(from), paths: FfiConverterArrayTypeBolt12OfferBlindedPath.read(from), signingPubkey: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalUInt64.write(value.absoluteExpiry, into); FfiConverterArrayString.write(value.chains, into); FfiConverterOptionalString.write(value.description, into); FfiConverterOptionalString.write(value.issuer, into); FfiConverterOptionalTypeAmount.write(value.minAmount, into); FfiConverterTypeBolt12Offer.write(value.offer, into); FfiConverterArrayTypeBolt12OfferBlindedPath.write(value.paths, into); FfiConverterOptionalString.write(value.signingPubkey, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalUInt64.allocationSize(value.absoluteExpiry) + FfiConverterArrayString.allocationSize(value.chains) + FfiConverterOptionalString.allocationSize(value.description) + FfiConverterOptionalString.allocationSize(value.issuer) + FfiConverterOptionalTypeAmount.allocationSize(value.minAmount) + FfiConverterTypeBolt12Offer.allocationSize(value.offer) + FfiConverterArrayTypeBolt12OfferBlindedPath.allocationSize( value.paths ) + FfiConverterOptionalString.allocationSize(value.signingPubkey) ); } } return new FFIConverter(); })(); export type BuildUnsignedBatchPackageRequest = { prepareResponse: PrepareSendBatchResponse; }; /** * Generated factory for {@link BuildUnsignedBatchPackageRequest} record objects. */ export const BuildUnsignedBatchPackageRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< BuildUnsignedBatchPackageRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link BuildUnsignedBatchPackageRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link BuildUnsignedBatchPackageRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBuildUnsignedBatchPackageRequest = (() => { type TypeName = BuildUnsignedBatchPackageRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { prepareResponse: FfiConverterTypePrepareSendBatchResponse.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypePrepareSendBatchResponse.write( value.prepareResponse, into ); } allocationSize(value: TypeName): number { return FfiConverterTypePrepareSendBatchResponse.allocationSize( value.prepareResponse ); } } return new FFIConverter(); })(); export type BuildUnsignedLnurlPayPackageRequest = { prepareResponse: PrepareLnurlPayResponse; }; /** * Generated factory for {@link BuildUnsignedLnurlPayPackageRequest} record objects. */ export const BuildUnsignedLnurlPayPackageRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< BuildUnsignedLnurlPayPackageRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link BuildUnsignedLnurlPayPackageRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link BuildUnsignedLnurlPayPackageRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBuildUnsignedLnurlPayPackageRequest = (() => { type TypeName = BuildUnsignedLnurlPayPackageRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { prepareResponse: FfiConverterTypePrepareLnurlPayResponse.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypePrepareLnurlPayResponse.write( value.prepareResponse, into ); } allocationSize(value: TypeName): number { return FfiConverterTypePrepareLnurlPayResponse.allocationSize( value.prepareResponse ); } } return new FFIConverter(); })(); export type BuildUnsignedTransferPackageRequest = { prepareResponse: PrepareSendPaymentResponse; options: BuildTransferPackageOptions | undefined; }; /** * Generated factory for {@link BuildUnsignedTransferPackageRequest} record objects. */ export const BuildUnsignedTransferPackageRequest = (() => { const defaults = () => ({ options: undefined }); const create = (() => { return uniffiCreateRecord< BuildUnsignedTransferPackageRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link BuildUnsignedTransferPackageRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link BuildUnsignedTransferPackageRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBuildUnsignedTransferPackageRequest = (() => { type TypeName = BuildUnsignedTransferPackageRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { prepareResponse: FfiConverterTypePrepareSendPaymentResponse.read(from), options: FfiConverterOptionalTypeBuildTransferPackageOptions.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypePrepareSendPaymentResponse.write( value.prepareResponse, into ); FfiConverterOptionalTypeBuildTransferPackageOptions.write( value.options, into ); } allocationSize(value: TypeName): number { return ( FfiConverterTypePrepareSendPaymentResponse.allocationSize( value.prepareResponse ) + FfiConverterOptionalTypeBuildTransferPackageOptions.allocationSize( value.options ) ); } } return new FFIConverter(); })(); export type BurnIssuerTokenRequest = { amount: U128; }; /** * Generated factory for {@link BurnIssuerTokenRequest} record objects. */ export const BurnIssuerTokenRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< BurnIssuerTokenRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link BurnIssuerTokenRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link BurnIssuerTokenRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBurnIssuerTokenRequest = (() => { type TypeName = BurnIssuerTokenRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { amount: FfiConverterTypeu128.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeu128.write(value.amount, into); } allocationSize(value: TypeName): number { return FfiConverterTypeu128.allocationSize(value.amount); } } return new FFIConverter(); })(); /** * Response containing a URL to complete the Bitcoin purchase */ export type BuyBitcoinResponse = { /** * The URL to open in a browser to complete the purchase */ url: string; }; /** * Generated factory for {@link BuyBitcoinResponse} record objects. */ export const BuyBitcoinResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link BuyBitcoinResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link BuyBitcoinResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeBuyBitcoinResponse = (() => { type TypeName = BuyBitcoinResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { url: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.url, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.url); } } return new FFIConverter(); })(); export type CheckLightningAddressRequest = { username: string; }; /** * Generated factory for {@link CheckLightningAddressRequest} record objects. */ export const CheckLightningAddressRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< CheckLightningAddressRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link CheckLightningAddressRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link CheckLightningAddressRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeCheckLightningAddressRequest = (() => { type TypeName = CheckLightningAddressRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { username: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.username, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.username); } } return new FFIConverter(); })(); export type CheckMessageRequest = { /** * The message that was signed */ message: string; /** * The public key that signed the message */ pubkey: string; /** * The DER or compact hex encoded signature */ signature: string; }; /** * Generated factory for {@link CheckMessageRequest} record objects. */ export const CheckMessageRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link CheckMessageRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link CheckMessageRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeCheckMessageRequest = (() => { type TypeName = CheckMessageRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { message: FfiConverterString.read(from), pubkey: FfiConverterString.read(from), signature: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.message, into); FfiConverterString.write(value.pubkey, into); FfiConverterString.write(value.signature, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.message) + FfiConverterString.allocationSize(value.pubkey) + FfiConverterString.allocationSize(value.signature) ); } } return new FFIConverter(); })(); export type CheckMessageResponse = { isValid: boolean; }; /** * Generated factory for {@link CheckMessageResponse} record objects. */ export const CheckMessageResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< CheckMessageResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link CheckMessageResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link CheckMessageResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeCheckMessageResponse = (() => { type TypeName = CheckMessageResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { isValid: FfiConverterBool.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterBool.write(value.isValid, into); } allocationSize(value: TypeName): number { return FfiConverterBool.allocationSize(value.isValid); } } return new FFIConverter(); })(); /** * Request for `check_unilateral_exit`: the exit you kept from a previous * `unilateral_exit`, as you last stored it. */ export type CheckUnilateralExitRequest = { exit: UnilateralExitResponse; }; /** * Generated factory for {@link CheckUnilateralExitRequest} record objects. */ export const CheckUnilateralExitRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< CheckUnilateralExitRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link CheckUnilateralExitRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link CheckUnilateralExitRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeCheckUnilateralExitRequest = (() => { type TypeName = CheckUnilateralExitRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { exit: FfiConverterTypeUnilateralExitResponse.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeUnilateralExitResponse.write(value.exit, into); } allocationSize(value: TypeName): number { return FfiConverterTypeUnilateralExitResponse.allocationSize(value.exit); } } return new FFIConverter(); })(); /** * Result of `check_unilateral_exit`: the same exit, read back against the * chain. */ export type CheckUnilateralExitResponse = { /** * The exit with each transaction's status brought up to date. Store it in * place of the copy you passed in. */ exit: UnilateralExitResponse; verdict: UnilateralExitVerdict; }; /** * Generated factory for {@link CheckUnilateralExitResponse} record objects. */ export const CheckUnilateralExitResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< CheckUnilateralExitResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link CheckUnilateralExitResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link CheckUnilateralExitResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeCheckUnilateralExitResponse = (() => { type TypeName = CheckUnilateralExitResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { exit: FfiConverterTypeUnilateralExitResponse.read(from), verdict: FfiConverterTypeUnilateralExitVerdict.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeUnilateralExitResponse.write(value.exit, into); FfiConverterTypeUnilateralExitVerdict.write(value.verdict, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeUnilateralExitResponse.allocationSize(value.exit) + FfiConverterTypeUnilateralExitVerdict.allocationSize(value.verdict) ); } } return new FFIConverter(); })(); /** * What one way of claiming a deposit costs. */ export type ClaimDepositQuote = { /** * The depth this becomes claimable at, as a total confirmation count on the * deposit tx and not a number still to wait. A deposit already at or past * this depth can be claimed. */ confirmationsRequired: /*u32*/ number; /** * What reaches the balance. */ creditAmountSats: /*u64*/ bigint; /** * The deposit value less the credit. */ feeSats: /*u64*/ bigint; /** * `fee_sats` as a fee rate over the claim transaction, so it is comparable * with a max fee expressed as a rate. */ feeRateSatPerVbyte: /*u64*/ bigint; /** * The provider would not quote this yet, so the fee is derived from current * on-chain fees and the real one may differ. */ isEstimate: boolean; }; /** * Generated factory for {@link ClaimDepositQuote} record objects. */ export const ClaimDepositQuote = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ClaimDepositQuote}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ClaimDepositQuote}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeClaimDepositQuote = (() => { type TypeName = ClaimDepositQuote; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { confirmationsRequired: FfiConverterUInt32.read(from), creditAmountSats: FfiConverterUInt64.read(from), feeSats: FfiConverterUInt64.read(from), feeRateSatPerVbyte: FfiConverterUInt64.read(from), isEstimate: FfiConverterBool.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt32.write(value.confirmationsRequired, into); FfiConverterUInt64.write(value.creditAmountSats, into); FfiConverterUInt64.write(value.feeSats, into); FfiConverterUInt64.write(value.feeRateSatPerVbyte, into); FfiConverterBool.write(value.isEstimate, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt32.allocationSize(value.confirmationsRequired) + FfiConverterUInt64.allocationSize(value.creditAmountSats) + FfiConverterUInt64.allocationSize(value.feeSats) + FfiConverterUInt64.allocationSize(value.feeRateSatPerVbyte) + FfiConverterBool.allocationSize(value.isEstimate) ); } } return new FFIConverter(); })(); export type ClaimDepositRequest = { txid: string; vout: /*u32*/ number; /** * Caps what the claim may cost. A deposit that has not matured is claimed * instantly when the provider's spread fits within this, so the same ceiling * governs both. Falls back to the configured max deposit claim fee. */ maxFee: MaxFee | undefined; }; /** * Generated factory for {@link ClaimDepositRequest} record objects. */ export const ClaimDepositRequest = (() => { const defaults = () => ({ maxFee: undefined }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ClaimDepositRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ClaimDepositRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeClaimDepositRequest = (() => { type TypeName = ClaimDepositRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { txid: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), maxFee: FfiConverterOptionalTypeMaxFee.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.txid, into); FfiConverterUInt32.write(value.vout, into); FfiConverterOptionalTypeMaxFee.write(value.maxFee, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.txid) + FfiConverterUInt32.allocationSize(value.vout) + FfiConverterOptionalTypeMaxFee.allocationSize(value.maxFee) ); } } return new FFIConverter(); })(); export type ClaimDepositResponse = { /** * The settled claim payment, present when the deposit was claimed at maturity, * which completes synchronously. Absent when it was claimed before maturity, * whose transfer settles asynchronously: watch for the payment via events or * `list_payments`. Which of the two happens follows from the deposit's maturity * and the fee ceiling, not from anything the caller asks for, so treat the * payment as optional on every claim. */ payment: Payment | undefined; }; /** * Generated factory for {@link ClaimDepositResponse} record objects. */ export const ClaimDepositResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ClaimDepositResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ClaimDepositResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ClaimDepositResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeClaimDepositResponse = (() => { type TypeName = ClaimDepositResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { payment: FfiConverterOptionalTypePayment.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalTypePayment.write(value.payment, into); } allocationSize(value: TypeName): number { return FfiConverterOptionalTypePayment.allocationSize(value.payment); } } return new FFIConverter(); })(); export type ClaimHtlcPaymentRequest = { preimage: string; }; /** * Generated factory for {@link ClaimHtlcPaymentRequest} record objects. */ export const ClaimHtlcPaymentRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ClaimHtlcPaymentRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ClaimHtlcPaymentRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ClaimHtlcPaymentRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeClaimHtlcPaymentRequest = (() => { type TypeName = ClaimHtlcPaymentRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { preimage: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.preimage, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.preimage); } } return new FFIConverter(); })(); export type ClaimHtlcPaymentResponse = { payment: Payment; }; /** * Generated factory for {@link ClaimHtlcPaymentResponse} record objects. */ export const ClaimHtlcPaymentResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ClaimHtlcPaymentResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ClaimHtlcPaymentResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ClaimHtlcPaymentResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeClaimHtlcPaymentResponse = (() => { type TypeName = ClaimHtlcPaymentResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { payment: FfiConverterTypePayment.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypePayment.write(value.payment, into); } allocationSize(value: TypeName): number { return FfiConverterTypePayment.allocationSize(value.payment); } } return new FFIConverter(); })(); /** * Request for [`BreezSdk::claim_lightning_address_transfer`]. Called by the * *new owner* to complete the takeover using the authorization produced by * the current owner. */ export type ClaimTransferRequest = { /** * Authorization produced by the current owner via * [`BreezSdk::authorize_lightning_address_transfer`]. */ authorization: TransferAuthorization; /** * Description for the address. Defaults to `"Pay to {username}@{domain}"`. */ description: string | undefined; }; /** * Generated factory for {@link ClaimTransferRequest} record objects. */ export const ClaimTransferRequest = (() => { const defaults = () => ({ description: undefined }); const create = (() => { return uniffiCreateRecord< ClaimTransferRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ClaimTransferRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ClaimTransferRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeClaimTransferRequest = (() => { type TypeName = ClaimTransferRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { authorization: FfiConverterTypeTransferAuthorization.read(from), description: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeTransferAuthorization.write(value.authorization, into); FfiConverterOptionalString.write(value.description, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeTransferAuthorization.allocationSize( value.authorization ) + FfiConverterOptionalString.allocationSize(value.description) ); } } return new FFIConverter(); })(); export type Config = { apiKey: string | undefined; network: Network; syncIntervalSecs: /*u32*/ number; /** * The maximum fee that can be paid to claim an on-chain deposit. It also caps * the provider's spread for crediting a deposit before it matures, so raising * it is what allows deposits to be claimed early. Unset disables claiming * rather than allowing any fee. */ maxDepositClaimFee: MaxFee | undefined; /** * The domain used for receiving through lnurl-pay and lightning address. */ lnurlDomain: string | undefined; /** * When this is set to `true` we will prefer to use spark payments over * lightning when sending and receiving. This has the benefit of lower fees * but is at the cost of privacy. */ preferSparkOverLightning: boolean; /** * Whether the data needed to exit a payment unilaterally, without the Spark * operators, is collected as funds arrive. Collection runs in the background, * and a sync waits for a collection pass before returning, so syncing is how * to make that happen at a moment of your choosing. A leaf the operators * cannot complete stays un-exitable until a later attempt succeeds. * * Leave this on unless bandwidth matters more than being able to recover funds * when the operators are unreachable. With it off, chains are only collected * when an exit is prepared, which needs the operators reachable at that * moment: a leaf cannot be exited without them until one is collected. * * Default value is true. */ exitChainAutoFetchEnabled: boolean; /** * A set of external input parsers that are used by [`BreezSdk::parse`](crate::sdk::BreezSdk::parse) when the input * is not recognized. See [`ExternalInputParser`] for more details on how to configure * external parsing. */ externalInputParsers: Array | undefined; /** * The SDK includes some default external input parsers * ([`DEFAULT_EXTERNAL_INPUT_PARSERS`]). * Set this to false in order to prevent their use. */ useDefaultExternalInputParsers: boolean; /** * Url to use for the real-time sync server. Defaults to the Breez real-time sync server. */ realTimeSyncServerUrl: string | undefined; /** * Whether the Spark private mode is enabled by default. * * If set to true, the Spark private mode will be enabled on the first * initialization of the SDK. If set to false, no changes will be made * to the Spark private mode. * * This default is only auto-applied when `background_tasks_enabled` is * `true`. When `background_tasks_enabled` is `false`, the SDK does not * touch the Spark private mode on startup; call `update_user_settings` * with `spark_private_mode_enabled` set as needed on a one-time setup * pass. */ privateEnabledDefault: boolean; /** * Configuration for leaf optimization. * * Leaf optimization controls the denominations of leaves that are held in the wallet. * Fewer, bigger leaves allow for more funds to be exited unilaterally. * More leaves allow payments to be made without needing a swap, reducing payment latency. */ leafOptimizationConfig: LeafOptimizationConfig; /** * Configuration for token-output optimization. * * Token-output optimization controls automatic consolidation of a token's * available outputs. Keeping the output set small reduces transaction size, * while keeping enough distinct outputs preserves concurrency for parallel * sends. */ tokenOptimizationConfig: TokenOptimizationConfig; /** * Configuration for automatic conversion of Bitcoin to stable tokens. * * When set, received sats will be automatically converted to the specified token * once the balance exceeds the threshold. */ stableBalanceConfig: StableBalanceConfig | undefined; /** * Maximum number of concurrent transfer claims. * * Default is 4. Increase for server environments with high incoming payment volume. */ maxConcurrentClaims: /*u32*/ number; /** * Optional custom Spark environment configuration. * * When set, overrides the default Spark operator pool, service provider, * threshold, and token settings. Use this to connect to alternative Spark * deployments (e.g. dev/staging environments). */ sparkConfig: SparkConfig | undefined; /** * Master switch for per-instance background services. * * When `true` (default), the SDK runs its standard background work: * periodic sync, lightning-address recovery, private-mode initialization, * the leaf and token-output optimizers, the Spark server-event * subscription, and the real-time sync client (when * `real_time_sync_server_url` is set). * * When `false`, **no background service is started**, regardless of any * other setting on this config. This is intended for multi-tenant server * deployments where the host application orchestrates sync and claims * explicitly and receives events via webhooks. Use * `default_server_config` to get this preset. * * Explicit operations (`sync_wallet`, `claim_deposit`, * `list_unclaimed_deposits`, `refund_deposit`, * `refund_pending_conversions`, leaf/token optimization, etc.) work * regardless of this flag. * * When `false`, the SDK rejects builds where fields whose backing * service is gated off are still in their active shape: * `stable_balance_config` must be `None`, `real_time_sync_server_url` * must be `None`, and `optimization_config.auto_enabled` must be `false`. * `default_server_config` already sets these compatible values. */ backgroundTasksEnabled: boolean; /** * Routes the connections the SDK opens through a SOCKS5 proxy. * * Covers HTTP and gRPC alike, and resolves hostnames at the proxy so no * DNS query leaks the destination. `None` (default) connects directly. * * When an [`SdkContext`](crate::SdkContext) is supplied to the builder, * its proxy must match this one: the context owns the shared clients, so * a disagreement would mean part of the traffic bypassed the proxy. */ proxy: ProxyConfig | undefined; /** * Configuration for cross-chain sends via Orchestra and Boltz. * * `Some(_)` enables cross-chain sends (sats to USDT on external chains). * `None` (default) disables them entirely. Opt in by setting this to * [`CrossChainConfig::default`] (or a customized value): the providers * run background work (e.g. web sockets), so enabling is left to the * caller. Cross-chain sends are only supported on mainnet. */ crossChainConfig: CrossChainConfig | undefined; }; /** * Generated factory for {@link Config} record objects. */ export const Config = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link Config}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Config}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeConfig = (() => { type TypeName = Config; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { apiKey: FfiConverterOptionalString.read(from), network: FfiConverterTypeNetwork.read(from), syncIntervalSecs: FfiConverterUInt32.read(from), maxDepositClaimFee: FfiConverterOptionalTypeMaxFee.read(from), lnurlDomain: FfiConverterOptionalString.read(from), preferSparkOverLightning: FfiConverterBool.read(from), exitChainAutoFetchEnabled: FfiConverterBool.read(from), externalInputParsers: FfiConverterOptionalArrayTypeExternalInputParser.read(from), useDefaultExternalInputParsers: FfiConverterBool.read(from), realTimeSyncServerUrl: FfiConverterOptionalString.read(from), privateEnabledDefault: FfiConverterBool.read(from), leafOptimizationConfig: FfiConverterTypeLeafOptimizationConfig.read(from), tokenOptimizationConfig: FfiConverterTypeTokenOptimizationConfig.read(from), stableBalanceConfig: FfiConverterOptionalTypeStableBalanceConfig.read(from), maxConcurrentClaims: FfiConverterUInt32.read(from), sparkConfig: FfiConverterOptionalTypeSparkConfig.read(from), backgroundTasksEnabled: FfiConverterBool.read(from), proxy: FfiConverterOptionalTypeProxyConfig.read(from), crossChainConfig: FfiConverterOptionalTypeCrossChainConfig.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.apiKey, into); FfiConverterTypeNetwork.write(value.network, into); FfiConverterUInt32.write(value.syncIntervalSecs, into); FfiConverterOptionalTypeMaxFee.write(value.maxDepositClaimFee, into); FfiConverterOptionalString.write(value.lnurlDomain, into); FfiConverterBool.write(value.preferSparkOverLightning, into); FfiConverterBool.write(value.exitChainAutoFetchEnabled, into); FfiConverterOptionalArrayTypeExternalInputParser.write( value.externalInputParsers, into ); FfiConverterBool.write(value.useDefaultExternalInputParsers, into); FfiConverterOptionalString.write(value.realTimeSyncServerUrl, into); FfiConverterBool.write(value.privateEnabledDefault, into); FfiConverterTypeLeafOptimizationConfig.write( value.leafOptimizationConfig, into ); FfiConverterTypeTokenOptimizationConfig.write( value.tokenOptimizationConfig, into ); FfiConverterOptionalTypeStableBalanceConfig.write( value.stableBalanceConfig, into ); FfiConverterUInt32.write(value.maxConcurrentClaims, into); FfiConverterOptionalTypeSparkConfig.write(value.sparkConfig, into); FfiConverterBool.write(value.backgroundTasksEnabled, into); FfiConverterOptionalTypeProxyConfig.write(value.proxy, into); FfiConverterOptionalTypeCrossChainConfig.write( value.crossChainConfig, into ); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.apiKey) + FfiConverterTypeNetwork.allocationSize(value.network) + FfiConverterUInt32.allocationSize(value.syncIntervalSecs) + FfiConverterOptionalTypeMaxFee.allocationSize( value.maxDepositClaimFee ) + FfiConverterOptionalString.allocationSize(value.lnurlDomain) + FfiConverterBool.allocationSize(value.preferSparkOverLightning) + FfiConverterBool.allocationSize(value.exitChainAutoFetchEnabled) + FfiConverterOptionalArrayTypeExternalInputParser.allocationSize( value.externalInputParsers ) + FfiConverterBool.allocationSize(value.useDefaultExternalInputParsers) + FfiConverterOptionalString.allocationSize(value.realTimeSyncServerUrl) + FfiConverterBool.allocationSize(value.privateEnabledDefault) + FfiConverterTypeLeafOptimizationConfig.allocationSize( value.leafOptimizationConfig ) + FfiConverterTypeTokenOptimizationConfig.allocationSize( value.tokenOptimizationConfig ) + FfiConverterOptionalTypeStableBalanceConfig.allocationSize( value.stableBalanceConfig ) + FfiConverterUInt32.allocationSize(value.maxConcurrentClaims) + FfiConverterOptionalTypeSparkConfig.allocationSize(value.sparkConfig) + FfiConverterBool.allocationSize(value.backgroundTasksEnabled) + FfiConverterOptionalTypeProxyConfig.allocationSize(value.proxy) + FfiConverterOptionalTypeCrossChainConfig.allocationSize( value.crossChainConfig ) ); } } return new FFIConverter(); })(); /** * A node of the exit tree that is already on-chain. */ export type ConfirmedExitNode = { nodeId: string; confirmedBy: ExitNodeConfirmation; /** * The block it is in, where that is known. Unset for a node put in a block * by a descendant's confirmation rather than read directly. */ blockHeight: /*u32*/ number | undefined; }; /** * Generated factory for {@link ConfirmedExitNode} record objects. */ export const ConfirmedExitNode = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ConfirmedExitNode}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ConfirmedExitNode}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeConfirmedExitNode = (() => { type TypeName = ConfirmedExitNode; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { nodeId: FfiConverterString.read(from), confirmedBy: FfiConverterTypeExitNodeConfirmation.read(from), blockHeight: FfiConverterOptionalUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.nodeId, into); FfiConverterTypeExitNodeConfirmation.write(value.confirmedBy, into); FfiConverterOptionalUInt32.write(value.blockHeight, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.nodeId) + FfiConverterTypeExitNodeConfirmation.allocationSize(value.confirmedBy) + FfiConverterOptionalUInt32.allocationSize(value.blockHeight) ); } } return new FFIConverter(); })(); export type ConnectRequest = { config: Config; seed: Seed; storageDir: string; }; /** * Generated factory for {@link ConnectRequest} record objects. */ export const ConnectRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ConnectRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ConnectRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeConnectRequest = (() => { type TypeName = ConnectRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { config: FfiConverterTypeConfig.read(from), seed: FfiConverterTypeSeed.read(from), storageDir: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeConfig.write(value.config, into); FfiConverterTypeSeed.write(value.seed, into); FfiConverterString.write(value.storageDir, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeConfig.allocationSize(value.config) + FfiConverterTypeSeed.allocationSize(value.seed) + FfiConverterString.allocationSize(value.storageDir) ); } } return new FFIConverter(); })(); /** * Request shape for [`PasskeyClient::connect_with_passkey`]. */ export type ConnectWithPasskeyRequest = { /** * Wallet label. Defaults to the configured default label when * `None`. Used both for the silent sign-in attempt and, if it * fast-fails, for the fallback registration. */ label: string | undefined; /** * Optional credential IDs to restrict the sign-in attempt to * (reauthentication path). A non-empty list runs the modal sign-in * rather than the immediate probe (a pin means a credential is already * known). See [`SignInRequest::allow_credentials`]. Ignored on the * fallback registration path. */ allowCredentials: Array | undefined; /** * Optional already-registered credential IDs to surface * duplicates on the fallback registration path. See * [`RegisterRequest::exclude_credentials`]. Ignored on the * silent sign-in attempt. */ excludeCredentials: Array | undefined; }; /** * Generated factory for {@link ConnectWithPasskeyRequest} record objects. */ export const ConnectWithPasskeyRequest = (() => { const defaults = () => ({ label: undefined, allowCredentials: undefined, excludeCredentials: undefined, }); const create = (() => { return uniffiCreateRecord< ConnectWithPasskeyRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ConnectWithPasskeyRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ConnectWithPasskeyRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeConnectWithPasskeyRequest = (() => { type TypeName = ConnectWithPasskeyRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { label: FfiConverterOptionalString.read(from), allowCredentials: FfiConverterOptionalArrayArrayBuffer.read(from), excludeCredentials: FfiConverterOptionalArrayArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.label, into); FfiConverterOptionalArrayArrayBuffer.write(value.allowCredentials, into); FfiConverterOptionalArrayArrayBuffer.write( value.excludeCredentials, into ); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.label) + FfiConverterOptionalArrayArrayBuffer.allocationSize( value.allowCredentials ) + FfiConverterOptionalArrayArrayBuffer.allocationSize( value.excludeCredentials ) ); } } return new FFIConverter(); })(); /** * Response from [`PasskeyClient::connect_with_passkey`]. * * `credential` carries whichever credential signed in or was * registered, when the provider surfaces it. The register path also * populates the attestation fields (`aaguid`, `backup_eligible`); the * sign-in path sets only `credential_id`. * * `labels` is the user's discovered label set when `request.label` was * `None` (the returning-user multi-wallet case): `wallet` is the default * label, and a host showing more than one entry lets the user pick * another via [`PasskeyClient::sign_in`]. Empty on the register path (a * new user has no other labels) and when a specific label was requested. */ export type ConnectWithPasskeyResponse = { wallet: Wallet; credential: PasskeyCredential | undefined; labels: Array; }; /** * Generated factory for {@link ConnectWithPasskeyResponse} record objects. */ export const ConnectWithPasskeyResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ConnectWithPasskeyResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ConnectWithPasskeyResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ConnectWithPasskeyResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeConnectWithPasskeyResponse = (() => { type TypeName = ConnectWithPasskeyResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { wallet: FfiConverterTypeWallet.read(from), credential: FfiConverterOptionalTypePasskeyCredential.read(from), labels: FfiConverterArrayString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeWallet.write(value.wallet, into); FfiConverterOptionalTypePasskeyCredential.write(value.credential, into); FfiConverterArrayString.write(value.labels, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeWallet.allocationSize(value.wallet) + FfiConverterOptionalTypePasskeyCredential.allocationSize( value.credential ) + FfiConverterArrayString.allocationSize(value.labels) ); } } return new FFIConverter(); })(); /** * Request object for connecting to the Spark network using an external signer. * * This allows using a custom signer implementation instead of providing a seed directly. */ export type ConnectWithSignerRequest = { config: Config; /** * External signer for non-Spark SDK signing (LNURL-auth, sync, message * signing, ECIES). */ breezSigner: ExternalBreezSigner; /** * External high-level Spark signer for the Spark wallet flows. */ sparkSigner: ExternalSparkSigner; storageDir: string; }; /** * Generated factory for {@link ConnectWithSignerRequest} record objects. */ export const ConnectWithSignerRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ConnectWithSignerRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ConnectWithSignerRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ConnectWithSignerRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeConnectWithSignerRequest = (() => { type TypeName = ConnectWithSignerRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { config: FfiConverterTypeConfig.read(from), breezSigner: FfiConverterTypeExternalBreezSigner.read(from), sparkSigner: FfiConverterTypeExternalSparkSigner.read(from), storageDir: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeConfig.write(value.config, into); FfiConverterTypeExternalBreezSigner.write(value.breezSigner, into); FfiConverterTypeExternalSparkSigner.write(value.sparkSigner, into); FfiConverterString.write(value.storageDir, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeConfig.allocationSize(value.config) + FfiConverterTypeExternalBreezSigner.allocationSize(value.breezSigner) + FfiConverterTypeExternalSparkSigner.allocationSize(value.sparkSigner) + FfiConverterString.allocationSize(value.storageDir) ); } } return new FFIConverter(); })(); /** * Request object for connecting to the Spark network using a signing-only * external signer. * * Use this instead of [`ConnectWithSignerRequest`] for a signer that can't * perform the SDK's local ECIES/HMAC operations (for example a * policy-restricted enclave). The SDK keeps session tokens in plaintext and * disables the features that rely on ECIES/HMAC. */ export type ConnectWithSigningOnlySignerRequest = { config: Config; /** * Signing-only external signer for non-Spark SDK signing. */ breezSigner: ExternalSigningSigner; /** * External high-level Spark signer for the Spark wallet flows. */ sparkSigner: ExternalSparkSigner; storageDir: string; }; /** * Generated factory for {@link ConnectWithSigningOnlySignerRequest} record objects. */ export const ConnectWithSigningOnlySignerRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ConnectWithSigningOnlySignerRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ConnectWithSigningOnlySignerRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ConnectWithSigningOnlySignerRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeConnectWithSigningOnlySignerRequest = (() => { type TypeName = ConnectWithSigningOnlySignerRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { config: FfiConverterTypeConfig.read(from), breezSigner: FfiConverterTypeExternalSigningSigner.read(from), sparkSigner: FfiConverterTypeExternalSparkSigner.read(from), storageDir: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeConfig.write(value.config, into); FfiConverterTypeExternalSigningSigner.write(value.breezSigner, into); FfiConverterTypeExternalSparkSigner.write(value.sparkSigner, into); FfiConverterString.write(value.storageDir, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeConfig.allocationSize(value.config) + FfiConverterTypeExternalSigningSigner.allocationSize( value.breezSigner ) + FfiConverterTypeExternalSparkSigner.allocationSize(value.sparkSigner) + FfiConverterString.allocationSize(value.storageDir) ); } } return new FFIConverter(); })(); /** * A contact entry containing a name and payment identifier. */ export type Contact = { id: string; name: string; /** * A Lightning address (user@domain). */ paymentIdentifier: string; createdAt: /*u64*/ bigint; updatedAt: /*u64*/ bigint; }; /** * Generated factory for {@link Contact} record objects. */ export const Contact = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link Contact}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Contact}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeContact = (() => { type TypeName = Contact; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { id: FfiConverterString.read(from), name: FfiConverterString.read(from), paymentIdentifier: FfiConverterString.read(from), createdAt: FfiConverterUInt64.read(from), updatedAt: FfiConverterUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.id, into); FfiConverterString.write(value.name, into); FfiConverterString.write(value.paymentIdentifier, into); FfiConverterUInt64.write(value.createdAt, into); FfiConverterUInt64.write(value.updatedAt, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.id) + FfiConverterString.allocationSize(value.name) + FfiConverterString.allocationSize(value.paymentIdentifier) + FfiConverterUInt64.allocationSize(value.createdAt) + FfiConverterUInt64.allocationSize(value.updatedAt) ); } } return new FFIConverter(); })(); /** * A single conversion in a payment's conversion chain. */ export type Conversion = { /** * The provider that performed this conversion */ provider: ConversionProvider; /** * Status of this specific conversion step */ status: ConversionStatus; /** * Source side of the conversion */ from: ConversionSide; /** * Destination side of the conversion */ to: ConversionSide; /** * Reason the conversion amount was adjusted, if applicable (AMM only) */ amountAdjustment: AmountAdjustmentReason | undefined; }; /** * Generated factory for {@link Conversion} record objects. */ export const Conversion = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link Conversion}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Conversion}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeConversion = (() => { type TypeName = Conversion; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { provider: FfiConverterTypeConversionProvider.read(from), status: FfiConverterTypeConversionStatus.read(from), from: FfiConverterTypeConversionSide.read(from), to: FfiConverterTypeConversionSide.read(from), amountAdjustment: FfiConverterOptionalTypeAmountAdjustmentReason.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeConversionProvider.write(value.provider, into); FfiConverterTypeConversionStatus.write(value.status, into); FfiConverterTypeConversionSide.write(value.from, into); FfiConverterTypeConversionSide.write(value.to, into); FfiConverterOptionalTypeAmountAdjustmentReason.write( value.amountAdjustment, into ); } allocationSize(value: TypeName): number { return ( FfiConverterTypeConversionProvider.allocationSize(value.provider) + FfiConverterTypeConversionStatus.allocationSize(value.status) + FfiConverterTypeConversionSide.allocationSize(value.from) + FfiConverterTypeConversionSide.allocationSize(value.to) + FfiConverterOptionalTypeAmountAdjustmentReason.allocationSize( value.amountAdjustment ) ); } } return new FFIConverter(); })(); /** * The asset on a [`ConversionSide`] — groups the ticker, stable identifier, * and decimals that always travel together. */ export type ConversionAsset = { /** * Ticker (e.g. `"BTC"`, `"USDB"`, `"USDC"`, `"USDT"`). Tickers alone * are ambiguous across chains — pair with [`Self::identifier`] for a * hard match. */ ticker: string; /** * Stable identifier: a Spark token identifier for Spark tokens, or a * contract/mint address for cross-chain assets. `None` for BTC/sats. */ identifier: string | undefined; /** * Number of decimals for the asset. * `0` for BTC/sats sides (amount is already in the smallest unit, * so no scaling is needed); non-zero for token assets (e.g. `6` for * USDC/USDT/USDB). */ decimals: /*u32*/ number; }; /** * Generated factory for {@link ConversionAsset} record objects. */ export const ConversionAsset = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ConversionAsset}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ConversionAsset}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeConversionAsset = (() => { type TypeName = ConversionAsset; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { ticker: FfiConverterString.read(from), identifier: FfiConverterOptionalString.read(from), decimals: FfiConverterUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.ticker, into); FfiConverterOptionalString.write(value.identifier, into); FfiConverterUInt32.write(value.decimals, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.ticker) + FfiConverterOptionalString.allocationSize(value.identifier) + FfiConverterUInt32.allocationSize(value.decimals) ); } } return new FFIConverter(); })(); /** * Outlines the steps involved in one or more conversions on a payment. * * Built progressively: `status` is available immediately from payment metadata, * while `conversions` are enriched later from child payments and conversion info. */ export type ConversionDetails = { /** * Overall status of the conversion (persisted in storage) */ status: ConversionStatus; /** * Ordered list of conversion steps. For sends: [AMM, cross-chain]. * For receives: [cross-chain, AMM]. Rebuilt on retrieval, not persisted. */ conversions: Array; }; /** * Generated factory for {@link ConversionDetails} record objects. */ export const ConversionDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ConversionDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ConversionDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeConversionDetails = (() => { type TypeName = ConversionDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { status: FfiConverterTypeConversionStatus.read(from), conversions: FfiConverterArrayTypeConversion.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeConversionStatus.write(value.status, into); FfiConverterArrayTypeConversion.write(value.conversions, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeConversionStatus.allocationSize(value.status) + FfiConverterArrayTypeConversion.allocationSize(value.conversions) ); } } return new FFIConverter(); })(); /** * Response from estimating a conversion, used when preparing a payment that requires conversion */ export type ConversionEstimate = { /** * The conversion options used for the estimate */ options: ConversionOptions; /** * The input amount for the conversion. * For `FromBitcoin`: the satoshis required to produce the desired token output. * For `ToBitcoin`: the token amount being converted. */ amountIn: U128; /** * The estimated output amount from the conversion. * For `FromBitcoin`: the estimated token amount received. * For `ToBitcoin`: the estimated satoshis received. */ amountOut: U128; /** * The fee estimated for the conversion. * Denominated in satoshis if converting from Bitcoin, otherwise in the token base units. */ fee: U128; /** * The reason the conversion amount was adjusted, if applicable. */ amountAdjustment: AmountAdjustmentReason | undefined; }; /** * Generated factory for {@link ConversionEstimate} record objects. */ export const ConversionEstimate = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ConversionEstimate}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ConversionEstimate}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeConversionEstimate = (() => { type TypeName = ConversionEstimate; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { options: FfiConverterTypeConversionOptions.read(from), amountIn: FfiConverterTypeu128.read(from), amountOut: FfiConverterTypeu128.read(from), fee: FfiConverterTypeu128.read(from), amountAdjustment: FfiConverterOptionalTypeAmountAdjustmentReason.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeConversionOptions.write(value.options, into); FfiConverterTypeu128.write(value.amountIn, into); FfiConverterTypeu128.write(value.amountOut, into); FfiConverterTypeu128.write(value.fee, into); FfiConverterOptionalTypeAmountAdjustmentReason.write( value.amountAdjustment, into ); } allocationSize(value: TypeName): number { return ( FfiConverterTypeConversionOptions.allocationSize(value.options) + FfiConverterTypeu128.allocationSize(value.amountIn) + FfiConverterTypeu128.allocationSize(value.amountOut) + FfiConverterTypeu128.allocationSize(value.fee) + FfiConverterOptionalTypeAmountAdjustmentReason.allocationSize( value.amountAdjustment ) ); } } return new FFIConverter(); })(); /** * Options for conversion when fulfilling a payment. When set, the SDK will * perform a conversion before fulfilling the payment. If not set, the payment * will only be fulfilled if the wallet has sufficient balance of the required asset. */ export type ConversionOptions = { /** * The type of conversion to perform when fulfilling the payment */ conversionType: ConversionType; /** * The optional maximum slippage in basis points (1/100 of a percent) allowed when * a conversion is needed to fulfill the payment. Defaults to 10 bps (0.1%) if not set. * The conversion will fail if the actual amount received is less than * `estimated_amount * (1 - max_slippage_bps / 10_000)`. */ maxSlippageBps: /*u32*/ number | undefined; /** * The optional timeout in seconds to wait for the conversion to complete * when fulfilling the payment. This timeout only concerns waiting for the received * payment of the conversion. If the timeout is reached before the conversion * is complete, the payment will fail. Defaults to 30 seconds if not set. */ completionTimeoutSecs: /*u32*/ number | undefined; }; /** * Generated factory for {@link ConversionOptions} record objects. */ export const ConversionOptions = (() => { const defaults = () => ({ maxSlippageBps: undefined, completionTimeoutSecs: undefined, }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ConversionOptions}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ConversionOptions}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeConversionOptions = (() => { type TypeName = ConversionOptions; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { conversionType: FfiConverterTypeConversionType.read(from), maxSlippageBps: FfiConverterOptionalUInt32.read(from), completionTimeoutSecs: FfiConverterOptionalUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeConversionType.write(value.conversionType, into); FfiConverterOptionalUInt32.write(value.maxSlippageBps, into); FfiConverterOptionalUInt32.write(value.completionTimeoutSecs, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeConversionType.allocationSize(value.conversionType) + FfiConverterOptionalUInt32.allocationSize(value.maxSlippageBps) + FfiConverterOptionalUInt32.allocationSize(value.completionTimeoutSecs) ); } } return new FFIConverter(); })(); /** * One side (source or destination) of a conversion. */ export type ConversionSide = { /** * The chain or network for this side. */ chain: ConversionChain; /** * The asset being converted on this side. */ asset: ConversionAsset; /** * Amount in base units (satoshis or token base units) */ amount: U128; /** * Fee in the same base units */ fee: U128; }; /** * Generated factory for {@link ConversionSide} record objects. */ export const ConversionSide = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ConversionSide}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ConversionSide}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeConversionSide = (() => { type TypeName = ConversionSide; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { chain: FfiConverterTypeConversionChain.read(from), asset: FfiConverterTypeConversionAsset.read(from), amount: FfiConverterTypeu128.read(from), fee: FfiConverterTypeu128.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeConversionChain.write(value.chain, into); FfiConverterTypeConversionAsset.write(value.asset, into); FfiConverterTypeu128.write(value.amount, into); FfiConverterTypeu128.write(value.fee, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeConversionChain.allocationSize(value.chain) + FfiConverterTypeConversionAsset.allocationSize(value.asset) + FfiConverterTypeu128.allocationSize(value.amount) + FfiConverterTypeu128.allocationSize(value.fee) ); } } return new FFIConverter(); })(); export type CreateIssuerTokenRequest = { name: string; ticker: string; decimals: /*u32*/ number; isFreezable: boolean; maxSupply: U128; }; /** * Generated factory for {@link CreateIssuerTokenRequest} record objects. */ export const CreateIssuerTokenRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< CreateIssuerTokenRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link CreateIssuerTokenRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link CreateIssuerTokenRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeCreateIssuerTokenRequest = (() => { type TypeName = CreateIssuerTokenRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { name: FfiConverterString.read(from), ticker: FfiConverterString.read(from), decimals: FfiConverterUInt32.read(from), isFreezable: FfiConverterBool.read(from), maxSupply: FfiConverterTypeu128.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.name, into); FfiConverterString.write(value.ticker, into); FfiConverterUInt32.write(value.decimals, into); FfiConverterBool.write(value.isFreezable, into); FfiConverterTypeu128.write(value.maxSupply, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.name) + FfiConverterString.allocationSize(value.ticker) + FfiConverterUInt32.allocationSize(value.decimals) + FfiConverterBool.allocationSize(value.isFreezable) + FfiConverterTypeu128.allocationSize(value.maxSupply) ); } } return new FFIConverter(); })(); /** * A newly created credential, plus the PRF outputs when the platform * evaluated them during the create ceremony itself. * * `seeds` present means no assertion is needed: the caller skips the * second ceremony, and with it the window in which a credential exists * but is not yet resolvable. Absent means the platform returned no PRF * results at create (or dropped one of a pair), so the caller derives * through [`super::PrfProvider::derive_seeds`] as before. */ export type CreatePasskeyOutput = { credential: PasskeyCredential; /** * One output per requested salt, in request order. */ seeds: Array | undefined; }; /** * Generated factory for {@link CreatePasskeyOutput} record objects. */ export const CreatePasskeyOutput = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link CreatePasskeyOutput}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link CreatePasskeyOutput}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeCreatePasskeyOutput = (() => { type TypeName = CreatePasskeyOutput; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { credential: FfiConverterTypePasskeyCredential.read(from), seeds: FfiConverterOptionalArrayArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypePasskeyCredential.write(value.credential, into); FfiConverterOptionalArrayArrayBuffer.write(value.seeds, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypePasskeyCredential.allocationSize(value.credential) + FfiConverterOptionalArrayArrayBuffer.allocationSize(value.seeds) ); } } return new FFIConverter(); })(); export type Credentials = { username: string; password: string; }; /** * Generated factory for {@link Credentials} record objects. */ export const Credentials = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link Credentials}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Credentials}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeCredentials = (() => { type TypeName = Credentials; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { username: FfiConverterString.read(from), password: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.username, into); FfiConverterString.write(value.password, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.username) + FfiConverterString.allocationSize(value.password) ); } } return new FFIConverter(); })(); export type CrossChainAddressDetails = { address: string; addressFamily: CrossChainAddressFamily; contractAddress: string | undefined; chainId: /*u64*/ bigint | undefined; amount: U128 | undefined; }; /** * Generated factory for {@link CrossChainAddressDetails} record objects. */ export const CrossChainAddressDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< CrossChainAddressDetails, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link CrossChainAddressDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link CrossChainAddressDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeCrossChainAddressDetails = (() => { type TypeName = CrossChainAddressDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { address: FfiConverterString.read(from), addressFamily: FfiConverterTypeCrossChainAddressFamily.read(from), contractAddress: FfiConverterOptionalString.read(from), chainId: FfiConverterOptionalUInt64.read(from), amount: FfiConverterOptionalTypeu128.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.address, into); FfiConverterTypeCrossChainAddressFamily.write(value.addressFamily, into); FfiConverterOptionalString.write(value.contractAddress, into); FfiConverterOptionalUInt64.write(value.chainId, into); FfiConverterOptionalTypeu128.write(value.amount, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.address) + FfiConverterTypeCrossChainAddressFamily.allocationSize( value.addressFamily ) + FfiConverterOptionalString.allocationSize(value.contractAddress) + FfiConverterOptionalUInt64.allocationSize(value.chainId) + FfiConverterOptionalTypeu128.allocationSize(value.amount) ); } } return new FFIConverter(); })(); /** * Configuration for cross-chain sends. * * The presence of this struct on [`Config::cross_chain_config`] enables * cross-chain providers; `None` disables them. */ export type CrossChainConfig = { /** * Default maximum slippage in basis points used when * [`PaymentRequest::CrossChain::max_slippage_bps`] is not set on the * prepare request. Must be in 10 to 500. Falls back to 100 bps (1%) * when this field is unset. */ defaultSlippageBps: /*u32*/ number | undefined; /** * Default target-overpay pad in basis points applied to the user's * destination amount on `FeesExcluded` conversion sends. Bumps the * target upward before quoting so the recipient lands at or above the * requested amount despite provider slippage. Must be in 0 to 500. * Falls back to 15 bps when unset. */ defaultTargetOverpayBps: /*u32*/ number | undefined; }; /** * Generated factory for {@link CrossChainConfig} record objects. */ export const CrossChainConfig = (() => { const defaults = () => ({ defaultSlippageBps: undefined, defaultTargetOverpayBps: undefined, }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link CrossChainConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link CrossChainConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeCrossChainConfig = (() => { type TypeName = CrossChainConfig; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { defaultSlippageBps: FfiConverterOptionalUInt32.read(from), defaultTargetOverpayBps: FfiConverterOptionalUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalUInt32.write(value.defaultSlippageBps, into); FfiConverterOptionalUInt32.write(value.defaultTargetOverpayBps, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalUInt32.allocationSize(value.defaultSlippageBps) + FfiConverterOptionalUInt32.allocationSize(value.defaultTargetOverpayBps) ); } } return new FFIConverter(); })(); /** * Information about the cross-chain receive quote. */ export type CrossChainReceiveInfo = { /** * Bare external deposit address the sender pays to. */ depositAddress: string; /** * Amount the sender must deposit, in source-asset base units * (`route.decimals`). On `FeesExcluded` this may differ from the * request's `amount` because the SDK inflates the deposit to absorb * provider fees. Render this value to the sender. */ depositAmount: U128; /** * Amount the receiver will see, net of provider fees, in * destination-asset base units. Sats when receiving BTC into Spark, * or token base units when receiving a Spark token (e.g. USDB). The * final delivered amount may move within the slippage tolerance. */ expectedReceivedAmount: U128; /** * Symbol of the Spark-side asset `expected_received_amount` is * denominated in, as the provider reports it: `"BTC"` for sats, or the * token symbol (e.g. `"USDB"`). */ destinationAsset: string; /** * Spark token identifier when the destination is a token. Absent when * the destination is BTC and the receiver will see sats. */ tokenIdentifier: string | undefined; /** * Provider-quoted total fee for this receive, in `service_fee_asset` * units. */ serviceFeeAmount: U128; /** * Ticker for `service_fee_amount`. Absent when the fee is denominated * in sats. */ serviceFeeAsset: string | undefined; /** * Quote expiry as a unix timestamp in seconds. */ expiresAt: /*u64*/ bigint; }; /** * Generated factory for {@link CrossChainReceiveInfo} record objects. */ export const CrossChainReceiveInfo = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< CrossChainReceiveInfo, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link CrossChainReceiveInfo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link CrossChainReceiveInfo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeCrossChainReceiveInfo = (() => { type TypeName = CrossChainReceiveInfo; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { depositAddress: FfiConverterString.read(from), depositAmount: FfiConverterTypeu128.read(from), expectedReceivedAmount: FfiConverterTypeu128.read(from), destinationAsset: FfiConverterString.read(from), tokenIdentifier: FfiConverterOptionalString.read(from), serviceFeeAmount: FfiConverterTypeu128.read(from), serviceFeeAsset: FfiConverterOptionalString.read(from), expiresAt: FfiConverterUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.depositAddress, into); FfiConverterTypeu128.write(value.depositAmount, into); FfiConverterTypeu128.write(value.expectedReceivedAmount, into); FfiConverterString.write(value.destinationAsset, into); FfiConverterOptionalString.write(value.tokenIdentifier, into); FfiConverterTypeu128.write(value.serviceFeeAmount, into); FfiConverterOptionalString.write(value.serviceFeeAsset, into); FfiConverterUInt64.write(value.expiresAt, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.depositAddress) + FfiConverterTypeu128.allocationSize(value.depositAmount) + FfiConverterTypeu128.allocationSize(value.expectedReceivedAmount) + FfiConverterString.allocationSize(value.destinationAsset) + FfiConverterOptionalString.allocationSize(value.tokenIdentifier) + FfiConverterTypeu128.allocationSize(value.serviceFeeAmount) + FfiConverterOptionalString.allocationSize(value.serviceFeeAsset) + FfiConverterUInt64.allocationSize(value.expiresAt) ); } } return new FFIConverter(); })(); /** * A single route available for cross-chain transfers, tagged with the provider * that offers it. Returned by `get_cross_chain_routes()`. */ export type CrossChainRoutePair = { /** * Which provider offers this route. */ provider: CrossChainProvider; /** * External blockchain (e.g. `"base"`, `"solana"`, `"tron"`). */ chain: string; /** * External chain identifier (e.g. EVM `chainId` as a decimal string). * `None` for non-EVM chains that don't expose one, or when the * provider doesn't surface it. */ chainId: string | undefined; /** * External asset symbol (e.g. `"USDC"`, `"USDT"`). */ asset: string; /** * Token contract / mint address on the destination chain. */ contractAddress: string | undefined; /** * Decimal places for the destination asset. */ decimals: /*u8*/ number; /** * Whether the route supports exact-out mode. */ exactOutEligible: boolean; /** * Spark-side assets this route accepts. */ acceptedAssets: Array; /** * Rails this route can be delivered over, orthogonal to * `accepted_assets` (the asset moved vs the rail moved on). */ deliveryMethods: Array; }; /** * Generated factory for {@link CrossChainRoutePair} record objects. */ export const CrossChainRoutePair = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link CrossChainRoutePair}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link CrossChainRoutePair}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeCrossChainRoutePair = (() => { type TypeName = CrossChainRoutePair; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { provider: FfiConverterTypeCrossChainProvider.read(from), chain: FfiConverterString.read(from), chainId: FfiConverterOptionalString.read(from), asset: FfiConverterString.read(from), contractAddress: FfiConverterOptionalString.read(from), decimals: FfiConverterUInt8.read(from), exactOutEligible: FfiConverterBool.read(from), acceptedAssets: FfiConverterArrayTypeSparkAsset.read(from), deliveryMethods: FfiConverterArrayTypeDeliveryMethod.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeCrossChainProvider.write(value.provider, into); FfiConverterString.write(value.chain, into); FfiConverterOptionalString.write(value.chainId, into); FfiConverterString.write(value.asset, into); FfiConverterOptionalString.write(value.contractAddress, into); FfiConverterUInt8.write(value.decimals, into); FfiConverterBool.write(value.exactOutEligible, into); FfiConverterArrayTypeSparkAsset.write(value.acceptedAssets, into); FfiConverterArrayTypeDeliveryMethod.write(value.deliveryMethods, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeCrossChainProvider.allocationSize(value.provider) + FfiConverterString.allocationSize(value.chain) + FfiConverterOptionalString.allocationSize(value.chainId) + FfiConverterString.allocationSize(value.asset) + FfiConverterOptionalString.allocationSize(value.contractAddress) + FfiConverterUInt8.allocationSize(value.decimals) + FfiConverterBool.allocationSize(value.exactOutEligible) + FfiConverterArrayTypeSparkAsset.allocationSize(value.acceptedAssets) + FfiConverterArrayTypeDeliveryMethod.allocationSize( value.deliveryMethods ) ); } } return new FFIConverter(); })(); /** * Details about a supported currency in the fiat rate feed */ export type CurrencyInfo = { name: string; fractionSize: /*u32*/ number; spacing: /*u32*/ number | undefined; symbol: Symbol | undefined; uniqSymbol: Symbol | undefined; localizedName: Array; localeOverrides: Array; }; /** * Generated factory for {@link CurrencyInfo} record objects. */ export const CurrencyInfo = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link CurrencyInfo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link CurrencyInfo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeCurrencyInfo = (() => { type TypeName = CurrencyInfo; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { name: FfiConverterString.read(from), fractionSize: FfiConverterUInt32.read(from), spacing: FfiConverterOptionalUInt32.read(from), symbol: FfiConverterOptionalTypeSymbol.read(from), uniqSymbol: FfiConverterOptionalTypeSymbol.read(from), localizedName: FfiConverterArrayTypeLocalizedName.read(from), localeOverrides: FfiConverterArrayTypeLocaleOverrides.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.name, into); FfiConverterUInt32.write(value.fractionSize, into); FfiConverterOptionalUInt32.write(value.spacing, into); FfiConverterOptionalTypeSymbol.write(value.symbol, into); FfiConverterOptionalTypeSymbol.write(value.uniqSymbol, into); FfiConverterArrayTypeLocalizedName.write(value.localizedName, into); FfiConverterArrayTypeLocaleOverrides.write(value.localeOverrides, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.name) + FfiConverterUInt32.allocationSize(value.fractionSize) + FfiConverterOptionalUInt32.allocationSize(value.spacing) + FfiConverterOptionalTypeSymbol.allocationSize(value.symbol) + FfiConverterOptionalTypeSymbol.allocationSize(value.uniqSymbol) + FfiConverterArrayTypeLocalizedName.allocationSize(value.localizedName) + FfiConverterArrayTypeLocaleOverrides.allocationSize( value.localeOverrides ) ); } } return new FFIConverter(); })(); export type DepositInfo = { /** * Transaction id of the on-chain output the deposit came from. */ txid: string; /** * Index of that output within its transaction. */ vout: /*u32*/ number; /** * Deposit value in satoshis. */ amountSats: /*u64*/ bigint; /** * Whether the deposit has enough confirmations to be claimed. */ isMature: boolean; /** * Raw refund transaction, once one has been created. */ refundTx: string | undefined; /** * Transaction id of the refund, once one has been created. */ refundTxId: string | undefined; /** * How far the refund has got towards the network. Unset when no refund has * been created, and on refunds created before this field existed. */ refundState: RefundState | undefined; /** * Why the last claim attempt failed. Unset while none has failed. */ claimError: DepositClaimError | undefined; /** * Unset when no instant claim has been attempted. */ instantClaimStatus: InstantClaimStatus | undefined; }; /** * Generated factory for {@link DepositInfo} record objects. */ export const DepositInfo = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link DepositInfo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link DepositInfo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeDepositInfo = (() => { type TypeName = DepositInfo; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { txid: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), amountSats: FfiConverterUInt64.read(from), isMature: FfiConverterBool.read(from), refundTx: FfiConverterOptionalString.read(from), refundTxId: FfiConverterOptionalString.read(from), refundState: FfiConverterOptionalTypeRefundState.read(from), claimError: FfiConverterOptionalTypeDepositClaimError.read(from), instantClaimStatus: FfiConverterOptionalTypeInstantClaimStatus.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.txid, into); FfiConverterUInt32.write(value.vout, into); FfiConverterUInt64.write(value.amountSats, into); FfiConverterBool.write(value.isMature, into); FfiConverterOptionalString.write(value.refundTx, into); FfiConverterOptionalString.write(value.refundTxId, into); FfiConverterOptionalTypeRefundState.write(value.refundState, into); FfiConverterOptionalTypeDepositClaimError.write(value.claimError, into); FfiConverterOptionalTypeInstantClaimStatus.write( value.instantClaimStatus, into ); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.txid) + FfiConverterUInt32.allocationSize(value.vout) + FfiConverterUInt64.allocationSize(value.amountSats) + FfiConverterBool.allocationSize(value.isMature) + FfiConverterOptionalString.allocationSize(value.refundTx) + FfiConverterOptionalString.allocationSize(value.refundTxId) + FfiConverterOptionalTypeRefundState.allocationSize(value.refundState) + FfiConverterOptionalTypeDepositClaimError.allocationSize( value.claimError ) + FfiConverterOptionalTypeInstantClaimStatus.allocationSize( value.instantClaimStatus ) ); } } return new FFIConverter(); })(); /** * Derived seeds plus the credential observed in the same assertion. */ export type DeriveSeedsOutput = { seeds: Array; /** * Absent when the provider does not surface it. */ credentialId: ArrayBuffer | undefined; }; /** * Generated factory for {@link DeriveSeedsOutput} record objects. */ export const DeriveSeedsOutput = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link DeriveSeedsOutput}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link DeriveSeedsOutput}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeDeriveSeedsOutput = (() => { type TypeName = DeriveSeedsOutput; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { seeds: FfiConverterArrayArrayBuffer.read(from), credentialId: FfiConverterOptionalArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayArrayBuffer.write(value.seeds, into); FfiConverterOptionalArrayBuffer.write(value.credentialId, into); } allocationSize(value: TypeName): number { return ( FfiConverterArrayArrayBuffer.allocationSize(value.seeds) + FfiConverterOptionalArrayBuffer.allocationSize(value.credentialId) ); } } return new FFIConverter(); })(); /** * Per-call inputs for [`PrfProvider::derive_seeds`]. Hosts that * don't need per-ceremony overrides fall back to [`Default`] * (`salts` only, all overrides empty / `None`). */ export type DeriveSeedsRequest = { /** * Salt strings in caller order. One 32-byte PRF output is * returned per salt, in the same order. */ salts: Array; /** * Credential IDs the assertion is restricted to. The main use is * reauthenticating a known user: if a listed credential is on the * device the OS unlocks straight away (no account picker); otherwise * it asks for another device (paired phone, security key) holding one. * Empty falls through to the provider's configured default. */ allowCredentials: Array; /** * Restrict the assertion to credentials already present on this * device. When `true`, the OS skips the cross-device picker (iOS * QR, Android hybrid, web `mediation: undefined`) and surfaces a * missing local credential as `CredentialNotFound` immediately. * When `false`, the OS picker is shown as usual. Unset uses the * provider's default (`true` for built-in providers). */ preferImmediatelyAvailableCredentials: boolean | undefined; }; /** * Generated factory for {@link DeriveSeedsRequest} record objects. */ export const DeriveSeedsRequest = (() => { const defaults = () => ({ allowCredentials: [], preferImmediatelyAvailableCredentials: undefined, }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link DeriveSeedsRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link DeriveSeedsRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeDeriveSeedsRequest = (() => { type TypeName = DeriveSeedsRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { salts: FfiConverterArrayString.read(from), allowCredentials: FfiConverterArrayArrayBuffer.read(from), preferImmediatelyAvailableCredentials: FfiConverterOptionalBool.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayString.write(value.salts, into); FfiConverterArrayArrayBuffer.write(value.allowCredentials, into); FfiConverterOptionalBool.write( value.preferImmediatelyAvailableCredentials, into ); } allocationSize(value: TypeName): number { return ( FfiConverterArrayString.allocationSize(value.salts) + FfiConverterArrayArrayBuffer.allocationSize(value.allowCredentials) + FfiConverterOptionalBool.allocationSize( value.preferImmediatelyAvailableCredentials ) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of an ECDSA signature (64 bytes) */ export type EcdsaSignatureBytes = { bytes: ArrayBuffer; }; /** * Generated factory for {@link EcdsaSignatureBytes} record objects. */ export const EcdsaSignatureBytes = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link EcdsaSignatureBytes}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link EcdsaSignatureBytes}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeEcdsaSignatureBytes = (() => { type TypeName = EcdsaSignatureBytes; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { bytes: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.bytes, into); } allocationSize(value: TypeName): number { return FfiConverterArrayBuffer.allocationSize(value.bytes); } } return new FFIConverter(); })(); /** * What the chain has already done to an exit's leaves, as * `prepare_unilateral_exit` found it. Pass it back to `unilateral_exit`, which * builds only the steps it does not cover. */ export type ExitChainState = { /** * Nodes whose transaction is on-chain. */ confirmedNodes: Array; /** * Leaves whose refund reached the chain. */ refunds: Array; /** * Leaves whose lineage was taken on-chain by a transaction the exit cannot * continue from. Nothing further can be driven for them. */ stoppedLeafIds: Array; /** * Nodes a chain lookup could not read, so their state is unknown rather * than absent. Transactions depending on them come back * `ExitTransactionStatus::Unverified`. */ unverifiedNodeIds: Array; /** * Nodes taken to be on-chain on the operators' word, the chain itself being * unreadable. Their spend is invisible, so anything built over them risks * double-spending an output that is already gone. */ unverifiableConfirmedNodeIds: Array; }; /** * Generated factory for {@link ExitChainState} record objects. */ export const ExitChainState = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExitChainState}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExitChainState}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExitChainState = (() => { type TypeName = ExitChainState; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { confirmedNodes: FfiConverterArrayTypeConfirmedExitNode.read(from), refunds: FfiConverterArrayTypeExitRefund.read(from), stoppedLeafIds: FfiConverterArrayString.read(from), unverifiedNodeIds: FfiConverterArrayString.read(from), unverifiableConfirmedNodeIds: FfiConverterArrayString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypeConfirmedExitNode.write(value.confirmedNodes, into); FfiConverterArrayTypeExitRefund.write(value.refunds, into); FfiConverterArrayString.write(value.stoppedLeafIds, into); FfiConverterArrayString.write(value.unverifiedNodeIds, into); FfiConverterArrayString.write(value.unverifiableConfirmedNodeIds, into); } allocationSize(value: TypeName): number { return ( FfiConverterArrayTypeConfirmedExitNode.allocationSize( value.confirmedNodes ) + FfiConverterArrayTypeExitRefund.allocationSize(value.refunds) + FfiConverterArrayString.allocationSize(value.stoppedLeafIds) + FfiConverterArrayString.allocationSize(value.unverifiedNodeIds) + FfiConverterArrayString.allocationSize( value.unverifiableConfirmedNodeIds ) ); } } return new FFIConverter(); })(); /** * A leaf's refund as the chain shows it. */ export type ExitRefund = { leafId: string; state: ExitRefundState; }; /** * Generated factory for {@link ExitRefund} record objects. */ export const ExitRefund = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExitRefund}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExitRefund}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExitRefund = (() => { type TypeName = ExitRefund; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { leafId: FfiConverterString.read(from), state: FfiConverterTypeExitRefundState.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.leafId, into); FfiConverterTypeExitRefundState.write(value.state, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.leafId) + FfiConverterTypeExitRefundState.allocationSize(value.state) ); } } return new FFIConverter(); })(); /** * Result of `export_unilateral_exit_state`: a self-contained copy of the * wallet's exit state, ready to be stored outside the wallet. */ export type ExportUnilateralExitStateResponse = { /** * The serialized exit state, to be handed back to * `import_unilateral_exit_state` unmodified. */ exitState: string; }; /** * Generated factory for {@link ExportUnilateralExitStateResponse} record objects. */ export const ExportUnilateralExitStateResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExportUnilateralExitStateResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExportUnilateralExitStateResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExportUnilateralExitStateResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExportUnilateralExitStateResponse = (() => { type TypeName = ExportUnilateralExitStateResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { exitState: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.exitState, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.exitState); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::ClaimLeafInput`. */ export type ExternalClaimLeafInput = { nodeId: ExternalTreeNodeId; senderSignature: ArrayBuffer; leafKeyCiphertext: ArrayBuffer; }; /** * Generated factory for {@link ExternalClaimLeafInput} record objects. */ export const ExternalClaimLeafInput = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalClaimLeafInput, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalClaimLeafInput}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalClaimLeafInput}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalClaimLeafInput = (() => { type TypeName = ExternalClaimLeafInput; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { nodeId: FfiConverterTypeExternalTreeNodeId.read(from), senderSignature: FfiConverterArrayBuffer.read(from), leafKeyCiphertext: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeExternalTreeNodeId.write(value.nodeId, into); FfiConverterArrayBuffer.write(value.senderSignature, into); FfiConverterArrayBuffer.write(value.leafKeyCiphertext, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeExternalTreeNodeId.allocationSize(value.nodeId) + FfiConverterArrayBuffer.allocationSize(value.senderSignature) + FfiConverterArrayBuffer.allocationSize(value.leafKeyCiphertext) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::FrostSigningCommitmentsWithNonces` */ export type ExternalFrostCommitments = { /** * Serialized hiding nonce commitment (variable length, typically 33 bytes compressed point) */ hidingCommitment: ArrayBuffer; /** * Serialized binding nonce commitment (variable length, typically 33 bytes compressed point) */ bindingCommitment: ArrayBuffer; /** * Encrypted nonces ciphertext */ noncesCiphertext: ArrayBuffer; }; /** * Generated factory for {@link ExternalFrostCommitments} record objects. */ export const ExternalFrostCommitments = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalFrostCommitments, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalFrostCommitments}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalFrostCommitments}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalFrostCommitments = (() => { type TypeName = ExternalFrostCommitments; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { hidingCommitment: FfiConverterArrayBuffer.read(from), bindingCommitment: FfiConverterArrayBuffer.read(from), noncesCiphertext: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.hidingCommitment, into); FfiConverterArrayBuffer.write(value.bindingCommitment, into); FfiConverterArrayBuffer.write(value.noncesCiphertext, into); } allocationSize(value: TypeName): number { return ( FfiConverterArrayBuffer.allocationSize(value.hidingCommitment) + FfiConverterArrayBuffer.allocationSize(value.bindingCommitment) + FfiConverterArrayBuffer.allocationSize(value.noncesCiphertext) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::FrostJob`. */ export type ExternalFrostJob = { /** * Which key to sign with. */ derivation: ExternalFrostDerivation; /** * 32-byte BIP-341 sighash to sign. */ sighash: ArrayBuffer; /** * FROST group verifying key (33 bytes compressed). */ verifyingKey: ArrayBuffer; /** * Per-operator round-1 commitments. */ operatorCommitments: Array; /** * Optional adaptor public key (33 bytes compressed). */ adaptorPublicKey: ArrayBuffer | undefined; }; /** * Generated factory for {@link ExternalFrostJob} record objects. */ export const ExternalFrostJob = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalFrostJob}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalFrostJob}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalFrostJob = (() => { type TypeName = ExternalFrostJob; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { derivation: FfiConverterTypeExternalFrostDerivation.read(from), sighash: FfiConverterArrayBuffer.read(from), verifyingKey: FfiConverterArrayBuffer.read(from), operatorCommitments: FfiConverterArrayTypeIdentifierCommitmentPair.read(from), adaptorPublicKey: FfiConverterOptionalArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeExternalFrostDerivation.write(value.derivation, into); FfiConverterArrayBuffer.write(value.sighash, into); FfiConverterArrayBuffer.write(value.verifyingKey, into); FfiConverterArrayTypeIdentifierCommitmentPair.write( value.operatorCommitments, into ); FfiConverterOptionalArrayBuffer.write(value.adaptorPublicKey, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeExternalFrostDerivation.allocationSize( value.derivation ) + FfiConverterArrayBuffer.allocationSize(value.sighash) + FfiConverterArrayBuffer.allocationSize(value.verifyingKey) + FfiConverterArrayTypeIdentifierCommitmentPair.allocationSize( value.operatorCommitments ) + FfiConverterOptionalArrayBuffer.allocationSize(value.adaptorPublicKey) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::FrostShareResult`. */ export type ExternalFrostShareResult = { /** * The user's nonce commitment (round-1 output). */ commitment: ExternalFrostCommitments; /** * The user's signature share (round-2 output). */ signatureShare: ExternalFrostSignatureShare; }; /** * Generated factory for {@link ExternalFrostShareResult} record objects. */ export const ExternalFrostShareResult = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalFrostShareResult, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalFrostShareResult}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalFrostShareResult}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalFrostShareResult = (() => { type TypeName = ExternalFrostShareResult; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { commitment: FfiConverterTypeExternalFrostCommitments.read(from), signatureShare: FfiConverterTypeExternalFrostSignatureShare.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeExternalFrostCommitments.write(value.commitment, into); FfiConverterTypeExternalFrostSignatureShare.write( value.signatureShare, into ); } allocationSize(value: TypeName): number { return ( FfiConverterTypeExternalFrostCommitments.allocationSize( value.commitment ) + FfiConverterTypeExternalFrostSignatureShare.allocationSize( value.signatureShare ) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `frost_secp256k1_tr::Signature` */ export type ExternalFrostSignature = { /** * Serialized Frost signature bytes (64 bytes) */ bytes: ArrayBuffer; }; /** * Generated factory for {@link ExternalFrostSignature} record objects. */ export const ExternalFrostSignature = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalFrostSignature, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalFrostSignature}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalFrostSignature}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalFrostSignature = (() => { type TypeName = ExternalFrostSignature; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { bytes: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.bytes, into); } allocationSize(value: TypeName): number { return FfiConverterArrayBuffer.allocationSize(value.bytes); } } return new FFIConverter(); })(); /** * FFI-safe representation of `frost_secp256k1_tr::round2::SignatureShare` */ export type ExternalFrostSignatureShare = { /** * Serialized signature share bytes (variable length, typically 32 bytes) */ bytes: ArrayBuffer; }; /** * Generated factory for {@link ExternalFrostSignatureShare} record objects. */ export const ExternalFrostSignatureShare = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalFrostSignatureShare, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalFrostSignatureShare}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalFrostSignatureShare}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalFrostSignatureShare = (() => { type TypeName = ExternalFrostSignatureShare; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { bytes: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.bytes, into); } allocationSize(value: TypeName): number { return FfiConverterArrayBuffer.allocationSize(value.bytes); } } return new FFIConverter(); })(); /** * FFI-safe representation of `frost_secp256k1_tr::Identifier` */ export type ExternalIdentifier = { /** * Serialized identifier bytes */ bytes: ArrayBuffer; }; /** * Generated factory for {@link ExternalIdentifier} record objects. */ export const ExternalIdentifier = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalIdentifier}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalIdentifier}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalIdentifier = (() => { type TypeName = ExternalIdentifier; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { bytes: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.bytes, into); } allocationSize(value: TypeName): number { return FfiConverterArrayBuffer.allocationSize(value.bytes); } } return new FFIConverter(); })(); /** * Configuration for an external input parser */ export type ExternalInputParser = { /** * An arbitrary parser provider id */ providerId: string; /** * The external parser will be used when an input conforms to this regex */ inputRegex: string; /** * The URL of the parser containing a placeholder `` that will be replaced with the * input to be parsed. The input is sanitized using percent encoding. */ parserUrl: string; }; /** * Generated factory for {@link ExternalInputParser} record objects. */ export const ExternalInputParser = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalInputParser}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalInputParser}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalInputParser = (() => { type TypeName = ExternalInputParser; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { providerId: FfiConverterString.read(from), inputRegex: FfiConverterString.read(from), parserUrl: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.providerId, into); FfiConverterString.write(value.inputRegex, into); FfiConverterString.write(value.parserUrl, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.providerId) + FfiConverterString.allocationSize(value.inputRegex) + FfiConverterString.allocationSize(value.parserUrl) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::NewLeafKey`. */ export type ExternalNewLeafKey = { nodeId: ExternalTreeNodeId; /** * New signing public key (33 bytes compressed). */ newSigningPublicKey: ArrayBuffer; }; /** * Generated factory for {@link ExternalNewLeafKey} record objects. */ export const ExternalNewLeafKey = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalNewLeafKey}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalNewLeafKey}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalNewLeafKey = (() => { type TypeName = ExternalNewLeafKey; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { nodeId: FfiConverterTypeExternalTreeNodeId.read(from), newSigningPublicKey: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeExternalTreeNodeId.write(value.nodeId, into); FfiConverterArrayBuffer.write(value.newSigningPublicKey, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeExternalTreeNodeId.allocationSize(value.nodeId) + FfiConverterArrayBuffer.allocationSize(value.newSigningPublicKey) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::OperatorPackage`. */ export type ExternalOperatorPackage = { /** * The operator this package is encrypted for. */ operatorIdentifier: ExternalIdentifier; /** * The ECIES-encrypted package bytes. */ encryptedPackage: ArrayBuffer; }; /** * Generated factory for {@link ExternalOperatorPackage} record objects. */ export const ExternalOperatorPackage = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalOperatorPackage, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalOperatorPackage}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalOperatorPackage}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalOperatorPackage = (() => { type TypeName = ExternalOperatorPackage; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { operatorIdentifier: FfiConverterTypeExternalIdentifier.read(from), encryptedPackage: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeExternalIdentifier.write(value.operatorIdentifier, into); FfiConverterArrayBuffer.write(value.encryptedPackage, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeExternalIdentifier.allocationSize( value.operatorIdentifier ) + FfiConverterArrayBuffer.allocationSize(value.encryptedPackage) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::OperatorRecipient`. */ export type ExternalOperatorRecipient = { /** * Numeric operator id (determines the Feldman share index). */ id: /*u64*/ bigint; /** * FROST identifier. */ identifier: ExternalIdentifier; /** * The operator's ECIES / identity public key (33 bytes compressed). */ publicKey: ArrayBuffer; }; /** * Generated factory for {@link ExternalOperatorRecipient} record objects. */ export const ExternalOperatorRecipient = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalOperatorRecipient, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalOperatorRecipient}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalOperatorRecipient}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalOperatorRecipient = (() => { type TypeName = ExternalOperatorRecipient; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { id: FfiConverterUInt64.read(from), identifier: FfiConverterTypeExternalIdentifier.read(from), publicKey: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt64.write(value.id, into); FfiConverterTypeExternalIdentifier.write(value.identifier, into); FfiConverterArrayBuffer.write(value.publicKey, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt64.allocationSize(value.id) + FfiConverterTypeExternalIdentifier.allocationSize(value.identifier) + FfiConverterArrayBuffer.allocationSize(value.publicKey) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::PrepareClaimRequest`. */ export type ExternalPrepareClaimRequest = { transferId: string; /** * Sender identity public key (33 bytes compressed). */ senderIdentityPublicKey: ArrayBuffer; leaves: Array; operatorRecipients: Array; threshold: /*u32*/ number; }; /** * Generated factory for {@link ExternalPrepareClaimRequest} record objects. */ export const ExternalPrepareClaimRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalPrepareClaimRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalPrepareClaimRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalPrepareClaimRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalPrepareClaimRequest = (() => { type TypeName = ExternalPrepareClaimRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { transferId: FfiConverterString.read(from), senderIdentityPublicKey: FfiConverterArrayBuffer.read(from), leaves: FfiConverterArrayTypeExternalClaimLeafInput.read(from), operatorRecipients: FfiConverterArrayTypeExternalOperatorRecipient.read(from), threshold: FfiConverterUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.transferId, into); FfiConverterArrayBuffer.write(value.senderIdentityPublicKey, into); FfiConverterArrayTypeExternalClaimLeafInput.write(value.leaves, into); FfiConverterArrayTypeExternalOperatorRecipient.write( value.operatorRecipients, into ); FfiConverterUInt32.write(value.threshold, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.transferId) + FfiConverterArrayBuffer.allocationSize(value.senderIdentityPublicKey) + FfiConverterArrayTypeExternalClaimLeafInput.allocationSize( value.leaves ) + FfiConverterArrayTypeExternalOperatorRecipient.allocationSize( value.operatorRecipients ) + FfiConverterUInt32.allocationSize(value.threshold) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::PrepareLightningReceiveRequest`. */ export type ExternalPrepareLightningReceiveRequest = { operatorRecipients: Array; threshold: /*u32*/ number; }; /** * Generated factory for {@link ExternalPrepareLightningReceiveRequest} record objects. */ export const ExternalPrepareLightningReceiveRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalPrepareLightningReceiveRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalPrepareLightningReceiveRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalPrepareLightningReceiveRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze( defaults() ) as Partial, }); })(); const FfiConverterTypeExternalPrepareLightningReceiveRequest = (() => { type TypeName = ExternalPrepareLightningReceiveRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { operatorRecipients: FfiConverterArrayTypeExternalOperatorRecipient.read(from), threshold: FfiConverterUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypeExternalOperatorRecipient.write( value.operatorRecipients, into ); FfiConverterUInt32.write(value.threshold, into); } allocationSize(value: TypeName): number { return ( FfiConverterArrayTypeExternalOperatorRecipient.allocationSize( value.operatorRecipients ) + FfiConverterUInt32.allocationSize(value.threshold) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::PrepareStaticDepositClaimRequest`. */ export type ExternalPrepareStaticDepositClaimRequest = { index: /*u32*/ number; userStatement: ArrayBuffer; }; /** * Generated factory for {@link ExternalPrepareStaticDepositClaimRequest} record objects. */ export const ExternalPrepareStaticDepositClaimRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalPrepareStaticDepositClaimRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalPrepareStaticDepositClaimRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalPrepareStaticDepositClaimRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze( defaults() ) as Partial, }); })(); const FfiConverterTypeExternalPrepareStaticDepositClaimRequest = (() => { type TypeName = ExternalPrepareStaticDepositClaimRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { index: FfiConverterUInt32.read(from), userStatement: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt32.write(value.index, into); FfiConverterArrayBuffer.write(value.userStatement, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt32.allocationSize(value.index) + FfiConverterArrayBuffer.allocationSize(value.userStatement) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::PrepareStaticDepositRequest`. */ export type ExternalPrepareStaticDepositRequest = { index: /*u32*/ number; /** * SSP public key (33 bytes compressed). */ sspPublicKey: ArrayBuffer; frostJobs: Array; }; /** * Generated factory for {@link ExternalPrepareStaticDepositRequest} record objects. */ export const ExternalPrepareStaticDepositRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalPrepareStaticDepositRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalPrepareStaticDepositRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalPrepareStaticDepositRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalPrepareStaticDepositRequest = (() => { type TypeName = ExternalPrepareStaticDepositRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { index: FfiConverterUInt32.read(from), sspPublicKey: FfiConverterArrayBuffer.read(from), frostJobs: FfiConverterArrayTypeExternalFrostJob.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt32.write(value.index, into); FfiConverterArrayBuffer.write(value.sspPublicKey, into); FfiConverterArrayTypeExternalFrostJob.write(value.frostJobs, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt32.allocationSize(value.index) + FfiConverterArrayBuffer.allocationSize(value.sspPublicKey) + FfiConverterArrayTypeExternalFrostJob.allocationSize(value.frostJobs) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::PrepareTokenTransactionRequest`. */ export type ExternalPrepareTokenTransactionRequest = { kind: ExternalTokenTransactionKind; digest: ArrayBuffer; }; /** * Generated factory for {@link ExternalPrepareTokenTransactionRequest} record objects. */ export const ExternalPrepareTokenTransactionRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalPrepareTokenTransactionRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalPrepareTokenTransactionRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalPrepareTokenTransactionRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze( defaults() ) as Partial, }); })(); const FfiConverterTypeExternalPrepareTokenTransactionRequest = (() => { type TypeName = ExternalPrepareTokenTransactionRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { kind: FfiConverterTypeExternalTokenTransactionKind.read(from), digest: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeExternalTokenTransactionKind.write(value.kind, into); FfiConverterArrayBuffer.write(value.digest, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeExternalTokenTransactionKind.allocationSize( value.kind ) + FfiConverterArrayBuffer.allocationSize(value.digest) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::PrepareTransferRequest`. */ export type ExternalPrepareTransferRequest = { transferId: string; /** * Receiver public key (33 bytes compressed). */ receiverPublicKey: ArrayBuffer; leaves: Array; operatorRecipients: Array; threshold: /*u32*/ number; }; /** * Generated factory for {@link ExternalPrepareTransferRequest} record objects. */ export const ExternalPrepareTransferRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalPrepareTransferRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalPrepareTransferRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalPrepareTransferRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalPrepareTransferRequest = (() => { type TypeName = ExternalPrepareTransferRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { transferId: FfiConverterString.read(from), receiverPublicKey: FfiConverterArrayBuffer.read(from), leaves: FfiConverterArrayTypeExternalTransferLeafInput.read(from), operatorRecipients: FfiConverterArrayTypeExternalOperatorRecipient.read(from), threshold: FfiConverterUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.transferId, into); FfiConverterArrayBuffer.write(value.receiverPublicKey, into); FfiConverterArrayTypeExternalTransferLeafInput.write(value.leaves, into); FfiConverterArrayTypeExternalOperatorRecipient.write( value.operatorRecipients, into ); FfiConverterUInt32.write(value.threshold, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.transferId) + FfiConverterArrayBuffer.allocationSize(value.receiverPublicKey) + FfiConverterArrayTypeExternalTransferLeafInput.allocationSize( value.leaves ) + FfiConverterArrayTypeExternalOperatorRecipient.allocationSize( value.operatorRecipients ) + FfiConverterUInt32.allocationSize(value.threshold) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::PreparedClaim`. */ export type ExternalPreparedClaim = { operatorPackages: Array; }; /** * Generated factory for {@link ExternalPreparedClaim} record objects. */ export const ExternalPreparedClaim = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalPreparedClaim, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalPreparedClaim}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalPreparedClaim}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalPreparedClaim = (() => { type TypeName = ExternalPreparedClaim; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { operatorPackages: FfiConverterArrayTypeExternalOperatorPackage.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypeExternalOperatorPackage.write( value.operatorPackages, into ); } allocationSize(value: TypeName): number { return FfiConverterArrayTypeExternalOperatorPackage.allocationSize( value.operatorPackages ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::PreparedLightningReceive`. */ export type ExternalPreparedLightningReceive = { /** * SHA256 of the in-enclave preimage (32 bytes). */ paymentHash: ArrayBuffer; operatorPreimagePackages: Array; }; /** * Generated factory for {@link ExternalPreparedLightningReceive} record objects. */ export const ExternalPreparedLightningReceive = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalPreparedLightningReceive, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalPreparedLightningReceive}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalPreparedLightningReceive}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalPreparedLightningReceive = (() => { type TypeName = ExternalPreparedLightningReceive; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { paymentHash: FfiConverterArrayBuffer.read(from), operatorPreimagePackages: FfiConverterArrayTypeExternalOperatorPackage.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.paymentHash, into); FfiConverterArrayTypeExternalOperatorPackage.write( value.operatorPreimagePackages, into ); } allocationSize(value: TypeName): number { return ( FfiConverterArrayBuffer.allocationSize(value.paymentHash) + FfiConverterArrayTypeExternalOperatorPackage.allocationSize( value.operatorPreimagePackages ) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::PreparedStaticDeposit`. */ export type ExternalPreparedStaticDeposit = { exportedSecret: ArrayBuffer; frostShares: Array; }; /** * Generated factory for {@link ExternalPreparedStaticDeposit} record objects. */ export const ExternalPreparedStaticDeposit = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalPreparedStaticDeposit, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalPreparedStaticDeposit}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalPreparedStaticDeposit}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalPreparedStaticDeposit = (() => { type TypeName = ExternalPreparedStaticDeposit; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { exportedSecret: FfiConverterArrayBuffer.read(from), frostShares: FfiConverterArrayTypeExternalFrostShareResult.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.exportedSecret, into); FfiConverterArrayTypeExternalFrostShareResult.write( value.frostShares, into ); } allocationSize(value: TypeName): number { return ( FfiConverterArrayBuffer.allocationSize(value.exportedSecret) + FfiConverterArrayTypeExternalFrostShareResult.allocationSize( value.frostShares ) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::PreparedStaticDepositClaim`. */ export type ExternalPreparedStaticDepositClaim = { /** * The static-deposit secret key, exported in the clear for the SSP. */ depositSecretKey: SecretBytes; userSignature: EcdsaSignatureBytes; }; /** * Generated factory for {@link ExternalPreparedStaticDepositClaim} record objects. */ export const ExternalPreparedStaticDepositClaim = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalPreparedStaticDepositClaim, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalPreparedStaticDepositClaim}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalPreparedStaticDepositClaim}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalPreparedStaticDepositClaim = (() => { type TypeName = ExternalPreparedStaticDepositClaim; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { depositSecretKey: FfiConverterTypeSecretBytes.read(from), userSignature: FfiConverterTypeEcdsaSignatureBytes.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeSecretBytes.write(value.depositSecretKey, into); FfiConverterTypeEcdsaSignatureBytes.write(value.userSignature, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeSecretBytes.allocationSize(value.depositSecretKey) + FfiConverterTypeEcdsaSignatureBytes.allocationSize(value.userSignature) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::PreparedTokenTransaction`. */ export type ExternalPreparedTokenTransaction = { signature: SchnorrSignatureBytes; }; /** * Generated factory for {@link ExternalPreparedTokenTransaction} record objects. */ export const ExternalPreparedTokenTransaction = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalPreparedTokenTransaction, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalPreparedTokenTransaction}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalPreparedTokenTransaction}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalPreparedTokenTransaction = (() => { type TypeName = ExternalPreparedTokenTransaction; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { signature: FfiConverterTypeSchnorrSignatureBytes.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeSchnorrSignatureBytes.write(value.signature, into); } allocationSize(value: TypeName): number { return FfiConverterTypeSchnorrSignatureBytes.allocationSize( value.signature ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::PreparedTransfer`. */ export type ExternalPreparedTransfer = { operatorPackages: Array; newLeafKeys: Array; transferUserSignature: EcdsaSignatureBytes; }; /** * Generated factory for {@link ExternalPreparedTransfer} record objects. */ export const ExternalPreparedTransfer = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalPreparedTransfer, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalPreparedTransfer}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalPreparedTransfer}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalPreparedTransfer = (() => { type TypeName = ExternalPreparedTransfer; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { operatorPackages: FfiConverterArrayTypeExternalOperatorPackage.read(from), newLeafKeys: FfiConverterArrayTypeExternalNewLeafKey.read(from), transferUserSignature: FfiConverterTypeEcdsaSignatureBytes.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypeExternalOperatorPackage.write( value.operatorPackages, into ); FfiConverterArrayTypeExternalNewLeafKey.write(value.newLeafKeys, into); FfiConverterTypeEcdsaSignatureBytes.write( value.transferUserSignature, into ); } allocationSize(value: TypeName): number { return ( FfiConverterArrayTypeExternalOperatorPackage.allocationSize( value.operatorPackages ) + FfiConverterArrayTypeExternalNewLeafKey.allocationSize( value.newLeafKeys ) + FfiConverterTypeEcdsaSignatureBytes.allocationSize( value.transferUserSignature ) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::SignSparkInvoiceRequest`. */ export type ExternalSignSparkInvoiceRequest = { kind: ExternalSparkInvoiceKind; invoiceHash: ArrayBuffer; }; /** * Generated factory for {@link ExternalSignSparkInvoiceRequest} record objects. */ export const ExternalSignSparkInvoiceRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalSignSparkInvoiceRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalSignSparkInvoiceRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalSignSparkInvoiceRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalSignSparkInvoiceRequest = (() => { type TypeName = ExternalSignSparkInvoiceRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { kind: FfiConverterTypeExternalSparkInvoiceKind.read(from), invoiceHash: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeExternalSparkInvoiceKind.write(value.kind, into); FfiConverterArrayBuffer.write(value.invoiceHash, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeExternalSparkInvoiceKind.allocationSize(value.kind) + FfiConverterArrayBuffer.allocationSize(value.invoiceHash) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::SignStaticDepositRefundRequest`. */ export type ExternalSignStaticDepositRefundRequest = { index: /*u32*/ number; sighash: ArrayBuffer; /** * FROST group verifying key (33 bytes compressed). */ verifyingKey: ArrayBuffer; nonceCommitment: ExternalFrostCommitments; statechainCommitments: Array; statechainSignatures: Array; statechainPublicKeys: Array; }; /** * Generated factory for {@link ExternalSignStaticDepositRefundRequest} record objects. */ export const ExternalSignStaticDepositRefundRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalSignStaticDepositRefundRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalSignStaticDepositRefundRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalSignStaticDepositRefundRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze( defaults() ) as Partial, }); })(); const FfiConverterTypeExternalSignStaticDepositRefundRequest = (() => { type TypeName = ExternalSignStaticDepositRefundRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { index: FfiConverterUInt32.read(from), sighash: FfiConverterArrayBuffer.read(from), verifyingKey: FfiConverterArrayBuffer.read(from), nonceCommitment: FfiConverterTypeExternalFrostCommitments.read(from), statechainCommitments: FfiConverterArrayTypeIdentifierCommitmentPair.read(from), statechainSignatures: FfiConverterArrayTypeIdentifierSignaturePair.read(from), statechainPublicKeys: FfiConverterArrayTypeIdentifierPublicKeyPair.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt32.write(value.index, into); FfiConverterArrayBuffer.write(value.sighash, into); FfiConverterArrayBuffer.write(value.verifyingKey, into); FfiConverterTypeExternalFrostCommitments.write( value.nonceCommitment, into ); FfiConverterArrayTypeIdentifierCommitmentPair.write( value.statechainCommitments, into ); FfiConverterArrayTypeIdentifierSignaturePair.write( value.statechainSignatures, into ); FfiConverterArrayTypeIdentifierPublicKeyPair.write( value.statechainPublicKeys, into ); } allocationSize(value: TypeName): number { return ( FfiConverterUInt32.allocationSize(value.index) + FfiConverterArrayBuffer.allocationSize(value.sighash) + FfiConverterArrayBuffer.allocationSize(value.verifyingKey) + FfiConverterTypeExternalFrostCommitments.allocationSize( value.nonceCommitment ) + FfiConverterArrayTypeIdentifierCommitmentPair.allocationSize( value.statechainCommitments ) + FfiConverterArrayTypeIdentifierSignaturePair.allocationSize( value.statechainSignatures ) + FfiConverterArrayTypeIdentifierPublicKeyPair.allocationSize( value.statechainPublicKeys ) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::SignedSparkInvoice`. */ export type ExternalSignedSparkInvoice = { signature: SchnorrSignatureBytes; }; /** * Generated factory for {@link ExternalSignedSparkInvoice} record objects. */ export const ExternalSignedSparkInvoice = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalSignedSparkInvoice, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalSignedSparkInvoice}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalSignedSparkInvoice}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalSignedSparkInvoice = (() => { type TypeName = ExternalSignedSparkInvoice; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { signature: FfiConverterTypeSchnorrSignatureBytes.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeSchnorrSignatureBytes.write(value.signature, into); } allocationSize(value: TypeName): number { return FfiConverterTypeSchnorrSignatureBytes.allocationSize( value.signature ); } } return new FFIConverter(); })(); /** * The two default external signers created from one mnemonic by * [`default_external_signers`]. */ export type ExternalSigners = { /** * External signer for non-Spark SDK signing (LNURL-auth, sync, message * signing, ECIES). */ breezSigner: ExternalBreezSigner; /** * External high-level Spark signer for the Spark wallet flows. */ sparkSigner: ExternalSparkSigner; }; /** * Generated factory for {@link ExternalSigners} record objects. */ export const ExternalSigners = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalSigners}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalSigners}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalSigners = (() => { type TypeName = ExternalSigners; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { breezSigner: FfiConverterTypeExternalBreezSigner.read(from), sparkSigner: FfiConverterTypeExternalSparkSigner.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeExternalBreezSigner.write(value.breezSigner, into); FfiConverterTypeExternalSparkSigner.write(value.sparkSigner, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeExternalBreezSigner.allocationSize(value.breezSigner) + FfiConverterTypeExternalSparkSigner.allocationSize(value.sparkSigner) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `frost_secp256k1_tr::round1::SigningCommitments` */ export type ExternalSigningCommitments = { /** * Serialized hiding nonce commitment */ hiding: ArrayBuffer; /** * Serialized binding nonce commitment */ binding: ArrayBuffer; }; /** * Generated factory for {@link ExternalSigningCommitments} record objects. */ export const ExternalSigningCommitments = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalSigningCommitments, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalSigningCommitments}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalSigningCommitments}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalSigningCommitments = (() => { type TypeName = ExternalSigningCommitments; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { hiding: FfiConverterArrayBuffer.read(from), binding: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.hiding, into); FfiConverterArrayBuffer.write(value.binding, into); } allocationSize(value: TypeName): number { return ( FfiConverterArrayBuffer.allocationSize(value.hiding) + FfiConverterArrayBuffer.allocationSize(value.binding) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::StartStaticDepositRefundRequest`. */ export type ExternalStartStaticDepositRefundRequest = { index: /*u32*/ number; userStatement: ArrayBuffer; }; /** * Generated factory for {@link ExternalStartStaticDepositRefundRequest} record objects. */ export const ExternalStartStaticDepositRefundRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalStartStaticDepositRefundRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalStartStaticDepositRefundRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalStartStaticDepositRefundRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze( defaults() ) as Partial, }); })(); const FfiConverterTypeExternalStartStaticDepositRefundRequest = (() => { type TypeName = ExternalStartStaticDepositRefundRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { index: FfiConverterUInt32.read(from), userStatement: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt32.write(value.index, into); FfiConverterArrayBuffer.write(value.userStatement, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt32.allocationSize(value.index) + FfiConverterArrayBuffer.allocationSize(value.userStatement) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::StartedStaticDepositRefund`. */ export type ExternalStartedStaticDepositRefund = { /** * Static-deposit signing public key (33 bytes compressed). */ signingPublicKey: ArrayBuffer; nonceCommitment: ExternalFrostCommitments; userSignature: EcdsaSignatureBytes; }; /** * Generated factory for {@link ExternalStartedStaticDepositRefund} record objects. */ export const ExternalStartedStaticDepositRefund = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalStartedStaticDepositRefund, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalStartedStaticDepositRefund}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalStartedStaticDepositRefund}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalStartedStaticDepositRefund = (() => { type TypeName = ExternalStartedStaticDepositRefund; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { signingPublicKey: FfiConverterArrayBuffer.read(from), nonceCommitment: FfiConverterTypeExternalFrostCommitments.read(from), userSignature: FfiConverterTypeEcdsaSignatureBytes.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.signingPublicKey, into); FfiConverterTypeExternalFrostCommitments.write( value.nonceCommitment, into ); FfiConverterTypeEcdsaSignatureBytes.write(value.userSignature, into); } allocationSize(value: TypeName): number { return ( FfiConverterArrayBuffer.allocationSize(value.signingPublicKey) + FfiConverterTypeExternalFrostCommitments.allocationSize( value.nonceCommitment ) + FfiConverterTypeEcdsaSignatureBytes.allocationSize(value.userSignature) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::TransferLeafInput`. Conveys the old * leaf id and the new (post-transfer) leaf id; the signer derives keys from them. */ export type ExternalTransferLeafInput = { nodeId: ExternalTreeNodeId; newLeafId: ExternalTreeNodeId; }; /** * Generated factory for {@link ExternalTransferLeafInput} record objects. */ export const ExternalTransferLeafInput = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ExternalTransferLeafInput, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalTransferLeafInput}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalTransferLeafInput}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalTransferLeafInput = (() => { type TypeName = ExternalTransferLeafInput; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { nodeId: FfiConverterTypeExternalTreeNodeId.read(from), newLeafId: FfiConverterTypeExternalTreeNodeId.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeExternalTreeNodeId.write(value.nodeId, into); FfiConverterTypeExternalTreeNodeId.write(value.newLeafId, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeExternalTreeNodeId.allocationSize(value.nodeId) + FfiConverterTypeExternalTreeNodeId.allocationSize(value.newLeafId) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::TreeNodeId` */ export type ExternalTreeNodeId = { /** * The tree node identifier as a string */ id: string; }; /** * Generated factory for {@link ExternalTreeNodeId} record objects. */ export const ExternalTreeNodeId = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ExternalTreeNodeId}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ExternalTreeNodeId}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeExternalTreeNodeId = (() => { type TypeName = ExternalTreeNodeId; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { id: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.id, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.id); } } return new FFIConverter(); })(); export type FetchClaimDepositQuoteRequest = { txid: string; vout: /*u32*/ number; }; /** * Generated factory for {@link FetchClaimDepositQuoteRequest} record objects. */ export const FetchClaimDepositQuoteRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< FetchClaimDepositQuoteRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link FetchClaimDepositQuoteRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link FetchClaimDepositQuoteRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeFetchClaimDepositQuoteRequest = (() => { type TypeName = FetchClaimDepositQuoteRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { txid: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.txid, into); FfiConverterUInt32.write(value.vout, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.txid) + FfiConverterUInt32.allocationSize(value.vout) ); } } return new FFIConverter(); })(); export type FetchClaimDepositQuoteResponse = { amountSats: /*u64*/ bigint; /** * Confirmations the deposit has now, 0 while unconfirmed. */ confirmations: /*u32*/ number; /** * Claiming ahead of maturity, for a spread. Absent when the provider offers * no such option for this deposit, and when claiming early would not actually * be earlier: a deposit that has already matured, or a plan crediting no * sooner than maturity would, is only ever the more expensive way to wait. * * Also absent when the provider could not be reached for a quote, which is not * distinguished here from having nothing to offer: both mean there is no early * claim to show right now, and the one worth retrying is the transient one. * * Priced regardless of the configured maximum claim fee, which is usually far * below a spread. It is quoted so it can be offered, so claiming it needs a max * fee of at least its `fee_sats`. Below that the claim fails with * `MaxDepositClaimFeeExceeded` and the deposit waits for maturity. */ instant: ClaimDepositQuote | undefined; /** * Claiming once the deposit matures. */ mature: ClaimDepositQuote; }; /** * Generated factory for {@link FetchClaimDepositQuoteResponse} record objects. */ export const FetchClaimDepositQuoteResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< FetchClaimDepositQuoteResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link FetchClaimDepositQuoteResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link FetchClaimDepositQuoteResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeFetchClaimDepositQuoteResponse = (() => { type TypeName = FetchClaimDepositQuoteResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { amountSats: FfiConverterUInt64.read(from), confirmations: FfiConverterUInt32.read(from), instant: FfiConverterOptionalTypeClaimDepositQuote.read(from), mature: FfiConverterTypeClaimDepositQuote.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt64.write(value.amountSats, into); FfiConverterUInt32.write(value.confirmations, into); FfiConverterOptionalTypeClaimDepositQuote.write(value.instant, into); FfiConverterTypeClaimDepositQuote.write(value.mature, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt64.allocationSize(value.amountSats) + FfiConverterUInt32.allocationSize(value.confirmations) + FfiConverterOptionalTypeClaimDepositQuote.allocationSize( value.instant ) + FfiConverterTypeClaimDepositQuote.allocationSize(value.mature) ); } } return new FFIConverter(); })(); export type FetchConversionLimitsRequest = { /** * The type of conversion, either from or to Bitcoin. */ conversionType: ConversionType; /** * The token identifier when converting to a token. */ tokenIdentifier: string | undefined; }; /** * Generated factory for {@link FetchConversionLimitsRequest} record objects. */ export const FetchConversionLimitsRequest = (() => { const defaults = () => ({ tokenIdentifier: undefined }); const create = (() => { return uniffiCreateRecord< FetchConversionLimitsRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link FetchConversionLimitsRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link FetchConversionLimitsRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeFetchConversionLimitsRequest = (() => { type TypeName = FetchConversionLimitsRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { conversionType: FfiConverterTypeConversionType.read(from), tokenIdentifier: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeConversionType.write(value.conversionType, into); FfiConverterOptionalString.write(value.tokenIdentifier, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeConversionType.allocationSize(value.conversionType) + FfiConverterOptionalString.allocationSize(value.tokenIdentifier) ); } } return new FFIConverter(); })(); export type FetchConversionLimitsResponse = { /** * The minimum amount to be converted. * Denominated in satoshis if converting from Bitcoin, otherwise in the token base units. */ minFromAmount: U128 | undefined; /** * The minimum amount to be received from the conversion. * Denominated in satoshis if converting to Bitcoin, otherwise in the token base units. */ minToAmount: U128 | undefined; }; /** * Generated factory for {@link FetchConversionLimitsResponse} record objects. */ export const FetchConversionLimitsResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< FetchConversionLimitsResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link FetchConversionLimitsResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link FetchConversionLimitsResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeFetchConversionLimitsResponse = (() => { type TypeName = FetchConversionLimitsResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { minFromAmount: FfiConverterOptionalTypeu128.read(from), minToAmount: FfiConverterOptionalTypeu128.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalTypeu128.write(value.minFromAmount, into); FfiConverterOptionalTypeu128.write(value.minToAmount, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalTypeu128.allocationSize(value.minFromAmount) + FfiConverterOptionalTypeu128.allocationSize(value.minToAmount) ); } } return new FFIConverter(); })(); /** * Wrapper around the [`CurrencyInfo`] of a fiat currency */ export type FiatCurrency = { id: string; info: CurrencyInfo; }; /** * Generated factory for {@link FiatCurrency} record objects. */ export const FiatCurrency = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link FiatCurrency}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link FiatCurrency}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeFiatCurrency = (() => { type TypeName = FiatCurrency; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { id: FfiConverterString.read(from), info: FfiConverterTypeCurrencyInfo.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.id, into); FfiConverterTypeCurrencyInfo.write(value.info, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.id) + FfiConverterTypeCurrencyInfo.allocationSize(value.info) ); } } return new FFIConverter(); })(); export type FreezeIssuerTokenRequest = { address: string; }; /** * Generated factory for {@link FreezeIssuerTokenRequest} record objects. */ export const FreezeIssuerTokenRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< FreezeIssuerTokenRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link FreezeIssuerTokenRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link FreezeIssuerTokenRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeFreezeIssuerTokenRequest = (() => { type TypeName = FreezeIssuerTokenRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { address: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.address, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.address); } } return new FFIConverter(); })(); export type FreezeIssuerTokenResponse = { impactedOutputIds: Array; impactedTokenAmount: U128; }; /** * Generated factory for {@link FreezeIssuerTokenResponse} record objects. */ export const FreezeIssuerTokenResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< FreezeIssuerTokenResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link FreezeIssuerTokenResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link FreezeIssuerTokenResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeFreezeIssuerTokenResponse = (() => { type TypeName = FreezeIssuerTokenResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { impactedOutputIds: FfiConverterArrayString.read(from), impactedTokenAmount: FfiConverterTypeu128.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayString.write(value.impactedOutputIds, into); FfiConverterTypeu128.write(value.impactedTokenAmount, into); } allocationSize(value: TypeName): number { return ( FfiConverterArrayString.allocationSize(value.impactedOutputIds) + FfiConverterTypeu128.allocationSize(value.impactedTokenAmount) ); } } return new FFIConverter(); })(); /** * Request to get the balance of the wallet */ export type GetInfoRequest = { /** * When `Some(true)`, and `background_tasks_enabled` is `true`, the call * waits for the initial Full sync to complete before returning. * * When `background_tasks_enabled` is `false`, setting this to `Some(true)` * is rejected with an invalid-input error. There is no background sync to * wait on; call `sync_wallet` explicitly first if you need fresh state. */ ensureSynced: boolean | undefined; }; /** * Generated factory for {@link GetInfoRequest} record objects. */ export const GetInfoRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link GetInfoRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link GetInfoRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeGetInfoRequest = (() => { type TypeName = GetInfoRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { ensureSynced: FfiConverterOptionalBool.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalBool.write(value.ensureSynced, into); } allocationSize(value: TypeName): number { return FfiConverterOptionalBool.allocationSize(value.ensureSynced); } } return new FFIConverter(); })(); /** * Response containing the balance of the wallet */ export type GetInfoResponse = { /** * The identity public key of the wallet as a hex string */ identityPubkey: string; /** * The balance in satoshis */ balanceSats: /*u64*/ bigint; /** * The balances of the tokens in the wallet keyed by the token identifier */ tokenBalances: Map; }; /** * Generated factory for {@link GetInfoResponse} record objects. */ export const GetInfoResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link GetInfoResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link GetInfoResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeGetInfoResponse = (() => { type TypeName = GetInfoResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { identityPubkey: FfiConverterString.read(from), balanceSats: FfiConverterUInt64.read(from), tokenBalances: FfiConverterMapStringTypeTokenBalance.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.identityPubkey, into); FfiConverterUInt64.write(value.balanceSats, into); FfiConverterMapStringTypeTokenBalance.write(value.tokenBalances, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.identityPubkey) + FfiConverterUInt64.allocationSize(value.balanceSats) + FfiConverterMapStringTypeTokenBalance.allocationSize( value.tokenBalances ) ); } } return new FFIConverter(); })(); export type GetPaymentRequest = { paymentId: string; }; /** * Generated factory for {@link GetPaymentRequest} record objects. */ export const GetPaymentRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link GetPaymentRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link GetPaymentRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeGetPaymentRequest = (() => { type TypeName = GetPaymentRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { paymentId: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.paymentId, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.paymentId); } } return new FFIConverter(); })(); export type GetPaymentResponse = { payment: Payment; }; /** * Generated factory for {@link GetPaymentResponse} record objects. */ export const GetPaymentResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link GetPaymentResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link GetPaymentResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeGetPaymentResponse = (() => { type TypeName = GetPaymentResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { payment: FfiConverterTypePayment.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypePayment.write(value.payment, into); } allocationSize(value: TypeName): number { return FfiConverterTypePayment.allocationSize(value.payment); } } return new FFIConverter(); })(); /** * Options for [`get_spark_status`]. */ export type GetSparkStatusRequest = { /** * Routes the status request through a SOCKS5 proxy. Pass the same value as * [`Config::proxy`]: this call runs without an SDK instance, so it cannot * pick the setting up on its own. */ proxy: ProxyConfig | undefined; }; /** * Generated factory for {@link GetSparkStatusRequest} record objects. */ export const GetSparkStatusRequest = (() => { const defaults = () => ({ proxy: undefined }); const create = (() => { return uniffiCreateRecord< GetSparkStatusRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link GetSparkStatusRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link GetSparkStatusRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeGetSparkStatusRequest = (() => { type TypeName = GetSparkStatusRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { proxy: FfiConverterOptionalTypeProxyConfig.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalTypeProxyConfig.write(value.proxy, into); } allocationSize(value: TypeName): number { return FfiConverterOptionalTypeProxyConfig.allocationSize(value.proxy); } } return new FFIConverter(); })(); export type GetTokensMetadataRequest = { tokenIdentifiers: Array; }; /** * Generated factory for {@link GetTokensMetadataRequest} record objects. */ export const GetTokensMetadataRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< GetTokensMetadataRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link GetTokensMetadataRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link GetTokensMetadataRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeGetTokensMetadataRequest = (() => { type TypeName = GetTokensMetadataRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { tokenIdentifiers: FfiConverterArrayString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayString.write(value.tokenIdentifiers, into); } allocationSize(value: TypeName): number { return FfiConverterArrayString.allocationSize(value.tokenIdentifiers); } } return new FFIConverter(); })(); export type GetTokensMetadataResponse = { tokensMetadata: Array; }; /** * Generated factory for {@link GetTokensMetadataResponse} record objects. */ export const GetTokensMetadataResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< GetTokensMetadataResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link GetTokensMetadataResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link GetTokensMetadataResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeGetTokensMetadataResponse = (() => { type TypeName = GetTokensMetadataResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { tokensMetadata: FfiConverterArrayTypeTokenMetadata.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypeTokenMetadata.write(value.tokensMetadata, into); } allocationSize(value: TypeName): number { return FfiConverterArrayTypeTokenMetadata.allocationSize( value.tokensMetadata ); } } return new FFIConverter(); })(); export type HashedMessageBytes = { bytes: ArrayBuffer; }; /** * Generated factory for {@link HashedMessageBytes} record objects. */ export const HashedMessageBytes = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link HashedMessageBytes}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link HashedMessageBytes}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeHashedMessageBytes = (() => { type TypeName = HashedMessageBytes; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { bytes: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.bytes, into); } allocationSize(value: TypeName): number { return FfiConverterArrayBuffer.allocationSize(value.bytes); } } return new FFIConverter(); })(); /** * FFI-safe wrapper for (Identifier, `SigningCommitments`) pair */ export type IdentifierCommitmentPair = { identifier: ExternalIdentifier; commitment: ExternalSigningCommitments; }; /** * Generated factory for {@link IdentifierCommitmentPair} record objects. */ export const IdentifierCommitmentPair = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< IdentifierCommitmentPair, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link IdentifierCommitmentPair}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link IdentifierCommitmentPair}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeIdentifierCommitmentPair = (() => { type TypeName = IdentifierCommitmentPair; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { identifier: FfiConverterTypeExternalIdentifier.read(from), commitment: FfiConverterTypeExternalSigningCommitments.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeExternalIdentifier.write(value.identifier, into); FfiConverterTypeExternalSigningCommitments.write(value.commitment, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeExternalIdentifier.allocationSize(value.identifier) + FfiConverterTypeExternalSigningCommitments.allocationSize( value.commitment ) ); } } return new FFIConverter(); })(); /** * FFI-safe wrapper for (Identifier, `PublicKey`) pair */ export type IdentifierPublicKeyPair = { identifier: ExternalIdentifier; publicKey: ArrayBuffer; }; /** * Generated factory for {@link IdentifierPublicKeyPair} record objects. */ export const IdentifierPublicKeyPair = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< IdentifierPublicKeyPair, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link IdentifierPublicKeyPair}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link IdentifierPublicKeyPair}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeIdentifierPublicKeyPair = (() => { type TypeName = IdentifierPublicKeyPair; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { identifier: FfiConverterTypeExternalIdentifier.read(from), publicKey: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeExternalIdentifier.write(value.identifier, into); FfiConverterArrayBuffer.write(value.publicKey, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeExternalIdentifier.allocationSize(value.identifier) + FfiConverterArrayBuffer.allocationSize(value.publicKey) ); } } return new FFIConverter(); })(); /** * FFI-safe wrapper for (Identifier, `SignatureShare`) pair */ export type IdentifierSignaturePair = { identifier: ExternalIdentifier; signature: ExternalFrostSignatureShare; }; /** * Generated factory for {@link IdentifierSignaturePair} record objects. */ export const IdentifierSignaturePair = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< IdentifierSignaturePair, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link IdentifierSignaturePair}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link IdentifierSignaturePair}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeIdentifierSignaturePair = (() => { type TypeName = IdentifierSignaturePair; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { identifier: FfiConverterTypeExternalIdentifier.read(from), signature: FfiConverterTypeExternalFrostSignatureShare.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeExternalIdentifier.write(value.identifier, into); FfiConverterTypeExternalFrostSignatureShare.write(value.signature, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeExternalIdentifier.allocationSize(value.identifier) + FfiConverterTypeExternalFrostSignatureShare.allocationSize( value.signature ) ); } } return new FFIConverter(); })(); /** * Request for `import_unilateral_exit_state`. */ export type ImportUnilateralExitStateRequest = { /** * An exit state as returned by `export_unilateral_exit_state`. */ exitState: string; }; /** * Generated factory for {@link ImportUnilateralExitStateRequest} record objects. */ export const ImportUnilateralExitStateRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ImportUnilateralExitStateRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ImportUnilateralExitStateRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ImportUnilateralExitStateRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeImportUnilateralExitStateRequest = (() => { type TypeName = ImportUnilateralExitStateRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { exitState: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.exitState, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.exitState); } } return new FFIConverter(); })(); /** * Result of `import_unilateral_exit_state`. */ export type ImportUnilateralExitStateResponse = { /** * Leaves merged into the wallet's exit state, whether or not their exit * data was taken with them. */ importedLeaves: /*u32*/ number; /** * Leaves left out because the exit state does not record this wallet as * their owner. */ skippedForeignLeaves: /*u32*/ number; /** * Leaves left out because their exit data disagrees with what the wallet * already holds, so none of it could be trusted. The wallet is left without * these leaves. */ skippedConflictingLeaves: /*u32*/ number; /** * Leaves the wallet holds whose imported exit data was left out: it is * incomplete, the wallet's own copy can already back an exit, or the leaf * was named more than once. The leaf itself is in the wallet either way. */ skippedChains: /*u32*/ number; }; /** * Generated factory for {@link ImportUnilateralExitStateResponse} record objects. */ export const ImportUnilateralExitStateResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ImportUnilateralExitStateResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ImportUnilateralExitStateResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ImportUnilateralExitStateResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeImportUnilateralExitStateResponse = (() => { type TypeName = ImportUnilateralExitStateResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { importedLeaves: FfiConverterUInt32.read(from), skippedForeignLeaves: FfiConverterUInt32.read(from), skippedConflictingLeaves: FfiConverterUInt32.read(from), skippedChains: FfiConverterUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt32.write(value.importedLeaves, into); FfiConverterUInt32.write(value.skippedForeignLeaves, into); FfiConverterUInt32.write(value.skippedConflictingLeaves, into); FfiConverterUInt32.write(value.skippedChains, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt32.allocationSize(value.importedLeaves) + FfiConverterUInt32.allocationSize(value.skippedForeignLeaves) + FfiConverterUInt32.allocationSize(value.skippedConflictingLeaves) + FfiConverterUInt32.allocationSize(value.skippedChains) ); } } return new FFIConverter(); })(); export type IncomingChange = { newState: Record; oldState: Record | undefined; }; /** * Generated factory for {@link IncomingChange} record objects. */ export const IncomingChange = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link IncomingChange}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link IncomingChange}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeIncomingChange = (() => { type TypeName = IncomingChange; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { newState: FfiConverterTypeRecord.read(from), oldState: FfiConverterOptionalTypeRecord.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeRecord.write(value.newState, into); FfiConverterOptionalTypeRecord.write(value.oldState, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeRecord.allocationSize(value.newState) + FfiConverterOptionalTypeRecord.allocationSize(value.oldState) ); } } return new FFIConverter(); })(); /** * Configuration for leaf optimization. */ export type LeafOptimizationConfig = { /** * Whether automatic leaf optimization is enabled. * * If set to true, the SDK will automatically optimize the leaf set when it changes. * Otherwise, the manual optimization API must be used to optimize the leaf set. * * Default value is true. */ autoEnabled: boolean; /** * The desired multiplicity for the leaf set. * * Setting this to 0 will optimize for maximizing unilateral exit. * Higher values will optimize for minimizing transfer swaps, with higher values * being more aggressive and allowing better TPS rates. * * For end-user wallets, values of 1-5 are recommended. Values above 5 are * intended for high-throughput server environments and are not recommended * for end-user wallets due to significantly higher unilateral exit costs. * * Default value is 1. */ multiplicity: /*u8*/ number; }; /** * Generated factory for {@link LeafOptimizationConfig} record objects. */ export const LeafOptimizationConfig = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< LeafOptimizationConfig, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link LeafOptimizationConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LeafOptimizationConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLeafOptimizationConfig = (() => { type TypeName = LeafOptimizationConfig; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { autoEnabled: FfiConverterBool.read(from), multiplicity: FfiConverterUInt8.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterBool.write(value.autoEnabled, into); FfiConverterUInt8.write(value.multiplicity, into); } allocationSize(value: TypeName): number { return ( FfiConverterBool.allocationSize(value.autoEnabled) + FfiConverterUInt8.allocationSize(value.multiplicity) ); } } return new FFIConverter(); })(); export type LightningAddressDetails = { address: string; payRequest: LnurlPayRequestDetails; }; /** * Generated factory for {@link LightningAddressDetails} record objects. */ export const LightningAddressDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< LightningAddressDetails, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link LightningAddressDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LightningAddressDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLightningAddressDetails = (() => { type TypeName = LightningAddressDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { address: FfiConverterString.read(from), payRequest: FfiConverterTypeLnurlPayRequestDetails.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.address, into); FfiConverterTypeLnurlPayRequestDetails.write(value.payRequest, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.address) + FfiConverterTypeLnurlPayRequestDetails.allocationSize(value.payRequest) ); } } return new FFIConverter(); })(); export type LightningAddressInfo = { description: string; lightningAddress: string; lnurl: LnurlInfo; username: string; }; /** * Generated factory for {@link LightningAddressInfo} record objects. */ export const LightningAddressInfo = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< LightningAddressInfo, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link LightningAddressInfo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LightningAddressInfo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLightningAddressInfo = (() => { type TypeName = LightningAddressInfo; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { description: FfiConverterString.read(from), lightningAddress: FfiConverterString.read(from), lnurl: FfiConverterTypeLnurlInfo.read(from), username: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.description, into); FfiConverterString.write(value.lightningAddress, into); FfiConverterTypeLnurlInfo.write(value.lnurl, into); FfiConverterString.write(value.username, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.description) + FfiConverterString.allocationSize(value.lightningAddress) + FfiConverterTypeLnurlInfo.allocationSize(value.lnurl) + FfiConverterString.allocationSize(value.username) ); } } return new FFIConverter(); })(); /** * Request to list contacts with optional pagination. */ export type ListContactsRequest = { offset: /*u32*/ number | undefined; limit: /*u32*/ number | undefined; }; /** * Generated factory for {@link ListContactsRequest} record objects. */ export const ListContactsRequest = (() => { const defaults = () => ({ offset: undefined, limit: undefined }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ListContactsRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ListContactsRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeListContactsRequest = (() => { type TypeName = ListContactsRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { offset: FfiConverterOptionalUInt32.read(from), limit: FfiConverterOptionalUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalUInt32.write(value.offset, into); FfiConverterOptionalUInt32.write(value.limit, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalUInt32.allocationSize(value.offset) + FfiConverterOptionalUInt32.allocationSize(value.limit) ); } } return new FFIConverter(); })(); /** * Response from listing fiat currencies */ export type ListFiatCurrenciesResponse = { /** * The list of fiat currencies */ currencies: Array; }; /** * Generated factory for {@link ListFiatCurrenciesResponse} record objects. */ export const ListFiatCurrenciesResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ListFiatCurrenciesResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ListFiatCurrenciesResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ListFiatCurrenciesResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeListFiatCurrenciesResponse = (() => { type TypeName = ListFiatCurrenciesResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { currencies: FfiConverterArrayTypeFiatCurrency.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypeFiatCurrency.write(value.currencies, into); } allocationSize(value: TypeName): number { return FfiConverterArrayTypeFiatCurrency.allocationSize(value.currencies); } } return new FFIConverter(); })(); /** * Response from listing fiat rates */ export type ListFiatRatesResponse = { /** * The list of fiat rates */ rates: Array; }; /** * Generated factory for {@link ListFiatRatesResponse} record objects. */ export const ListFiatRatesResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ListFiatRatesResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ListFiatRatesResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ListFiatRatesResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeListFiatRatesResponse = (() => { type TypeName = ListFiatRatesResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { rates: FfiConverterArrayTypeRate.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypeRate.write(value.rates, into); } allocationSize(value: TypeName): number { return FfiConverterArrayTypeRate.allocationSize(value.rates); } } return new FFIConverter(); })(); /** * Request to list payments with optional filters and pagination */ export type ListPaymentsRequest = { typeFilter: Array | undefined; statusFilter: Array | undefined; assetFilter: AssetFilter | undefined; /** * Only include payments matching at least one of these payment details filters */ paymentDetailsFilter: Array | undefined; /** * Only include payments created after this timestamp (inclusive) */ fromTimestamp: /*u64*/ bigint | undefined; /** * Only include payments created before this timestamp (exclusive) */ toTimestamp: /*u64*/ bigint | undefined; /** * Number of records to skip */ offset: /*u32*/ number | undefined; /** * Maximum number of records to return */ limit: /*u32*/ number | undefined; sortAscending: boolean | undefined; }; /** * Generated factory for {@link ListPaymentsRequest} record objects. */ export const ListPaymentsRequest = (() => { const defaults = () => ({ typeFilter: undefined, statusFilter: undefined, assetFilter: undefined, paymentDetailsFilter: undefined, fromTimestamp: undefined, toTimestamp: undefined, offset: undefined, limit: undefined, sortAscending: undefined, }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ListPaymentsRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ListPaymentsRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeListPaymentsRequest = (() => { type TypeName = ListPaymentsRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { typeFilter: FfiConverterOptionalArrayTypePaymentType.read(from), statusFilter: FfiConverterOptionalArrayTypePaymentStatus.read(from), assetFilter: FfiConverterOptionalTypeAssetFilter.read(from), paymentDetailsFilter: FfiConverterOptionalArrayTypePaymentDetailsFilter.read(from), fromTimestamp: FfiConverterOptionalUInt64.read(from), toTimestamp: FfiConverterOptionalUInt64.read(from), offset: FfiConverterOptionalUInt32.read(from), limit: FfiConverterOptionalUInt32.read(from), sortAscending: FfiConverterOptionalBool.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalArrayTypePaymentType.write(value.typeFilter, into); FfiConverterOptionalArrayTypePaymentStatus.write( value.statusFilter, into ); FfiConverterOptionalTypeAssetFilter.write(value.assetFilter, into); FfiConverterOptionalArrayTypePaymentDetailsFilter.write( value.paymentDetailsFilter, into ); FfiConverterOptionalUInt64.write(value.fromTimestamp, into); FfiConverterOptionalUInt64.write(value.toTimestamp, into); FfiConverterOptionalUInt32.write(value.offset, into); FfiConverterOptionalUInt32.write(value.limit, into); FfiConverterOptionalBool.write(value.sortAscending, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalArrayTypePaymentType.allocationSize( value.typeFilter ) + FfiConverterOptionalArrayTypePaymentStatus.allocationSize( value.statusFilter ) + FfiConverterOptionalTypeAssetFilter.allocationSize(value.assetFilter) + FfiConverterOptionalArrayTypePaymentDetailsFilter.allocationSize( value.paymentDetailsFilter ) + FfiConverterOptionalUInt64.allocationSize(value.fromTimestamp) + FfiConverterOptionalUInt64.allocationSize(value.toTimestamp) + FfiConverterOptionalUInt32.allocationSize(value.offset) + FfiConverterOptionalUInt32.allocationSize(value.limit) + FfiConverterOptionalBool.allocationSize(value.sortAscending) ); } } return new FFIConverter(); })(); /** * Response from listing payments */ export type ListPaymentsResponse = { /** * The list of payments */ payments: Array; }; /** * Generated factory for {@link ListPaymentsResponse} record objects. */ export const ListPaymentsResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ListPaymentsResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ListPaymentsResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ListPaymentsResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeListPaymentsResponse = (() => { type TypeName = ListPaymentsResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { payments: FfiConverterArrayTypePayment.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypePayment.write(value.payments, into); } allocationSize(value: TypeName): number { return FfiConverterArrayTypePayment.allocationSize(value.payments); } } return new FFIConverter(); })(); export type ListUnclaimedDepositsRequest = {}; /** * Generated factory for {@link ListUnclaimedDepositsRequest} record objects. */ export const ListUnclaimedDepositsRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ListUnclaimedDepositsRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ListUnclaimedDepositsRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ListUnclaimedDepositsRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeListUnclaimedDepositsRequest = (() => { type TypeName = ListUnclaimedDepositsRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return {}; } write(value: TypeName, into: RustBuffer): void {} allocationSize(value: TypeName): number { return 0; } } return new FFIConverter(); })(); export type ListUnclaimedDepositsResponse = { deposits: Array; }; /** * Generated factory for {@link ListUnclaimedDepositsResponse} record objects. */ export const ListUnclaimedDepositsResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ListUnclaimedDepositsResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ListUnclaimedDepositsResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ListUnclaimedDepositsResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeListUnclaimedDepositsResponse = (() => { type TypeName = ListUnclaimedDepositsResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { deposits: FfiConverterArrayTypeDepositInfo.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypeDepositInfo.write(value.deposits, into); } allocationSize(value: TypeName): number { return FfiConverterArrayTypeDepositInfo.allocationSize(value.deposits); } } return new FFIConverter(); })(); /** * Wrapped in a [`InputType::LnurlAuth`], this is the result of parsing a LNURL-auth endpoint. * * It represents the endpoint's parameters for the LNURL workflow. * * See */ export type LnurlAuthRequestDetails = { /** * Hex encoded 32 bytes of challenge */ k1: string; /** * When available, one of: register, login, link, auth */ action: string | undefined; /** * Indicates the domain of the LNURL-auth service, to be shown to the user when asking for * auth confirmation, as per LUD-04 spec. */ domain: string; /** * Indicates the URL of the LNURL-auth service, including the query arguments. This will be * extended with the signed challenge and the linking key, then called in the second step of the workflow. */ url: string; }; /** * Generated factory for {@link LnurlAuthRequestDetails} record objects. */ export const LnurlAuthRequestDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< LnurlAuthRequestDetails, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link LnurlAuthRequestDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LnurlAuthRequestDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLnurlAuthRequestDetails = (() => { type TypeName = LnurlAuthRequestDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { k1: FfiConverterString.read(from), action: FfiConverterOptionalString.read(from), domain: FfiConverterString.read(from), url: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.k1, into); FfiConverterOptionalString.write(value.action, into); FfiConverterString.write(value.domain, into); FfiConverterString.write(value.url, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.k1) + FfiConverterOptionalString.allocationSize(value.action) + FfiConverterString.allocationSize(value.domain) + FfiConverterString.allocationSize(value.url) ); } } return new FFIConverter(); })(); /** * LNURL error details */ export type LnurlErrorDetails = { reason: string; }; /** * Generated factory for {@link LnurlErrorDetails} record objects. */ export const LnurlErrorDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link LnurlErrorDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LnurlErrorDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLnurlErrorDetails = (() => { type TypeName = LnurlErrorDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { reason: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.reason, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.reason); } } return new FFIConverter(); })(); export type LnurlInfo = { url: string; bech32: string; }; /** * Generated factory for {@link LnurlInfo} record objects. */ export const LnurlInfo = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link LnurlInfo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LnurlInfo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLnurlInfo = (() => { type TypeName = LnurlInfo; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { url: FfiConverterString.read(from), bech32: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.url, into); FfiConverterString.write(value.bech32, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.url) + FfiConverterString.allocationSize(value.bech32) ); } } return new FFIConverter(); })(); export type LnurlPayContext = { payRequest: LnurlPayRequestDetails; comment: string | undefined; successAction: SuccessAction | undefined; }; /** * Generated factory for {@link LnurlPayContext} record objects. */ export const LnurlPayContext = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link LnurlPayContext}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LnurlPayContext}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLnurlPayContext = (() => { type TypeName = LnurlPayContext; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { payRequest: FfiConverterTypeLnurlPayRequestDetails.read(from), comment: FfiConverterOptionalString.read(from), successAction: FfiConverterOptionalTypeSuccessAction.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeLnurlPayRequestDetails.write(value.payRequest, into); FfiConverterOptionalString.write(value.comment, into); FfiConverterOptionalTypeSuccessAction.write(value.successAction, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeLnurlPayRequestDetails.allocationSize( value.payRequest ) + FfiConverterOptionalString.allocationSize(value.comment) + FfiConverterOptionalTypeSuccessAction.allocationSize( value.successAction ) ); } } return new FFIConverter(); })(); /** * Represents the payment LNURL info */ export type LnurlPayInfo = { lnAddress: string | undefined; comment: string | undefined; domain: string | undefined; metadata: string | undefined; processedSuccessAction: SuccessActionProcessed | undefined; rawSuccessAction: SuccessAction | undefined; }; /** * Generated factory for {@link LnurlPayInfo} record objects. */ export const LnurlPayInfo = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link LnurlPayInfo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LnurlPayInfo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLnurlPayInfo = (() => { type TypeName = LnurlPayInfo; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { lnAddress: FfiConverterOptionalString.read(from), comment: FfiConverterOptionalString.read(from), domain: FfiConverterOptionalString.read(from), metadata: FfiConverterOptionalString.read(from), processedSuccessAction: FfiConverterOptionalTypeSuccessActionProcessed.read(from), rawSuccessAction: FfiConverterOptionalTypeSuccessAction.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.lnAddress, into); FfiConverterOptionalString.write(value.comment, into); FfiConverterOptionalString.write(value.domain, into); FfiConverterOptionalString.write(value.metadata, into); FfiConverterOptionalTypeSuccessActionProcessed.write( value.processedSuccessAction, into ); FfiConverterOptionalTypeSuccessAction.write(value.rawSuccessAction, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.lnAddress) + FfiConverterOptionalString.allocationSize(value.comment) + FfiConverterOptionalString.allocationSize(value.domain) + FfiConverterOptionalString.allocationSize(value.metadata) + FfiConverterOptionalTypeSuccessActionProcessed.allocationSize( value.processedSuccessAction ) + FfiConverterOptionalTypeSuccessAction.allocationSize( value.rawSuccessAction ) ); } } return new FFIConverter(); })(); export type LnurlPayRequest = { prepareResponse: PrepareLnurlPayResponse; /** * If set, providing the same idempotency key for multiple requests will ensure that only one * payment is made. If an idempotency key is re-used, the same payment will be returned. * The idempotency key must be a valid UUID. */ idempotencyKey: string | undefined; }; /** * Generated factory for {@link LnurlPayRequest} record objects. */ export const LnurlPayRequest = (() => { const defaults = () => ({ idempotencyKey: undefined }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link LnurlPayRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LnurlPayRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLnurlPayRequest = (() => { type TypeName = LnurlPayRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { prepareResponse: FfiConverterTypePrepareLnurlPayResponse.read(from), idempotencyKey: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypePrepareLnurlPayResponse.write( value.prepareResponse, into ); FfiConverterOptionalString.write(value.idempotencyKey, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypePrepareLnurlPayResponse.allocationSize( value.prepareResponse ) + FfiConverterOptionalString.allocationSize(value.idempotencyKey) ); } } return new FFIConverter(); })(); export type LnurlPayRequestDetails = { callback: string; /** * The minimum amount, in millisats, that this LNURL-pay endpoint accepts */ minSendable: /*u64*/ bigint; /** * The maximum amount, in millisats, that this LNURL-pay endpoint accepts */ maxSendable: /*u64*/ bigint; /** * As per LUD-06, `metadata` is a raw string (e.g. a json representation of the inner map). * Use `metadata_vec()` to get the parsed items. */ metadataStr: string; /** * The comment length accepted by this endpoint * * See */ commentAllowed: /*u16*/ number; /** * Indicates the domain of the LNURL-pay service, to be shown to the user when asking for * payment input, as per LUD-06 spec. * * Note: this is not the domain of the callback, but the domain of the LNURL-pay endpoint. */ domain: string; url: string; /** * Optional lightning address if that was used to resolve the lnurl. */ address: string | undefined; /** * Value indicating whether the recipient supports Nostr Zaps through NIP-57. * * See */ allowsNostr: boolean | undefined; /** * Optional recipient's lnurl provider's Nostr pubkey for NIP-57. If it exists it should be a * valid BIP 340 public key in hex. * * See * See */ nostrPubkey: string | undefined; }; /** * Generated factory for {@link LnurlPayRequestDetails} record objects. */ export const LnurlPayRequestDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< LnurlPayRequestDetails, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link LnurlPayRequestDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LnurlPayRequestDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLnurlPayRequestDetails = (() => { type TypeName = LnurlPayRequestDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { callback: FfiConverterString.read(from), minSendable: FfiConverterUInt64.read(from), maxSendable: FfiConverterUInt64.read(from), metadataStr: FfiConverterString.read(from), commentAllowed: FfiConverterUInt16.read(from), domain: FfiConverterString.read(from), url: FfiConverterString.read(from), address: FfiConverterOptionalString.read(from), allowsNostr: FfiConverterOptionalBool.read(from), nostrPubkey: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.callback, into); FfiConverterUInt64.write(value.minSendable, into); FfiConverterUInt64.write(value.maxSendable, into); FfiConverterString.write(value.metadataStr, into); FfiConverterUInt16.write(value.commentAllowed, into); FfiConverterString.write(value.domain, into); FfiConverterString.write(value.url, into); FfiConverterOptionalString.write(value.address, into); FfiConverterOptionalBool.write(value.allowsNostr, into); FfiConverterOptionalString.write(value.nostrPubkey, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.callback) + FfiConverterUInt64.allocationSize(value.minSendable) + FfiConverterUInt64.allocationSize(value.maxSendable) + FfiConverterString.allocationSize(value.metadataStr) + FfiConverterUInt16.allocationSize(value.commentAllowed) + FfiConverterString.allocationSize(value.domain) + FfiConverterString.allocationSize(value.url) + FfiConverterOptionalString.allocationSize(value.address) + FfiConverterOptionalBool.allocationSize(value.allowsNostr) + FfiConverterOptionalString.allocationSize(value.nostrPubkey) ); } } return new FFIConverter(); })(); export type LnurlPayResponse = { payment: Payment; successAction: SuccessActionProcessed | undefined; }; /** * Generated factory for {@link LnurlPayResponse} record objects. */ export const LnurlPayResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link LnurlPayResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LnurlPayResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLnurlPayResponse = (() => { type TypeName = LnurlPayResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { payment: FfiConverterTypePayment.read(from), successAction: FfiConverterOptionalTypeSuccessActionProcessed.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypePayment.write(value.payment, into); FfiConverterOptionalTypeSuccessActionProcessed.write( value.successAction, into ); } allocationSize(value: TypeName): number { return ( FfiConverterTypePayment.allocationSize(value.payment) + FfiConverterOptionalTypeSuccessActionProcessed.allocationSize( value.successAction ) ); } } return new FFIConverter(); })(); export type LnurlReceiveMetadata = { nostrZapRequest: string | undefined; nostrZapReceipt: string | undefined; senderComment: string | undefined; }; /** * Generated factory for {@link LnurlReceiveMetadata} record objects. */ export const LnurlReceiveMetadata = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< LnurlReceiveMetadata, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link LnurlReceiveMetadata}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LnurlReceiveMetadata}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLnurlReceiveMetadata = (() => { type TypeName = LnurlReceiveMetadata; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { nostrZapRequest: FfiConverterOptionalString.read(from), nostrZapReceipt: FfiConverterOptionalString.read(from), senderComment: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.nostrZapRequest, into); FfiConverterOptionalString.write(value.nostrZapReceipt, into); FfiConverterOptionalString.write(value.senderComment, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.nostrZapRequest) + FfiConverterOptionalString.allocationSize(value.nostrZapReceipt) + FfiConverterOptionalString.allocationSize(value.senderComment) ); } } return new FFIConverter(); })(); /** * Represents the withdraw LNURL info */ export type LnurlWithdrawInfo = { withdrawUrl: string; }; /** * Generated factory for {@link LnurlWithdrawInfo} record objects. */ export const LnurlWithdrawInfo = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link LnurlWithdrawInfo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LnurlWithdrawInfo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLnurlWithdrawInfo = (() => { type TypeName = LnurlWithdrawInfo; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { withdrawUrl: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.withdrawUrl, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.withdrawUrl); } } return new FFIConverter(); })(); export type LnurlWithdrawRequest = { /** * The amount to withdraw in satoshis * Must be within the min and max withdrawable limits */ amountSats: /*u64*/ bigint; withdrawRequest: LnurlWithdrawRequestDetails; /** * If set, the function will return the payment if it is still pending after this * number of seconds. If unset, the function will return immediately after * initiating the LNURL withdraw. */ completionTimeoutSecs: /*u32*/ number | undefined; }; /** * Generated factory for {@link LnurlWithdrawRequest} record objects. */ export const LnurlWithdrawRequest = (() => { const defaults = () => ({ completionTimeoutSecs: undefined }); const create = (() => { return uniffiCreateRecord< LnurlWithdrawRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link LnurlWithdrawRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LnurlWithdrawRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLnurlWithdrawRequest = (() => { type TypeName = LnurlWithdrawRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { amountSats: FfiConverterUInt64.read(from), withdrawRequest: FfiConverterTypeLnurlWithdrawRequestDetails.read(from), completionTimeoutSecs: FfiConverterOptionalUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt64.write(value.amountSats, into); FfiConverterTypeLnurlWithdrawRequestDetails.write( value.withdrawRequest, into ); FfiConverterOptionalUInt32.write(value.completionTimeoutSecs, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt64.allocationSize(value.amountSats) + FfiConverterTypeLnurlWithdrawRequestDetails.allocationSize( value.withdrawRequest ) + FfiConverterOptionalUInt32.allocationSize(value.completionTimeoutSecs) ); } } return new FFIConverter(); })(); export type LnurlWithdrawRequestDetails = { callback: string; k1: string; defaultDescription: string; /** * The minimum amount, in millisats, that this LNURL-withdraw endpoint accepts */ minWithdrawable: /*u64*/ bigint; /** * The maximum amount, in millisats, that this LNURL-withdraw endpoint accepts */ maxWithdrawable: /*u64*/ bigint; /** * The URL of the LNURL-withdraw endpoint these details were fetched from. * Set when the details come from parsing an input; determines how far the * withdraw flow trusts the endpoint-chosen `callback`. Absent or empty * means no exemption: the callback is held to the public-host rules. */ url: string; }; /** * Generated factory for {@link LnurlWithdrawRequestDetails} record objects. */ export const LnurlWithdrawRequestDetails = (() => { const defaults = () => ({ url: '' }); const create = (() => { return uniffiCreateRecord< LnurlWithdrawRequestDetails, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link LnurlWithdrawRequestDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LnurlWithdrawRequestDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLnurlWithdrawRequestDetails = (() => { type TypeName = LnurlWithdrawRequestDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { callback: FfiConverterString.read(from), k1: FfiConverterString.read(from), defaultDescription: FfiConverterString.read(from), minWithdrawable: FfiConverterUInt64.read(from), maxWithdrawable: FfiConverterUInt64.read(from), url: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.callback, into); FfiConverterString.write(value.k1, into); FfiConverterString.write(value.defaultDescription, into); FfiConverterUInt64.write(value.minWithdrawable, into); FfiConverterUInt64.write(value.maxWithdrawable, into); FfiConverterString.write(value.url, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.callback) + FfiConverterString.allocationSize(value.k1) + FfiConverterString.allocationSize(value.defaultDescription) + FfiConverterUInt64.allocationSize(value.minWithdrawable) + FfiConverterUInt64.allocationSize(value.maxWithdrawable) + FfiConverterString.allocationSize(value.url) ); } } return new FFIConverter(); })(); export type LnurlWithdrawResponse = { /** * The Lightning invoice generated for the LNURL withdraw */ paymentRequest: string; payment: Payment | undefined; }; /** * Generated factory for {@link LnurlWithdrawResponse} record objects. */ export const LnurlWithdrawResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< LnurlWithdrawResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link LnurlWithdrawResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LnurlWithdrawResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLnurlWithdrawResponse = (() => { type TypeName = LnurlWithdrawResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { paymentRequest: FfiConverterString.read(from), payment: FfiConverterOptionalTypePayment.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.paymentRequest, into); FfiConverterOptionalTypePayment.write(value.payment, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.paymentRequest) + FfiConverterOptionalTypePayment.allocationSize(value.payment) ); } } return new FFIConverter(); })(); /** * Locale-specific settings for the representation of a currency */ export type LocaleOverrides = { locale: string; spacing: /*u32*/ number | undefined; symbol: Symbol; }; /** * Generated factory for {@link LocaleOverrides} record objects. */ export const LocaleOverrides = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link LocaleOverrides}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LocaleOverrides}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLocaleOverrides = (() => { type TypeName = LocaleOverrides; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { locale: FfiConverterString.read(from), spacing: FfiConverterOptionalUInt32.read(from), symbol: FfiConverterTypeSymbol.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.locale, into); FfiConverterOptionalUInt32.write(value.spacing, into); FfiConverterTypeSymbol.write(value.symbol, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.locale) + FfiConverterOptionalUInt32.allocationSize(value.spacing) + FfiConverterTypeSymbol.allocationSize(value.symbol) ); } } return new FFIConverter(); })(); /** * Localized name of a currency */ export type LocalizedName = { locale: string; name: string; }; /** * Generated factory for {@link LocalizedName} record objects. */ export const LocalizedName = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link LocalizedName}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LocalizedName}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLocalizedName = (() => { type TypeName = LocalizedName; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { locale: FfiConverterString.read(from), name: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.locale, into); FfiConverterString.write(value.name, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.locale) + FfiConverterString.allocationSize(value.name) ); } } return new FFIConverter(); })(); export type LogEntry = { line: string; level: string; }; /** * Generated factory for {@link LogEntry} record objects. */ export const LogEntry = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link LogEntry}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link LogEntry}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeLogEntry = (() => { type TypeName = LogEntry; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { line: FfiConverterString.read(from), level: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.line, into); FfiConverterString.write(value.level, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.line) + FfiConverterString.allocationSize(value.level) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of a 32-byte message digest for ECDSA signing */ export type MessageBytes = { bytes: ArrayBuffer; }; /** * Generated factory for {@link MessageBytes} record objects. */ export const MessageBytes = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link MessageBytes}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link MessageBytes}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeMessageBytes = (() => { type TypeName = MessageBytes; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { bytes: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.bytes, into); } allocationSize(value: TypeName): number { return FfiConverterArrayBuffer.allocationSize(value.bytes); } } return new FFIConverter(); })(); export type MessageSuccessActionData = { message: string; }; /** * Generated factory for {@link MessageSuccessActionData} record objects. */ export const MessageSuccessActionData = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< MessageSuccessActionData, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link MessageSuccessActionData}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link MessageSuccessActionData}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeMessageSuccessActionData = (() => { type TypeName = MessageSuccessActionData; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { message: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.message, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.message); } } return new FFIConverter(); })(); export type MintIssuerTokenRequest = { amount: U128; }; /** * Generated factory for {@link MintIssuerTokenRequest} record objects. */ export const MintIssuerTokenRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< MintIssuerTokenRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link MintIssuerTokenRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link MintIssuerTokenRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeMintIssuerTokenRequest = (() => { type TypeName = MintIssuerTokenRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { amount: FfiConverterTypeu128.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeu128.write(value.amount, into); } allocationSize(value: TypeName): number { return FfiConverterTypeu128.allocationSize(value.amount); } } return new FFIConverter(); })(); /** * Options for [`new_rest_chain_service`]. */ export type NewRestChainServiceRequest = { /** * Routes the chain service through a SOCKS5 proxy. Pass the same value as * [`Config::proxy`](crate::Config::proxy): this service is built outside * the SDK, so it cannot pick the setting up on its own. */ proxy: ProxyConfig | undefined; }; /** * Generated factory for {@link NewRestChainServiceRequest} record objects. */ export const NewRestChainServiceRequest = (() => { const defaults = () => ({ proxy: undefined }); const create = (() => { return uniffiCreateRecord< NewRestChainServiceRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link NewRestChainServiceRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link NewRestChainServiceRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeNewRestChainServiceRequest = (() => { type TypeName = NewRestChainServiceRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { proxy: FfiConverterOptionalTypeProxyConfig.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalTypeProxyConfig.write(value.proxy, into); } allocationSize(value: TypeName): number { return FfiConverterOptionalTypeProxyConfig.allocationSize(value.proxy); } } return new FFIConverter(); })(); /** * Request for [`BreezSdk::optimize_leaves`]. Defaults to * [`OptimizationMode::Full`]. */ export type OptimizeLeavesRequest = { /** * Controls how much work the call performs before returning. */ mode: OptimizationMode; }; /** * Generated factory for {@link OptimizeLeavesRequest} record objects. */ export const OptimizeLeavesRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< OptimizeLeavesRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link OptimizeLeavesRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link OptimizeLeavesRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeOptimizeLeavesRequest = (() => { type TypeName = OptimizeLeavesRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { mode: FfiConverterTypeOptimizationMode.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeOptimizationMode.write(value.mode, into); } allocationSize(value: TypeName): number { return FfiConverterTypeOptimizationMode.allocationSize(value.mode); } } return new FFIConverter(); })(); /** * Response from a [`BreezSdk::optimize_leaves`] call. */ export type OptimizeLeavesResponse = { /** * The outcome of the optimization run. */ outcome: OptimizationOutcome; }; /** * Generated factory for {@link OptimizeLeavesResponse} record objects. */ export const OptimizeLeavesResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< OptimizeLeavesResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link OptimizeLeavesResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link OptimizeLeavesResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeOptimizeLeavesResponse = (() => { type TypeName = OptimizeLeavesResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { outcome: FfiConverterTypeOptimizationOutcome.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeOptimizationOutcome.write(value.outcome, into); } allocationSize(value: TypeName): number { return FfiConverterTypeOptimizationOutcome.allocationSize(value.outcome); } } return new FFIConverter(); })(); export type OutgoingChange = { change: RecordChange; parent: Record | undefined; }; /** * Generated factory for {@link OutgoingChange} record objects. */ export const OutgoingChange = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link OutgoingChange}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link OutgoingChange}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeOutgoingChange = (() => { type TypeName = OutgoingChange; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { change: FfiConverterTypeRecordChange.read(from), parent: FfiConverterOptionalTypeRecord.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeRecordChange.write(value.change, into); FfiConverterOptionalTypeRecord.write(value.parent, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeRecordChange.allocationSize(value.change) + FfiConverterOptionalTypeRecord.allocationSize(value.parent) ); } } return new FFIConverter(); })(); /** * Configuration for the passkey client. */ export type PasskeyConfig = { /** * Default wallet label when a call provides none. Unset uses * `"Default"`. */ defaultLabel: string | undefined; /** * Relying Party and user identity for the built-in provider, used * on the zero-config path. Ignored when you inject your own * provider. */ providerOptions: PasskeyProviderOptions | undefined; /** * Routes the Nostr relay connections that store wallet labels through a * SOCKS5 proxy. Pass the same value as [`Config::proxy`](crate::Config::proxy): * the passkey client is built before the SDK, so it cannot pick the setting * up on its own. * * Relay connections do not support proxy authentication, so a proxy * carrying a username and password is rejected when the client is * built. */ proxy: ProxyConfig | undefined; }; /** * Generated factory for {@link PasskeyConfig} record objects. */ export const PasskeyConfig = (() => { const defaults = () => ({ defaultLabel: undefined, providerOptions: undefined, proxy: undefined, }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link PasskeyConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PasskeyConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePasskeyConfig = (() => { type TypeName = PasskeyConfig; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { defaultLabel: FfiConverterOptionalString.read(from), providerOptions: FfiConverterOptionalTypePasskeyProviderOptions.read(from), proxy: FfiConverterOptionalTypeProxyConfig.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.defaultLabel, into); FfiConverterOptionalTypePasskeyProviderOptions.write( value.providerOptions, into ); FfiConverterOptionalTypeProxyConfig.write(value.proxy, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.defaultLabel) + FfiConverterOptionalTypePasskeyProviderOptions.allocationSize( value.providerOptions ) + FfiConverterOptionalTypeProxyConfig.allocationSize(value.proxy) ); } } return new FFIConverter(); })(); /** * A passkey credential from a register or sign-in ceremony. * `credential_id` is always set; the attestation fields are * populated on registration and absent on sign-in (an assertion * carries no attestation). Persist `credential_id` to drive * `exclude_credentials` / `allow_credentials` on later calls. */ export type PasskeyCredential = { /** * The credential used on sign-in or created on registration. */ credentialId: ArrayBuffer; /** * `WebAuthn` user handle, provider-minted at registration. * Absent on sign-in. */ userId: ArrayBuffer | undefined; /** * Authenticator AAGUID. A display hint only: the attestation is * unverified. Absent on sign-in. */ aaguid: ArrayBuffer | undefined; /** * Whether the credential is eligible for cloud backup / sync. * Absent on sign-in. */ backupEligible: boolean | undefined; }; /** * Generated factory for {@link PasskeyCredential} record objects. */ export const PasskeyCredential = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link PasskeyCredential}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PasskeyCredential}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePasskeyCredential = (() => { type TypeName = PasskeyCredential; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { credentialId: FfiConverterArrayBuffer.read(from), userId: FfiConverterOptionalArrayBuffer.read(from), aaguid: FfiConverterOptionalArrayBuffer.read(from), backupEligible: FfiConverterOptionalBool.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.credentialId, into); FfiConverterOptionalArrayBuffer.write(value.userId, into); FfiConverterOptionalArrayBuffer.write(value.aaguid, into); FfiConverterOptionalBool.write(value.backupEligible, into); } allocationSize(value: TypeName): number { return ( FfiConverterArrayBuffer.allocationSize(value.credentialId) + FfiConverterOptionalArrayBuffer.allocationSize(value.userId) + FfiConverterOptionalArrayBuffer.allocationSize(value.aaguid) + FfiConverterOptionalBool.allocationSize(value.backupEligible) ); } } return new FFIConverter(); })(); /** * Relying Party and user identity for the built-in passkey provider. * Applies only when a binding builds the provider for you (the * zero-config path); a provider you construct yourself owns these and * ignores them. */ export type PasskeyProviderOptions = { /** * Relying Party ID. Unset uses the Breez shared RP * (`keys.breez.technology`). */ rpId: string | undefined; /** * Relying Party name. Unset uses `"Breez"`. */ rpName: string | undefined; /** * `WebAuthn` `user.name`: the account identifier the OS sign-in * picker shows beneath the display name, typically an email or * handle (e.g. `john@doe.com`). Set a stable per-user * value to keep each registration a distinct entry. Unset uses * `rp_name`. */ userName: string | undefined; /** * `WebAuthn` `user.display_name`: the human-friendly name the * picker shows most prominently (e.g. `John Doe`). Unset uses * `user_name`. */ userDisplayName: string | undefined; }; /** * Generated factory for {@link PasskeyProviderOptions} record objects. */ export const PasskeyProviderOptions = (() => { const defaults = () => ({ rpId: undefined, rpName: undefined, userName: undefined, userDisplayName: undefined, }); const create = (() => { return uniffiCreateRecord< PasskeyProviderOptions, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link PasskeyProviderOptions}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PasskeyProviderOptions}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePasskeyProviderOptions = (() => { type TypeName = PasskeyProviderOptions; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { rpId: FfiConverterOptionalString.read(from), rpName: FfiConverterOptionalString.read(from), userName: FfiConverterOptionalString.read(from), userDisplayName: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.rpId, into); FfiConverterOptionalString.write(value.rpName, into); FfiConverterOptionalString.write(value.userName, into); FfiConverterOptionalString.write(value.userDisplayName, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.rpId) + FfiConverterOptionalString.allocationSize(value.rpName) + FfiConverterOptionalString.allocationSize(value.userName) + FfiConverterOptionalString.allocationSize(value.userDisplayName) ); } } return new FFIConverter(); })(); /** * Represents a payment (sent or received) */ export type Payment = { /** * Unique identifier for the payment */ id: string; /** * Type of payment (send or receive) */ paymentType: PaymentType; /** * Status of the payment */ status: PaymentStatus; /** * Amount in satoshis or token base units */ amount: U128; /** * Fee paid in satoshis or token base units */ fees: U128; /** * Timestamp of when the payment was created */ timestamp: /*u64*/ bigint; /** * Method of payment. Sometimes the payment details is empty so this field * is used to determine the payment method. */ method: PaymentMethod; /** * Details of the payment */ details: PaymentDetails | undefined; /** * If set, this payment involved a conversion before the payment */ conversionDetails: ConversionDetails | undefined; }; /** * Generated factory for {@link Payment} record objects. */ export const Payment = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link Payment}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Payment}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePayment = (() => { type TypeName = Payment; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { id: FfiConverterString.read(from), paymentType: FfiConverterTypePaymentType.read(from), status: FfiConverterTypePaymentStatus.read(from), amount: FfiConverterTypeu128.read(from), fees: FfiConverterTypeu128.read(from), timestamp: FfiConverterUInt64.read(from), method: FfiConverterTypePaymentMethod.read(from), details: FfiConverterOptionalTypePaymentDetails.read(from), conversionDetails: FfiConverterOptionalTypeConversionDetails.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.id, into); FfiConverterTypePaymentType.write(value.paymentType, into); FfiConverterTypePaymentStatus.write(value.status, into); FfiConverterTypeu128.write(value.amount, into); FfiConverterTypeu128.write(value.fees, into); FfiConverterUInt64.write(value.timestamp, into); FfiConverterTypePaymentMethod.write(value.method, into); FfiConverterOptionalTypePaymentDetails.write(value.details, into); FfiConverterOptionalTypeConversionDetails.write( value.conversionDetails, into ); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.id) + FfiConverterTypePaymentType.allocationSize(value.paymentType) + FfiConverterTypePaymentStatus.allocationSize(value.status) + FfiConverterTypeu128.allocationSize(value.amount) + FfiConverterTypeu128.allocationSize(value.fees) + FfiConverterUInt64.allocationSize(value.timestamp) + FfiConverterTypePaymentMethod.allocationSize(value.method) + FfiConverterOptionalTypePaymentDetails.allocationSize(value.details) + FfiConverterOptionalTypeConversionDetails.allocationSize( value.conversionDetails ) ); } } return new FFIConverter(); })(); export type PaymentIdUpdate = { /** * Provisional payment id reported by `before_send`, in the form `{partial_tx_id}:{index}` */ provisionalPaymentId: string; /** * Final payment id once the transaction is broadcast, in the form `{final_tx_id}:{vout}` */ finalPaymentId: string; }; /** * Generated factory for {@link PaymentIdUpdate} record objects. */ export const PaymentIdUpdate = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link PaymentIdUpdate}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PaymentIdUpdate}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePaymentIdUpdate = (() => { type TypeName = PaymentIdUpdate; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { provisionalPaymentId: FfiConverterString.read(from), finalPaymentId: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.provisionalPaymentId, into); FfiConverterString.write(value.finalPaymentId, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.provisionalPaymentId) + FfiConverterString.allocationSize(value.finalPaymentId) ); } } return new FFIConverter(); })(); /** * Metadata associated with a payment that cannot be extracted from the Spark operator. */ export type PaymentMetadata = { parentPaymentId: string | undefined; lnurlPayInfo: LnurlPayInfo | undefined; lnurlWithdrawInfo: LnurlWithdrawInfo | undefined; lnurlDescription: string | undefined; /** * Conversion info for this payment. Defaults `"type"` to `"amm"` when the * tag is missing (pre-migration sync records). */ conversionInfo: ConversionInfo | undefined; conversionStatus: ConversionStatus | undefined; }; /** * Generated factory for {@link PaymentMetadata} record objects. */ export const PaymentMetadata = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link PaymentMetadata}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PaymentMetadata}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePaymentMetadata = (() => { type TypeName = PaymentMetadata; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { parentPaymentId: FfiConverterOptionalString.read(from), lnurlPayInfo: FfiConverterOptionalTypeLnurlPayInfo.read(from), lnurlWithdrawInfo: FfiConverterOptionalTypeLnurlWithdrawInfo.read(from), lnurlDescription: FfiConverterOptionalString.read(from), conversionInfo: FfiConverterOptionalTypeConversionInfo.read(from), conversionStatus: FfiConverterOptionalTypeConversionStatus.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.parentPaymentId, into); FfiConverterOptionalTypeLnurlPayInfo.write(value.lnurlPayInfo, into); FfiConverterOptionalTypeLnurlWithdrawInfo.write( value.lnurlWithdrawInfo, into ); FfiConverterOptionalString.write(value.lnurlDescription, into); FfiConverterOptionalTypeConversionInfo.write(value.conversionInfo, into); FfiConverterOptionalTypeConversionStatus.write( value.conversionStatus, into ); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.parentPaymentId) + FfiConverterOptionalTypeLnurlPayInfo.allocationSize( value.lnurlPayInfo ) + FfiConverterOptionalTypeLnurlWithdrawInfo.allocationSize( value.lnurlWithdrawInfo ) + FfiConverterOptionalString.allocationSize(value.lnurlDescription) + FfiConverterOptionalTypeConversionInfo.allocationSize( value.conversionInfo ) + FfiConverterOptionalTypeConversionStatus.allocationSize( value.conversionStatus ) ); } } return new FFIConverter(); })(); export type PaymentRequestSource = { bip21Uri: string | undefined; bip353Address: string | undefined; }; /** * Generated factory for {@link PaymentRequestSource} record objects. */ export const PaymentRequestSource = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< PaymentRequestSource, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link PaymentRequestSource}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PaymentRequestSource}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePaymentRequestSource = (() => { type TypeName = PaymentRequestSource; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { bip21Uri: FfiConverterOptionalString.read(from), bip353Address: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.bip21Uri, into); FfiConverterOptionalString.write(value.bip353Address, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.bip21Uri) + FfiConverterOptionalString.allocationSize(value.bip353Address) ); } } return new FFIConverter(); })(); /** * How much to fund one branch of the exit to avoid a fan-out. */ export type PerBranchFunding = { /** * The leaf whose branch this funds. */ leafId: string; /** * Fund a UTXO of at least this many satoshis for this branch. */ fundingSat: /*u64*/ bigint; }; /** * Generated factory for {@link PerBranchFunding} record objects. */ export const PerBranchFunding = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link PerBranchFunding}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PerBranchFunding}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePerBranchFunding = (() => { type TypeName = PerBranchFunding; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { leafId: FfiConverterString.read(from), fundingSat: FfiConverterUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.leafId, into); FfiConverterUInt64.write(value.fundingSat, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.leafId) + FfiConverterUInt64.allocationSize(value.fundingSat) ); } } return new FFIConverter(); })(); export type PrepareLnurlPayRequest = { /** * The amount to send. Denominated in satoshis, or in token base units * when `token_identifier` is set. */ amount: U128; payRequest: LnurlPayRequestDetails; comment: string | undefined; validateSuccessActionUrl: boolean | undefined; /** * The token identifier when sending a token amount with conversion. */ tokenIdentifier: string | undefined; /** * If provided, the payment will include a token conversion step before sending the payment */ conversionOptions: ConversionOptions | undefined; /** * How fees are handled. See [`FeePolicy`]. Defaults to `FeesExcluded`. */ feePolicy: FeePolicy | undefined; }; /** * Generated factory for {@link PrepareLnurlPayRequest} record objects. */ export const PrepareLnurlPayRequest = (() => { const defaults = () => ({ comment: undefined, validateSuccessActionUrl: undefined, tokenIdentifier: undefined, conversionOptions: undefined, feePolicy: undefined, }); const create = (() => { return uniffiCreateRecord< PrepareLnurlPayRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link PrepareLnurlPayRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PrepareLnurlPayRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePrepareLnurlPayRequest = (() => { type TypeName = PrepareLnurlPayRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { amount: FfiConverterTypeu128.read(from), payRequest: FfiConverterTypeLnurlPayRequestDetails.read(from), comment: FfiConverterOptionalString.read(from), validateSuccessActionUrl: FfiConverterOptionalBool.read(from), tokenIdentifier: FfiConverterOptionalString.read(from), conversionOptions: FfiConverterOptionalTypeConversionOptions.read(from), feePolicy: FfiConverterOptionalTypeFeePolicy.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeu128.write(value.amount, into); FfiConverterTypeLnurlPayRequestDetails.write(value.payRequest, into); FfiConverterOptionalString.write(value.comment, into); FfiConverterOptionalBool.write(value.validateSuccessActionUrl, into); FfiConverterOptionalString.write(value.tokenIdentifier, into); FfiConverterOptionalTypeConversionOptions.write( value.conversionOptions, into ); FfiConverterOptionalTypeFeePolicy.write(value.feePolicy, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeu128.allocationSize(value.amount) + FfiConverterTypeLnurlPayRequestDetails.allocationSize( value.payRequest ) + FfiConverterOptionalString.allocationSize(value.comment) + FfiConverterOptionalBool.allocationSize( value.validateSuccessActionUrl ) + FfiConverterOptionalString.allocationSize(value.tokenIdentifier) + FfiConverterOptionalTypeConversionOptions.allocationSize( value.conversionOptions ) + FfiConverterOptionalTypeFeePolicy.allocationSize(value.feePolicy) ); } } return new FFIConverter(); })(); export type PrepareLnurlPayResponse = { /** * The amount for the payment, always denominated in sats, even when a * `token_identifier` and conversion are present. * When a conversion is present, the token input amount is available in * `conversion_estimate.amount_in`. */ amountSats: /*u64*/ bigint; comment: string | undefined; payRequest: LnurlPayRequestDetails; /** * The fee in satoshis. For `FeesIncluded` operations, this represents the total fee * (including potential overpayment). */ feeSats: /*u64*/ bigint; invoiceDetails: Bolt11InvoiceDetails; successAction: SuccessAction | undefined; /** * When set, the payment will include a token conversion step before sending the payment */ conversionEstimate: ConversionEstimate | undefined; /** * The fee policy actually applied. May differ from the request — e.g., * LNURL sends with `token_identifier` set + conversion are always * `FeesIncluded` (explicit `FeesExcluded` is rejected). */ feePolicy: FeePolicy; }; /** * Generated factory for {@link PrepareLnurlPayResponse} record objects. */ export const PrepareLnurlPayResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< PrepareLnurlPayResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link PrepareLnurlPayResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PrepareLnurlPayResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePrepareLnurlPayResponse = (() => { type TypeName = PrepareLnurlPayResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { amountSats: FfiConverterUInt64.read(from), comment: FfiConverterOptionalString.read(from), payRequest: FfiConverterTypeLnurlPayRequestDetails.read(from), feeSats: FfiConverterUInt64.read(from), invoiceDetails: FfiConverterTypeBolt11InvoiceDetails.read(from), successAction: FfiConverterOptionalTypeSuccessAction.read(from), conversionEstimate: FfiConverterOptionalTypeConversionEstimate.read(from), feePolicy: FfiConverterTypeFeePolicy.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt64.write(value.amountSats, into); FfiConverterOptionalString.write(value.comment, into); FfiConverterTypeLnurlPayRequestDetails.write(value.payRequest, into); FfiConverterUInt64.write(value.feeSats, into); FfiConverterTypeBolt11InvoiceDetails.write(value.invoiceDetails, into); FfiConverterOptionalTypeSuccessAction.write(value.successAction, into); FfiConverterOptionalTypeConversionEstimate.write( value.conversionEstimate, into ); FfiConverterTypeFeePolicy.write(value.feePolicy, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt64.allocationSize(value.amountSats) + FfiConverterOptionalString.allocationSize(value.comment) + FfiConverterTypeLnurlPayRequestDetails.allocationSize( value.payRequest ) + FfiConverterUInt64.allocationSize(value.feeSats) + FfiConverterTypeBolt11InvoiceDetails.allocationSize( value.invoiceDetails ) + FfiConverterOptionalTypeSuccessAction.allocationSize( value.successAction ) + FfiConverterOptionalTypeConversionEstimate.allocationSize( value.conversionEstimate ) + FfiConverterTypeFeePolicy.allocationSize(value.feePolicy) ); } } return new FFIConverter(); })(); /** * Request for a payment link that sends USDC/USDT to an external-chain * recipient, funded by Cash App over Lightning. * * The user pays the returned URL, and the cross-chain provider delivers the * stablecoin to `address`. No funds move through the Spark wallet. Only * available on mainnet. */ export type PreparePaymentLinkRequest = { /** * Recipient address on the destination chain (e.g. an EVM `0x...` address). */ address: string; /** * The destination route from calling `get_cross_chain_routes()` with the * `CrossChainRouteFilter::PaymentLink` filter. Selects the destination chain * + asset (e.g. USDC on Base). */ route: CrossChainRoutePair; /** * Amount in the destination asset's base units, per the route's * `decimals`. These routes deliver USD-pegged stablecoins, so at parity * this is the USD value: `1_000_000` is 1 USDC (6 decimals), about $1. * * With the default fee policy the recipient receives this net amount. * With `FeesIncluded` it is the amount the payer deposits. */ amount: U128; /** * Whether fees are added on top of `amount` (`FeesExcluded`, the default) * or deducted from it (`FeesIncluded`). */ feePolicy: FeePolicy | undefined; /** * Maximum slippage tolerance in basis points. Falls back to the SDK * default when unset. */ maxSlippageBps: /*u32*/ number | undefined; }; /** * Generated factory for {@link PreparePaymentLinkRequest} record objects. */ export const PreparePaymentLinkRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< PreparePaymentLinkRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link PreparePaymentLinkRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PreparePaymentLinkRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePreparePaymentLinkRequest = (() => { type TypeName = PreparePaymentLinkRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { address: FfiConverterString.read(from), route: FfiConverterTypeCrossChainRoutePair.read(from), amount: FfiConverterTypeu128.read(from), feePolicy: FfiConverterOptionalTypeFeePolicy.read(from), maxSlippageBps: FfiConverterOptionalUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.address, into); FfiConverterTypeCrossChainRoutePair.write(value.route, into); FfiConverterTypeu128.write(value.amount, into); FfiConverterOptionalTypeFeePolicy.write(value.feePolicy, into); FfiConverterOptionalUInt32.write(value.maxSlippageBps, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.address) + FfiConverterTypeCrossChainRoutePair.allocationSize(value.route) + FfiConverterTypeu128.allocationSize(value.amount) + FfiConverterOptionalTypeFeePolicy.allocationSize(value.feePolicy) + FfiConverterOptionalUInt32.allocationSize(value.maxSlippageBps) ); } } return new FFIConverter(); })(); /** * Response to a [`PreparePaymentLinkRequest`]. Mirrors `BuyBitcoinResponse` * (a payable `url`) plus the quote so the caller can display the expected * delivery and fees. */ export type PreparePaymentLinkResponse = { /** * The URL to open in a browser; paying it delivers the stablecoin. */ url: string; /** * Sats the payer deposits through the fiat rail. */ amountSats: /*u64*/ bigint; /** * Estimated amount delivered to the recipient, in `asset` base units. */ estimatedOut: U128; /** * The destination stablecoin symbol (e.g. `USDC`). `estimated_out` is * denominated in it. */ asset: string; /** * Provider service fee, in `service_fee_asset` base units. */ serviceFeeAmount: U128; /** * Denomination of `service_fee_amount`. `None` means sats: Boltz * denominates its fee in sats, Orchestra in the stablecoin. */ serviceFeeAsset: string | undefined; /** * RFC3339 timestamp after which the quote is no longer valid. */ expiresAt: string; }; /** * Generated factory for {@link PreparePaymentLinkResponse} record objects. */ export const PreparePaymentLinkResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< PreparePaymentLinkResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link PreparePaymentLinkResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PreparePaymentLinkResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePreparePaymentLinkResponse = (() => { type TypeName = PreparePaymentLinkResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { url: FfiConverterString.read(from), amountSats: FfiConverterUInt64.read(from), estimatedOut: FfiConverterTypeu128.read(from), asset: FfiConverterString.read(from), serviceFeeAmount: FfiConverterTypeu128.read(from), serviceFeeAsset: FfiConverterOptionalString.read(from), expiresAt: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.url, into); FfiConverterUInt64.write(value.amountSats, into); FfiConverterTypeu128.write(value.estimatedOut, into); FfiConverterString.write(value.asset, into); FfiConverterTypeu128.write(value.serviceFeeAmount, into); FfiConverterOptionalString.write(value.serviceFeeAsset, into); FfiConverterString.write(value.expiresAt, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.url) + FfiConverterUInt64.allocationSize(value.amountSats) + FfiConverterTypeu128.allocationSize(value.estimatedOut) + FfiConverterString.allocationSize(value.asset) + FfiConverterTypeu128.allocationSize(value.serviceFeeAmount) + FfiConverterOptionalString.allocationSize(value.serviceFeeAsset) + FfiConverterString.allocationSize(value.expiresAt) ); } } return new FFIConverter(); })(); export type PrepareSendBatchRequest = { /** * The payees, all paid by one transaction. They may span several tokens, * and may mix Spark addresses with Spark invoices. Once a Spark invoice is * among them, every recipient must be paid in the same token. */ recipients: Array; }; /** * Generated factory for {@link PrepareSendBatchRequest} record objects. */ export const PrepareSendBatchRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< PrepareSendBatchRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link PrepareSendBatchRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PrepareSendBatchRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePrepareSendBatchRequest = (() => { type TypeName = PrepareSendBatchRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { recipients: FfiConverterArrayTypeBatchRecipient.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypeBatchRecipient.write(value.recipients, into); } allocationSize(value: TypeName): number { return FfiConverterArrayTypeBatchRecipient.allocationSize( value.recipients ); } } return new FFIConverter(); })(); export type PrepareSendBatchResponse = { /** * The payees in the order they were requested, which is the order their * payments come back in. */ recipients: Array; /** * What the batch debits, one entry per distinct asset. */ totals: Array; }; /** * Generated factory for {@link PrepareSendBatchResponse} record objects. */ export const PrepareSendBatchResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< PrepareSendBatchResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link PrepareSendBatchResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PrepareSendBatchResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePrepareSendBatchResponse = (() => { type TypeName = PrepareSendBatchResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { recipients: FfiConverterArrayTypeResolvedBatchRecipient.read(from), totals: FfiConverterArrayTypeBatchTotal.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypeResolvedBatchRecipient.write(value.recipients, into); FfiConverterArrayTypeBatchTotal.write(value.totals, into); } allocationSize(value: TypeName): number { return ( FfiConverterArrayTypeResolvedBatchRecipient.allocationSize( value.recipients ) + FfiConverterArrayTypeBatchTotal.allocationSize(value.totals) ); } } return new FFIConverter(); })(); export type PrepareSendPaymentRequest = { paymentRequest: PaymentRequest; /** * The amount to send. * Optional for payment requests with embedded amounts (e.g., Spark/Bolt11 invoices with amounts). * Required for Spark addresses, Bitcoin addresses, and amountless invoices. * Denominated in satoshis for Bitcoin payments, or token base units for token payments. */ amount: U128 | undefined; /** * Optional token identifier for token payments. * Absence indicates that the payment is a Bitcoin payment. */ tokenIdentifier: string | undefined; /** * If provided, the payment will include a conversion step before sending the payment */ conversionOptions: ConversionOptions | undefined; /** * How fees are handled. See [`FeePolicy`]. Defaults to `FeesExcluded`. * * Ignored on cross-chain AMM-conversion sends (whether the conversion was * explicitly requested or auto-injected by stable balance) — fees come * out of the converted sats. Bolt11 and Bitcoin AMM-conversion sends * still respect this field by sizing the conversion to cover fees. The * prepare response's `fee_policy` reflects what was actually applied. */ feePolicy: FeePolicy | undefined; }; /** * Generated factory for {@link PrepareSendPaymentRequest} record objects. */ export const PrepareSendPaymentRequest = (() => { const defaults = () => ({ amount: undefined, tokenIdentifier: undefined, conversionOptions: undefined, feePolicy: undefined, }); const create = (() => { return uniffiCreateRecord< PrepareSendPaymentRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link PrepareSendPaymentRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PrepareSendPaymentRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePrepareSendPaymentRequest = (() => { type TypeName = PrepareSendPaymentRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { paymentRequest: FfiConverterTypePaymentRequest.read(from), amount: FfiConverterOptionalTypeu128.read(from), tokenIdentifier: FfiConverterOptionalString.read(from), conversionOptions: FfiConverterOptionalTypeConversionOptions.read(from), feePolicy: FfiConverterOptionalTypeFeePolicy.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypePaymentRequest.write(value.paymentRequest, into); FfiConverterOptionalTypeu128.write(value.amount, into); FfiConverterOptionalString.write(value.tokenIdentifier, into); FfiConverterOptionalTypeConversionOptions.write( value.conversionOptions, into ); FfiConverterOptionalTypeFeePolicy.write(value.feePolicy, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypePaymentRequest.allocationSize(value.paymentRequest) + FfiConverterOptionalTypeu128.allocationSize(value.amount) + FfiConverterOptionalString.allocationSize(value.tokenIdentifier) + FfiConverterOptionalTypeConversionOptions.allocationSize( value.conversionOptions ) + FfiConverterOptionalTypeFeePolicy.allocationSize(value.feePolicy) ); } } return new FFIConverter(); })(); export type PrepareSendPaymentResponse = { paymentMethod: SendPaymentMethod; /** * The amount to be sent, denominated in satoshis for Bitcoin payments * (including token-to-Bitcoin conversions), or token base units for token payments. * When a conversion is present, the input amount is in * `conversion_estimate.amount_in`. */ amount: U128; /** * Optional token identifier for token payments. * Absence indicates that the payment is a Bitcoin payment. */ tokenIdentifier: string | undefined; /** * When set, the payment will include a conversion step before sending the payment */ conversionEstimate: ConversionEstimate | undefined; /** * The fee policy actually applied. May differ from the request — e.g., * cross-chain AMM-conversion sends are always `FeesIncluded`. */ feePolicy: FeePolicy; }; /** * Generated factory for {@link PrepareSendPaymentResponse} record objects. */ export const PrepareSendPaymentResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< PrepareSendPaymentResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link PrepareSendPaymentResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PrepareSendPaymentResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePrepareSendPaymentResponse = (() => { type TypeName = PrepareSendPaymentResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { paymentMethod: FfiConverterTypeSendPaymentMethod.read(from), amount: FfiConverterTypeu128.read(from), tokenIdentifier: FfiConverterOptionalString.read(from), conversionEstimate: FfiConverterOptionalTypeConversionEstimate.read(from), feePolicy: FfiConverterTypeFeePolicy.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeSendPaymentMethod.write(value.paymentMethod, into); FfiConverterTypeu128.write(value.amount, into); FfiConverterOptionalString.write(value.tokenIdentifier, into); FfiConverterOptionalTypeConversionEstimate.write( value.conversionEstimate, into ); FfiConverterTypeFeePolicy.write(value.feePolicy, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeSendPaymentMethod.allocationSize(value.paymentMethod) + FfiConverterTypeu128.allocationSize(value.amount) + FfiConverterOptionalString.allocationSize(value.tokenIdentifier) + FfiConverterOptionalTypeConversionEstimate.allocationSize( value.conversionEstimate ) + FfiConverterTypeFeePolicy.allocationSize(value.feePolicy) ); } } return new FFIConverter(); })(); /** * Request for `prepare_unilateral_exit`, the exit quote. */ export type PrepareUnilateralExitRequest = { /** * Target fee rate in sat/vByte, applied to every CPFP child, the fan-out, * and the sweep. */ feeRateSatPerVbyte: /*u64*/ bigint; fundingKind: CpfpFundingKind; /** * The Bitcoin address the swept funds are sent to. */ destination: string; selection: ExitLeafSelection; }; /** * Generated factory for {@link PrepareUnilateralExitRequest} record objects. */ export const PrepareUnilateralExitRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< PrepareUnilateralExitRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link PrepareUnilateralExitRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PrepareUnilateralExitRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePrepareUnilateralExitRequest = (() => { type TypeName = PrepareUnilateralExitRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { feeRateSatPerVbyte: FfiConverterUInt64.read(from), fundingKind: FfiConverterTypeCpfpFundingKind.read(from), destination: FfiConverterString.read(from), selection: FfiConverterTypeExitLeafSelection.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt64.write(value.feeRateSatPerVbyte, into); FfiConverterTypeCpfpFundingKind.write(value.fundingKind, into); FfiConverterString.write(value.destination, into); FfiConverterTypeExitLeafSelection.write(value.selection, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt64.allocationSize(value.feeRateSatPerVbyte) + FfiConverterTypeCpfpFundingKind.allocationSize(value.fundingKind) + FfiConverterString.allocationSize(value.destination) + FfiConverterTypeExitLeafSelection.allocationSize(value.selection) ); } } return new FFIConverter(); })(); /** * Response from `prepare_unilateral_exit`: which leaves would exit, the exact * fee at the requested rate, and how much to fund. */ export type PrepareUnilateralExitResponse = { leaves: Array; /** * Total value of the selected leaves, in satoshis. */ recoverableValueSat: /*u64*/ bigint; /** * Total on-chain fee when funding with a single UTXO (fanned out across * branches), in satoshis. Exact for the given funding kind; nodes the * operators report on-chain are assumed already paid, so a partially-exited * tree quotes a lower fee than a fresh one. * * The sum of the three components below, which say who pays what: * `cpfp_fee_sat + fanout_fee_sat + sweep_fee_sat`. The first two come from * your funding UTXO, the third off the value being recovered. */ totalFeeSat: /*u64*/ bigint; /** * The part of `total_fee_sat` the CPFP children pay, funded by your UTXOs. * It does not reduce what the exit recovers. */ cpfpFeeSat: /*u64*/ bigint; /** * The part of `total_fee_sat` paid for the fan-out transaction, funded by * your UTXO. Funding one UTXO per branch (`per_branch_funding`) avoids it. * Zero for a single branch (no fan-out). */ fanoutFeeSat: /*u64*/ bigint; /** * The part of `total_fee_sat` the final sweep pays. The sweep takes its fee * from the value it moves, so this is the one component subtracted from * what reaches `destination`. */ sweepFeeSat: /*u64*/ bigint; /** * Fund a single UTXO of at least this many satoshis to exit with a fan-out. * Above `cpfp_fee_sat + fanout_fee_sat` by design: it carries the sweep fee * and a per-branch dust allowance as headroom, both of which come back to * you in the sweep. */ singleUtxoFundingSat: /*u64*/ bigint; /** * To skip the fan-out, fund one UTXO per branch of at least the given * amount (one entry per selected leaf). */ perBranchFunding: Array; /** * The fee rate this quote was computed at, in sat/vByte. */ feeRateSatPerVbyte: /*u64*/ bigint; destination: string; /** * What the chain has already done to these leaves, read while preparing. * Pass it back to `unilateral_exit`, which builds only the steps it does * not already cover. */ exitChainState: ExitChainState; }; /** * Generated factory for {@link PrepareUnilateralExitResponse} record objects. */ export const PrepareUnilateralExitResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< PrepareUnilateralExitResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link PrepareUnilateralExitResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PrepareUnilateralExitResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePrepareUnilateralExitResponse = (() => { type TypeName = PrepareUnilateralExitResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { leaves: FfiConverterArrayTypeUnilateralExitLeaf.read(from), recoverableValueSat: FfiConverterUInt64.read(from), totalFeeSat: FfiConverterUInt64.read(from), cpfpFeeSat: FfiConverterUInt64.read(from), fanoutFeeSat: FfiConverterUInt64.read(from), sweepFeeSat: FfiConverterUInt64.read(from), singleUtxoFundingSat: FfiConverterUInt64.read(from), perBranchFunding: FfiConverterArrayTypePerBranchFunding.read(from), feeRateSatPerVbyte: FfiConverterUInt64.read(from), destination: FfiConverterString.read(from), exitChainState: FfiConverterTypeExitChainState.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypeUnilateralExitLeaf.write(value.leaves, into); FfiConverterUInt64.write(value.recoverableValueSat, into); FfiConverterUInt64.write(value.totalFeeSat, into); FfiConverterUInt64.write(value.cpfpFeeSat, into); FfiConverterUInt64.write(value.fanoutFeeSat, into); FfiConverterUInt64.write(value.sweepFeeSat, into); FfiConverterUInt64.write(value.singleUtxoFundingSat, into); FfiConverterArrayTypePerBranchFunding.write(value.perBranchFunding, into); FfiConverterUInt64.write(value.feeRateSatPerVbyte, into); FfiConverterString.write(value.destination, into); FfiConverterTypeExitChainState.write(value.exitChainState, into); } allocationSize(value: TypeName): number { return ( FfiConverterArrayTypeUnilateralExitLeaf.allocationSize(value.leaves) + FfiConverterUInt64.allocationSize(value.recoverableValueSat) + FfiConverterUInt64.allocationSize(value.totalFeeSat) + FfiConverterUInt64.allocationSize(value.cpfpFeeSat) + FfiConverterUInt64.allocationSize(value.fanoutFeeSat) + FfiConverterUInt64.allocationSize(value.sweepFeeSat) + FfiConverterUInt64.allocationSize(value.singleUtxoFundingSat) + FfiConverterArrayTypePerBranchFunding.allocationSize( value.perBranchFunding ) + FfiConverterUInt64.allocationSize(value.feeRateSatPerVbyte) + FfiConverterString.allocationSize(value.destination) + FfiConverterTypeExitChainState.allocationSize(value.exitChainState) ); } } return new FFIConverter(); })(); export type ProvisionalPayment = { /** * Unique identifier for the payment */ paymentId: string; /** * Amount in satoshis or token base units */ amount: U128; /** * Details of the payment */ details: ProvisionalPaymentDetails; }; /** * Generated factory for {@link ProvisionalPayment} record objects. */ export const ProvisionalPayment = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ProvisionalPayment}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ProvisionalPayment}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeProvisionalPayment = (() => { type TypeName = ProvisionalPayment; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { paymentId: FfiConverterString.read(from), amount: FfiConverterTypeu128.read(from), details: FfiConverterTypeProvisionalPaymentDetails.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.paymentId, into); FfiConverterTypeu128.write(value.amount, into); FfiConverterTypeProvisionalPaymentDetails.write(value.details, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.paymentId) + FfiConverterTypeu128.allocationSize(value.amount) + FfiConverterTypeProvisionalPaymentDetails.allocationSize(value.details) ); } } return new FFIConverter(); })(); /** * A SOCKS5 proxy carrying the connections the SDK opens. * * Hostnames are resolved by the proxy rather than locally, so a DNS query * never discloses which host is being reached. A connection that cannot be * established through the proxy fails: the SDK never falls back to a direct * one. * * Not supported on WASM, where the browser owns connection setup and exposes * no proxy control. In Node, route the SDK by installing a proxy dispatcher * on the global `fetch` instead. */ export type ProxyConfig = { /** * Proxy host. An IP address, or a name resolvable locally: reaching the * proxy is the one lookup that cannot itself go through the proxy. */ host: string; port: /*u16*/ number; /** * Username for SOCKS5 username/password authentication. Authentication is * only offered when both this and `password` are set. */ username: string | undefined; password: string | undefined; }; /** * Generated factory for {@link ProxyConfig} record objects. */ export const ProxyConfig = (() => { const defaults = () => ({ username: undefined, password: undefined }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link ProxyConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ProxyConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeProxyConfig = (() => { type TypeName = ProxyConfig; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { host: FfiConverterString.read(from), port: FfiConverterUInt16.read(from), username: FfiConverterOptionalString.read(from), password: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.host, into); FfiConverterUInt16.write(value.port, into); FfiConverterOptionalString.write(value.username, into); FfiConverterOptionalString.write(value.password, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.host) + FfiConverterUInt16.allocationSize(value.port) + FfiConverterOptionalString.allocationSize(value.username) + FfiConverterOptionalString.allocationSize(value.password) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of a secp256k1 public key (33 bytes compressed) */ export type PublicKeyBytes = { bytes: ArrayBuffer; }; /** * Generated factory for {@link PublicKeyBytes} record objects. */ export const PublicKeyBytes = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link PublicKeyBytes}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PublicKeyBytes}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePublicKeyBytes = (() => { type TypeName = PublicKeyBytes; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { bytes: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.bytes, into); } allocationSize(value: TypeName): number { return FfiConverterArrayBuffer.allocationSize(value.bytes); } } return new FFIConverter(); })(); export type PublishSignedLnurlPayPackageRequest = { signedPackage: SignedTransferPackage; }; /** * Generated factory for {@link PublishSignedLnurlPayPackageRequest} record objects. */ export const PublishSignedLnurlPayPackageRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< PublishSignedLnurlPayPackageRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link PublishSignedLnurlPayPackageRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PublishSignedLnurlPayPackageRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePublishSignedLnurlPayPackageRequest = (() => { type TypeName = PublishSignedLnurlPayPackageRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { signedPackage: FfiConverterTypeSignedTransferPackage.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeSignedTransferPackage.write(value.signedPackage, into); } allocationSize(value: TypeName): number { return FfiConverterTypeSignedTransferPackage.allocationSize( value.signedPackage ); } } return new FFIConverter(); })(); export type PublishSignedTransferPackageRequest = { signedPackage: SignedTransferPackage; }; /** * Generated factory for {@link PublishSignedTransferPackageRequest} record objects. */ export const PublishSignedTransferPackageRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< PublishSignedTransferPackageRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link PublishSignedTransferPackageRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link PublishSignedTransferPackageRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePublishSignedTransferPackageRequest = (() => { type TypeName = PublishSignedTransferPackageRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { signedPackage: FfiConverterTypeSignedTransferPackage.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeSignedTransferPackage.write(value.signedPackage, into); } allocationSize(value: TypeName): number { return FfiConverterTypeSignedTransferPackage.allocationSize( value.signedPackage ); } } return new FFIConverter(); })(); /** * Denominator in an exchange rate */ export type Rate = { coin: string; value: /*f64*/ number; }; /** * Generated factory for {@link Rate} record objects. */ export const Rate = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link Rate}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Rate}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRate = (() => { type TypeName = Rate; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { coin: FfiConverterString.read(from), value: FfiConverterFloat64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.coin, into); FfiConverterFloat64.write(value.value, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.coin) + FfiConverterFloat64.allocationSize(value.value) ); } } return new FFIConverter(); })(); export type ReceivePaymentRequest = { paymentMethod: ReceivePaymentMethod; }; /** * Generated factory for {@link ReceivePaymentRequest} record objects. */ export const ReceivePaymentRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ReceivePaymentRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ReceivePaymentRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ReceivePaymentRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeReceivePaymentRequest = (() => { type TypeName = ReceivePaymentRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { paymentMethod: FfiConverterTypeReceivePaymentMethod.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeReceivePaymentMethod.write(value.paymentMethod, into); } allocationSize(value: TypeName): number { return FfiConverterTypeReceivePaymentMethod.allocationSize( value.paymentMethod ); } } return new FFIConverter(); })(); export type ReceivePaymentResponse = { paymentRequest: string; /** * Fee to pay to receive the payment * Denominated in sats or token base units */ fee: U128; /** * Optional information populated only for cross-chain receives. */ crossChainInfo: CrossChainReceiveInfo | undefined; }; /** * Generated factory for {@link ReceivePaymentResponse} record objects. */ export const ReceivePaymentResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ReceivePaymentResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ReceivePaymentResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ReceivePaymentResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeReceivePaymentResponse = (() => { type TypeName = ReceivePaymentResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { paymentRequest: FfiConverterString.read(from), fee: FfiConverterTypeu128.read(from), crossChainInfo: FfiConverterOptionalTypeCrossChainReceiveInfo.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.paymentRequest, into); FfiConverterTypeu128.write(value.fee, into); FfiConverterOptionalTypeCrossChainReceiveInfo.write( value.crossChainInfo, into ); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.paymentRequest) + FfiConverterTypeu128.allocationSize(value.fee) + FfiConverterOptionalTypeCrossChainReceiveInfo.allocationSize( value.crossChainInfo ) ); } } return new FFIConverter(); })(); export type RecommendedFees = { fastestFee: /*u64*/ bigint; halfHourFee: /*u64*/ bigint; hourFee: /*u64*/ bigint; economyFee: /*u64*/ bigint; minimumFee: /*u64*/ bigint; }; /** * Generated factory for {@link RecommendedFees} record objects. */ export const RecommendedFees = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link RecommendedFees}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link RecommendedFees}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRecommendedFees = (() => { type TypeName = RecommendedFees; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { fastestFee: FfiConverterUInt64.read(from), halfHourFee: FfiConverterUInt64.read(from), hourFee: FfiConverterUInt64.read(from), economyFee: FfiConverterUInt64.read(from), minimumFee: FfiConverterUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt64.write(value.fastestFee, into); FfiConverterUInt64.write(value.halfHourFee, into); FfiConverterUInt64.write(value.hourFee, into); FfiConverterUInt64.write(value.economyFee, into); FfiConverterUInt64.write(value.minimumFee, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt64.allocationSize(value.fastestFee) + FfiConverterUInt64.allocationSize(value.halfHourFee) + FfiConverterUInt64.allocationSize(value.hourFee) + FfiConverterUInt64.allocationSize(value.economyFee) + FfiConverterUInt64.allocationSize(value.minimumFee) ); } } return new FFIConverter(); })(); export type Record = { id: RecordId; revision: /*u64*/ bigint; schemaVersion: string; data: Map; }; /** * Generated factory for {@link Record} record objects. */ export const Record = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link Record}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Record}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRecord = (() => { type TypeName = Record; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { id: FfiConverterTypeRecordId.read(from), revision: FfiConverterUInt64.read(from), schemaVersion: FfiConverterString.read(from), data: FfiConverterMapStringString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeRecordId.write(value.id, into); FfiConverterUInt64.write(value.revision, into); FfiConverterString.write(value.schemaVersion, into); FfiConverterMapStringString.write(value.data, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeRecordId.allocationSize(value.id) + FfiConverterUInt64.allocationSize(value.revision) + FfiConverterString.allocationSize(value.schemaVersion) + FfiConverterMapStringString.allocationSize(value.data) ); } } return new FFIConverter(); })(); export type RecordChange = { id: RecordId; schemaVersion: string; updatedFields: Map; localRevision: /*u64*/ bigint; }; /** * Generated factory for {@link RecordChange} record objects. */ export const RecordChange = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link RecordChange}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link RecordChange}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRecordChange = (() => { type TypeName = RecordChange; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { id: FfiConverterTypeRecordId.read(from), schemaVersion: FfiConverterString.read(from), updatedFields: FfiConverterMapStringString.read(from), localRevision: FfiConverterUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeRecordId.write(value.id, into); FfiConverterString.write(value.schemaVersion, into); FfiConverterMapStringString.write(value.updatedFields, into); FfiConverterUInt64.write(value.localRevision, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeRecordId.allocationSize(value.id) + FfiConverterString.allocationSize(value.schemaVersion) + FfiConverterMapStringString.allocationSize(value.updatedFields) + FfiConverterUInt64.allocationSize(value.localRevision) ); } } return new FFIConverter(); })(); export type RecordId = { type: string; dataId: string; }; /** * Generated factory for {@link RecordId} record objects. */ export const RecordId = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link RecordId}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link RecordId}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRecordId = (() => { type TypeName = RecordId; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { type: FfiConverterString.read(from), dataId: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.type, into); FfiConverterString.write(value.dataId, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.type) + FfiConverterString.allocationSize(value.dataId) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of a recoverable ECDSA signature (65 bytes: 1 recovery byte + 64 signature bytes) */ export type RecoverableEcdsaSignatureBytes = { bytes: ArrayBuffer; }; /** * Generated factory for {@link RecoverableEcdsaSignatureBytes} record objects. */ export const RecoverableEcdsaSignatureBytes = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< RecoverableEcdsaSignatureBytes, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link RecoverableEcdsaSignatureBytes}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link RecoverableEcdsaSignatureBytes}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRecoverableEcdsaSignatureBytes = (() => { type TypeName = RecoverableEcdsaSignatureBytes; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { bytes: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.bytes, into); } allocationSize(value: TypeName): number { return FfiConverterArrayBuffer.allocationSize(value.bytes); } } return new FFIConverter(); })(); export type RefundDepositRequest = { txid: string; vout: /*u32*/ number; destinationAddress: string; fee: Fee; }; /** * Generated factory for {@link RefundDepositRequest} record objects. */ export const RefundDepositRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< RefundDepositRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link RefundDepositRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link RefundDepositRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRefundDepositRequest = (() => { type TypeName = RefundDepositRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { txid: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), destinationAddress: FfiConverterString.read(from), fee: FfiConverterTypeFee.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.txid, into); FfiConverterUInt32.write(value.vout, into); FfiConverterString.write(value.destinationAddress, into); FfiConverterTypeFee.write(value.fee, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.txid) + FfiConverterUInt32.allocationSize(value.vout) + FfiConverterString.allocationSize(value.destinationAddress) + FfiConverterTypeFee.allocationSize(value.fee) ); } } return new FFIConverter(); })(); export type RefundDepositResponse = { txId: string; txHex: string; }; /** * Generated factory for {@link RefundDepositResponse} record objects. */ export const RefundDepositResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< RefundDepositResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link RefundDepositResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link RefundDepositResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRefundDepositResponse = (() => { type TypeName = RefundDepositResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { txId: FfiConverterString.read(from), txHex: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.txId, into); FfiConverterString.write(value.txHex, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.txId) + FfiConverterString.allocationSize(value.txHex) ); } } return new FFIConverter(); })(); /** * Response from refunding pending conversions. */ export type RefundPendingConversionsResponse = { /** * Conversions successfully refunded this pass. */ refunded: /*u32*/ number; /** * Conversions not clawed back this pass: held back by a safety window, or * found to have executed after all. Only the former are retried. */ skipped: /*u32*/ number; /** * Conversions whose clawback did not complete this pass (rejected or * errored; funds not returned). The next pass will retry them. */ failed: /*u32*/ number; }; /** * Generated factory for {@link RefundPendingConversionsResponse} record objects. */ export const RefundPendingConversionsResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< RefundPendingConversionsResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link RefundPendingConversionsResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link RefundPendingConversionsResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRefundPendingConversionsResponse = (() => { type TypeName = RefundPendingConversionsResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { refunded: FfiConverterUInt32.read(from), skipped: FfiConverterUInt32.read(from), failed: FfiConverterUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt32.write(value.refunded, into); FfiConverterUInt32.write(value.skipped, into); FfiConverterUInt32.write(value.failed, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt32.allocationSize(value.refunded) + FfiConverterUInt32.allocationSize(value.skipped) + FfiConverterUInt32.allocationSize(value.failed) ); } } return new FFIConverter(); })(); export type RegisterLightningAddressRequest = { username: string; description: string | undefined; }; /** * Generated factory for {@link RegisterLightningAddressRequest} record objects. */ export const RegisterLightningAddressRequest = (() => { const defaults = () => ({ description: undefined }); const create = (() => { return uniffiCreateRecord< RegisterLightningAddressRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link RegisterLightningAddressRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link RegisterLightningAddressRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRegisterLightningAddressRequest = (() => { type TypeName = RegisterLightningAddressRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { username: FfiConverterString.read(from), description: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.username, into); FfiConverterOptionalString.write(value.description, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.username) + FfiConverterOptionalString.allocationSize(value.description) ); } } return new FFIConverter(); })(); /** * Request shape for [`PasskeyClient::register`]. */ export type RegisterRequest = { /** * User-chosen label for the new wallet. Defaults to the configured * default label when `None`. Always published to the label * store as part of registration. */ label: string | undefined; /** * Optional list of already-registered credential IDs. Prevents * registering the same device twice: when any entry matches a * credential already on the device, the platform raises * [`crate::passkey::PrfProviderError::CredentialAlreadyExists`] * so the host can flip the user to the sign-in path. Unset is * treated as empty. Forwarded to [`PrfProvider::create_passkey`]. */ excludeCredentials: Array | undefined; }; /** * Generated factory for {@link RegisterRequest} record objects. */ export const RegisterRequest = (() => { const defaults = () => ({ label: undefined, excludeCredentials: undefined }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link RegisterRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link RegisterRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRegisterRequest = (() => { type TypeName = RegisterRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { label: FfiConverterOptionalString.read(from), excludeCredentials: FfiConverterOptionalArrayArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.label, into); FfiConverterOptionalArrayArrayBuffer.write( value.excludeCredentials, into ); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.label) + FfiConverterOptionalArrayArrayBuffer.allocationSize( value.excludeCredentials ) ); } } return new FFIConverter(); })(); /** * Response from [`PasskeyClient::register`]. */ export type RegisterResponse = { /** * The newly-derived wallet for [`RegisterRequest::label`]. */ wallet: Wallet; /** * The credential the platform just registered. Persist * [`PasskeyCredential::credential_id`] to populate * `exclude_credentials` on future [`PasskeyClient::register`] * calls. Always set on the register path. */ credential: PasskeyCredential | undefined; }; /** * Generated factory for {@link RegisterResponse} record objects. */ export const RegisterResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link RegisterResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link RegisterResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRegisterResponse = (() => { type TypeName = RegisterResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { wallet: FfiConverterTypeWallet.read(from), credential: FfiConverterOptionalTypePasskeyCredential.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeWallet.write(value.wallet, into); FfiConverterOptionalTypePasskeyCredential.write(value.credential, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeWallet.allocationSize(value.wallet) + FfiConverterOptionalTypePasskeyCredential.allocationSize( value.credential ) ); } } return new FFIConverter(); })(); /** * Request to register a new webhook. */ export type RegisterWebhookRequest = { /** * The URL that will receive webhook notifications. */ url: string; /** * A secret used for HMAC-SHA256 signature verification of webhook payloads. */ secret: string; /** * The event types to subscribe to. */ eventTypes: Array; }; /** * Generated factory for {@link RegisterWebhookRequest} record objects. */ export const RegisterWebhookRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< RegisterWebhookRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link RegisterWebhookRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link RegisterWebhookRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRegisterWebhookRequest = (() => { type TypeName = RegisterWebhookRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { url: FfiConverterString.read(from), secret: FfiConverterString.read(from), eventTypes: FfiConverterArrayTypeWebhookEventType.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.url, into); FfiConverterString.write(value.secret, into); FfiConverterArrayTypeWebhookEventType.write(value.eventTypes, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.url) + FfiConverterString.allocationSize(value.secret) + FfiConverterArrayTypeWebhookEventType.allocationSize(value.eventTypes) ); } } return new FFIConverter(); })(); /** * Response from registering a webhook. */ export type RegisterWebhookResponse = { /** * The unique identifier of the newly registered webhook. */ webhookId: string; }; /** * Generated factory for {@link RegisterWebhookResponse} record objects. */ export const RegisterWebhookResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< RegisterWebhookResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link RegisterWebhookResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link RegisterWebhookResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRegisterWebhookResponse = (() => { type TypeName = RegisterWebhookResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { webhookId: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.webhookId, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.webhookId); } } return new FFIConverter(); })(); /** * A recipient after prepare has resolved the asset and amount it is owed. */ export type ResolvedBatchRecipient = { destination: BatchDestination; /** * Amount in the base units of the asset this recipient is paid in. */ amount: U128; /** * The token this recipient is paid in. Unset means sats, which a batch * cannot send yet. */ tokenIdentifier: string | undefined; }; /** * Generated factory for {@link ResolvedBatchRecipient} record objects. */ export const ResolvedBatchRecipient = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ResolvedBatchRecipient, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link ResolvedBatchRecipient}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link ResolvedBatchRecipient}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeResolvedBatchRecipient = (() => { type TypeName = ResolvedBatchRecipient; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { destination: FfiConverterTypeBatchDestination.read(from), amount: FfiConverterTypeu128.read(from), tokenIdentifier: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeBatchDestination.write(value.destination, into); FfiConverterTypeu128.write(value.amount, into); FfiConverterOptionalString.write(value.tokenIdentifier, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeBatchDestination.allocationSize(value.destination) + FfiConverterTypeu128.allocationSize(value.amount) + FfiConverterOptionalString.allocationSize(value.tokenIdentifier) ); } } return new FFIConverter(); })(); export type RestResponse = { status: /*u16*/ number; body: string; }; /** * Generated factory for {@link RestResponse} record objects. */ export const RestResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link RestResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link RestResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRestResponse = (() => { type TypeName = RestResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { status: FfiConverterUInt16.read(from), body: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt16.write(value.status, into); FfiConverterString.write(value.body, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt16.allocationSize(value.status) + FfiConverterString.allocationSize(value.body) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of a Schnorr signature (64 bytes) */ export type SchnorrSignatureBytes = { bytes: ArrayBuffer; }; /** * Generated factory for {@link SchnorrSignatureBytes} record objects. */ export const SchnorrSignatureBytes = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< SchnorrSignatureBytes, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link SchnorrSignatureBytes}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SchnorrSignatureBytes}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSchnorrSignatureBytes = (() => { type TypeName = SchnorrSignatureBytes; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { bytes: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.bytes, into); } allocationSize(value: TypeName): number { return FfiConverterArrayBuffer.allocationSize(value.bytes); } } return new FFIConverter(); })(); /** * Settings for [`new_shared_sdk_context`]. All fields are optional; the defaults * match the single-SDK happy path. */ export type SdkContextConfig = { /** * Network the shared resources target. Defaults to [`Network::Mainnet`]. * Used to gate the partner JWT header provider — only constructed on * Mainnet, since Regtest has no JWT-issuing Breez endpoint. */ network: Network; /** * Breez API key. When set together with `network == Mainnet`, the * context constructs a shared partner JWT header provider that all * SDKs built from this context will attach to their SO requests. */ apiKey: string | undefined; /** * Number of gRPC connections per Spark operator. `None` (or `Some(1)`) * keeps a single connection per operator (the right choice for most * deployments); `Some(n)` opens `n` channels per operator and balances * requests across them. */ connectionsPerOperator: /*u32*/ number | undefined; /** * Routes the connections opened by this context's shared clients through * a SOCKS5 proxy. Must match the `proxy` on the `Config` of every SDK * built from this context. */ proxy: ProxyConfig | undefined; /** * Shared storage backend for SDKs built from this context. When set, * every SDK built from the context reuses it (and its database * connection pool). Construct via * [`default_storage`](crate::default_storage), * [`postgres_storage`](crate::postgres_storage), * [`mysql_storage`](crate::mysql_storage) or * [`custom_storage`](crate::custom_storage). */ storage: StorageBackend | undefined; }; /** * Generated factory for {@link SdkContextConfig} record objects. */ export const SdkContextConfig = (() => { const defaults = () => ({ apiKey: undefined, connectionsPerOperator: undefined, proxy: undefined, storage: undefined, }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SdkContextConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SdkContextConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSdkContextConfig = (() => { type TypeName = SdkContextConfig; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { network: FfiConverterTypeNetwork.read(from), apiKey: FfiConverterOptionalString.read(from), connectionsPerOperator: FfiConverterOptionalUInt32.read(from), proxy: FfiConverterOptionalTypeProxyConfig.read(from), storage: FfiConverterOptionalTypeStorageBackend.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeNetwork.write(value.network, into); FfiConverterOptionalString.write(value.apiKey, into); FfiConverterOptionalUInt32.write(value.connectionsPerOperator, into); FfiConverterOptionalTypeProxyConfig.write(value.proxy, into); FfiConverterOptionalTypeStorageBackend.write(value.storage, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeNetwork.allocationSize(value.network) + FfiConverterOptionalString.allocationSize(value.apiKey) + FfiConverterOptionalUInt32.allocationSize( value.connectionsPerOperator ) + FfiConverterOptionalTypeProxyConfig.allocationSize(value.proxy) + FfiConverterOptionalTypeStorageBackend.allocationSize(value.storage) ); } } return new FFIConverter(); })(); /** * FFI-safe representation of a private key (32 bytes) */ export type SecretBytes = { bytes: ArrayBuffer; }; /** * Generated factory for {@link SecretBytes} record objects. */ export const SecretBytes = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SecretBytes}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SecretBytes}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSecretBytes = (() => { type TypeName = SecretBytes; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { bytes: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayBuffer.write(value.bytes, into); } allocationSize(value: TypeName): number { return FfiConverterArrayBuffer.allocationSize(value.bytes); } } return new FFIConverter(); })(); export type SendBatchRequest = { prepareResponse: PrepareSendBatchResponse; }; /** * Generated factory for {@link SendBatchRequest} record objects. */ export const SendBatchRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SendBatchRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SendBatchRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSendBatchRequest = (() => { type TypeName = SendBatchRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { prepareResponse: FfiConverterTypePrepareSendBatchResponse.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypePrepareSendBatchResponse.write( value.prepareResponse, into ); } allocationSize(value: TypeName): number { return FfiConverterTypePrepareSendBatchResponse.allocationSize( value.prepareResponse ); } } return new FFIConverter(); })(); export type SendBatchResponse = { /** * One payment per recipient, in recipient order, all sharing a transaction * hash. */ payments: Array; }; /** * Generated factory for {@link SendBatchResponse} record objects. */ export const SendBatchResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SendBatchResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SendBatchResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSendBatchResponse = (() => { type TypeName = SendBatchResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { payments: FfiConverterArrayTypePayment.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypePayment.write(value.payments, into); } allocationSize(value: TypeName): number { return FfiConverterArrayTypePayment.allocationSize(value.payments); } } return new FFIConverter(); })(); export type SendOnchainFeeQuote = { /** * Identifies the quote to the provider when the payment is sent. Empty on * an estimate, which no provider has issued. */ id: string; /** * When the quote stops being honoured, as a Unix timestamp in seconds. * Zero on an estimate. */ expiresAt: /*u64*/ bigint; speedFast: SendOnchainSpeedFeeQuote; speedMedium: SendOnchainSpeedFeeQuote; speedSlow: SendOnchainSpeedFeeQuote; /** * Set when the wallet holds no bitcoin and a token conversion will fund the * send, because the provider will not quote without funds to price against. * The estimate is an upper bound: the payment quotes for real once the * conversion lands, and fails rather than spending more than this. */ isEstimate: boolean; }; /** * Generated factory for {@link SendOnchainFeeQuote} record objects. */ export const SendOnchainFeeQuote = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SendOnchainFeeQuote}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SendOnchainFeeQuote}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSendOnchainFeeQuote = (() => { type TypeName = SendOnchainFeeQuote; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { id: FfiConverterString.read(from), expiresAt: FfiConverterUInt64.read(from), speedFast: FfiConverterTypeSendOnchainSpeedFeeQuote.read(from), speedMedium: FfiConverterTypeSendOnchainSpeedFeeQuote.read(from), speedSlow: FfiConverterTypeSendOnchainSpeedFeeQuote.read(from), isEstimate: FfiConverterBool.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.id, into); FfiConverterUInt64.write(value.expiresAt, into); FfiConverterTypeSendOnchainSpeedFeeQuote.write(value.speedFast, into); FfiConverterTypeSendOnchainSpeedFeeQuote.write(value.speedMedium, into); FfiConverterTypeSendOnchainSpeedFeeQuote.write(value.speedSlow, into); FfiConverterBool.write(value.isEstimate, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.id) + FfiConverterUInt64.allocationSize(value.expiresAt) + FfiConverterTypeSendOnchainSpeedFeeQuote.allocationSize( value.speedFast ) + FfiConverterTypeSendOnchainSpeedFeeQuote.allocationSize( value.speedMedium ) + FfiConverterTypeSendOnchainSpeedFeeQuote.allocationSize( value.speedSlow ) + FfiConverterBool.allocationSize(value.isEstimate) ); } } return new FFIConverter(); })(); export type SendOnchainSpeedFeeQuote = { userFeeSat: /*u64*/ bigint; l1BroadcastFeeSat: /*u64*/ bigint; }; /** * Generated factory for {@link SendOnchainSpeedFeeQuote} record objects. */ export const SendOnchainSpeedFeeQuote = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< SendOnchainSpeedFeeQuote, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link SendOnchainSpeedFeeQuote}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SendOnchainSpeedFeeQuote}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSendOnchainSpeedFeeQuote = (() => { type TypeName = SendOnchainSpeedFeeQuote; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { userFeeSat: FfiConverterUInt64.read(from), l1BroadcastFeeSat: FfiConverterUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt64.write(value.userFeeSat, into); FfiConverterUInt64.write(value.l1BroadcastFeeSat, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt64.allocationSize(value.userFeeSat) + FfiConverterUInt64.allocationSize(value.l1BroadcastFeeSat) ); } } return new FFIConverter(); })(); export type SendPaymentRequest = { prepareResponse: PrepareSendPaymentResponse; options: SendPaymentOptions | undefined; /** * The optional idempotency key for all Spark based transfers (excludes token payments * and cross-chain sends). * If set, providing the same idempotency key for multiple requests will ensure that only one * payment is made. If an idempotency key is re-used, the same payment will be returned. * The idempotency key must be a valid UUID. */ idempotencyKey: string | undefined; }; /** * Generated factory for {@link SendPaymentRequest} record objects. */ export const SendPaymentRequest = (() => { const defaults = () => ({ options: undefined, idempotencyKey: undefined }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SendPaymentRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SendPaymentRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSendPaymentRequest = (() => { type TypeName = SendPaymentRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { prepareResponse: FfiConverterTypePrepareSendPaymentResponse.read(from), options: FfiConverterOptionalTypeSendPaymentOptions.read(from), idempotencyKey: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypePrepareSendPaymentResponse.write( value.prepareResponse, into ); FfiConverterOptionalTypeSendPaymentOptions.write(value.options, into); FfiConverterOptionalString.write(value.idempotencyKey, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypePrepareSendPaymentResponse.allocationSize( value.prepareResponse ) + FfiConverterOptionalTypeSendPaymentOptions.allocationSize( value.options ) + FfiConverterOptionalString.allocationSize(value.idempotencyKey) ); } } return new FFIConverter(); })(); export type SendPaymentResponse = { payment: Payment; }; /** * Generated factory for {@link SendPaymentResponse} record objects. */ export const SendPaymentResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SendPaymentResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SendPaymentResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSendPaymentResponse = (() => { type TypeName = SendPaymentResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { payment: FfiConverterTypePayment.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypePayment.write(value.payment, into); } allocationSize(value: TypeName): number { return FfiConverterTypePayment.allocationSize(value.payment); } } return new FFIConverter(); })(); /** * Cached authentication session for a single backend service identity. */ export type Session = { token: string; expiration: /*u64*/ bigint; }; /** * Generated factory for {@link Session} record objects. */ export const Session = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link Session}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Session}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSession = (() => { type TypeName = Session; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { token: FfiConverterString.read(from), expiration: FfiConverterUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.token, into); FfiConverterUInt64.write(value.expiration, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.token) + FfiConverterUInt64.allocationSize(value.expiration) ); } } return new FFIConverter(); })(); export type SetLnurlMetadataItem = { paymentHash: string; senderComment: string | undefined; nostrZapRequest: string | undefined; nostrZapReceipt: string | undefined; }; /** * Generated factory for {@link SetLnurlMetadataItem} record objects. */ export const SetLnurlMetadataItem = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< SetLnurlMetadataItem, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link SetLnurlMetadataItem}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SetLnurlMetadataItem}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSetLnurlMetadataItem = (() => { type TypeName = SetLnurlMetadataItem; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { paymentHash: FfiConverterString.read(from), senderComment: FfiConverterOptionalString.read(from), nostrZapRequest: FfiConverterOptionalString.read(from), nostrZapReceipt: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.paymentHash, into); FfiConverterOptionalString.write(value.senderComment, into); FfiConverterOptionalString.write(value.nostrZapRequest, into); FfiConverterOptionalString.write(value.nostrZapReceipt, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.paymentHash) + FfiConverterOptionalString.allocationSize(value.senderComment) + FfiConverterOptionalString.allocationSize(value.nostrZapRequest) + FfiConverterOptionalString.allocationSize(value.nostrZapReceipt) ); } } return new FFIConverter(); })(); /** * Request for [`crate::passkey::Passkey::setup_wallet`]. */ export type SetupWalletRequest = { /** * Wallet label. Unset uses the configured default label. */ label: string | undefined; /** * Publish the label to Nostr after deriving. Leave false for * speculative derivations (cold restore). */ publishLabel: boolean; /** * Restrict the assertion to these credential IDs. Useful for * server-driven flows that resolve the credential set out-of-band. */ allowCredentials: Array; /** * Prefer credentials already on this device over the cross-device * picker. Unset uses the platform default. */ preferImmediatelyAvailableCredentials: boolean | undefined; }; /** * Generated factory for {@link SetupWalletRequest} record objects. */ export const SetupWalletRequest = (() => { const defaults = () => ({ label: undefined, publishLabel: false, allowCredentials: [], preferImmediatelyAvailableCredentials: undefined, }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SetupWalletRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SetupWalletRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSetupWalletRequest = (() => { type TypeName = SetupWalletRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { label: FfiConverterOptionalString.read(from), publishLabel: FfiConverterBool.read(from), allowCredentials: FfiConverterArrayArrayBuffer.read(from), preferImmediatelyAvailableCredentials: FfiConverterOptionalBool.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.label, into); FfiConverterBool.write(value.publishLabel, into); FfiConverterArrayArrayBuffer.write(value.allowCredentials, into); FfiConverterOptionalBool.write( value.preferImmediatelyAvailableCredentials, into ); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.label) + FfiConverterBool.allocationSize(value.publishLabel) + FfiConverterArrayArrayBuffer.allocationSize(value.allowCredentials) + FfiConverterOptionalBool.allocationSize( value.preferImmediatelyAvailableCredentials ) ); } } return new FFIConverter(); })(); /** * Request shape for [`PasskeyClient::sign_in`]. */ export type SignInRequest = { /** * When present, the fast path: one ceremony, no label-store * query. When absent, triggers discovery: derives the configured * default label and also returns the user's full label set in * [`SignInResponse::labels`]. */ label: string | undefined; /** * Optional credential IDs the assertion is restricted to * (reauthentication of a known user). Unset or empty lets the OS * pick any matching credential for this RP. Forwarded to * [`crate::passkey::DeriveSeedsRequest::allow_credentials`]. */ allowCredentials: Array | undefined; /** * Forwarded to * [`crate::passkey::DeriveSeedsRequest::prefer_immediately_available_credentials`]. */ preferImmediatelyAvailableCredentials: boolean | undefined; }; /** * Generated factory for {@link SignInRequest} record objects. */ export const SignInRequest = (() => { const defaults = () => ({ label: undefined, allowCredentials: undefined, preferImmediatelyAvailableCredentials: undefined, }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SignInRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SignInRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSignInRequest = (() => { type TypeName = SignInRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { label: FfiConverterOptionalString.read(from), allowCredentials: FfiConverterOptionalArrayArrayBuffer.read(from), preferImmediatelyAvailableCredentials: FfiConverterOptionalBool.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.label, into); FfiConverterOptionalArrayArrayBuffer.write(value.allowCredentials, into); FfiConverterOptionalBool.write( value.preferImmediatelyAvailableCredentials, into ); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.label) + FfiConverterOptionalArrayArrayBuffer.allocationSize( value.allowCredentials ) + FfiConverterOptionalBool.allocationSize( value.preferImmediatelyAvailableCredentials ) ); } } return new FFIConverter(); })(); /** * Response from [`PasskeyClient::sign_in`]. */ export type SignInResponse = { wallet: Wallet; /** * Empty on the fast path. Populated on discovery (or empty if * the label store was unreachable). */ labels: Array; /** * The credential the user signed in with, when the underlying * [`PrfProvider`] surfaces it. `None` for providers that don't * expose this signal (CLI / file-backed / hardware). Only * `credential_id` is set: a sign-in assertion carries no * attestation. */ credential: PasskeyCredential | undefined; }; /** * Generated factory for {@link SignInResponse} record objects. */ export const SignInResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SignInResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SignInResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSignInResponse = (() => { type TypeName = SignInResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { wallet: FfiConverterTypeWallet.read(from), labels: FfiConverterArrayString.read(from), credential: FfiConverterOptionalTypePasskeyCredential.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeWallet.write(value.wallet, into); FfiConverterArrayString.write(value.labels, into); FfiConverterOptionalTypePasskeyCredential.write(value.credential, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeWallet.allocationSize(value.wallet) + FfiConverterArrayString.allocationSize(value.labels) + FfiConverterOptionalTypePasskeyCredential.allocationSize( value.credential ) ); } } return new FFIConverter(); })(); export type SignMessageRequest = { message: string; /** * If true, the signature will be encoded in compact format instead of DER format */ compact: boolean; }; /** * Generated factory for {@link SignMessageRequest} record objects. */ export const SignMessageRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SignMessageRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SignMessageRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSignMessageRequest = (() => { type TypeName = SignMessageRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { message: FfiConverterString.read(from), compact: FfiConverterBool.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.message, into); FfiConverterBool.write(value.compact, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.message) + FfiConverterBool.allocationSize(value.compact) ); } } return new FFIConverter(); })(); export type SignMessageResponse = { pubkey: string; /** * The DER or compact hex encoded signature */ signature: string; }; /** * Generated factory for {@link SignMessageResponse} record objects. */ export const SignMessageResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SignMessageResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SignMessageResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSignMessageResponse = (() => { type TypeName = SignMessageResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { pubkey: FfiConverterString.read(from), signature: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.pubkey, into); FfiConverterString.write(value.signature, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.pubkey) + FfiConverterString.allocationSize(value.signature) ); } } return new FFIConverter(); })(); export type SignedTransferPackage = { unsigned: UnsignedTransferPackage; signature: TransferSignature; }; /** * Generated factory for {@link SignedTransferPackage} record objects. */ export const SignedTransferPackage = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< SignedTransferPackage, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link SignedTransferPackage}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SignedTransferPackage}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSignedTransferPackage = (() => { type TypeName = SignedTransferPackage; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { unsigned: FfiConverterTypeUnsignedTransferPackage.read(from), signature: FfiConverterTypeTransferSignature.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeUnsignedTransferPackage.write(value.unsigned, into); FfiConverterTypeTransferSignature.write(value.signature, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeUnsignedTransferPackage.allocationSize(value.unsigned) + FfiConverterTypeTransferSignature.allocationSize(value.signature) ); } } return new FFIConverter(); })(); /** * A signing-only external signer paired with the Spark signer, for wallets that * connect via [`connect_with_signing_only_signer`]. The Breez half performs * signing only, without the SDK's local ECIES/HMAC operations. */ export type SigningOnlyExternalSigners = { /** * Signing-only external signer for non-Spark SDK signing. */ breezSigner: ExternalSigningSigner; /** * External high-level Spark signer for the Spark wallet flows. */ sparkSigner: ExternalSparkSigner; }; /** * Generated factory for {@link SigningOnlyExternalSigners} record objects. */ export const SigningOnlyExternalSigners = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< SigningOnlyExternalSigners, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link SigningOnlyExternalSigners}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SigningOnlyExternalSigners}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSigningOnlyExternalSigners = (() => { type TypeName = SigningOnlyExternalSigners; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { breezSigner: FfiConverterTypeExternalSigningSigner.read(from), sparkSigner: FfiConverterTypeExternalSparkSigner.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeExternalSigningSigner.write(value.breezSigner, into); FfiConverterTypeExternalSparkSigner.write(value.sparkSigner, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeExternalSigningSigner.allocationSize( value.breezSigner ) + FfiConverterTypeExternalSparkSigner.allocationSize(value.sparkSigner) ); } } return new FFIConverter(); })(); export type SilentPaymentAddressDetails = { address: string; network: BitcoinNetwork; source: PaymentRequestSource; }; /** * Generated factory for {@link SilentPaymentAddressDetails} record objects. */ export const SilentPaymentAddressDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< SilentPaymentAddressDetails, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link SilentPaymentAddressDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SilentPaymentAddressDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSilentPaymentAddressDetails = (() => { type TypeName = SilentPaymentAddressDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { address: FfiConverterString.read(from), network: FfiConverterTypeBitcoinNetwork.read(from), source: FfiConverterTypePaymentRequestSource.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.address, into); FfiConverterTypeBitcoinNetwork.write(value.network, into); FfiConverterTypePaymentRequestSource.write(value.source, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.address) + FfiConverterTypeBitcoinNetwork.allocationSize(value.network) + FfiConverterTypePaymentRequestSource.allocationSize(value.source) ); } } return new FFIConverter(); })(); export type SparkAddressDetails = { /** * The raw address string */ address: string; /** * The identity public key of the address owner */ identityPublicKey: string; network: BitcoinNetwork; source: PaymentRequestSource; }; /** * Generated factory for {@link SparkAddressDetails} record objects. */ export const SparkAddressDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SparkAddressDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SparkAddressDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSparkAddressDetails = (() => { type TypeName = SparkAddressDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { address: FfiConverterString.read(from), identityPublicKey: FfiConverterString.read(from), network: FfiConverterTypeBitcoinNetwork.read(from), source: FfiConverterTypePaymentRequestSource.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.address, into); FfiConverterString.write(value.identityPublicKey, into); FfiConverterTypeBitcoinNetwork.write(value.network, into); FfiConverterTypePaymentRequestSource.write(value.source, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.address) + FfiConverterString.allocationSize(value.identityPublicKey) + FfiConverterTypeBitcoinNetwork.allocationSize(value.network) + FfiConverterTypePaymentRequestSource.allocationSize(value.source) ); } } return new FFIConverter(); })(); /** * Configuration for a custom Spark environment. * * When set on [`Config`], overrides the default Spark operator pool, * service provider, threshold, and token settings. This allows connecting * to alternative Spark deployments (e.g. dev/staging environments). */ export type SparkConfig = { /** * Hex-encoded identifier of the coordinator operator. */ coordinatorIdentifier: string; /** * The FROST signing threshold (e.g. 2 of 3). */ threshold: /*u32*/ number; /** * The set of signing operators. */ signingOperators: Array; /** * Service provider (SSP) configuration. */ sspConfig: SparkSspConfig; /** * Expected bond amount in sats for token withdrawals. */ expectedWithdrawBondSats: /*u64*/ bigint; /** * Expected relative block locktime for token withdrawals. */ expectedWithdrawRelativeBlockLocktime: /*u64*/ bigint; /** * Cap on the inputs a single token transaction may spend. A send needing * more first consolidates the wallet's token outputs. Unset uses the SDK * default (500). */ maxTokenTransactionInputs: /*u32*/ number | undefined; }; /** * Generated factory for {@link SparkConfig} record objects. */ export const SparkConfig = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SparkConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SparkConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSparkConfig = (() => { type TypeName = SparkConfig; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { coordinatorIdentifier: FfiConverterString.read(from), threshold: FfiConverterUInt32.read(from), signingOperators: FfiConverterArrayTypeSparkSigningOperator.read(from), sspConfig: FfiConverterTypeSparkSspConfig.read(from), expectedWithdrawBondSats: FfiConverterUInt64.read(from), expectedWithdrawRelativeBlockLocktime: FfiConverterUInt64.read(from), maxTokenTransactionInputs: FfiConverterOptionalUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.coordinatorIdentifier, into); FfiConverterUInt32.write(value.threshold, into); FfiConverterArrayTypeSparkSigningOperator.write( value.signingOperators, into ); FfiConverterTypeSparkSspConfig.write(value.sspConfig, into); FfiConverterUInt64.write(value.expectedWithdrawBondSats, into); FfiConverterUInt64.write( value.expectedWithdrawRelativeBlockLocktime, into ); FfiConverterOptionalUInt32.write(value.maxTokenTransactionInputs, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.coordinatorIdentifier) + FfiConverterUInt32.allocationSize(value.threshold) + FfiConverterArrayTypeSparkSigningOperator.allocationSize( value.signingOperators ) + FfiConverterTypeSparkSspConfig.allocationSize(value.sspConfig) + FfiConverterUInt64.allocationSize(value.expectedWithdrawBondSats) + FfiConverterUInt64.allocationSize( value.expectedWithdrawRelativeBlockLocktime ) + FfiConverterOptionalUInt32.allocationSize( value.maxTokenTransactionInputs ) ); } } return new FFIConverter(); })(); export type SparkHtlcDetails = { /** * The payment hash of the HTLC */ paymentHash: string; /** * The preimage of the HTLC. Empty until receiver has released it. */ preimage: string | undefined; /** * The expiry time of the HTLC as a unix timestamp in seconds */ expiryTime: /*u64*/ bigint; /** * The HTLC status */ status: SparkHtlcStatus; }; /** * Generated factory for {@link SparkHtlcDetails} record objects. */ export const SparkHtlcDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SparkHtlcDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SparkHtlcDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSparkHtlcDetails = (() => { type TypeName = SparkHtlcDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { paymentHash: FfiConverterString.read(from), preimage: FfiConverterOptionalString.read(from), expiryTime: FfiConverterUInt64.read(from), status: FfiConverterTypeSparkHtlcStatus.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.paymentHash, into); FfiConverterOptionalString.write(value.preimage, into); FfiConverterUInt64.write(value.expiryTime, into); FfiConverterTypeSparkHtlcStatus.write(value.status, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.paymentHash) + FfiConverterOptionalString.allocationSize(value.preimage) + FfiConverterUInt64.allocationSize(value.expiryTime) + FfiConverterTypeSparkHtlcStatus.allocationSize(value.status) ); } } return new FFIConverter(); })(); export type SparkHtlcOptions = { /** * The payment hash of the HTLC. The receiver will need to provide the associated preimage to claim it. */ paymentHash: string; /** * The duration of the HTLC in seconds. * After this time, the HTLC will be returned. */ expiryDurationSecs: /*u64*/ bigint; }; /** * Generated factory for {@link SparkHtlcOptions} record objects. */ export const SparkHtlcOptions = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SparkHtlcOptions}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SparkHtlcOptions}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSparkHtlcOptions = (() => { type TypeName = SparkHtlcOptions; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { paymentHash: FfiConverterString.read(from), expiryDurationSecs: FfiConverterUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.paymentHash, into); FfiConverterUInt64.write(value.expiryDurationSecs, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.paymentHash) + FfiConverterUInt64.allocationSize(value.expiryDurationSecs) ); } } return new FFIConverter(); })(); export type SparkInvoiceDetails = { /** * The raw invoice string */ invoice: string; /** * The identity public key of the invoice issuer */ identityPublicKey: string; network: BitcoinNetwork; /** * Optional amount denominated in sats if `token_identifier` is absent, otherwise in the token base units */ amount: U128 | undefined; /** * The token identifier of the token payment. Absence indicates a Bitcoin payment. */ tokenIdentifier: string | undefined; /** * Optional expiry time as a unix timestamp in seconds. If not provided, the invoice will never expire. */ expiryTime: /*u64*/ bigint | undefined; /** * Optional description. */ description: string | undefined; /** * If set, the invoice may only be fulfilled by a payer with this public key. */ senderPublicKey: string | undefined; }; /** * Generated factory for {@link SparkInvoiceDetails} record objects. */ export const SparkInvoiceDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SparkInvoiceDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SparkInvoiceDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSparkInvoiceDetails = (() => { type TypeName = SparkInvoiceDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { invoice: FfiConverterString.read(from), identityPublicKey: FfiConverterString.read(from), network: FfiConverterTypeBitcoinNetwork.read(from), amount: FfiConverterOptionalTypeu128.read(from), tokenIdentifier: FfiConverterOptionalString.read(from), expiryTime: FfiConverterOptionalUInt64.read(from), description: FfiConverterOptionalString.read(from), senderPublicKey: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.invoice, into); FfiConverterString.write(value.identityPublicKey, into); FfiConverterTypeBitcoinNetwork.write(value.network, into); FfiConverterOptionalTypeu128.write(value.amount, into); FfiConverterOptionalString.write(value.tokenIdentifier, into); FfiConverterOptionalUInt64.write(value.expiryTime, into); FfiConverterOptionalString.write(value.description, into); FfiConverterOptionalString.write(value.senderPublicKey, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.invoice) + FfiConverterString.allocationSize(value.identityPublicKey) + FfiConverterTypeBitcoinNetwork.allocationSize(value.network) + FfiConverterOptionalTypeu128.allocationSize(value.amount) + FfiConverterOptionalString.allocationSize(value.tokenIdentifier) + FfiConverterOptionalUInt64.allocationSize(value.expiryTime) + FfiConverterOptionalString.allocationSize(value.description) + FfiConverterOptionalString.allocationSize(value.senderPublicKey) ); } } return new FFIConverter(); })(); export type SparkInvoicePaymentDetails = { /** * Represents the spark invoice description */ description: string | undefined; /** * The raw spark invoice string */ invoice: string; }; /** * Generated factory for {@link SparkInvoicePaymentDetails} record objects. */ export const SparkInvoicePaymentDetails = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< SparkInvoicePaymentDetails, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link SparkInvoicePaymentDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SparkInvoicePaymentDetails}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSparkInvoicePaymentDetails = (() => { type TypeName = SparkInvoicePaymentDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { description: FfiConverterOptionalString.read(from), invoice: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.description, into); FfiConverterString.write(value.invoice, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.description) + FfiConverterString.allocationSize(value.invoice) ); } } return new FFIConverter(); })(); /** * A Spark signing operator. */ export type SparkSigningOperator = { /** * Sequential operator ID (0-indexed). */ id: /*u32*/ number; /** * Hex-encoded 32-byte FROST identifier. */ identifier: string; /** * gRPC address of the operator (e.g. `https://0.spark.lightspark.com`). */ address: string; /** * Hex-encoded compressed public key of the operator. */ identityPublicKey: string; /** * Optional PEM-encoded CA certificate for TLS verification. * When set, the SDK uses this CA to verify the operator's TLS certificate * instead of the system/default roots. Useful for local development with * self-signed certificates. */ caCertPem: string | undefined; }; /** * Generated factory for {@link SparkSigningOperator} record objects. */ export const SparkSigningOperator = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< SparkSigningOperator, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link SparkSigningOperator}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SparkSigningOperator}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSparkSigningOperator = (() => { type TypeName = SparkSigningOperator; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { id: FfiConverterUInt32.read(from), identifier: FfiConverterString.read(from), address: FfiConverterString.read(from), identityPublicKey: FfiConverterString.read(from), caCertPem: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt32.write(value.id, into); FfiConverterString.write(value.identifier, into); FfiConverterString.write(value.address, into); FfiConverterString.write(value.identityPublicKey, into); FfiConverterOptionalString.write(value.caCertPem, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt32.allocationSize(value.id) + FfiConverterString.allocationSize(value.identifier) + FfiConverterString.allocationSize(value.address) + FfiConverterString.allocationSize(value.identityPublicKey) + FfiConverterOptionalString.allocationSize(value.caCertPem) ); } } return new FFIConverter(); })(); /** * Configuration for the Spark Service Provider (SSP). */ export type SparkSspConfig = { /** * Base URL of the SSP GraphQL API. */ baseUrl: string; /** * Hex-encoded compressed public key of the SSP. */ identityPublicKey: string; /** * Optional GraphQL schema endpoint path (e.g. "graphql/spark/rc"). * Defaults to the hardcoded schema endpoint if not set. */ schemaEndpoint: string | undefined; }; /** * Generated factory for {@link SparkSspConfig} record objects. */ export const SparkSspConfig = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SparkSspConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SparkSspConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSparkSspConfig = (() => { type TypeName = SparkSspConfig; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { baseUrl: FfiConverterString.read(from), identityPublicKey: FfiConverterString.read(from), schemaEndpoint: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.baseUrl, into); FfiConverterString.write(value.identityPublicKey, into); FfiConverterOptionalString.write(value.schemaEndpoint, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.baseUrl) + FfiConverterString.allocationSize(value.identityPublicKey) + FfiConverterOptionalString.allocationSize(value.schemaEndpoint) ); } } return new FFIConverter(); })(); /** * The status of the Spark network services relevant to the SDK. */ export type SparkStatus = { /** * The worst status across all relevant services. */ status: ServiceStatus; /** * The last time the status was updated, as a unix timestamp in seconds. */ lastUpdated: /*u64*/ bigint; }; /** * Generated factory for {@link SparkStatus} record objects. */ export const SparkStatus = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SparkStatus}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SparkStatus}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSparkStatus = (() => { type TypeName = SparkStatus; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { status: FfiConverterTypeServiceStatus.read(from), lastUpdated: FfiConverterUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeServiceStatus.write(value.status, into); FfiConverterUInt64.write(value.lastUpdated, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeServiceStatus.allocationSize(value.status) + FfiConverterUInt64.allocationSize(value.lastUpdated) ); } } return new FFIConverter(); })(); /** * Configuration for automatic conversion of Bitcoin to stable tokens. * * When configured, the SDK automatically monitors the Bitcoin balance after each * wallet sync. Once the balance reaches the configured threshold, the SDK converts * the whole Bitcoin balance to the active stable token. * * When the balance is held in a stable token, Bitcoin payments can still be sent. * The SDK automatically detects when there's not enough Bitcoin balance to cover a * payment and auto-populates the token-to-Bitcoin conversion options to facilitate * the payment. * * The active token can be changed at runtime via [`UpdateUserSettingsRequest`]. */ export type StableBalanceConfig = { /** * Available tokens that can be used for stable balance. */ tokens: Array; /** * The label of the token to activate by default. * * If `None`, stable balance starts deactivated. The user can activate it * at runtime via [`UpdateUserSettingsRequest`]. If a user setting is cached * locally, it takes precedence over this default. */ defaultActiveLabel: string | undefined; /** * The minimum sats balance that triggers auto-conversion. * * If not provided, uses the minimum from conversion limits. * If provided but less than the conversion limit minimum, the limit minimum is used. */ thresholdSats: /*u64*/ bigint | undefined; /** * Maximum slippage in basis points (1/100 of a percent). * * Defaults to 10 bps (0.1%) if not set. */ maxSlippageBps: /*u32*/ number | undefined; }; /** * Generated factory for {@link StableBalanceConfig} record objects. */ export const StableBalanceConfig = (() => { const defaults = () => ({ defaultActiveLabel: undefined, thresholdSats: undefined, maxSlippageBps: undefined, }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link StableBalanceConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link StableBalanceConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeStableBalanceConfig = (() => { type TypeName = StableBalanceConfig; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { tokens: FfiConverterArrayTypeStableBalanceToken.read(from), defaultActiveLabel: FfiConverterOptionalString.read(from), thresholdSats: FfiConverterOptionalUInt64.read(from), maxSlippageBps: FfiConverterOptionalUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayTypeStableBalanceToken.write(value.tokens, into); FfiConverterOptionalString.write(value.defaultActiveLabel, into); FfiConverterOptionalUInt64.write(value.thresholdSats, into); FfiConverterOptionalUInt32.write(value.maxSlippageBps, into); } allocationSize(value: TypeName): number { return ( FfiConverterArrayTypeStableBalanceToken.allocationSize(value.tokens) + FfiConverterOptionalString.allocationSize(value.defaultActiveLabel) + FfiConverterOptionalUInt64.allocationSize(value.thresholdSats) + FfiConverterOptionalUInt32.allocationSize(value.maxSlippageBps) ); } } return new FFIConverter(); })(); /** * A stable token that can be used for automatic balance conversion. */ export type StableBalanceToken = { /** * Integrator-defined display label for the token, e.g. "USD". * * This is a short, human-readable name set by the integrator for display purposes. * It is **not** a canonical Spark token ticker — it has no protocol-level meaning. * Labels must be unique within the [`StableBalanceConfig::tokens`] list. */ label: string; /** * The full token identifier string used for conversions. */ tokenIdentifier: string; }; /** * Generated factory for {@link StableBalanceToken} record objects. */ export const StableBalanceToken = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link StableBalanceToken}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link StableBalanceToken}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeStableBalanceToken = (() => { type TypeName = StableBalanceToken; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { label: FfiConverterString.read(from), tokenIdentifier: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.label, into); FfiConverterString.write(value.tokenIdentifier, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.label) + FfiConverterString.allocationSize(value.tokenIdentifier) ); } } return new FFIConverter(); })(); /** * Storage-internal variant of [`ListPaymentsRequest`] that uses * [`StoragePaymentDetailsFilter`] instead of the public [`PaymentDetailsFilter`]. */ export type StorageListPaymentsRequest = { typeFilter: Array | undefined; statusFilter: Array | undefined; assetFilter: AssetFilter | undefined; paymentDetailsFilter: Array | undefined; fromTimestamp: /*u64*/ bigint | undefined; toTimestamp: /*u64*/ bigint | undefined; offset: /*u32*/ number | undefined; limit: /*u32*/ number | undefined; sortAscending: boolean | undefined; }; /** * Generated factory for {@link StorageListPaymentsRequest} record objects. */ export const StorageListPaymentsRequest = (() => { const defaults = () => ({ typeFilter: undefined, statusFilter: undefined, assetFilter: undefined, paymentDetailsFilter: undefined, fromTimestamp: undefined, toTimestamp: undefined, offset: undefined, limit: undefined, sortAscending: undefined, }); const create = (() => { return uniffiCreateRecord< StorageListPaymentsRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link StorageListPaymentsRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link StorageListPaymentsRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeStorageListPaymentsRequest = (() => { type TypeName = StorageListPaymentsRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { typeFilter: FfiConverterOptionalArrayTypePaymentType.read(from), statusFilter: FfiConverterOptionalArrayTypePaymentStatus.read(from), assetFilter: FfiConverterOptionalTypeAssetFilter.read(from), paymentDetailsFilter: FfiConverterOptionalArrayTypeStoragePaymentDetailsFilter.read(from), fromTimestamp: FfiConverterOptionalUInt64.read(from), toTimestamp: FfiConverterOptionalUInt64.read(from), offset: FfiConverterOptionalUInt32.read(from), limit: FfiConverterOptionalUInt32.read(from), sortAscending: FfiConverterOptionalBool.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalArrayTypePaymentType.write(value.typeFilter, into); FfiConverterOptionalArrayTypePaymentStatus.write( value.statusFilter, into ); FfiConverterOptionalTypeAssetFilter.write(value.assetFilter, into); FfiConverterOptionalArrayTypeStoragePaymentDetailsFilter.write( value.paymentDetailsFilter, into ); FfiConverterOptionalUInt64.write(value.fromTimestamp, into); FfiConverterOptionalUInt64.write(value.toTimestamp, into); FfiConverterOptionalUInt32.write(value.offset, into); FfiConverterOptionalUInt32.write(value.limit, into); FfiConverterOptionalBool.write(value.sortAscending, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalArrayTypePaymentType.allocationSize( value.typeFilter ) + FfiConverterOptionalArrayTypePaymentStatus.allocationSize( value.statusFilter ) + FfiConverterOptionalTypeAssetFilter.allocationSize(value.assetFilter) + FfiConverterOptionalArrayTypeStoragePaymentDetailsFilter.allocationSize( value.paymentDetailsFilter ) + FfiConverterOptionalUInt64.allocationSize(value.fromTimestamp) + FfiConverterOptionalUInt64.allocationSize(value.toTimestamp) + FfiConverterOptionalUInt32.allocationSize(value.offset) + FfiConverterOptionalUInt32.allocationSize(value.limit) + FfiConverterOptionalBool.allocationSize(value.sortAscending) ); } } return new FFIConverter(); })(); /** * A cross-chain swap row as persisted and synced. Shared across providers * (Boltz, Orchestra, future) so each provider's adapter writes opaque * JSON into `data` and (optionally) opaque ciphertext into `secrets`. * * For providers with money-critical secrets, the adapter lifts them out of * the swap JSON, ECIES-encrypts them, and carries only the ciphertext in * `secrets`. The storage layer treats both fields as opaque, so it needs * no signer. */ export type StoredCrossChainSwap = { /** * Provider tag (e.g. `"boltz"`, `"orchestra"`). */ provider: string; /** * Provider-scoped swap id (boltz swap id, orchestra quote-or-order id). */ id: string; /** * Lifted from the underlying swap's terminal flag into an indexed column * so `list_active_cross_chain_swaps` filters without parsing `data`. */ isTerminal: boolean; /** * Lifted from the underlying swap's `updated_at` into a column so the * row's freshness is inspectable without parsing `data`. */ updatedAt: /*u64*/ bigint; /** * Serialized JSON owned by the cross-chain provider's storage adapter. */ data: string; /** * Base64 of the ECIES ciphertext of the provider's lifted secrets. * Empty for providers with no money-critical secrets to protect at rest. */ secrets: string; }; /** * Generated factory for {@link StoredCrossChainSwap} record objects. */ export const StoredCrossChainSwap = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< StoredCrossChainSwap, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link StoredCrossChainSwap}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link StoredCrossChainSwap}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeStoredCrossChainSwap = (() => { type TypeName = StoredCrossChainSwap; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { provider: FfiConverterString.read(from), id: FfiConverterString.read(from), isTerminal: FfiConverterBool.read(from), updatedAt: FfiConverterUInt64.read(from), data: FfiConverterString.read(from), secrets: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.provider, into); FfiConverterString.write(value.id, into); FfiConverterBool.write(value.isTerminal, into); FfiConverterUInt64.write(value.updatedAt, into); FfiConverterString.write(value.data, into); FfiConverterString.write(value.secrets, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.provider) + FfiConverterString.allocationSize(value.id) + FfiConverterBool.allocationSize(value.isTerminal) + FfiConverterUInt64.allocationSize(value.updatedAt) + FfiConverterString.allocationSize(value.data) + FfiConverterString.allocationSize(value.secrets) ); } } return new FFIConverter(); })(); /** * Settings for the symbol representation of a currency */ export type Symbol = { grapheme: string | undefined; template: string | undefined; rtl: boolean | undefined; position: /*u32*/ number | undefined; }; /** * Generated factory for {@link Symbol} record objects. */ export const Symbol = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link Symbol}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Symbol}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSymbol = (() => { type TypeName = Symbol; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { grapheme: FfiConverterOptionalString.read(from), template: FfiConverterOptionalString.read(from), rtl: FfiConverterOptionalBool.read(from), position: FfiConverterOptionalUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.grapheme, into); FfiConverterOptionalString.write(value.template, into); FfiConverterOptionalBool.write(value.rtl, into); FfiConverterOptionalUInt32.write(value.position, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.grapheme) + FfiConverterOptionalString.allocationSize(value.template) + FfiConverterOptionalBool.allocationSize(value.rtl) + FfiConverterOptionalUInt32.allocationSize(value.position) ); } } return new FFIConverter(); })(); /** * Request to sync the wallet with the Spark network */ export type SyncWalletRequest = {}; /** * Generated factory for {@link SyncWalletRequest} record objects. */ export const SyncWalletRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SyncWalletRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SyncWalletRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSyncWalletRequest = (() => { type TypeName = SyncWalletRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return {}; } write(value: TypeName, into: RustBuffer): void {} allocationSize(value: TypeName): number { return 0; } } return new FFIConverter(); })(); /** * Response from synchronizing the wallet */ export type SyncWalletResponse = {}; /** * Generated factory for {@link SyncWalletResponse} record objects. */ export const SyncWalletResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link SyncWalletResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link SyncWalletResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeSyncWalletResponse = (() => { type TypeName = SyncWalletResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return {}; } write(value: TypeName, into: RustBuffer): void {} allocationSize(value: TypeName): number { return 0; } } return new FFIConverter(); })(); export type TokenBalance = { balance: U128; tokenMetadata: TokenMetadata; }; /** * Generated factory for {@link TokenBalance} record objects. */ export const TokenBalance = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link TokenBalance}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link TokenBalance}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeTokenBalance = (() => { type TypeName = TokenBalance; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { balance: FfiConverterTypeu128.read(from), tokenMetadata: FfiConverterTypeTokenMetadata.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeu128.write(value.balance, into); FfiConverterTypeTokenMetadata.write(value.tokenMetadata, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeu128.allocationSize(value.balance) + FfiConverterTypeTokenMetadata.allocationSize(value.tokenMetadata) ); } } return new FFIConverter(); })(); export type TokenMetadata = { identifier: string; /** * Hex representation of the issuer public key */ issuerPublicKey: string; name: string; ticker: string; /** * Number of decimals the token uses */ decimals: /*u32*/ number; maxSupply: U128; isFreezable: boolean; }; /** * Generated factory for {@link TokenMetadata} record objects. */ export const TokenMetadata = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link TokenMetadata}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link TokenMetadata}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeTokenMetadata = (() => { type TypeName = TokenMetadata; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { identifier: FfiConverterString.read(from), issuerPublicKey: FfiConverterString.read(from), name: FfiConverterString.read(from), ticker: FfiConverterString.read(from), decimals: FfiConverterUInt32.read(from), maxSupply: FfiConverterTypeu128.read(from), isFreezable: FfiConverterBool.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.identifier, into); FfiConverterString.write(value.issuerPublicKey, into); FfiConverterString.write(value.name, into); FfiConverterString.write(value.ticker, into); FfiConverterUInt32.write(value.decimals, into); FfiConverterTypeu128.write(value.maxSupply, into); FfiConverterBool.write(value.isFreezable, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.identifier) + FfiConverterString.allocationSize(value.issuerPublicKey) + FfiConverterString.allocationSize(value.name) + FfiConverterString.allocationSize(value.ticker) + FfiConverterUInt32.allocationSize(value.decimals) + FfiConverterTypeu128.allocationSize(value.maxSupply) + FfiConverterBool.allocationSize(value.isFreezable) ); } } return new FFIConverter(); })(); /** * Configuration for token-output optimization. */ export type TokenOptimizationConfig = { /** * Whether automatic token-output consolidation is enabled. * * If set to true, the SDK will periodically consolidate a token's outputs * once their count exceeds [`Self::min_outputs_threshold`]. Otherwise, no * automatic consolidation is performed. * * Default value is true. */ autoEnabled: boolean; /** * Number of token outputs to produce when token-output auto-consolidation * fires. * * Instead of collapsing a token's outputs into a single output (which * serializes subsequent payments), the SDK splits the consolidated balance * across this many outputs of roughly equal value. Higher values preserve * concurrency for parallel sends at the cost of a slightly larger output * set. * * Must be >= 1 and strictly less than [`Self::min_outputs_threshold`]. * * Default value is 5. */ targetOutputCount: /*u32*/ number; /** * Output count that triggers per-token auto-consolidation. * * Auto-consolidation triggers for a token when its available output count * strictly exceeds this threshold. * * Must be greater than 1. * * Default value is 50. */ minOutputsThreshold: /*u32*/ number; }; /** * Generated factory for {@link TokenOptimizationConfig} record objects. */ export const TokenOptimizationConfig = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< TokenOptimizationConfig, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link TokenOptimizationConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link TokenOptimizationConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeTokenOptimizationConfig = (() => { type TypeName = TokenOptimizationConfig; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { autoEnabled: FfiConverterBool.read(from), targetOutputCount: FfiConverterUInt32.read(from), minOutputsThreshold: FfiConverterUInt32.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterBool.write(value.autoEnabled, into); FfiConverterUInt32.write(value.targetOutputCount, into); FfiConverterUInt32.write(value.minOutputsThreshold, into); } allocationSize(value: TypeName): number { return ( FfiConverterBool.allocationSize(value.autoEnabled) + FfiConverterUInt32.allocationSize(value.targetOutputCount) + FfiConverterUInt32.allocationSize(value.minOutputsThreshold) ); } } return new FFIConverter(); })(); /** * Authorization from the current owner granting a specific new owner the * right to take over a username. Produced by * [`BreezSdk::authorize_lightning_address_transfer`] and handed to the new * owner, who passes it to [`BreezSdk::claim_lightning_address_transfer`]. It * fully describes the transfer, so the new owner needs nothing else to claim. */ export type TransferAuthorization = { /** * The username being handed over. */ username: string; /** * The current owner's public key. */ pubkey: string; /** * The current owner's signature authorizing the transfer. */ signature: string; /** * The lightning-address domain the authorization is for, taken from the * address being handed over. The signed message names this domain, so an * authorization made for one server does not verify at another. */ domain: string; /** * When the authorization was produced, in seconds since the Unix epoch. * Covered by the signature, and valid for 10 minutes: the transferee has * to claim within that window or the current owner authorizes again. */ timestamp: /*u64*/ bigint; }; /** * Generated factory for {@link TransferAuthorization} record objects. */ export const TransferAuthorization = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< TransferAuthorization, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link TransferAuthorization}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link TransferAuthorization}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeTransferAuthorization = (() => { type TypeName = TransferAuthorization; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { username: FfiConverterString.read(from), pubkey: FfiConverterString.read(from), signature: FfiConverterString.read(from), domain: FfiConverterString.read(from), timestamp: FfiConverterUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.username, into); FfiConverterString.write(value.pubkey, into); FfiConverterString.write(value.signature, into); FfiConverterString.write(value.domain, into); FfiConverterUInt64.write(value.timestamp, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.username) + FfiConverterString.allocationSize(value.pubkey) + FfiConverterString.allocationSize(value.signature) + FfiConverterString.allocationSize(value.domain) + FfiConverterUInt64.allocationSize(value.timestamp) ); } } return new FFIConverter(); })(); export type TurnkeyConfig = { /** * Turnkey API base URL. Unset uses `https://api.turnkey.com`. */ baseUrl: string | undefined; /** * Organization (or sub-organization) id that owns the wallet. */ organizationId: string; /** * API public key (compressed, hex), registered with the organization. */ apiPublicKey: string; /** * API private key (hex) used to stamp requests. */ apiPrivateKey: string; /** * Id of the Spark wallet to sign with. */ walletId: string; /** * Network the wallet operates on; selects the Spark address format * (mainnet or regtest) used for Spark-protocol and Schnorr signing. */ network: Network; /** * Spark account number: the `{account}` in every derivation path * (`m/8797555'/{account}'/...`). Unset uses the network default, matching * the seed-based signer, so the same wallet seed derives the same keys on * either backend. */ accountNumber: /*u32*/ number | undefined; /** * The wallet's identity public key (compressed, hex), to skip fetching it * from Turnkey on init. Obtain it once from a freshly-built signer via * [`ExternalSparkSigner::get_identity_public_key`] — the simplest source, * available right after `create_turnkey_signer` with no separate connect — * or, if you only have a connected SDK, from `identity_pubkey` on the * get-info response. Pass it back on later inits: the signer then serves the * identity key and its Spark address from this value instead of the per-init * Turnkey round-trips, making signer setup network-free. Unset fetches * lazily, as before. It is a stable, non-secret, per-wallet value; a value * that does not match the wallet yields a signer that signs with the wrong * identity, so only pass one read from this same wallet. * * [`ExternalSparkSigner::get_identity_public_key`]: crate::signer::ExternalSparkSigner::get_identity_public_key */ identityPublicKey: string | undefined; /** * Retry policy for Turnkey requests. Unset uses the default policy. */ retry: TurnkeyRetryConfig | undefined; /** * Maximum requests per second the client issues to this suborganization, * across all concurrent operations. The client paces itself to this rate. * Unset uses Turnkey's documented per-suborganization cap of 10 RPS; set it * to the account's actual limit if a different one is provisioned. Must be * greater than 0 when set: 0 is rejected at connect. */ maxRps: /*u32*/ number | undefined; /** * Routes Turnkey requests through a SOCKS5 proxy. Pass the same value as * [`Config::proxy`](crate::Config::proxy): the signer is built before the * SDK, so it cannot pick the setting up on its own. */ proxy: ProxyConfig | undefined; }; /** * Generated factory for {@link TurnkeyConfig} record objects. */ export const TurnkeyConfig = (() => { const defaults = () => ({ maxRps: undefined, proxy: undefined }); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link TurnkeyConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link TurnkeyConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeTurnkeyConfig = (() => { type TypeName = TurnkeyConfig; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { baseUrl: FfiConverterOptionalString.read(from), organizationId: FfiConverterString.read(from), apiPublicKey: FfiConverterString.read(from), apiPrivateKey: FfiConverterString.read(from), walletId: FfiConverterString.read(from), network: FfiConverterTypeNetwork.read(from), accountNumber: FfiConverterOptionalUInt32.read(from), identityPublicKey: FfiConverterOptionalString.read(from), retry: FfiConverterOptionalTypeTurnkeyRetryConfig.read(from), maxRps: FfiConverterOptionalUInt32.read(from), proxy: FfiConverterOptionalTypeProxyConfig.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalString.write(value.baseUrl, into); FfiConverterString.write(value.organizationId, into); FfiConverterString.write(value.apiPublicKey, into); FfiConverterString.write(value.apiPrivateKey, into); FfiConverterString.write(value.walletId, into); FfiConverterTypeNetwork.write(value.network, into); FfiConverterOptionalUInt32.write(value.accountNumber, into); FfiConverterOptionalString.write(value.identityPublicKey, into); FfiConverterOptionalTypeTurnkeyRetryConfig.write(value.retry, into); FfiConverterOptionalUInt32.write(value.maxRps, into); FfiConverterOptionalTypeProxyConfig.write(value.proxy, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalString.allocationSize(value.baseUrl) + FfiConverterString.allocationSize(value.organizationId) + FfiConverterString.allocationSize(value.apiPublicKey) + FfiConverterString.allocationSize(value.apiPrivateKey) + FfiConverterString.allocationSize(value.walletId) + FfiConverterTypeNetwork.allocationSize(value.network) + FfiConverterOptionalUInt32.allocationSize(value.accountNumber) + FfiConverterOptionalString.allocationSize(value.identityPublicKey) + FfiConverterOptionalTypeTurnkeyRetryConfig.allocationSize(value.retry) + FfiConverterOptionalUInt32.allocationSize(value.maxRps) + FfiConverterOptionalTypeProxyConfig.allocationSize(value.proxy) ); } } return new FFIConverter(); })(); /** * Retry policy for Turnkey API requests (used while polling a pending * activity). Mirrors `turnkey_client`'s `RetryConfig` with FFI-friendly * millisecond fields. */ export type TurnkeyRetryConfig = { /** * Delay before the first retry, in milliseconds. */ initialDelayMs: /*u64*/ bigint; /** * Multiplier applied to the delay after each attempt. */ multiplier: /*f64*/ number; /** * Upper bound on the delay between retries, in milliseconds. */ maxDelayMs: /*u64*/ bigint; /** * Maximum number of retries (0 disables retrying). */ maxRetries: /*u32*/ number; /** * Total time budget for one API request including its retries and waits, * in milliseconds. No retry begins past this deadline: when the next wait * (server-requested or backoff) would end after it, the request fails with * the last error instead of stalling. */ requestTimeoutMs: /*u64*/ bigint; }; /** * Generated factory for {@link TurnkeyRetryConfig} record objects. */ export const TurnkeyRetryConfig = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link TurnkeyRetryConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link TurnkeyRetryConfig}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeTurnkeyRetryConfig = (() => { type TypeName = TurnkeyRetryConfig; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { initialDelayMs: FfiConverterUInt64.read(from), multiplier: FfiConverterFloat64.read(from), maxDelayMs: FfiConverterUInt64.read(from), maxRetries: FfiConverterUInt32.read(from), requestTimeoutMs: FfiConverterUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt64.write(value.initialDelayMs, into); FfiConverterFloat64.write(value.multiplier, into); FfiConverterUInt64.write(value.maxDelayMs, into); FfiConverterUInt32.write(value.maxRetries, into); FfiConverterUInt64.write(value.requestTimeoutMs, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt64.allocationSize(value.initialDelayMs) + FfiConverterFloat64.allocationSize(value.multiplier) + FfiConverterUInt64.allocationSize(value.maxDelayMs) + FfiConverterUInt32.allocationSize(value.maxRetries) + FfiConverterUInt64.allocationSize(value.requestTimeoutMs) ); } } return new FFIConverter(); })(); export type TxStatus = { confirmed: boolean; blockHeight: /*u32*/ number | undefined; blockTime: /*u64*/ bigint | undefined; }; /** * Generated factory for {@link TxStatus} record objects. */ export const TxStatus = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link TxStatus}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link TxStatus}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeTxStatus = (() => { type TypeName = TxStatus; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { confirmed: FfiConverterBool.read(from), blockHeight: FfiConverterOptionalUInt32.read(from), blockTime: FfiConverterOptionalUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterBool.write(value.confirmed, into); FfiConverterOptionalUInt32.write(value.blockHeight, into); FfiConverterOptionalUInt64.write(value.blockTime, into); } allocationSize(value: TypeName): number { return ( FfiConverterBool.allocationSize(value.confirmed) + FfiConverterOptionalUInt32.allocationSize(value.blockHeight) + FfiConverterOptionalUInt64.allocationSize(value.blockTime) ); } } return new FFIConverter(); })(); export type UnfreezeIssuerTokenRequest = { address: string; }; /** * Generated factory for {@link UnfreezeIssuerTokenRequest} record objects. */ export const UnfreezeIssuerTokenRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< UnfreezeIssuerTokenRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link UnfreezeIssuerTokenRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link UnfreezeIssuerTokenRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeUnfreezeIssuerTokenRequest = (() => { type TypeName = UnfreezeIssuerTokenRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { address: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.address, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.address); } } return new FFIConverter(); })(); export type UnfreezeIssuerTokenResponse = { impactedOutputIds: Array; impactedTokenAmount: U128; }; /** * Generated factory for {@link UnfreezeIssuerTokenResponse} record objects. */ export const UnfreezeIssuerTokenResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< UnfreezeIssuerTokenResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link UnfreezeIssuerTokenResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link UnfreezeIssuerTokenResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeUnfreezeIssuerTokenResponse = (() => { type TypeName = UnfreezeIssuerTokenResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { impactedOutputIds: FfiConverterArrayString.read(from), impactedTokenAmount: FfiConverterTypeu128.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterArrayString.write(value.impactedOutputIds, into); FfiConverterTypeu128.write(value.impactedTokenAmount, into); } allocationSize(value: TypeName): number { return ( FfiConverterArrayString.allocationSize(value.impactedOutputIds) + FfiConverterTypeu128.allocationSize(value.impactedTokenAmount) ); } } return new FFIConverter(); })(); /** * A leaf selected for exit, with its value. */ export type UnilateralExitLeaf = { leafId: string; /** * The leaf's value in satoshis. */ value: /*u64*/ bigint; }; /** * Generated factory for {@link UnilateralExitLeaf} record objects. */ export const UnilateralExitLeaf = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link UnilateralExitLeaf}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link UnilateralExitLeaf}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeUnilateralExitLeaf = (() => { type TypeName = UnilateralExitLeaf; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { leafId: FfiConverterString.read(from), value: FfiConverterUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.leafId, into); FfiConverterUInt64.write(value.value, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.leafId) + FfiConverterUInt64.allocationSize(value.value) ); } } return new FFIConverter(); })(); /** * Request for `unilateral_exit`: a `prepare_unilateral_exit` quote plus the * funding UTXOs that pay its fees. The signer is passed separately (it is not a * plain data value). */ export type UnilateralExitRequest = { /** * The quote returned by `prepare_unilateral_exit`, naming the leaves to exit. */ prepared: PrepareUnilateralExitResponse; /** * The funding UTXOs that pay the exit's on-chain fees, meeting the quote's * `single_utxo_funding_sat` (one UTXO) or `per_branch_funding` (one per branch). */ fundingInputs: Array; }; /** * Generated factory for {@link UnilateralExitRequest} record objects. */ export const UnilateralExitRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< UnilateralExitRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link UnilateralExitRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link UnilateralExitRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeUnilateralExitRequest = (() => { type TypeName = UnilateralExitRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { prepared: FfiConverterTypePrepareUnilateralExitResponse.read(from), fundingInputs: FfiConverterArrayTypeCpfpInput.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypePrepareUnilateralExitResponse.write(value.prepared, into); FfiConverterArrayTypeCpfpInput.write(value.fundingInputs, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypePrepareUnilateralExitResponse.allocationSize( value.prepared ) + FfiConverterArrayTypeCpfpInput.allocationSize(value.fundingInputs) ); } } return new FFIConverter(); })(); /** * Result of `unilateral_exit`: a cost summary plus the complete, signed exit * path. */ export type UnilateralExitResponse = { /** * Total value of the selected leaves, in satoshis. */ recoverableValueSat: /*u64*/ bigint; /** * The actual total on-chain fee the returned transactions pay at the * requested rate, in satoshis. A resumed or partially-confirmed exit pays * less because already-confirmed steps are not rebuilt. * * The sum of the three components below, which say who pays what: * `cpfp_fee_sat + fanout_fee_sat + sweep_fee_sat`. The first two come from * your funding UTXOs, the third off the value being recovered. */ totalFeeSat: /*u64*/ bigint; /** * The part of `total_fee_sat` the CPFP children pay, funded by your UTXOs. * It does not reduce what the exit recovers. */ cpfpFeeSat: /*u64*/ bigint; /** * The part of `total_fee_sat` the fan-out pays, funded by your UTXO. Zero * when this exit needed no fan-out, and when an earlier attempt's fan-out * had already confirmed. */ fanoutFeeSat: /*u64*/ bigint; /** * The part of `total_fee_sat` the sweep pays, taken from the value it * moves, so this is the one component subtracted from what reaches the * destination. Zero while no refund is on-chain yet and the set carries no * sweep. */ sweepFeeSat: /*u64*/ bigint; leaves: Array; /** * The full signed transaction set, in valid topological (broadcast) order * with shared ancestors appearing once and the sweep last. */ transactions: Array; /** * The funding UTXOs this exit was built from, as you supplied them. Hand * them back when you build the exit again and they are followed to whatever * they have since become, so an outpoint an earlier attempt already spent * still funds the rest. */ fundingInputs: Array; }; /** * Generated factory for {@link UnilateralExitResponse} record objects. */ export const UnilateralExitResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< UnilateralExitResponse, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link UnilateralExitResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link UnilateralExitResponse}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeUnilateralExitResponse = (() => { type TypeName = UnilateralExitResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { recoverableValueSat: FfiConverterUInt64.read(from), totalFeeSat: FfiConverterUInt64.read(from), cpfpFeeSat: FfiConverterUInt64.read(from), fanoutFeeSat: FfiConverterUInt64.read(from), sweepFeeSat: FfiConverterUInt64.read(from), leaves: FfiConverterArrayTypeUnilateralExitLeaf.read(from), transactions: FfiConverterArrayTypeUnilateralExitTransaction.read(from), fundingInputs: FfiConverterArrayTypeCpfpInput.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt64.write(value.recoverableValueSat, into); FfiConverterUInt64.write(value.totalFeeSat, into); FfiConverterUInt64.write(value.cpfpFeeSat, into); FfiConverterUInt64.write(value.fanoutFeeSat, into); FfiConverterUInt64.write(value.sweepFeeSat, into); FfiConverterArrayTypeUnilateralExitLeaf.write(value.leaves, into); FfiConverterArrayTypeUnilateralExitTransaction.write( value.transactions, into ); FfiConverterArrayTypeCpfpInput.write(value.fundingInputs, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt64.allocationSize(value.recoverableValueSat) + FfiConverterUInt64.allocationSize(value.totalFeeSat) + FfiConverterUInt64.allocationSize(value.cpfpFeeSat) + FfiConverterUInt64.allocationSize(value.fanoutFeeSat) + FfiConverterUInt64.allocationSize(value.sweepFeeSat) + FfiConverterArrayTypeUnilateralExitLeaf.allocationSize(value.leaves) + FfiConverterArrayTypeUnilateralExitTransaction.allocationSize( value.transactions ) + FfiConverterArrayTypeCpfpInput.allocationSize(value.fundingInputs) ); } } return new FFIConverter(); })(); /** * One transaction in the unilateral exit path, with everything needed to * order and broadcast it. */ export type UnilateralExitTransaction = { kind: UnilateralExitTxKind; /** * The tree node this transaction belongs to. Unset for the fan-out and the * sweep. */ nodeId: string | undefined; txid: string; txHex: string; /** * The signed CPFP child to broadcast alongside `tx_hex` as a package. * Unset for the fan-out and the sweep (no anchor to bump) and for a * `Confirmed` step (its CPFP is already on-chain). */ cpfpTxHex: string | undefined; /** * Relative CSV timelock, in blocks, that must mature on the spent input * before this transaction can confirm. Unset when there is no timelock. */ csvTimelockBlocks: /*u32*/ number | undefined; /** * Txids of other entries in this list that must be confirmed before this * one can be broadcast. */ dependsOn: Array; /** * Whether this transaction is on-chain, can go out now, or is waiting on * something. Resolved against the chain tip, so it accounts for * `csv_timelock_blocks` as well as `depends_on`. */ status: ExitTransactionStatus; }; /** * Generated factory for {@link UnilateralExitTransaction} record objects. */ export const UnilateralExitTransaction = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< UnilateralExitTransaction, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link UnilateralExitTransaction}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link UnilateralExitTransaction}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeUnilateralExitTransaction = (() => { type TypeName = UnilateralExitTransaction; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { kind: FfiConverterTypeUnilateralExitTxKind.read(from), nodeId: FfiConverterOptionalString.read(from), txid: FfiConverterString.read(from), txHex: FfiConverterString.read(from), cpfpTxHex: FfiConverterOptionalString.read(from), csvTimelockBlocks: FfiConverterOptionalUInt32.read(from), dependsOn: FfiConverterArrayString.read(from), status: FfiConverterTypeExitTransactionStatus.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeUnilateralExitTxKind.write(value.kind, into); FfiConverterOptionalString.write(value.nodeId, into); FfiConverterString.write(value.txid, into); FfiConverterString.write(value.txHex, into); FfiConverterOptionalString.write(value.cpfpTxHex, into); FfiConverterOptionalUInt32.write(value.csvTimelockBlocks, into); FfiConverterArrayString.write(value.dependsOn, into); FfiConverterTypeExitTransactionStatus.write(value.status, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeUnilateralExitTxKind.allocationSize(value.kind) + FfiConverterOptionalString.allocationSize(value.nodeId) + FfiConverterString.allocationSize(value.txid) + FfiConverterString.allocationSize(value.txHex) + FfiConverterOptionalString.allocationSize(value.cpfpTxHex) + FfiConverterOptionalUInt32.allocationSize(value.csvTimelockBlocks) + FfiConverterArrayString.allocationSize(value.dependsOn) + FfiConverterTypeExitTransactionStatus.allocationSize(value.status) ); } } return new FFIConverter(); })(); /** * Request to unregister an existing webhook. */ export type UnregisterWebhookRequest = { /** * The unique identifier of the webhook to unregister. */ webhookId: string; }; /** * Generated factory for {@link UnregisterWebhookRequest} record objects. */ export const UnregisterWebhookRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< UnregisterWebhookRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link UnregisterWebhookRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link UnregisterWebhookRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeUnregisterWebhookRequest = (() => { type TypeName = UnregisterWebhookRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { webhookId: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.webhookId, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.webhookId); } } return new FFIConverter(); })(); export type UnversionedRecordChange = { id: RecordId; schemaVersion: string; updatedFields: Map; }; /** * Generated factory for {@link UnversionedRecordChange} record objects. */ export const UnversionedRecordChange = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< UnversionedRecordChange, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link UnversionedRecordChange}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link UnversionedRecordChange}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeUnversionedRecordChange = (() => { type TypeName = UnversionedRecordChange; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { id: FfiConverterTypeRecordId.read(from), schemaVersion: FfiConverterString.read(from), updatedFields: FfiConverterMapStringString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeRecordId.write(value.id, into); FfiConverterString.write(value.schemaVersion, into); FfiConverterMapStringString.write(value.updatedFields, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeRecordId.allocationSize(value.id) + FfiConverterString.allocationSize(value.schemaVersion) + FfiConverterMapStringString.allocationSize(value.updatedFields) ); } } return new FFIConverter(); })(); /** * Request to update an existing contact. */ export type UpdateContactRequest = { id: string; name: string; /** * A Lightning address (user@domain). */ paymentIdentifier: string; }; /** * Generated factory for {@link UpdateContactRequest} record objects. */ export const UpdateContactRequest = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< UpdateContactRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link UpdateContactRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link UpdateContactRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeUpdateContactRequest = (() => { type TypeName = UpdateContactRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { id: FfiConverterString.read(from), name: FfiConverterString.read(from), paymentIdentifier: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.id, into); FfiConverterString.write(value.name, into); FfiConverterString.write(value.paymentIdentifier, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.id) + FfiConverterString.allocationSize(value.name) + FfiConverterString.allocationSize(value.paymentIdentifier) ); } } return new FFIConverter(); })(); export type UpdateUserSettingsRequest = { sparkPrivateModeEnabled: boolean | undefined; /** * Update the active stable balance token. `None` means no change. */ stableBalanceActiveLabel: StableBalanceActiveLabel | undefined; /** * Designate or remove the wallet's master identity, a second public key * the Spark operators accept as a reader of this wallet's balance and * history while `spark_private_mode_enabled` is set. The master identity * can only read: payments still require the owner's keys. `None` means no * change. */ sparkMasterIdentityPublicKey: SparkMasterIdentityPublicKey | undefined; }; /** * Generated factory for {@link UpdateUserSettingsRequest} record objects. */ export const UpdateUserSettingsRequest = (() => { const defaults = () => ({ stableBalanceActiveLabel: undefined, sparkMasterIdentityPublicKey: undefined, }); const create = (() => { return uniffiCreateRecord< UpdateUserSettingsRequest, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link UpdateUserSettingsRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link UpdateUserSettingsRequest}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeUpdateUserSettingsRequest = (() => { type TypeName = UpdateUserSettingsRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { sparkPrivateModeEnabled: FfiConverterOptionalBool.read(from), stableBalanceActiveLabel: FfiConverterOptionalTypeStableBalanceActiveLabel.read(from), sparkMasterIdentityPublicKey: FfiConverterOptionalTypeSparkMasterIdentityPublicKey.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalBool.write(value.sparkPrivateModeEnabled, into); FfiConverterOptionalTypeStableBalanceActiveLabel.write( value.stableBalanceActiveLabel, into ); FfiConverterOptionalTypeSparkMasterIdentityPublicKey.write( value.sparkMasterIdentityPublicKey, into ); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalBool.allocationSize(value.sparkPrivateModeEnabled) + FfiConverterOptionalTypeStableBalanceActiveLabel.allocationSize( value.stableBalanceActiveLabel ) + FfiConverterOptionalTypeSparkMasterIdentityPublicKey.allocationSize( value.sparkMasterIdentityPublicKey ) ); } } return new FFIConverter(); })(); export type UrlSuccessActionData = { /** * Contents description, up to 144 characters */ description: string; /** * URL of the success action */ url: string; /** * Indicates the success URL domain matches the LNURL callback domain. * * See */ matchesCallbackDomain: boolean; }; /** * Generated factory for {@link UrlSuccessActionData} record objects. */ export const UrlSuccessActionData = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< UrlSuccessActionData, ReturnType >(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link UrlSuccessActionData}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link UrlSuccessActionData}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeUrlSuccessActionData = (() => { type TypeName = UrlSuccessActionData; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { description: FfiConverterString.read(from), url: FfiConverterString.read(from), matchesCallbackDomain: FfiConverterBool.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.description, into); FfiConverterString.write(value.url, into); FfiConverterBool.write(value.matchesCallbackDomain, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.description) + FfiConverterString.allocationSize(value.url) + FfiConverterBool.allocationSize(value.matchesCallbackDomain) ); } } return new FFIConverter(); })(); export type UserSettings = { sparkPrivateModeEnabled: boolean; /** * The label of the currently active stable balance token, or `None` if deactivated. */ stableBalanceActiveLabel: string | undefined; /** * The hex encoded public key designated as this wallet's master identity * key, or `None` if none is designated. */ sparkMasterIdentityPublicKey: string | undefined; }; /** * Generated factory for {@link UserSettings} record objects. */ export const UserSettings = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link UserSettings}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link UserSettings}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeUserSettings = (() => { type TypeName = UserSettings; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { sparkPrivateModeEnabled: FfiConverterBool.read(from), stableBalanceActiveLabel: FfiConverterOptionalString.read(from), sparkMasterIdentityPublicKey: FfiConverterOptionalString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterBool.write(value.sparkPrivateModeEnabled, into); FfiConverterOptionalString.write(value.stableBalanceActiveLabel, into); FfiConverterOptionalString.write( value.sparkMasterIdentityPublicKey, into ); } allocationSize(value: TypeName): number { return ( FfiConverterBool.allocationSize(value.sparkPrivateModeEnabled) + FfiConverterOptionalString.allocationSize( value.stableBalanceActiveLabel ) + FfiConverterOptionalString.allocationSize( value.sparkMasterIdentityPublicKey ) ); } } return new FFIConverter(); })(); export type Utxo = { txid: string; vout: /*u32*/ number; value: /*u64*/ bigint; status: TxStatus; }; /** * Generated factory for {@link Utxo} record objects. */ export const Utxo = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link Utxo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Utxo}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeUtxo = (() => { type TypeName = Utxo; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { txid: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), value: FfiConverterUInt64.read(from), status: FfiConverterTypeTxStatus.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.txid, into); FfiConverterUInt32.write(value.vout, into); FfiConverterUInt64.write(value.value, into); FfiConverterTypeTxStatus.write(value.status, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.txid) + FfiConverterUInt32.allocationSize(value.vout) + FfiConverterUInt64.allocationSize(value.value) + FfiConverterTypeTxStatus.allocationSize(value.status) ); } } return new FFIConverter(); })(); /** * A wallet derived from a passkey. */ export type Wallet = { seed: Seed; /** * Label used for derivation: user-provided or the default. */ label: string; }; /** * Generated factory for {@link Wallet} record objects. */ export const Wallet = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link Wallet}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Wallet}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeWallet = (() => { type TypeName = Wallet; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { seed: FfiConverterTypeSeed.read(from), label: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeSeed.write(value.seed, into); FfiConverterString.write(value.label, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeSeed.allocationSize(value.seed) + FfiConverterString.allocationSize(value.label) ); } } return new FFIConverter(); })(); /** * Response from [`crate::passkey::Passkey::setup_wallet`]. */ export type WalletSetup = { wallet: Wallet; /** * Credential that derived this wallet. Absent when the provider * does not surface it. */ credentialId: ArrayBuffer | undefined; }; /** * Generated factory for {@link WalletSetup} record objects. */ export const WalletSetup = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ /** * Create a frozen instance of {@link WalletSetup}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link WalletSetup}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeWalletSetup = (() => { type TypeName = WalletSetup; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { wallet: FfiConverterTypeWallet.read(from), credentialId: FfiConverterOptionalArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeWallet.write(value.wallet, into); FfiConverterOptionalArrayBuffer.write(value.credentialId, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeWallet.allocationSize(value.wallet) + FfiConverterOptionalArrayBuffer.allocationSize(value.credentialId) ); } } return new FFIConverter(); })(); /** * A registered webhook entry. */ export type Webhook = { /** * Unique identifier for this webhook. */ id: string; /** * The URL that receives webhook notifications. */ url: string; /** * The event types this webhook is subscribed to. */ eventTypes: Array; }; /** * Generated factory for {@link Webhook} record objects. */ export const Webhook = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ /** * Create a frozen instance of {@link Webhook}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ create, /** * Create a frozen instance of {@link Webhook}, with defaults specified * in Rust, in the {@link breez_sdk_spark} crate. */ new: create, /** * Defaults specified in the {@link breez_sdk_spark} crate. */ defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeWebhook = (() => { type TypeName = Webhook; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { id: FfiConverterString.read(from), url: FfiConverterString.read(from), eventTypes: FfiConverterArrayTypeWebhookEventType.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.id, into); FfiConverterString.write(value.url, into); FfiConverterArrayTypeWebhookEventType.write(value.eventTypes, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.id) + FfiConverterString.allocationSize(value.url) + FfiConverterArrayTypeWebhookEventType.allocationSize(value.eventTypes) ); } } return new FFIConverter(); })(); const stringConverter = { stringToBytes: (s: string) => uniffiCaller.rustCall((status) => nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer( s, status ) ), bytesToString: (ab: UniffiByteArray) => uniffiCaller.rustCall((status) => nativeModule().ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string( ab, status ) ), stringByteLength: (s: string) => uniffiCaller.rustCall((status) => nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length( s, status ) ), }; const FfiConverterString = uniffiCreateFfiConverterString(stringConverter); /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. */ export type PublicKey = string; // FfiConverter for PublicKey, a type alias for string. const FfiConverterTypePublicKey = FfiConverterString; /** * Typealias from the type name used in the UDL file to the custom type. This * is needed because the UDL type name is used in function/method signatures. */ export type U128 = bigint; // FfiConverter for U128 const FfiConverterTypeu128 = (() => { type TsType = U128; type FfiType = Uint8Array; const intermediateConverter = FfiConverterString; class FFIConverter implements FfiConverter { lift(value: FfiType): TsType { const intermediate = intermediateConverter.lift(value); return BigInt(intermediate); } lower(value: TsType): FfiType { const intermediate = value.toString(); return intermediateConverter.lower(intermediate); } read(from: RustBuffer): TsType { const intermediate = intermediateConverter.read(from); return BigInt(intermediate); } write(value: TsType, into: RustBuffer): void { const intermediate = value.toString(); intermediateConverter.write(intermediate, into); } allocationSize(value: TsType): number { const intermediate = value.toString(); return intermediateConverter.allocationSize(intermediate); } } return new FFIConverter(); })(); // Enum: AesSuccessActionDataResult export enum AesSuccessActionDataResult_Tags { Decrypted = 'Decrypted', ErrorStatus = 'ErrorStatus', } /** * Result of decryption of [`AesSuccessActionData`] payload */ export const AesSuccessActionDataResult = (() => { type Decrypted__interface = { tag: AesSuccessActionDataResult_Tags.Decrypted; inner: Readonly<{ data: AesSuccessActionDataDecrypted }>; }; class Decrypted_ extends UniffiEnum implements Decrypted__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'AesSuccessActionDataResult'; readonly tag = AesSuccessActionDataResult_Tags.Decrypted; readonly inner: Readonly<{ data: AesSuccessActionDataDecrypted }>; constructor(inner: { data: AesSuccessActionDataDecrypted }) { super('AesSuccessActionDataResult', 'Decrypted'); this.inner = Object.freeze(inner); } static new(inner: { data: AesSuccessActionDataDecrypted }): Decrypted_ { return new Decrypted_(inner); } static instanceOf(obj: any): obj is Decrypted_ { return obj.tag === AesSuccessActionDataResult_Tags.Decrypted; } } type ErrorStatus__interface = { tag: AesSuccessActionDataResult_Tags.ErrorStatus; inner: Readonly<{ reason: string }>; }; class ErrorStatus_ extends UniffiEnum implements ErrorStatus__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'AesSuccessActionDataResult'; readonly tag = AesSuccessActionDataResult_Tags.ErrorStatus; readonly inner: Readonly<{ reason: string }>; constructor(inner: { reason: string }) { super('AesSuccessActionDataResult', 'ErrorStatus'); this.inner = Object.freeze(inner); } static new(inner: { reason: string }): ErrorStatus_ { return new ErrorStatus_(inner); } static instanceOf(obj: any): obj is ErrorStatus_ { return obj.tag === AesSuccessActionDataResult_Tags.ErrorStatus; } } function instanceOf(obj: any): obj is AesSuccessActionDataResult { return obj[uniffiTypeNameSymbol] === 'AesSuccessActionDataResult'; } return Object.freeze({ instanceOf, Decrypted: Decrypted_, ErrorStatus: ErrorStatus_, }); })(); /** * Result of decryption of [`AesSuccessActionData`] payload */ export type AesSuccessActionDataResult = InstanceType< (typeof AesSuccessActionDataResult)[keyof Omit< typeof AesSuccessActionDataResult, 'instanceOf' >] >; // FfiConverter for enum AesSuccessActionDataResult const FfiConverterTypeAesSuccessActionDataResult = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = AesSuccessActionDataResult; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new AesSuccessActionDataResult.Decrypted({ data: FfiConverterTypeAesSuccessActionDataDecrypted.read(from), }); case 2: return new AesSuccessActionDataResult.ErrorStatus({ reason: FfiConverterString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case AesSuccessActionDataResult_Tags.Decrypted: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeAesSuccessActionDataDecrypted.write(inner.data, into); return; } case AesSuccessActionDataResult_Tags.ErrorStatus: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.reason, into); return; } default: // Throwing from here means that AesSuccessActionDataResult_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case AesSuccessActionDataResult_Tags.Decrypted: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeAesSuccessActionDataDecrypted.allocationSize( inner.data ); return size; } case AesSuccessActionDataResult_Tags.ErrorStatus: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.reason); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: Amount export enum Amount_Tags { Bitcoin = 'Bitcoin', Currency = 'Currency', } export const Amount = (() => { type Bitcoin__interface = { tag: Amount_Tags.Bitcoin; inner: Readonly<{ amountMsat: /*u64*/ bigint }>; }; class Bitcoin_ extends UniffiEnum implements Bitcoin__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'Amount'; readonly tag = Amount_Tags.Bitcoin; readonly inner: Readonly<{ amountMsat: /*u64*/ bigint }>; constructor(inner: { amountMsat: /*u64*/ bigint }) { super('Amount', 'Bitcoin'); this.inner = Object.freeze(inner); } static new(inner: { amountMsat: /*u64*/ bigint }): Bitcoin_ { return new Bitcoin_(inner); } static instanceOf(obj: any): obj is Bitcoin_ { return obj.tag === Amount_Tags.Bitcoin; } } type Currency__interface = { tag: Amount_Tags.Currency; inner: Readonly<{ iso4217Code: string; fractionalAmount: /*u64*/ bigint }>; }; /** * An amount of currency specified using ISO 4712. */ class Currency_ extends UniffiEnum implements Currency__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'Amount'; readonly tag = Amount_Tags.Currency; readonly inner: Readonly<{ iso4217Code: string; fractionalAmount: /*u64*/ bigint; }>; constructor(inner: { /** * The currency that the amount is denominated in. */ iso4217Code: string; /** * The amount in the currency unit adjusted by the ISO 4712 exponent (e.g., USD cents). */ fractionalAmount: /*u64*/ bigint; }) { super('Amount', 'Currency'); this.inner = Object.freeze(inner); } static new(inner: { /** * The currency that the amount is denominated in. */ iso4217Code: string; /** * The amount in the currency unit adjusted by the ISO 4712 exponent (e.g., USD cents). */ fractionalAmount: /*u64*/ bigint; }): Currency_ { return new Currency_(inner); } static instanceOf(obj: any): obj is Currency_ { return obj.tag === Amount_Tags.Currency; } } function instanceOf(obj: any): obj is Amount { return obj[uniffiTypeNameSymbol] === 'Amount'; } return Object.freeze({ instanceOf, Bitcoin: Bitcoin_, Currency: Currency_, }); })(); export type Amount = InstanceType< (typeof Amount)[keyof Omit] >; // FfiConverter for enum Amount const FfiConverterTypeAmount = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = Amount; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new Amount.Bitcoin({ amountMsat: FfiConverterUInt64.read(from), }); case 2: return new Amount.Currency({ iso4217Code: FfiConverterString.read(from), fractionalAmount: FfiConverterUInt64.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case Amount_Tags.Bitcoin: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterUInt64.write(inner.amountMsat, into); return; } case Amount_Tags.Currency: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.iso4217Code, into); FfiConverterUInt64.write(inner.fractionalAmount, into); return; } default: // Throwing from here means that Amount_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case Amount_Tags.Bitcoin: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterUInt64.allocationSize(inner.amountMsat); return size; } case Amount_Tags.Currency: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.iso4217Code); size += FfiConverterUInt64.allocationSize(inner.fractionalAmount); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * The reason why a conversion amount was adjusted from the originally requested value. */ export enum AmountAdjustmentReason { /** * The amount was increased to meet the minimum conversion limit. */ FlooredToMinLimit, /** * The amount was increased to convert the full token balance, * avoiding a remaining balance below the minimum conversion limit (token dust). */ IncreasedToAvoidDust, } const FfiConverterTypeAmountAdjustmentReason = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = AmountAdjustmentReason; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return AmountAdjustmentReason.FlooredToMinLimit; case 2: return AmountAdjustmentReason.IncreasedToAvoidDust; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case AmountAdjustmentReason.FlooredToMinLimit: return ordinalConverter.write(1, into); case AmountAdjustmentReason.IncreasedToAvoidDust: return ordinalConverter.write(2, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: AssetFilter export enum AssetFilter_Tags { Bitcoin = 'Bitcoin', Token = 'Token', } /** * A field of [`ListPaymentsRequest`] when listing payments filtered by asset */ export const AssetFilter = (() => { type Bitcoin__interface = { tag: AssetFilter_Tags.Bitcoin; }; class Bitcoin_ extends UniffiEnum implements Bitcoin__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'AssetFilter'; readonly tag = AssetFilter_Tags.Bitcoin; constructor() { super('AssetFilter', 'Bitcoin'); } static new(): Bitcoin_ { return new Bitcoin_(); } static instanceOf(obj: any): obj is Bitcoin_ { return obj.tag === AssetFilter_Tags.Bitcoin; } } type Token__interface = { tag: AssetFilter_Tags.Token; inner: Readonly<{ tokenIdentifier: string | undefined }>; }; class Token_ extends UniffiEnum implements Token__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'AssetFilter'; readonly tag = AssetFilter_Tags.Token; readonly inner: Readonly<{ tokenIdentifier: string | undefined }>; constructor(inner: { /** * Optional token identifier to filter by */ tokenIdentifier: string | undefined; }) { super('AssetFilter', 'Token'); this.inner = Object.freeze(inner); } static new(inner: { /** * Optional token identifier to filter by */ tokenIdentifier: string | undefined; }): Token_ { return new Token_(inner); } static instanceOf(obj: any): obj is Token_ { return obj.tag === AssetFilter_Tags.Token; } } function instanceOf(obj: any): obj is AssetFilter { return obj[uniffiTypeNameSymbol] === 'AssetFilter'; } return Object.freeze({ instanceOf, Bitcoin: Bitcoin_, Token: Token_, }); })(); /** * A field of [`ListPaymentsRequest`] when listing payments filtered by asset */ export type AssetFilter = InstanceType< (typeof AssetFilter)[keyof Omit] >; // FfiConverter for enum AssetFilter const FfiConverterTypeAssetFilter = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = AssetFilter; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new AssetFilter.Bitcoin(); case 2: return new AssetFilter.Token({ tokenIdentifier: FfiConverterOptionalString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case AssetFilter_Tags.Bitcoin: { ordinalConverter.write(1, into); return; } case AssetFilter_Tags.Token: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterOptionalString.write(inner.tokenIdentifier, into); return; } default: // Throwing from here means that AssetFilter_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case AssetFilter_Tags.Bitcoin: { return ordinalConverter.allocationSize(1); } case AssetFilter_Tags.Token: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterOptionalString.allocationSize( inner.tokenIdentifier ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: AutoOptimizationEvent export enum AutoOptimizationEvent_Tags { Started = 'Started', RoundCompleted = 'RoundCompleted', Completed = 'Completed', Cancelled = 'Cancelled', Failed = 'Failed', Skipped = 'Skipped', } export const AutoOptimizationEvent = (() => { type Started__interface = { tag: AutoOptimizationEvent_Tags.Started; inner: Readonly<{ totalRounds: /*u32*/ number }>; }; /** * Optimization has started with the given number of rounds. */ class Started_ extends UniffiEnum implements Started__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'AutoOptimizationEvent'; readonly tag = AutoOptimizationEvent_Tags.Started; readonly inner: Readonly<{ totalRounds: /*u32*/ number }>; constructor(inner: { totalRounds: /*u32*/ number }) { super('AutoOptimizationEvent', 'Started'); this.inner = Object.freeze(inner); } static new(inner: { totalRounds: /*u32*/ number }): Started_ { return new Started_(inner); } static instanceOf(obj: any): obj is Started_ { return obj.tag === AutoOptimizationEvent_Tags.Started; } } type RoundCompleted__interface = { tag: AutoOptimizationEvent_Tags.RoundCompleted; inner: Readonly<{ currentRound: /*u32*/ number; totalRounds: /*u32*/ number; }>; }; /** * A round has completed. */ class RoundCompleted_ extends UniffiEnum implements RoundCompleted__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'AutoOptimizationEvent'; readonly tag = AutoOptimizationEvent_Tags.RoundCompleted; readonly inner: Readonly<{ currentRound: /*u32*/ number; totalRounds: /*u32*/ number; }>; constructor(inner: { currentRound: /*u32*/ number; totalRounds: /*u32*/ number; }) { super('AutoOptimizationEvent', 'RoundCompleted'); this.inner = Object.freeze(inner); } static new(inner: { currentRound: /*u32*/ number; totalRounds: /*u32*/ number; }): RoundCompleted_ { return new RoundCompleted_(inner); } static instanceOf(obj: any): obj is RoundCompleted_ { return obj.tag === AutoOptimizationEvent_Tags.RoundCompleted; } } type Completed__interface = { tag: AutoOptimizationEvent_Tags.Completed; }; /** * Optimization completed successfully. */ class Completed_ extends UniffiEnum implements Completed__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'AutoOptimizationEvent'; readonly tag = AutoOptimizationEvent_Tags.Completed; constructor() { super('AutoOptimizationEvent', 'Completed'); } static new(): Completed_ { return new Completed_(); } static instanceOf(obj: any): obj is Completed_ { return obj.tag === AutoOptimizationEvent_Tags.Completed; } } type Cancelled__interface = { tag: AutoOptimizationEvent_Tags.Cancelled; }; /** * Optimization was cancelled. */ class Cancelled_ extends UniffiEnum implements Cancelled__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'AutoOptimizationEvent'; readonly tag = AutoOptimizationEvent_Tags.Cancelled; constructor() { super('AutoOptimizationEvent', 'Cancelled'); } static new(): Cancelled_ { return new Cancelled_(); } static instanceOf(obj: any): obj is Cancelled_ { return obj.tag === AutoOptimizationEvent_Tags.Cancelled; } } type Failed__interface = { tag: AutoOptimizationEvent_Tags.Failed; inner: Readonly<{ error: string }>; }; /** * Optimization failed with an error. */ class Failed_ extends UniffiEnum implements Failed__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'AutoOptimizationEvent'; readonly tag = AutoOptimizationEvent_Tags.Failed; readonly inner: Readonly<{ error: string }>; constructor(inner: { error: string }) { super('AutoOptimizationEvent', 'Failed'); this.inner = Object.freeze(inner); } static new(inner: { error: string }): Failed_ { return new Failed_(inner); } static instanceOf(obj: any): obj is Failed_ { return obj.tag === AutoOptimizationEvent_Tags.Failed; } } type Skipped__interface = { tag: AutoOptimizationEvent_Tags.Skipped; }; /** * Optimization was skipped because leaves are already optimal. */ class Skipped_ extends UniffiEnum implements Skipped__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'AutoOptimizationEvent'; readonly tag = AutoOptimizationEvent_Tags.Skipped; constructor() { super('AutoOptimizationEvent', 'Skipped'); } static new(): Skipped_ { return new Skipped_(); } static instanceOf(obj: any): obj is Skipped_ { return obj.tag === AutoOptimizationEvent_Tags.Skipped; } } function instanceOf(obj: any): obj is AutoOptimizationEvent { return obj[uniffiTypeNameSymbol] === 'AutoOptimizationEvent'; } return Object.freeze({ instanceOf, Started: Started_, RoundCompleted: RoundCompleted_, Completed: Completed_, Cancelled: Cancelled_, Failed: Failed_, Skipped: Skipped_, }); })(); export type AutoOptimizationEvent = InstanceType< (typeof AutoOptimizationEvent)[keyof Omit< typeof AutoOptimizationEvent, 'instanceOf' >] >; // FfiConverter for enum AutoOptimizationEvent const FfiConverterTypeAutoOptimizationEvent = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = AutoOptimizationEvent; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new AutoOptimizationEvent.Started({ totalRounds: FfiConverterUInt32.read(from), }); case 2: return new AutoOptimizationEvent.RoundCompleted({ currentRound: FfiConverterUInt32.read(from), totalRounds: FfiConverterUInt32.read(from), }); case 3: return new AutoOptimizationEvent.Completed(); case 4: return new AutoOptimizationEvent.Cancelled(); case 5: return new AutoOptimizationEvent.Failed({ error: FfiConverterString.read(from), }); case 6: return new AutoOptimizationEvent.Skipped(); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case AutoOptimizationEvent_Tags.Started: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterUInt32.write(inner.totalRounds, into); return; } case AutoOptimizationEvent_Tags.RoundCompleted: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterUInt32.write(inner.currentRound, into); FfiConverterUInt32.write(inner.totalRounds, into); return; } case AutoOptimizationEvent_Tags.Completed: { ordinalConverter.write(3, into); return; } case AutoOptimizationEvent_Tags.Cancelled: { ordinalConverter.write(4, into); return; } case AutoOptimizationEvent_Tags.Failed: { ordinalConverter.write(5, into); const inner = value.inner; FfiConverterString.write(inner.error, into); return; } case AutoOptimizationEvent_Tags.Skipped: { ordinalConverter.write(6, into); return; } default: // Throwing from here means that AutoOptimizationEvent_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case AutoOptimizationEvent_Tags.Started: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterUInt32.allocationSize(inner.totalRounds); return size; } case AutoOptimizationEvent_Tags.RoundCompleted: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterUInt32.allocationSize(inner.currentRound); size += FfiConverterUInt32.allocationSize(inner.totalRounds); return size; } case AutoOptimizationEvent_Tags.Completed: { return ordinalConverter.allocationSize(3); } case AutoOptimizationEvent_Tags.Cancelled: { return ordinalConverter.allocationSize(4); } case AutoOptimizationEvent_Tags.Failed: { const inner = value.inner; let size = ordinalConverter.allocationSize(5); size += FfiConverterString.allocationSize(inner.error); return size; } case AutoOptimizationEvent_Tags.Skipped: { return ordinalConverter.allocationSize(6); } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: BatchDestination export enum BatchDestination_Tags { SparkAddress = 'SparkAddress', SparkInvoice = 'SparkInvoice', } /** * Where a batch recipient is paid, once prepare has decoded its payment request. */ export const BatchDestination = (() => { type SparkAddress__interface = { tag: BatchDestination_Tags.SparkAddress; inner: Readonly<{ address: string }>; }; class SparkAddress_ extends UniffiEnum implements SparkAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'BatchDestination'; readonly tag = BatchDestination_Tags.SparkAddress; readonly inner: Readonly<{ address: string }>; constructor(inner: { address: string }) { super('BatchDestination', 'SparkAddress'); this.inner = Object.freeze(inner); } static new(inner: { address: string }): SparkAddress_ { return new SparkAddress_(inner); } static instanceOf(obj: any): obj is SparkAddress_ { return obj.tag === BatchDestination_Tags.SparkAddress; } } type SparkInvoice__interface = { tag: BatchDestination_Tags.SparkInvoice; inner: Readonly<{ invoiceDetails: SparkInvoiceDetails }>; }; class SparkInvoice_ extends UniffiEnum implements SparkInvoice__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'BatchDestination'; readonly tag = BatchDestination_Tags.SparkInvoice; readonly inner: Readonly<{ invoiceDetails: SparkInvoiceDetails }>; constructor(inner: { invoiceDetails: SparkInvoiceDetails }) { super('BatchDestination', 'SparkInvoice'); this.inner = Object.freeze(inner); } static new(inner: { invoiceDetails: SparkInvoiceDetails }): SparkInvoice_ { return new SparkInvoice_(inner); } static instanceOf(obj: any): obj is SparkInvoice_ { return obj.tag === BatchDestination_Tags.SparkInvoice; } } function instanceOf(obj: any): obj is BatchDestination { return obj[uniffiTypeNameSymbol] === 'BatchDestination'; } return Object.freeze({ instanceOf, SparkAddress: SparkAddress_, SparkInvoice: SparkInvoice_, }); })(); /** * Where a batch recipient is paid, once prepare has decoded its payment request. */ export type BatchDestination = InstanceType< (typeof BatchDestination)[keyof Omit] >; // FfiConverter for enum BatchDestination const FfiConverterTypeBatchDestination = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = BatchDestination; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new BatchDestination.SparkAddress({ address: FfiConverterString.read(from), }); case 2: return new BatchDestination.SparkInvoice({ invoiceDetails: FfiConverterTypeSparkInvoiceDetails.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case BatchDestination_Tags.SparkAddress: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.address, into); return; } case BatchDestination_Tags.SparkInvoice: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeSparkInvoiceDetails.write(inner.invoiceDetails, into); return; } default: // Throwing from here means that BatchDestination_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case BatchDestination_Tags.SparkAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.address); return size; } case BatchDestination_Tags.SparkInvoice: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeSparkInvoiceDetails.allocationSize( inner.invoiceDetails ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); export enum BitcoinNetwork { /** * Mainnet */ Bitcoin, Testnet3, Testnet4, Signet, Regtest, } const FfiConverterTypeBitcoinNetwork = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = BitcoinNetwork; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return BitcoinNetwork.Bitcoin; case 2: return BitcoinNetwork.Testnet3; case 3: return BitcoinNetwork.Testnet4; case 4: return BitcoinNetwork.Signet; case 5: return BitcoinNetwork.Regtest; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case BitcoinNetwork.Bitcoin: return ordinalConverter.write(1, into); case BitcoinNetwork.Testnet3: return ordinalConverter.write(2, into); case BitcoinNetwork.Testnet4: return ordinalConverter.write(3, into); case BitcoinNetwork.Signet: return ordinalConverter.write(4, into); case BitcoinNetwork.Regtest: return ordinalConverter.write(5, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: BuildTransferPackageOptions export enum BuildTransferPackageOptions_Tags { BitcoinAddress = 'BitcoinAddress', Bolt11Invoice = 'Bolt11Invoice', } export const BuildTransferPackageOptions = (() => { type BitcoinAddress__interface = { tag: BuildTransferPackageOptions_Tags.BitcoinAddress; inner: Readonly<{ confirmationSpeed: OnchainConfirmationSpeed }>; }; class BitcoinAddress_ extends UniffiEnum implements BitcoinAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'BuildTransferPackageOptions'; readonly tag = BuildTransferPackageOptions_Tags.BitcoinAddress; readonly inner: Readonly<{ confirmationSpeed: OnchainConfirmationSpeed }>; constructor(inner: { confirmationSpeed: OnchainConfirmationSpeed }) { super('BuildTransferPackageOptions', 'BitcoinAddress'); this.inner = Object.freeze(inner); } static new(inner: { confirmationSpeed: OnchainConfirmationSpeed; }): BitcoinAddress_ { return new BitcoinAddress_(inner); } static instanceOf(obj: any): obj is BitcoinAddress_ { return obj.tag === BuildTransferPackageOptions_Tags.BitcoinAddress; } } type Bolt11Invoice__interface = { tag: BuildTransferPackageOptions_Tags.Bolt11Invoice; inner: Readonly<{ preferSpark: boolean; completionTimeoutSecs: /*u32*/ number | undefined; }>; }; class Bolt11Invoice_ extends UniffiEnum implements Bolt11Invoice__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'BuildTransferPackageOptions'; readonly tag = BuildTransferPackageOptions_Tags.Bolt11Invoice; readonly inner: Readonly<{ preferSpark: boolean; completionTimeoutSecs: /*u32*/ number | undefined; }>; constructor(inner: { preferSpark: boolean; /** * If set, publishing the package waits up to this many seconds for the * payment to complete before returning it while still pending. If unset, * publishing returns immediately after initiating the payment. */ completionTimeoutSecs: /*u32*/ number | undefined; }) { super('BuildTransferPackageOptions', 'Bolt11Invoice'); this.inner = Object.freeze(inner); } static new(inner: { preferSpark: boolean; /** * If set, publishing the package waits up to this many seconds for the * payment to complete before returning it while still pending. If unset, * publishing returns immediately after initiating the payment. */ completionTimeoutSecs: /*u32*/ number | undefined; }): Bolt11Invoice_ { return new Bolt11Invoice_(inner); } static instanceOf(obj: any): obj is Bolt11Invoice_ { return obj.tag === BuildTransferPackageOptions_Tags.Bolt11Invoice; } } function instanceOf(obj: any): obj is BuildTransferPackageOptions { return obj[uniffiTypeNameSymbol] === 'BuildTransferPackageOptions'; } return Object.freeze({ instanceOf, BitcoinAddress: BitcoinAddress_, Bolt11Invoice: Bolt11Invoice_, }); })(); export type BuildTransferPackageOptions = InstanceType< (typeof BuildTransferPackageOptions)[keyof Omit< typeof BuildTransferPackageOptions, 'instanceOf' >] >; // FfiConverter for enum BuildTransferPackageOptions const FfiConverterTypeBuildTransferPackageOptions = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = BuildTransferPackageOptions; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new BuildTransferPackageOptions.BitcoinAddress({ confirmationSpeed: FfiConverterTypeOnchainConfirmationSpeed.read(from), }); case 2: return new BuildTransferPackageOptions.Bolt11Invoice({ preferSpark: FfiConverterBool.read(from), completionTimeoutSecs: FfiConverterOptionalUInt32.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case BuildTransferPackageOptions_Tags.BitcoinAddress: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeOnchainConfirmationSpeed.write( inner.confirmationSpeed, into ); return; } case BuildTransferPackageOptions_Tags.Bolt11Invoice: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterBool.write(inner.preferSpark, into); FfiConverterOptionalUInt32.write(inner.completionTimeoutSecs, into); return; } default: // Throwing from here means that BuildTransferPackageOptions_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case BuildTransferPackageOptions_Tags.BitcoinAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeOnchainConfirmationSpeed.allocationSize( inner.confirmationSpeed ); return size; } case BuildTransferPackageOptions_Tags.Bolt11Invoice: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterBool.allocationSize(inner.preferSpark); size += FfiConverterOptionalUInt32.allocationSize( inner.completionTimeoutSecs ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: BuyBitcoinRequest export enum BuyBitcoinRequest_Tags { Moonpay = 'Moonpay', CashApp = 'CashApp', } /** * The available providers for buying Bitcoin * Request to buy Bitcoin using an external provider. * * Each variant carries only the parameters relevant to that provider. */ export const BuyBitcoinRequest = (() => { type Moonpay__interface = { tag: BuyBitcoinRequest_Tags.Moonpay; inner: Readonly<{ lockedAmountSat: /*u64*/ bigint | undefined; redirectUrl: string | undefined; }>; }; /** * `MoonPay`: Fiat-to-Bitcoin via credit card, Apple Pay, etc. * Uses an on-chain deposit address. */ class Moonpay_ extends UniffiEnum implements Moonpay__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'BuyBitcoinRequest'; readonly tag = BuyBitcoinRequest_Tags.Moonpay; readonly inner: Readonly<{ lockedAmountSat: /*u64*/ bigint | undefined; redirectUrl: string | undefined; }>; constructor(inner: { /** * Lock the purchase to a specific amount in satoshis. */ lockedAmountSat: /*u64*/ bigint | undefined; /** * Custom redirect URL after purchase completion. */ redirectUrl: string | undefined; }) { super('BuyBitcoinRequest', 'Moonpay'); this.inner = Object.freeze(inner); } static new(inner: { /** * Lock the purchase to a specific amount in satoshis. */ lockedAmountSat: /*u64*/ bigint | undefined; /** * Custom redirect URL after purchase completion. */ redirectUrl: string | undefined; }): Moonpay_ { return new Moonpay_(inner); } static instanceOf(obj: any): obj is Moonpay_ { return obj.tag === BuyBitcoinRequest_Tags.Moonpay; } } type CashApp__interface = { tag: BuyBitcoinRequest_Tags.CashApp; inner: Readonly<{ amountSats: /*u64*/ bigint }>; }; /** * `CashApp`: Pay via the Lightning Network. * Generates a bolt11 invoice for the given amount and returns a * `cash.app` deep link. Only available on mainnet. * * The amount is required. With an amountless invoice, Cash App only * lets the payer fund from their existing Cash App BTC balance. With * a fixed-amount invoice, Cash App opens up funding via fiat balance * and debit card. */ class CashApp_ extends UniffiEnum implements CashApp__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'BuyBitcoinRequest'; readonly tag = BuyBitcoinRequest_Tags.CashApp; readonly inner: Readonly<{ amountSats: /*u64*/ bigint }>; constructor(inner: { /** * Amount in satoshis for the Lightning invoice. Must be non-zero. */ amountSats: /*u64*/ bigint; }) { super('BuyBitcoinRequest', 'CashApp'); this.inner = Object.freeze(inner); } static new(inner: { /** * Amount in satoshis for the Lightning invoice. Must be non-zero. */ amountSats: /*u64*/ bigint; }): CashApp_ { return new CashApp_(inner); } static instanceOf(obj: any): obj is CashApp_ { return obj.tag === BuyBitcoinRequest_Tags.CashApp; } } function instanceOf(obj: any): obj is BuyBitcoinRequest { return obj[uniffiTypeNameSymbol] === 'BuyBitcoinRequest'; } return Object.freeze({ instanceOf, Moonpay: Moonpay_, CashApp: CashApp_, }); })(); /** * The available providers for buying Bitcoin * Request to buy Bitcoin using an external provider. * * Each variant carries only the parameters relevant to that provider. */ export type BuyBitcoinRequest = InstanceType< (typeof BuyBitcoinRequest)[keyof Omit] >; // FfiConverter for enum BuyBitcoinRequest const FfiConverterTypeBuyBitcoinRequest = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = BuyBitcoinRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new BuyBitcoinRequest.Moonpay({ lockedAmountSat: FfiConverterOptionalUInt64.read(from), redirectUrl: FfiConverterOptionalString.read(from), }); case 2: return new BuyBitcoinRequest.CashApp({ amountSats: FfiConverterUInt64.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case BuyBitcoinRequest_Tags.Moonpay: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterOptionalUInt64.write(inner.lockedAmountSat, into); FfiConverterOptionalString.write(inner.redirectUrl, into); return; } case BuyBitcoinRequest_Tags.CashApp: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterUInt64.write(inner.amountSats, into); return; } default: // Throwing from here means that BuyBitcoinRequest_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case BuyBitcoinRequest_Tags.Moonpay: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterOptionalUInt64.allocationSize( inner.lockedAmountSat ); size += FfiConverterOptionalString.allocationSize(inner.redirectUrl); return size; } case BuyBitcoinRequest_Tags.CashApp: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterUInt64.allocationSize(inner.amountSats); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); export enum ChainApiType { Esplora, MempoolSpace, } const FfiConverterTypeChainApiType = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ChainApiType; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return ChainApiType.Esplora; case 2: return ChainApiType.MempoolSpace; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case ChainApiType.Esplora: return ordinalConverter.write(1, into); case ChainApiType.MempoolSpace: return ordinalConverter.write(2, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Error type: ChainServiceError // Enum: ChainServiceError export enum ChainServiceError_Tags { InvalidAddress = 'InvalidAddress', ServiceConnectivity = 'ServiceConnectivity', Generic = 'Generic', } export const ChainServiceError = (() => { type InvalidAddress__interface = { tag: ChainServiceError_Tags.InvalidAddress; inner: Readonly<[string]>; }; class InvalidAddress_ extends UniffiError implements InvalidAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ChainServiceError'; readonly tag = ChainServiceError_Tags.InvalidAddress; readonly inner: Readonly<[string]>; constructor(v0: string) { super('ChainServiceError', 'InvalidAddress'); this.inner = Object.freeze([v0]); } static new(v0: string): InvalidAddress_ { return new InvalidAddress_(v0); } static instanceOf(obj: any): obj is InvalidAddress_ { return obj.tag === ChainServiceError_Tags.InvalidAddress; } static hasInner(obj: any): obj is InvalidAddress_ { return InvalidAddress_.instanceOf(obj); } static getInner(obj: InvalidAddress_): Readonly<[string]> { return obj.inner; } } type ServiceConnectivity__interface = { tag: ChainServiceError_Tags.ServiceConnectivity; inner: Readonly<[string]>; }; class ServiceConnectivity_ extends UniffiError implements ServiceConnectivity__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ChainServiceError'; readonly tag = ChainServiceError_Tags.ServiceConnectivity; readonly inner: Readonly<[string]>; constructor(v0: string) { super('ChainServiceError', 'ServiceConnectivity'); this.inner = Object.freeze([v0]); } static new(v0: string): ServiceConnectivity_ { return new ServiceConnectivity_(v0); } static instanceOf(obj: any): obj is ServiceConnectivity_ { return obj.tag === ChainServiceError_Tags.ServiceConnectivity; } static hasInner(obj: any): obj is ServiceConnectivity_ { return ServiceConnectivity_.instanceOf(obj); } static getInner(obj: ServiceConnectivity_): Readonly<[string]> { return obj.inner; } } type Generic__interface = { tag: ChainServiceError_Tags.Generic; inner: Readonly<[string]>; }; class Generic_ extends UniffiError implements Generic__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ChainServiceError'; readonly tag = ChainServiceError_Tags.Generic; readonly inner: Readonly<[string]>; constructor(v0: string) { super('ChainServiceError', 'Generic'); this.inner = Object.freeze([v0]); } static new(v0: string): Generic_ { return new Generic_(v0); } static instanceOf(obj: any): obj is Generic_ { return obj.tag === ChainServiceError_Tags.Generic; } static hasInner(obj: any): obj is Generic_ { return Generic_.instanceOf(obj); } static getInner(obj: Generic_): Readonly<[string]> { return obj.inner; } } function instanceOf(obj: any): obj is ChainServiceError { return obj[uniffiTypeNameSymbol] === 'ChainServiceError'; } return Object.freeze({ instanceOf, InvalidAddress: InvalidAddress_, ServiceConnectivity: ServiceConnectivity_, Generic: Generic_, }); })(); export type ChainServiceError = InstanceType< (typeof ChainServiceError)[keyof Omit] >; // FfiConverter for enum ChainServiceError const FfiConverterTypeChainServiceError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ChainServiceError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ChainServiceError.InvalidAddress( FfiConverterString.read(from) ); case 2: return new ChainServiceError.ServiceConnectivity( FfiConverterString.read(from) ); case 3: return new ChainServiceError.Generic(FfiConverterString.read(from)); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ChainServiceError_Tags.InvalidAddress: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case ChainServiceError_Tags.ServiceConnectivity: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case ChainServiceError_Tags.Generic: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } default: // Throwing from here means that ChainServiceError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ChainServiceError_Tags.InvalidAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner[0]); return size; } case ChainServiceError_Tags.ServiceConnectivity: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner[0]); return size; } case ChainServiceError_Tags.Generic: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: ConversionChain export enum ConversionChain_Tags { Spark = 'Spark', Lightning = 'Lightning', External = 'External', } /** * The chain or network that a [`ConversionSide`] lives on. */ export const ConversionChain = (() => { type Spark__interface = { tag: ConversionChain_Tags.Spark; }; /** * Spark layer-2 network. */ class Spark_ extends UniffiEnum implements Spark__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ConversionChain'; readonly tag = ConversionChain_Tags.Spark; constructor() { super('ConversionChain', 'Spark'); } static new(): Spark_ { return new Spark_(); } static instanceOf(obj: any): obj is Spark_ { return obj.tag === ConversionChain_Tags.Spark; } } type Lightning__interface = { tag: ConversionChain_Tags.Lightning; }; /** * Bitcoin Lightning Network. */ class Lightning_ extends UniffiEnum implements Lightning__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ConversionChain'; readonly tag = ConversionChain_Tags.Lightning; constructor() { super('ConversionChain', 'Lightning'); } static new(): Lightning_ { return new Lightning_(); } static instanceOf(obj: any): obj is Lightning_ { return obj.tag === ConversionChain_Tags.Lightning; } } type External__interface = { tag: ConversionChain_Tags.External; inner: Readonly<{ name: string; chainId: string | undefined }>; }; /** * An external chain reached via a cross-chain provider. */ class External_ extends UniffiEnum implements External__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ConversionChain'; readonly tag = ConversionChain_Tags.External; readonly inner: Readonly<{ name: string; chainId: string | undefined }>; constructor(inner: { /** * Human-readable chain name (e.g. `"base"`, `"solana"`, `"arbitrum"`). */ name: string; /** * Stable chain identifier (e.g. EVM `chainId` as a decimal string, * or a chain-native identifier). `None` when the provider does not * expose one for this route. */ chainId: string | undefined; }) { super('ConversionChain', 'External'); this.inner = Object.freeze(inner); } static new(inner: { /** * Human-readable chain name (e.g. `"base"`, `"solana"`, `"arbitrum"`). */ name: string; /** * Stable chain identifier (e.g. EVM `chainId` as a decimal string, * or a chain-native identifier). `None` when the provider does not * expose one for this route. */ chainId: string | undefined; }): External_ { return new External_(inner); } static instanceOf(obj: any): obj is External_ { return obj.tag === ConversionChain_Tags.External; } } function instanceOf(obj: any): obj is ConversionChain { return obj[uniffiTypeNameSymbol] === 'ConversionChain'; } return Object.freeze({ instanceOf, Spark: Spark_, Lightning: Lightning_, External: External_, }); })(); /** * The chain or network that a [`ConversionSide`] lives on. */ export type ConversionChain = InstanceType< (typeof ConversionChain)[keyof Omit] >; // FfiConverter for enum ConversionChain const FfiConverterTypeConversionChain = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ConversionChain; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ConversionChain.Spark(); case 2: return new ConversionChain.Lightning(); case 3: return new ConversionChain.External({ name: FfiConverterString.read(from), chainId: FfiConverterOptionalString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ConversionChain_Tags.Spark: { ordinalConverter.write(1, into); return; } case ConversionChain_Tags.Lightning: { ordinalConverter.write(2, into); return; } case ConversionChain_Tags.External: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner.name, into); FfiConverterOptionalString.write(inner.chainId, into); return; } default: // Throwing from here means that ConversionChain_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ConversionChain_Tags.Spark: { return ordinalConverter.allocationSize(1); } case ConversionChain_Tags.Lightning: { return ordinalConverter.allocationSize(2); } case ConversionChain_Tags.External: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner.name); size += FfiConverterOptionalString.allocationSize(inner.chainId); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * Selects payments by conversion type + status for background tasks. */ export enum ConversionFilter { /** * AMM conversions that need a refund (clawback). */ AmmRefundNeeded, /** * Orchestra orders that have not yet reached a terminal state. */ OrchestraPending, /** * Boltz reverse swaps that have not yet reached a terminal state. Lives on * the Lightning leg (the hold-invoice pay), so it is selected via the * [`StoragePaymentDetailsFilter::Lightning`] filter. */ BoltzPending, } const FfiConverterTypeConversionFilter = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ConversionFilter; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return ConversionFilter.AmmRefundNeeded; case 2: return ConversionFilter.OrchestraPending; case 3: return ConversionFilter.BoltzPending; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case ConversionFilter.AmmRefundNeeded: return ordinalConverter.write(1, into); case ConversionFilter.OrchestraPending: return ordinalConverter.write(2, into); case ConversionFilter.BoltzPending: return ordinalConverter.write(3, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: ConversionInfo export enum ConversionInfo_Tags { Amm = 'Amm', Orchestra = 'Orchestra', Boltz = 'Boltz', } /** * Details of the asset conversion attached to a payment, when the payment * involves a swap or cross-chain bridge in addition to the on-Spark transfer. * * The variant identifies which provider handled the conversion: * - [`ConversionInfo::Amm`] for Spark token swaps via Flashnet AMM pools. * - [`ConversionInfo::Orchestra`] for cross-chain transfers via Flashnet * Orchestra, in either direction (Spark → external chain, or external * chain → Spark). * - [`ConversionInfo::Boltz`] for sats → stable-coin reverse swaps via Boltz. */ export const ConversionInfo = (() => { type Amm__interface = { tag: ConversionInfo_Tags.Amm; inner: Readonly<{ poolId: string; conversionId: string; status: ConversionStatus; fee: U128 | undefined; purpose: ConversionPurpose | undefined; amountAdjustment: AmountAdjustmentReason | undefined; degradation: SwapDegradation | undefined; }>; }; /** * AMM (Flashnet pool-based) conversion — Spark ↔ Spark token swaps. */ class Amm_ extends UniffiEnum implements Amm__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ConversionInfo'; readonly tag = ConversionInfo_Tags.Amm; readonly inner: Readonly<{ poolId: string; conversionId: string; status: ConversionStatus; fee: U128 | undefined; purpose: ConversionPurpose | undefined; amountAdjustment: AmountAdjustmentReason | undefined; degradation: SwapDegradation | undefined; }>; constructor(inner: { /** * The pool id associated with the conversion */ poolId: string; /** * The conversion id shared by both sides of the conversion */ conversionId: string; /** * The status of the conversion */ status: ConversionStatus; /** * The fee paid for the conversion. * Denominated in satoshis if converting from Bitcoin, otherwise in the token base units. */ fee: U128 | undefined; /** * The purpose of the conversion */ purpose: ConversionPurpose | undefined; /** * The reason the conversion amount was adjusted, if applicable. */ amountAdjustment: AmountAdjustmentReason | undefined; /** * How the swap departed from the signed terms, if it did. Set on a * conversion that completed without delivering what was signed for. */ degradation: SwapDegradation | undefined; }) { super('ConversionInfo', 'Amm'); this.inner = Object.freeze(inner); } static new(inner: { /** * The pool id associated with the conversion */ poolId: string; /** * The conversion id shared by both sides of the conversion */ conversionId: string; /** * The status of the conversion */ status: ConversionStatus; /** * The fee paid for the conversion. * Denominated in satoshis if converting from Bitcoin, otherwise in the token base units. */ fee: U128 | undefined; /** * The purpose of the conversion */ purpose: ConversionPurpose | undefined; /** * The reason the conversion amount was adjusted, if applicable. */ amountAdjustment: AmountAdjustmentReason | undefined; /** * How the swap departed from the signed terms, if it did. Set on a * conversion that completed without delivering what was signed for. */ degradation: SwapDegradation | undefined; }): Amm_ { return new Amm_(inner); } static instanceOf(obj: any): obj is Amm_ { return obj.tag === ConversionInfo_Tags.Amm; } } type Orchestra__interface = { tag: ConversionInfo_Tags.Orchestra; inner: Readonly<{ orderId: string; quoteId: string; readToken: string | undefined; chain: string; chainId: string | undefined; asset: string; recipientAddress: string; assetAmountIn: U128 | undefined; estimatedOut: U128; deliveredAmount: U128 | undefined; externalTxHash: string | undefined; status: ConversionStatus; feeAmount: U128 | undefined; serviceFeeAmount: U128 | undefined; serviceFeeAsset: string | undefined; assetDecimals: /*u32*/ number; assetContract: string | undefined; }>; }; /** * Orchestra cross-chain conversion via the Flashnet orchestration API, * in either direction. * * `chain`, `asset`, `asset_decimals` and `asset_contract` always describe * the external (non-Spark) side: the destination on a send, the source on * a receive. Amounts follow the direction of the transfer, so read each * amount field's own denomination. */ class Orchestra_ extends UniffiEnum implements Orchestra__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ConversionInfo'; readonly tag = ConversionInfo_Tags.Orchestra; readonly inner: Readonly<{ orderId: string; quoteId: string; readToken: string | undefined; chain: string; chainId: string | undefined; asset: string; recipientAddress: string; assetAmountIn: U128 | undefined; estimatedOut: U128; deliveredAmount: U128 | undefined; externalTxHash: string | undefined; status: ConversionStatus; feeAmount: U128 | undefined; serviceFeeAmount: U128 | undefined; serviceFeeAsset: string | undefined; assetDecimals: /*u32*/ number; assetContract: string | undefined; }>; constructor(inner: { /** * The Orchestra order id returned by `/v1/orchestration/submit`. */ orderId: string; /** * The Orchestra quote id used to create this order. */ quoteId: string; /** * Opaque token required for querying order status. */ readToken: string | undefined; /** * Chain name (e.g. `"base"`, `"solana"`, `"tron"`). */ chain: string; /** * Stable chain identifier (e.g. EVM `chainId` decimal string `"8453"` * for Base, SLIP-44 or similar for other chains). `None` if the * provider doesn't expose one for this route. */ chainId: string | undefined; /** * Asset ticker (e.g. `"USDC"`, `"USDT"`). */ asset: string; /** * The target-chain address on a send, the receiving Spark address * on a receive. */ recipientAddress: string; /** * Amount paid in, in `asset` base units. On a send it is the Spark * amount expressed in `asset` via the rate the SDK used at prepare * time. On a receive it is the deposit the sender made on `chain`. */ assetAmountIn: U128 | undefined; /** * Estimated amount delivered to the receiving end, frozen at prepare * time. In `asset` base units on a send, and in Spark-side units on * a receive (sats for Bitcoin, token base units for a token). */ estimatedOut: U128; /** * Actual delivered amount, in the same units as `estimated_out`. * Unset until the order reaches a terminal state. */ deliveredAmount: U128 | undefined; /** * Transaction on `chain`, the non-Spark side of the conversion: the * delivery on a send, the funding deposit on a receive. Format follows * the chain (e.g. `0x`-prefixed hex on EVM, a base58 signature on * Solana). Unset until that transaction exists, and on orders that * failed or were refunded. */ externalTxHash: string | undefined; status: ConversionStatus; /** * Best-available total fee, in `asset` base units. * Prepare-time estimate while pending, realized fee when Completed. */ feeAmount: U128 | undefined; /** * Orchestra service fee. */ serviceFeeAmount: U128 | undefined; /** * Asset the service fee is denominated in. Unset means BTC sats. */ serviceFeeAsset: string | undefined; /** * Asset decimals (e.g. 6 for USDC). */ assetDecimals: /*u32*/ number; /** * Token contract / mint address on `chain`. Unset when that side is * the chain's native asset. */ assetContract: string | undefined; }) { super('ConversionInfo', 'Orchestra'); this.inner = Object.freeze(inner); } static new(inner: { /** * The Orchestra order id returned by `/v1/orchestration/submit`. */ orderId: string; /** * The Orchestra quote id used to create this order. */ quoteId: string; /** * Opaque token required for querying order status. */ readToken: string | undefined; /** * Chain name (e.g. `"base"`, `"solana"`, `"tron"`). */ chain: string; /** * Stable chain identifier (e.g. EVM `chainId` decimal string `"8453"` * for Base, SLIP-44 or similar for other chains). `None` if the * provider doesn't expose one for this route. */ chainId: string | undefined; /** * Asset ticker (e.g. `"USDC"`, `"USDT"`). */ asset: string; /** * The target-chain address on a send, the receiving Spark address * on a receive. */ recipientAddress: string; /** * Amount paid in, in `asset` base units. On a send it is the Spark * amount expressed in `asset` via the rate the SDK used at prepare * time. On a receive it is the deposit the sender made on `chain`. */ assetAmountIn: U128 | undefined; /** * Estimated amount delivered to the receiving end, frozen at prepare * time. In `asset` base units on a send, and in Spark-side units on * a receive (sats for Bitcoin, token base units for a token). */ estimatedOut: U128; /** * Actual delivered amount, in the same units as `estimated_out`. * Unset until the order reaches a terminal state. */ deliveredAmount: U128 | undefined; /** * Transaction on `chain`, the non-Spark side of the conversion: the * delivery on a send, the funding deposit on a receive. Format follows * the chain (e.g. `0x`-prefixed hex on EVM, a base58 signature on * Solana). Unset until that transaction exists, and on orders that * failed or were refunded. */ externalTxHash: string | undefined; status: ConversionStatus; /** * Best-available total fee, in `asset` base units. * Prepare-time estimate while pending, realized fee when Completed. */ feeAmount: U128 | undefined; /** * Orchestra service fee. */ serviceFeeAmount: U128 | undefined; /** * Asset the service fee is denominated in. Unset means BTC sats. */ serviceFeeAsset: string | undefined; /** * Asset decimals (e.g. 6 for USDC). */ assetDecimals: /*u32*/ number; /** * Token contract / mint address on `chain`. Unset when that side is * the chain's native asset. */ assetContract: string | undefined; }): Orchestra_ { return new Orchestra_(inner); } static instanceOf(obj: any): obj is Orchestra_ { return obj.tag === ConversionInfo_Tags.Orchestra; } } type Boltz__interface = { tag: ConversionInfo_Tags.Boltz; inner: Readonly<{ swapId: string; invoice: string; invoiceAmountSats: /*u64*/ bigint; bridgeRef: string | undefined; maxSlippageBps: /*u32*/ number; quoteDegraded: boolean; chain: string; chainId: string | undefined; asset: string; recipientAddress: string; estimatedOut: U128; deliveredAmount: U128 | undefined; status: ConversionStatus; assetAmountIn: U128 | undefined; feeAmount: U128 | undefined; serviceFeeAmount: U128 | undefined; serviceFeeAsset: string | undefined; assetDecimals: /*u32*/ number; assetContract: string | undefined; }>; }; /** * Boltz reverse swap: cross-chain conversion via Lightning hold invoice. * * The swap's secrets and lifecycle state live on the synced Boltz swap row * keyed by `swap_id`, which also drives cross-instance recovery. */ class Boltz_ extends UniffiEnum implements Boltz__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ConversionInfo'; readonly tag = ConversionInfo_Tags.Boltz; readonly inner: Readonly<{ swapId: string; invoice: string; invoiceAmountSats: /*u64*/ bigint; bridgeRef: string | undefined; maxSlippageBps: /*u32*/ number; quoteDegraded: boolean; chain: string; chainId: string | undefined; asset: string; recipientAddress: string; estimatedOut: U128; deliveredAmount: U128 | undefined; status: ConversionStatus; assetAmountIn: U128 | undefined; feeAmount: U128 | undefined; serviceFeeAmount: U128 | undefined; serviceFeeAsset: string | undefined; assetDecimals: /*u32*/ number; assetContract: string | undefined; }>; constructor(inner: { /** * The Boltz swap id returned by `POST /swap/reverse`. */ swapId: string; /** * The BOLT11 hold invoice paid on the Spark/Lightning side. */ invoice: string; /** * Amount of the hold invoice in sats. */ invoiceAmountSats: /*u64*/ bigint; /** * Cross-chain bridge tracking handle for bridged swaps: a `LayerZero` * message GUID for OFT (USDT0) routes, or a CCTP reference for USDC * routes. `None` for same-chain (Arbitrum-direct) delivery. */ bridgeRef: string | undefined; /** * DEX slippage tolerance (basis points) committed at prepare time. */ maxSlippageBps: /*u32*/ number; /** * Whether the claim-time DEX quote drifted beyond `max_slippage_bps`. */ quoteDegraded: boolean; /** * Chain name (e.g. `"arbitrum"`, `"solana"`, `"tron"`). */ chain: string; /** * Stable chain identifier (e.g. EVM `chainId` decimal string `"42161"` * for Arbitrum). `None` if the provider doesn't expose one for this * route. */ chainId: string | undefined; /** * Asset ticker (e.g. `"USDT"`, `"USDT0"`). */ asset: string; /** * Recipient address on the target chain. */ recipientAddress: string; /** * Estimated amount in the asset's base units, frozen at prepare time. */ estimatedOut: U128; /** * Actual amount delivered. `None` until the claim receipt is processed. */ deliveredAmount: U128 | undefined; /** * Current status of the reverse swap. */ status: ConversionStatus; /** * Amount in expressed in the cross-chain asset's base units, via the * BTC/USD rate the SDK used at prepare time. */ assetAmountIn: U128 | undefined; /** * Best-available total fee in destination asset base units. * Prepare-time estimate while pending, realized fee on Completed. */ feeAmount: U128 | undefined; /** * Boltz spread in sats. */ serviceFeeAmount: U128 | undefined; /** * Asset service fee is denominated in. Unset means BTC sats. */ serviceFeeAsset: string | undefined; /** * Asset decimals (e.g. 6 for USDT). */ assetDecimals: /*u32*/ number; /** * Token contract / mint address on `chain`. Unset when that side is * the chain's native asset. */ assetContract: string | undefined; }) { super('ConversionInfo', 'Boltz'); this.inner = Object.freeze(inner); } static new(inner: { /** * The Boltz swap id returned by `POST /swap/reverse`. */ swapId: string; /** * The BOLT11 hold invoice paid on the Spark/Lightning side. */ invoice: string; /** * Amount of the hold invoice in sats. */ invoiceAmountSats: /*u64*/ bigint; /** * Cross-chain bridge tracking handle for bridged swaps: a `LayerZero` * message GUID for OFT (USDT0) routes, or a CCTP reference for USDC * routes. `None` for same-chain (Arbitrum-direct) delivery. */ bridgeRef: string | undefined; /** * DEX slippage tolerance (basis points) committed at prepare time. */ maxSlippageBps: /*u32*/ number; /** * Whether the claim-time DEX quote drifted beyond `max_slippage_bps`. */ quoteDegraded: boolean; /** * Chain name (e.g. `"arbitrum"`, `"solana"`, `"tron"`). */ chain: string; /** * Stable chain identifier (e.g. EVM `chainId` decimal string `"42161"` * for Arbitrum). `None` if the provider doesn't expose one for this * route. */ chainId: string | undefined; /** * Asset ticker (e.g. `"USDT"`, `"USDT0"`). */ asset: string; /** * Recipient address on the target chain. */ recipientAddress: string; /** * Estimated amount in the asset's base units, frozen at prepare time. */ estimatedOut: U128; /** * Actual amount delivered. `None` until the claim receipt is processed. */ deliveredAmount: U128 | undefined; /** * Current status of the reverse swap. */ status: ConversionStatus; /** * Amount in expressed in the cross-chain asset's base units, via the * BTC/USD rate the SDK used at prepare time. */ assetAmountIn: U128 | undefined; /** * Best-available total fee in destination asset base units. * Prepare-time estimate while pending, realized fee on Completed. */ feeAmount: U128 | undefined; /** * Boltz spread in sats. */ serviceFeeAmount: U128 | undefined; /** * Asset service fee is denominated in. Unset means BTC sats. */ serviceFeeAsset: string | undefined; /** * Asset decimals (e.g. 6 for USDT). */ assetDecimals: /*u32*/ number; /** * Token contract / mint address on `chain`. Unset when that side is * the chain's native asset. */ assetContract: string | undefined; }): Boltz_ { return new Boltz_(inner); } static instanceOf(obj: any): obj is Boltz_ { return obj.tag === ConversionInfo_Tags.Boltz; } } function instanceOf(obj: any): obj is ConversionInfo { return obj[uniffiTypeNameSymbol] === 'ConversionInfo'; } return Object.freeze({ instanceOf, Amm: Amm_, Orchestra: Orchestra_, Boltz: Boltz_, }); })(); /** * Details of the asset conversion attached to a payment, when the payment * involves a swap or cross-chain bridge in addition to the on-Spark transfer. * * The variant identifies which provider handled the conversion: * - [`ConversionInfo::Amm`] for Spark token swaps via Flashnet AMM pools. * - [`ConversionInfo::Orchestra`] for cross-chain transfers via Flashnet * Orchestra, in either direction (Spark → external chain, or external * chain → Spark). * - [`ConversionInfo::Boltz`] for sats → stable-coin reverse swaps via Boltz. */ export type ConversionInfo = InstanceType< (typeof ConversionInfo)[keyof Omit] >; // FfiConverter for enum ConversionInfo const FfiConverterTypeConversionInfo = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ConversionInfo; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ConversionInfo.Amm({ poolId: FfiConverterString.read(from), conversionId: FfiConverterString.read(from), status: FfiConverterTypeConversionStatus.read(from), fee: FfiConverterOptionalTypeu128.read(from), purpose: FfiConverterOptionalTypeConversionPurpose.read(from), amountAdjustment: FfiConverterOptionalTypeAmountAdjustmentReason.read(from), degradation: FfiConverterOptionalTypeSwapDegradation.read(from), }); case 2: return new ConversionInfo.Orchestra({ orderId: FfiConverterString.read(from), quoteId: FfiConverterString.read(from), readToken: FfiConverterOptionalString.read(from), chain: FfiConverterString.read(from), chainId: FfiConverterOptionalString.read(from), asset: FfiConverterString.read(from), recipientAddress: FfiConverterString.read(from), assetAmountIn: FfiConverterOptionalTypeu128.read(from), estimatedOut: FfiConverterTypeu128.read(from), deliveredAmount: FfiConverterOptionalTypeu128.read(from), externalTxHash: FfiConverterOptionalString.read(from), status: FfiConverterTypeConversionStatus.read(from), feeAmount: FfiConverterOptionalTypeu128.read(from), serviceFeeAmount: FfiConverterOptionalTypeu128.read(from), serviceFeeAsset: FfiConverterOptionalString.read(from), assetDecimals: FfiConverterUInt32.read(from), assetContract: FfiConverterOptionalString.read(from), }); case 3: return new ConversionInfo.Boltz({ swapId: FfiConverterString.read(from), invoice: FfiConverterString.read(from), invoiceAmountSats: FfiConverterUInt64.read(from), bridgeRef: FfiConverterOptionalString.read(from), maxSlippageBps: FfiConverterUInt32.read(from), quoteDegraded: FfiConverterBool.read(from), chain: FfiConverterString.read(from), chainId: FfiConverterOptionalString.read(from), asset: FfiConverterString.read(from), recipientAddress: FfiConverterString.read(from), estimatedOut: FfiConverterTypeu128.read(from), deliveredAmount: FfiConverterOptionalTypeu128.read(from), status: FfiConverterTypeConversionStatus.read(from), assetAmountIn: FfiConverterOptionalTypeu128.read(from), feeAmount: FfiConverterOptionalTypeu128.read(from), serviceFeeAmount: FfiConverterOptionalTypeu128.read(from), serviceFeeAsset: FfiConverterOptionalString.read(from), assetDecimals: FfiConverterUInt32.read(from), assetContract: FfiConverterOptionalString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ConversionInfo_Tags.Amm: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.poolId, into); FfiConverterString.write(inner.conversionId, into); FfiConverterTypeConversionStatus.write(inner.status, into); FfiConverterOptionalTypeu128.write(inner.fee, into); FfiConverterOptionalTypeConversionPurpose.write(inner.purpose, into); FfiConverterOptionalTypeAmountAdjustmentReason.write( inner.amountAdjustment, into ); FfiConverterOptionalTypeSwapDegradation.write( inner.degradation, into ); return; } case ConversionInfo_Tags.Orchestra: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.orderId, into); FfiConverterString.write(inner.quoteId, into); FfiConverterOptionalString.write(inner.readToken, into); FfiConverterString.write(inner.chain, into); FfiConverterOptionalString.write(inner.chainId, into); FfiConverterString.write(inner.asset, into); FfiConverterString.write(inner.recipientAddress, into); FfiConverterOptionalTypeu128.write(inner.assetAmountIn, into); FfiConverterTypeu128.write(inner.estimatedOut, into); FfiConverterOptionalTypeu128.write(inner.deliveredAmount, into); FfiConverterOptionalString.write(inner.externalTxHash, into); FfiConverterTypeConversionStatus.write(inner.status, into); FfiConverterOptionalTypeu128.write(inner.feeAmount, into); FfiConverterOptionalTypeu128.write(inner.serviceFeeAmount, into); FfiConverterOptionalString.write(inner.serviceFeeAsset, into); FfiConverterUInt32.write(inner.assetDecimals, into); FfiConverterOptionalString.write(inner.assetContract, into); return; } case ConversionInfo_Tags.Boltz: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner.swapId, into); FfiConverterString.write(inner.invoice, into); FfiConverterUInt64.write(inner.invoiceAmountSats, into); FfiConverterOptionalString.write(inner.bridgeRef, into); FfiConverterUInt32.write(inner.maxSlippageBps, into); FfiConverterBool.write(inner.quoteDegraded, into); FfiConverterString.write(inner.chain, into); FfiConverterOptionalString.write(inner.chainId, into); FfiConverterString.write(inner.asset, into); FfiConverterString.write(inner.recipientAddress, into); FfiConverterTypeu128.write(inner.estimatedOut, into); FfiConverterOptionalTypeu128.write(inner.deliveredAmount, into); FfiConverterTypeConversionStatus.write(inner.status, into); FfiConverterOptionalTypeu128.write(inner.assetAmountIn, into); FfiConverterOptionalTypeu128.write(inner.feeAmount, into); FfiConverterOptionalTypeu128.write(inner.serviceFeeAmount, into); FfiConverterOptionalString.write(inner.serviceFeeAsset, into); FfiConverterUInt32.write(inner.assetDecimals, into); FfiConverterOptionalString.write(inner.assetContract, into); return; } default: // Throwing from here means that ConversionInfo_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ConversionInfo_Tags.Amm: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.poolId); size += FfiConverterString.allocationSize(inner.conversionId); size += FfiConverterTypeConversionStatus.allocationSize(inner.status); size += FfiConverterOptionalTypeu128.allocationSize(inner.fee); size += FfiConverterOptionalTypeConversionPurpose.allocationSize( inner.purpose ); size += FfiConverterOptionalTypeAmountAdjustmentReason.allocationSize( inner.amountAdjustment ); size += FfiConverterOptionalTypeSwapDegradation.allocationSize( inner.degradation ); return size; } case ConversionInfo_Tags.Orchestra: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.orderId); size += FfiConverterString.allocationSize(inner.quoteId); size += FfiConverterOptionalString.allocationSize(inner.readToken); size += FfiConverterString.allocationSize(inner.chain); size += FfiConverterOptionalString.allocationSize(inner.chainId); size += FfiConverterString.allocationSize(inner.asset); size += FfiConverterString.allocationSize(inner.recipientAddress); size += FfiConverterOptionalTypeu128.allocationSize( inner.assetAmountIn ); size += FfiConverterTypeu128.allocationSize(inner.estimatedOut); size += FfiConverterOptionalTypeu128.allocationSize( inner.deliveredAmount ); size += FfiConverterOptionalString.allocationSize( inner.externalTxHash ); size += FfiConverterTypeConversionStatus.allocationSize(inner.status); size += FfiConverterOptionalTypeu128.allocationSize(inner.feeAmount); size += FfiConverterOptionalTypeu128.allocationSize( inner.serviceFeeAmount ); size += FfiConverterOptionalString.allocationSize( inner.serviceFeeAsset ); size += FfiConverterUInt32.allocationSize(inner.assetDecimals); size += FfiConverterOptionalString.allocationSize( inner.assetContract ); return size; } case ConversionInfo_Tags.Boltz: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner.swapId); size += FfiConverterString.allocationSize(inner.invoice); size += FfiConverterUInt64.allocationSize(inner.invoiceAmountSats); size += FfiConverterOptionalString.allocationSize(inner.bridgeRef); size += FfiConverterUInt32.allocationSize(inner.maxSlippageBps); size += FfiConverterBool.allocationSize(inner.quoteDegraded); size += FfiConverterString.allocationSize(inner.chain); size += FfiConverterOptionalString.allocationSize(inner.chainId); size += FfiConverterString.allocationSize(inner.asset); size += FfiConverterString.allocationSize(inner.recipientAddress); size += FfiConverterTypeu128.allocationSize(inner.estimatedOut); size += FfiConverterOptionalTypeu128.allocationSize( inner.deliveredAmount ); size += FfiConverterTypeConversionStatus.allocationSize(inner.status); size += FfiConverterOptionalTypeu128.allocationSize( inner.assetAmountIn ); size += FfiConverterOptionalTypeu128.allocationSize(inner.feeAmount); size += FfiConverterOptionalTypeu128.allocationSize( inner.serviceFeeAmount ); size += FfiConverterOptionalString.allocationSize( inner.serviceFeeAsset ); size += FfiConverterUInt32.allocationSize(inner.assetDecimals); size += FfiConverterOptionalString.allocationSize( inner.assetContract ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * The provider that performed a conversion. */ export enum ConversionProvider { /** * AMM (Flashnet pool) conversion between token and BTC on Spark */ Amm, /** * Orchestra cross-chain conversion */ Orchestra, /** * Boltz reverse-swap cross-chain conversion */ Boltz, } const FfiConverterTypeConversionProvider = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ConversionProvider; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return ConversionProvider.Amm; case 2: return ConversionProvider.Orchestra; case 3: return ConversionProvider.Boltz; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case ConversionProvider.Amm: return ordinalConverter.write(1, into); case ConversionProvider.Orchestra: return ordinalConverter.write(2, into); case ConversionProvider.Boltz: return ordinalConverter.write(3, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: ConversionPurpose export enum ConversionPurpose_Tags { OngoingPayment = 'OngoingPayment', SelfTransfer = 'SelfTransfer', AutoConversion = 'AutoConversion', } /** * The purpose of the conversion, which is used to provide context for the conversion * if its related to an ongoing payment or a self-transfer. */ export const ConversionPurpose = (() => { type OngoingPayment__interface = { tag: ConversionPurpose_Tags.OngoingPayment; inner: Readonly<{ paymentRequest: string }>; }; /** * Conversion is associated with an ongoing payment */ class OngoingPayment_ extends UniffiEnum implements OngoingPayment__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ConversionPurpose'; readonly tag = ConversionPurpose_Tags.OngoingPayment; readonly inner: Readonly<{ paymentRequest: string }>; constructor(inner: { /** * The payment request of the ongoing payment */ paymentRequest: string; }) { super('ConversionPurpose', 'OngoingPayment'); this.inner = Object.freeze(inner); } static new(inner: { /** * The payment request of the ongoing payment */ paymentRequest: string; }): OngoingPayment_ { return new OngoingPayment_(inner); } static instanceOf(obj: any): obj is OngoingPayment_ { return obj.tag === ConversionPurpose_Tags.OngoingPayment; } } type SelfTransfer__interface = { tag: ConversionPurpose_Tags.SelfTransfer; }; /** * Conversion is for self-transfer */ class SelfTransfer_ extends UniffiEnum implements SelfTransfer__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ConversionPurpose'; readonly tag = ConversionPurpose_Tags.SelfTransfer; constructor() { super('ConversionPurpose', 'SelfTransfer'); } static new(): SelfTransfer_ { return new SelfTransfer_(); } static instanceOf(obj: any): obj is SelfTransfer_ { return obj.tag === ConversionPurpose_Tags.SelfTransfer; } } type AutoConversion__interface = { tag: ConversionPurpose_Tags.AutoConversion; }; /** * Conversion triggered automatically */ class AutoConversion_ extends UniffiEnum implements AutoConversion__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ConversionPurpose'; readonly tag = ConversionPurpose_Tags.AutoConversion; constructor() { super('ConversionPurpose', 'AutoConversion'); } static new(): AutoConversion_ { return new AutoConversion_(); } static instanceOf(obj: any): obj is AutoConversion_ { return obj.tag === ConversionPurpose_Tags.AutoConversion; } } function instanceOf(obj: any): obj is ConversionPurpose { return obj[uniffiTypeNameSymbol] === 'ConversionPurpose'; } return Object.freeze({ instanceOf, OngoingPayment: OngoingPayment_, SelfTransfer: SelfTransfer_, AutoConversion: AutoConversion_, }); })(); /** * The purpose of the conversion, which is used to provide context for the conversion * if its related to an ongoing payment or a self-transfer. */ export type ConversionPurpose = InstanceType< (typeof ConversionPurpose)[keyof Omit] >; // FfiConverter for enum ConversionPurpose const FfiConverterTypeConversionPurpose = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ConversionPurpose; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ConversionPurpose.OngoingPayment({ paymentRequest: FfiConverterString.read(from), }); case 2: return new ConversionPurpose.SelfTransfer(); case 3: return new ConversionPurpose.AutoConversion(); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ConversionPurpose_Tags.OngoingPayment: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.paymentRequest, into); return; } case ConversionPurpose_Tags.SelfTransfer: { ordinalConverter.write(2, into); return; } case ConversionPurpose_Tags.AutoConversion: { ordinalConverter.write(3, into); return; } default: // Throwing from here means that ConversionPurpose_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ConversionPurpose_Tags.OngoingPayment: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.paymentRequest); return size; } case ConversionPurpose_Tags.SelfTransfer: { return ordinalConverter.allocationSize(2); } case ConversionPurpose_Tags.AutoConversion: { return ordinalConverter.allocationSize(3); } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * The status of the conversion */ export enum ConversionStatus { /** * Conversion is in-flight (queued or started, not yet completed) */ Pending, /** * The conversion was successful */ Completed, /** * The conversion failed (e.g., the initial send payment failed) */ Failed, /** * The conversion failed and no refund was made yet, which requires action by the SDK to * perform the refund. This can happen if there was a failure during the conversion process. */ RefundNeeded, /** * The conversion failed and a refund was made */ Refunded, } const FfiConverterTypeConversionStatus = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ConversionStatus; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return ConversionStatus.Pending; case 2: return ConversionStatus.Completed; case 3: return ConversionStatus.Failed; case 4: return ConversionStatus.RefundNeeded; case 5: return ConversionStatus.Refunded; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case ConversionStatus.Pending: return ordinalConverter.write(1, into); case ConversionStatus.Completed: return ordinalConverter.write(2, into); case ConversionStatus.Failed: return ordinalConverter.write(3, into); case ConversionStatus.RefundNeeded: return ordinalConverter.write(4, into); case ConversionStatus.Refunded: return ordinalConverter.write(5, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: ConversionType export enum ConversionType_Tags { FromBitcoin = 'FromBitcoin', ToBitcoin = 'ToBitcoin', } export const ConversionType = (() => { type FromBitcoin__interface = { tag: ConversionType_Tags.FromBitcoin; }; /** * Converting from Bitcoin to a token */ class FromBitcoin_ extends UniffiEnum implements FromBitcoin__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ConversionType'; readonly tag = ConversionType_Tags.FromBitcoin; constructor() { super('ConversionType', 'FromBitcoin'); } static new(): FromBitcoin_ { return new FromBitcoin_(); } static instanceOf(obj: any): obj is FromBitcoin_ { return obj.tag === ConversionType_Tags.FromBitcoin; } } type ToBitcoin__interface = { tag: ConversionType_Tags.ToBitcoin; inner: Readonly<{ fromTokenIdentifier: string }>; }; /** * Converting from a token to Bitcoin */ class ToBitcoin_ extends UniffiEnum implements ToBitcoin__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ConversionType'; readonly tag = ConversionType_Tags.ToBitcoin; readonly inner: Readonly<{ fromTokenIdentifier: string }>; constructor(inner: { fromTokenIdentifier: string }) { super('ConversionType', 'ToBitcoin'); this.inner = Object.freeze(inner); } static new(inner: { fromTokenIdentifier: string }): ToBitcoin_ { return new ToBitcoin_(inner); } static instanceOf(obj: any): obj is ToBitcoin_ { return obj.tag === ConversionType_Tags.ToBitcoin; } } function instanceOf(obj: any): obj is ConversionType { return obj[uniffiTypeNameSymbol] === 'ConversionType'; } return Object.freeze({ instanceOf, FromBitcoin: FromBitcoin_, ToBitcoin: ToBitcoin_, }); })(); export type ConversionType = InstanceType< (typeof ConversionType)[keyof Omit] >; // FfiConverter for enum ConversionType const FfiConverterTypeConversionType = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ConversionType; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ConversionType.FromBitcoin(); case 2: return new ConversionType.ToBitcoin({ fromTokenIdentifier: FfiConverterString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ConversionType_Tags.FromBitcoin: { ordinalConverter.write(1, into); return; } case ConversionType_Tags.ToBitcoin: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.fromTokenIdentifier, into); return; } default: // Throwing from here means that ConversionType_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ConversionType_Tags.FromBitcoin: { return ordinalConverter.allocationSize(1); } case ConversionType_Tags.ToBitcoin: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.fromTokenIdentifier); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: CpfpFundingKind export enum CpfpFundingKind_Tags { P2wpkh = 'P2wpkh', P2tr = 'P2tr', Custom = 'Custom', } /** * The kind of UTXO that will fund an exit's fees. */ export const CpfpFundingKind = (() => { type P2wpkh__interface = { tag: CpfpFundingKind_Tags.P2wpkh; }; /** * Fees paid from P2WPKH (native segwit v0) UTXOs. */ class P2wpkh_ extends UniffiEnum implements P2wpkh__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'CpfpFundingKind'; readonly tag = CpfpFundingKind_Tags.P2wpkh; constructor() { super('CpfpFundingKind', 'P2wpkh'); } static new(): P2wpkh_ { return new P2wpkh_(); } static instanceOf(obj: any): obj is P2wpkh_ { return obj.tag === CpfpFundingKind_Tags.P2wpkh; } } type P2tr__interface = { tag: CpfpFundingKind_Tags.P2tr; }; /** * Fees paid from P2TR (taproot, key-path) UTXOs. */ class P2tr_ extends UniffiEnum implements P2tr__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'CpfpFundingKind'; readonly tag = CpfpFundingKind_Tags.P2tr; constructor() { super('CpfpFundingKind', 'P2tr'); } static new(): P2tr_ { return new P2tr_(); } static instanceOf(obj: any): obj is P2tr_ { return obj.tag === CpfpFundingKind_Tags.P2tr; } } type Custom__interface = { tag: CpfpFundingKind_Tags.Custom; inner: Readonly<{ scriptPubkeyHex: string; signedInputWeight: /*u64*/ bigint; }>; }; /** * Fees paid from a custom witness-program script (legacy scripts are * rejected). `script_pubkey_hex` (the funding scriptPubKey) sizes the * fan-out output and dust; `signed_input_weight` (weight units) is an upper * bound on the input's signed weight, so the quote stays exact or slightly * conservative. */ class Custom_ extends UniffiEnum implements Custom__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'CpfpFundingKind'; readonly tag = CpfpFundingKind_Tags.Custom; readonly inner: Readonly<{ scriptPubkeyHex: string; signedInputWeight: /*u64*/ bigint; }>; constructor(inner: { scriptPubkeyHex: string; signedInputWeight: /*u64*/ bigint; }) { super('CpfpFundingKind', 'Custom'); this.inner = Object.freeze(inner); } static new(inner: { scriptPubkeyHex: string; signedInputWeight: /*u64*/ bigint; }): Custom_ { return new Custom_(inner); } static instanceOf(obj: any): obj is Custom_ { return obj.tag === CpfpFundingKind_Tags.Custom; } } function instanceOf(obj: any): obj is CpfpFundingKind { return obj[uniffiTypeNameSymbol] === 'CpfpFundingKind'; } return Object.freeze({ instanceOf, P2wpkh: P2wpkh_, P2tr: P2tr_, Custom: Custom_, }); })(); /** * The kind of UTXO that will fund an exit's fees. */ export type CpfpFundingKind = InstanceType< (typeof CpfpFundingKind)[keyof Omit] >; // FfiConverter for enum CpfpFundingKind const FfiConverterTypeCpfpFundingKind = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = CpfpFundingKind; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new CpfpFundingKind.P2wpkh(); case 2: return new CpfpFundingKind.P2tr(); case 3: return new CpfpFundingKind.Custom({ scriptPubkeyHex: FfiConverterString.read(from), signedInputWeight: FfiConverterUInt64.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case CpfpFundingKind_Tags.P2wpkh: { ordinalConverter.write(1, into); return; } case CpfpFundingKind_Tags.P2tr: { ordinalConverter.write(2, into); return; } case CpfpFundingKind_Tags.Custom: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner.scriptPubkeyHex, into); FfiConverterUInt64.write(inner.signedInputWeight, into); return; } default: // Throwing from here means that CpfpFundingKind_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case CpfpFundingKind_Tags.P2wpkh: { return ordinalConverter.allocationSize(1); } case CpfpFundingKind_Tags.P2tr: { return ordinalConverter.allocationSize(2); } case CpfpFundingKind_Tags.Custom: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner.scriptPubkeyHex); size += FfiConverterUInt64.allocationSize(inner.signedInputWeight); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: CpfpInput export enum CpfpInput_Tags { P2wpkh = 'P2wpkh', P2tr = 'P2tr', Custom = 'Custom', } /** * A funding UTXO that pays the on-chain fees of a unilateral exit. */ export const CpfpInput = (() => { type P2wpkh__interface = { tag: CpfpInput_Tags.P2wpkh; inner: Readonly<{ txid: string; vout: /*u32*/ number; value: /*u64*/ bigint; pubkey: string; }>; }; /** * A P2WPKH (native segwit v0) UTXO controlled by `pubkey` (33-byte * compressed, hex). */ class P2wpkh_ extends UniffiEnum implements P2wpkh__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'CpfpInput'; readonly tag = CpfpInput_Tags.P2wpkh; readonly inner: Readonly<{ txid: string; vout: /*u32*/ number; value: /*u64*/ bigint; pubkey: string; }>; constructor(inner: { txid: string; vout: /*u32*/ number; value: /*u64*/ bigint; pubkey: string; }) { super('CpfpInput', 'P2wpkh'); this.inner = Object.freeze(inner); } static new(inner: { txid: string; vout: /*u32*/ number; value: /*u64*/ bigint; pubkey: string; }): P2wpkh_ { return new P2wpkh_(inner); } static instanceOf(obj: any): obj is P2wpkh_ { return obj.tag === CpfpInput_Tags.P2wpkh; } } type P2tr__interface = { tag: CpfpInput_Tags.P2tr; inner: Readonly<{ txid: string; vout: /*u32*/ number; value: /*u64*/ bigint; pubkey: string; }>; }; /** * A P2TR (taproot, key-path) UTXO. `pubkey` (x-only or compressed, hex) is * the **internal** (untweaked, BIP86 key-path) public key whose secret signs * the input, not the tweaked on-chain output key. The SDK applies the BIP86 * taproot tweak itself to derive the funding scriptPubKey, so passing the * already-tweaked output key here produces a scriptPubKey that does not match * the UTXO and the built transaction is rejected at broadcast. */ class P2tr_ extends UniffiEnum implements P2tr__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'CpfpInput'; readonly tag = CpfpInput_Tags.P2tr; readonly inner: Readonly<{ txid: string; vout: /*u32*/ number; value: /*u64*/ bigint; pubkey: string; }>; constructor(inner: { txid: string; vout: /*u32*/ number; value: /*u64*/ bigint; pubkey: string; }) { super('CpfpInput', 'P2tr'); this.inner = Object.freeze(inner); } static new(inner: { txid: string; vout: /*u32*/ number; value: /*u64*/ bigint; pubkey: string; }): P2tr_ { return new P2tr_(inner); } static instanceOf(obj: any): obj is P2tr_ { return obj.tag === CpfpInput_Tags.P2tr; } } type Custom__interface = { tag: CpfpInput_Tags.Custom; inner: Readonly<{ txid: string; vout: /*u32*/ number; value: /*u64*/ bigint; scriptPubkeyHex: string; signedInputWeight: /*u64*/ bigint; }>; }; /** * Any witness-program script, signed via a custom `CpfpSigner`. Legacy * (non-SegWit) scripts are rejected. `signed_input_weight` (weight units) * is an upper bound on the input's signed weight, so the fee stays exact, * or slightly conservative if the real signature is shorter. */ class Custom_ extends UniffiEnum implements Custom__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'CpfpInput'; readonly tag = CpfpInput_Tags.Custom; readonly inner: Readonly<{ txid: string; vout: /*u32*/ number; value: /*u64*/ bigint; scriptPubkeyHex: string; signedInputWeight: /*u64*/ bigint; }>; constructor(inner: { txid: string; vout: /*u32*/ number; value: /*u64*/ bigint; scriptPubkeyHex: string; signedInputWeight: /*u64*/ bigint; }) { super('CpfpInput', 'Custom'); this.inner = Object.freeze(inner); } static new(inner: { txid: string; vout: /*u32*/ number; value: /*u64*/ bigint; scriptPubkeyHex: string; signedInputWeight: /*u64*/ bigint; }): Custom_ { return new Custom_(inner); } static instanceOf(obj: any): obj is Custom_ { return obj.tag === CpfpInput_Tags.Custom; } } function instanceOf(obj: any): obj is CpfpInput { return obj[uniffiTypeNameSymbol] === 'CpfpInput'; } return Object.freeze({ instanceOf, P2wpkh: P2wpkh_, P2tr: P2tr_, Custom: Custom_, }); })(); /** * A funding UTXO that pays the on-chain fees of a unilateral exit. */ export type CpfpInput = InstanceType< (typeof CpfpInput)[keyof Omit] >; // FfiConverter for enum CpfpInput const FfiConverterTypeCpfpInput = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = CpfpInput; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new CpfpInput.P2wpkh({ txid: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), value: FfiConverterUInt64.read(from), pubkey: FfiConverterString.read(from), }); case 2: return new CpfpInput.P2tr({ txid: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), value: FfiConverterUInt64.read(from), pubkey: FfiConverterString.read(from), }); case 3: return new CpfpInput.Custom({ txid: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), value: FfiConverterUInt64.read(from), scriptPubkeyHex: FfiConverterString.read(from), signedInputWeight: FfiConverterUInt64.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case CpfpInput_Tags.P2wpkh: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.txid, into); FfiConverterUInt32.write(inner.vout, into); FfiConverterUInt64.write(inner.value, into); FfiConverterString.write(inner.pubkey, into); return; } case CpfpInput_Tags.P2tr: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.txid, into); FfiConverterUInt32.write(inner.vout, into); FfiConverterUInt64.write(inner.value, into); FfiConverterString.write(inner.pubkey, into); return; } case CpfpInput_Tags.Custom: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner.txid, into); FfiConverterUInt32.write(inner.vout, into); FfiConverterUInt64.write(inner.value, into); FfiConverterString.write(inner.scriptPubkeyHex, into); FfiConverterUInt64.write(inner.signedInputWeight, into); return; } default: // Throwing from here means that CpfpInput_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case CpfpInput_Tags.P2wpkh: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.txid); size += FfiConverterUInt32.allocationSize(inner.vout); size += FfiConverterUInt64.allocationSize(inner.value); size += FfiConverterString.allocationSize(inner.pubkey); return size; } case CpfpInput_Tags.P2tr: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.txid); size += FfiConverterUInt32.allocationSize(inner.vout); size += FfiConverterUInt64.allocationSize(inner.value); size += FfiConverterString.allocationSize(inner.pubkey); return size; } case CpfpInput_Tags.Custom: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner.txid); size += FfiConverterUInt32.allocationSize(inner.vout); size += FfiConverterUInt64.allocationSize(inner.value); size += FfiConverterString.allocationSize(inner.scriptPubkeyHex); size += FfiConverterUInt64.allocationSize(inner.signedInputWeight); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); export enum CrossChainAddressFamily { Evm, Solana, Tron, } const FfiConverterTypeCrossChainAddressFamily = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = CrossChainAddressFamily; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return CrossChainAddressFamily.Evm; case 2: return CrossChainAddressFamily.Solana; case 3: return CrossChainAddressFamily.Tron; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case CrossChainAddressFamily.Evm: return ordinalConverter.write(1, into); case CrossChainAddressFamily.Solana: return ordinalConverter.write(2, into); case CrossChainAddressFamily.Tron: return ordinalConverter.write(3, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); /** * Which side of the transfer the request `amount` sizes: what leaves the * payer, or what reaches the receiver. */ export enum CrossChainFeeMode { /** * `amount` sizes the receiving end, and fees are paid on top. * * Sending: `amount` is the provider invoice/deposit target, and the * wallet pays `amount + source_transfer_fee_sats` in total. * Receiving: `amount` is what the wallet ends up with, and the deposit * the sender is asked for is sized above it to cover fees. */ FeesExcluded, /** * `amount` sizes the paying end, and fees come out of it. * * Sending: `amount` is the wallet's total sats budget, and the provider * leg is sized so `amount_in + source_transfer_fee_sats <= amount`. * Receiving: `amount` is the deposit the sender makes, and the wallet * ends up with that minus fees. */ FeesIncluded, } const FfiConverterTypeCrossChainFeeMode = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = CrossChainFeeMode; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return CrossChainFeeMode.FeesExcluded; case 2: return CrossChainFeeMode.FeesIncluded; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case CrossChainFeeMode.FeesExcluded: return ordinalConverter.write(1, into); case CrossChainFeeMode.FeesIncluded: return ordinalConverter.write(2, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); export enum CrossChainProvider { Orchestra, /** * Not operational: no routes are currently offered under this provider. */ Boltz, } const FfiConverterTypeCrossChainProvider = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = CrossChainProvider; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return CrossChainProvider.Orchestra; case 2: return CrossChainProvider.Boltz; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case CrossChainProvider.Orchestra: return ordinalConverter.write(1, into); case CrossChainProvider.Boltz: return ordinalConverter.write(2, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: CrossChainProviderContext export enum CrossChainProviderContext_Tags { Orchestra = 'Orchestra', Boltz = 'Boltz', } /** * Provider-internal state produced by `prepare` and consumed by `send`. * Typed per provider so the send stage can resume without re-quoting and * without a serde round-trip. Callers should round-trip this value as-is. */ export const CrossChainProviderContext = (() => { type Orchestra__interface = { tag: CrossChainProviderContext_Tags.Orchestra; inner: Readonly<{ quoteId: string; depositAddress: string; depositAmount: U128; }>; }; class Orchestra_ extends UniffiEnum implements Orchestra__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'CrossChainProviderContext'; readonly tag = CrossChainProviderContext_Tags.Orchestra; readonly inner: Readonly<{ quoteId: string; depositAddress: string; depositAmount: U128; }>; constructor(inner: { /** * Orchestra quote id, passed back on `/submit`. */ quoteId: string; /** * Spark address Orchestra expects the deposit transfer to land on. */ depositAddress: string; /** * Spark-side deposit amount in the route's source-asset base units. */ depositAmount: U128; }) { super('CrossChainProviderContext', 'Orchestra'); this.inner = Object.freeze(inner); } static new(inner: { /** * Orchestra quote id, passed back on `/submit`. */ quoteId: string; /** * Spark address Orchestra expects the deposit transfer to land on. */ depositAddress: string; /** * Spark-side deposit amount in the route's source-asset base units. */ depositAmount: U128; }): Orchestra_ { return new Orchestra_(inner); } static instanceOf(obj: any): obj is Orchestra_ { return obj.tag === CrossChainProviderContext_Tags.Orchestra; } } type Boltz__interface = { tag: CrossChainProviderContext_Tags.Boltz; inner: Readonly<{ swapId: string; invoice: string; invoiceAmountSats: /*u64*/ bigint; maxSlippageBps: /*u32*/ number; }>; }; class Boltz_ extends UniffiEnum implements Boltz__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'CrossChainProviderContext'; readonly tag = CrossChainProviderContext_Tags.Boltz; readonly inner: Readonly<{ swapId: string; invoice: string; invoiceAmountSats: /*u64*/ bigint; maxSlippageBps: /*u32*/ number; }>; constructor(inner: { /** * Boltz swap id. */ swapId: string; /** * Hold invoice to pay. */ invoice: string; /** * Hold invoice amount in sats. */ invoiceAmountSats: /*u64*/ bigint; /** * Slippage tolerance in basis points. */ maxSlippageBps: /*u32*/ number; }) { super('CrossChainProviderContext', 'Boltz'); this.inner = Object.freeze(inner); } static new(inner: { /** * Boltz swap id. */ swapId: string; /** * Hold invoice to pay. */ invoice: string; /** * Hold invoice amount in sats. */ invoiceAmountSats: /*u64*/ bigint; /** * Slippage tolerance in basis points. */ maxSlippageBps: /*u32*/ number; }): Boltz_ { return new Boltz_(inner); } static instanceOf(obj: any): obj is Boltz_ { return obj.tag === CrossChainProviderContext_Tags.Boltz; } } function instanceOf(obj: any): obj is CrossChainProviderContext { return obj[uniffiTypeNameSymbol] === 'CrossChainProviderContext'; } return Object.freeze({ instanceOf, Orchestra: Orchestra_, Boltz: Boltz_, }); })(); /** * Provider-internal state produced by `prepare` and consumed by `send`. * Typed per provider so the send stage can resume without re-quoting and * without a serde round-trip. Callers should round-trip this value as-is. */ export type CrossChainProviderContext = InstanceType< (typeof CrossChainProviderContext)[keyof Omit< typeof CrossChainProviderContext, 'instanceOf' >] >; // FfiConverter for enum CrossChainProviderContext const FfiConverterTypeCrossChainProviderContext = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = CrossChainProviderContext; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new CrossChainProviderContext.Orchestra({ quoteId: FfiConverterString.read(from), depositAddress: FfiConverterString.read(from), depositAmount: FfiConverterTypeu128.read(from), }); case 2: return new CrossChainProviderContext.Boltz({ swapId: FfiConverterString.read(from), invoice: FfiConverterString.read(from), invoiceAmountSats: FfiConverterUInt64.read(from), maxSlippageBps: FfiConverterUInt32.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case CrossChainProviderContext_Tags.Orchestra: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.quoteId, into); FfiConverterString.write(inner.depositAddress, into); FfiConverterTypeu128.write(inner.depositAmount, into); return; } case CrossChainProviderContext_Tags.Boltz: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.swapId, into); FfiConverterString.write(inner.invoice, into); FfiConverterUInt64.write(inner.invoiceAmountSats, into); FfiConverterUInt32.write(inner.maxSlippageBps, into); return; } default: // Throwing from here means that CrossChainProviderContext_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case CrossChainProviderContext_Tags.Orchestra: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.quoteId); size += FfiConverterString.allocationSize(inner.depositAddress); size += FfiConverterTypeu128.allocationSize(inner.depositAmount); return size; } case CrossChainProviderContext_Tags.Boltz: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.swapId); size += FfiConverterString.allocationSize(inner.invoice); size += FfiConverterUInt64.allocationSize(inner.invoiceAmountSats); size += FfiConverterUInt32.allocationSize(inner.maxSlippageBps); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: CrossChainRouteFilter export enum CrossChainRouteFilter_Tags { Send = 'Send', Receive = 'Receive', PaymentLink = 'PaymentLink', } /** * Filter for [`CrossChainService::get_routes`] and the public * `get_cross_chain_routes()` API. */ export const CrossChainRouteFilter = (() => { type Send__interface = { tag: CrossChainRouteFilter_Tags.Send; inner: Readonly<{ addressDetails: CrossChainAddressDetails }>; }; /** * Routes for sending from the Spark wallet to another chain. * Filtered by the parsed recipient address details. */ class Send_ extends UniffiEnum implements Send__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'CrossChainRouteFilter'; readonly tag = CrossChainRouteFilter_Tags.Send; readonly inner: Readonly<{ addressDetails: CrossChainAddressDetails }>; constructor(inner: { addressDetails: CrossChainAddressDetails }) { super('CrossChainRouteFilter', 'Send'); this.inner = Object.freeze(inner); } static new(inner: { addressDetails: CrossChainAddressDetails }): Send_ { return new Send_(inner); } static instanceOf(obj: any): obj is Send_ { return obj.tag === CrossChainRouteFilter_Tags.Send; } } type Receive__interface = { tag: CrossChainRouteFilter_Tags.Receive; inner: Readonly<{ contractAddress: string | undefined }>; }; /** * Routes for receiving to Spark from another chain. * Optionally filtered by the source token contract address. */ class Receive_ extends UniffiEnum implements Receive__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'CrossChainRouteFilter'; readonly tag = CrossChainRouteFilter_Tags.Receive; readonly inner: Readonly<{ contractAddress: string | undefined }>; constructor(inner: { contractAddress: string | undefined }) { super('CrossChainRouteFilter', 'Receive'); this.inner = Object.freeze(inner); } static new(inner: { contractAddress: string | undefined }): Receive_ { return new Receive_(inner); } static instanceOf(obj: any): obj is Receive_ { return obj.tag === CrossChainRouteFilter_Tags.Receive; } } type PaymentLink__interface = { tag: CrossChainRouteFilter_Tags.PaymentLink; inner: Readonly<{ addressDetails: CrossChainAddressDetails }>; }; /** * Routes for a payment link that sends a stablecoin funded by an external * rail (Cash App over Lightning) rather than the Spark wallet. * Filtered by the parsed recipient address details. */ class PaymentLink_ extends UniffiEnum implements PaymentLink__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'CrossChainRouteFilter'; readonly tag = CrossChainRouteFilter_Tags.PaymentLink; readonly inner: Readonly<{ addressDetails: CrossChainAddressDetails }>; constructor(inner: { addressDetails: CrossChainAddressDetails }) { super('CrossChainRouteFilter', 'PaymentLink'); this.inner = Object.freeze(inner); } static new(inner: { addressDetails: CrossChainAddressDetails; }): PaymentLink_ { return new PaymentLink_(inner); } static instanceOf(obj: any): obj is PaymentLink_ { return obj.tag === CrossChainRouteFilter_Tags.PaymentLink; } } function instanceOf(obj: any): obj is CrossChainRouteFilter { return obj[uniffiTypeNameSymbol] === 'CrossChainRouteFilter'; } return Object.freeze({ instanceOf, Send: Send_, Receive: Receive_, PaymentLink: PaymentLink_, }); })(); /** * Filter for [`CrossChainService::get_routes`] and the public * `get_cross_chain_routes()` API. */ export type CrossChainRouteFilter = InstanceType< (typeof CrossChainRouteFilter)[keyof Omit< typeof CrossChainRouteFilter, 'instanceOf' >] >; // FfiConverter for enum CrossChainRouteFilter const FfiConverterTypeCrossChainRouteFilter = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = CrossChainRouteFilter; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new CrossChainRouteFilter.Send({ addressDetails: FfiConverterTypeCrossChainAddressDetails.read(from), }); case 2: return new CrossChainRouteFilter.Receive({ contractAddress: FfiConverterOptionalString.read(from), }); case 3: return new CrossChainRouteFilter.PaymentLink({ addressDetails: FfiConverterTypeCrossChainAddressDetails.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case CrossChainRouteFilter_Tags.Send: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeCrossChainAddressDetails.write( inner.addressDetails, into ); return; } case CrossChainRouteFilter_Tags.Receive: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterOptionalString.write(inner.contractAddress, into); return; } case CrossChainRouteFilter_Tags.PaymentLink: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeCrossChainAddressDetails.write( inner.addressDetails, into ); return; } default: // Throwing from here means that CrossChainRouteFilter_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case CrossChainRouteFilter_Tags.Send: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeCrossChainAddressDetails.allocationSize( inner.addressDetails ); return size; } case CrossChainRouteFilter_Tags.Receive: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterOptionalString.allocationSize( inner.contractAddress ); return size; } case CrossChainRouteFilter_Tags.PaymentLink: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeCrossChainAddressDetails.allocationSize( inner.addressDetails ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * The rail a cross-chain payment is delivered over. */ export enum DeliveryMethod { /** * Delivered over the Spark network. */ Spark, /** * Delivered over Lightning. */ Lightning, /** * Delivered on-chain over Bitcoin. */ Bitcoin, } const FfiConverterTypeDeliveryMethod = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = DeliveryMethod; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return DeliveryMethod.Spark; case 2: return DeliveryMethod.Lightning; case 3: return DeliveryMethod.Bitcoin; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case DeliveryMethod.Spark: return ordinalConverter.write(1, into); case DeliveryMethod.Lightning: return ordinalConverter.write(2, into); case DeliveryMethod.Bitcoin: return ordinalConverter.write(3, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: DepositClaimError export enum DepositClaimError_Tags { MaxDepositClaimFeeExceeded = 'MaxDepositClaimFeeExceeded', MissingUtxo = 'MissingUtxo', Generic = 'Generic', } export const DepositClaimError = (() => { type MaxDepositClaimFeeExceeded__interface = { tag: DepositClaimError_Tags.MaxDepositClaimFeeExceeded; inner: Readonly<{ tx: string; vout: /*u32*/ number; maxFee: Fee | undefined; requiredFeeSats: /*u64*/ bigint; requiredFeeRateSatPerVbyte: /*u64*/ bigint; }>; }; class MaxDepositClaimFeeExceeded_ extends UniffiEnum implements MaxDepositClaimFeeExceeded__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'DepositClaimError'; readonly tag = DepositClaimError_Tags.MaxDepositClaimFeeExceeded; readonly inner: Readonly<{ tx: string; vout: /*u32*/ number; maxFee: Fee | undefined; requiredFeeSats: /*u64*/ bigint; requiredFeeRateSatPerVbyte: /*u64*/ bigint; }>; constructor(inner: { tx: string; vout: /*u32*/ number; maxFee: Fee | undefined; requiredFeeSats: /*u64*/ bigint; requiredFeeRateSatPerVbyte: /*u64*/ bigint; }) { super('DepositClaimError', 'MaxDepositClaimFeeExceeded'); this.inner = Object.freeze(inner); } static new(inner: { tx: string; vout: /*u32*/ number; maxFee: Fee | undefined; requiredFeeSats: /*u64*/ bigint; requiredFeeRateSatPerVbyte: /*u64*/ bigint; }): MaxDepositClaimFeeExceeded_ { return new MaxDepositClaimFeeExceeded_(inner); } static instanceOf(obj: any): obj is MaxDepositClaimFeeExceeded_ { return obj.tag === DepositClaimError_Tags.MaxDepositClaimFeeExceeded; } } type MissingUtxo__interface = { tag: DepositClaimError_Tags.MissingUtxo; inner: Readonly<{ tx: string; vout: /*u32*/ number }>; }; class MissingUtxo_ extends UniffiEnum implements MissingUtxo__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'DepositClaimError'; readonly tag = DepositClaimError_Tags.MissingUtxo; readonly inner: Readonly<{ tx: string; vout: /*u32*/ number }>; constructor(inner: { tx: string; vout: /*u32*/ number }) { super('DepositClaimError', 'MissingUtxo'); this.inner = Object.freeze(inner); } static new(inner: { tx: string; vout: /*u32*/ number }): MissingUtxo_ { return new MissingUtxo_(inner); } static instanceOf(obj: any): obj is MissingUtxo_ { return obj.tag === DepositClaimError_Tags.MissingUtxo; } } type Generic__interface = { tag: DepositClaimError_Tags.Generic; inner: Readonly<{ message: string }>; }; class Generic_ extends UniffiEnum implements Generic__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'DepositClaimError'; readonly tag = DepositClaimError_Tags.Generic; readonly inner: Readonly<{ message: string }>; constructor(inner: { message: string }) { super('DepositClaimError', 'Generic'); this.inner = Object.freeze(inner); } static new(inner: { message: string }): Generic_ { return new Generic_(inner); } static instanceOf(obj: any): obj is Generic_ { return obj.tag === DepositClaimError_Tags.Generic; } } function instanceOf(obj: any): obj is DepositClaimError { return obj[uniffiTypeNameSymbol] === 'DepositClaimError'; } return Object.freeze({ instanceOf, MaxDepositClaimFeeExceeded: MaxDepositClaimFeeExceeded_, MissingUtxo: MissingUtxo_, Generic: Generic_, }); })(); export type DepositClaimError = InstanceType< (typeof DepositClaimError)[keyof Omit] >; // FfiConverter for enum DepositClaimError const FfiConverterTypeDepositClaimError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = DepositClaimError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new DepositClaimError.MaxDepositClaimFeeExceeded({ tx: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), maxFee: FfiConverterOptionalTypeFee.read(from), requiredFeeSats: FfiConverterUInt64.read(from), requiredFeeRateSatPerVbyte: FfiConverterUInt64.read(from), }); case 2: return new DepositClaimError.MissingUtxo({ tx: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), }); case 3: return new DepositClaimError.Generic({ message: FfiConverterString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case DepositClaimError_Tags.MaxDepositClaimFeeExceeded: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.tx, into); FfiConverterUInt32.write(inner.vout, into); FfiConverterOptionalTypeFee.write(inner.maxFee, into); FfiConverterUInt64.write(inner.requiredFeeSats, into); FfiConverterUInt64.write(inner.requiredFeeRateSatPerVbyte, into); return; } case DepositClaimError_Tags.MissingUtxo: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.tx, into); FfiConverterUInt32.write(inner.vout, into); return; } case DepositClaimError_Tags.Generic: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner.message, into); return; } default: // Throwing from here means that DepositClaimError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case DepositClaimError_Tags.MaxDepositClaimFeeExceeded: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.tx); size += FfiConverterUInt32.allocationSize(inner.vout); size += FfiConverterOptionalTypeFee.allocationSize(inner.maxFee); size += FfiConverterUInt64.allocationSize(inner.requiredFeeSats); size += FfiConverterUInt64.allocationSize( inner.requiredFeeRateSatPerVbyte ); return size; } case DepositClaimError_Tags.MissingUtxo: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.tx); size += FfiConverterUInt32.allocationSize(inner.vout); return size; } case DepositClaimError_Tags.Generic: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner.message); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: DomainAssociation export enum DomainAssociation_Tags { Associated = 'Associated', NotAssociated = 'NotAssociated', Skipped = 'Skipped', } /** * Result of [`PrfProvider::check_domain_association`]. The platform's * out-of-band verification (AASA / assetlinks) gates passkey * ceremonies but its failures collapse into opaque platform errors; * this gives callers a definitive signal they can gate UX on. */ export const DomainAssociation = (() => { type Associated__interface = { tag: DomainAssociation_Tags.Associated; }; /** * Configuration verified; safe to proceed. */ class Associated_ extends UniffiEnum implements Associated__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'DomainAssociation'; readonly tag = DomainAssociation_Tags.Associated; constructor() { super('DomainAssociation', 'Associated'); } static new(): Associated_ { return new Associated_(); } static instanceOf(obj: any): obj is Associated_ { return obj.tag === DomainAssociation_Tags.Associated; } } type NotAssociated__interface = { tag: DomainAssociation_Tags.NotAssociated; inner: Readonly<{ source: string; reason: string }>; }; /** * Configuration is broken; subsequent ceremonies will fail. * `source` names the verification origin (e.g. `"Apple AASA CDN"`) * for diagnostic UIs; `reason` explains what was missing. */ class NotAssociated_ extends UniffiEnum implements NotAssociated__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'DomainAssociation'; readonly tag = DomainAssociation_Tags.NotAssociated; readonly inner: Readonly<{ source: string; reason: string }>; constructor(inner: { source: string; reason: string }) { super('DomainAssociation', 'NotAssociated'); this.inner = Object.freeze(inner); } static new(inner: { source: string; reason: string }): NotAssociated_ { return new NotAssociated_(inner); } static instanceOf(obj: any): obj is NotAssociated_ { return obj.tag === DomainAssociation_Tags.NotAssociated; } } type Skipped__interface = { tag: DomainAssociation_Tags.Skipped; inner: Readonly<{ reason: string }>; }; /** * Check was not performed (provider has no verification source, * or the check itself could not complete). Not a negative signal. */ class Skipped_ extends UniffiEnum implements Skipped__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'DomainAssociation'; readonly tag = DomainAssociation_Tags.Skipped; readonly inner: Readonly<{ reason: string }>; constructor(inner: { reason: string }) { super('DomainAssociation', 'Skipped'); this.inner = Object.freeze(inner); } static new(inner: { reason: string }): Skipped_ { return new Skipped_(inner); } static instanceOf(obj: any): obj is Skipped_ { return obj.tag === DomainAssociation_Tags.Skipped; } } function instanceOf(obj: any): obj is DomainAssociation { return obj[uniffiTypeNameSymbol] === 'DomainAssociation'; } return Object.freeze({ instanceOf, Associated: Associated_, NotAssociated: NotAssociated_, Skipped: Skipped_, }); })(); /** * Result of [`PrfProvider::check_domain_association`]. The platform's * out-of-band verification (AASA / assetlinks) gates passkey * ceremonies but its failures collapse into opaque platform errors; * this gives callers a definitive signal they can gate UX on. */ export type DomainAssociation = InstanceType< (typeof DomainAssociation)[keyof Omit] >; // FfiConverter for enum DomainAssociation const FfiConverterTypeDomainAssociation = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = DomainAssociation; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new DomainAssociation.Associated(); case 2: return new DomainAssociation.NotAssociated({ source: FfiConverterString.read(from), reason: FfiConverterString.read(from), }); case 3: return new DomainAssociation.Skipped({ reason: FfiConverterString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case DomainAssociation_Tags.Associated: { ordinalConverter.write(1, into); return; } case DomainAssociation_Tags.NotAssociated: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.source, into); FfiConverterString.write(inner.reason, into); return; } case DomainAssociation_Tags.Skipped: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner.reason, into); return; } default: // Throwing from here means that DomainAssociation_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case DomainAssociation_Tags.Associated: { return ordinalConverter.allocationSize(1); } case DomainAssociation_Tags.NotAssociated: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.source); size += FfiConverterString.allocationSize(inner.reason); return size; } case DomainAssociation_Tags.Skipped: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner.reason); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * Coarse classification of a passkey error by the UX reaction it * warrants. The variant names the action to take, not the cause. */ export enum ErrorKind { /** * User dismissed the prompt. Do not auto-retry. */ Cancel, /** * No matching credential on this device. Offer to register one. */ NoCredential, /** * Authenticator lacks the PRF extension. Fall back to a non-passkey * flow or guide the user to another credential provider. */ PrfUnsupported, /** * PRF is supported but evaluation failed. Often transient: retrying * the ceremony may succeed. */ PrfFailed, /** * Platform / app setup is wrong (entitlement, assetlinks, rpId * scope). Not retryable until the integrator fixes it. */ Configuration, /** * An existing credential matched. Route the user to sign-in. */ AlreadyExists, /** * The prompt closed on the platform inactivity timeout with no user * action. Unlike `Cancel`, safe to auto-retry or re-prompt. */ Timeout, /** * The ceremony failed for a security or state reason. Offer a retry; * if it persists, the credential or RP setup may be at fault. */ AuthFailure, /** * Failure the caller can't act on. Show a generic "try again". */ Internal, } const FfiConverterTypeErrorKind = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ErrorKind; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return ErrorKind.Cancel; case 2: return ErrorKind.NoCredential; case 3: return ErrorKind.PrfUnsupported; case 4: return ErrorKind.PrfFailed; case 5: return ErrorKind.Configuration; case 6: return ErrorKind.AlreadyExists; case 7: return ErrorKind.Timeout; case 8: return ErrorKind.AuthFailure; case 9: return ErrorKind.Internal; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case ErrorKind.Cancel: return ordinalConverter.write(1, into); case ErrorKind.NoCredential: return ordinalConverter.write(2, into); case ErrorKind.PrfUnsupported: return ordinalConverter.write(3, into); case ErrorKind.PrfFailed: return ordinalConverter.write(4, into); case ErrorKind.Configuration: return ordinalConverter.write(5, into); case ErrorKind.AlreadyExists: return ordinalConverter.write(6, into); case ErrorKind.Timeout: return ordinalConverter.write(7, into); case ErrorKind.AuthFailure: return ordinalConverter.write(8, into); case ErrorKind.Internal: return ordinalConverter.write(9, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: ExitLeafSelection export enum ExitLeafSelection_Tags { Auto = 'Auto', Specific = 'Specific', } /** * Which leaves to exit. */ export const ExitLeafSelection = (() => { type Auto__interface = { tag: ExitLeafSelection_Tags.Auto; }; /** * Exit every leaf whose value exceeds its own marginal exit cost (its tree * and refund CPFP fees plus its sweep input). This per-leaf test does not * include the shared fan-out fee, so funding many leaves from a single UTXO * adds `fanout_fee_sat` on top: compare `recoverable_value_sat` with * `total_fee_sat`, or fund one UTXO per branch to avoid the fan-out. Leaves * that fail the per-leaf test are skipped. */ class Auto_ extends UniffiEnum implements Auto__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ExitLeafSelection'; readonly tag = ExitLeafSelection_Tags.Auto; constructor() { super('ExitLeafSelection', 'Auto'); } static new(): Auto_ { return new Auto_(); } static instanceOf(obj: any): obj is Auto_ { return obj.tag === ExitLeafSelection_Tags.Auto; } } type Specific__interface = { tag: ExitLeafSelection_Tags.Specific; inner: Readonly<{ leafIds: Array }>; }; /** * Exit exactly these leaves, regardless of profitability. */ class Specific_ extends UniffiEnum implements Specific__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ExitLeafSelection'; readonly tag = ExitLeafSelection_Tags.Specific; readonly inner: Readonly<{ leafIds: Array }>; constructor(inner: { leafIds: Array }) { super('ExitLeafSelection', 'Specific'); this.inner = Object.freeze(inner); } static new(inner: { leafIds: Array }): Specific_ { return new Specific_(inner); } static instanceOf(obj: any): obj is Specific_ { return obj.tag === ExitLeafSelection_Tags.Specific; } } function instanceOf(obj: any): obj is ExitLeafSelection { return obj[uniffiTypeNameSymbol] === 'ExitLeafSelection'; } return Object.freeze({ instanceOf, Auto: Auto_, Specific: Specific_, }); })(); /** * Which leaves to exit. */ export type ExitLeafSelection = InstanceType< (typeof ExitLeafSelection)[keyof Omit] >; // FfiConverter for enum ExitLeafSelection const FfiConverterTypeExitLeafSelection = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ExitLeafSelection; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ExitLeafSelection.Auto(); case 2: return new ExitLeafSelection.Specific({ leafIds: FfiConverterArrayString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ExitLeafSelection_Tags.Auto: { ordinalConverter.write(1, into); return; } case ExitLeafSelection_Tags.Specific: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterArrayString.write(inner.leafIds, into); return; } default: // Throwing from here means that ExitLeafSelection_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ExitLeafSelection_Tags.Auto: { return ordinalConverter.allocationSize(1); } case ExitLeafSelection_Tags.Specific: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterArrayString.allocationSize(inner.leafIds); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * Which of a node's two pre-signed spends took it on-chain. */ export enum ExitNodeConfirmation { /** * The CPFP transaction, whose fee a child paid. */ Cpfp, /** * The direct transaction, which pays its own fee. A leaf that went out this * way is refunded by its direct refund transaction. */ Direct, } const FfiConverterTypeExitNodeConfirmation = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ExitNodeConfirmation; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return ExitNodeConfirmation.Cpfp; case 2: return ExitNodeConfirmation.Direct; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case ExitNodeConfirmation.Cpfp: return ordinalConverter.write(1, into); case ExitNodeConfirmation.Direct: return ordinalConverter.write(2, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: ExitRefundState export enum ExitRefundState_Tags { OnChain = 'OnChain', Swept = 'Swept', } export const ExitRefundState = (() => { type OnChain__interface = { tag: ExitRefundState_Tags.OnChain; inner: Readonly<{ txHex: string; vout: /*u32*/ number; valueSat: /*u64*/ bigint; blockHeight: /*u32*/ number | undefined; }>; }; /** * On-chain with its output still there, which is what the sweep pulls from. * A sweep sitting unconfirmed in the mempool leaves the refund here, so * that sweep is rebuilt rather than dropped. */ class OnChain_ extends UniffiEnum implements OnChain__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ExitRefundState'; readonly tag = ExitRefundState_Tags.OnChain; readonly inner: Readonly<{ txHex: string; vout: /*u32*/ number; valueSat: /*u64*/ bigint; blockHeight: /*u32*/ number | undefined; }>; constructor(inner: { txHex: string; vout: /*u32*/ number; valueSat: /*u64*/ bigint; blockHeight: /*u32*/ number | undefined; }) { super('ExitRefundState', 'OnChain'); this.inner = Object.freeze(inner); } static new(inner: { txHex: string; vout: /*u32*/ number; valueSat: /*u64*/ bigint; blockHeight: /*u32*/ number | undefined; }): OnChain_ { return new OnChain_(inner); } static instanceOf(obj: any): obj is OnChain_ { return obj.tag === ExitRefundState_Tags.OnChain; } } type Swept__interface = { tag: ExitRefundState_Tags.Swept; }; /** * Spent by a confirmed transaction: the sweep landed. */ class Swept_ extends UniffiEnum implements Swept__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ExitRefundState'; readonly tag = ExitRefundState_Tags.Swept; constructor() { super('ExitRefundState', 'Swept'); } static new(): Swept_ { return new Swept_(); } static instanceOf(obj: any): obj is Swept_ { return obj.tag === ExitRefundState_Tags.Swept; } } function instanceOf(obj: any): obj is ExitRefundState { return obj[uniffiTypeNameSymbol] === 'ExitRefundState'; } return Object.freeze({ instanceOf, OnChain: OnChain_, Swept: Swept_, }); })(); export type ExitRefundState = InstanceType< (typeof ExitRefundState)[keyof Omit] >; // FfiConverter for enum ExitRefundState const FfiConverterTypeExitRefundState = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ExitRefundState; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ExitRefundState.OnChain({ txHex: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), valueSat: FfiConverterUInt64.read(from), blockHeight: FfiConverterOptionalUInt32.read(from), }); case 2: return new ExitRefundState.Swept(); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ExitRefundState_Tags.OnChain: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.txHex, into); FfiConverterUInt32.write(inner.vout, into); FfiConverterUInt64.write(inner.valueSat, into); FfiConverterOptionalUInt32.write(inner.blockHeight, into); return; } case ExitRefundState_Tags.Swept: { ordinalConverter.write(2, into); return; } default: // Throwing from here means that ExitRefundState_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ExitRefundState_Tags.OnChain: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.txHex); size += FfiConverterUInt32.allocationSize(inner.vout); size += FfiConverterUInt64.allocationSize(inner.valueSat); size += FfiConverterOptionalUInt32.allocationSize(inner.blockHeight); return size; } case ExitRefundState_Tags.Swept: { return ordinalConverter.allocationSize(2); } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: ExitTransactionStatus export enum ExitTransactionStatus_Tags { Confirmed = 'Confirmed', Ready = 'Ready', WaitingForDependencies = 'WaitingForDependencies', WaitingForTimelock = 'WaitingForTimelock', Unverified = 'Unverified', } /** * Where a transaction in the exit path stands: on-chain, ready to send, or * waiting for something. */ export const ExitTransactionStatus = (() => { type Confirmed__interface = { tag: ExitTransactionStatus_Tags.Confirmed; inner: Readonly<{ blockHeight: /*u32*/ number | undefined }>; }; /** * Confirmed in a block, at `block_height` where the chain service reported * one. It needs no action. * * A relative `csv_timelock_blocks` counts from the height of the * transaction it spends, so this is what tells you when a child of this one * can go out, without fetching it again. */ class Confirmed_ extends UniffiEnum implements Confirmed__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ExitTransactionStatus'; readonly tag = ExitTransactionStatus_Tags.Confirmed; readonly inner: Readonly<{ blockHeight: /*u32*/ number | undefined }>; constructor(inner: { blockHeight: /*u32*/ number | undefined }) { super('ExitTransactionStatus', 'Confirmed'); this.inner = Object.freeze(inner); } static new(inner: { blockHeight: /*u32*/ number | undefined }): Confirmed_ { return new Confirmed_(inner); } static instanceOf(obj: any): obj is Confirmed_ { return obj.tag === ExitTransactionStatus_Tags.Confirmed; } } type Ready__interface = { tag: ExitTransactionStatus_Tags.Ready; }; /** * Not on-chain, and nothing is holding it back. Broadcast it, with its * `cpfp_tx_hex` where it has one. */ class Ready_ extends UniffiEnum implements Ready__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ExitTransactionStatus'; readonly tag = ExitTransactionStatus_Tags.Ready; constructor() { super('ExitTransactionStatus', 'Ready'); } static new(): Ready_ { return new Ready_(); } static instanceOf(obj: any): obj is Ready_ { return obj.tag === ExitTransactionStatus_Tags.Ready; } } type WaitingForDependencies__interface = { tag: ExitTransactionStatus_Tags.WaitingForDependencies; }; /** * A transaction in `depends_on` has yet to confirm. A relative timelock * only starts counting once it does. */ class WaitingForDependencies_ extends UniffiEnum implements WaitingForDependencies__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ExitTransactionStatus'; readonly tag = ExitTransactionStatus_Tags.WaitingForDependencies; constructor() { super('ExitTransactionStatus', 'WaitingForDependencies'); } static new(): WaitingForDependencies_ { return new WaitingForDependencies_(); } static instanceOf(obj: any): obj is WaitingForDependencies_ { return obj.tag === ExitTransactionStatus_Tags.WaitingForDependencies; } } type WaitingForTimelock__interface = { tag: ExitTransactionStatus_Tags.WaitingForTimelock; inner: Readonly<{ spendableAtHeight: /*u32*/ number | undefined }>; }; /** * Every input is confirmed, but a relative timelock has yet to mature. * `spendable_at_height` is the first block that can include this * transaction, and is unset when the height it counts from could not be * read from the chain. */ class WaitingForTimelock_ extends UniffiEnum implements WaitingForTimelock__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ExitTransactionStatus'; readonly tag = ExitTransactionStatus_Tags.WaitingForTimelock; readonly inner: Readonly<{ spendableAtHeight: /*u32*/ number | undefined }>; constructor(inner: { spendableAtHeight: /*u32*/ number | undefined }) { super('ExitTransactionStatus', 'WaitingForTimelock'); this.inner = Object.freeze(inner); } static new(inner: { spendableAtHeight: /*u32*/ number | undefined; }): WaitingForTimelock_ { return new WaitingForTimelock_(inner); } static instanceOf(obj: any): obj is WaitingForTimelock_ { return obj.tag === ExitTransactionStatus_Tags.WaitingForTimelock; } } type Unverified__interface = { tag: ExitTransactionStatus_Tags.Unverified; }; /** * The on-chain status could not be determined (the chain service errored), * which also leaves what it is waiting for unknown. Broadcasting may fail * if a conflicting transaction already landed. */ class Unverified_ extends UniffiEnum implements Unverified__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ExitTransactionStatus'; readonly tag = ExitTransactionStatus_Tags.Unverified; constructor() { super('ExitTransactionStatus', 'Unverified'); } static new(): Unverified_ { return new Unverified_(); } static instanceOf(obj: any): obj is Unverified_ { return obj.tag === ExitTransactionStatus_Tags.Unverified; } } function instanceOf(obj: any): obj is ExitTransactionStatus { return obj[uniffiTypeNameSymbol] === 'ExitTransactionStatus'; } return Object.freeze({ instanceOf, Confirmed: Confirmed_, Ready: Ready_, WaitingForDependencies: WaitingForDependencies_, WaitingForTimelock: WaitingForTimelock_, Unverified: Unverified_, }); })(); /** * Where a transaction in the exit path stands: on-chain, ready to send, or * waiting for something. */ export type ExitTransactionStatus = InstanceType< (typeof ExitTransactionStatus)[keyof Omit< typeof ExitTransactionStatus, 'instanceOf' >] >; // FfiConverter for enum ExitTransactionStatus const FfiConverterTypeExitTransactionStatus = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ExitTransactionStatus; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ExitTransactionStatus.Confirmed({ blockHeight: FfiConverterOptionalUInt32.read(from), }); case 2: return new ExitTransactionStatus.Ready(); case 3: return new ExitTransactionStatus.WaitingForDependencies(); case 4: return new ExitTransactionStatus.WaitingForTimelock({ spendableAtHeight: FfiConverterOptionalUInt32.read(from), }); case 5: return new ExitTransactionStatus.Unverified(); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ExitTransactionStatus_Tags.Confirmed: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterOptionalUInt32.write(inner.blockHeight, into); return; } case ExitTransactionStatus_Tags.Ready: { ordinalConverter.write(2, into); return; } case ExitTransactionStatus_Tags.WaitingForDependencies: { ordinalConverter.write(3, into); return; } case ExitTransactionStatus_Tags.WaitingForTimelock: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterOptionalUInt32.write(inner.spendableAtHeight, into); return; } case ExitTransactionStatus_Tags.Unverified: { ordinalConverter.write(5, into); return; } default: // Throwing from here means that ExitTransactionStatus_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ExitTransactionStatus_Tags.Confirmed: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterOptionalUInt32.allocationSize(inner.blockHeight); return size; } case ExitTransactionStatus_Tags.Ready: { return ordinalConverter.allocationSize(2); } case ExitTransactionStatus_Tags.WaitingForDependencies: { return ordinalConverter.allocationSize(3); } case ExitTransactionStatus_Tags.WaitingForTimelock: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterOptionalUInt32.allocationSize( inner.spendableAtHeight ); return size; } case ExitTransactionStatus_Tags.Unverified: { return ordinalConverter.allocationSize(5); } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: ExternalFrostDerivation export enum ExternalFrostDerivation_Tags { SigningLeaf = 'SigningLeaf', StaticDeposit = 'StaticDeposit', HtlcPreimage = 'HtlcPreimage', Identity = 'Identity', } /** * FFI-safe representation of `spark_wallet::FrostDerivation`. */ export const ExternalFrostDerivation = (() => { type SigningLeaf__interface = { tag: ExternalFrostDerivation_Tags.SigningLeaf; inner: Readonly<{ leafId: ExternalTreeNodeId }>; }; /** * The signing key for a tree leaf. */ class SigningLeaf_ extends UniffiEnum implements SigningLeaf__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ExternalFrostDerivation'; readonly tag = ExternalFrostDerivation_Tags.SigningLeaf; readonly inner: Readonly<{ leafId: ExternalTreeNodeId }>; constructor(inner: { leafId: ExternalTreeNodeId }) { super('ExternalFrostDerivation', 'SigningLeaf'); this.inner = Object.freeze(inner); } static new(inner: { leafId: ExternalTreeNodeId }): SigningLeaf_ { return new SigningLeaf_(inner); } static instanceOf(obj: any): obj is SigningLeaf_ { return obj.tag === ExternalFrostDerivation_Tags.SigningLeaf; } } type StaticDeposit__interface = { tag: ExternalFrostDerivation_Tags.StaticDeposit; inner: Readonly<{ index: /*u32*/ number }>; }; /** * The static-deposit key at `index`. */ class StaticDeposit_ extends UniffiEnum implements StaticDeposit__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ExternalFrostDerivation'; readonly tag = ExternalFrostDerivation_Tags.StaticDeposit; readonly inner: Readonly<{ index: /*u32*/ number }>; constructor(inner: { index: /*u32*/ number }) { super('ExternalFrostDerivation', 'StaticDeposit'); this.inner = Object.freeze(inner); } static new(inner: { index: /*u32*/ number }): StaticDeposit_ { return new StaticDeposit_(inner); } static instanceOf(obj: any): obj is StaticDeposit_ { return obj.tag === ExternalFrostDerivation_Tags.StaticDeposit; } } type HtlcPreimage__interface = { tag: ExternalFrostDerivation_Tags.HtlcPreimage; }; /** * The HTLC-preimage key. */ class HtlcPreimage_ extends UniffiEnum implements HtlcPreimage__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ExternalFrostDerivation'; readonly tag = ExternalFrostDerivation_Tags.HtlcPreimage; constructor() { super('ExternalFrostDerivation', 'HtlcPreimage'); } static new(): HtlcPreimage_ { return new HtlcPreimage_(); } static instanceOf(obj: any): obj is HtlcPreimage_ { return obj.tag === ExternalFrostDerivation_Tags.HtlcPreimage; } } type Identity__interface = { tag: ExternalFrostDerivation_Tags.Identity; }; /** * The wallet identity key. */ class Identity_ extends UniffiEnum implements Identity__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ExternalFrostDerivation'; readonly tag = ExternalFrostDerivation_Tags.Identity; constructor() { super('ExternalFrostDerivation', 'Identity'); } static new(): Identity_ { return new Identity_(); } static instanceOf(obj: any): obj is Identity_ { return obj.tag === ExternalFrostDerivation_Tags.Identity; } } function instanceOf(obj: any): obj is ExternalFrostDerivation { return obj[uniffiTypeNameSymbol] === 'ExternalFrostDerivation'; } return Object.freeze({ instanceOf, SigningLeaf: SigningLeaf_, StaticDeposit: StaticDeposit_, HtlcPreimage: HtlcPreimage_, Identity: Identity_, }); })(); /** * FFI-safe representation of `spark_wallet::FrostDerivation`. */ export type ExternalFrostDerivation = InstanceType< (typeof ExternalFrostDerivation)[keyof Omit< typeof ExternalFrostDerivation, 'instanceOf' >] >; // FfiConverter for enum ExternalFrostDerivation const FfiConverterTypeExternalFrostDerivation = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ExternalFrostDerivation; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ExternalFrostDerivation.SigningLeaf({ leafId: FfiConverterTypeExternalTreeNodeId.read(from), }); case 2: return new ExternalFrostDerivation.StaticDeposit({ index: FfiConverterUInt32.read(from), }); case 3: return new ExternalFrostDerivation.HtlcPreimage(); case 4: return new ExternalFrostDerivation.Identity(); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ExternalFrostDerivation_Tags.SigningLeaf: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeExternalTreeNodeId.write(inner.leafId, into); return; } case ExternalFrostDerivation_Tags.StaticDeposit: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterUInt32.write(inner.index, into); return; } case ExternalFrostDerivation_Tags.HtlcPreimage: { ordinalConverter.write(3, into); return; } case ExternalFrostDerivation_Tags.Identity: { ordinalConverter.write(4, into); return; } default: // Throwing from here means that ExternalFrostDerivation_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ExternalFrostDerivation_Tags.SigningLeaf: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeExternalTreeNodeId.allocationSize( inner.leafId ); return size; } case ExternalFrostDerivation_Tags.StaticDeposit: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterUInt32.allocationSize(inner.index); return size; } case ExternalFrostDerivation_Tags.HtlcPreimage: { return ordinalConverter.allocationSize(3); } case ExternalFrostDerivation_Tags.Identity: { return ordinalConverter.allocationSize(4); } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::SparkInvoiceKind`. */ export enum ExternalSparkInvoiceKind { Sats, Tokens, } const FfiConverterTypeExternalSparkInvoiceKind = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ExternalSparkInvoiceKind; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return ExternalSparkInvoiceKind.Sats; case 2: return ExternalSparkInvoiceKind.Tokens; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case ExternalSparkInvoiceKind.Sats: return ordinalConverter.write(1, into); case ExternalSparkInvoiceKind.Tokens: return ordinalConverter.write(2, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); /** * FFI-safe representation of `spark_wallet::TokenTransactionKind`. */ export enum ExternalTokenTransactionKind { Freeze, Partial, Final, } const FfiConverterTypeExternalTokenTransactionKind = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ExternalTokenTransactionKind; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return ExternalTokenTransactionKind.Freeze; case 2: return ExternalTokenTransactionKind.Partial; case 3: return ExternalTokenTransactionKind.Final; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case ExternalTokenTransactionKind.Freeze: return ordinalConverter.write(1, into); case ExternalTokenTransactionKind.Partial: return ordinalConverter.write(2, into); case ExternalTokenTransactionKind.Final: return ordinalConverter.write(3, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: Fee export enum Fee_Tags { Fixed = 'Fixed', Rate = 'Rate', } export const Fee = (() => { type Fixed__interface = { tag: Fee_Tags.Fixed; inner: Readonly<{ amount: /*u64*/ bigint }>; }; class Fixed_ extends UniffiEnum implements Fixed__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'Fee'; readonly tag = Fee_Tags.Fixed; readonly inner: Readonly<{ amount: /*u64*/ bigint }>; constructor(inner: { amount: /*u64*/ bigint }) { super('Fee', 'Fixed'); this.inner = Object.freeze(inner); } static new(inner: { amount: /*u64*/ bigint }): Fixed_ { return new Fixed_(inner); } static instanceOf(obj: any): obj is Fixed_ { return obj.tag === Fee_Tags.Fixed; } } type Rate__interface = { tag: Fee_Tags.Rate; inner: Readonly<{ satPerVbyte: /*u64*/ bigint }>; }; class Rate_ extends UniffiEnum implements Rate__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'Fee'; readonly tag = Fee_Tags.Rate; readonly inner: Readonly<{ satPerVbyte: /*u64*/ bigint }>; constructor(inner: { satPerVbyte: /*u64*/ bigint }) { super('Fee', 'Rate'); this.inner = Object.freeze(inner); } static new(inner: { satPerVbyte: /*u64*/ bigint }): Rate_ { return new Rate_(inner); } static instanceOf(obj: any): obj is Rate_ { return obj.tag === Fee_Tags.Rate; } } function instanceOf(obj: any): obj is Fee { return obj[uniffiTypeNameSymbol] === 'Fee'; } return Object.freeze({ instanceOf, Fixed: Fixed_, Rate: Rate_, }); })(); export type Fee = InstanceType< (typeof Fee)[keyof Omit] >; // FfiConverter for enum Fee const FfiConverterTypeFee = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = Fee; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new Fee.Fixed({ amount: FfiConverterUInt64.read(from) }); case 2: return new Fee.Rate({ satPerVbyte: FfiConverterUInt64.read(from) }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case Fee_Tags.Fixed: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterUInt64.write(inner.amount, into); return; } case Fee_Tags.Rate: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterUInt64.write(inner.satPerVbyte, into); return; } default: // Throwing from here means that Fee_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case Fee_Tags.Fixed: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterUInt64.allocationSize(inner.amount); return size; } case Fee_Tags.Rate: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterUInt64.allocationSize(inner.satPerVbyte); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * Specifies how fees are handled in a payment. * * "Fees" are the wallet's sender-paid fees (Lightning routing, on-chain, * Spark transfer). They do not include provider spreads or destination-chain * costs on cross-chain routes; those are reported separately via * `estimated_out` on the prepare response and are not deterministic. * `FeePolicy` only controls the wallet's spend accounting. */ export enum FeePolicy { /** * Fees are added on top of `amount`. Wallet's total spend is * `amount + fees`. For direct sat sends, the recipient receives exactly * `amount`. Default. */ FeesExcluded, /** * Fees are deducted from `amount`. Wallet's total spend is `amount`. * Use this to drain a balance — pass `amount = balance` and the wallet * spends exactly that. */ FeesIncluded, } const FfiConverterTypeFeePolicy = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = FeePolicy; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return FeePolicy.FeesExcluded; case 2: return FeePolicy.FeesIncluded; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case FeePolicy.FeesExcluded: return ordinalConverter.write(1, into); case FeePolicy.FeesIncluded: return ordinalConverter.write(2, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: InputType export enum InputType_Tags { BitcoinAddress = 'BitcoinAddress', Bolt11Invoice = 'Bolt11Invoice', Bolt12Invoice = 'Bolt12Invoice', Bolt12Offer = 'Bolt12Offer', LightningAddress = 'LightningAddress', LnurlPay = 'LnurlPay', SilentPaymentAddress = 'SilentPaymentAddress', LnurlAuth = 'LnurlAuth', Url = 'Url', Bip21 = 'Bip21', Bolt12InvoiceRequest = 'Bolt12InvoiceRequest', LnurlWithdraw = 'LnurlWithdraw', SparkAddress = 'SparkAddress', SparkInvoice = 'SparkInvoice', CrossChainAddress = 'CrossChainAddress', } export const InputType = (() => { type BitcoinAddress__interface = { tag: InputType_Tags.BitcoinAddress; inner: Readonly<[BitcoinAddressDetails]>; }; class BitcoinAddress_ extends UniffiEnum implements BitcoinAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.BitcoinAddress; readonly inner: Readonly<[BitcoinAddressDetails]>; constructor(v0: BitcoinAddressDetails) { super('InputType', 'BitcoinAddress'); this.inner = Object.freeze([v0]); } static new(v0: BitcoinAddressDetails): BitcoinAddress_ { return new BitcoinAddress_(v0); } static instanceOf(obj: any): obj is BitcoinAddress_ { return obj.tag === InputType_Tags.BitcoinAddress; } } type Bolt11Invoice__interface = { tag: InputType_Tags.Bolt11Invoice; inner: Readonly<[Bolt11InvoiceDetails]>; }; class Bolt11Invoice_ extends UniffiEnum implements Bolt11Invoice__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.Bolt11Invoice; readonly inner: Readonly<[Bolt11InvoiceDetails]>; constructor(v0: Bolt11InvoiceDetails) { super('InputType', 'Bolt11Invoice'); this.inner = Object.freeze([v0]); } static new(v0: Bolt11InvoiceDetails): Bolt11Invoice_ { return new Bolt11Invoice_(v0); } static instanceOf(obj: any): obj is Bolt11Invoice_ { return obj.tag === InputType_Tags.Bolt11Invoice; } } type Bolt12Invoice__interface = { tag: InputType_Tags.Bolt12Invoice; inner: Readonly<[Bolt12InvoiceDetails]>; }; class Bolt12Invoice_ extends UniffiEnum implements Bolt12Invoice__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.Bolt12Invoice; readonly inner: Readonly<[Bolt12InvoiceDetails]>; constructor(v0: Bolt12InvoiceDetails) { super('InputType', 'Bolt12Invoice'); this.inner = Object.freeze([v0]); } static new(v0: Bolt12InvoiceDetails): Bolt12Invoice_ { return new Bolt12Invoice_(v0); } static instanceOf(obj: any): obj is Bolt12Invoice_ { return obj.tag === InputType_Tags.Bolt12Invoice; } } type Bolt12Offer__interface = { tag: InputType_Tags.Bolt12Offer; inner: Readonly<[Bolt12OfferDetails]>; }; class Bolt12Offer_ extends UniffiEnum implements Bolt12Offer__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.Bolt12Offer; readonly inner: Readonly<[Bolt12OfferDetails]>; constructor(v0: Bolt12OfferDetails) { super('InputType', 'Bolt12Offer'); this.inner = Object.freeze([v0]); } static new(v0: Bolt12OfferDetails): Bolt12Offer_ { return new Bolt12Offer_(v0); } static instanceOf(obj: any): obj is Bolt12Offer_ { return obj.tag === InputType_Tags.Bolt12Offer; } } type LightningAddress__interface = { tag: InputType_Tags.LightningAddress; inner: Readonly<[LightningAddressDetails]>; }; class LightningAddress_ extends UniffiEnum implements LightningAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.LightningAddress; readonly inner: Readonly<[LightningAddressDetails]>; constructor(v0: LightningAddressDetails) { super('InputType', 'LightningAddress'); this.inner = Object.freeze([v0]); } static new(v0: LightningAddressDetails): LightningAddress_ { return new LightningAddress_(v0); } static instanceOf(obj: any): obj is LightningAddress_ { return obj.tag === InputType_Tags.LightningAddress; } } type LnurlPay__interface = { tag: InputType_Tags.LnurlPay; inner: Readonly<[LnurlPayRequestDetails]>; }; class LnurlPay_ extends UniffiEnum implements LnurlPay__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.LnurlPay; readonly inner: Readonly<[LnurlPayRequestDetails]>; constructor(v0: LnurlPayRequestDetails) { super('InputType', 'LnurlPay'); this.inner = Object.freeze([v0]); } static new(v0: LnurlPayRequestDetails): LnurlPay_ { return new LnurlPay_(v0); } static instanceOf(obj: any): obj is LnurlPay_ { return obj.tag === InputType_Tags.LnurlPay; } } type SilentPaymentAddress__interface = { tag: InputType_Tags.SilentPaymentAddress; inner: Readonly<[SilentPaymentAddressDetails]>; }; class SilentPaymentAddress_ extends UniffiEnum implements SilentPaymentAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.SilentPaymentAddress; readonly inner: Readonly<[SilentPaymentAddressDetails]>; constructor(v0: SilentPaymentAddressDetails) { super('InputType', 'SilentPaymentAddress'); this.inner = Object.freeze([v0]); } static new(v0: SilentPaymentAddressDetails): SilentPaymentAddress_ { return new SilentPaymentAddress_(v0); } static instanceOf(obj: any): obj is SilentPaymentAddress_ { return obj.tag === InputType_Tags.SilentPaymentAddress; } } type LnurlAuth__interface = { tag: InputType_Tags.LnurlAuth; inner: Readonly<[LnurlAuthRequestDetails]>; }; class LnurlAuth_ extends UniffiEnum implements LnurlAuth__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.LnurlAuth; readonly inner: Readonly<[LnurlAuthRequestDetails]>; constructor(v0: LnurlAuthRequestDetails) { super('InputType', 'LnurlAuth'); this.inner = Object.freeze([v0]); } static new(v0: LnurlAuthRequestDetails): LnurlAuth_ { return new LnurlAuth_(v0); } static instanceOf(obj: any): obj is LnurlAuth_ { return obj.tag === InputType_Tags.LnurlAuth; } } type Url__interface = { tag: InputType_Tags.Url; inner: Readonly<[string]>; }; class Url_ extends UniffiEnum implements Url__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.Url; readonly inner: Readonly<[string]>; constructor(v0: string) { super('InputType', 'Url'); this.inner = Object.freeze([v0]); } static new(v0: string): Url_ { return new Url_(v0); } static instanceOf(obj: any): obj is Url_ { return obj.tag === InputType_Tags.Url; } } type Bip21__interface = { tag: InputType_Tags.Bip21; inner: Readonly<[Bip21Details]>; }; class Bip21_ extends UniffiEnum implements Bip21__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.Bip21; readonly inner: Readonly<[Bip21Details]>; constructor(v0: Bip21Details) { super('InputType', 'Bip21'); this.inner = Object.freeze([v0]); } static new(v0: Bip21Details): Bip21_ { return new Bip21_(v0); } static instanceOf(obj: any): obj is Bip21_ { return obj.tag === InputType_Tags.Bip21; } } type Bolt12InvoiceRequest__interface = { tag: InputType_Tags.Bolt12InvoiceRequest; inner: Readonly<[Bolt12InvoiceRequestDetails]>; }; class Bolt12InvoiceRequest_ extends UniffiEnum implements Bolt12InvoiceRequest__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.Bolt12InvoiceRequest; readonly inner: Readonly<[Bolt12InvoiceRequestDetails]>; constructor(v0: Bolt12InvoiceRequestDetails) { super('InputType', 'Bolt12InvoiceRequest'); this.inner = Object.freeze([v0]); } static new(v0: Bolt12InvoiceRequestDetails): Bolt12InvoiceRequest_ { return new Bolt12InvoiceRequest_(v0); } static instanceOf(obj: any): obj is Bolt12InvoiceRequest_ { return obj.tag === InputType_Tags.Bolt12InvoiceRequest; } } type LnurlWithdraw__interface = { tag: InputType_Tags.LnurlWithdraw; inner: Readonly<[LnurlWithdrawRequestDetails]>; }; class LnurlWithdraw_ extends UniffiEnum implements LnurlWithdraw__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.LnurlWithdraw; readonly inner: Readonly<[LnurlWithdrawRequestDetails]>; constructor(v0: LnurlWithdrawRequestDetails) { super('InputType', 'LnurlWithdraw'); this.inner = Object.freeze([v0]); } static new(v0: LnurlWithdrawRequestDetails): LnurlWithdraw_ { return new LnurlWithdraw_(v0); } static instanceOf(obj: any): obj is LnurlWithdraw_ { return obj.tag === InputType_Tags.LnurlWithdraw; } } type SparkAddress__interface = { tag: InputType_Tags.SparkAddress; inner: Readonly<[SparkAddressDetails]>; }; class SparkAddress_ extends UniffiEnum implements SparkAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.SparkAddress; readonly inner: Readonly<[SparkAddressDetails]>; constructor(v0: SparkAddressDetails) { super('InputType', 'SparkAddress'); this.inner = Object.freeze([v0]); } static new(v0: SparkAddressDetails): SparkAddress_ { return new SparkAddress_(v0); } static instanceOf(obj: any): obj is SparkAddress_ { return obj.tag === InputType_Tags.SparkAddress; } } type SparkInvoice__interface = { tag: InputType_Tags.SparkInvoice; inner: Readonly<[SparkInvoiceDetails]>; }; class SparkInvoice_ extends UniffiEnum implements SparkInvoice__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.SparkInvoice; readonly inner: Readonly<[SparkInvoiceDetails]>; constructor(v0: SparkInvoiceDetails) { super('InputType', 'SparkInvoice'); this.inner = Object.freeze([v0]); } static new(v0: SparkInvoiceDetails): SparkInvoice_ { return new SparkInvoice_(v0); } static instanceOf(obj: any): obj is SparkInvoice_ { return obj.tag === InputType_Tags.SparkInvoice; } } type CrossChainAddress__interface = { tag: InputType_Tags.CrossChainAddress; inner: Readonly<[CrossChainAddressDetails]>; }; class CrossChainAddress_ extends UniffiEnum implements CrossChainAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InputType'; readonly tag = InputType_Tags.CrossChainAddress; readonly inner: Readonly<[CrossChainAddressDetails]>; constructor(v0: CrossChainAddressDetails) { super('InputType', 'CrossChainAddress'); this.inner = Object.freeze([v0]); } static new(v0: CrossChainAddressDetails): CrossChainAddress_ { return new CrossChainAddress_(v0); } static instanceOf(obj: any): obj is CrossChainAddress_ { return obj.tag === InputType_Tags.CrossChainAddress; } } function instanceOf(obj: any): obj is InputType { return obj[uniffiTypeNameSymbol] === 'InputType'; } return Object.freeze({ instanceOf, BitcoinAddress: BitcoinAddress_, Bolt11Invoice: Bolt11Invoice_, Bolt12Invoice: Bolt12Invoice_, Bolt12Offer: Bolt12Offer_, LightningAddress: LightningAddress_, LnurlPay: LnurlPay_, SilentPaymentAddress: SilentPaymentAddress_, LnurlAuth: LnurlAuth_, Url: Url_, Bip21: Bip21_, Bolt12InvoiceRequest: Bolt12InvoiceRequest_, LnurlWithdraw: LnurlWithdraw_, SparkAddress: SparkAddress_, SparkInvoice: SparkInvoice_, CrossChainAddress: CrossChainAddress_, }); })(); export type InputType = InstanceType< (typeof InputType)[keyof Omit] >; // FfiConverter for enum InputType const FfiConverterTypeInputType = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = InputType; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new InputType.BitcoinAddress( FfiConverterTypeBitcoinAddressDetails.read(from) ); case 2: return new InputType.Bolt11Invoice( FfiConverterTypeBolt11InvoiceDetails.read(from) ); case 3: return new InputType.Bolt12Invoice( FfiConverterTypeBolt12InvoiceDetails.read(from) ); case 4: return new InputType.Bolt12Offer( FfiConverterTypeBolt12OfferDetails.read(from) ); case 5: return new InputType.LightningAddress( FfiConverterTypeLightningAddressDetails.read(from) ); case 6: return new InputType.LnurlPay( FfiConverterTypeLnurlPayRequestDetails.read(from) ); case 7: return new InputType.SilentPaymentAddress( FfiConverterTypeSilentPaymentAddressDetails.read(from) ); case 8: return new InputType.LnurlAuth( FfiConverterTypeLnurlAuthRequestDetails.read(from) ); case 9: return new InputType.Url(FfiConverterString.read(from)); case 10: return new InputType.Bip21(FfiConverterTypeBip21Details.read(from)); case 11: return new InputType.Bolt12InvoiceRequest( FfiConverterTypeBolt12InvoiceRequestDetails.read(from) ); case 12: return new InputType.LnurlWithdraw( FfiConverterTypeLnurlWithdrawRequestDetails.read(from) ); case 13: return new InputType.SparkAddress( FfiConverterTypeSparkAddressDetails.read(from) ); case 14: return new InputType.SparkInvoice( FfiConverterTypeSparkInvoiceDetails.read(from) ); case 15: return new InputType.CrossChainAddress( FfiConverterTypeCrossChainAddressDetails.read(from) ); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case InputType_Tags.BitcoinAddress: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeBitcoinAddressDetails.write(inner[0], into); return; } case InputType_Tags.Bolt11Invoice: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeBolt11InvoiceDetails.write(inner[0], into); return; } case InputType_Tags.Bolt12Invoice: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeBolt12InvoiceDetails.write(inner[0], into); return; } case InputType_Tags.Bolt12Offer: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterTypeBolt12OfferDetails.write(inner[0], into); return; } case InputType_Tags.LightningAddress: { ordinalConverter.write(5, into); const inner = value.inner; FfiConverterTypeLightningAddressDetails.write(inner[0], into); return; } case InputType_Tags.LnurlPay: { ordinalConverter.write(6, into); const inner = value.inner; FfiConverterTypeLnurlPayRequestDetails.write(inner[0], into); return; } case InputType_Tags.SilentPaymentAddress: { ordinalConverter.write(7, into); const inner = value.inner; FfiConverterTypeSilentPaymentAddressDetails.write(inner[0], into); return; } case InputType_Tags.LnurlAuth: { ordinalConverter.write(8, into); const inner = value.inner; FfiConverterTypeLnurlAuthRequestDetails.write(inner[0], into); return; } case InputType_Tags.Url: { ordinalConverter.write(9, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case InputType_Tags.Bip21: { ordinalConverter.write(10, into); const inner = value.inner; FfiConverterTypeBip21Details.write(inner[0], into); return; } case InputType_Tags.Bolt12InvoiceRequest: { ordinalConverter.write(11, into); const inner = value.inner; FfiConverterTypeBolt12InvoiceRequestDetails.write(inner[0], into); return; } case InputType_Tags.LnurlWithdraw: { ordinalConverter.write(12, into); const inner = value.inner; FfiConverterTypeLnurlWithdrawRequestDetails.write(inner[0], into); return; } case InputType_Tags.SparkAddress: { ordinalConverter.write(13, into); const inner = value.inner; FfiConverterTypeSparkAddressDetails.write(inner[0], into); return; } case InputType_Tags.SparkInvoice: { ordinalConverter.write(14, into); const inner = value.inner; FfiConverterTypeSparkInvoiceDetails.write(inner[0], into); return; } case InputType_Tags.CrossChainAddress: { ordinalConverter.write(15, into); const inner = value.inner; FfiConverterTypeCrossChainAddressDetails.write(inner[0], into); return; } default: // Throwing from here means that InputType_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case InputType_Tags.BitcoinAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeBitcoinAddressDetails.allocationSize( inner[0] ); return size; } case InputType_Tags.Bolt11Invoice: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeBolt11InvoiceDetails.allocationSize(inner[0]); return size; } case InputType_Tags.Bolt12Invoice: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeBolt12InvoiceDetails.allocationSize(inner[0]); return size; } case InputType_Tags.Bolt12Offer: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterTypeBolt12OfferDetails.allocationSize(inner[0]); return size; } case InputType_Tags.LightningAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(5); size += FfiConverterTypeLightningAddressDetails.allocationSize( inner[0] ); return size; } case InputType_Tags.LnurlPay: { const inner = value.inner; let size = ordinalConverter.allocationSize(6); size += FfiConverterTypeLnurlPayRequestDetails.allocationSize( inner[0] ); return size; } case InputType_Tags.SilentPaymentAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(7); size += FfiConverterTypeSilentPaymentAddressDetails.allocationSize( inner[0] ); return size; } case InputType_Tags.LnurlAuth: { const inner = value.inner; let size = ordinalConverter.allocationSize(8); size += FfiConverterTypeLnurlAuthRequestDetails.allocationSize( inner[0] ); return size; } case InputType_Tags.Url: { const inner = value.inner; let size = ordinalConverter.allocationSize(9); size += FfiConverterString.allocationSize(inner[0]); return size; } case InputType_Tags.Bip21: { const inner = value.inner; let size = ordinalConverter.allocationSize(10); size += FfiConverterTypeBip21Details.allocationSize(inner[0]); return size; } case InputType_Tags.Bolt12InvoiceRequest: { const inner = value.inner; let size = ordinalConverter.allocationSize(11); size += FfiConverterTypeBolt12InvoiceRequestDetails.allocationSize( inner[0] ); return size; } case InputType_Tags.LnurlWithdraw: { const inner = value.inner; let size = ordinalConverter.allocationSize(12); size += FfiConverterTypeLnurlWithdrawRequestDetails.allocationSize( inner[0] ); return size; } case InputType_Tags.SparkAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(13); size += FfiConverterTypeSparkAddressDetails.allocationSize(inner[0]); return size; } case InputType_Tags.SparkInvoice: { const inner = value.inner; let size = ordinalConverter.allocationSize(14); size += FfiConverterTypeSparkInvoiceDetails.allocationSize(inner[0]); return size; } case InputType_Tags.CrossChainAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(15); size += FfiConverterTypeCrossChainAddressDetails.allocationSize( inner[0] ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: InstantClaimStatus export enum InstantClaimStatus_Tags { Declined = 'Declined', Submitted = 'Submitted', } /** * State of an instant claim attempt on a deposit. */ export const InstantClaimStatus = (() => { type Declined__interface = { tag: InstantClaimStatus_Tags.Declined; inner: Readonly<{ maxFeeSats: /*u64*/ bigint | undefined; confirmations: /*u32*/ number; }>; }; /** * The early claim was declined and the deposit falls through to the claim at * maturity. `max_fee_sats` is the ceiling that declined it, unset when the * decline was for a reason no ceiling will fix. `confirmations` is the depth * it was declined at. */ class Declined_ extends UniffiEnum implements Declined__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InstantClaimStatus'; readonly tag = InstantClaimStatus_Tags.Declined; readonly inner: Readonly<{ maxFeeSats: /*u64*/ bigint | undefined; confirmations: /*u32*/ number; }>; constructor(inner: { maxFeeSats: /*u64*/ bigint | undefined; confirmations: /*u32*/ number; }) { super('InstantClaimStatus', 'Declined'); this.inner = Object.freeze(inner); } static new(inner: { maxFeeSats: /*u64*/ bigint | undefined; confirmations: /*u32*/ number; }): Declined_ { return new Declined_(inner); } static instanceOf(obj: any): obj is Declined_ { return obj.tag === InstantClaimStatus_Tags.Declined; } } type Submitted__interface = { tag: InstantClaimStatus_Tags.Submitted; inner: Readonly<{ claimId: string }>; }; /** * An instant claim was submitted and is settling. The deposit must not be * re-claimed (instant or normal) until the claim settles and it is reconciled * out. Carries the SSP claim id. */ class Submitted_ extends UniffiEnum implements Submitted__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'InstantClaimStatus'; readonly tag = InstantClaimStatus_Tags.Submitted; readonly inner: Readonly<{ claimId: string }>; constructor(inner: { claimId: string }) { super('InstantClaimStatus', 'Submitted'); this.inner = Object.freeze(inner); } static new(inner: { claimId: string }): Submitted_ { return new Submitted_(inner); } static instanceOf(obj: any): obj is Submitted_ { return obj.tag === InstantClaimStatus_Tags.Submitted; } } function instanceOf(obj: any): obj is InstantClaimStatus { return obj[uniffiTypeNameSymbol] === 'InstantClaimStatus'; } return Object.freeze({ instanceOf, Declined: Declined_, Submitted: Submitted_, }); })(); /** * State of an instant claim attempt on a deposit. */ export type InstantClaimStatus = InstanceType< (typeof InstantClaimStatus)[keyof Omit< typeof InstantClaimStatus, 'instanceOf' >] >; // FfiConverter for enum InstantClaimStatus const FfiConverterTypeInstantClaimStatus = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = InstantClaimStatus; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new InstantClaimStatus.Declined({ maxFeeSats: FfiConverterOptionalUInt64.read(from), confirmations: FfiConverterUInt32.read(from), }); case 2: return new InstantClaimStatus.Submitted({ claimId: FfiConverterString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case InstantClaimStatus_Tags.Declined: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterOptionalUInt64.write(inner.maxFeeSats, into); FfiConverterUInt32.write(inner.confirmations, into); return; } case InstantClaimStatus_Tags.Submitted: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.claimId, into); return; } default: // Throwing from here means that InstantClaimStatus_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case InstantClaimStatus_Tags.Declined: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterOptionalUInt64.allocationSize(inner.maxFeeSats); size += FfiConverterUInt32.allocationSize(inner.confirmations); return size; } case InstantClaimStatus_Tags.Submitted: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.claimId); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: LnurlCallbackStatus export enum LnurlCallbackStatus_Tags { Ok = 'Ok', ErrorStatus = 'ErrorStatus', } /** * The response from a LNURL-auth callback, indicating success or failure. */ export const LnurlCallbackStatus = (() => { type Ok__interface = { tag: LnurlCallbackStatus_Tags.Ok; }; /** * On-wire format is: `{"status": "OK"}` */ class Ok_ extends UniffiEnum implements Ok__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'LnurlCallbackStatus'; readonly tag = LnurlCallbackStatus_Tags.Ok; constructor() { super('LnurlCallbackStatus', 'Ok'); } static new(): Ok_ { return new Ok_(); } static instanceOf(obj: any): obj is Ok_ { return obj.tag === LnurlCallbackStatus_Tags.Ok; } } type ErrorStatus__interface = { tag: LnurlCallbackStatus_Tags.ErrorStatus; inner: Readonly<{ errorDetails: LnurlErrorDetails }>; }; /** * On-wire format is: `{"status": "ERROR", "reason": "error details..."}` */ class ErrorStatus_ extends UniffiEnum implements ErrorStatus__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'LnurlCallbackStatus'; readonly tag = LnurlCallbackStatus_Tags.ErrorStatus; readonly inner: Readonly<{ errorDetails: LnurlErrorDetails }>; constructor(inner: { errorDetails: LnurlErrorDetails }) { super('LnurlCallbackStatus', 'ErrorStatus'); this.inner = Object.freeze(inner); } static new(inner: { errorDetails: LnurlErrorDetails }): ErrorStatus_ { return new ErrorStatus_(inner); } static instanceOf(obj: any): obj is ErrorStatus_ { return obj.tag === LnurlCallbackStatus_Tags.ErrorStatus; } } function instanceOf(obj: any): obj is LnurlCallbackStatus { return obj[uniffiTypeNameSymbol] === 'LnurlCallbackStatus'; } return Object.freeze({ instanceOf, Ok: Ok_, ErrorStatus: ErrorStatus_, }); })(); /** * The response from a LNURL-auth callback, indicating success or failure. */ export type LnurlCallbackStatus = InstanceType< (typeof LnurlCallbackStatus)[keyof Omit< typeof LnurlCallbackStatus, 'instanceOf' >] >; // FfiConverter for enum LnurlCallbackStatus const FfiConverterTypeLnurlCallbackStatus = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = LnurlCallbackStatus; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new LnurlCallbackStatus.Ok(); case 2: return new LnurlCallbackStatus.ErrorStatus({ errorDetails: FfiConverterTypeLnurlErrorDetails.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case LnurlCallbackStatus_Tags.Ok: { ordinalConverter.write(1, into); return; } case LnurlCallbackStatus_Tags.ErrorStatus: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeLnurlErrorDetails.write(inner.errorDetails, into); return; } default: // Throwing from here means that LnurlCallbackStatus_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case LnurlCallbackStatus_Tags.Ok: { return ordinalConverter.allocationSize(1); } case LnurlCallbackStatus_Tags.ErrorStatus: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeLnurlErrorDetails.allocationSize( inner.errorDetails ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: MaxFee export enum MaxFee_Tags { Fixed = 'Fixed', Rate = 'Rate', NetworkRecommended = 'NetworkRecommended', } export const MaxFee = (() => { type Fixed__interface = { tag: MaxFee_Tags.Fixed; inner: Readonly<{ amount: /*u64*/ bigint }>; }; class Fixed_ extends UniffiEnum implements Fixed__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'MaxFee'; readonly tag = MaxFee_Tags.Fixed; readonly inner: Readonly<{ amount: /*u64*/ bigint }>; constructor(inner: { amount: /*u64*/ bigint }) { super('MaxFee', 'Fixed'); this.inner = Object.freeze(inner); } static new(inner: { amount: /*u64*/ bigint }): Fixed_ { return new Fixed_(inner); } static instanceOf(obj: any): obj is Fixed_ { return obj.tag === MaxFee_Tags.Fixed; } } type Rate__interface = { tag: MaxFee_Tags.Rate; inner: Readonly<{ satPerVbyte: /*u64*/ bigint }>; }; class Rate_ extends UniffiEnum implements Rate__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'MaxFee'; readonly tag = MaxFee_Tags.Rate; readonly inner: Readonly<{ satPerVbyte: /*u64*/ bigint }>; constructor(inner: { satPerVbyte: /*u64*/ bigint }) { super('MaxFee', 'Rate'); this.inner = Object.freeze(inner); } static new(inner: { satPerVbyte: /*u64*/ bigint }): Rate_ { return new Rate_(inner); } static instanceOf(obj: any): obj is Rate_ { return obj.tag === MaxFee_Tags.Rate; } } type NetworkRecommended__interface = { tag: MaxFee_Tags.NetworkRecommended; inner: Readonly<{ leewaySatPerVbyte: /*u64*/ bigint }>; }; class NetworkRecommended_ extends UniffiEnum implements NetworkRecommended__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'MaxFee'; readonly tag = MaxFee_Tags.NetworkRecommended; readonly inner: Readonly<{ leewaySatPerVbyte: /*u64*/ bigint }>; constructor(inner: { leewaySatPerVbyte: /*u64*/ bigint }) { super('MaxFee', 'NetworkRecommended'); this.inner = Object.freeze(inner); } static new(inner: { leewaySatPerVbyte: /*u64*/ bigint; }): NetworkRecommended_ { return new NetworkRecommended_(inner); } static instanceOf(obj: any): obj is NetworkRecommended_ { return obj.tag === MaxFee_Tags.NetworkRecommended; } } function instanceOf(obj: any): obj is MaxFee { return obj[uniffiTypeNameSymbol] === 'MaxFee'; } return Object.freeze({ instanceOf, Fixed: Fixed_, Rate: Rate_, NetworkRecommended: NetworkRecommended_, }); })(); export type MaxFee = InstanceType< (typeof MaxFee)[keyof Omit] >; // FfiConverter for enum MaxFee const FfiConverterTypeMaxFee = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = MaxFee; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new MaxFee.Fixed({ amount: FfiConverterUInt64.read(from) }); case 2: return new MaxFee.Rate({ satPerVbyte: FfiConverterUInt64.read(from), }); case 3: return new MaxFee.NetworkRecommended({ leewaySatPerVbyte: FfiConverterUInt64.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case MaxFee_Tags.Fixed: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterUInt64.write(inner.amount, into); return; } case MaxFee_Tags.Rate: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterUInt64.write(inner.satPerVbyte, into); return; } case MaxFee_Tags.NetworkRecommended: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterUInt64.write(inner.leewaySatPerVbyte, into); return; } default: // Throwing from here means that MaxFee_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case MaxFee_Tags.Fixed: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterUInt64.allocationSize(inner.amount); return size; } case MaxFee_Tags.Rate: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterUInt64.allocationSize(inner.satPerVbyte); return size; } case MaxFee_Tags.NetworkRecommended: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterUInt64.allocationSize(inner.leewaySatPerVbyte); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); export enum Network { Mainnet, Regtest, } const FfiConverterTypeNetwork = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = Network; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return Network.Mainnet; case 2: return Network.Regtest; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case Network.Mainnet: return ordinalConverter.write(1, into); case Network.Regtest: return ordinalConverter.write(2, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); export enum OnchainConfirmationSpeed { Fast, Medium, Slow, } const FfiConverterTypeOnchainConfirmationSpeed = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = OnchainConfirmationSpeed; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return OnchainConfirmationSpeed.Fast; case 2: return OnchainConfirmationSpeed.Medium; case 3: return OnchainConfirmationSpeed.Slow; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case OnchainConfirmationSpeed.Fast: return ordinalConverter.write(1, into); case OnchainConfirmationSpeed.Medium: return ordinalConverter.write(2, into); case OnchainConfirmationSpeed.Slow: return ordinalConverter.write(3, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); /** * Mode of a manually-triggered optimization run. */ export enum OptimizationMode { /** * Run until no further optimization is productive. */ Full, /** * Execute a single round and return so the caller can drive progress. */ SingleRound, } const FfiConverterTypeOptimizationMode = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = OptimizationMode; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return OptimizationMode.Full; case 2: return OptimizationMode.SingleRound; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case OptimizationMode.Full: return ordinalConverter.write(1, into); case OptimizationMode.SingleRound: return ordinalConverter.write(2, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: OptimizationOutcome export enum OptimizationOutcome_Tags { Completed = 'Completed', InProgress = 'InProgress', } /** * Outcome of a [`BreezSdk::optimize_leaves`] call. * * `rounds_executed` on `Completed` refers to rounds run by *this call*. * The SDK holds no cross-call state — callers driving a `SingleRound` * loop maintain their own cumulative counter if they need one. * * A `Completed { rounds_executed: 0 }` outcome means the wallet was * already optimal at call time (no swap was needed). * * **`SingleRound` loop pattern**: terminate on anything that isn't * `InProgress`. `Completed` covers both the final swap of a productive * run and the "already optimal" no-op case (the latter as * `rounds_executed: 0`). * * ```ignore * loop { * let request = OptimizeLeavesRequest { mode: OptimizationMode::SingleRound }; * match sdk.optimize_leaves(request).await?.outcome { * OptimizationOutcome::InProgress => continue, * OptimizationOutcome::Completed { .. } => break, * } * } * ``` */ export const OptimizationOutcome = (() => { type Completed__interface = { tag: OptimizationOutcome_Tags.Completed; inner: Readonly<{ roundsExecuted: /*u32*/ number }>; }; /** * All planned optimization work was executed in this call. * Returned by `Full` runs on success, and by `SingleRound` runs * whose swap was the final one needed (the planner produced a * single-swap plan with a convergence guarantee). * `rounds_executed == 0` means the wallet was already optimal — * no work was performed. */ class Completed_ extends UniffiEnum implements Completed__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'OptimizationOutcome'; readonly tag = OptimizationOutcome_Tags.Completed; readonly inner: Readonly<{ roundsExecuted: /*u32*/ number }>; constructor(inner: { roundsExecuted: /*u32*/ number }) { super('OptimizationOutcome', 'Completed'); this.inner = Object.freeze(inner); } static new(inner: { roundsExecuted: /*u32*/ number }): Completed_ { return new Completed_(inner); } static instanceOf(obj: any): obj is Completed_ { return obj.tag === OptimizationOutcome_Tags.Completed; } } type InProgress__interface = { tag: OptimizationOutcome_Tags.InProgress; }; /** * `SingleRound` only: a round ran but the planner could not * guarantee it was the last. The caller should invoke * `optimize_leaves` again. */ class InProgress_ extends UniffiEnum implements InProgress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'OptimizationOutcome'; readonly tag = OptimizationOutcome_Tags.InProgress; constructor() { super('OptimizationOutcome', 'InProgress'); } static new(): InProgress_ { return new InProgress_(); } static instanceOf(obj: any): obj is InProgress_ { return obj.tag === OptimizationOutcome_Tags.InProgress; } } function instanceOf(obj: any): obj is OptimizationOutcome { return obj[uniffiTypeNameSymbol] === 'OptimizationOutcome'; } return Object.freeze({ instanceOf, Completed: Completed_, InProgress: InProgress_, }); })(); /** * Outcome of a [`BreezSdk::optimize_leaves`] call. * * `rounds_executed` on `Completed` refers to rounds run by *this call*. * The SDK holds no cross-call state — callers driving a `SingleRound` * loop maintain their own cumulative counter if they need one. * * A `Completed { rounds_executed: 0 }` outcome means the wallet was * already optimal at call time (no swap was needed). * * **`SingleRound` loop pattern**: terminate on anything that isn't * `InProgress`. `Completed` covers both the final swap of a productive * run and the "already optimal" no-op case (the latter as * `rounds_executed: 0`). * * ```ignore * loop { * let request = OptimizeLeavesRequest { mode: OptimizationMode::SingleRound }; * match sdk.optimize_leaves(request).await?.outcome { * OptimizationOutcome::InProgress => continue, * OptimizationOutcome::Completed { .. } => break, * } * } * ``` */ export type OptimizationOutcome = InstanceType< (typeof OptimizationOutcome)[keyof Omit< typeof OptimizationOutcome, 'instanceOf' >] >; // FfiConverter for enum OptimizationOutcome const FfiConverterTypeOptimizationOutcome = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = OptimizationOutcome; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new OptimizationOutcome.Completed({ roundsExecuted: FfiConverterUInt32.read(from), }); case 2: return new OptimizationOutcome.InProgress(); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case OptimizationOutcome_Tags.Completed: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterUInt32.write(inner.roundsExecuted, into); return; } case OptimizationOutcome_Tags.InProgress: { ordinalConverter.write(2, into); return; } default: // Throwing from here means that OptimizationOutcome_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case OptimizationOutcome_Tags.Completed: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterUInt32.allocationSize(inner.roundsExecuted); return size; } case OptimizationOutcome_Tags.InProgress: { return ordinalConverter.allocationSize(2); } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: Outspend export enum Outspend_Tags { Unspent = 'Unspent', Spent = 'Spent', } /** * The spend status of a transaction output. */ export const Outspend = (() => { type Unspent__interface = { tag: Outspend_Tags.Unspent; }; class Unspent_ extends UniffiEnum implements Unspent__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'Outspend'; readonly tag = Outspend_Tags.Unspent; constructor() { super('Outspend', 'Unspent'); } static new(): Unspent_ { return new Unspent_(); } static instanceOf(obj: any): obj is Unspent_ { return obj.tag === Outspend_Tags.Unspent; } } type Spent__interface = { tag: Outspend_Tags.Spent; inner: Readonly<{ txid: string; vin: /*u32*/ number; status: TxStatus }>; }; /** * The output is spent by input `vin` of transaction `txid`; `status` is * that spending transaction's confirmation status. */ class Spent_ extends UniffiEnum implements Spent__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'Outspend'; readonly tag = Outspend_Tags.Spent; readonly inner: Readonly<{ txid: string; vin: /*u32*/ number; status: TxStatus; }>; constructor(inner: { txid: string; vin: /*u32*/ number; status: TxStatus; }) { super('Outspend', 'Spent'); this.inner = Object.freeze(inner); } static new(inner: { txid: string; vin: /*u32*/ number; status: TxStatus; }): Spent_ { return new Spent_(inner); } static instanceOf(obj: any): obj is Spent_ { return obj.tag === Outspend_Tags.Spent; } } function instanceOf(obj: any): obj is Outspend { return obj[uniffiTypeNameSymbol] === 'Outspend'; } return Object.freeze({ instanceOf, Unspent: Unspent_, Spent: Spent_, }); })(); /** * The spend status of a transaction output. */ export type Outspend = InstanceType< (typeof Outspend)[keyof Omit] >; // FfiConverter for enum Outspend const FfiConverterTypeOutspend = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = Outspend; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new Outspend.Unspent(); case 2: return new Outspend.Spent({ txid: FfiConverterString.read(from), vin: FfiConverterUInt32.read(from), status: FfiConverterTypeTxStatus.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case Outspend_Tags.Unspent: { ordinalConverter.write(1, into); return; } case Outspend_Tags.Spent: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.txid, into); FfiConverterUInt32.write(inner.vin, into); FfiConverterTypeTxStatus.write(inner.status, into); return; } default: // Throwing from here means that Outspend_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case Outspend_Tags.Unspent: { return ordinalConverter.allocationSize(1); } case Outspend_Tags.Spent: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.txid); size += FfiConverterUInt32.allocationSize(inner.vin); size += FfiConverterTypeTxStatus.allocationSize(inner.status); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: PasskeyAvailability export enum PasskeyAvailability_Tags { Available = 'Available', PrfUnsupported = 'PrfUnsupported', NotAssociated = 'NotAssociated', Skipped = 'Skipped', } /** * Single-value result of [`PasskeyClient::check_availability`]. * Collapses [`PrfProvider::is_supported`] + * [`PrfProvider::check_domain_association`] into one variant per * distinct host UX reaction. */ export const PasskeyAvailability = (() => { type Available__interface = { tag: PasskeyAvailability_Tags.Available; }; /** * PRF is supported and the platform's domain-association check * (when present) passed. Safe to proceed with register / sign-in. */ class Available_ extends UniffiEnum implements Available__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyAvailability'; readonly tag = PasskeyAvailability_Tags.Available; constructor() { super('PasskeyAvailability', 'Available'); } static new(): Available_ { return new Available_(); } static instanceOf(obj: any): obj is Available_ { return obj.tag === PasskeyAvailability_Tags.Available; } } type PrfUnsupported__interface = { tag: PasskeyAvailability_Tags.PrfUnsupported; }; /** * The authenticator does not implement the `WebAuthn` PRF * extension. Hosts gate the passkey UX path off this value. */ class PrfUnsupported_ extends UniffiEnum implements PrfUnsupported__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyAvailability'; readonly tag = PasskeyAvailability_Tags.PrfUnsupported; constructor() { super('PasskeyAvailability', 'PrfUnsupported'); } static new(): PrfUnsupported_ { return new PrfUnsupported_(); } static instanceOf(obj: any): obj is PrfUnsupported_ { return obj.tag === PasskeyAvailability_Tags.PrfUnsupported; } } type NotAssociated__interface = { tag: PasskeyAvailability_Tags.NotAssociated; inner: Readonly<{ source: string; reason: string }>; }; /** * PRF is supported but the platform's out-of-band verification * (iOS AASA / Android assetlinks / browser `rpId` scope) reports a * configuration mismatch. The strings carry the verification * origin and the concrete reason for diagnostic UI. */ class NotAssociated_ extends UniffiEnum implements NotAssociated__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyAvailability'; readonly tag = PasskeyAvailability_Tags.NotAssociated; readonly inner: Readonly<{ source: string; reason: string }>; constructor(inner: { source: string; reason: string }) { super('PasskeyAvailability', 'NotAssociated'); this.inner = Object.freeze(inner); } static new(inner: { source: string; reason: string }): NotAssociated_ { return new NotAssociated_(inner); } static instanceOf(obj: any): obj is NotAssociated_ { return obj.tag === PasskeyAvailability_Tags.NotAssociated; } } type Skipped__interface = { tag: PasskeyAvailability_Tags.Skipped; inner: Readonly<{ reason: string }>; }; /** * Domain-association verification was not performed (no source, * SSR context, etc.). Not a negative signal; passkey flows are * still safe to attempt. */ class Skipped_ extends UniffiEnum implements Skipped__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyAvailability'; readonly tag = PasskeyAvailability_Tags.Skipped; readonly inner: Readonly<{ reason: string }>; constructor(inner: { reason: string }) { super('PasskeyAvailability', 'Skipped'); this.inner = Object.freeze(inner); } static new(inner: { reason: string }): Skipped_ { return new Skipped_(inner); } static instanceOf(obj: any): obj is Skipped_ { return obj.tag === PasskeyAvailability_Tags.Skipped; } } function instanceOf(obj: any): obj is PasskeyAvailability { return obj[uniffiTypeNameSymbol] === 'PasskeyAvailability'; } return Object.freeze({ instanceOf, Available: Available_, PrfUnsupported: PrfUnsupported_, NotAssociated: NotAssociated_, Skipped: Skipped_, }); })(); /** * Single-value result of [`PasskeyClient::check_availability`]. * Collapses [`PrfProvider::is_supported`] + * [`PrfProvider::check_domain_association`] into one variant per * distinct host UX reaction. */ export type PasskeyAvailability = InstanceType< (typeof PasskeyAvailability)[keyof Omit< typeof PasskeyAvailability, 'instanceOf' >] >; // FfiConverter for enum PasskeyAvailability const FfiConverterTypePasskeyAvailability = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = PasskeyAvailability; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new PasskeyAvailability.Available(); case 2: return new PasskeyAvailability.PrfUnsupported(); case 3: return new PasskeyAvailability.NotAssociated({ source: FfiConverterString.read(from), reason: FfiConverterString.read(from), }); case 4: return new PasskeyAvailability.Skipped({ reason: FfiConverterString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case PasskeyAvailability_Tags.Available: { ordinalConverter.write(1, into); return; } case PasskeyAvailability_Tags.PrfUnsupported: { ordinalConverter.write(2, into); return; } case PasskeyAvailability_Tags.NotAssociated: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner.source, into); FfiConverterString.write(inner.reason, into); return; } case PasskeyAvailability_Tags.Skipped: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterString.write(inner.reason, into); return; } default: // Throwing from here means that PasskeyAvailability_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case PasskeyAvailability_Tags.Available: { return ordinalConverter.allocationSize(1); } case PasskeyAvailability_Tags.PrfUnsupported: { return ordinalConverter.allocationSize(2); } case PasskeyAvailability_Tags.NotAssociated: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner.source); size += FfiConverterString.allocationSize(inner.reason); return size; } case PasskeyAvailability_Tags.Skipped: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterString.allocationSize(inner.reason); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Error type: PasskeyError // Enum: PasskeyError export enum PasskeyError_Tags { Prf = 'Prf', RelayConnectionFailed = 'RelayConnectionFailed', NostrWriteFailed = 'NostrWriteFailed', NostrReadFailed = 'NostrReadFailed', KeyDerivationError = 'KeyDerivationError', InvalidPrfOutput = 'InvalidPrfOutput', MnemonicError = 'MnemonicError', InvalidSalt = 'InvalidSalt', CreatedButNotDerived = 'CreatedButNotDerived', InvalidConfig = 'InvalidConfig', Generic = 'Generic', } /** * Error type for passkey operations. */ export const PasskeyError = (() => { type Prf__interface = { tag: PasskeyError_Tags.Prf; inner: Readonly<[PrfProviderError]>; }; /** * Raised by the underlying [`crate::passkey::PrfProvider`]. */ class Prf_ extends UniffiError implements Prf__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyError'; readonly tag = PasskeyError_Tags.Prf; readonly inner: Readonly<[PrfProviderError]>; constructor(v0: PrfProviderError) { super('PasskeyError', 'Prf'); this.inner = Object.freeze([v0]); } static new(v0: PrfProviderError): Prf_ { return new Prf_(v0); } static instanceOf(obj: any): obj is Prf_ { return obj.tag === PasskeyError_Tags.Prf; } static hasInner(obj: any): obj is Prf_ { return Prf_.instanceOf(obj); } static getInner(obj: Prf_): Readonly<[PrfProviderError]> { return obj.inner; } } type RelayConnectionFailed__interface = { tag: PasskeyError_Tags.RelayConnectionFailed; inner: Readonly<[string]>; }; class RelayConnectionFailed_ extends UniffiError implements RelayConnectionFailed__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyError'; readonly tag = PasskeyError_Tags.RelayConnectionFailed; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PasskeyError', 'RelayConnectionFailed'); this.inner = Object.freeze([v0]); } static new(v0: string): RelayConnectionFailed_ { return new RelayConnectionFailed_(v0); } static instanceOf(obj: any): obj is RelayConnectionFailed_ { return obj.tag === PasskeyError_Tags.RelayConnectionFailed; } static hasInner(obj: any): obj is RelayConnectionFailed_ { return RelayConnectionFailed_.instanceOf(obj); } static getInner(obj: RelayConnectionFailed_): Readonly<[string]> { return obj.inner; } } type NostrWriteFailed__interface = { tag: PasskeyError_Tags.NostrWriteFailed; inner: Readonly<[string]>; }; class NostrWriteFailed_ extends UniffiError implements NostrWriteFailed__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyError'; readonly tag = PasskeyError_Tags.NostrWriteFailed; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PasskeyError', 'NostrWriteFailed'); this.inner = Object.freeze([v0]); } static new(v0: string): NostrWriteFailed_ { return new NostrWriteFailed_(v0); } static instanceOf(obj: any): obj is NostrWriteFailed_ { return obj.tag === PasskeyError_Tags.NostrWriteFailed; } static hasInner(obj: any): obj is NostrWriteFailed_ { return NostrWriteFailed_.instanceOf(obj); } static getInner(obj: NostrWriteFailed_): Readonly<[string]> { return obj.inner; } } type NostrReadFailed__interface = { tag: PasskeyError_Tags.NostrReadFailed; inner: Readonly<[string]>; }; class NostrReadFailed_ extends UniffiError implements NostrReadFailed__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyError'; readonly tag = PasskeyError_Tags.NostrReadFailed; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PasskeyError', 'NostrReadFailed'); this.inner = Object.freeze([v0]); } static new(v0: string): NostrReadFailed_ { return new NostrReadFailed_(v0); } static instanceOf(obj: any): obj is NostrReadFailed_ { return obj.tag === PasskeyError_Tags.NostrReadFailed; } static hasInner(obj: any): obj is NostrReadFailed_ { return NostrReadFailed_.instanceOf(obj); } static getInner(obj: NostrReadFailed_): Readonly<[string]> { return obj.inner; } } type KeyDerivationError__interface = { tag: PasskeyError_Tags.KeyDerivationError; inner: Readonly<[string]>; }; class KeyDerivationError_ extends UniffiError implements KeyDerivationError__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyError'; readonly tag = PasskeyError_Tags.KeyDerivationError; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PasskeyError', 'KeyDerivationError'); this.inner = Object.freeze([v0]); } static new(v0: string): KeyDerivationError_ { return new KeyDerivationError_(v0); } static instanceOf(obj: any): obj is KeyDerivationError_ { return obj.tag === PasskeyError_Tags.KeyDerivationError; } static hasInner(obj: any): obj is KeyDerivationError_ { return KeyDerivationError_.instanceOf(obj); } static getInner(obj: KeyDerivationError_): Readonly<[string]> { return obj.inner; } } type InvalidPrfOutput__interface = { tag: PasskeyError_Tags.InvalidPrfOutput; inner: Readonly<[string]>; }; /** * PRF output was unusable (e.g. wrong size). */ class InvalidPrfOutput_ extends UniffiError implements InvalidPrfOutput__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyError'; readonly tag = PasskeyError_Tags.InvalidPrfOutput; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PasskeyError', 'InvalidPrfOutput'); this.inner = Object.freeze([v0]); } static new(v0: string): InvalidPrfOutput_ { return new InvalidPrfOutput_(v0); } static instanceOf(obj: any): obj is InvalidPrfOutput_ { return obj.tag === PasskeyError_Tags.InvalidPrfOutput; } static hasInner(obj: any): obj is InvalidPrfOutput_ { return InvalidPrfOutput_.instanceOf(obj); } static getInner(obj: InvalidPrfOutput_): Readonly<[string]> { return obj.inner; } } type MnemonicError__interface = { tag: PasskeyError_Tags.MnemonicError; inner: Readonly<[string]>; }; class MnemonicError_ extends UniffiError implements MnemonicError__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyError'; readonly tag = PasskeyError_Tags.MnemonicError; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PasskeyError', 'MnemonicError'); this.inner = Object.freeze([v0]); } static new(v0: string): MnemonicError_ { return new MnemonicError_(v0); } static instanceOf(obj: any): obj is MnemonicError_ { return obj.tag === PasskeyError_Tags.MnemonicError; } static hasInner(obj: any): obj is MnemonicError_ { return MnemonicError_.instanceOf(obj); } static getInner(obj: MnemonicError_): Readonly<[string]> { return obj.inner; } } type InvalidSalt__interface = { tag: PasskeyError_Tags.InvalidSalt; inner: Readonly<[string]>; }; class InvalidSalt_ extends UniffiError implements InvalidSalt__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyError'; readonly tag = PasskeyError_Tags.InvalidSalt; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PasskeyError', 'InvalidSalt'); this.inner = Object.freeze([v0]); } static new(v0: string): InvalidSalt_ { return new InvalidSalt_(v0); } static instanceOf(obj: any): obj is InvalidSalt_ { return obj.tag === PasskeyError_Tags.InvalidSalt; } static hasInner(obj: any): obj is InvalidSalt_ { return InvalidSalt_.instanceOf(obj); } static getInner(obj: InvalidSalt_): Readonly<[string]> { return obj.inner; } } type CreatedButNotDerived__interface = { tag: PasskeyError_Tags.CreatedButNotDerived; inner: Readonly<{ credentialId: ArrayBuffer; source: PrfProviderError }>; }; /** * Registration created the credential, then the derive that * followed it failed. The passkey exists on the device: recover by * signing in pinned to `credential_id`. Registering again would * leave this one behind, owning a wallet nothing points to. * * Only wraps a [`PrfProviderError`], so hosts unwrap once and keep * the arms they already have. Failures that are not the * authenticator's (mnemonic, key derivation, invalid PRF output) * propagate as their own variant, unwrapped. */ class CreatedButNotDerived_ extends UniffiError implements CreatedButNotDerived__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyError'; readonly tag = PasskeyError_Tags.CreatedButNotDerived; readonly inner: Readonly<{ credentialId: ArrayBuffer; source: PrfProviderError; }>; constructor(inner: { credentialId: ArrayBuffer; source: PrfProviderError; }) { super('PasskeyError', 'CreatedButNotDerived'); this.inner = Object.freeze(inner); } static new(inner: { credentialId: ArrayBuffer; source: PrfProviderError; }): CreatedButNotDerived_ { return new CreatedButNotDerived_(inner); } static instanceOf(obj: any): obj is CreatedButNotDerived_ { return obj.tag === PasskeyError_Tags.CreatedButNotDerived; } static hasInner(obj: any): obj is CreatedButNotDerived_ { return CreatedButNotDerived_.instanceOf(obj); } static getInner( obj: CreatedButNotDerived_ ): Readonly<{ credentialId: ArrayBuffer; source: PrfProviderError }> { return obj.inner; } } type InvalidConfig__interface = { tag: PasskeyError_Tags.InvalidConfig; inner: Readonly<[string]>; }; /** * The client was configured in a way it cannot honour, so no * operation would succeed. Not retryable until the integrator * changes the configuration. */ class InvalidConfig_ extends UniffiError implements InvalidConfig__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyError'; readonly tag = PasskeyError_Tags.InvalidConfig; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PasskeyError', 'InvalidConfig'); this.inner = Object.freeze([v0]); } static new(v0: string): InvalidConfig_ { return new InvalidConfig_(v0); } static instanceOf(obj: any): obj is InvalidConfig_ { return obj.tag === PasskeyError_Tags.InvalidConfig; } static hasInner(obj: any): obj is InvalidConfig_ { return InvalidConfig_.instanceOf(obj); } static getInner(obj: InvalidConfig_): Readonly<[string]> { return obj.inner; } } type Generic__interface = { tag: PasskeyError_Tags.Generic; inner: Readonly<[string]>; }; class Generic_ extends UniffiError implements Generic__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PasskeyError'; readonly tag = PasskeyError_Tags.Generic; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PasskeyError', 'Generic'); this.inner = Object.freeze([v0]); } static new(v0: string): Generic_ { return new Generic_(v0); } static instanceOf(obj: any): obj is Generic_ { return obj.tag === PasskeyError_Tags.Generic; } static hasInner(obj: any): obj is Generic_ { return Generic_.instanceOf(obj); } static getInner(obj: Generic_): Readonly<[string]> { return obj.inner; } } function instanceOf(obj: any): obj is PasskeyError { return obj[uniffiTypeNameSymbol] === 'PasskeyError'; } return Object.freeze({ instanceOf, Prf: Prf_, RelayConnectionFailed: RelayConnectionFailed_, NostrWriteFailed: NostrWriteFailed_, NostrReadFailed: NostrReadFailed_, KeyDerivationError: KeyDerivationError_, InvalidPrfOutput: InvalidPrfOutput_, MnemonicError: MnemonicError_, InvalidSalt: InvalidSalt_, CreatedButNotDerived: CreatedButNotDerived_, InvalidConfig: InvalidConfig_, Generic: Generic_, }); })(); /** * Error type for passkey operations. */ export type PasskeyError = InstanceType< (typeof PasskeyError)[keyof Omit] >; // FfiConverter for enum PasskeyError const FfiConverterTypePasskeyError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = PasskeyError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new PasskeyError.Prf( FfiConverterTypePrfProviderError.read(from) ); case 2: return new PasskeyError.RelayConnectionFailed( FfiConverterString.read(from) ); case 3: return new PasskeyError.NostrWriteFailed( FfiConverterString.read(from) ); case 4: return new PasskeyError.NostrReadFailed( FfiConverterString.read(from) ); case 5: return new PasskeyError.KeyDerivationError( FfiConverterString.read(from) ); case 6: return new PasskeyError.InvalidPrfOutput( FfiConverterString.read(from) ); case 7: return new PasskeyError.MnemonicError(FfiConverterString.read(from)); case 8: return new PasskeyError.InvalidSalt(FfiConverterString.read(from)); case 9: return new PasskeyError.CreatedButNotDerived({ credentialId: FfiConverterArrayBuffer.read(from), source: FfiConverterTypePrfProviderError.read(from), }); case 10: return new PasskeyError.InvalidConfig(FfiConverterString.read(from)); case 11: return new PasskeyError.Generic(FfiConverterString.read(from)); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case PasskeyError_Tags.Prf: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypePrfProviderError.write(inner[0], into); return; } case PasskeyError_Tags.RelayConnectionFailed: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case PasskeyError_Tags.NostrWriteFailed: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case PasskeyError_Tags.NostrReadFailed: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case PasskeyError_Tags.KeyDerivationError: { ordinalConverter.write(5, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case PasskeyError_Tags.InvalidPrfOutput: { ordinalConverter.write(6, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case PasskeyError_Tags.MnemonicError: { ordinalConverter.write(7, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case PasskeyError_Tags.InvalidSalt: { ordinalConverter.write(8, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case PasskeyError_Tags.CreatedButNotDerived: { ordinalConverter.write(9, into); const inner = value.inner; FfiConverterArrayBuffer.write(inner.credentialId, into); FfiConverterTypePrfProviderError.write(inner.source, into); return; } case PasskeyError_Tags.InvalidConfig: { ordinalConverter.write(10, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case PasskeyError_Tags.Generic: { ordinalConverter.write(11, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } default: // Throwing from here means that PasskeyError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case PasskeyError_Tags.Prf: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypePrfProviderError.allocationSize(inner[0]); return size; } case PasskeyError_Tags.RelayConnectionFailed: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner[0]); return size; } case PasskeyError_Tags.NostrWriteFailed: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner[0]); return size; } case PasskeyError_Tags.NostrReadFailed: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterString.allocationSize(inner[0]); return size; } case PasskeyError_Tags.KeyDerivationError: { const inner = value.inner; let size = ordinalConverter.allocationSize(5); size += FfiConverterString.allocationSize(inner[0]); return size; } case PasskeyError_Tags.InvalidPrfOutput: { const inner = value.inner; let size = ordinalConverter.allocationSize(6); size += FfiConverterString.allocationSize(inner[0]); return size; } case PasskeyError_Tags.MnemonicError: { const inner = value.inner; let size = ordinalConverter.allocationSize(7); size += FfiConverterString.allocationSize(inner[0]); return size; } case PasskeyError_Tags.InvalidSalt: { const inner = value.inner; let size = ordinalConverter.allocationSize(8); size += FfiConverterString.allocationSize(inner[0]); return size; } case PasskeyError_Tags.CreatedButNotDerived: { const inner = value.inner; let size = ordinalConverter.allocationSize(9); size += FfiConverterArrayBuffer.allocationSize(inner.credentialId); size += FfiConverterTypePrfProviderError.allocationSize(inner.source); return size; } case PasskeyError_Tags.InvalidConfig: { const inner = value.inner; let size = ordinalConverter.allocationSize(10); size += FfiConverterString.allocationSize(inner[0]); return size; } case PasskeyError_Tags.Generic: { const inner = value.inner; let size = ordinalConverter.allocationSize(11); size += FfiConverterString.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: PaymentDetails export enum PaymentDetails_Tags { Spark = 'Spark', Token = 'Token', Lightning = 'Lightning', Withdraw = 'Withdraw', Deposit = 'Deposit', } export const PaymentDetails = (() => { type Spark__interface = { tag: PaymentDetails_Tags.Spark; inner: Readonly<{ invoiceDetails: SparkInvoicePaymentDetails | undefined; htlcDetails: SparkHtlcDetails | undefined; conversionInfo: ConversionInfo | undefined; }>; }; class Spark_ extends UniffiEnum implements Spark__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PaymentDetails'; readonly tag = PaymentDetails_Tags.Spark; readonly inner: Readonly<{ invoiceDetails: SparkInvoicePaymentDetails | undefined; htlcDetails: SparkHtlcDetails | undefined; conversionInfo: ConversionInfo | undefined; }>; constructor(inner: { /** * The invoice details if the payment fulfilled a spark invoice */ invoiceDetails: SparkInvoicePaymentDetails | undefined; /** * The HTLC transfer details if the payment fulfilled an HTLC transfer */ htlcDetails: SparkHtlcDetails | undefined; /** * The information for a conversion */ conversionInfo: ConversionInfo | undefined; }) { super('PaymentDetails', 'Spark'); this.inner = Object.freeze(inner); } static new(inner: { /** * The invoice details if the payment fulfilled a spark invoice */ invoiceDetails: SparkInvoicePaymentDetails | undefined; /** * The HTLC transfer details if the payment fulfilled an HTLC transfer */ htlcDetails: SparkHtlcDetails | undefined; /** * The information for a conversion */ conversionInfo: ConversionInfo | undefined; }): Spark_ { return new Spark_(inner); } static instanceOf(obj: any): obj is Spark_ { return obj.tag === PaymentDetails_Tags.Spark; } } type Token__interface = { tag: PaymentDetails_Tags.Token; inner: Readonly<{ metadata: TokenMetadata; txHash: string; txType: TokenTransactionType; invoiceDetails: SparkInvoicePaymentDetails | undefined; conversionInfo: ConversionInfo | undefined; }>; }; class Token_ extends UniffiEnum implements Token__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PaymentDetails'; readonly tag = PaymentDetails_Tags.Token; readonly inner: Readonly<{ metadata: TokenMetadata; txHash: string; txType: TokenTransactionType; invoiceDetails: SparkInvoicePaymentDetails | undefined; conversionInfo: ConversionInfo | undefined; }>; constructor(inner: { metadata: TokenMetadata; txHash: string; txType: TokenTransactionType; /** * The invoice details if the payment fulfilled a spark invoice */ invoiceDetails: SparkInvoicePaymentDetails | undefined; /** * The information for a conversion */ conversionInfo: ConversionInfo | undefined; }) { super('PaymentDetails', 'Token'); this.inner = Object.freeze(inner); } static new(inner: { metadata: TokenMetadata; txHash: string; txType: TokenTransactionType; /** * The invoice details if the payment fulfilled a spark invoice */ invoiceDetails: SparkInvoicePaymentDetails | undefined; /** * The information for a conversion */ conversionInfo: ConversionInfo | undefined; }): Token_ { return new Token_(inner); } static instanceOf(obj: any): obj is Token_ { return obj.tag === PaymentDetails_Tags.Token; } } type Lightning__interface = { tag: PaymentDetails_Tags.Lightning; inner: Readonly<{ description: string | undefined; invoice: string; destinationPubkey: string; htlcDetails: SparkHtlcDetails; lnurlPayInfo: LnurlPayInfo | undefined; lnurlWithdrawInfo: LnurlWithdrawInfo | undefined; lnurlReceiveMetadata: LnurlReceiveMetadata | undefined; conversionInfo: ConversionInfo | undefined; }>; }; class Lightning_ extends UniffiEnum implements Lightning__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PaymentDetails'; readonly tag = PaymentDetails_Tags.Lightning; readonly inner: Readonly<{ description: string | undefined; invoice: string; destinationPubkey: string; htlcDetails: SparkHtlcDetails; lnurlPayInfo: LnurlPayInfo | undefined; lnurlWithdrawInfo: LnurlWithdrawInfo | undefined; lnurlReceiveMetadata: LnurlReceiveMetadata | undefined; conversionInfo: ConversionInfo | undefined; }>; constructor(inner: { /** * Represents the invoice description */ description: string | undefined; /** * Represents the Bolt11/Bolt12 invoice associated with a payment * In the case of a Send payment, this is the invoice paid by the user * In the case of a Receive payment, this is the invoice paid to the user */ invoice: string; /** * The invoice destination/payee pubkey */ destinationPubkey: string; /** * The HTLC transfer details */ htlcDetails: SparkHtlcDetails; /** * Lnurl payment information if this was an lnurl payment. */ lnurlPayInfo: LnurlPayInfo | undefined; /** * Lnurl withdrawal information if this was an lnurl payment. */ lnurlWithdrawInfo: LnurlWithdrawInfo | undefined; /** * Lnurl receive information if this was a received lnurl payment. */ lnurlReceiveMetadata: LnurlReceiveMetadata | undefined; /** * The information for a conversion — populated when this Lightning * payment is the source leg of a cross-chain conversion (e.g. a * Boltz reverse swap paying a hold invoice). */ conversionInfo: ConversionInfo | undefined; }) { super('PaymentDetails', 'Lightning'); this.inner = Object.freeze(inner); } static new(inner: { /** * Represents the invoice description */ description: string | undefined; /** * Represents the Bolt11/Bolt12 invoice associated with a payment * In the case of a Send payment, this is the invoice paid by the user * In the case of a Receive payment, this is the invoice paid to the user */ invoice: string; /** * The invoice destination/payee pubkey */ destinationPubkey: string; /** * The HTLC transfer details */ htlcDetails: SparkHtlcDetails; /** * Lnurl payment information if this was an lnurl payment. */ lnurlPayInfo: LnurlPayInfo | undefined; /** * Lnurl withdrawal information if this was an lnurl payment. */ lnurlWithdrawInfo: LnurlWithdrawInfo | undefined; /** * Lnurl receive information if this was a received lnurl payment. */ lnurlReceiveMetadata: LnurlReceiveMetadata | undefined; /** * The information for a conversion — populated when this Lightning * payment is the source leg of a cross-chain conversion (e.g. a * Boltz reverse swap paying a hold invoice). */ conversionInfo: ConversionInfo | undefined; }): Lightning_ { return new Lightning_(inner); } static instanceOf(obj: any): obj is Lightning_ { return obj.tag === PaymentDetails_Tags.Lightning; } } type Withdraw__interface = { tag: PaymentDetails_Tags.Withdraw; inner: Readonly<{ txId: string }>; }; class Withdraw_ extends UniffiEnum implements Withdraw__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PaymentDetails'; readonly tag = PaymentDetails_Tags.Withdraw; readonly inner: Readonly<{ txId: string }>; constructor(inner: { txId: string }) { super('PaymentDetails', 'Withdraw'); this.inner = Object.freeze(inner); } static new(inner: { txId: string }): Withdraw_ { return new Withdraw_(inner); } static instanceOf(obj: any): obj is Withdraw_ { return obj.tag === PaymentDetails_Tags.Withdraw; } } type Deposit__interface = { tag: PaymentDetails_Tags.Deposit; inner: Readonly<{ txId: string; vout: /*u32*/ number }>; }; class Deposit_ extends UniffiEnum implements Deposit__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PaymentDetails'; readonly tag = PaymentDetails_Tags.Deposit; readonly inner: Readonly<{ txId: string; vout: /*u32*/ number }>; constructor(inner: { txId: string; vout: /*u32*/ number }) { super('PaymentDetails', 'Deposit'); this.inner = Object.freeze(inner); } static new(inner: { txId: string; vout: /*u32*/ number }): Deposit_ { return new Deposit_(inner); } static instanceOf(obj: any): obj is Deposit_ { return obj.tag === PaymentDetails_Tags.Deposit; } } function instanceOf(obj: any): obj is PaymentDetails { return obj[uniffiTypeNameSymbol] === 'PaymentDetails'; } return Object.freeze({ instanceOf, Spark: Spark_, Token: Token_, Lightning: Lightning_, Withdraw: Withdraw_, Deposit: Deposit_, }); })(); export type PaymentDetails = InstanceType< (typeof PaymentDetails)[keyof Omit] >; // FfiConverter for enum PaymentDetails const FfiConverterTypePaymentDetails = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = PaymentDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new PaymentDetails.Spark({ invoiceDetails: FfiConverterOptionalTypeSparkInvoicePaymentDetails.read(from), htlcDetails: FfiConverterOptionalTypeSparkHtlcDetails.read(from), conversionInfo: FfiConverterOptionalTypeConversionInfo.read(from), }); case 2: return new PaymentDetails.Token({ metadata: FfiConverterTypeTokenMetadata.read(from), txHash: FfiConverterString.read(from), txType: FfiConverterTypeTokenTransactionType.read(from), invoiceDetails: FfiConverterOptionalTypeSparkInvoicePaymentDetails.read(from), conversionInfo: FfiConverterOptionalTypeConversionInfo.read(from), }); case 3: return new PaymentDetails.Lightning({ description: FfiConverterOptionalString.read(from), invoice: FfiConverterString.read(from), destinationPubkey: FfiConverterString.read(from), htlcDetails: FfiConverterTypeSparkHtlcDetails.read(from), lnurlPayInfo: FfiConverterOptionalTypeLnurlPayInfo.read(from), lnurlWithdrawInfo: FfiConverterOptionalTypeLnurlWithdrawInfo.read(from), lnurlReceiveMetadata: FfiConverterOptionalTypeLnurlReceiveMetadata.read(from), conversionInfo: FfiConverterOptionalTypeConversionInfo.read(from), }); case 4: return new PaymentDetails.Withdraw({ txId: FfiConverterString.read(from), }); case 5: return new PaymentDetails.Deposit({ txId: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case PaymentDetails_Tags.Spark: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterOptionalTypeSparkInvoicePaymentDetails.write( inner.invoiceDetails, into ); FfiConverterOptionalTypeSparkHtlcDetails.write( inner.htlcDetails, into ); FfiConverterOptionalTypeConversionInfo.write( inner.conversionInfo, into ); return; } case PaymentDetails_Tags.Token: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeTokenMetadata.write(inner.metadata, into); FfiConverterString.write(inner.txHash, into); FfiConverterTypeTokenTransactionType.write(inner.txType, into); FfiConverterOptionalTypeSparkInvoicePaymentDetails.write( inner.invoiceDetails, into ); FfiConverterOptionalTypeConversionInfo.write( inner.conversionInfo, into ); return; } case PaymentDetails_Tags.Lightning: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterOptionalString.write(inner.description, into); FfiConverterString.write(inner.invoice, into); FfiConverterString.write(inner.destinationPubkey, into); FfiConverterTypeSparkHtlcDetails.write(inner.htlcDetails, into); FfiConverterOptionalTypeLnurlPayInfo.write(inner.lnurlPayInfo, into); FfiConverterOptionalTypeLnurlWithdrawInfo.write( inner.lnurlWithdrawInfo, into ); FfiConverterOptionalTypeLnurlReceiveMetadata.write( inner.lnurlReceiveMetadata, into ); FfiConverterOptionalTypeConversionInfo.write( inner.conversionInfo, into ); return; } case PaymentDetails_Tags.Withdraw: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterString.write(inner.txId, into); return; } case PaymentDetails_Tags.Deposit: { ordinalConverter.write(5, into); const inner = value.inner; FfiConverterString.write(inner.txId, into); FfiConverterUInt32.write(inner.vout, into); return; } default: // Throwing from here means that PaymentDetails_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case PaymentDetails_Tags.Spark: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterOptionalTypeSparkInvoicePaymentDetails.allocationSize( inner.invoiceDetails ); size += FfiConverterOptionalTypeSparkHtlcDetails.allocationSize( inner.htlcDetails ); size += FfiConverterOptionalTypeConversionInfo.allocationSize( inner.conversionInfo ); return size; } case PaymentDetails_Tags.Token: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeTokenMetadata.allocationSize(inner.metadata); size += FfiConverterString.allocationSize(inner.txHash); size += FfiConverterTypeTokenTransactionType.allocationSize( inner.txType ); size += FfiConverterOptionalTypeSparkInvoicePaymentDetails.allocationSize( inner.invoiceDetails ); size += FfiConverterOptionalTypeConversionInfo.allocationSize( inner.conversionInfo ); return size; } case PaymentDetails_Tags.Lightning: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterOptionalString.allocationSize(inner.description); size += FfiConverterString.allocationSize(inner.invoice); size += FfiConverterString.allocationSize(inner.destinationPubkey); size += FfiConverterTypeSparkHtlcDetails.allocationSize( inner.htlcDetails ); size += FfiConverterOptionalTypeLnurlPayInfo.allocationSize( inner.lnurlPayInfo ); size += FfiConverterOptionalTypeLnurlWithdrawInfo.allocationSize( inner.lnurlWithdrawInfo ); size += FfiConverterOptionalTypeLnurlReceiveMetadata.allocationSize( inner.lnurlReceiveMetadata ); size += FfiConverterOptionalTypeConversionInfo.allocationSize( inner.conversionInfo ); return size; } case PaymentDetails_Tags.Withdraw: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterString.allocationSize(inner.txId); return size; } case PaymentDetails_Tags.Deposit: { const inner = value.inner; let size = ordinalConverter.allocationSize(5); size += FfiConverterString.allocationSize(inner.txId); size += FfiConverterUInt32.allocationSize(inner.vout); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: PaymentDetailsFilter export enum PaymentDetailsFilter_Tags { Spark = 'Spark', Token = 'Token', Lightning = 'Lightning', } export const PaymentDetailsFilter = (() => { type Spark__interface = { tag: PaymentDetailsFilter_Tags.Spark; inner: Readonly<{ htlcStatus: Array | undefined; conversionRefundNeeded: boolean | undefined; }>; }; class Spark_ extends UniffiEnum implements Spark__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PaymentDetailsFilter'; readonly tag = PaymentDetailsFilter_Tags.Spark; readonly inner: Readonly<{ htlcStatus: Array | undefined; conversionRefundNeeded: boolean | undefined; }>; constructor(inner: { /** * Filter specific Spark HTLC statuses */ htlcStatus: Array | undefined; /** * Filter conversion payments with refund information */ conversionRefundNeeded: boolean | undefined; }) { super('PaymentDetailsFilter', 'Spark'); this.inner = Object.freeze(inner); } static new(inner: { /** * Filter specific Spark HTLC statuses */ htlcStatus: Array | undefined; /** * Filter conversion payments with refund information */ conversionRefundNeeded: boolean | undefined; }): Spark_ { return new Spark_(inner); } static instanceOf(obj: any): obj is Spark_ { return obj.tag === PaymentDetailsFilter_Tags.Spark; } } type Token__interface = { tag: PaymentDetailsFilter_Tags.Token; inner: Readonly<{ conversionRefundNeeded: boolean | undefined; txHash: string | undefined; txType: TokenTransactionType | undefined; }>; }; class Token_ extends UniffiEnum implements Token__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PaymentDetailsFilter'; readonly tag = PaymentDetailsFilter_Tags.Token; readonly inner: Readonly<{ conversionRefundNeeded: boolean | undefined; txHash: string | undefined; txType: TokenTransactionType | undefined; }>; constructor(inner: { /** * Filter conversion payments with refund information */ conversionRefundNeeded: boolean | undefined; /** * Filter by transaction hash */ txHash: string | undefined; /** * Filter by transaction type */ txType: TokenTransactionType | undefined; }) { super('PaymentDetailsFilter', 'Token'); this.inner = Object.freeze(inner); } static new(inner: { /** * Filter conversion payments with refund information */ conversionRefundNeeded: boolean | undefined; /** * Filter by transaction hash */ txHash: string | undefined; /** * Filter by transaction type */ txType: TokenTransactionType | undefined; }): Token_ { return new Token_(inner); } static instanceOf(obj: any): obj is Token_ { return obj.tag === PaymentDetailsFilter_Tags.Token; } } type Lightning__interface = { tag: PaymentDetailsFilter_Tags.Lightning; inner: Readonly<{ htlcStatus: Array | undefined }>; }; class Lightning_ extends UniffiEnum implements Lightning__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PaymentDetailsFilter'; readonly tag = PaymentDetailsFilter_Tags.Lightning; readonly inner: Readonly<{ htlcStatus: Array | undefined; }>; constructor(inner: { /** * Filter specific Spark HTLC statuses */ htlcStatus: Array | undefined; }) { super('PaymentDetailsFilter', 'Lightning'); this.inner = Object.freeze(inner); } static new(inner: { /** * Filter specific Spark HTLC statuses */ htlcStatus: Array | undefined; }): Lightning_ { return new Lightning_(inner); } static instanceOf(obj: any): obj is Lightning_ { return obj.tag === PaymentDetailsFilter_Tags.Lightning; } } function instanceOf(obj: any): obj is PaymentDetailsFilter { return obj[uniffiTypeNameSymbol] === 'PaymentDetailsFilter'; } return Object.freeze({ instanceOf, Spark: Spark_, Token: Token_, Lightning: Lightning_, }); })(); export type PaymentDetailsFilter = InstanceType< (typeof PaymentDetailsFilter)[keyof Omit< typeof PaymentDetailsFilter, 'instanceOf' >] >; // FfiConverter for enum PaymentDetailsFilter const FfiConverterTypePaymentDetailsFilter = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = PaymentDetailsFilter; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new PaymentDetailsFilter.Spark({ htlcStatus: FfiConverterOptionalArrayTypeSparkHtlcStatus.read(from), conversionRefundNeeded: FfiConverterOptionalBool.read(from), }); case 2: return new PaymentDetailsFilter.Token({ conversionRefundNeeded: FfiConverterOptionalBool.read(from), txHash: FfiConverterOptionalString.read(from), txType: FfiConverterOptionalTypeTokenTransactionType.read(from), }); case 3: return new PaymentDetailsFilter.Lightning({ htlcStatus: FfiConverterOptionalArrayTypeSparkHtlcStatus.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case PaymentDetailsFilter_Tags.Spark: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterOptionalArrayTypeSparkHtlcStatus.write( inner.htlcStatus, into ); FfiConverterOptionalBool.write(inner.conversionRefundNeeded, into); return; } case PaymentDetailsFilter_Tags.Token: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterOptionalBool.write(inner.conversionRefundNeeded, into); FfiConverterOptionalString.write(inner.txHash, into); FfiConverterOptionalTypeTokenTransactionType.write( inner.txType, into ); return; } case PaymentDetailsFilter_Tags.Lightning: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterOptionalArrayTypeSparkHtlcStatus.write( inner.htlcStatus, into ); return; } default: // Throwing from here means that PaymentDetailsFilter_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case PaymentDetailsFilter_Tags.Spark: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterOptionalArrayTypeSparkHtlcStatus.allocationSize( inner.htlcStatus ); size += FfiConverterOptionalBool.allocationSize( inner.conversionRefundNeeded ); return size; } case PaymentDetailsFilter_Tags.Token: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterOptionalBool.allocationSize( inner.conversionRefundNeeded ); size += FfiConverterOptionalString.allocationSize(inner.txHash); size += FfiConverterOptionalTypeTokenTransactionType.allocationSize( inner.txType ); return size; } case PaymentDetailsFilter_Tags.Lightning: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterOptionalArrayTypeSparkHtlcStatus.allocationSize( inner.htlcStatus ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); export enum PaymentMethod { Lightning, Spark, Token, Deposit, Withdraw, Unknown, } const FfiConverterTypePaymentMethod = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = PaymentMethod; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return PaymentMethod.Lightning; case 2: return PaymentMethod.Spark; case 3: return PaymentMethod.Token; case 4: return PaymentMethod.Deposit; case 5: return PaymentMethod.Withdraw; case 6: return PaymentMethod.Unknown; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case PaymentMethod.Lightning: return ordinalConverter.write(1, into); case PaymentMethod.Spark: return ordinalConverter.write(2, into); case PaymentMethod.Token: return ordinalConverter.write(3, into); case PaymentMethod.Deposit: return ordinalConverter.write(4, into); case PaymentMethod.Withdraw: return ordinalConverter.write(5, into); case PaymentMethod.Unknown: return ordinalConverter.write(6, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Error type: PaymentObserverError // Enum: PaymentObserverError export enum PaymentObserverError_Tags { ServiceConnectivity = 'ServiceConnectivity', Generic = 'Generic', } export const PaymentObserverError = (() => { type ServiceConnectivity__interface = { tag: PaymentObserverError_Tags.ServiceConnectivity; inner: Readonly<[string]>; }; class ServiceConnectivity_ extends UniffiError implements ServiceConnectivity__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PaymentObserverError'; readonly tag = PaymentObserverError_Tags.ServiceConnectivity; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PaymentObserverError', 'ServiceConnectivity'); this.inner = Object.freeze([v0]); } static new(v0: string): ServiceConnectivity_ { return new ServiceConnectivity_(v0); } static instanceOf(obj: any): obj is ServiceConnectivity_ { return obj.tag === PaymentObserverError_Tags.ServiceConnectivity; } static hasInner(obj: any): obj is ServiceConnectivity_ { return ServiceConnectivity_.instanceOf(obj); } static getInner(obj: ServiceConnectivity_): Readonly<[string]> { return obj.inner; } } type Generic__interface = { tag: PaymentObserverError_Tags.Generic; inner: Readonly<[string]>; }; class Generic_ extends UniffiError implements Generic__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PaymentObserverError'; readonly tag = PaymentObserverError_Tags.Generic; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PaymentObserverError', 'Generic'); this.inner = Object.freeze([v0]); } static new(v0: string): Generic_ { return new Generic_(v0); } static instanceOf(obj: any): obj is Generic_ { return obj.tag === PaymentObserverError_Tags.Generic; } static hasInner(obj: any): obj is Generic_ { return Generic_.instanceOf(obj); } static getInner(obj: Generic_): Readonly<[string]> { return obj.inner; } } function instanceOf(obj: any): obj is PaymentObserverError { return obj[uniffiTypeNameSymbol] === 'PaymentObserverError'; } return Object.freeze({ instanceOf, ServiceConnectivity: ServiceConnectivity_, Generic: Generic_, }); })(); export type PaymentObserverError = InstanceType< (typeof PaymentObserverError)[keyof Omit< typeof PaymentObserverError, 'instanceOf' >] >; // FfiConverter for enum PaymentObserverError const FfiConverterTypePaymentObserverError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = PaymentObserverError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new PaymentObserverError.ServiceConnectivity( FfiConverterString.read(from) ); case 2: return new PaymentObserverError.Generic( FfiConverterString.read(from) ); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case PaymentObserverError_Tags.ServiceConnectivity: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case PaymentObserverError_Tags.Generic: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } default: // Throwing from here means that PaymentObserverError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case PaymentObserverError_Tags.ServiceConnectivity: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner[0]); return size; } case PaymentObserverError_Tags.Generic: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: PaymentRequest export enum PaymentRequest_Tags { Input = 'Input', CrossChain = 'CrossChain', } /** * The payment destination. Either a raw string (bolt11, spark address, BIP-21, * cross-chain URI, etc.) that is parsed internally, or a structured * cross-chain destination with explicit chain + asset selection. */ export const PaymentRequest = (() => { type Input__interface = { tag: PaymentRequest_Tags.Input; inner: Readonly<{ input: string }>; }; /** * Unparsed user input string (bolt11, spark address, BIP-21, cross-chain URI, etc.) */ class Input_ extends UniffiEnum implements Input__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PaymentRequest'; readonly tag = PaymentRequest_Tags.Input; readonly inner: Readonly<{ input: string }>; constructor(inner: { input: string }) { super('PaymentRequest', 'Input'); this.inner = Object.freeze(inner); } static new(inner: { input: string }): Input_ { return new Input_(inner); } static instanceOf(obj: any): obj is Input_ { return obj.tag === PaymentRequest_Tags.Input; } } type CrossChain__interface = { tag: PaymentRequest_Tags.CrossChain; inner: Readonly<{ address: string; route: CrossChainRoutePair; maxSlippageBps: /*u32*/ number | undefined; targetOverpayBps: /*u32*/ number | undefined; }>; }; /** * Cross-chain send with a selected route from `get_cross_chain_routes()`. * Amount comes from `PrepareSendPaymentRequest.amount`, not here. */ class CrossChain_ extends UniffiEnum implements CrossChain__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PaymentRequest'; readonly tag = PaymentRequest_Tags.CrossChain; readonly inner: Readonly<{ address: string; route: CrossChainRoutePair; maxSlippageBps: /*u32*/ number | undefined; targetOverpayBps: /*u32*/ number | undefined; }>; constructor(inner: { address: string; route: CrossChainRoutePair; /** * Maximum slippage tolerance in basis points (1/100 of a percent) * for the cross-chain quote. Must be in 10 to 500. Falls back to * [`Config::default_slippage_bps`] when unset, which itself * defaults to 100 bps (1%). */ maxSlippageBps: /*u32*/ number | undefined; /** * Target-overpay pad in basis points applied on `FeesExcluded` * conversion sends. Inflates the destination target before quoting * so the recipient lands at or above the user's requested amount * despite provider slippage. Must be in 0 to 500. Falls back to * [`CrossChainConfig::default_target_overpay_bps`] when unset, * which itself defaults to 15 bps. */ targetOverpayBps: /*u32*/ number | undefined; }) { super('PaymentRequest', 'CrossChain'); this.inner = Object.freeze(inner); } static new(inner: { address: string; route: CrossChainRoutePair; /** * Maximum slippage tolerance in basis points (1/100 of a percent) * for the cross-chain quote. Must be in 10 to 500. Falls back to * [`Config::default_slippage_bps`] when unset, which itself * defaults to 100 bps (1%). */ maxSlippageBps: /*u32*/ number | undefined; /** * Target-overpay pad in basis points applied on `FeesExcluded` * conversion sends. Inflates the destination target before quoting * so the recipient lands at or above the user's requested amount * despite provider slippage. Must be in 0 to 500. Falls back to * [`CrossChainConfig::default_target_overpay_bps`] when unset, * which itself defaults to 15 bps. */ targetOverpayBps: /*u32*/ number | undefined; }): CrossChain_ { return new CrossChain_(inner); } static instanceOf(obj: any): obj is CrossChain_ { return obj.tag === PaymentRequest_Tags.CrossChain; } } function instanceOf(obj: any): obj is PaymentRequest { return obj[uniffiTypeNameSymbol] === 'PaymentRequest'; } return Object.freeze({ instanceOf, Input: Input_, CrossChain: CrossChain_, }); })(); /** * The payment destination. Either a raw string (bolt11, spark address, BIP-21, * cross-chain URI, etc.) that is parsed internally, or a structured * cross-chain destination with explicit chain + asset selection. */ export type PaymentRequest = InstanceType< (typeof PaymentRequest)[keyof Omit] >; // FfiConverter for enum PaymentRequest const FfiConverterTypePaymentRequest = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = PaymentRequest; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new PaymentRequest.Input({ input: FfiConverterString.read(from), }); case 2: return new PaymentRequest.CrossChain({ address: FfiConverterString.read(from), route: FfiConverterTypeCrossChainRoutePair.read(from), maxSlippageBps: FfiConverterOptionalUInt32.read(from), targetOverpayBps: FfiConverterOptionalUInt32.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case PaymentRequest_Tags.Input: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.input, into); return; } case PaymentRequest_Tags.CrossChain: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.address, into); FfiConverterTypeCrossChainRoutePair.write(inner.route, into); FfiConverterOptionalUInt32.write(inner.maxSlippageBps, into); FfiConverterOptionalUInt32.write(inner.targetOverpayBps, into); return; } default: // Throwing from here means that PaymentRequest_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case PaymentRequest_Tags.Input: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.input); return size; } case PaymentRequest_Tags.CrossChain: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.address); size += FfiConverterTypeCrossChainRoutePair.allocationSize( inner.route ); size += FfiConverterOptionalUInt32.allocationSize( inner.maxSlippageBps ); size += FfiConverterOptionalUInt32.allocationSize( inner.targetOverpayBps ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * The status of a payment */ export enum PaymentStatus { /** * Payment is completed successfully */ Completed, /** * Payment is in progress */ Pending, /** * Payment has failed */ Failed, } const FfiConverterTypePaymentStatus = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = PaymentStatus; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return PaymentStatus.Completed; case 2: return PaymentStatus.Pending; case 3: return PaymentStatus.Failed; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case PaymentStatus.Completed: return ordinalConverter.write(1, into); case PaymentStatus.Pending: return ordinalConverter.write(2, into); case PaymentStatus.Failed: return ordinalConverter.write(3, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); /** * The type of payment */ export enum PaymentType { /** * Payment sent from this wallet */ Send, /** * Payment received to this wallet */ Receive, } const FfiConverterTypePaymentType = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = PaymentType; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return PaymentType.Send; case 2: return PaymentType.Receive; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case PaymentType.Send: return ordinalConverter.write(1, into); case PaymentType.Receive: return ordinalConverter.write(2, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Error type: PrfProviderError // Enum: PrfProviderError export enum PrfProviderError_Tags { PrfNotSupported = 'PrfNotSupported', UserCancelled = 'UserCancelled', UserTimedOut = 'UserTimedOut', CredentialNotFound = 'CredentialNotFound', AuthenticationFailed = 'AuthenticationFailed', PrfEvaluationFailed = 'PrfEvaluationFailed', Configuration = 'Configuration', CredentialAlreadyExists = 'CredentialAlreadyExists', Generic = 'Generic', } /** * Failures from a passkey PRF operation. Each platform normalizes its * native errors into these variants so callers match one taxonomy * everywhere; anything unclassifiable becomes [`Generic`](Self::Generic). */ export const PrfProviderError = (() => { type PrfNotSupported__interface = { tag: PrfProviderError_Tags.PrfNotSupported; }; class PrfNotSupported_ extends UniffiError implements PrfNotSupported__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PrfProviderError'; readonly tag = PrfProviderError_Tags.PrfNotSupported; constructor() { super('PrfProviderError', 'PrfNotSupported'); } static new(): PrfNotSupported_ { return new PrfNotSupported_(); } static instanceOf(obj: any): obj is PrfNotSupported_ { return obj.tag === PrfProviderError_Tags.PrfNotSupported; } static hasInner(obj: any): obj is PrfNotSupported_ { return false; } } type UserCancelled__interface = { tag: PrfProviderError_Tags.UserCancelled; }; class UserCancelled_ extends UniffiError implements UserCancelled__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PrfProviderError'; readonly tag = PrfProviderError_Tags.UserCancelled; constructor() { super('PrfProviderError', 'UserCancelled'); } static new(): UserCancelled_ { return new UserCancelled_(); } static instanceOf(obj: any): obj is UserCancelled_ { return obj.tag === PrfProviderError_Tags.UserCancelled; } static hasInner(obj: any): obj is UserCancelled_ { return false; } } type UserTimedOut__interface = { tag: PrfProviderError_Tags.UserTimedOut; }; /** * The prompt closed on the platform inactivity timeout, with no * user action. Unlike `UserCancelled`, safe to auto-retry. */ class UserTimedOut_ extends UniffiError implements UserTimedOut__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PrfProviderError'; readonly tag = PrfProviderError_Tags.UserTimedOut; constructor() { super('PrfProviderError', 'UserTimedOut'); } static new(): UserTimedOut_ { return new UserTimedOut_(); } static instanceOf(obj: any): obj is UserTimedOut_ { return obj.tag === PrfProviderError_Tags.UserTimedOut; } static hasInner(obj: any): obj is UserTimedOut_ { return false; } } type CredentialNotFound__interface = { tag: PrfProviderError_Tags.CredentialNotFound; inner: Readonly<[string]>; }; class CredentialNotFound_ extends UniffiError implements CredentialNotFound__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PrfProviderError'; readonly tag = PrfProviderError_Tags.CredentialNotFound; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PrfProviderError', 'CredentialNotFound'); this.inner = Object.freeze([v0]); } static new(v0: string): CredentialNotFound_ { return new CredentialNotFound_(v0); } static instanceOf(obj: any): obj is CredentialNotFound_ { return obj.tag === PrfProviderError_Tags.CredentialNotFound; } static hasInner(obj: any): obj is CredentialNotFound_ { return CredentialNotFound_.instanceOf(obj); } static getInner(obj: CredentialNotFound_): Readonly<[string]> { return obj.inner; } } type AuthenticationFailed__interface = { tag: PrfProviderError_Tags.AuthenticationFailed; inner: Readonly<[string]>; }; class AuthenticationFailed_ extends UniffiError implements AuthenticationFailed__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PrfProviderError'; readonly tag = PrfProviderError_Tags.AuthenticationFailed; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PrfProviderError', 'AuthenticationFailed'); this.inner = Object.freeze([v0]); } static new(v0: string): AuthenticationFailed_ { return new AuthenticationFailed_(v0); } static instanceOf(obj: any): obj is AuthenticationFailed_ { return obj.tag === PrfProviderError_Tags.AuthenticationFailed; } static hasInner(obj: any): obj is AuthenticationFailed_ { return AuthenticationFailed_.instanceOf(obj); } static getInner(obj: AuthenticationFailed_): Readonly<[string]> { return obj.inner; } } type PrfEvaluationFailed__interface = { tag: PrfProviderError_Tags.PrfEvaluationFailed; inner: Readonly<[string]>; }; class PrfEvaluationFailed_ extends UniffiError implements PrfEvaluationFailed__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PrfProviderError'; readonly tag = PrfProviderError_Tags.PrfEvaluationFailed; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PrfProviderError', 'PrfEvaluationFailed'); this.inner = Object.freeze([v0]); } static new(v0: string): PrfEvaluationFailed_ { return new PrfEvaluationFailed_(v0); } static instanceOf(obj: any): obj is PrfEvaluationFailed_ { return obj.tag === PrfProviderError_Tags.PrfEvaluationFailed; } static hasInner(obj: any): obj is PrfEvaluationFailed_ { return PrfEvaluationFailed_.instanceOf(obj); } static getInner(obj: PrfEvaluationFailed_): Readonly<[string]> { return obj.inner; } } type Configuration__interface = { tag: PrfProviderError_Tags.Configuration; inner: Readonly<[string]>; }; /** * Platform / app setup is wrong: missing AASA entitlement, invalid * assetlinks.json, or misconfigured RP ID. */ class Configuration_ extends UniffiError implements Configuration__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PrfProviderError'; readonly tag = PrfProviderError_Tags.Configuration; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PrfProviderError', 'Configuration'); this.inner = Object.freeze([v0]); } static new(v0: string): Configuration_ { return new Configuration_(v0); } static instanceOf(obj: any): obj is Configuration_ { return obj.tag === PrfProviderError_Tags.Configuration; } static hasInner(obj: any): obj is Configuration_ { return Configuration_.instanceOf(obj); } static getInner(obj: Configuration_): Readonly<[string]> { return obj.inner; } } type CredentialAlreadyExists__interface = { tag: PrfProviderError_Tags.CredentialAlreadyExists; inner: Readonly<[string]>; }; /** * An existing credential matched. Route the user to sign-in. */ class CredentialAlreadyExists_ extends UniffiError implements CredentialAlreadyExists__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PrfProviderError'; readonly tag = PrfProviderError_Tags.CredentialAlreadyExists; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PrfProviderError', 'CredentialAlreadyExists'); this.inner = Object.freeze([v0]); } static new(v0: string): CredentialAlreadyExists_ { return new CredentialAlreadyExists_(v0); } static instanceOf(obj: any): obj is CredentialAlreadyExists_ { return obj.tag === PrfProviderError_Tags.CredentialAlreadyExists; } static hasInner(obj: any): obj is CredentialAlreadyExists_ { return CredentialAlreadyExists_.instanceOf(obj); } static getInner(obj: CredentialAlreadyExists_): Readonly<[string]> { return obj.inner; } } type Generic__interface = { tag: PrfProviderError_Tags.Generic; inner: Readonly<[string]>; }; class Generic_ extends UniffiError implements Generic__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PrfProviderError'; readonly tag = PrfProviderError_Tags.Generic; readonly inner: Readonly<[string]>; constructor(v0: string) { super('PrfProviderError', 'Generic'); this.inner = Object.freeze([v0]); } static new(v0: string): Generic_ { return new Generic_(v0); } static instanceOf(obj: any): obj is Generic_ { return obj.tag === PrfProviderError_Tags.Generic; } static hasInner(obj: any): obj is Generic_ { return Generic_.instanceOf(obj); } static getInner(obj: Generic_): Readonly<[string]> { return obj.inner; } } function instanceOf(obj: any): obj is PrfProviderError { return obj[uniffiTypeNameSymbol] === 'PrfProviderError'; } return Object.freeze({ instanceOf, PrfNotSupported: PrfNotSupported_, UserCancelled: UserCancelled_, UserTimedOut: UserTimedOut_, CredentialNotFound: CredentialNotFound_, AuthenticationFailed: AuthenticationFailed_, PrfEvaluationFailed: PrfEvaluationFailed_, Configuration: Configuration_, CredentialAlreadyExists: CredentialAlreadyExists_, Generic: Generic_, }); })(); /** * Failures from a passkey PRF operation. Each platform normalizes its * native errors into these variants so callers match one taxonomy * everywhere; anything unclassifiable becomes [`Generic`](Self::Generic). */ export type PrfProviderError = InstanceType< (typeof PrfProviderError)[keyof Omit] >; // FfiConverter for enum PrfProviderError const FfiConverterTypePrfProviderError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = PrfProviderError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new PrfProviderError.PrfNotSupported(); case 2: return new PrfProviderError.UserCancelled(); case 3: return new PrfProviderError.UserTimedOut(); case 4: return new PrfProviderError.CredentialNotFound( FfiConverterString.read(from) ); case 5: return new PrfProviderError.AuthenticationFailed( FfiConverterString.read(from) ); case 6: return new PrfProviderError.PrfEvaluationFailed( FfiConverterString.read(from) ); case 7: return new PrfProviderError.Configuration( FfiConverterString.read(from) ); case 8: return new PrfProviderError.CredentialAlreadyExists( FfiConverterString.read(from) ); case 9: return new PrfProviderError.Generic(FfiConverterString.read(from)); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case PrfProviderError_Tags.PrfNotSupported: { ordinalConverter.write(1, into); return; } case PrfProviderError_Tags.UserCancelled: { ordinalConverter.write(2, into); return; } case PrfProviderError_Tags.UserTimedOut: { ordinalConverter.write(3, into); return; } case PrfProviderError_Tags.CredentialNotFound: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case PrfProviderError_Tags.AuthenticationFailed: { ordinalConverter.write(5, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case PrfProviderError_Tags.PrfEvaluationFailed: { ordinalConverter.write(6, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case PrfProviderError_Tags.Configuration: { ordinalConverter.write(7, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case PrfProviderError_Tags.CredentialAlreadyExists: { ordinalConverter.write(8, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case PrfProviderError_Tags.Generic: { ordinalConverter.write(9, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } default: // Throwing from here means that PrfProviderError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case PrfProviderError_Tags.PrfNotSupported: { return ordinalConverter.allocationSize(1); } case PrfProviderError_Tags.UserCancelled: { return ordinalConverter.allocationSize(2); } case PrfProviderError_Tags.UserTimedOut: { return ordinalConverter.allocationSize(3); } case PrfProviderError_Tags.CredentialNotFound: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterString.allocationSize(inner[0]); return size; } case PrfProviderError_Tags.AuthenticationFailed: { const inner = value.inner; let size = ordinalConverter.allocationSize(5); size += FfiConverterString.allocationSize(inner[0]); return size; } case PrfProviderError_Tags.PrfEvaluationFailed: { const inner = value.inner; let size = ordinalConverter.allocationSize(6); size += FfiConverterString.allocationSize(inner[0]); return size; } case PrfProviderError_Tags.Configuration: { const inner = value.inner; let size = ordinalConverter.allocationSize(7); size += FfiConverterString.allocationSize(inner[0]); return size; } case PrfProviderError_Tags.CredentialAlreadyExists: { const inner = value.inner; let size = ordinalConverter.allocationSize(8); size += FfiConverterString.allocationSize(inner[0]); return size; } case PrfProviderError_Tags.Generic: { const inner = value.inner; let size = ordinalConverter.allocationSize(9); size += FfiConverterString.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: ProvisionalPaymentDetails export enum ProvisionalPaymentDetails_Tags { Bitcoin = 'Bitcoin', Lightning = 'Lightning', Spark = 'Spark', Token = 'Token', } export const ProvisionalPaymentDetails = (() => { type Bitcoin__interface = { tag: ProvisionalPaymentDetails_Tags.Bitcoin; inner: Readonly<{ withdrawalAddress: string }>; }; class Bitcoin_ extends UniffiEnum implements Bitcoin__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ProvisionalPaymentDetails'; readonly tag = ProvisionalPaymentDetails_Tags.Bitcoin; readonly inner: Readonly<{ withdrawalAddress: string }>; constructor(inner: { /** * Onchain Bitcoin address */ withdrawalAddress: string; }) { super('ProvisionalPaymentDetails', 'Bitcoin'); this.inner = Object.freeze(inner); } static new(inner: { /** * Onchain Bitcoin address */ withdrawalAddress: string; }): Bitcoin_ { return new Bitcoin_(inner); } static instanceOf(obj: any): obj is Bitcoin_ { return obj.tag === ProvisionalPaymentDetails_Tags.Bitcoin; } } type Lightning__interface = { tag: ProvisionalPaymentDetails_Tags.Lightning; inner: Readonly<{ invoice: string }>; }; class Lightning_ extends UniffiEnum implements Lightning__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ProvisionalPaymentDetails'; readonly tag = ProvisionalPaymentDetails_Tags.Lightning; readonly inner: Readonly<{ invoice: string }>; constructor(inner: { /** * BOLT11 invoice */ invoice: string; }) { super('ProvisionalPaymentDetails', 'Lightning'); this.inner = Object.freeze(inner); } static new(inner: { /** * BOLT11 invoice */ invoice: string; }): Lightning_ { return new Lightning_(inner); } static instanceOf(obj: any): obj is Lightning_ { return obj.tag === ProvisionalPaymentDetails_Tags.Lightning; } } type Spark__interface = { tag: ProvisionalPaymentDetails_Tags.Spark; inner: Readonly<{ payRequest: string }>; }; class Spark_ extends UniffiEnum implements Spark__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ProvisionalPaymentDetails'; readonly tag = ProvisionalPaymentDetails_Tags.Spark; readonly inner: Readonly<{ payRequest: string }>; constructor(inner: { /** * Spark pay request being paid (either a Spark address or a Spark invoice) */ payRequest: string; }) { super('ProvisionalPaymentDetails', 'Spark'); this.inner = Object.freeze(inner); } static new(inner: { /** * Spark pay request being paid (either a Spark address or a Spark invoice) */ payRequest: string; }): Spark_ { return new Spark_(inner); } static instanceOf(obj: any): obj is Spark_ { return obj.tag === ProvisionalPaymentDetails_Tags.Spark; } } type Token__interface = { tag: ProvisionalPaymentDetails_Tags.Token; inner: Readonly<{ tokenId: string; payRequest: string }>; }; class Token_ extends UniffiEnum implements Token__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ProvisionalPaymentDetails'; readonly tag = ProvisionalPaymentDetails_Tags.Token; readonly inner: Readonly<{ tokenId: string; payRequest: string }>; constructor(inner: { /** * Token identifier */ tokenId: string; /** * Spark pay request being paid (either a Spark address or a Spark invoice) */ payRequest: string; }) { super('ProvisionalPaymentDetails', 'Token'); this.inner = Object.freeze(inner); } static new(inner: { /** * Token identifier */ tokenId: string; /** * Spark pay request being paid (either a Spark address or a Spark invoice) */ payRequest: string; }): Token_ { return new Token_(inner); } static instanceOf(obj: any): obj is Token_ { return obj.tag === ProvisionalPaymentDetails_Tags.Token; } } function instanceOf(obj: any): obj is ProvisionalPaymentDetails { return obj[uniffiTypeNameSymbol] === 'ProvisionalPaymentDetails'; } return Object.freeze({ instanceOf, Bitcoin: Bitcoin_, Lightning: Lightning_, Spark: Spark_, Token: Token_, }); })(); export type ProvisionalPaymentDetails = InstanceType< (typeof ProvisionalPaymentDetails)[keyof Omit< typeof ProvisionalPaymentDetails, 'instanceOf' >] >; // FfiConverter for enum ProvisionalPaymentDetails const FfiConverterTypeProvisionalPaymentDetails = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ProvisionalPaymentDetails; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ProvisionalPaymentDetails.Bitcoin({ withdrawalAddress: FfiConverterString.read(from), }); case 2: return new ProvisionalPaymentDetails.Lightning({ invoice: FfiConverterString.read(from), }); case 3: return new ProvisionalPaymentDetails.Spark({ payRequest: FfiConverterString.read(from), }); case 4: return new ProvisionalPaymentDetails.Token({ tokenId: FfiConverterString.read(from), payRequest: FfiConverterString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ProvisionalPaymentDetails_Tags.Bitcoin: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.withdrawalAddress, into); return; } case ProvisionalPaymentDetails_Tags.Lightning: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.invoice, into); return; } case ProvisionalPaymentDetails_Tags.Spark: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner.payRequest, into); return; } case ProvisionalPaymentDetails_Tags.Token: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterString.write(inner.tokenId, into); FfiConverterString.write(inner.payRequest, into); return; } default: // Throwing from here means that ProvisionalPaymentDetails_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ProvisionalPaymentDetails_Tags.Bitcoin: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.withdrawalAddress); return size; } case ProvisionalPaymentDetails_Tags.Lightning: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.invoice); return size; } case ProvisionalPaymentDetails_Tags.Spark: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner.payRequest); return size; } case ProvisionalPaymentDetails_Tags.Token: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterString.allocationSize(inner.tokenId); size += FfiConverterString.allocationSize(inner.payRequest); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: PublishSignedLnurlPayResponse export enum PublishSignedLnurlPayResponse_Tags { SwapCompleted = 'SwapCompleted', PaymentSent = 'PaymentSent', } export const PublishSignedLnurlPayResponse = (() => { type SwapCompleted__interface = { tag: PublishSignedLnurlPayResponse_Tags.SwapCompleted; }; class SwapCompleted_ extends UniffiEnum implements SwapCompleted__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PublishSignedLnurlPayResponse'; readonly tag = PublishSignedLnurlPayResponse_Tags.SwapCompleted; constructor() { super('PublishSignedLnurlPayResponse', 'SwapCompleted'); } static new(): SwapCompleted_ { return new SwapCompleted_(); } static instanceOf(obj: any): obj is SwapCompleted_ { return obj.tag === PublishSignedLnurlPayResponse_Tags.SwapCompleted; } } type PaymentSent__interface = { tag: PublishSignedLnurlPayResponse_Tags.PaymentSent; inner: Readonly<{ response: LnurlPayResponse }>; }; class PaymentSent_ extends UniffiEnum implements PaymentSent__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PublishSignedLnurlPayResponse'; readonly tag = PublishSignedLnurlPayResponse_Tags.PaymentSent; readonly inner: Readonly<{ response: LnurlPayResponse }>; constructor(inner: { response: LnurlPayResponse }) { super('PublishSignedLnurlPayResponse', 'PaymentSent'); this.inner = Object.freeze(inner); } static new(inner: { response: LnurlPayResponse }): PaymentSent_ { return new PaymentSent_(inner); } static instanceOf(obj: any): obj is PaymentSent_ { return obj.tag === PublishSignedLnurlPayResponse_Tags.PaymentSent; } } function instanceOf(obj: any): obj is PublishSignedLnurlPayResponse { return obj[uniffiTypeNameSymbol] === 'PublishSignedLnurlPayResponse'; } return Object.freeze({ instanceOf, SwapCompleted: SwapCompleted_, PaymentSent: PaymentSent_, }); })(); export type PublishSignedLnurlPayResponse = InstanceType< (typeof PublishSignedLnurlPayResponse)[keyof Omit< typeof PublishSignedLnurlPayResponse, 'instanceOf' >] >; // FfiConverter for enum PublishSignedLnurlPayResponse const FfiConverterTypePublishSignedLnurlPayResponse = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = PublishSignedLnurlPayResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new PublishSignedLnurlPayResponse.SwapCompleted(); case 2: return new PublishSignedLnurlPayResponse.PaymentSent({ response: FfiConverterTypeLnurlPayResponse.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case PublishSignedLnurlPayResponse_Tags.SwapCompleted: { ordinalConverter.write(1, into); return; } case PublishSignedLnurlPayResponse_Tags.PaymentSent: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeLnurlPayResponse.write(inner.response, into); return; } default: // Throwing from here means that PublishSignedLnurlPayResponse_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case PublishSignedLnurlPayResponse_Tags.SwapCompleted: { return ordinalConverter.allocationSize(1); } case PublishSignedLnurlPayResponse_Tags.PaymentSent: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeLnurlPayResponse.allocationSize( inner.response ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: PublishSignedTransferPackageResponse export enum PublishSignedTransferPackageResponse_Tags { SwapCompleted = 'SwapCompleted', PaymentSent = 'PaymentSent', PaymentsSent = 'PaymentsSent', } export const PublishSignedTransferPackageResponse = (() => { type SwapCompleted__interface = { tag: PublishSignedTransferPackageResponse_Tags.SwapCompleted; }; class SwapCompleted_ extends UniffiEnum implements SwapCompleted__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PublishSignedTransferPackageResponse'; readonly tag = PublishSignedTransferPackageResponse_Tags.SwapCompleted; constructor() { super('PublishSignedTransferPackageResponse', 'SwapCompleted'); } static new(): SwapCompleted_ { return new SwapCompleted_(); } static instanceOf(obj: any): obj is SwapCompleted_ { return ( obj.tag === PublishSignedTransferPackageResponse_Tags.SwapCompleted ); } } type PaymentSent__interface = { tag: PublishSignedTransferPackageResponse_Tags.PaymentSent; inner: Readonly<{ payment: Payment }>; }; class PaymentSent_ extends UniffiEnum implements PaymentSent__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PublishSignedTransferPackageResponse'; readonly tag = PublishSignedTransferPackageResponse_Tags.PaymentSent; readonly inner: Readonly<{ payment: Payment }>; constructor(inner: { payment: Payment }) { super('PublishSignedTransferPackageResponse', 'PaymentSent'); this.inner = Object.freeze(inner); } static new(inner: { payment: Payment }): PaymentSent_ { return new PaymentSent_(inner); } static instanceOf(obj: any): obj is PaymentSent_ { return obj.tag === PublishSignedTransferPackageResponse_Tags.PaymentSent; } } type PaymentsSent__interface = { tag: PublishSignedTransferPackageResponse_Tags.PaymentsSent; inner: Readonly<{ payments: Array }>; }; /** * Returned for a batch package: one payment per recipient, in recipient * order. */ class PaymentsSent_ extends UniffiEnum implements PaymentsSent__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'PublishSignedTransferPackageResponse'; readonly tag = PublishSignedTransferPackageResponse_Tags.PaymentsSent; readonly inner: Readonly<{ payments: Array }>; constructor(inner: { payments: Array }) { super('PublishSignedTransferPackageResponse', 'PaymentsSent'); this.inner = Object.freeze(inner); } static new(inner: { payments: Array }): PaymentsSent_ { return new PaymentsSent_(inner); } static instanceOf(obj: any): obj is PaymentsSent_ { return obj.tag === PublishSignedTransferPackageResponse_Tags.PaymentsSent; } } function instanceOf(obj: any): obj is PublishSignedTransferPackageResponse { return obj[uniffiTypeNameSymbol] === 'PublishSignedTransferPackageResponse'; } return Object.freeze({ instanceOf, SwapCompleted: SwapCompleted_, PaymentSent: PaymentSent_, PaymentsSent: PaymentsSent_, }); })(); export type PublishSignedTransferPackageResponse = InstanceType< (typeof PublishSignedTransferPackageResponse)[keyof Omit< typeof PublishSignedTransferPackageResponse, 'instanceOf' >] >; // FfiConverter for enum PublishSignedTransferPackageResponse const FfiConverterTypePublishSignedTransferPackageResponse = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = PublishSignedTransferPackageResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new PublishSignedTransferPackageResponse.SwapCompleted(); case 2: return new PublishSignedTransferPackageResponse.PaymentSent({ payment: FfiConverterTypePayment.read(from), }); case 3: return new PublishSignedTransferPackageResponse.PaymentsSent({ payments: FfiConverterArrayTypePayment.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case PublishSignedTransferPackageResponse_Tags.SwapCompleted: { ordinalConverter.write(1, into); return; } case PublishSignedTransferPackageResponse_Tags.PaymentSent: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypePayment.write(inner.payment, into); return; } case PublishSignedTransferPackageResponse_Tags.PaymentsSent: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterArrayTypePayment.write(inner.payments, into); return; } default: // Throwing from here means that PublishSignedTransferPackageResponse_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case PublishSignedTransferPackageResponse_Tags.SwapCompleted: { return ordinalConverter.allocationSize(1); } case PublishSignedTransferPackageResponse_Tags.PaymentSent: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypePayment.allocationSize(inner.payment); return size; } case PublishSignedTransferPackageResponse_Tags.PaymentsSent: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterArrayTypePayment.allocationSize(inner.payments); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: ReceivePaymentMethod export enum ReceivePaymentMethod_Tags { SparkAddress = 'SparkAddress', SparkInvoice = 'SparkInvoice', BitcoinAddress = 'BitcoinAddress', Bolt11Invoice = 'Bolt11Invoice', CrossChain = 'CrossChain', } export const ReceivePaymentMethod = (() => { type SparkAddress__interface = { tag: ReceivePaymentMethod_Tags.SparkAddress; }; class SparkAddress_ extends UniffiEnum implements SparkAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ReceivePaymentMethod'; readonly tag = ReceivePaymentMethod_Tags.SparkAddress; constructor() { super('ReceivePaymentMethod', 'SparkAddress'); } static new(): SparkAddress_ { return new SparkAddress_(); } static instanceOf(obj: any): obj is SparkAddress_ { return obj.tag === ReceivePaymentMethod_Tags.SparkAddress; } } type SparkInvoice__interface = { tag: ReceivePaymentMethod_Tags.SparkInvoice; inner: Readonly<{ amount: U128 | undefined; tokenIdentifier: string | undefined; expiryTime: /*u64*/ bigint | undefined; description: string | undefined; senderPublicKey: string | undefined; }>; }; class SparkInvoice_ extends UniffiEnum implements SparkInvoice__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ReceivePaymentMethod'; readonly tag = ReceivePaymentMethod_Tags.SparkInvoice; readonly inner: Readonly<{ amount: U128 | undefined; tokenIdentifier: string | undefined; expiryTime: /*u64*/ bigint | undefined; description: string | undefined; senderPublicKey: string | undefined; }>; constructor(inner: { /** * Amount to receive. Denominated in sats if token identifier is empty, otherwise in the token base units */ amount: U128 | undefined; /** * The presence of this field indicates that the payment is for a token * If empty, it is a Bitcoin payment */ tokenIdentifier: string | undefined; /** * The expiry time of the invoice as a unix timestamp in seconds */ expiryTime: /*u64*/ bigint | undefined; /** * A description to embed in the invoice. */ description: string | undefined; /** * If set, the invoice may only be fulfilled by a payer with this public key */ senderPublicKey: string | undefined; }) { super('ReceivePaymentMethod', 'SparkInvoice'); this.inner = Object.freeze(inner); } static new(inner: { /** * Amount to receive. Denominated in sats if token identifier is empty, otherwise in the token base units */ amount: U128 | undefined; /** * The presence of this field indicates that the payment is for a token * If empty, it is a Bitcoin payment */ tokenIdentifier: string | undefined; /** * The expiry time of the invoice as a unix timestamp in seconds */ expiryTime: /*u64*/ bigint | undefined; /** * A description to embed in the invoice. */ description: string | undefined; /** * If set, the invoice may only be fulfilled by a payer with this public key */ senderPublicKey: string | undefined; }): SparkInvoice_ { return new SparkInvoice_(inner); } static instanceOf(obj: any): obj is SparkInvoice_ { return obj.tag === ReceivePaymentMethod_Tags.SparkInvoice; } } type BitcoinAddress__interface = { tag: ReceivePaymentMethod_Tags.BitcoinAddress; inner: Readonly<{ newAddress: boolean | undefined }>; }; class BitcoinAddress_ extends UniffiEnum implements BitcoinAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ReceivePaymentMethod'; readonly tag = ReceivePaymentMethod_Tags.BitcoinAddress; readonly inner: Readonly<{ newAddress: boolean | undefined }>; constructor(inner: { /** * If true, rotate to a new deposit address. Previous ones remain valid. * If false or absent, return the existing address (creating one if none * exists yet). */ newAddress: boolean | undefined; }) { super('ReceivePaymentMethod', 'BitcoinAddress'); this.inner = Object.freeze(inner); } static new(inner: { /** * If true, rotate to a new deposit address. Previous ones remain valid. * If false or absent, return the existing address (creating one if none * exists yet). */ newAddress: boolean | undefined; }): BitcoinAddress_ { return new BitcoinAddress_(inner); } static instanceOf(obj: any): obj is BitcoinAddress_ { return obj.tag === ReceivePaymentMethod_Tags.BitcoinAddress; } } type Bolt11Invoice__interface = { tag: ReceivePaymentMethod_Tags.Bolt11Invoice; inner: Readonly<{ description: string; amountSats: /*u64*/ bigint | undefined; expirySecs: /*u32*/ number | undefined; paymentHash: string | undefined; receiverIdentityPublicKey: string | undefined; }>; }; class Bolt11Invoice_ extends UniffiEnum implements Bolt11Invoice__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ReceivePaymentMethod'; readonly tag = ReceivePaymentMethod_Tags.Bolt11Invoice; readonly inner: Readonly<{ description: string; amountSats: /*u64*/ bigint | undefined; expirySecs: /*u32*/ number | undefined; paymentHash: string | undefined; receiverIdentityPublicKey: string | undefined; }>; constructor(inner: { description: string; amountSats: /*u64*/ bigint | undefined; /** * The expiry of the invoice as a duration in seconds */ expirySecs: /*u32*/ number | undefined; /** * If set, creates a HODL invoice with this payment hash (hex-encoded). * The payer's HTLC will be held until the preimage is provided via * `claim_htlc_payment` or the HTLC expires. */ paymentHash: string | undefined; /** * Spark identity public key that will receive the payment. * If absent, the connected wallet's identity public key is used. */ receiverIdentityPublicKey: string | undefined; }) { super('ReceivePaymentMethod', 'Bolt11Invoice'); this.inner = Object.freeze(inner); } static new(inner: { description: string; amountSats: /*u64*/ bigint | undefined; /** * The expiry of the invoice as a duration in seconds */ expirySecs: /*u32*/ number | undefined; /** * If set, creates a HODL invoice with this payment hash (hex-encoded). * The payer's HTLC will be held until the preimage is provided via * `claim_htlc_payment` or the HTLC expires. */ paymentHash: string | undefined; /** * Spark identity public key that will receive the payment. * If absent, the connected wallet's identity public key is used. */ receiverIdentityPublicKey: string | undefined; }): Bolt11Invoice_ { return new Bolt11Invoice_(inner); } static instanceOf(obj: any): obj is Bolt11Invoice_ { return obj.tag === ReceivePaymentMethod_Tags.Bolt11Invoice; } } type CrossChain__interface = { tag: ReceivePaymentMethod_Tags.CrossChain; inner: Readonly<{ route: CrossChainRoutePair; amount: U128; destination: SparkAsset | undefined; feeMode: CrossChainFeeMode | undefined; maxSlippageBps: /*u32*/ number | undefined; targetOverpayBps: /*u32*/ number | undefined; }>; }; class CrossChain_ extends UniffiEnum implements CrossChain__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ReceivePaymentMethod'; readonly tag = ReceivePaymentMethod_Tags.CrossChain; readonly inner: Readonly<{ route: CrossChainRoutePair; amount: U128; destination: SparkAsset | undefined; feeMode: CrossChainFeeMode | undefined; maxSlippageBps: /*u32*/ number | undefined; targetOverpayBps: /*u32*/ number | undefined; }>; constructor(inner: { /** * The selected cross-chain route in the receive direction. */ route: CrossChainRoutePair; /** * The amount, in the source asset's base units (`route.decimals`). * USD-stable sources are at parity, so `1 USD = 10^route.decimals` * (e.g. `1_000_000` for 6-decimal USDC/USDT, `10^18` for 18-decimal * BSC USDC). * * - `FeesExcluded` (default): what the receiver ends up with, sized * as if `amount` source units were converted to the Spark-side * destination at parity (USDB) or the live BTC/USD rate (Bitcoin). * - `FeesIncluded`: what the sender deposits. The receiver ends up * with that amount minus provider fees. */ amount: U128; /** * Spark-side asset the receiver wants delivered. When absent, the * SDK auto-selects: the wallet's active stable-balance token if * the route supports it, otherwise Bitcoin (sats). When set, the * value must appear in the route's `accepted_assets`. */ destination: SparkAsset | undefined; /** * How `amount` should be interpreted. When absent, defaults to * `FeesExcluded`. */ feeMode: CrossChainFeeMode | undefined; /** * Maximum slippage in basis points. When absent, the SDK default * (100 bps) is used. */ maxSlippageBps: /*u32*/ number | undefined; /** * Per-request override for the overpay buffer applied to the * sender's deposit when `fee_mode == FeesExcluded`. Range 0 to 500. * When absent, falls back to `CrossChainConfig::default_target_overpay_bps` * then the built-in default (15 bps). Ignored when `fee_mode` * is `FeesIncluded`. */ targetOverpayBps: /*u32*/ number | undefined; }) { super('ReceivePaymentMethod', 'CrossChain'); this.inner = Object.freeze(inner); } static new(inner: { /** * The selected cross-chain route in the receive direction. */ route: CrossChainRoutePair; /** * The amount, in the source asset's base units (`route.decimals`). * USD-stable sources are at parity, so `1 USD = 10^route.decimals` * (e.g. `1_000_000` for 6-decimal USDC/USDT, `10^18` for 18-decimal * BSC USDC). * * - `FeesExcluded` (default): what the receiver ends up with, sized * as if `amount` source units were converted to the Spark-side * destination at parity (USDB) or the live BTC/USD rate (Bitcoin). * - `FeesIncluded`: what the sender deposits. The receiver ends up * with that amount minus provider fees. */ amount: U128; /** * Spark-side asset the receiver wants delivered. When absent, the * SDK auto-selects: the wallet's active stable-balance token if * the route supports it, otherwise Bitcoin (sats). When set, the * value must appear in the route's `accepted_assets`. */ destination: SparkAsset | undefined; /** * How `amount` should be interpreted. When absent, defaults to * `FeesExcluded`. */ feeMode: CrossChainFeeMode | undefined; /** * Maximum slippage in basis points. When absent, the SDK default * (100 bps) is used. */ maxSlippageBps: /*u32*/ number | undefined; /** * Per-request override for the overpay buffer applied to the * sender's deposit when `fee_mode == FeesExcluded`. Range 0 to 500. * When absent, falls back to `CrossChainConfig::default_target_overpay_bps` * then the built-in default (15 bps). Ignored when `fee_mode` * is `FeesIncluded`. */ targetOverpayBps: /*u32*/ number | undefined; }): CrossChain_ { return new CrossChain_(inner); } static instanceOf(obj: any): obj is CrossChain_ { return obj.tag === ReceivePaymentMethod_Tags.CrossChain; } } function instanceOf(obj: any): obj is ReceivePaymentMethod { return obj[uniffiTypeNameSymbol] === 'ReceivePaymentMethod'; } return Object.freeze({ instanceOf, SparkAddress: SparkAddress_, SparkInvoice: SparkInvoice_, BitcoinAddress: BitcoinAddress_, Bolt11Invoice: Bolt11Invoice_, CrossChain: CrossChain_, }); })(); export type ReceivePaymentMethod = InstanceType< (typeof ReceivePaymentMethod)[keyof Omit< typeof ReceivePaymentMethod, 'instanceOf' >] >; // FfiConverter for enum ReceivePaymentMethod const FfiConverterTypeReceivePaymentMethod = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ReceivePaymentMethod; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ReceivePaymentMethod.SparkAddress(); case 2: return new ReceivePaymentMethod.SparkInvoice({ amount: FfiConverterOptionalTypeu128.read(from), tokenIdentifier: FfiConverterOptionalString.read(from), expiryTime: FfiConverterOptionalUInt64.read(from), description: FfiConverterOptionalString.read(from), senderPublicKey: FfiConverterOptionalString.read(from), }); case 3: return new ReceivePaymentMethod.BitcoinAddress({ newAddress: FfiConverterOptionalBool.read(from), }); case 4: return new ReceivePaymentMethod.Bolt11Invoice({ description: FfiConverterString.read(from), amountSats: FfiConverterOptionalUInt64.read(from), expirySecs: FfiConverterOptionalUInt32.read(from), paymentHash: FfiConverterOptionalString.read(from), receiverIdentityPublicKey: FfiConverterOptionalString.read(from), }); case 5: return new ReceivePaymentMethod.CrossChain({ route: FfiConverterTypeCrossChainRoutePair.read(from), amount: FfiConverterTypeu128.read(from), destination: FfiConverterOptionalTypeSparkAsset.read(from), feeMode: FfiConverterOptionalTypeCrossChainFeeMode.read(from), maxSlippageBps: FfiConverterOptionalUInt32.read(from), targetOverpayBps: FfiConverterOptionalUInt32.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ReceivePaymentMethod_Tags.SparkAddress: { ordinalConverter.write(1, into); return; } case ReceivePaymentMethod_Tags.SparkInvoice: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterOptionalTypeu128.write(inner.amount, into); FfiConverterOptionalString.write(inner.tokenIdentifier, into); FfiConverterOptionalUInt64.write(inner.expiryTime, into); FfiConverterOptionalString.write(inner.description, into); FfiConverterOptionalString.write(inner.senderPublicKey, into); return; } case ReceivePaymentMethod_Tags.BitcoinAddress: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterOptionalBool.write(inner.newAddress, into); return; } case ReceivePaymentMethod_Tags.Bolt11Invoice: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterString.write(inner.description, into); FfiConverterOptionalUInt64.write(inner.amountSats, into); FfiConverterOptionalUInt32.write(inner.expirySecs, into); FfiConverterOptionalString.write(inner.paymentHash, into); FfiConverterOptionalString.write( inner.receiverIdentityPublicKey, into ); return; } case ReceivePaymentMethod_Tags.CrossChain: { ordinalConverter.write(5, into); const inner = value.inner; FfiConverterTypeCrossChainRoutePair.write(inner.route, into); FfiConverterTypeu128.write(inner.amount, into); FfiConverterOptionalTypeSparkAsset.write(inner.destination, into); FfiConverterOptionalTypeCrossChainFeeMode.write(inner.feeMode, into); FfiConverterOptionalUInt32.write(inner.maxSlippageBps, into); FfiConverterOptionalUInt32.write(inner.targetOverpayBps, into); return; } default: // Throwing from here means that ReceivePaymentMethod_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ReceivePaymentMethod_Tags.SparkAddress: { return ordinalConverter.allocationSize(1); } case ReceivePaymentMethod_Tags.SparkInvoice: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterOptionalTypeu128.allocationSize(inner.amount); size += FfiConverterOptionalString.allocationSize( inner.tokenIdentifier ); size += FfiConverterOptionalUInt64.allocationSize(inner.expiryTime); size += FfiConverterOptionalString.allocationSize(inner.description); size += FfiConverterOptionalString.allocationSize( inner.senderPublicKey ); return size; } case ReceivePaymentMethod_Tags.BitcoinAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterOptionalBool.allocationSize(inner.newAddress); return size; } case ReceivePaymentMethod_Tags.Bolt11Invoice: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterString.allocationSize(inner.description); size += FfiConverterOptionalUInt64.allocationSize(inner.amountSats); size += FfiConverterOptionalUInt32.allocationSize(inner.expirySecs); size += FfiConverterOptionalString.allocationSize(inner.paymentHash); size += FfiConverterOptionalString.allocationSize( inner.receiverIdentityPublicKey ); return size; } case ReceivePaymentMethod_Tags.CrossChain: { const inner = value.inner; let size = ordinalConverter.allocationSize(5); size += FfiConverterTypeCrossChainRoutePair.allocationSize( inner.route ); size += FfiConverterTypeu128.allocationSize(inner.amount); size += FfiConverterOptionalTypeSparkAsset.allocationSize( inner.destination ); size += FfiConverterOptionalTypeCrossChainFeeMode.allocationSize( inner.feeMode ); size += FfiConverterOptionalUInt32.allocationSize( inner.maxSlippageBps ); size += FfiConverterOptionalUInt32.allocationSize( inner.targetOverpayBps ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: RefundState export enum RefundState_Tags { BroadcastPending = 'BroadcastPending', Broadcast = 'Broadcast', } /** * State of the deposit refund broadcast. */ export const RefundState = (() => { type BroadcastPending__interface = { tag: RefundState_Tags.BroadcastPending; inner: Readonly<{ lastError: string | undefined }>; }; /** * The refund is signed and stored but has not been seen on the network. * `last_error` carries the reason the most recent broadcast was refused, * unset while none has been refused. A refund whose fee is under the * network's current minimum stays here until it is re-created at a higher * fee. */ class BroadcastPending_ extends UniffiEnum implements BroadcastPending__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'RefundState'; readonly tag = RefundState_Tags.BroadcastPending; readonly inner: Readonly<{ lastError: string | undefined }>; constructor(inner: { lastError: string | undefined }) { super('RefundState', 'BroadcastPending'); this.inner = Object.freeze(inner); } static new(inner: { lastError: string | undefined }): BroadcastPending_ { return new BroadcastPending_(inner); } static instanceOf(obj: any): obj is BroadcastPending_ { return obj.tag === RefundState_Tags.BroadcastPending; } } type Broadcast__interface = { tag: RefundState_Tags.Broadcast; }; /** * The refund has been accepted by the network and is waiting to confirm. */ class Broadcast_ extends UniffiEnum implements Broadcast__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'RefundState'; readonly tag = RefundState_Tags.Broadcast; constructor() { super('RefundState', 'Broadcast'); } static new(): Broadcast_ { return new Broadcast_(); } static instanceOf(obj: any): obj is Broadcast_ { return obj.tag === RefundState_Tags.Broadcast; } } function instanceOf(obj: any): obj is RefundState { return obj[uniffiTypeNameSymbol] === 'RefundState'; } return Object.freeze({ instanceOf, BroadcastPending: BroadcastPending_, Broadcast: Broadcast_, }); })(); /** * State of the deposit refund broadcast. */ export type RefundState = InstanceType< (typeof RefundState)[keyof Omit] >; // FfiConverter for enum RefundState const FfiConverterTypeRefundState = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = RefundState; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new RefundState.BroadcastPending({ lastError: FfiConverterOptionalString.read(from), }); case 2: return new RefundState.Broadcast(); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case RefundState_Tags.BroadcastPending: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterOptionalString.write(inner.lastError, into); return; } case RefundState_Tags.Broadcast: { ordinalConverter.write(2, into); return; } default: // Throwing from here means that RefundState_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case RefundState_Tags.BroadcastPending: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterOptionalString.allocationSize(inner.lastError); return size; } case RefundState_Tags.Broadcast: { return ordinalConverter.allocationSize(2); } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Error type: SdkError // Enum: SdkError export enum SdkError_Tags { SparkError = 'SparkError', InsufficientFunds = 'InsufficientFunds', InvalidUuid = 'InvalidUuid', InvalidInput = 'InvalidInput', NetworkError = 'NetworkError', StorageError = 'StorageError', ChainServiceError = 'ChainServiceError', MaxDepositClaimFeeExceeded = 'MaxDepositClaimFeeExceeded', MissingUtxo = 'MissingUtxo', DepositClaimInProgress = 'DepositClaimInProgress', RefundReplacementFeeTooLow = 'RefundReplacementFeeTooLow', LnurlError = 'LnurlError', Signer = 'Signer', OptimizationAlreadyRunning = 'OptimizationAlreadyRunning', OptimizationCancelled = 'OptimizationCancelled', InsufficientCpfpFunds = 'InsufficientCpfpFunds', Generic = 'Generic', } /** * Error type for the `BreezSdk` */ export const SdkError = (() => { type SparkError__interface = { tag: SdkError_Tags.SparkError; inner: Readonly<[string]>; }; class SparkError_ extends UniffiError implements SparkError__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.SparkError; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SdkError', 'SparkError'); this.inner = Object.freeze([v0]); } static new(v0: string): SparkError_ { return new SparkError_(v0); } static instanceOf(obj: any): obj is SparkError_ { return obj.tag === SdkError_Tags.SparkError; } static hasInner(obj: any): obj is SparkError_ { return SparkError_.instanceOf(obj); } static getInner(obj: SparkError_): Readonly<[string]> { return obj.inner; } } type InsufficientFunds__interface = { tag: SdkError_Tags.InsufficientFunds; inner: Readonly<{ tokenIdentifier: string | undefined }>; }; class InsufficientFunds_ extends UniffiError implements InsufficientFunds__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.InsufficientFunds; readonly inner: Readonly<{ tokenIdentifier: string | undefined }>; constructor(inner: { /** * The token that cannot cover the payment. Unset when the shortfall is * in sats or when no single token can be named. */ tokenIdentifier: string | undefined; }) { super('SdkError', 'InsufficientFunds'); this.inner = Object.freeze(inner); } static new(inner: { /** * The token that cannot cover the payment. Unset when the shortfall is * in sats or when no single token can be named. */ tokenIdentifier: string | undefined; }): InsufficientFunds_ { return new InsufficientFunds_(inner); } static instanceOf(obj: any): obj is InsufficientFunds_ { return obj.tag === SdkError_Tags.InsufficientFunds; } static hasInner(obj: any): obj is InsufficientFunds_ { return InsufficientFunds_.instanceOf(obj); } static getInner( obj: InsufficientFunds_ ): Readonly<{ tokenIdentifier: string | undefined }> { return obj.inner; } } type InvalidUuid__interface = { tag: SdkError_Tags.InvalidUuid; inner: Readonly<[string]>; }; class InvalidUuid_ extends UniffiError implements InvalidUuid__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.InvalidUuid; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SdkError', 'InvalidUuid'); this.inner = Object.freeze([v0]); } static new(v0: string): InvalidUuid_ { return new InvalidUuid_(v0); } static instanceOf(obj: any): obj is InvalidUuid_ { return obj.tag === SdkError_Tags.InvalidUuid; } static hasInner(obj: any): obj is InvalidUuid_ { return InvalidUuid_.instanceOf(obj); } static getInner(obj: InvalidUuid_): Readonly<[string]> { return obj.inner; } } type InvalidInput__interface = { tag: SdkError_Tags.InvalidInput; inner: Readonly<[string]>; }; /** * Invalid input error */ class InvalidInput_ extends UniffiError implements InvalidInput__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.InvalidInput; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SdkError', 'InvalidInput'); this.inner = Object.freeze([v0]); } static new(v0: string): InvalidInput_ { return new InvalidInput_(v0); } static instanceOf(obj: any): obj is InvalidInput_ { return obj.tag === SdkError_Tags.InvalidInput; } static hasInner(obj: any): obj is InvalidInput_ { return InvalidInput_.instanceOf(obj); } static getInner(obj: InvalidInput_): Readonly<[string]> { return obj.inner; } } type NetworkError__interface = { tag: SdkError_Tags.NetworkError; inner: Readonly<[string]>; }; /** * Network error */ class NetworkError_ extends UniffiError implements NetworkError__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.NetworkError; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SdkError', 'NetworkError'); this.inner = Object.freeze([v0]); } static new(v0: string): NetworkError_ { return new NetworkError_(v0); } static instanceOf(obj: any): obj is NetworkError_ { return obj.tag === SdkError_Tags.NetworkError; } static hasInner(obj: any): obj is NetworkError_ { return NetworkError_.instanceOf(obj); } static getInner(obj: NetworkError_): Readonly<[string]> { return obj.inner; } } type StorageError__interface = { tag: SdkError_Tags.StorageError; inner: Readonly<[string]>; }; /** * Storage error */ class StorageError_ extends UniffiError implements StorageError__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.StorageError; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SdkError', 'StorageError'); this.inner = Object.freeze([v0]); } static new(v0: string): StorageError_ { return new StorageError_(v0); } static instanceOf(obj: any): obj is StorageError_ { return obj.tag === SdkError_Tags.StorageError; } static hasInner(obj: any): obj is StorageError_ { return StorageError_.instanceOf(obj); } static getInner(obj: StorageError_): Readonly<[string]> { return obj.inner; } } type ChainServiceError__interface = { tag: SdkError_Tags.ChainServiceError; inner: Readonly<[string]>; }; class ChainServiceError_ extends UniffiError implements ChainServiceError__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.ChainServiceError; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SdkError', 'ChainServiceError'); this.inner = Object.freeze([v0]); } static new(v0: string): ChainServiceError_ { return new ChainServiceError_(v0); } static instanceOf(obj: any): obj is ChainServiceError_ { return obj.tag === SdkError_Tags.ChainServiceError; } static hasInner(obj: any): obj is ChainServiceError_ { return ChainServiceError_.instanceOf(obj); } static getInner(obj: ChainServiceError_): Readonly<[string]> { return obj.inner; } } type MaxDepositClaimFeeExceeded__interface = { tag: SdkError_Tags.MaxDepositClaimFeeExceeded; inner: Readonly<{ tx: string; vout: /*u32*/ number; maxFee: Fee | undefined; requiredFeeSats: /*u64*/ bigint; requiredFeeRateSatPerVbyte: /*u64*/ bigint; }>; }; class MaxDepositClaimFeeExceeded_ extends UniffiError implements MaxDepositClaimFeeExceeded__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.MaxDepositClaimFeeExceeded; readonly inner: Readonly<{ tx: string; vout: /*u32*/ number; maxFee: Fee | undefined; requiredFeeSats: /*u64*/ bigint; requiredFeeRateSatPerVbyte: /*u64*/ bigint; }>; constructor(inner: { tx: string; vout: /*u32*/ number; maxFee: Fee | undefined; requiredFeeSats: /*u64*/ bigint; requiredFeeRateSatPerVbyte: /*u64*/ bigint; }) { super('SdkError', 'MaxDepositClaimFeeExceeded'); this.inner = Object.freeze(inner); } static new(inner: { tx: string; vout: /*u32*/ number; maxFee: Fee | undefined; requiredFeeSats: /*u64*/ bigint; requiredFeeRateSatPerVbyte: /*u64*/ bigint; }): MaxDepositClaimFeeExceeded_ { return new MaxDepositClaimFeeExceeded_(inner); } static instanceOf(obj: any): obj is MaxDepositClaimFeeExceeded_ { return obj.tag === SdkError_Tags.MaxDepositClaimFeeExceeded; } static hasInner(obj: any): obj is MaxDepositClaimFeeExceeded_ { return MaxDepositClaimFeeExceeded_.instanceOf(obj); } static getInner( obj: MaxDepositClaimFeeExceeded_ ): Readonly<{ tx: string; vout: /*u32*/ number; maxFee: Fee | undefined; requiredFeeSats: /*u64*/ bigint; requiredFeeRateSatPerVbyte: /*u64*/ bigint; }> { return obj.inner; } } type MissingUtxo__interface = { tag: SdkError_Tags.MissingUtxo; inner: Readonly<{ tx: string; vout: /*u32*/ number }>; }; class MissingUtxo_ extends UniffiError implements MissingUtxo__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.MissingUtxo; readonly inner: Readonly<{ tx: string; vout: /*u32*/ number }>; constructor(inner: { tx: string; vout: /*u32*/ number }) { super('SdkError', 'MissingUtxo'); this.inner = Object.freeze(inner); } static new(inner: { tx: string; vout: /*u32*/ number }): MissingUtxo_ { return new MissingUtxo_(inner); } static instanceOf(obj: any): obj is MissingUtxo_ { return obj.tag === SdkError_Tags.MissingUtxo; } static hasInner(obj: any): obj is MissingUtxo_ { return MissingUtxo_.instanceOf(obj); } static getInner( obj: MissingUtxo_ ): Readonly<{ tx: string; vout: /*u32*/ number }> { return obj.inner; } } type DepositClaimInProgress__interface = { tag: SdkError_Tags.DepositClaimInProgress; inner: Readonly<{ tx: string; vout: /*u32*/ number }>; }; /** * Another claim on this deposit is already running. */ class DepositClaimInProgress_ extends UniffiError implements DepositClaimInProgress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.DepositClaimInProgress; readonly inner: Readonly<{ tx: string; vout: /*u32*/ number }>; constructor(inner: { tx: string; vout: /*u32*/ number }) { super('SdkError', 'DepositClaimInProgress'); this.inner = Object.freeze(inner); } static new(inner: { tx: string; vout: /*u32*/ number; }): DepositClaimInProgress_ { return new DepositClaimInProgress_(inner); } static instanceOf(obj: any): obj is DepositClaimInProgress_ { return obj.tag === SdkError_Tags.DepositClaimInProgress; } static hasInner(obj: any): obj is DepositClaimInProgress_ { return DepositClaimInProgress_.instanceOf(obj); } static getInner( obj: DepositClaimInProgress_ ): Readonly<{ tx: string; vout: /*u32*/ number }> { return obj.inner; } } type RefundReplacementFeeTooLow__interface = { tag: SdkError_Tags.RefundReplacementFeeTooLow; inner: Readonly<{ pendingFeeSats: /*u64*/ bigint; requiredFeeSats: /*u64*/ bigint; }>; }; /** * A refund for this deposit is already on the network, and the requested * replacement does not pay enough to displace it. */ class RefundReplacementFeeTooLow_ extends UniffiError implements RefundReplacementFeeTooLow__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.RefundReplacementFeeTooLow; readonly inner: Readonly<{ pendingFeeSats: /*u64*/ bigint; requiredFeeSats: /*u64*/ bigint; }>; constructor(inner: { pendingFeeSats: /*u64*/ bigint; requiredFeeSats: /*u64*/ bigint; }) { super('SdkError', 'RefundReplacementFeeTooLow'); this.inner = Object.freeze(inner); } static new(inner: { pendingFeeSats: /*u64*/ bigint; requiredFeeSats: /*u64*/ bigint; }): RefundReplacementFeeTooLow_ { return new RefundReplacementFeeTooLow_(inner); } static instanceOf(obj: any): obj is RefundReplacementFeeTooLow_ { return obj.tag === SdkError_Tags.RefundReplacementFeeTooLow; } static hasInner(obj: any): obj is RefundReplacementFeeTooLow_ { return RefundReplacementFeeTooLow_.instanceOf(obj); } static getInner( obj: RefundReplacementFeeTooLow_ ): Readonly<{ pendingFeeSats: /*u64*/ bigint; requiredFeeSats: /*u64*/ bigint; }> { return obj.inner; } } type LnurlError__interface = { tag: SdkError_Tags.LnurlError; inner: Readonly<[string]>; }; class LnurlError_ extends UniffiError implements LnurlError__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.LnurlError; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SdkError', 'LnurlError'); this.inner = Object.freeze([v0]); } static new(v0: string): LnurlError_ { return new LnurlError_(v0); } static instanceOf(obj: any): obj is LnurlError_ { return obj.tag === SdkError_Tags.LnurlError; } static hasInner(obj: any): obj is LnurlError_ { return LnurlError_.instanceOf(obj); } static getInner(obj: LnurlError_): Readonly<[string]> { return obj.inner; } } type Signer__interface = { tag: SdkError_Tags.Signer; inner: Readonly<[string]>; }; class Signer_ extends UniffiError implements Signer__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.Signer; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SdkError', 'Signer'); this.inner = Object.freeze([v0]); } static new(v0: string): Signer_ { return new Signer_(v0); } static instanceOf(obj: any): obj is Signer_ { return obj.tag === SdkError_Tags.Signer; } static hasInner(obj: any): obj is Signer_ { return Signer_.instanceOf(obj); } static getInner(obj: Signer_): Readonly<[string]> { return obj.inner; } } type OptimizationAlreadyRunning__interface = { tag: SdkError_Tags.OptimizationAlreadyRunning; }; /** * `optimize_leaves` was called while another optimization run (auto or * manual) was already in flight. */ class OptimizationAlreadyRunning_ extends UniffiError implements OptimizationAlreadyRunning__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.OptimizationAlreadyRunning; constructor() { super('SdkError', 'OptimizationAlreadyRunning'); } static new(): OptimizationAlreadyRunning_ { return new OptimizationAlreadyRunning_(); } static instanceOf(obj: any): obj is OptimizationAlreadyRunning_ { return obj.tag === SdkError_Tags.OptimizationAlreadyRunning; } static hasInner(obj: any): obj is OptimizationAlreadyRunning_ { return false; } } type OptimizationCancelled__interface = { tag: SdkError_Tags.OptimizationCancelled; }; /** * `optimize_leaves` was preempted by the SDK to free leaves for a * higher-priority operation (typically a payment). */ class OptimizationCancelled_ extends UniffiError implements OptimizationCancelled__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.OptimizationCancelled; constructor() { super('SdkError', 'OptimizationCancelled'); } static new(): OptimizationCancelled_ { return new OptimizationCancelled_(); } static instanceOf(obj: any): obj is OptimizationCancelled_ { return obj.tag === SdkError_Tags.OptimizationCancelled; } static hasInner(obj: any): obj is OptimizationCancelled_ { return false; } } type InsufficientCpfpFunds__interface = { tag: SdkError_Tags.InsufficientCpfpFunds; inner: Readonly<{ requiredSat: /*u64*/ bigint }>; }; /** * The provided CPFP funding is too low to cover the exit's on-chain fees. */ class InsufficientCpfpFunds_ extends UniffiError implements InsufficientCpfpFunds__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.InsufficientCpfpFunds; readonly inner: Readonly<{ requiredSat: /*u64*/ bigint }>; constructor(inner: { requiredSat: /*u64*/ bigint }) { super('SdkError', 'InsufficientCpfpFunds'); this.inner = Object.freeze(inner); } static new(inner: { requiredSat: /*u64*/ bigint }): InsufficientCpfpFunds_ { return new InsufficientCpfpFunds_(inner); } static instanceOf(obj: any): obj is InsufficientCpfpFunds_ { return obj.tag === SdkError_Tags.InsufficientCpfpFunds; } static hasInner(obj: any): obj is InsufficientCpfpFunds_ { return InsufficientCpfpFunds_.instanceOf(obj); } static getInner( obj: InsufficientCpfpFunds_ ): Readonly<{ requiredSat: /*u64*/ bigint }> { return obj.inner; } } type Generic__interface = { tag: SdkError_Tags.Generic; inner: Readonly<[string]>; }; class Generic_ extends UniffiError implements Generic__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkError'; readonly tag = SdkError_Tags.Generic; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SdkError', 'Generic'); this.inner = Object.freeze([v0]); } static new(v0: string): Generic_ { return new Generic_(v0); } static instanceOf(obj: any): obj is Generic_ { return obj.tag === SdkError_Tags.Generic; } static hasInner(obj: any): obj is Generic_ { return Generic_.instanceOf(obj); } static getInner(obj: Generic_): Readonly<[string]> { return obj.inner; } } function instanceOf(obj: any): obj is SdkError { return obj[uniffiTypeNameSymbol] === 'SdkError'; } return Object.freeze({ instanceOf, SparkError: SparkError_, InsufficientFunds: InsufficientFunds_, InvalidUuid: InvalidUuid_, InvalidInput: InvalidInput_, NetworkError: NetworkError_, StorageError: StorageError_, ChainServiceError: ChainServiceError_, MaxDepositClaimFeeExceeded: MaxDepositClaimFeeExceeded_, MissingUtxo: MissingUtxo_, DepositClaimInProgress: DepositClaimInProgress_, RefundReplacementFeeTooLow: RefundReplacementFeeTooLow_, LnurlError: LnurlError_, Signer: Signer_, OptimizationAlreadyRunning: OptimizationAlreadyRunning_, OptimizationCancelled: OptimizationCancelled_, InsufficientCpfpFunds: InsufficientCpfpFunds_, Generic: Generic_, }); })(); /** * Error type for the `BreezSdk` */ export type SdkError = InstanceType< (typeof SdkError)[keyof Omit] >; // FfiConverter for enum SdkError const FfiConverterTypeSdkError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SdkError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new SdkError.SparkError(FfiConverterString.read(from)); case 2: return new SdkError.InsufficientFunds({ tokenIdentifier: FfiConverterOptionalString.read(from), }); case 3: return new SdkError.InvalidUuid(FfiConverterString.read(from)); case 4: return new SdkError.InvalidInput(FfiConverterString.read(from)); case 5: return new SdkError.NetworkError(FfiConverterString.read(from)); case 6: return new SdkError.StorageError(FfiConverterString.read(from)); case 7: return new SdkError.ChainServiceError(FfiConverterString.read(from)); case 8: return new SdkError.MaxDepositClaimFeeExceeded({ tx: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), maxFee: FfiConverterOptionalTypeFee.read(from), requiredFeeSats: FfiConverterUInt64.read(from), requiredFeeRateSatPerVbyte: FfiConverterUInt64.read(from), }); case 9: return new SdkError.MissingUtxo({ tx: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), }); case 10: return new SdkError.DepositClaimInProgress({ tx: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), }); case 11: return new SdkError.RefundReplacementFeeTooLow({ pendingFeeSats: FfiConverterUInt64.read(from), requiredFeeSats: FfiConverterUInt64.read(from), }); case 12: return new SdkError.LnurlError(FfiConverterString.read(from)); case 13: return new SdkError.Signer(FfiConverterString.read(from)); case 14: return new SdkError.OptimizationAlreadyRunning(); case 15: return new SdkError.OptimizationCancelled(); case 16: return new SdkError.InsufficientCpfpFunds({ requiredSat: FfiConverterUInt64.read(from), }); case 17: return new SdkError.Generic(FfiConverterString.read(from)); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case SdkError_Tags.SparkError: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SdkError_Tags.InsufficientFunds: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterOptionalString.write(inner.tokenIdentifier, into); return; } case SdkError_Tags.InvalidUuid: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SdkError_Tags.InvalidInput: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SdkError_Tags.NetworkError: { ordinalConverter.write(5, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SdkError_Tags.StorageError: { ordinalConverter.write(6, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SdkError_Tags.ChainServiceError: { ordinalConverter.write(7, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SdkError_Tags.MaxDepositClaimFeeExceeded: { ordinalConverter.write(8, into); const inner = value.inner; FfiConverterString.write(inner.tx, into); FfiConverterUInt32.write(inner.vout, into); FfiConverterOptionalTypeFee.write(inner.maxFee, into); FfiConverterUInt64.write(inner.requiredFeeSats, into); FfiConverterUInt64.write(inner.requiredFeeRateSatPerVbyte, into); return; } case SdkError_Tags.MissingUtxo: { ordinalConverter.write(9, into); const inner = value.inner; FfiConverterString.write(inner.tx, into); FfiConverterUInt32.write(inner.vout, into); return; } case SdkError_Tags.DepositClaimInProgress: { ordinalConverter.write(10, into); const inner = value.inner; FfiConverterString.write(inner.tx, into); FfiConverterUInt32.write(inner.vout, into); return; } case SdkError_Tags.RefundReplacementFeeTooLow: { ordinalConverter.write(11, into); const inner = value.inner; FfiConverterUInt64.write(inner.pendingFeeSats, into); FfiConverterUInt64.write(inner.requiredFeeSats, into); return; } case SdkError_Tags.LnurlError: { ordinalConverter.write(12, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SdkError_Tags.Signer: { ordinalConverter.write(13, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SdkError_Tags.OptimizationAlreadyRunning: { ordinalConverter.write(14, into); return; } case SdkError_Tags.OptimizationCancelled: { ordinalConverter.write(15, into); return; } case SdkError_Tags.InsufficientCpfpFunds: { ordinalConverter.write(16, into); const inner = value.inner; FfiConverterUInt64.write(inner.requiredSat, into); return; } case SdkError_Tags.Generic: { ordinalConverter.write(17, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } default: // Throwing from here means that SdkError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case SdkError_Tags.SparkError: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner[0]); return size; } case SdkError_Tags.InsufficientFunds: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterOptionalString.allocationSize( inner.tokenIdentifier ); return size; } case SdkError_Tags.InvalidUuid: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner[0]); return size; } case SdkError_Tags.InvalidInput: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterString.allocationSize(inner[0]); return size; } case SdkError_Tags.NetworkError: { const inner = value.inner; let size = ordinalConverter.allocationSize(5); size += FfiConverterString.allocationSize(inner[0]); return size; } case SdkError_Tags.StorageError: { const inner = value.inner; let size = ordinalConverter.allocationSize(6); size += FfiConverterString.allocationSize(inner[0]); return size; } case SdkError_Tags.ChainServiceError: { const inner = value.inner; let size = ordinalConverter.allocationSize(7); size += FfiConverterString.allocationSize(inner[0]); return size; } case SdkError_Tags.MaxDepositClaimFeeExceeded: { const inner = value.inner; let size = ordinalConverter.allocationSize(8); size += FfiConverterString.allocationSize(inner.tx); size += FfiConverterUInt32.allocationSize(inner.vout); size += FfiConverterOptionalTypeFee.allocationSize(inner.maxFee); size += FfiConverterUInt64.allocationSize(inner.requiredFeeSats); size += FfiConverterUInt64.allocationSize( inner.requiredFeeRateSatPerVbyte ); return size; } case SdkError_Tags.MissingUtxo: { const inner = value.inner; let size = ordinalConverter.allocationSize(9); size += FfiConverterString.allocationSize(inner.tx); size += FfiConverterUInt32.allocationSize(inner.vout); return size; } case SdkError_Tags.DepositClaimInProgress: { const inner = value.inner; let size = ordinalConverter.allocationSize(10); size += FfiConverterString.allocationSize(inner.tx); size += FfiConverterUInt32.allocationSize(inner.vout); return size; } case SdkError_Tags.RefundReplacementFeeTooLow: { const inner = value.inner; let size = ordinalConverter.allocationSize(11); size += FfiConverterUInt64.allocationSize(inner.pendingFeeSats); size += FfiConverterUInt64.allocationSize(inner.requiredFeeSats); return size; } case SdkError_Tags.LnurlError: { const inner = value.inner; let size = ordinalConverter.allocationSize(12); size += FfiConverterString.allocationSize(inner[0]); return size; } case SdkError_Tags.Signer: { const inner = value.inner; let size = ordinalConverter.allocationSize(13); size += FfiConverterString.allocationSize(inner[0]); return size; } case SdkError_Tags.OptimizationAlreadyRunning: { return ordinalConverter.allocationSize(14); } case SdkError_Tags.OptimizationCancelled: { return ordinalConverter.allocationSize(15); } case SdkError_Tags.InsufficientCpfpFunds: { const inner = value.inner; let size = ordinalConverter.allocationSize(16); size += FfiConverterUInt64.allocationSize(inner.requiredSat); return size; } case SdkError_Tags.Generic: { const inner = value.inner; let size = ordinalConverter.allocationSize(17); size += FfiConverterString.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: SdkEvent export enum SdkEvent_Tags { Synced = 'Synced', UnclaimedDeposits = 'UnclaimedDeposits', ClaimedDeposits = 'ClaimedDeposits', PaymentSucceeded = 'PaymentSucceeded', PaymentPending = 'PaymentPending', PaymentFailed = 'PaymentFailed', AutoOptimization = 'AutoOptimization', LightningAddressChanged = 'LightningAddressChanged', NewDeposits = 'NewDeposits', UnilateralExitStateChanged = 'UnilateralExitStateChanged', } /** * Events emitted by the SDK */ export const SdkEvent = (() => { type Synced__interface = { tag: SdkEvent_Tags.Synced; }; /** * Emitted when the wallet has been synchronized with the network */ class Synced_ extends UniffiEnum implements Synced__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkEvent'; readonly tag = SdkEvent_Tags.Synced; constructor() { super('SdkEvent', 'Synced'); } static new(): Synced_ { return new Synced_(); } static instanceOf(obj: any): obj is Synced_ { return obj.tag === SdkEvent_Tags.Synced; } } type UnclaimedDeposits__interface = { tag: SdkEvent_Tags.UnclaimedDeposits; inner: Readonly<{ unclaimedDeposits: Array }>; }; /** * Emitted when the SDK was unable to claim deposits. Each deposit carries a * `claim_error` with the reason. */ class UnclaimedDeposits_ extends UniffiEnum implements UnclaimedDeposits__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkEvent'; readonly tag = SdkEvent_Tags.UnclaimedDeposits; readonly inner: Readonly<{ unclaimedDeposits: Array }>; constructor(inner: { unclaimedDeposits: Array }) { super('SdkEvent', 'UnclaimedDeposits'); this.inner = Object.freeze(inner); } static new(inner: { unclaimedDeposits: Array; }): UnclaimedDeposits_ { return new UnclaimedDeposits_(inner); } static instanceOf(obj: any): obj is UnclaimedDeposits_ { return obj.tag === SdkEvent_Tags.UnclaimedDeposits; } } type ClaimedDeposits__interface = { tag: SdkEvent_Tags.ClaimedDeposits; inner: Readonly<{ claimedDeposits: Array }>; }; /** * Emitted when deposits were claimed into the wallet. The resulting payment * is emitted separately as `PaymentSucceeded`. */ class ClaimedDeposits_ extends UniffiEnum implements ClaimedDeposits__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkEvent'; readonly tag = SdkEvent_Tags.ClaimedDeposits; readonly inner: Readonly<{ claimedDeposits: Array }>; constructor(inner: { claimedDeposits: Array }) { super('SdkEvent', 'ClaimedDeposits'); this.inner = Object.freeze(inner); } static new(inner: { claimedDeposits: Array; }): ClaimedDeposits_ { return new ClaimedDeposits_(inner); } static instanceOf(obj: any): obj is ClaimedDeposits_ { return obj.tag === SdkEvent_Tags.ClaimedDeposits; } } type PaymentSucceeded__interface = { tag: SdkEvent_Tags.PaymentSucceeded; inner: Readonly<{ payment: Payment }>; }; /** * Emitted when a payment completed. The cached balance is refreshed before * this event, so `get_info` returns the new value. */ class PaymentSucceeded_ extends UniffiEnum implements PaymentSucceeded__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkEvent'; readonly tag = SdkEvent_Tags.PaymentSucceeded; readonly inner: Readonly<{ payment: Payment }>; constructor(inner: { payment: Payment }) { super('SdkEvent', 'PaymentSucceeded'); this.inner = Object.freeze(inner); } static new(inner: { payment: Payment }): PaymentSucceeded_ { return new PaymentSucceeded_(inner); } static instanceOf(obj: any): obj is PaymentSucceeded_ { return obj.tag === SdkEvent_Tags.PaymentSucceeded; } } type PaymentPending__interface = { tag: SdkEvent_Tags.PaymentPending; inner: Readonly<{ payment: Payment }>; }; /** * Emitted when a payment is in flight. The same payment is emitted again as * succeeded or failed once it settles. */ class PaymentPending_ extends UniffiEnum implements PaymentPending__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkEvent'; readonly tag = SdkEvent_Tags.PaymentPending; readonly inner: Readonly<{ payment: Payment }>; constructor(inner: { payment: Payment }) { super('SdkEvent', 'PaymentPending'); this.inner = Object.freeze(inner); } static new(inner: { payment: Payment }): PaymentPending_ { return new PaymentPending_(inner); } static instanceOf(obj: any): obj is PaymentPending_ { return obj.tag === SdkEvent_Tags.PaymentPending; } } type PaymentFailed__interface = { tag: SdkEvent_Tags.PaymentFailed; inner: Readonly<{ payment: Payment }>; }; /** * Emitted when a payment failed. */ class PaymentFailed_ extends UniffiEnum implements PaymentFailed__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkEvent'; readonly tag = SdkEvent_Tags.PaymentFailed; readonly inner: Readonly<{ payment: Payment }>; constructor(inner: { payment: Payment }) { super('SdkEvent', 'PaymentFailed'); this.inner = Object.freeze(inner); } static new(inner: { payment: Payment }): PaymentFailed_ { return new PaymentFailed_(inner); } static instanceOf(obj: any): obj is PaymentFailed_ { return obj.tag === SdkEvent_Tags.PaymentFailed; } } type AutoOptimization__interface = { tag: SdkEvent_Tags.AutoOptimization; inner: Readonly<{ optimizationEvent: AutoOptimizationEvent }>; }; /** * Emitted while the background auto-optimizer is running. * * Only fired from the auto path (enabled via * `LeafOptimizationConfig::auto_enabled`). Manually-triggered runs * via `BreezSdk::optimize_leaves` do not emit events: they return an * `OptimizationOutcome` instead. */ class AutoOptimization_ extends UniffiEnum implements AutoOptimization__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkEvent'; readonly tag = SdkEvent_Tags.AutoOptimization; readonly inner: Readonly<{ optimizationEvent: AutoOptimizationEvent }>; constructor(inner: { optimizationEvent: AutoOptimizationEvent }) { super('SdkEvent', 'AutoOptimization'); this.inner = Object.freeze(inner); } static new(inner: { optimizationEvent: AutoOptimizationEvent; }): AutoOptimization_ { return new AutoOptimization_(inner); } static instanceOf(obj: any): obj is AutoOptimization_ { return obj.tag === SdkEvent_Tags.AutoOptimization; } } type LightningAddressChanged__interface = { tag: SdkEvent_Tags.LightningAddressChanged; inner: Readonly<{ lightningAddress: LightningAddressInfo | undefined }>; }; /** * Emitted when the Lightning address changed on another device. The address * is unset when it was deleted. */ class LightningAddressChanged_ extends UniffiEnum implements LightningAddressChanged__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkEvent'; readonly tag = SdkEvent_Tags.LightningAddressChanged; readonly inner: Readonly<{ lightningAddress: LightningAddressInfo | undefined; }>; constructor(inner: { lightningAddress: LightningAddressInfo | undefined }) { super('SdkEvent', 'LightningAddressChanged'); this.inner = Object.freeze(inner); } static new(inner: { lightningAddress: LightningAddressInfo | undefined; }): LightningAddressChanged_ { return new LightningAddressChanged_(inner); } static instanceOf(obj: any): obj is LightningAddressChanged_ { return obj.tag === SdkEvent_Tags.LightningAddressChanged; } } type NewDeposits__interface = { tag: SdkEvent_Tags.NewDeposits; inner: Readonly<{ newDeposits: Array }>; }; /** * Emitted when on-chain deposits are detected. Only deposits whose * `is_mature` is set have enough confirmations to be claimed. */ class NewDeposits_ extends UniffiEnum implements NewDeposits__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkEvent'; readonly tag = SdkEvent_Tags.NewDeposits; readonly inner: Readonly<{ newDeposits: Array }>; constructor(inner: { newDeposits: Array }) { super('SdkEvent', 'NewDeposits'); this.inner = Object.freeze(inner); } static new(inner: { newDeposits: Array }): NewDeposits_ { return new NewDeposits_(inner); } static instanceOf(obj: any): obj is NewDeposits_ { return obj.tag === SdkEvent_Tags.NewDeposits; } } type UnilateralExitStateChanged__interface = { tag: SdkEvent_Tags.UnilateralExitStateChanged; }; /** * Emitted when the data a unilateral exit is built from has changed, so an * exit state exported earlier is out of date and should be exported again. */ class UnilateralExitStateChanged_ extends UniffiEnum implements UnilateralExitStateChanged__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SdkEvent'; readonly tag = SdkEvent_Tags.UnilateralExitStateChanged; constructor() { super('SdkEvent', 'UnilateralExitStateChanged'); } static new(): UnilateralExitStateChanged_ { return new UnilateralExitStateChanged_(); } static instanceOf(obj: any): obj is UnilateralExitStateChanged_ { return obj.tag === SdkEvent_Tags.UnilateralExitStateChanged; } } function instanceOf(obj: any): obj is SdkEvent { return obj[uniffiTypeNameSymbol] === 'SdkEvent'; } return Object.freeze({ instanceOf, Synced: Synced_, UnclaimedDeposits: UnclaimedDeposits_, ClaimedDeposits: ClaimedDeposits_, PaymentSucceeded: PaymentSucceeded_, PaymentPending: PaymentPending_, PaymentFailed: PaymentFailed_, AutoOptimization: AutoOptimization_, LightningAddressChanged: LightningAddressChanged_, NewDeposits: NewDeposits_, UnilateralExitStateChanged: UnilateralExitStateChanged_, }); })(); /** * Events emitted by the SDK */ export type SdkEvent = InstanceType< (typeof SdkEvent)[keyof Omit] >; // FfiConverter for enum SdkEvent const FfiConverterTypeSdkEvent = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SdkEvent; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new SdkEvent.Synced(); case 2: return new SdkEvent.UnclaimedDeposits({ unclaimedDeposits: FfiConverterArrayTypeDepositInfo.read(from), }); case 3: return new SdkEvent.ClaimedDeposits({ claimedDeposits: FfiConverterArrayTypeDepositInfo.read(from), }); case 4: return new SdkEvent.PaymentSucceeded({ payment: FfiConverterTypePayment.read(from), }); case 5: return new SdkEvent.PaymentPending({ payment: FfiConverterTypePayment.read(from), }); case 6: return new SdkEvent.PaymentFailed({ payment: FfiConverterTypePayment.read(from), }); case 7: return new SdkEvent.AutoOptimization({ optimizationEvent: FfiConverterTypeAutoOptimizationEvent.read(from), }); case 8: return new SdkEvent.LightningAddressChanged({ lightningAddress: FfiConverterOptionalTypeLightningAddressInfo.read(from), }); case 9: return new SdkEvent.NewDeposits({ newDeposits: FfiConverterArrayTypeDepositInfo.read(from), }); case 10: return new SdkEvent.UnilateralExitStateChanged(); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case SdkEvent_Tags.Synced: { ordinalConverter.write(1, into); return; } case SdkEvent_Tags.UnclaimedDeposits: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterArrayTypeDepositInfo.write(inner.unclaimedDeposits, into); return; } case SdkEvent_Tags.ClaimedDeposits: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterArrayTypeDepositInfo.write(inner.claimedDeposits, into); return; } case SdkEvent_Tags.PaymentSucceeded: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterTypePayment.write(inner.payment, into); return; } case SdkEvent_Tags.PaymentPending: { ordinalConverter.write(5, into); const inner = value.inner; FfiConverterTypePayment.write(inner.payment, into); return; } case SdkEvent_Tags.PaymentFailed: { ordinalConverter.write(6, into); const inner = value.inner; FfiConverterTypePayment.write(inner.payment, into); return; } case SdkEvent_Tags.AutoOptimization: { ordinalConverter.write(7, into); const inner = value.inner; FfiConverterTypeAutoOptimizationEvent.write( inner.optimizationEvent, into ); return; } case SdkEvent_Tags.LightningAddressChanged: { ordinalConverter.write(8, into); const inner = value.inner; FfiConverterOptionalTypeLightningAddressInfo.write( inner.lightningAddress, into ); return; } case SdkEvent_Tags.NewDeposits: { ordinalConverter.write(9, into); const inner = value.inner; FfiConverterArrayTypeDepositInfo.write(inner.newDeposits, into); return; } case SdkEvent_Tags.UnilateralExitStateChanged: { ordinalConverter.write(10, into); return; } default: // Throwing from here means that SdkEvent_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case SdkEvent_Tags.Synced: { return ordinalConverter.allocationSize(1); } case SdkEvent_Tags.UnclaimedDeposits: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterArrayTypeDepositInfo.allocationSize( inner.unclaimedDeposits ); return size; } case SdkEvent_Tags.ClaimedDeposits: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterArrayTypeDepositInfo.allocationSize( inner.claimedDeposits ); return size; } case SdkEvent_Tags.PaymentSucceeded: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterTypePayment.allocationSize(inner.payment); return size; } case SdkEvent_Tags.PaymentPending: { const inner = value.inner; let size = ordinalConverter.allocationSize(5); size += FfiConverterTypePayment.allocationSize(inner.payment); return size; } case SdkEvent_Tags.PaymentFailed: { const inner = value.inner; let size = ordinalConverter.allocationSize(6); size += FfiConverterTypePayment.allocationSize(inner.payment); return size; } case SdkEvent_Tags.AutoOptimization: { const inner = value.inner; let size = ordinalConverter.allocationSize(7); size += FfiConverterTypeAutoOptimizationEvent.allocationSize( inner.optimizationEvent ); return size; } case SdkEvent_Tags.LightningAddressChanged: { const inner = value.inner; let size = ordinalConverter.allocationSize(8); size += FfiConverterOptionalTypeLightningAddressInfo.allocationSize( inner.lightningAddress ); return size; } case SdkEvent_Tags.NewDeposits: { const inner = value.inner; let size = ordinalConverter.allocationSize(9); size += FfiConverterArrayTypeDepositInfo.allocationSize( inner.newDeposits ); return size; } case SdkEvent_Tags.UnilateralExitStateChanged: { return ordinalConverter.allocationSize(10); } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: Seed export enum Seed_Tags { Mnemonic = 'Mnemonic', Entropy = 'Entropy', } /** * Represents the seed for wallet generation, either as a mnemonic phrase with an optional * passphrase or as raw entropy bytes. */ export const Seed = (() => { type Mnemonic__interface = { tag: Seed_Tags.Mnemonic; inner: Readonly<{ mnemonic: string; passphrase: string | undefined }>; }; /** * A BIP-39 mnemonic phrase with an optional passphrase. */ class Mnemonic_ extends UniffiEnum implements Mnemonic__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'Seed'; readonly tag = Seed_Tags.Mnemonic; readonly inner: Readonly<{ mnemonic: string; passphrase: string | undefined; }>; constructor(inner: { /** * The mnemonic phrase. 12 or 24 words. */ mnemonic: string; /** * An optional passphrase for the mnemonic. */ passphrase: string | undefined; }) { super('Seed', 'Mnemonic'); this.inner = Object.freeze(inner); } static new(inner: { /** * The mnemonic phrase. 12 or 24 words. */ mnemonic: string; /** * An optional passphrase for the mnemonic. */ passphrase: string | undefined; }): Mnemonic_ { return new Mnemonic_(inner); } static instanceOf(obj: any): obj is Mnemonic_ { return obj.tag === Seed_Tags.Mnemonic; } } type Entropy__interface = { tag: Seed_Tags.Entropy; inner: Readonly<[ArrayBuffer]>; }; /** * Raw entropy bytes. */ class Entropy_ extends UniffiEnum implements Entropy__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'Seed'; readonly tag = Seed_Tags.Entropy; readonly inner: Readonly<[ArrayBuffer]>; constructor(v0: ArrayBuffer) { super('Seed', 'Entropy'); this.inner = Object.freeze([v0]); } static new(v0: ArrayBuffer): Entropy_ { return new Entropy_(v0); } static instanceOf(obj: any): obj is Entropy_ { return obj.tag === Seed_Tags.Entropy; } } function instanceOf(obj: any): obj is Seed { return obj[uniffiTypeNameSymbol] === 'Seed'; } return Object.freeze({ instanceOf, Mnemonic: Mnemonic_, Entropy: Entropy_, }); })(); /** * Represents the seed for wallet generation, either as a mnemonic phrase with an optional * passphrase or as raw entropy bytes. */ export type Seed = InstanceType< (typeof Seed)[keyof Omit] >; // FfiConverter for enum Seed const FfiConverterTypeSeed = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = Seed; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new Seed.Mnemonic({ mnemonic: FfiConverterString.read(from), passphrase: FfiConverterOptionalString.read(from), }); case 2: return new Seed.Entropy(FfiConverterArrayBuffer.read(from)); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case Seed_Tags.Mnemonic: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.mnemonic, into); FfiConverterOptionalString.write(inner.passphrase, into); return; } case Seed_Tags.Entropy: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterArrayBuffer.write(inner[0], into); return; } default: // Throwing from here means that Seed_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case Seed_Tags.Mnemonic: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.mnemonic); size += FfiConverterOptionalString.allocationSize(inner.passphrase); return size; } case Seed_Tags.Entropy: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterArrayBuffer.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: SendPaymentMethod export enum SendPaymentMethod_Tags { BitcoinAddress = 'BitcoinAddress', Bolt11Invoice = 'Bolt11Invoice', SparkAddress = 'SparkAddress', SparkInvoice = 'SparkInvoice', CrossChainAddress = 'CrossChainAddress', } export const SendPaymentMethod = (() => { type BitcoinAddress__interface = { tag: SendPaymentMethod_Tags.BitcoinAddress; inner: Readonly<{ address: BitcoinAddressDetails; feeQuote: SendOnchainFeeQuote; }>; }; class BitcoinAddress_ extends UniffiEnum implements BitcoinAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SendPaymentMethod'; readonly tag = SendPaymentMethod_Tags.BitcoinAddress; readonly inner: Readonly<{ address: BitcoinAddressDetails; feeQuote: SendOnchainFeeQuote; }>; constructor(inner: { address: BitcoinAddressDetails; feeQuote: SendOnchainFeeQuote; }) { super('SendPaymentMethod', 'BitcoinAddress'); this.inner = Object.freeze(inner); } static new(inner: { address: BitcoinAddressDetails; feeQuote: SendOnchainFeeQuote; }): BitcoinAddress_ { return new BitcoinAddress_(inner); } static instanceOf(obj: any): obj is BitcoinAddress_ { return obj.tag === SendPaymentMethod_Tags.BitcoinAddress; } } type Bolt11Invoice__interface = { tag: SendPaymentMethod_Tags.Bolt11Invoice; inner: Readonly<{ invoiceDetails: Bolt11InvoiceDetails; sparkTransferFeeSats: /*u64*/ bigint | undefined; lightningFeeSats: /*u64*/ bigint; }>; }; class Bolt11Invoice_ extends UniffiEnum implements Bolt11Invoice__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SendPaymentMethod'; readonly tag = SendPaymentMethod_Tags.Bolt11Invoice; readonly inner: Readonly<{ invoiceDetails: Bolt11InvoiceDetails; sparkTransferFeeSats: /*u64*/ bigint | undefined; lightningFeeSats: /*u64*/ bigint; }>; constructor(inner: { invoiceDetails: Bolt11InvoiceDetails; sparkTransferFeeSats: /*u64*/ bigint | undefined; lightningFeeSats: /*u64*/ bigint; }) { super('SendPaymentMethod', 'Bolt11Invoice'); this.inner = Object.freeze(inner); } static new(inner: { invoiceDetails: Bolt11InvoiceDetails; sparkTransferFeeSats: /*u64*/ bigint | undefined; lightningFeeSats: /*u64*/ bigint; }): Bolt11Invoice_ { return new Bolt11Invoice_(inner); } static instanceOf(obj: any): obj is Bolt11Invoice_ { return obj.tag === SendPaymentMethod_Tags.Bolt11Invoice; } } type SparkAddress__interface = { tag: SendPaymentMethod_Tags.SparkAddress; inner: Readonly<{ address: string; fee: U128; tokenIdentifier: string | undefined; }>; }; class SparkAddress_ extends UniffiEnum implements SparkAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SendPaymentMethod'; readonly tag = SendPaymentMethod_Tags.SparkAddress; readonly inner: Readonly<{ address: string; fee: U128; tokenIdentifier: string | undefined; }>; constructor(inner: { address: string; /** * Fee to pay for the transaction * Denominated in sats if token identifier is empty, otherwise in the token base units */ fee: U128; /** * The presence of this field indicates that the payment is for a token * If empty, it is a Bitcoin payment */ tokenIdentifier: string | undefined; }) { super('SendPaymentMethod', 'SparkAddress'); this.inner = Object.freeze(inner); } static new(inner: { address: string; /** * Fee to pay for the transaction * Denominated in sats if token identifier is empty, otherwise in the token base units */ fee: U128; /** * The presence of this field indicates that the payment is for a token * If empty, it is a Bitcoin payment */ tokenIdentifier: string | undefined; }): SparkAddress_ { return new SparkAddress_(inner); } static instanceOf(obj: any): obj is SparkAddress_ { return obj.tag === SendPaymentMethod_Tags.SparkAddress; } } type SparkInvoice__interface = { tag: SendPaymentMethod_Tags.SparkInvoice; inner: Readonly<{ sparkInvoiceDetails: SparkInvoiceDetails; fee: U128; tokenIdentifier: string | undefined; }>; }; class SparkInvoice_ extends UniffiEnum implements SparkInvoice__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SendPaymentMethod'; readonly tag = SendPaymentMethod_Tags.SparkInvoice; readonly inner: Readonly<{ sparkInvoiceDetails: SparkInvoiceDetails; fee: U128; tokenIdentifier: string | undefined; }>; constructor(inner: { sparkInvoiceDetails: SparkInvoiceDetails; /** * Fee to pay for the transaction * Denominated in sats if token identifier is empty, otherwise in the token base units */ fee: U128; /** * The presence of this field indicates that the payment is for a token * If empty, it is a Bitcoin payment */ tokenIdentifier: string | undefined; }) { super('SendPaymentMethod', 'SparkInvoice'); this.inner = Object.freeze(inner); } static new(inner: { sparkInvoiceDetails: SparkInvoiceDetails; /** * Fee to pay for the transaction * Denominated in sats if token identifier is empty, otherwise in the token base units */ fee: U128; /** * The presence of this field indicates that the payment is for a token * If empty, it is a Bitcoin payment */ tokenIdentifier: string | undefined; }): SparkInvoice_ { return new SparkInvoice_(inner); } static instanceOf(obj: any): obj is SparkInvoice_ { return obj.tag === SendPaymentMethod_Tags.SparkInvoice; } } type CrossChainAddress__interface = { tag: SendPaymentMethod_Tags.CrossChainAddress; inner: Readonly<{ route: CrossChainRoutePair; recipientAddress: string; amountIn: U128; assetAmountIn: U128; estimatedOut: U128; feeAmount: U128; serviceFeeAmount: U128; serviceFeeAsset: string | undefined; sourceTransferFeeSats: /*u64*/ bigint; feeMode: CrossChainFeeMode; expiresAt: string; providerContext: CrossChainProviderContext; }>; }; /** * A cross-chain send via a bridge/swap provider. */ class CrossChainAddress_ extends UniffiEnum implements CrossChainAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SendPaymentMethod'; readonly tag = SendPaymentMethod_Tags.CrossChainAddress; readonly inner: Readonly<{ route: CrossChainRoutePair; recipientAddress: string; amountIn: U128; assetAmountIn: U128; estimatedOut: U128; feeAmount: U128; serviceFeeAmount: U128; serviceFeeAsset: string | undefined; sourceTransferFeeSats: /*u64*/ bigint; feeMode: CrossChainFeeMode; expiresAt: string; providerContext: CrossChainProviderContext; }>; constructor(inner: { /** * The route selected for this cross-chain send (includes provider, chain, asset). */ route: CrossChainRoutePair; /** * Raw destination address (e.g. `0xabc...`). */ recipientAddress: string; /** * Amount routed to the provider, in the route's source-asset units * (Boltz invoice sats; Orchestra deposit sats/token). On the * token-conversion path (both `FeesIncluded` and `FeesExcluded`) * the dispatcher overrides this with the wallet-side token debit * when the source token and destination asset form a USD-stable pair. */ amountIn: U128; /** * `amount_in` expressed in the cross-chain (destination) asset's * base units, via the same rate the SDK used at prepare time. */ assetAmountIn: U128; /** * Estimated recipient amount in cross-chain asset base units. */ estimatedOut: U128; /** * Prepare-time total user-visible fee in cross-chain asset base units. * Covers provider spread + bridge/gas + DEX slippage. On the * token-conversion path it also rolls in the LN routing budget; on * the direct path that budget lives separately in * `source_transfer_fee_sats`. */ feeAmount: U128; /** * Provider's own service fee/spread in its native denomination. */ serviceFeeAmount: U128; /** * Asset which service fee is denominated in. Unset means BTC sats. */ serviceFeeAsset: string | undefined; /** * Sats budget for moving the amount in from the wallet to the provider. */ sourceTransferFeeSats: /*u64*/ bigint; /** * Fee mode the prepare ran under; the send stage matches. */ feeMode: CrossChainFeeMode; /** * ISO8601 timestamp after which the quote is no longer valid. */ expiresAt: string; /** * Provider-internal state, produced when preparing and consumed * when sending. */ providerContext: CrossChainProviderContext; }) { super('SendPaymentMethod', 'CrossChainAddress'); this.inner = Object.freeze(inner); } static new(inner: { /** * The route selected for this cross-chain send (includes provider, chain, asset). */ route: CrossChainRoutePair; /** * Raw destination address (e.g. `0xabc...`). */ recipientAddress: string; /** * Amount routed to the provider, in the route's source-asset units * (Boltz invoice sats; Orchestra deposit sats/token). On the * token-conversion path (both `FeesIncluded` and `FeesExcluded`) * the dispatcher overrides this with the wallet-side token debit * when the source token and destination asset form a USD-stable pair. */ amountIn: U128; /** * `amount_in` expressed in the cross-chain (destination) asset's * base units, via the same rate the SDK used at prepare time. */ assetAmountIn: U128; /** * Estimated recipient amount in cross-chain asset base units. */ estimatedOut: U128; /** * Prepare-time total user-visible fee in cross-chain asset base units. * Covers provider spread + bridge/gas + DEX slippage. On the * token-conversion path it also rolls in the LN routing budget; on * the direct path that budget lives separately in * `source_transfer_fee_sats`. */ feeAmount: U128; /** * Provider's own service fee/spread in its native denomination. */ serviceFeeAmount: U128; /** * Asset which service fee is denominated in. Unset means BTC sats. */ serviceFeeAsset: string | undefined; /** * Sats budget for moving the amount in from the wallet to the provider. */ sourceTransferFeeSats: /*u64*/ bigint; /** * Fee mode the prepare ran under; the send stage matches. */ feeMode: CrossChainFeeMode; /** * ISO8601 timestamp after which the quote is no longer valid. */ expiresAt: string; /** * Provider-internal state, produced when preparing and consumed * when sending. */ providerContext: CrossChainProviderContext; }): CrossChainAddress_ { return new CrossChainAddress_(inner); } static instanceOf(obj: any): obj is CrossChainAddress_ { return obj.tag === SendPaymentMethod_Tags.CrossChainAddress; } } function instanceOf(obj: any): obj is SendPaymentMethod { return obj[uniffiTypeNameSymbol] === 'SendPaymentMethod'; } return Object.freeze({ instanceOf, BitcoinAddress: BitcoinAddress_, Bolt11Invoice: Bolt11Invoice_, SparkAddress: SparkAddress_, SparkInvoice: SparkInvoice_, CrossChainAddress: CrossChainAddress_, }); })(); export type SendPaymentMethod = InstanceType< (typeof SendPaymentMethod)[keyof Omit] >; // FfiConverter for enum SendPaymentMethod const FfiConverterTypeSendPaymentMethod = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SendPaymentMethod; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new SendPaymentMethod.BitcoinAddress({ address: FfiConverterTypeBitcoinAddressDetails.read(from), feeQuote: FfiConverterTypeSendOnchainFeeQuote.read(from), }); case 2: return new SendPaymentMethod.Bolt11Invoice({ invoiceDetails: FfiConverterTypeBolt11InvoiceDetails.read(from), sparkTransferFeeSats: FfiConverterOptionalUInt64.read(from), lightningFeeSats: FfiConverterUInt64.read(from), }); case 3: return new SendPaymentMethod.SparkAddress({ address: FfiConverterString.read(from), fee: FfiConverterTypeu128.read(from), tokenIdentifier: FfiConverterOptionalString.read(from), }); case 4: return new SendPaymentMethod.SparkInvoice({ sparkInvoiceDetails: FfiConverterTypeSparkInvoiceDetails.read(from), fee: FfiConverterTypeu128.read(from), tokenIdentifier: FfiConverterOptionalString.read(from), }); case 5: return new SendPaymentMethod.CrossChainAddress({ route: FfiConverterTypeCrossChainRoutePair.read(from), recipientAddress: FfiConverterString.read(from), amountIn: FfiConverterTypeu128.read(from), assetAmountIn: FfiConverterTypeu128.read(from), estimatedOut: FfiConverterTypeu128.read(from), feeAmount: FfiConverterTypeu128.read(from), serviceFeeAmount: FfiConverterTypeu128.read(from), serviceFeeAsset: FfiConverterOptionalString.read(from), sourceTransferFeeSats: FfiConverterUInt64.read(from), feeMode: FfiConverterTypeCrossChainFeeMode.read(from), expiresAt: FfiConverterString.read(from), providerContext: FfiConverterTypeCrossChainProviderContext.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case SendPaymentMethod_Tags.BitcoinAddress: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeBitcoinAddressDetails.write(inner.address, into); FfiConverterTypeSendOnchainFeeQuote.write(inner.feeQuote, into); return; } case SendPaymentMethod_Tags.Bolt11Invoice: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeBolt11InvoiceDetails.write( inner.invoiceDetails, into ); FfiConverterOptionalUInt64.write(inner.sparkTransferFeeSats, into); FfiConverterUInt64.write(inner.lightningFeeSats, into); return; } case SendPaymentMethod_Tags.SparkAddress: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner.address, into); FfiConverterTypeu128.write(inner.fee, into); FfiConverterOptionalString.write(inner.tokenIdentifier, into); return; } case SendPaymentMethod_Tags.SparkInvoice: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterTypeSparkInvoiceDetails.write( inner.sparkInvoiceDetails, into ); FfiConverterTypeu128.write(inner.fee, into); FfiConverterOptionalString.write(inner.tokenIdentifier, into); return; } case SendPaymentMethod_Tags.CrossChainAddress: { ordinalConverter.write(5, into); const inner = value.inner; FfiConverterTypeCrossChainRoutePair.write(inner.route, into); FfiConverterString.write(inner.recipientAddress, into); FfiConverterTypeu128.write(inner.amountIn, into); FfiConverterTypeu128.write(inner.assetAmountIn, into); FfiConverterTypeu128.write(inner.estimatedOut, into); FfiConverterTypeu128.write(inner.feeAmount, into); FfiConverterTypeu128.write(inner.serviceFeeAmount, into); FfiConverterOptionalString.write(inner.serviceFeeAsset, into); FfiConverterUInt64.write(inner.sourceTransferFeeSats, into); FfiConverterTypeCrossChainFeeMode.write(inner.feeMode, into); FfiConverterString.write(inner.expiresAt, into); FfiConverterTypeCrossChainProviderContext.write( inner.providerContext, into ); return; } default: // Throwing from here means that SendPaymentMethod_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case SendPaymentMethod_Tags.BitcoinAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeBitcoinAddressDetails.allocationSize( inner.address ); size += FfiConverterTypeSendOnchainFeeQuote.allocationSize( inner.feeQuote ); return size; } case SendPaymentMethod_Tags.Bolt11Invoice: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeBolt11InvoiceDetails.allocationSize( inner.invoiceDetails ); size += FfiConverterOptionalUInt64.allocationSize( inner.sparkTransferFeeSats ); size += FfiConverterUInt64.allocationSize(inner.lightningFeeSats); return size; } case SendPaymentMethod_Tags.SparkAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner.address); size += FfiConverterTypeu128.allocationSize(inner.fee); size += FfiConverterOptionalString.allocationSize( inner.tokenIdentifier ); return size; } case SendPaymentMethod_Tags.SparkInvoice: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterTypeSparkInvoiceDetails.allocationSize( inner.sparkInvoiceDetails ); size += FfiConverterTypeu128.allocationSize(inner.fee); size += FfiConverterOptionalString.allocationSize( inner.tokenIdentifier ); return size; } case SendPaymentMethod_Tags.CrossChainAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(5); size += FfiConverterTypeCrossChainRoutePair.allocationSize( inner.route ); size += FfiConverterString.allocationSize(inner.recipientAddress); size += FfiConverterTypeu128.allocationSize(inner.amountIn); size += FfiConverterTypeu128.allocationSize(inner.assetAmountIn); size += FfiConverterTypeu128.allocationSize(inner.estimatedOut); size += FfiConverterTypeu128.allocationSize(inner.feeAmount); size += FfiConverterTypeu128.allocationSize(inner.serviceFeeAmount); size += FfiConverterOptionalString.allocationSize( inner.serviceFeeAsset ); size += FfiConverterUInt64.allocationSize( inner.sourceTransferFeeSats ); size += FfiConverterTypeCrossChainFeeMode.allocationSize( inner.feeMode ); size += FfiConverterString.allocationSize(inner.expiresAt); size += FfiConverterTypeCrossChainProviderContext.allocationSize( inner.providerContext ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: SendPaymentOptions export enum SendPaymentOptions_Tags { BitcoinAddress = 'BitcoinAddress', Bolt11Invoice = 'Bolt11Invoice', SparkAddress = 'SparkAddress', } export const SendPaymentOptions = (() => { type BitcoinAddress__interface = { tag: SendPaymentOptions_Tags.BitcoinAddress; inner: Readonly<{ confirmationSpeed: OnchainConfirmationSpeed }>; }; class BitcoinAddress_ extends UniffiEnum implements BitcoinAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SendPaymentOptions'; readonly tag = SendPaymentOptions_Tags.BitcoinAddress; readonly inner: Readonly<{ confirmationSpeed: OnchainConfirmationSpeed }>; constructor(inner: { /** * Confirmation speed for the on-chain transaction. */ confirmationSpeed: OnchainConfirmationSpeed; }) { super('SendPaymentOptions', 'BitcoinAddress'); this.inner = Object.freeze(inner); } static new(inner: { /** * Confirmation speed for the on-chain transaction. */ confirmationSpeed: OnchainConfirmationSpeed; }): BitcoinAddress_ { return new BitcoinAddress_(inner); } static instanceOf(obj: any): obj is BitcoinAddress_ { return obj.tag === SendPaymentOptions_Tags.BitcoinAddress; } } type Bolt11Invoice__interface = { tag: SendPaymentOptions_Tags.Bolt11Invoice; inner: Readonly<{ preferSpark: boolean; completionTimeoutSecs: /*u32*/ number | undefined; }>; }; class Bolt11Invoice_ extends UniffiEnum implements Bolt11Invoice__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SendPaymentOptions'; readonly tag = SendPaymentOptions_Tags.Bolt11Invoice; readonly inner: Readonly<{ preferSpark: boolean; completionTimeoutSecs: /*u32*/ number | undefined; }>; constructor(inner: { preferSpark: boolean; /** * If set, the function will return the payment if it is still pending after this * number of seconds. If unset, the function will return immediately after initiating the payment. */ completionTimeoutSecs: /*u32*/ number | undefined; }) { super('SendPaymentOptions', 'Bolt11Invoice'); this.inner = Object.freeze(inner); } static new(inner: { preferSpark: boolean; /** * If set, the function will return the payment if it is still pending after this * number of seconds. If unset, the function will return immediately after initiating the payment. */ completionTimeoutSecs: /*u32*/ number | undefined; }): Bolt11Invoice_ { return new Bolt11Invoice_(inner); } static instanceOf(obj: any): obj is Bolt11Invoice_ { return obj.tag === SendPaymentOptions_Tags.Bolt11Invoice; } } type SparkAddress__interface = { tag: SendPaymentOptions_Tags.SparkAddress; inner: Readonly<{ htlcOptions: SparkHtlcOptions | undefined }>; }; class SparkAddress_ extends UniffiEnum implements SparkAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SendPaymentOptions'; readonly tag = SendPaymentOptions_Tags.SparkAddress; readonly inner: Readonly<{ htlcOptions: SparkHtlcOptions | undefined }>; constructor(inner: { /** * Can only be provided for Bitcoin payments. If set, a Spark HTLC transfer will be created. * The receiver will need to provide the preimage to claim it. */ htlcOptions: SparkHtlcOptions | undefined; }) { super('SendPaymentOptions', 'SparkAddress'); this.inner = Object.freeze(inner); } static new(inner: { /** * Can only be provided for Bitcoin payments. If set, a Spark HTLC transfer will be created. * The receiver will need to provide the preimage to claim it. */ htlcOptions: SparkHtlcOptions | undefined; }): SparkAddress_ { return new SparkAddress_(inner); } static instanceOf(obj: any): obj is SparkAddress_ { return obj.tag === SendPaymentOptions_Tags.SparkAddress; } } function instanceOf(obj: any): obj is SendPaymentOptions { return obj[uniffiTypeNameSymbol] === 'SendPaymentOptions'; } return Object.freeze({ instanceOf, BitcoinAddress: BitcoinAddress_, Bolt11Invoice: Bolt11Invoice_, SparkAddress: SparkAddress_, }); })(); export type SendPaymentOptions = InstanceType< (typeof SendPaymentOptions)[keyof Omit< typeof SendPaymentOptions, 'instanceOf' >] >; // FfiConverter for enum SendPaymentOptions const FfiConverterTypeSendPaymentOptions = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SendPaymentOptions; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new SendPaymentOptions.BitcoinAddress({ confirmationSpeed: FfiConverterTypeOnchainConfirmationSpeed.read(from), }); case 2: return new SendPaymentOptions.Bolt11Invoice({ preferSpark: FfiConverterBool.read(from), completionTimeoutSecs: FfiConverterOptionalUInt32.read(from), }); case 3: return new SendPaymentOptions.SparkAddress({ htlcOptions: FfiConverterOptionalTypeSparkHtlcOptions.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case SendPaymentOptions_Tags.BitcoinAddress: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeOnchainConfirmationSpeed.write( inner.confirmationSpeed, into ); return; } case SendPaymentOptions_Tags.Bolt11Invoice: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterBool.write(inner.preferSpark, into); FfiConverterOptionalUInt32.write(inner.completionTimeoutSecs, into); return; } case SendPaymentOptions_Tags.SparkAddress: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterOptionalTypeSparkHtlcOptions.write( inner.htlcOptions, into ); return; } default: // Throwing from here means that SendPaymentOptions_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case SendPaymentOptions_Tags.BitcoinAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeOnchainConfirmationSpeed.allocationSize( inner.confirmationSpeed ); return size; } case SendPaymentOptions_Tags.Bolt11Invoice: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterBool.allocationSize(inner.preferSpark); size += FfiConverterOptionalUInt32.allocationSize( inner.completionTimeoutSecs ); return size; } case SendPaymentOptions_Tags.SparkAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterOptionalTypeSparkHtlcOptions.allocationSize( inner.htlcOptions ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Error type: ServiceConnectivityError // Enum: ServiceConnectivityError export enum ServiceConnectivityError_Tags { Builder = 'Builder', Redirect = 'Redirect', Status = 'Status', Timeout = 'Timeout', Request = 'Request', Connect = 'Connect', Body = 'Body', Decode = 'Decode', Json = 'Json', Other = 'Other', } export const ServiceConnectivityError = (() => { type Builder__interface = { tag: ServiceConnectivityError_Tags.Builder; inner: Readonly<[string]>; }; class Builder_ extends UniffiError implements Builder__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ServiceConnectivityError'; readonly tag = ServiceConnectivityError_Tags.Builder; readonly inner: Readonly<[string]>; constructor(v0: string) { super('ServiceConnectivityError', 'Builder'); this.inner = Object.freeze([v0]); } static new(v0: string): Builder_ { return new Builder_(v0); } static instanceOf(obj: any): obj is Builder_ { return obj.tag === ServiceConnectivityError_Tags.Builder; } static hasInner(obj: any): obj is Builder_ { return Builder_.instanceOf(obj); } static getInner(obj: Builder_): Readonly<[string]> { return obj.inner; } } type Redirect__interface = { tag: ServiceConnectivityError_Tags.Redirect; inner: Readonly<[string]>; }; class Redirect_ extends UniffiError implements Redirect__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ServiceConnectivityError'; readonly tag = ServiceConnectivityError_Tags.Redirect; readonly inner: Readonly<[string]>; constructor(v0: string) { super('ServiceConnectivityError', 'Redirect'); this.inner = Object.freeze([v0]); } static new(v0: string): Redirect_ { return new Redirect_(v0); } static instanceOf(obj: any): obj is Redirect_ { return obj.tag === ServiceConnectivityError_Tags.Redirect; } static hasInner(obj: any): obj is Redirect_ { return Redirect_.instanceOf(obj); } static getInner(obj: Redirect_): Readonly<[string]> { return obj.inner; } } type Status__interface = { tag: ServiceConnectivityError_Tags.Status; inner: Readonly<{ status: /*u16*/ number; body: string }>; }; class Status_ extends UniffiError implements Status__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ServiceConnectivityError'; readonly tag = ServiceConnectivityError_Tags.Status; readonly inner: Readonly<{ status: /*u16*/ number; body: string }>; constructor(inner: { status: /*u16*/ number; body: string }) { super('ServiceConnectivityError', 'Status'); this.inner = Object.freeze(inner); } static new(inner: { status: /*u16*/ number; body: string }): Status_ { return new Status_(inner); } static instanceOf(obj: any): obj is Status_ { return obj.tag === ServiceConnectivityError_Tags.Status; } static hasInner(obj: any): obj is Status_ { return Status_.instanceOf(obj); } static getInner( obj: Status_ ): Readonly<{ status: /*u16*/ number; body: string }> { return obj.inner; } } type Timeout__interface = { tag: ServiceConnectivityError_Tags.Timeout; inner: Readonly<[string]>; }; class Timeout_ extends UniffiError implements Timeout__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ServiceConnectivityError'; readonly tag = ServiceConnectivityError_Tags.Timeout; readonly inner: Readonly<[string]>; constructor(v0: string) { super('ServiceConnectivityError', 'Timeout'); this.inner = Object.freeze([v0]); } static new(v0: string): Timeout_ { return new Timeout_(v0); } static instanceOf(obj: any): obj is Timeout_ { return obj.tag === ServiceConnectivityError_Tags.Timeout; } static hasInner(obj: any): obj is Timeout_ { return Timeout_.instanceOf(obj); } static getInner(obj: Timeout_): Readonly<[string]> { return obj.inner; } } type Request__interface = { tag: ServiceConnectivityError_Tags.Request; inner: Readonly<[string]>; }; class Request_ extends UniffiError implements Request__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ServiceConnectivityError'; readonly tag = ServiceConnectivityError_Tags.Request; readonly inner: Readonly<[string]>; constructor(v0: string) { super('ServiceConnectivityError', 'Request'); this.inner = Object.freeze([v0]); } static new(v0: string): Request_ { return new Request_(v0); } static instanceOf(obj: any): obj is Request_ { return obj.tag === ServiceConnectivityError_Tags.Request; } static hasInner(obj: any): obj is Request_ { return Request_.instanceOf(obj); } static getInner(obj: Request_): Readonly<[string]> { return obj.inner; } } type Connect__interface = { tag: ServiceConnectivityError_Tags.Connect; inner: Readonly<[string]>; }; class Connect_ extends UniffiError implements Connect__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ServiceConnectivityError'; readonly tag = ServiceConnectivityError_Tags.Connect; readonly inner: Readonly<[string]>; constructor(v0: string) { super('ServiceConnectivityError', 'Connect'); this.inner = Object.freeze([v0]); } static new(v0: string): Connect_ { return new Connect_(v0); } static instanceOf(obj: any): obj is Connect_ { return obj.tag === ServiceConnectivityError_Tags.Connect; } static hasInner(obj: any): obj is Connect_ { return Connect_.instanceOf(obj); } static getInner(obj: Connect_): Readonly<[string]> { return obj.inner; } } type Body__interface = { tag: ServiceConnectivityError_Tags.Body; inner: Readonly<[string]>; }; class Body_ extends UniffiError implements Body__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ServiceConnectivityError'; readonly tag = ServiceConnectivityError_Tags.Body; readonly inner: Readonly<[string]>; constructor(v0: string) { super('ServiceConnectivityError', 'Body'); this.inner = Object.freeze([v0]); } static new(v0: string): Body_ { return new Body_(v0); } static instanceOf(obj: any): obj is Body_ { return obj.tag === ServiceConnectivityError_Tags.Body; } static hasInner(obj: any): obj is Body_ { return Body_.instanceOf(obj); } static getInner(obj: Body_): Readonly<[string]> { return obj.inner; } } type Decode__interface = { tag: ServiceConnectivityError_Tags.Decode; inner: Readonly<[string]>; }; class Decode_ extends UniffiError implements Decode__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ServiceConnectivityError'; readonly tag = ServiceConnectivityError_Tags.Decode; readonly inner: Readonly<[string]>; constructor(v0: string) { super('ServiceConnectivityError', 'Decode'); this.inner = Object.freeze([v0]); } static new(v0: string): Decode_ { return new Decode_(v0); } static instanceOf(obj: any): obj is Decode_ { return obj.tag === ServiceConnectivityError_Tags.Decode; } static hasInner(obj: any): obj is Decode_ { return Decode_.instanceOf(obj); } static getInner(obj: Decode_): Readonly<[string]> { return obj.inner; } } type Json__interface = { tag: ServiceConnectivityError_Tags.Json; inner: Readonly<[string]>; }; class Json_ extends UniffiError implements Json__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ServiceConnectivityError'; readonly tag = ServiceConnectivityError_Tags.Json; readonly inner: Readonly<[string]>; constructor(v0: string) { super('ServiceConnectivityError', 'Json'); this.inner = Object.freeze([v0]); } static new(v0: string): Json_ { return new Json_(v0); } static instanceOf(obj: any): obj is Json_ { return obj.tag === ServiceConnectivityError_Tags.Json; } static hasInner(obj: any): obj is Json_ { return Json_.instanceOf(obj); } static getInner(obj: Json_): Readonly<[string]> { return obj.inner; } } type Other__interface = { tag: ServiceConnectivityError_Tags.Other; inner: Readonly<[string]>; }; class Other_ extends UniffiError implements Other__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'ServiceConnectivityError'; readonly tag = ServiceConnectivityError_Tags.Other; readonly inner: Readonly<[string]>; constructor(v0: string) { super('ServiceConnectivityError', 'Other'); this.inner = Object.freeze([v0]); } static new(v0: string): Other_ { return new Other_(v0); } static instanceOf(obj: any): obj is Other_ { return obj.tag === ServiceConnectivityError_Tags.Other; } static hasInner(obj: any): obj is Other_ { return Other_.instanceOf(obj); } static getInner(obj: Other_): Readonly<[string]> { return obj.inner; } } function instanceOf(obj: any): obj is ServiceConnectivityError { return obj[uniffiTypeNameSymbol] === 'ServiceConnectivityError'; } return Object.freeze({ instanceOf, Builder: Builder_, Redirect: Redirect_, Status: Status_, Timeout: Timeout_, Request: Request_, Connect: Connect_, Body: Body_, Decode: Decode_, Json: Json_, Other: Other_, }); })(); export type ServiceConnectivityError = InstanceType< (typeof ServiceConnectivityError)[keyof Omit< typeof ServiceConnectivityError, 'instanceOf' >] >; // FfiConverter for enum ServiceConnectivityError const FfiConverterTypeServiceConnectivityError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ServiceConnectivityError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ServiceConnectivityError.Builder( FfiConverterString.read(from) ); case 2: return new ServiceConnectivityError.Redirect( FfiConverterString.read(from) ); case 3: return new ServiceConnectivityError.Status({ status: FfiConverterUInt16.read(from), body: FfiConverterString.read(from), }); case 4: return new ServiceConnectivityError.Timeout( FfiConverterString.read(from) ); case 5: return new ServiceConnectivityError.Request( FfiConverterString.read(from) ); case 6: return new ServiceConnectivityError.Connect( FfiConverterString.read(from) ); case 7: return new ServiceConnectivityError.Body( FfiConverterString.read(from) ); case 8: return new ServiceConnectivityError.Decode( FfiConverterString.read(from) ); case 9: return new ServiceConnectivityError.Json( FfiConverterString.read(from) ); case 10: return new ServiceConnectivityError.Other( FfiConverterString.read(from) ); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ServiceConnectivityError_Tags.Builder: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case ServiceConnectivityError_Tags.Redirect: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case ServiceConnectivityError_Tags.Status: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterUInt16.write(inner.status, into); FfiConverterString.write(inner.body, into); return; } case ServiceConnectivityError_Tags.Timeout: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case ServiceConnectivityError_Tags.Request: { ordinalConverter.write(5, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case ServiceConnectivityError_Tags.Connect: { ordinalConverter.write(6, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case ServiceConnectivityError_Tags.Body: { ordinalConverter.write(7, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case ServiceConnectivityError_Tags.Decode: { ordinalConverter.write(8, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case ServiceConnectivityError_Tags.Json: { ordinalConverter.write(9, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case ServiceConnectivityError_Tags.Other: { ordinalConverter.write(10, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } default: // Throwing from here means that ServiceConnectivityError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ServiceConnectivityError_Tags.Builder: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner[0]); return size; } case ServiceConnectivityError_Tags.Redirect: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner[0]); return size; } case ServiceConnectivityError_Tags.Status: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterUInt16.allocationSize(inner.status); size += FfiConverterString.allocationSize(inner.body); return size; } case ServiceConnectivityError_Tags.Timeout: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterString.allocationSize(inner[0]); return size; } case ServiceConnectivityError_Tags.Request: { const inner = value.inner; let size = ordinalConverter.allocationSize(5); size += FfiConverterString.allocationSize(inner[0]); return size; } case ServiceConnectivityError_Tags.Connect: { const inner = value.inner; let size = ordinalConverter.allocationSize(6); size += FfiConverterString.allocationSize(inner[0]); return size; } case ServiceConnectivityError_Tags.Body: { const inner = value.inner; let size = ordinalConverter.allocationSize(7); size += FfiConverterString.allocationSize(inner[0]); return size; } case ServiceConnectivityError_Tags.Decode: { const inner = value.inner; let size = ordinalConverter.allocationSize(8); size += FfiConverterString.allocationSize(inner[0]); return size; } case ServiceConnectivityError_Tags.Json: { const inner = value.inner; let size = ordinalConverter.allocationSize(9); size += FfiConverterString.allocationSize(inner[0]); return size; } case ServiceConnectivityError_Tags.Other: { const inner = value.inner; let size = ordinalConverter.allocationSize(10); size += FfiConverterString.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * The operational status of a Spark service. */ export enum ServiceStatus { /** * Service is fully operational. */ Operational, /** * Service is experiencing degraded performance. */ Degraded, /** * Service is partially unavailable. */ Partial, /** * Service status is unknown. */ Unknown, /** * Service is experiencing a major outage. */ Major, } const FfiConverterTypeServiceStatus = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ServiceStatus; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return ServiceStatus.Operational; case 2: return ServiceStatus.Degraded; case 3: return ServiceStatus.Partial; case 4: return ServiceStatus.Unknown; case 5: return ServiceStatus.Major; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case ServiceStatus.Operational: return ordinalConverter.write(1, into); case ServiceStatus.Degraded: return ordinalConverter.write(2, into); case ServiceStatus.Partial: return ordinalConverter.write(3, into); case ServiceStatus.Unknown: return ordinalConverter.write(4, into); case ServiceStatus.Major: return ordinalConverter.write(5, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Error type: SessionStoreError // Enum: SessionStoreError export enum SessionStoreError_Tags { NotFound = 'NotFound', Generic = 'Generic', } export const SessionStoreError = (() => { type NotFound__interface = { tag: SessionStoreError_Tags.NotFound; }; class NotFound_ extends UniffiError implements NotFound__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SessionStoreError'; readonly tag = SessionStoreError_Tags.NotFound; constructor() { super('SessionStoreError', 'NotFound'); } static new(): NotFound_ { return new NotFound_(); } static instanceOf(obj: any): obj is NotFound_ { return obj.tag === SessionStoreError_Tags.NotFound; } static hasInner(obj: any): obj is NotFound_ { return false; } } type Generic__interface = { tag: SessionStoreError_Tags.Generic; inner: Readonly<[string]>; }; class Generic_ extends UniffiError implements Generic__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SessionStoreError'; readonly tag = SessionStoreError_Tags.Generic; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SessionStoreError', 'Generic'); this.inner = Object.freeze([v0]); } static new(v0: string): Generic_ { return new Generic_(v0); } static instanceOf(obj: any): obj is Generic_ { return obj.tag === SessionStoreError_Tags.Generic; } static hasInner(obj: any): obj is Generic_ { return Generic_.instanceOf(obj); } static getInner(obj: Generic_): Readonly<[string]> { return obj.inner; } } function instanceOf(obj: any): obj is SessionStoreError { return obj[uniffiTypeNameSymbol] === 'SessionStoreError'; } return Object.freeze({ instanceOf, NotFound: NotFound_, Generic: Generic_, }); })(); export type SessionStoreError = InstanceType< (typeof SessionStoreError)[keyof Omit] >; // FfiConverter for enum SessionStoreError const FfiConverterTypeSessionStoreError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SessionStoreError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new SessionStoreError.NotFound(); case 2: return new SessionStoreError.Generic(FfiConverterString.read(from)); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case SessionStoreError_Tags.NotFound: { ordinalConverter.write(1, into); return; } case SessionStoreError_Tags.Generic: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } default: // Throwing from here means that SessionStoreError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case SessionStoreError_Tags.NotFound: { return ordinalConverter.allocationSize(1); } case SessionStoreError_Tags.Generic: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Error type: SignerError // Enum: SignerError export enum SignerError_Tags { KeyDerivation = 'KeyDerivation', Signing = 'Signing', Encryption = 'Encryption', Decryption = 'Decryption', EncryptionUnavailable = 'EncryptionUnavailable', Frost = 'Frost', InvalidInput = 'InvalidInput', Generic = 'Generic', } /** * Error type for signer operations */ export const SignerError = (() => { type KeyDerivation__interface = { tag: SignerError_Tags.KeyDerivation; inner: Readonly<[string]>; }; class KeyDerivation_ extends UniffiError implements KeyDerivation__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SignerError'; readonly tag = SignerError_Tags.KeyDerivation; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SignerError', 'KeyDerivation'); this.inner = Object.freeze([v0]); } static new(v0: string): KeyDerivation_ { return new KeyDerivation_(v0); } static instanceOf(obj: any): obj is KeyDerivation_ { return obj.tag === SignerError_Tags.KeyDerivation; } static hasInner(obj: any): obj is KeyDerivation_ { return KeyDerivation_.instanceOf(obj); } static getInner(obj: KeyDerivation_): Readonly<[string]> { return obj.inner; } } type Signing__interface = { tag: SignerError_Tags.Signing; inner: Readonly<[string]>; }; class Signing_ extends UniffiError implements Signing__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SignerError'; readonly tag = SignerError_Tags.Signing; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SignerError', 'Signing'); this.inner = Object.freeze([v0]); } static new(v0: string): Signing_ { return new Signing_(v0); } static instanceOf(obj: any): obj is Signing_ { return obj.tag === SignerError_Tags.Signing; } static hasInner(obj: any): obj is Signing_ { return Signing_.instanceOf(obj); } static getInner(obj: Signing_): Readonly<[string]> { return obj.inner; } } type Encryption__interface = { tag: SignerError_Tags.Encryption; inner: Readonly<[string]>; }; class Encryption_ extends UniffiError implements Encryption__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SignerError'; readonly tag = SignerError_Tags.Encryption; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SignerError', 'Encryption'); this.inner = Object.freeze([v0]); } static new(v0: string): Encryption_ { return new Encryption_(v0); } static instanceOf(obj: any): obj is Encryption_ { return obj.tag === SignerError_Tags.Encryption; } static hasInner(obj: any): obj is Encryption_ { return Encryption_.instanceOf(obj); } static getInner(obj: Encryption_): Readonly<[string]> { return obj.inner; } } type Decryption__interface = { tag: SignerError_Tags.Decryption; inner: Readonly<[string]>; }; class Decryption_ extends UniffiError implements Decryption__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SignerError'; readonly tag = SignerError_Tags.Decryption; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SignerError', 'Decryption'); this.inner = Object.freeze([v0]); } static new(v0: string): Decryption_ { return new Decryption_(v0); } static instanceOf(obj: any): obj is Decryption_ { return obj.tag === SignerError_Tags.Decryption; } static hasInner(obj: any): obj is Decryption_ { return Decryption_.instanceOf(obj); } static getInner(obj: Decryption_): Readonly<[string]> { return obj.inner; } } type EncryptionUnavailable__interface = { tag: SignerError_Tags.EncryptionUnavailable; inner: Readonly<[string]>; }; class EncryptionUnavailable_ extends UniffiError implements EncryptionUnavailable__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SignerError'; readonly tag = SignerError_Tags.EncryptionUnavailable; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SignerError', 'EncryptionUnavailable'); this.inner = Object.freeze([v0]); } static new(v0: string): EncryptionUnavailable_ { return new EncryptionUnavailable_(v0); } static instanceOf(obj: any): obj is EncryptionUnavailable_ { return obj.tag === SignerError_Tags.EncryptionUnavailable; } static hasInner(obj: any): obj is EncryptionUnavailable_ { return EncryptionUnavailable_.instanceOf(obj); } static getInner(obj: EncryptionUnavailable_): Readonly<[string]> { return obj.inner; } } type Frost__interface = { tag: SignerError_Tags.Frost; inner: Readonly<[string]>; }; class Frost_ extends UniffiError implements Frost__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SignerError'; readonly tag = SignerError_Tags.Frost; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SignerError', 'Frost'); this.inner = Object.freeze([v0]); } static new(v0: string): Frost_ { return new Frost_(v0); } static instanceOf(obj: any): obj is Frost_ { return obj.tag === SignerError_Tags.Frost; } static hasInner(obj: any): obj is Frost_ { return Frost_.instanceOf(obj); } static getInner(obj: Frost_): Readonly<[string]> { return obj.inner; } } type InvalidInput__interface = { tag: SignerError_Tags.InvalidInput; inner: Readonly<[string]>; }; class InvalidInput_ extends UniffiError implements InvalidInput__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SignerError'; readonly tag = SignerError_Tags.InvalidInput; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SignerError', 'InvalidInput'); this.inner = Object.freeze([v0]); } static new(v0: string): InvalidInput_ { return new InvalidInput_(v0); } static instanceOf(obj: any): obj is InvalidInput_ { return obj.tag === SignerError_Tags.InvalidInput; } static hasInner(obj: any): obj is InvalidInput_ { return InvalidInput_.instanceOf(obj); } static getInner(obj: InvalidInput_): Readonly<[string]> { return obj.inner; } } type Generic__interface = { tag: SignerError_Tags.Generic; inner: Readonly<[string]>; }; class Generic_ extends UniffiError implements Generic__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SignerError'; readonly tag = SignerError_Tags.Generic; readonly inner: Readonly<[string]>; constructor(v0: string) { super('SignerError', 'Generic'); this.inner = Object.freeze([v0]); } static new(v0: string): Generic_ { return new Generic_(v0); } static instanceOf(obj: any): obj is Generic_ { return obj.tag === SignerError_Tags.Generic; } static hasInner(obj: any): obj is Generic_ { return Generic_.instanceOf(obj); } static getInner(obj: Generic_): Readonly<[string]> { return obj.inner; } } function instanceOf(obj: any): obj is SignerError { return obj[uniffiTypeNameSymbol] === 'SignerError'; } return Object.freeze({ instanceOf, KeyDerivation: KeyDerivation_, Signing: Signing_, Encryption: Encryption_, Decryption: Decryption_, EncryptionUnavailable: EncryptionUnavailable_, Frost: Frost_, InvalidInput: InvalidInput_, Generic: Generic_, }); })(); /** * Error type for signer operations */ export type SignerError = InstanceType< (typeof SignerError)[keyof Omit] >; // FfiConverter for enum SignerError const FfiConverterTypeSignerError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SignerError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new SignerError.KeyDerivation(FfiConverterString.read(from)); case 2: return new SignerError.Signing(FfiConverterString.read(from)); case 3: return new SignerError.Encryption(FfiConverterString.read(from)); case 4: return new SignerError.Decryption(FfiConverterString.read(from)); case 5: return new SignerError.EncryptionUnavailable( FfiConverterString.read(from) ); case 6: return new SignerError.Frost(FfiConverterString.read(from)); case 7: return new SignerError.InvalidInput(FfiConverterString.read(from)); case 8: return new SignerError.Generic(FfiConverterString.read(from)); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case SignerError_Tags.KeyDerivation: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SignerError_Tags.Signing: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SignerError_Tags.Encryption: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SignerError_Tags.Decryption: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SignerError_Tags.EncryptionUnavailable: { ordinalConverter.write(5, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SignerError_Tags.Frost: { ordinalConverter.write(6, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SignerError_Tags.InvalidInput: { ordinalConverter.write(7, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case SignerError_Tags.Generic: { ordinalConverter.write(8, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } default: // Throwing from here means that SignerError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case SignerError_Tags.KeyDerivation: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner[0]); return size; } case SignerError_Tags.Signing: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner[0]); return size; } case SignerError_Tags.Encryption: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner[0]); return size; } case SignerError_Tags.Decryption: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterString.allocationSize(inner[0]); return size; } case SignerError_Tags.EncryptionUnavailable: { const inner = value.inner; let size = ordinalConverter.allocationSize(5); size += FfiConverterString.allocationSize(inner[0]); return size; } case SignerError_Tags.Frost: { const inner = value.inner; let size = ordinalConverter.allocationSize(6); size += FfiConverterString.allocationSize(inner[0]); return size; } case SignerError_Tags.InvalidInput: { const inner = value.inner; let size = ordinalConverter.allocationSize(7); size += FfiConverterString.allocationSize(inner[0]); return size; } case SignerError_Tags.Generic: { const inner = value.inner; let size = ordinalConverter.allocationSize(8); size += FfiConverterString.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: SparkAsset export enum SparkAsset_Tags { Bitcoin = 'Bitcoin', Token = 'Token', } /** * The asset a cross-chain route accepts on the Spark side. */ export const SparkAsset = (() => { type Bitcoin__interface = { tag: SparkAsset_Tags.Bitcoin; }; /** * Native BTC (sats). */ class Bitcoin_ extends UniffiEnum implements Bitcoin__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SparkAsset'; readonly tag = SparkAsset_Tags.Bitcoin; constructor() { super('SparkAsset', 'Bitcoin'); } static new(): Bitcoin_ { return new Bitcoin_(); } static instanceOf(obj: any): obj is Bitcoin_ { return obj.tag === SparkAsset_Tags.Bitcoin; } } type Token__interface = { tag: SparkAsset_Tags.Token; inner: Readonly<{ tokenIdentifier: string }>; }; /** * A Spark token, identified by its bech32m `token_identifier` (e.g. `btkn1...`). */ class Token_ extends UniffiEnum implements Token__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SparkAsset'; readonly tag = SparkAsset_Tags.Token; readonly inner: Readonly<{ tokenIdentifier: string }>; constructor(inner: { tokenIdentifier: string }) { super('SparkAsset', 'Token'); this.inner = Object.freeze(inner); } static new(inner: { tokenIdentifier: string }): Token_ { return new Token_(inner); } static instanceOf(obj: any): obj is Token_ { return obj.tag === SparkAsset_Tags.Token; } } function instanceOf(obj: any): obj is SparkAsset { return obj[uniffiTypeNameSymbol] === 'SparkAsset'; } return Object.freeze({ instanceOf, Bitcoin: Bitcoin_, Token: Token_, }); })(); /** * The asset a cross-chain route accepts on the Spark side. */ export type SparkAsset = InstanceType< (typeof SparkAsset)[keyof Omit] >; // FfiConverter for enum SparkAsset const FfiConverterTypeSparkAsset = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SparkAsset; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new SparkAsset.Bitcoin(); case 2: return new SparkAsset.Token({ tokenIdentifier: FfiConverterString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case SparkAsset_Tags.Bitcoin: { ordinalConverter.write(1, into); return; } case SparkAsset_Tags.Token: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.tokenIdentifier, into); return; } default: // Throwing from here means that SparkAsset_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case SparkAsset_Tags.Bitcoin: { return ordinalConverter.allocationSize(1); } case SparkAsset_Tags.Token: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.tokenIdentifier); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); export enum SparkHtlcStatus { /** * The HTLC is waiting for the preimage to be shared by the receiver */ WaitingForPreimage, /** * The HTLC preimage has been shared and the transfer can be or has been claimed by the receiver */ PreimageShared, /** * The HTLC has been returned to the sender due to expiry */ Returned, } const FfiConverterTypeSparkHtlcStatus = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SparkHtlcStatus; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return SparkHtlcStatus.WaitingForPreimage; case 2: return SparkHtlcStatus.PreimageShared; case 3: return SparkHtlcStatus.Returned; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case SparkHtlcStatus.WaitingForPreimage: return ordinalConverter.write(1, into); case SparkHtlcStatus.PreimageShared: return ordinalConverter.write(2, into); case SparkHtlcStatus.Returned: return ordinalConverter.write(3, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: SparkMasterIdentityPublicKey export enum SparkMasterIdentityPublicKey_Tags { Set = 'Set', Unset = 'Unset', } /** * Specifies how to update the wallet's Spark master identity public key. */ export const SparkMasterIdentityPublicKey = (() => { type Set__interface = { tag: SparkMasterIdentityPublicKey_Tags.Set; inner: Readonly<{ publicKey: string }>; }; /** * Designate the holder of this public key as the wallet's master * identity, replacing any previously designated key. Must be hex encoded * in the 33-byte compressed form. */ class Set_ extends UniffiEnum implements Set__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SparkMasterIdentityPublicKey'; readonly tag = SparkMasterIdentityPublicKey_Tags.Set; readonly inner: Readonly<{ publicKey: string }>; constructor(inner: { publicKey: string }) { super('SparkMasterIdentityPublicKey', 'Set'); this.inner = Object.freeze(inner); } static new(inner: { publicKey: string }): Set_ { return new Set_(inner); } static instanceOf(obj: any): obj is Set_ { return obj.tag === SparkMasterIdentityPublicKey_Tags.Set; } } type Unset__interface = { tag: SparkMasterIdentityPublicKey_Tags.Unset; }; /** * Remove the designated master identity, leaving the owner as the only * party able to read the wallet under private mode. */ class Unset_ extends UniffiEnum implements Unset__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SparkMasterIdentityPublicKey'; readonly tag = SparkMasterIdentityPublicKey_Tags.Unset; constructor() { super('SparkMasterIdentityPublicKey', 'Unset'); } static new(): Unset_ { return new Unset_(); } static instanceOf(obj: any): obj is Unset_ { return obj.tag === SparkMasterIdentityPublicKey_Tags.Unset; } } function instanceOf(obj: any): obj is SparkMasterIdentityPublicKey { return obj[uniffiTypeNameSymbol] === 'SparkMasterIdentityPublicKey'; } return Object.freeze({ instanceOf, Set: Set_, Unset: Unset_, }); })(); /** * Specifies how to update the wallet's Spark master identity public key. */ export type SparkMasterIdentityPublicKey = InstanceType< (typeof SparkMasterIdentityPublicKey)[keyof Omit< typeof SparkMasterIdentityPublicKey, 'instanceOf' >] >; // FfiConverter for enum SparkMasterIdentityPublicKey const FfiConverterTypeSparkMasterIdentityPublicKey = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SparkMasterIdentityPublicKey; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new SparkMasterIdentityPublicKey.Set({ publicKey: FfiConverterString.read(from), }); case 2: return new SparkMasterIdentityPublicKey.Unset(); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case SparkMasterIdentityPublicKey_Tags.Set: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.publicKey, into); return; } case SparkMasterIdentityPublicKey_Tags.Unset: { ordinalConverter.write(2, into); return; } default: // Throwing from here means that SparkMasterIdentityPublicKey_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case SparkMasterIdentityPublicKey_Tags.Set: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.publicKey); return size; } case SparkMasterIdentityPublicKey_Tags.Unset: { return ordinalConverter.allocationSize(2); } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: StableBalanceActiveLabel export enum StableBalanceActiveLabel_Tags { Set = 'Set', Unset = 'Unset', } /** * Specifies how to update the active stable balance token. */ export const StableBalanceActiveLabel = (() => { type Set__interface = { tag: StableBalanceActiveLabel_Tags.Set; inner: Readonly<{ label: string }>; }; /** * Activate stable balance with the given label. */ class Set_ extends UniffiEnum implements Set__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'StableBalanceActiveLabel'; readonly tag = StableBalanceActiveLabel_Tags.Set; readonly inner: Readonly<{ label: string }>; constructor(inner: { label: string }) { super('StableBalanceActiveLabel', 'Set'); this.inner = Object.freeze(inner); } static new(inner: { label: string }): Set_ { return new Set_(inner); } static instanceOf(obj: any): obj is Set_ { return obj.tag === StableBalanceActiveLabel_Tags.Set; } } type Unset__interface = { tag: StableBalanceActiveLabel_Tags.Unset; }; /** * Deactivate stable balance. */ class Unset_ extends UniffiEnum implements Unset__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'StableBalanceActiveLabel'; readonly tag = StableBalanceActiveLabel_Tags.Unset; constructor() { super('StableBalanceActiveLabel', 'Unset'); } static new(): Unset_ { return new Unset_(); } static instanceOf(obj: any): obj is Unset_ { return obj.tag === StableBalanceActiveLabel_Tags.Unset; } } function instanceOf(obj: any): obj is StableBalanceActiveLabel { return obj[uniffiTypeNameSymbol] === 'StableBalanceActiveLabel'; } return Object.freeze({ instanceOf, Set: Set_, Unset: Unset_, }); })(); /** * Specifies how to update the active stable balance token. */ export type StableBalanceActiveLabel = InstanceType< (typeof StableBalanceActiveLabel)[keyof Omit< typeof StableBalanceActiveLabel, 'instanceOf' >] >; // FfiConverter for enum StableBalanceActiveLabel const FfiConverterTypeStableBalanceActiveLabel = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = StableBalanceActiveLabel; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new StableBalanceActiveLabel.Set({ label: FfiConverterString.read(from), }); case 2: return new StableBalanceActiveLabel.Unset(); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case StableBalanceActiveLabel_Tags.Set: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.label, into); return; } case StableBalanceActiveLabel_Tags.Unset: { ordinalConverter.write(2, into); return; } default: // Throwing from here means that StableBalanceActiveLabel_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case StableBalanceActiveLabel_Tags.Set: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.label); return size; } case StableBalanceActiveLabel_Tags.Unset: { return ordinalConverter.allocationSize(2); } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Error type: StorageError // Enum: StorageError export enum StorageError_Tags { Connection = 'Connection', Implementation = 'Implementation', InitializationError = 'InitializationError', Serialization = 'Serialization', NotFound = 'NotFound', } /** * Errors that can occur during storage operations */ export const StorageError = (() => { type Connection__interface = { tag: StorageError_Tags.Connection; inner: Readonly<[string]>; }; /** * Connection-related errors (pool exhaustion, timeouts, connection refused). * These are often transient and may be retried. */ class Connection_ extends UniffiError implements Connection__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'StorageError'; readonly tag = StorageError_Tags.Connection; readonly inner: Readonly<[string]>; constructor(v0: string) { super('StorageError', 'Connection'); this.inner = Object.freeze([v0]); } static new(v0: string): Connection_ { return new Connection_(v0); } static instanceOf(obj: any): obj is Connection_ { return obj.tag === StorageError_Tags.Connection; } static hasInner(obj: any): obj is Connection_ { return Connection_.instanceOf(obj); } static getInner(obj: Connection_): Readonly<[string]> { return obj.inner; } } type Implementation__interface = { tag: StorageError_Tags.Implementation; inner: Readonly<[string]>; }; class Implementation_ extends UniffiError implements Implementation__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'StorageError'; readonly tag = StorageError_Tags.Implementation; readonly inner: Readonly<[string]>; constructor(v0: string) { super('StorageError', 'Implementation'); this.inner = Object.freeze([v0]); } static new(v0: string): Implementation_ { return new Implementation_(v0); } static instanceOf(obj: any): obj is Implementation_ { return obj.tag === StorageError_Tags.Implementation; } static hasInner(obj: any): obj is Implementation_ { return Implementation_.instanceOf(obj); } static getInner(obj: Implementation_): Readonly<[string]> { return obj.inner; } } type InitializationError__interface = { tag: StorageError_Tags.InitializationError; inner: Readonly<[string]>; }; /** * Database initialization error */ class InitializationError_ extends UniffiError implements InitializationError__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'StorageError'; readonly tag = StorageError_Tags.InitializationError; readonly inner: Readonly<[string]>; constructor(v0: string) { super('StorageError', 'InitializationError'); this.inner = Object.freeze([v0]); } static new(v0: string): InitializationError_ { return new InitializationError_(v0); } static instanceOf(obj: any): obj is InitializationError_ { return obj.tag === StorageError_Tags.InitializationError; } static hasInner(obj: any): obj is InitializationError_ { return InitializationError_.instanceOf(obj); } static getInner(obj: InitializationError_): Readonly<[string]> { return obj.inner; } } type Serialization__interface = { tag: StorageError_Tags.Serialization; inner: Readonly<[string]>; }; class Serialization_ extends UniffiError implements Serialization__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'StorageError'; readonly tag = StorageError_Tags.Serialization; readonly inner: Readonly<[string]>; constructor(v0: string) { super('StorageError', 'Serialization'); this.inner = Object.freeze([v0]); } static new(v0: string): Serialization_ { return new Serialization_(v0); } static instanceOf(obj: any): obj is Serialization_ { return obj.tag === StorageError_Tags.Serialization; } static hasInner(obj: any): obj is Serialization_ { return Serialization_.instanceOf(obj); } static getInner(obj: Serialization_): Readonly<[string]> { return obj.inner; } } type NotFound__interface = { tag: StorageError_Tags.NotFound; }; class NotFound_ extends UniffiError implements NotFound__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'StorageError'; readonly tag = StorageError_Tags.NotFound; constructor() { super('StorageError', 'NotFound'); } static new(): NotFound_ { return new NotFound_(); } static instanceOf(obj: any): obj is NotFound_ { return obj.tag === StorageError_Tags.NotFound; } static hasInner(obj: any): obj is NotFound_ { return false; } } function instanceOf(obj: any): obj is StorageError { return obj[uniffiTypeNameSymbol] === 'StorageError'; } return Object.freeze({ instanceOf, Connection: Connection_, Implementation: Implementation_, InitializationError: InitializationError_, Serialization: Serialization_, NotFound: NotFound_, }); })(); /** * Errors that can occur during storage operations */ export type StorageError = InstanceType< (typeof StorageError)[keyof Omit] >; // FfiConverter for enum StorageError const FfiConverterTypeStorageError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = StorageError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new StorageError.Connection(FfiConverterString.read(from)); case 2: return new StorageError.Implementation(FfiConverterString.read(from)); case 3: return new StorageError.InitializationError( FfiConverterString.read(from) ); case 4: return new StorageError.Serialization(FfiConverterString.read(from)); case 5: return new StorageError.NotFound(); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case StorageError_Tags.Connection: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case StorageError_Tags.Implementation: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case StorageError_Tags.InitializationError: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case StorageError_Tags.Serialization: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } case StorageError_Tags.NotFound: { ordinalConverter.write(5, into); return; } default: // Throwing from here means that StorageError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case StorageError_Tags.Connection: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner[0]); return size; } case StorageError_Tags.Implementation: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner[0]); return size; } case StorageError_Tags.InitializationError: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner[0]); return size; } case StorageError_Tags.Serialization: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterString.allocationSize(inner[0]); return size; } case StorageError_Tags.NotFound: { return ordinalConverter.allocationSize(5); } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: StoragePaymentDetailsFilter export enum StoragePaymentDetailsFilter_Tags { Spark = 'Spark', Token = 'Token', Lightning = 'Lightning', } /** * Storage-internal variant of [`PaymentDetailsFilter`]. */ export const StoragePaymentDetailsFilter = (() => { type Spark__interface = { tag: StoragePaymentDetailsFilter_Tags.Spark; inner: Readonly<{ htlcStatus: Array | undefined; conversionFilter: ConversionFilter | undefined; }>; }; class Spark_ extends UniffiEnum implements Spark__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'StoragePaymentDetailsFilter'; readonly tag = StoragePaymentDetailsFilter_Tags.Spark; readonly inner: Readonly<{ htlcStatus: Array | undefined; conversionFilter: ConversionFilter | undefined; }>; constructor(inner: { htlcStatus: Array | undefined; conversionFilter: ConversionFilter | undefined; }) { super('StoragePaymentDetailsFilter', 'Spark'); this.inner = Object.freeze(inner); } static new(inner: { htlcStatus: Array | undefined; conversionFilter: ConversionFilter | undefined; }): Spark_ { return new Spark_(inner); } static instanceOf(obj: any): obj is Spark_ { return obj.tag === StoragePaymentDetailsFilter_Tags.Spark; } } type Token__interface = { tag: StoragePaymentDetailsFilter_Tags.Token; inner: Readonly<{ conversionFilter: ConversionFilter | undefined; txHash: string | undefined; txType: TokenTransactionType | undefined; }>; }; class Token_ extends UniffiEnum implements Token__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'StoragePaymentDetailsFilter'; readonly tag = StoragePaymentDetailsFilter_Tags.Token; readonly inner: Readonly<{ conversionFilter: ConversionFilter | undefined; txHash: string | undefined; txType: TokenTransactionType | undefined; }>; constructor(inner: { conversionFilter: ConversionFilter | undefined; txHash: string | undefined; txType: TokenTransactionType | undefined; }) { super('StoragePaymentDetailsFilter', 'Token'); this.inner = Object.freeze(inner); } static new(inner: { conversionFilter: ConversionFilter | undefined; txHash: string | undefined; txType: TokenTransactionType | undefined; }): Token_ { return new Token_(inner); } static instanceOf(obj: any): obj is Token_ { return obj.tag === StoragePaymentDetailsFilter_Tags.Token; } } type Lightning__interface = { tag: StoragePaymentDetailsFilter_Tags.Lightning; inner: Readonly<{ htlcStatus: Array | undefined; conversionFilter: ConversionFilter | undefined; }>; }; class Lightning_ extends UniffiEnum implements Lightning__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'StoragePaymentDetailsFilter'; readonly tag = StoragePaymentDetailsFilter_Tags.Lightning; readonly inner: Readonly<{ htlcStatus: Array | undefined; conversionFilter: ConversionFilter | undefined; }>; constructor(inner: { htlcStatus: Array | undefined; conversionFilter: ConversionFilter | undefined; }) { super('StoragePaymentDetailsFilter', 'Lightning'); this.inner = Object.freeze(inner); } static new(inner: { htlcStatus: Array | undefined; conversionFilter: ConversionFilter | undefined; }): Lightning_ { return new Lightning_(inner); } static instanceOf(obj: any): obj is Lightning_ { return obj.tag === StoragePaymentDetailsFilter_Tags.Lightning; } } function instanceOf(obj: any): obj is StoragePaymentDetailsFilter { return obj[uniffiTypeNameSymbol] === 'StoragePaymentDetailsFilter'; } return Object.freeze({ instanceOf, Spark: Spark_, Token: Token_, Lightning: Lightning_, }); })(); /** * Storage-internal variant of [`PaymentDetailsFilter`]. */ export type StoragePaymentDetailsFilter = InstanceType< (typeof StoragePaymentDetailsFilter)[keyof Omit< typeof StoragePaymentDetailsFilter, 'instanceOf' >] >; // FfiConverter for enum StoragePaymentDetailsFilter const FfiConverterTypeStoragePaymentDetailsFilter = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = StoragePaymentDetailsFilter; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new StoragePaymentDetailsFilter.Spark({ htlcStatus: FfiConverterOptionalArrayTypeSparkHtlcStatus.read(from), conversionFilter: FfiConverterOptionalTypeConversionFilter.read(from), }); case 2: return new StoragePaymentDetailsFilter.Token({ conversionFilter: FfiConverterOptionalTypeConversionFilter.read(from), txHash: FfiConverterOptionalString.read(from), txType: FfiConverterOptionalTypeTokenTransactionType.read(from), }); case 3: return new StoragePaymentDetailsFilter.Lightning({ htlcStatus: FfiConverterOptionalArrayTypeSparkHtlcStatus.read(from), conversionFilter: FfiConverterOptionalTypeConversionFilter.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case StoragePaymentDetailsFilter_Tags.Spark: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterOptionalArrayTypeSparkHtlcStatus.write( inner.htlcStatus, into ); FfiConverterOptionalTypeConversionFilter.write( inner.conversionFilter, into ); return; } case StoragePaymentDetailsFilter_Tags.Token: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterOptionalTypeConversionFilter.write( inner.conversionFilter, into ); FfiConverterOptionalString.write(inner.txHash, into); FfiConverterOptionalTypeTokenTransactionType.write( inner.txType, into ); return; } case StoragePaymentDetailsFilter_Tags.Lightning: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterOptionalArrayTypeSparkHtlcStatus.write( inner.htlcStatus, into ); FfiConverterOptionalTypeConversionFilter.write( inner.conversionFilter, into ); return; } default: // Throwing from here means that StoragePaymentDetailsFilter_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case StoragePaymentDetailsFilter_Tags.Spark: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterOptionalArrayTypeSparkHtlcStatus.allocationSize( inner.htlcStatus ); size += FfiConverterOptionalTypeConversionFilter.allocationSize( inner.conversionFilter ); return size; } case StoragePaymentDetailsFilter_Tags.Token: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterOptionalTypeConversionFilter.allocationSize( inner.conversionFilter ); size += FfiConverterOptionalString.allocationSize(inner.txHash); size += FfiConverterOptionalTypeTokenTransactionType.allocationSize( inner.txType ); return size; } case StoragePaymentDetailsFilter_Tags.Lightning: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterOptionalArrayTypeSparkHtlcStatus.allocationSize( inner.htlcStatus ); size += FfiConverterOptionalTypeConversionFilter.allocationSize( inner.conversionFilter ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: SuccessAction export enum SuccessAction_Tags { Aes = 'Aes', Message = 'Message', Url = 'Url', } /** * Supported success action types * * Receiving any other (unsupported) success action type will result in a failed parsing, * which will abort the LNURL-pay workflow, as per LUD-09. */ export const SuccessAction = (() => { type Aes__interface = { tag: SuccessAction_Tags.Aes; inner: Readonly<{ data: AesSuccessActionData }>; }; /** * AES type, described in LUD-10 */ class Aes_ extends UniffiEnum implements Aes__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SuccessAction'; readonly tag = SuccessAction_Tags.Aes; readonly inner: Readonly<{ data: AesSuccessActionData }>; constructor(inner: { data: AesSuccessActionData }) { super('SuccessAction', 'Aes'); this.inner = Object.freeze(inner); } static new(inner: { data: AesSuccessActionData }): Aes_ { return new Aes_(inner); } static instanceOf(obj: any): obj is Aes_ { return obj.tag === SuccessAction_Tags.Aes; } } type Message__interface = { tag: SuccessAction_Tags.Message; inner: Readonly<{ data: MessageSuccessActionData }>; }; /** * Message type, described in LUD-09 */ class Message_ extends UniffiEnum implements Message__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SuccessAction'; readonly tag = SuccessAction_Tags.Message; readonly inner: Readonly<{ data: MessageSuccessActionData }>; constructor(inner: { data: MessageSuccessActionData }) { super('SuccessAction', 'Message'); this.inner = Object.freeze(inner); } static new(inner: { data: MessageSuccessActionData }): Message_ { return new Message_(inner); } static instanceOf(obj: any): obj is Message_ { return obj.tag === SuccessAction_Tags.Message; } } type Url__interface = { tag: SuccessAction_Tags.Url; inner: Readonly<{ data: UrlSuccessActionData }>; }; /** * URL type, described in LUD-09 */ class Url_ extends UniffiEnum implements Url__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SuccessAction'; readonly tag = SuccessAction_Tags.Url; readonly inner: Readonly<{ data: UrlSuccessActionData }>; constructor(inner: { data: UrlSuccessActionData }) { super('SuccessAction', 'Url'); this.inner = Object.freeze(inner); } static new(inner: { data: UrlSuccessActionData }): Url_ { return new Url_(inner); } static instanceOf(obj: any): obj is Url_ { return obj.tag === SuccessAction_Tags.Url; } } function instanceOf(obj: any): obj is SuccessAction { return obj[uniffiTypeNameSymbol] === 'SuccessAction'; } return Object.freeze({ instanceOf, Aes: Aes_, Message: Message_, Url: Url_, }); })(); /** * Supported success action types * * Receiving any other (unsupported) success action type will result in a failed parsing, * which will abort the LNURL-pay workflow, as per LUD-09. */ export type SuccessAction = InstanceType< (typeof SuccessAction)[keyof Omit] >; // FfiConverter for enum SuccessAction const FfiConverterTypeSuccessAction = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SuccessAction; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new SuccessAction.Aes({ data: FfiConverterTypeAesSuccessActionData.read(from), }); case 2: return new SuccessAction.Message({ data: FfiConverterTypeMessageSuccessActionData.read(from), }); case 3: return new SuccessAction.Url({ data: FfiConverterTypeUrlSuccessActionData.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case SuccessAction_Tags.Aes: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeAesSuccessActionData.write(inner.data, into); return; } case SuccessAction_Tags.Message: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeMessageSuccessActionData.write(inner.data, into); return; } case SuccessAction_Tags.Url: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeUrlSuccessActionData.write(inner.data, into); return; } default: // Throwing from here means that SuccessAction_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case SuccessAction_Tags.Aes: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeAesSuccessActionData.allocationSize( inner.data ); return size; } case SuccessAction_Tags.Message: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeMessageSuccessActionData.allocationSize( inner.data ); return size; } case SuccessAction_Tags.Url: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeUrlSuccessActionData.allocationSize( inner.data ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: SuccessActionProcessed export enum SuccessActionProcessed_Tags { Aes = 'Aes', Message = 'Message', Url = 'Url', } /** * [`SuccessAction`] where contents are ready to be consumed by the caller * * Contents are identical to [`SuccessAction`], except for AES where the ciphertext is decrypted. */ export const SuccessActionProcessed = (() => { type Aes__interface = { tag: SuccessActionProcessed_Tags.Aes; inner: Readonly<{ result: AesSuccessActionDataResult }>; }; /** * See [`SuccessAction::Aes`] for received payload * * See [`AesSuccessActionDataDecrypted`] for decrypted payload */ class Aes_ extends UniffiEnum implements Aes__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SuccessActionProcessed'; readonly tag = SuccessActionProcessed_Tags.Aes; readonly inner: Readonly<{ result: AesSuccessActionDataResult }>; constructor(inner: { result: AesSuccessActionDataResult }) { super('SuccessActionProcessed', 'Aes'); this.inner = Object.freeze(inner); } static new(inner: { result: AesSuccessActionDataResult }): Aes_ { return new Aes_(inner); } static instanceOf(obj: any): obj is Aes_ { return obj.tag === SuccessActionProcessed_Tags.Aes; } } type Message__interface = { tag: SuccessActionProcessed_Tags.Message; inner: Readonly<{ data: MessageSuccessActionData }>; }; /** * See [`SuccessAction::Message`] */ class Message_ extends UniffiEnum implements Message__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SuccessActionProcessed'; readonly tag = SuccessActionProcessed_Tags.Message; readonly inner: Readonly<{ data: MessageSuccessActionData }>; constructor(inner: { data: MessageSuccessActionData }) { super('SuccessActionProcessed', 'Message'); this.inner = Object.freeze(inner); } static new(inner: { data: MessageSuccessActionData }): Message_ { return new Message_(inner); } static instanceOf(obj: any): obj is Message_ { return obj.tag === SuccessActionProcessed_Tags.Message; } } type Url__interface = { tag: SuccessActionProcessed_Tags.Url; inner: Readonly<{ data: UrlSuccessActionData }>; }; /** * See [`SuccessAction::Url`] */ class Url_ extends UniffiEnum implements Url__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'SuccessActionProcessed'; readonly tag = SuccessActionProcessed_Tags.Url; readonly inner: Readonly<{ data: UrlSuccessActionData }>; constructor(inner: { data: UrlSuccessActionData }) { super('SuccessActionProcessed', 'Url'); this.inner = Object.freeze(inner); } static new(inner: { data: UrlSuccessActionData }): Url_ { return new Url_(inner); } static instanceOf(obj: any): obj is Url_ { return obj.tag === SuccessActionProcessed_Tags.Url; } } function instanceOf(obj: any): obj is SuccessActionProcessed { return obj[uniffiTypeNameSymbol] === 'SuccessActionProcessed'; } return Object.freeze({ instanceOf, Aes: Aes_, Message: Message_, Url: Url_, }); })(); /** * [`SuccessAction`] where contents are ready to be consumed by the caller * * Contents are identical to [`SuccessAction`], except for AES where the ciphertext is decrypted. */ export type SuccessActionProcessed = InstanceType< (typeof SuccessActionProcessed)[keyof Omit< typeof SuccessActionProcessed, 'instanceOf' >] >; // FfiConverter for enum SuccessActionProcessed const FfiConverterTypeSuccessActionProcessed = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SuccessActionProcessed; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new SuccessActionProcessed.Aes({ result: FfiConverterTypeAesSuccessActionDataResult.read(from), }); case 2: return new SuccessActionProcessed.Message({ data: FfiConverterTypeMessageSuccessActionData.read(from), }); case 3: return new SuccessActionProcessed.Url({ data: FfiConverterTypeUrlSuccessActionData.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case SuccessActionProcessed_Tags.Aes: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeAesSuccessActionDataResult.write(inner.result, into); return; } case SuccessActionProcessed_Tags.Message: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeMessageSuccessActionData.write(inner.data, into); return; } case SuccessActionProcessed_Tags.Url: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeUrlSuccessActionData.write(inner.data, into); return; } default: // Throwing from here means that SuccessActionProcessed_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case SuccessActionProcessed_Tags.Aes: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeAesSuccessActionDataResult.allocationSize( inner.result ); return size; } case SuccessActionProcessed_Tags.Message: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeMessageSuccessActionData.allocationSize( inner.data ); return size; } case SuccessActionProcessed_Tags.Url: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeUrlSuccessActionData.allocationSize( inner.data ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * How an executed swap departed from the terms the client signed. * * The input is spent either way, so the conversion completes rather than being * refunded. This records that it did not deliver what was signed for. */ export enum SwapDegradation { /** * Delivered less than the minimum the intent signed. */ BelowMinimum, /** * Delivered an asset other than the one the intent named. */ UnexpectedAsset, /** * Accepted without naming the amount, the asset, or the transfer carrying * it. */ MissingInfo, } const FfiConverterTypeSwapDegradation = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SwapDegradation; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return SwapDegradation.BelowMinimum; case 2: return SwapDegradation.UnexpectedAsset; case 3: return SwapDegradation.MissingInfo; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case SwapDegradation.BelowMinimum: return ordinalConverter.write(1, into); case SwapDegradation.UnexpectedAsset: return ordinalConverter.write(2, into); case SwapDegradation.MissingInfo: return ordinalConverter.write(3, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); export enum TokenTransactionType { Transfer, Mint, Burn, } const FfiConverterTypeTokenTransactionType = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = TokenTransactionType; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return TokenTransactionType.Transfer; case 2: return TokenTransactionType.Mint; case 3: return TokenTransactionType.Burn; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case TokenTransactionType.Transfer: return ordinalConverter.write(1, into); case TokenTransactionType.Mint: return ordinalConverter.write(2, into); case TokenTransactionType.Burn: return ordinalConverter.write(3, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: TransferSignature export enum TransferSignature_Tags { Transfer = 'Transfer', Token = 'Token', } export const TransferSignature = (() => { type Transfer__interface = { tag: TransferSignature_Tags.Transfer; inner: Readonly<{ signed: ExternalPreparedTransfer }>; }; class Transfer_ extends UniffiEnum implements Transfer__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'TransferSignature'; readonly tag = TransferSignature_Tags.Transfer; readonly inner: Readonly<{ signed: ExternalPreparedTransfer }>; constructor(inner: { signed: ExternalPreparedTransfer }) { super('TransferSignature', 'Transfer'); this.inner = Object.freeze(inner); } static new(inner: { signed: ExternalPreparedTransfer }): Transfer_ { return new Transfer_(inner); } static instanceOf(obj: any): obj is Transfer_ { return obj.tag === TransferSignature_Tags.Transfer; } } type Token__interface = { tag: TransferSignature_Tags.Token; inner: Readonly<{ signed: ExternalPreparedTokenTransaction }>; }; class Token_ extends UniffiEnum implements Token__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'TransferSignature'; readonly tag = TransferSignature_Tags.Token; readonly inner: Readonly<{ signed: ExternalPreparedTokenTransaction }>; constructor(inner: { signed: ExternalPreparedTokenTransaction }) { super('TransferSignature', 'Token'); this.inner = Object.freeze(inner); } static new(inner: { signed: ExternalPreparedTokenTransaction }): Token_ { return new Token_(inner); } static instanceOf(obj: any): obj is Token_ { return obj.tag === TransferSignature_Tags.Token; } } function instanceOf(obj: any): obj is TransferSignature { return obj[uniffiTypeNameSymbol] === 'TransferSignature'; } return Object.freeze({ instanceOf, Transfer: Transfer_, Token: Token_, }); })(); export type TransferSignature = InstanceType< (typeof TransferSignature)[keyof Omit] >; // FfiConverter for enum TransferSignature const FfiConverterTypeTransferSignature = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = TransferSignature; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new TransferSignature.Transfer({ signed: FfiConverterTypeExternalPreparedTransfer.read(from), }); case 2: return new TransferSignature.Token({ signed: FfiConverterTypeExternalPreparedTokenTransaction.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case TransferSignature_Tags.Transfer: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeExternalPreparedTransfer.write(inner.signed, into); return; } case TransferSignature_Tags.Token: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeExternalPreparedTokenTransaction.write( inner.signed, into ); return; } default: // Throwing from here means that TransferSignature_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case TransferSignature_Tags.Transfer: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeExternalPreparedTransfer.allocationSize( inner.signed ); return size; } case TransferSignature_Tags.Token: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeExternalPreparedTokenTransaction.allocationSize( inner.signed ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: TransferTarget export enum TransferTarget_Tags { Spark = 'Spark', Lightning = 'Lightning', CoopExit = 'CoopExit', } export const TransferTarget = (() => { type Spark__interface = { tag: TransferTarget_Tags.Spark; inner: Readonly<{ address: string; sparkInvoice: string | undefined }>; }; class Spark_ extends UniffiEnum implements Spark__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'TransferTarget'; readonly tag = TransferTarget_Tags.Spark; readonly inner: Readonly<{ address: string; sparkInvoice: string | undefined; }>; constructor(inner: { address: string; sparkInvoice: string | undefined }) { super('TransferTarget', 'Spark'); this.inner = Object.freeze(inner); } static new(inner: { address: string; sparkInvoice: string | undefined; }): Spark_ { return new Spark_(inner); } static instanceOf(obj: any): obj is Spark_ { return obj.tag === TransferTarget_Tags.Spark; } } type Lightning__interface = { tag: TransferTarget_Tags.Lightning; inner: Readonly<{ bolt11: string; lnurlPay: LnurlPayContext | undefined; feePolicy: FeePolicy; completionTimeoutSecs: /*u32*/ number | undefined; }>; }; class Lightning_ extends UniffiEnum implements Lightning__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'TransferTarget'; readonly tag = TransferTarget_Tags.Lightning; readonly inner: Readonly<{ bolt11: string; lnurlPay: LnurlPayContext | undefined; feePolicy: FeePolicy; completionTimeoutSecs: /*u32*/ number | undefined; }>; constructor(inner: { bolt11: string; lnurlPay: LnurlPayContext | undefined; feePolicy: FeePolicy; completionTimeoutSecs: /*u32*/ number | undefined; }) { super('TransferTarget', 'Lightning'); this.inner = Object.freeze(inner); } static new(inner: { bolt11: string; lnurlPay: LnurlPayContext | undefined; feePolicy: FeePolicy; completionTimeoutSecs: /*u32*/ number | undefined; }): Lightning_ { return new Lightning_(inner); } static instanceOf(obj: any): obj is Lightning_ { return obj.tag === TransferTarget_Tags.Lightning; } } type CoopExit__interface = { tag: TransferTarget_Tags.CoopExit; inner: Readonly<{ address: string; feeQuote: SendOnchainFeeQuote; confirmationSpeed: OnchainConfirmationSpeed; }>; }; class CoopExit_ extends UniffiEnum implements CoopExit__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'TransferTarget'; readonly tag = TransferTarget_Tags.CoopExit; readonly inner: Readonly<{ address: string; feeQuote: SendOnchainFeeQuote; confirmationSpeed: OnchainConfirmationSpeed; }>; constructor(inner: { address: string; feeQuote: SendOnchainFeeQuote; confirmationSpeed: OnchainConfirmationSpeed; }) { super('TransferTarget', 'CoopExit'); this.inner = Object.freeze(inner); } static new(inner: { address: string; feeQuote: SendOnchainFeeQuote; confirmationSpeed: OnchainConfirmationSpeed; }): CoopExit_ { return new CoopExit_(inner); } static instanceOf(obj: any): obj is CoopExit_ { return obj.tag === TransferTarget_Tags.CoopExit; } } function instanceOf(obj: any): obj is TransferTarget { return obj[uniffiTypeNameSymbol] === 'TransferTarget'; } return Object.freeze({ instanceOf, Spark: Spark_, Lightning: Lightning_, CoopExit: CoopExit_, }); })(); export type TransferTarget = InstanceType< (typeof TransferTarget)[keyof Omit] >; // FfiConverter for enum TransferTarget const FfiConverterTypeTransferTarget = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = TransferTarget; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new TransferTarget.Spark({ address: FfiConverterString.read(from), sparkInvoice: FfiConverterOptionalString.read(from), }); case 2: return new TransferTarget.Lightning({ bolt11: FfiConverterString.read(from), lnurlPay: FfiConverterOptionalTypeLnurlPayContext.read(from), feePolicy: FfiConverterTypeFeePolicy.read(from), completionTimeoutSecs: FfiConverterOptionalUInt32.read(from), }); case 3: return new TransferTarget.CoopExit({ address: FfiConverterString.read(from), feeQuote: FfiConverterTypeSendOnchainFeeQuote.read(from), confirmationSpeed: FfiConverterTypeOnchainConfirmationSpeed.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case TransferTarget_Tags.Spark: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.address, into); FfiConverterOptionalString.write(inner.sparkInvoice, into); return; } case TransferTarget_Tags.Lightning: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.bolt11, into); FfiConverterOptionalTypeLnurlPayContext.write(inner.lnurlPay, into); FfiConverterTypeFeePolicy.write(inner.feePolicy, into); FfiConverterOptionalUInt32.write(inner.completionTimeoutSecs, into); return; } case TransferTarget_Tags.CoopExit: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner.address, into); FfiConverterTypeSendOnchainFeeQuote.write(inner.feeQuote, into); FfiConverterTypeOnchainConfirmationSpeed.write( inner.confirmationSpeed, into ); return; } default: // Throwing from here means that TransferTarget_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case TransferTarget_Tags.Spark: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.address); size += FfiConverterOptionalString.allocationSize(inner.sparkInvoice); return size; } case TransferTarget_Tags.Lightning: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.bolt11); size += FfiConverterOptionalTypeLnurlPayContext.allocationSize( inner.lnurlPay ); size += FfiConverterTypeFeePolicy.allocationSize(inner.feePolicy); size += FfiConverterOptionalUInt32.allocationSize( inner.completionTimeoutSecs ); return size; } case TransferTarget_Tags.CoopExit: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner.address); size += FfiConverterTypeSendOnchainFeeQuote.allocationSize( inner.feeQuote ); size += FfiConverterTypeOnchainConfirmationSpeed.allocationSize( inner.confirmationSpeed ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * Why an exit has to be built again. */ export enum UnilateralExitRedoReason { /** * The chain no longer matches the exit: something that is not one of its * own transactions took an outpoint it still needs. A different refund, a * fee bump from elsewhere, or funding spent on something else all land * here. */ OnChainStateDiverged, } const FfiConverterTypeUnilateralExitRedoReason = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = UnilateralExitRedoReason; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return UnilateralExitRedoReason.OnChainStateDiverged; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case UnilateralExitRedoReason.OnChainStateDiverged: return ordinalConverter.write(1, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); /** * The role of a transaction in the exit path. */ export enum UnilateralExitTxKind { /** * Splits the caller's funding into one output per branch. Present only * when the funding couldn't be matched one-to-one to branches. */ FanOut, /** * A tree node transaction (root, intermediate, or leaf node). */ Node, /** * A leaf's refund transaction. */ Refund, /** * The final transaction sweeping all refund outputs to the destination. */ Sweep, } const FfiConverterTypeUnilateralExitTxKind = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = UnilateralExitTxKind; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return UnilateralExitTxKind.FanOut; case 2: return UnilateralExitTxKind.Node; case 3: return UnilateralExitTxKind.Refund; case 4: return UnilateralExitTxKind.Sweep; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case UnilateralExitTxKind.FanOut: return ordinalConverter.write(1, into); case UnilateralExitTxKind.Node: return ordinalConverter.write(2, into); case UnilateralExitTxKind.Refund: return ordinalConverter.write(3, into); case UnilateralExitTxKind.Sweep: return ordinalConverter.write(4, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); // Enum: UnilateralExitVerdict export enum UnilateralExitVerdict_Tags { Valid = 'Valid', Done = 'Done', Redo = 'Redo', } /** * What to do with an exit that has been read back against the chain. */ export const UnilateralExitVerdict = (() => { type Valid__interface = { tag: UnilateralExitVerdict_Tags.Valid; }; /** * The exit still holds. Broadcast the transactions whose dependencies are * confirmed and whose timelocks have matured. */ class Valid_ extends UniffiEnum implements Valid__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'UnilateralExitVerdict'; readonly tag = UnilateralExitVerdict_Tags.Valid; constructor() { super('UnilateralExitVerdict', 'Valid'); } static new(): Valid_ { return new Valid_(); } static instanceOf(obj: any): obj is Valid_ { return obj.tag === UnilateralExitVerdict_Tags.Valid; } } type Done__interface = { tag: UnilateralExitVerdict_Tags.Done; }; /** * Every transaction is confirmed, the sweep included. The funds have * arrived and there is nothing left to send. */ class Done_ extends UniffiEnum implements Done__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'UnilateralExitVerdict'; readonly tag = UnilateralExitVerdict_Tags.Done; constructor() { super('UnilateralExitVerdict', 'Done'); } static new(): Done_ { return new Done_(); } static instanceOf(obj: any): obj is Done_ { return obj.tag === UnilateralExitVerdict_Tags.Done; } } type Redo__interface = { tag: UnilateralExitVerdict_Tags.Redo; inner: Readonly<{ reason: UnilateralExitRedoReason }>; }; /** * The exit cannot be finished as it stands. Quote and build it again. */ class Redo_ extends UniffiEnum implements Redo__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'UnilateralExitVerdict'; readonly tag = UnilateralExitVerdict_Tags.Redo; readonly inner: Readonly<{ reason: UnilateralExitRedoReason }>; constructor(inner: { reason: UnilateralExitRedoReason }) { super('UnilateralExitVerdict', 'Redo'); this.inner = Object.freeze(inner); } static new(inner: { reason: UnilateralExitRedoReason }): Redo_ { return new Redo_(inner); } static instanceOf(obj: any): obj is Redo_ { return obj.tag === UnilateralExitVerdict_Tags.Redo; } } function instanceOf(obj: any): obj is UnilateralExitVerdict { return obj[uniffiTypeNameSymbol] === 'UnilateralExitVerdict'; } return Object.freeze({ instanceOf, Valid: Valid_, Done: Done_, Redo: Redo_, }); })(); /** * What to do with an exit that has been read back against the chain. */ export type UnilateralExitVerdict = InstanceType< (typeof UnilateralExitVerdict)[keyof Omit< typeof UnilateralExitVerdict, 'instanceOf' >] >; // FfiConverter for enum UnilateralExitVerdict const FfiConverterTypeUnilateralExitVerdict = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = UnilateralExitVerdict; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new UnilateralExitVerdict.Valid(); case 2: return new UnilateralExitVerdict.Done(); case 3: return new UnilateralExitVerdict.Redo({ reason: FfiConverterTypeUnilateralExitRedoReason.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case UnilateralExitVerdict_Tags.Valid: { ordinalConverter.write(1, into); return; } case UnilateralExitVerdict_Tags.Done: { ordinalConverter.write(2, into); return; } case UnilateralExitVerdict_Tags.Redo: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeUnilateralExitRedoReason.write(inner.reason, into); return; } default: // Throwing from here means that UnilateralExitVerdict_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case UnilateralExitVerdict_Tags.Valid: { return ordinalConverter.allocationSize(1); } case UnilateralExitVerdict_Tags.Done: { return ordinalConverter.allocationSize(2); } case UnilateralExitVerdict_Tags.Redo: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeUnilateralExitRedoReason.allocationSize( inner.reason ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: UnsignedTransferPackage export enum UnsignedTransferPackage_Tags { Swap = 'Swap', Transfer = 'Transfer', Token = 'Token', TokenBatch = 'TokenBatch', } export const UnsignedTransferPackage = (() => { type Swap__interface = { tag: UnsignedTransferPackage_Tags.Swap; inner: Readonly<{ prepareTransfer: ExternalPrepareTransferRequest; targetAmounts: Array; amountSat: /*u64*/ bigint; feeSat: /*u64*/ bigint; }>; }; class Swap_ extends UniffiEnum implements Swap__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'UnsignedTransferPackage'; readonly tag = UnsignedTransferPackage_Tags.Swap; readonly inner: Readonly<{ prepareTransfer: ExternalPrepareTransferRequest; targetAmounts: Array; amountSat: /*u64*/ bigint; feeSat: /*u64*/ bigint; }>; constructor(inner: { prepareTransfer: ExternalPrepareTransferRequest; targetAmounts: Array; amountSat: /*u64*/ bigint; feeSat: /*u64*/ bigint; }) { super('UnsignedTransferPackage', 'Swap'); this.inner = Object.freeze(inner); } static new(inner: { prepareTransfer: ExternalPrepareTransferRequest; targetAmounts: Array; amountSat: /*u64*/ bigint; feeSat: /*u64*/ bigint; }): Swap_ { return new Swap_(inner); } static instanceOf(obj: any): obj is Swap_ { return obj.tag === UnsignedTransferPackage_Tags.Swap; } } type Transfer__interface = { tag: UnsignedTransferPackage_Tags.Transfer; inner: Readonly<{ prepareTransfer: ExternalPrepareTransferRequest; amountSat: /*u64*/ bigint; feeSat: /*u64*/ bigint; target: TransferTarget; }>; }; class Transfer_ extends UniffiEnum implements Transfer__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'UnsignedTransferPackage'; readonly tag = UnsignedTransferPackage_Tags.Transfer; readonly inner: Readonly<{ prepareTransfer: ExternalPrepareTransferRequest; amountSat: /*u64*/ bigint; feeSat: /*u64*/ bigint; target: TransferTarget; }>; constructor(inner: { prepareTransfer: ExternalPrepareTransferRequest; amountSat: /*u64*/ bigint; feeSat: /*u64*/ bigint; target: TransferTarget; }) { super('UnsignedTransferPackage', 'Transfer'); this.inner = Object.freeze(inner); } static new(inner: { prepareTransfer: ExternalPrepareTransferRequest; amountSat: /*u64*/ bigint; feeSat: /*u64*/ bigint; target: TransferTarget; }): Transfer_ { return new Transfer_(inner); } static instanceOf(obj: any): obj is Transfer_ { return obj.tag === UnsignedTransferPackage_Tags.Transfer; } } type Token__interface = { tag: UnsignedTransferPackage_Tags.Token; inner: Readonly<{ prepareTokenTransaction: ExternalPrepareTokenTransactionRequest; tokenContext: ArrayBuffer; tokenIdentifier: string; amount: U128; fee: U128; isSwap: boolean; }>; }; class Token_ extends UniffiEnum implements Token__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'UnsignedTransferPackage'; readonly tag = UnsignedTransferPackage_Tags.Token; readonly inner: Readonly<{ prepareTokenTransaction: ExternalPrepareTokenTransactionRequest; tokenContext: ArrayBuffer; tokenIdentifier: string; amount: U128; fee: U128; isSwap: boolean; }>; constructor(inner: { prepareTokenTransaction: ExternalPrepareTokenTransactionRequest; tokenContext: ArrayBuffer; tokenIdentifier: string; amount: U128; fee: U128; /** * When set, this package re-shapes the wallet's token outputs instead of * sending a payment. Publishing it returns `SwapCompleted`: rebuild the * original send from the same prepare response and submit again. */ isSwap: boolean; }) { super('UnsignedTransferPackage', 'Token'); this.inner = Object.freeze(inner); } static new(inner: { prepareTokenTransaction: ExternalPrepareTokenTransactionRequest; tokenContext: ArrayBuffer; tokenIdentifier: string; amount: U128; fee: U128; /** * When set, this package re-shapes the wallet's token outputs instead of * sending a payment. Publishing it returns `SwapCompleted`: rebuild the * original send from the same prepare response and submit again. */ isSwap: boolean; }): Token_ { return new Token_(inner); } static instanceOf(obj: any): obj is Token_ { return obj.tag === UnsignedTransferPackage_Tags.Token; } } type TokenBatch__interface = { tag: UnsignedTransferPackage_Tags.TokenBatch; inner: Readonly<{ prepareTokenTransaction: ExternalPrepareTokenTransactionRequest; tokenContext: ArrayBuffer; totals: Array; isSwap: boolean; }>; }; /** * One token transaction paying several recipients. Publishing it returns * `PaymentsSent` with one payment per recipient. */ class TokenBatch_ extends UniffiEnum implements TokenBatch__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'UnsignedTransferPackage'; readonly tag = UnsignedTransferPackage_Tags.TokenBatch; readonly inner: Readonly<{ prepareTokenTransaction: ExternalPrepareTokenTransactionRequest; tokenContext: ArrayBuffer; totals: Array; isSwap: boolean; }>; constructor(inner: { prepareTokenTransaction: ExternalPrepareTokenTransactionRequest; tokenContext: ArrayBuffer; /** * What the batch debits, per token. A batch spanning tokens has no * single amount to report. */ totals: Array; /** * When set, this package re-shapes the wallet's token outputs instead of * sending a payment. Publishing it returns `SwapCompleted`: rebuild the * original send from the same prepare response and submit again. */ isSwap: boolean; }) { super('UnsignedTransferPackage', 'TokenBatch'); this.inner = Object.freeze(inner); } static new(inner: { prepareTokenTransaction: ExternalPrepareTokenTransactionRequest; tokenContext: ArrayBuffer; /** * What the batch debits, per token. A batch spanning tokens has no * single amount to report. */ totals: Array; /** * When set, this package re-shapes the wallet's token outputs instead of * sending a payment. Publishing it returns `SwapCompleted`: rebuild the * original send from the same prepare response and submit again. */ isSwap: boolean; }): TokenBatch_ { return new TokenBatch_(inner); } static instanceOf(obj: any): obj is TokenBatch_ { return obj.tag === UnsignedTransferPackage_Tags.TokenBatch; } } function instanceOf(obj: any): obj is UnsignedTransferPackage { return obj[uniffiTypeNameSymbol] === 'UnsignedTransferPackage'; } return Object.freeze({ instanceOf, Swap: Swap_, Transfer: Transfer_, Token: Token_, TokenBatch: TokenBatch_, }); })(); export type UnsignedTransferPackage = InstanceType< (typeof UnsignedTransferPackage)[keyof Omit< typeof UnsignedTransferPackage, 'instanceOf' >] >; // FfiConverter for enum UnsignedTransferPackage const FfiConverterTypeUnsignedTransferPackage = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = UnsignedTransferPackage; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new UnsignedTransferPackage.Swap({ prepareTransfer: FfiConverterTypeExternalPrepareTransferRequest.read(from), targetAmounts: FfiConverterArrayUInt64.read(from), amountSat: FfiConverterUInt64.read(from), feeSat: FfiConverterUInt64.read(from), }); case 2: return new UnsignedTransferPackage.Transfer({ prepareTransfer: FfiConverterTypeExternalPrepareTransferRequest.read(from), amountSat: FfiConverterUInt64.read(from), feeSat: FfiConverterUInt64.read(from), target: FfiConverterTypeTransferTarget.read(from), }); case 3: return new UnsignedTransferPackage.Token({ prepareTokenTransaction: FfiConverterTypeExternalPrepareTokenTransactionRequest.read(from), tokenContext: FfiConverterArrayBuffer.read(from), tokenIdentifier: FfiConverterString.read(from), amount: FfiConverterTypeu128.read(from), fee: FfiConverterTypeu128.read(from), isSwap: FfiConverterBool.read(from), }); case 4: return new UnsignedTransferPackage.TokenBatch({ prepareTokenTransaction: FfiConverterTypeExternalPrepareTokenTransactionRequest.read(from), tokenContext: FfiConverterArrayBuffer.read(from), totals: FfiConverterArrayTypeBatchTotal.read(from), isSwap: FfiConverterBool.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case UnsignedTransferPackage_Tags.Swap: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeExternalPrepareTransferRequest.write( inner.prepareTransfer, into ); FfiConverterArrayUInt64.write(inner.targetAmounts, into); FfiConverterUInt64.write(inner.amountSat, into); FfiConverterUInt64.write(inner.feeSat, into); return; } case UnsignedTransferPackage_Tags.Transfer: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeExternalPrepareTransferRequest.write( inner.prepareTransfer, into ); FfiConverterUInt64.write(inner.amountSat, into); FfiConverterUInt64.write(inner.feeSat, into); FfiConverterTypeTransferTarget.write(inner.target, into); return; } case UnsignedTransferPackage_Tags.Token: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeExternalPrepareTokenTransactionRequest.write( inner.prepareTokenTransaction, into ); FfiConverterArrayBuffer.write(inner.tokenContext, into); FfiConverterString.write(inner.tokenIdentifier, into); FfiConverterTypeu128.write(inner.amount, into); FfiConverterTypeu128.write(inner.fee, into); FfiConverterBool.write(inner.isSwap, into); return; } case UnsignedTransferPackage_Tags.TokenBatch: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterTypeExternalPrepareTokenTransactionRequest.write( inner.prepareTokenTransaction, into ); FfiConverterArrayBuffer.write(inner.tokenContext, into); FfiConverterArrayTypeBatchTotal.write(inner.totals, into); FfiConverterBool.write(inner.isSwap, into); return; } default: // Throwing from here means that UnsignedTransferPackage_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case UnsignedTransferPackage_Tags.Swap: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeExternalPrepareTransferRequest.allocationSize( inner.prepareTransfer ); size += FfiConverterArrayUInt64.allocationSize(inner.targetAmounts); size += FfiConverterUInt64.allocationSize(inner.amountSat); size += FfiConverterUInt64.allocationSize(inner.feeSat); return size; } case UnsignedTransferPackage_Tags.Transfer: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeExternalPrepareTransferRequest.allocationSize( inner.prepareTransfer ); size += FfiConverterUInt64.allocationSize(inner.amountSat); size += FfiConverterUInt64.allocationSize(inner.feeSat); size += FfiConverterTypeTransferTarget.allocationSize(inner.target); return size; } case UnsignedTransferPackage_Tags.Token: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeExternalPrepareTokenTransactionRequest.allocationSize( inner.prepareTokenTransaction ); size += FfiConverterArrayBuffer.allocationSize(inner.tokenContext); size += FfiConverterString.allocationSize(inner.tokenIdentifier); size += FfiConverterTypeu128.allocationSize(inner.amount); size += FfiConverterTypeu128.allocationSize(inner.fee); size += FfiConverterBool.allocationSize(inner.isSwap); return size; } case UnsignedTransferPackage_Tags.TokenBatch: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterTypeExternalPrepareTokenTransactionRequest.allocationSize( inner.prepareTokenTransaction ); size += FfiConverterArrayBuffer.allocationSize(inner.tokenContext); size += FfiConverterArrayTypeBatchTotal.allocationSize(inner.totals); size += FfiConverterBool.allocationSize(inner.isSwap); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: UpdateDepositPayload export enum UpdateDepositPayload_Tags { ClaimError = 'ClaimError', Refund = 'Refund', InstantClaim = 'InstantClaim', RefundBroadcastState = 'RefundBroadcastState', } export const UpdateDepositPayload = (() => { type ClaimError__interface = { tag: UpdateDepositPayload_Tags.ClaimError; inner: Readonly<{ error: DepositClaimError }>; }; class ClaimError_ extends UniffiEnum implements ClaimError__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'UpdateDepositPayload'; readonly tag = UpdateDepositPayload_Tags.ClaimError; readonly inner: Readonly<{ error: DepositClaimError }>; constructor(inner: { error: DepositClaimError }) { super('UpdateDepositPayload', 'ClaimError'); this.inner = Object.freeze(inner); } static new(inner: { error: DepositClaimError }): ClaimError_ { return new ClaimError_(inner); } static instanceOf(obj: any): obj is ClaimError_ { return obj.tag === UpdateDepositPayload_Tags.ClaimError; } } type Refund__interface = { tag: UpdateDepositPayload_Tags.Refund; inner: Readonly<{ refundTxid: string; refundTx: string; state: RefundState; }>; }; class Refund_ extends UniffiEnum implements Refund__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'UpdateDepositPayload'; readonly tag = UpdateDepositPayload_Tags.Refund; readonly inner: Readonly<{ refundTxid: string; refundTx: string; state: RefundState; }>; constructor(inner: { refundTxid: string; refundTx: string; state: RefundState; }) { super('UpdateDepositPayload', 'Refund'); this.inner = Object.freeze(inner); } static new(inner: { refundTxid: string; refundTx: string; state: RefundState; }): Refund_ { return new Refund_(inner); } static instanceOf(obj: any): obj is Refund_ { return obj.tag === UpdateDepositPayload_Tags.Refund; } } type InstantClaim__interface = { tag: UpdateDepositPayload_Tags.InstantClaim; inner: Readonly<{ status: InstantClaimStatus }>; }; class InstantClaim_ extends UniffiEnum implements InstantClaim__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'UpdateDepositPayload'; readonly tag = UpdateDepositPayload_Tags.InstantClaim; readonly inner: Readonly<{ status: InstantClaimStatus }>; constructor(inner: { status: InstantClaimStatus }) { super('UpdateDepositPayload', 'InstantClaim'); this.inner = Object.freeze(inner); } static new(inner: { status: InstantClaimStatus }): InstantClaim_ { return new InstantClaim_(inner); } static instanceOf(obj: any): obj is InstantClaim_ { return obj.tag === UpdateDepositPayload_Tags.InstantClaim; } } type RefundBroadcastState__interface = { tag: UpdateDepositPayload_Tags.RefundBroadcastState; inner: Readonly<{ refundTxid: string; state: RefundState }>; }; /** * Moves an existing refund between states without touching the refund * itself or the last claim error. Applies only while `refund_txid` is still * the stored refund, so a state decided against one refund cannot land on a * newer one. */ class RefundBroadcastState_ extends UniffiEnum implements RefundBroadcastState__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'UpdateDepositPayload'; readonly tag = UpdateDepositPayload_Tags.RefundBroadcastState; readonly inner: Readonly<{ refundTxid: string; state: RefundState }>; constructor(inner: { refundTxid: string; state: RefundState }) { super('UpdateDepositPayload', 'RefundBroadcastState'); this.inner = Object.freeze(inner); } static new(inner: { refundTxid: string; state: RefundState; }): RefundBroadcastState_ { return new RefundBroadcastState_(inner); } static instanceOf(obj: any): obj is RefundBroadcastState_ { return obj.tag === UpdateDepositPayload_Tags.RefundBroadcastState; } } function instanceOf(obj: any): obj is UpdateDepositPayload { return obj[uniffiTypeNameSymbol] === 'UpdateDepositPayload'; } return Object.freeze({ instanceOf, ClaimError: ClaimError_, Refund: Refund_, InstantClaim: InstantClaim_, RefundBroadcastState: RefundBroadcastState_, }); })(); export type UpdateDepositPayload = InstanceType< (typeof UpdateDepositPayload)[keyof Omit< typeof UpdateDepositPayload, 'instanceOf' >] >; // FfiConverter for enum UpdateDepositPayload const FfiConverterTypeUpdateDepositPayload = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = UpdateDepositPayload; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new UpdateDepositPayload.ClaimError({ error: FfiConverterTypeDepositClaimError.read(from), }); case 2: return new UpdateDepositPayload.Refund({ refundTxid: FfiConverterString.read(from), refundTx: FfiConverterString.read(from), state: FfiConverterTypeRefundState.read(from), }); case 3: return new UpdateDepositPayload.InstantClaim({ status: FfiConverterTypeInstantClaimStatus.read(from), }); case 4: return new UpdateDepositPayload.RefundBroadcastState({ refundTxid: FfiConverterString.read(from), state: FfiConverterTypeRefundState.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case UpdateDepositPayload_Tags.ClaimError: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeDepositClaimError.write(inner.error, into); return; } case UpdateDepositPayload_Tags.Refund: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.refundTxid, into); FfiConverterString.write(inner.refundTx, into); FfiConverterTypeRefundState.write(inner.state, into); return; } case UpdateDepositPayload_Tags.InstantClaim: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeInstantClaimStatus.write(inner.status, into); return; } case UpdateDepositPayload_Tags.RefundBroadcastState: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterString.write(inner.refundTxid, into); FfiConverterTypeRefundState.write(inner.state, into); return; } default: // Throwing from here means that UpdateDepositPayload_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case UpdateDepositPayload_Tags.ClaimError: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeDepositClaimError.allocationSize(inner.error); return size; } case UpdateDepositPayload_Tags.Refund: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.refundTxid); size += FfiConverterString.allocationSize(inner.refundTx); size += FfiConverterTypeRefundState.allocationSize(inner.state); return size; } case UpdateDepositPayload_Tags.InstantClaim: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeInstantClaimStatus.allocationSize( inner.status ); return size; } case UpdateDepositPayload_Tags.RefundBroadcastState: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterString.allocationSize(inner.refundTxid); size += FfiConverterTypeRefundState.allocationSize(inner.state); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Enum: WebhookEventType export enum WebhookEventType_Tags { LightningReceiveFinished = 'LightningReceiveFinished', LightningSendFinished = 'LightningSendFinished', CoopExitFinished = 'CoopExitFinished', StaticDepositFinished = 'StaticDepositFinished', Unknown = 'Unknown', } /** * The type of event that triggers a webhook notification. */ export const WebhookEventType = (() => { type LightningReceiveFinished__interface = { tag: WebhookEventType_Tags.LightningReceiveFinished; }; /** * Triggered when a Lightning receive operation completes. */ class LightningReceiveFinished_ extends UniffiEnum implements LightningReceiveFinished__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'WebhookEventType'; readonly tag = WebhookEventType_Tags.LightningReceiveFinished; constructor() { super('WebhookEventType', 'LightningReceiveFinished'); } static new(): LightningReceiveFinished_ { return new LightningReceiveFinished_(); } static instanceOf(obj: any): obj is LightningReceiveFinished_ { return obj.tag === WebhookEventType_Tags.LightningReceiveFinished; } } type LightningSendFinished__interface = { tag: WebhookEventType_Tags.LightningSendFinished; }; /** * Triggered when a Lightning send operation completes. */ class LightningSendFinished_ extends UniffiEnum implements LightningSendFinished__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'WebhookEventType'; readonly tag = WebhookEventType_Tags.LightningSendFinished; constructor() { super('WebhookEventType', 'LightningSendFinished'); } static new(): LightningSendFinished_ { return new LightningSendFinished_(); } static instanceOf(obj: any): obj is LightningSendFinished_ { return obj.tag === WebhookEventType_Tags.LightningSendFinished; } } type CoopExitFinished__interface = { tag: WebhookEventType_Tags.CoopExitFinished; }; /** * Triggered when a cooperative exit completes. */ class CoopExitFinished_ extends UniffiEnum implements CoopExitFinished__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'WebhookEventType'; readonly tag = WebhookEventType_Tags.CoopExitFinished; constructor() { super('WebhookEventType', 'CoopExitFinished'); } static new(): CoopExitFinished_ { return new CoopExitFinished_(); } static instanceOf(obj: any): obj is CoopExitFinished_ { return obj.tag === WebhookEventType_Tags.CoopExitFinished; } } type StaticDepositFinished__interface = { tag: WebhookEventType_Tags.StaticDepositFinished; }; /** * Triggered when a static deposit completes. */ class StaticDepositFinished_ extends UniffiEnum implements StaticDepositFinished__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'WebhookEventType'; readonly tag = WebhookEventType_Tags.StaticDepositFinished; constructor() { super('WebhookEventType', 'StaticDepositFinished'); } static new(): StaticDepositFinished_ { return new StaticDepositFinished_(); } static instanceOf(obj: any): obj is StaticDepositFinished_ { return obj.tag === WebhookEventType_Tags.StaticDepositFinished; } } type Unknown__interface = { tag: WebhookEventType_Tags.Unknown; inner: Readonly<[string]>; }; /** * An event type not yet recognized by this version of the SDK. */ class Unknown_ extends UniffiEnum implements Unknown__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = 'WebhookEventType'; readonly tag = WebhookEventType_Tags.Unknown; readonly inner: Readonly<[string]>; constructor(v0: string) { super('WebhookEventType', 'Unknown'); this.inner = Object.freeze([v0]); } static new(v0: string): Unknown_ { return new Unknown_(v0); } static instanceOf(obj: any): obj is Unknown_ { return obj.tag === WebhookEventType_Tags.Unknown; } } function instanceOf(obj: any): obj is WebhookEventType { return obj[uniffiTypeNameSymbol] === 'WebhookEventType'; } return Object.freeze({ instanceOf, LightningReceiveFinished: LightningReceiveFinished_, LightningSendFinished: LightningSendFinished_, CoopExitFinished: CoopExitFinished_, StaticDepositFinished: StaticDepositFinished_, Unknown: Unknown_, }); })(); /** * The type of event that triggers a webhook notification. */ export type WebhookEventType = InstanceType< (typeof WebhookEventType)[keyof Omit] >; // FfiConverter for enum WebhookEventType const FfiConverterTypeWebhookEventType = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = WebhookEventType; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new WebhookEventType.LightningReceiveFinished(); case 2: return new WebhookEventType.LightningSendFinished(); case 3: return new WebhookEventType.CoopExitFinished(); case 4: return new WebhookEventType.StaticDepositFinished(); case 5: return new WebhookEventType.Unknown(FfiConverterString.read(from)); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case WebhookEventType_Tags.LightningReceiveFinished: { ordinalConverter.write(1, into); return; } case WebhookEventType_Tags.LightningSendFinished: { ordinalConverter.write(2, into); return; } case WebhookEventType_Tags.CoopExitFinished: { ordinalConverter.write(3, into); return; } case WebhookEventType_Tags.StaticDepositFinished: { ordinalConverter.write(4, into); return; } case WebhookEventType_Tags.Unknown: { ordinalConverter.write(5, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } default: // Throwing from here means that WebhookEventType_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case WebhookEventType_Tags.LightningReceiveFinished: { return ordinalConverter.allocationSize(1); } case WebhookEventType_Tags.LightningSendFinished: { return ordinalConverter.allocationSize(2); } case WebhookEventType_Tags.CoopExitFinished: { return ordinalConverter.allocationSize(3); } case WebhookEventType_Tags.StaticDepositFinished: { return ordinalConverter.allocationSize(4); } case WebhookEventType_Tags.Unknown: { const inner = value.inner; let size = ordinalConverter.allocationSize(5); size += FfiConverterString.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // FfiConverter for Map const FfiConverterMapStringTypeTokenBalance = new FfiConverterMap( FfiConverterString, FfiConverterTypeTokenBalance ); // FfiConverter for Map const FfiConverterMapStringString = new FfiConverterMap( FfiConverterString, FfiConverterString ); export interface BitcoinChainService { getAddressUtxos( address: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise>; /** * Every output ever paid to `address`, spent or not, unlike * [`get_address_utxos`](Self::get_address_utxos) which omits spent ones. * Recovers an output's outpoint and value after it has been spent, so a * swept refund can still be distinguished from one never broadcast. */ getAddressTxos( address: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise>; getTransactionStatus( txid: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Height of the chain tip. Paired with a transaction's * [`TxStatus::block_height`] it gives that transaction's confirmation count, * which no single call reports. */ tipHeight(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; getTransactionHex( txid: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; getOutspend( txid: string, vout: /*u32*/ number, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; broadcastTransaction( tx: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; recommendedFees(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; } export class BitcoinChainServiceImpl extends UniffiAbstractObject implements BitcoinChainService { readonly [uniffiTypeNameSymbol] = 'BitcoinChainServiceImpl'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeBitcoinChainServiceImplObjectFactory.bless(pointer); } public async getAddressUtxos( address: string, asyncOpts_?: { signal: AbortSignal } ): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_bitcoinchainservice_get_address_utxos( uniffiTypeBitcoinChainServiceImplObjectFactory.clonePointer(this), FfiConverterString.lower(address) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayTypeUtxo.lift.bind( FfiConverterArrayTypeUtxo ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeChainServiceError.lift.bind( FfiConverterTypeChainServiceError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Every output ever paid to `address`, spent or not, unlike * [`get_address_utxos`](Self::get_address_utxos) which omits spent ones. * Recovers an output's outpoint and value after it has been spent, so a * swept refund can still be distinguished from one never broadcast. */ public async getAddressTxos( address: string, asyncOpts_?: { signal: AbortSignal } ): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_bitcoinchainservice_get_address_txos( uniffiTypeBitcoinChainServiceImplObjectFactory.clonePointer(this), FfiConverterString.lower(address) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayTypeUtxo.lift.bind( FfiConverterArrayTypeUtxo ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeChainServiceError.lift.bind( FfiConverterTypeChainServiceError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async getTransactionStatus( txid: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_bitcoinchainservice_get_transaction_status( uniffiTypeBitcoinChainServiceImplObjectFactory.clonePointer(this), FfiConverterString.lower(txid) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeTxStatus.lift.bind( FfiConverterTypeTxStatus ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeChainServiceError.lift.bind( FfiConverterTypeChainServiceError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Height of the chain tip. Paired with a transaction's * [`TxStatus::block_height`] it gives that transaction's confirmation count, * which no single call reports. */ public async tipHeight(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_bitcoinchainservice_tip_height( uniffiTypeBitcoinChainServiceImplObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_u32, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_u32, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_u32, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_u32, /*liftFunc:*/ FfiConverterUInt32.lift.bind(FfiConverterUInt32), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeChainServiceError.lift.bind( FfiConverterTypeChainServiceError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async getTransactionHex( txid: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_bitcoinchainservice_get_transaction_hex( uniffiTypeBitcoinChainServiceImplObjectFactory.clonePointer(this), FfiConverterString.lower(txid) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeChainServiceError.lift.bind( FfiConverterTypeChainServiceError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async getOutspend( txid: string, vout: /*u32*/ number, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_bitcoinchainservice_get_outspend( uniffiTypeBitcoinChainServiceImplObjectFactory.clonePointer(this), FfiConverterString.lower(txid), FfiConverterUInt32.lower(vout) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeOutspend.lift.bind( FfiConverterTypeOutspend ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeChainServiceError.lift.bind( FfiConverterTypeChainServiceError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async broadcastTransaction( tx: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_bitcoinchainservice_broadcast_transaction( uniffiTypeBitcoinChainServiceImplObjectFactory.clonePointer(this), FfiConverterString.lower(tx) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeChainServiceError.lift.bind( FfiConverterTypeChainServiceError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async recommendedFees(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_bitcoinchainservice_recommended_fees( uniffiTypeBitcoinChainServiceImplObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeRecommendedFees.lift.bind( FfiConverterTypeRecommendedFees ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeChainServiceError.lift.bind( FfiConverterTypeChainServiceError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeBitcoinChainServiceImplObjectFactory.pointer(this); uniffiTypeBitcoinChainServiceImplObjectFactory.freePointer(pointer); uniffiTypeBitcoinChainServiceImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is BitcoinChainServiceImpl { return uniffiTypeBitcoinChainServiceImplObjectFactory.isConcreteType(obj); } } const uniffiTypeBitcoinChainServiceImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): BitcoinChainService { const instance = Object.create(BitcoinChainServiceImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'BitcoinChainServiceImpl'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_bitcoinchainservice_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: BitcoinChainService): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: BitcoinChainService): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_bitcoinchainservice( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_bitcoinchainservice( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is BitcoinChainService { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'BitcoinChainServiceImpl' ); }, }; })(); // FfiConverter for BitcoinChainService const FfiConverterTypeBitcoinChainService = new FfiConverterObjectWithCallbacks( uniffiTypeBitcoinChainServiceImplObjectFactory ); // Add a vtavble for the callbacks that go in BitcoinChainService. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceBitcoinChainService: { vtable: UniffiVTableCallbackInterfaceBitcoinChainService; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { getAddressUtxos: ( uniffiHandle: bigint, address: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise> => { const jsCallback = FfiConverterTypeBitcoinChainService.lift(uniffiHandle); return await jsCallback.getAddressUtxos( FfiConverterString.lift(address), { signal } ); }; const uniffiHandleSuccess = (returnValue: Array) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterArrayTypeUtxo.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ChainServiceError.instanceOf, /*lowerError:*/ FfiConverterTypeChainServiceError.lower.bind( FfiConverterTypeChainServiceError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getAddressTxos: ( uniffiHandle: bigint, address: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise> => { const jsCallback = FfiConverterTypeBitcoinChainService.lift(uniffiHandle); return await jsCallback.getAddressTxos( FfiConverterString.lift(address), { signal } ); }; const uniffiHandleSuccess = (returnValue: Array) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterArrayTypeUtxo.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ChainServiceError.instanceOf, /*lowerError:*/ FfiConverterTypeChainServiceError.lower.bind( FfiConverterTypeChainServiceError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getTransactionStatus: ( uniffiHandle: bigint, txid: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeBitcoinChainService.lift(uniffiHandle); return await jsCallback.getTransactionStatus( FfiConverterString.lift(txid), { signal } ); }; const uniffiHandleSuccess = (returnValue: TxStatus) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeTxStatus.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ChainServiceError.instanceOf, /*lowerError:*/ FfiConverterTypeChainServiceError.lower.bind( FfiConverterTypeChainServiceError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, tipHeight: ( uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompleteU32, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeBitcoinChainService.lift(uniffiHandle); return await jsCallback.tipHeight({ signal }); }; const uniffiHandleSuccess = (returnValue: /*u32*/ number) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructU32 */ { returnValue: FfiConverterUInt32.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructU32 */ { returnValue: 0, // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ChainServiceError.instanceOf, /*lowerError:*/ FfiConverterTypeChainServiceError.lower.bind( FfiConverterTypeChainServiceError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getTransactionHex: ( uniffiHandle: bigint, txid: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeBitcoinChainService.lift(uniffiHandle); return await jsCallback.getTransactionHex( FfiConverterString.lift(txid), { signal } ); }; const uniffiHandleSuccess = (returnValue: string) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterString.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ChainServiceError.instanceOf, /*lowerError:*/ FfiConverterTypeChainServiceError.lower.bind( FfiConverterTypeChainServiceError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getOutspend: ( uniffiHandle: bigint, txid: Uint8Array, vout: number, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeBitcoinChainService.lift(uniffiHandle); return await jsCallback.getOutspend( FfiConverterString.lift(txid), FfiConverterUInt32.lift(vout), { signal } ); }; const uniffiHandleSuccess = (returnValue: Outspend) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeOutspend.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ChainServiceError.instanceOf, /*lowerError:*/ FfiConverterTypeChainServiceError.lower.bind( FfiConverterTypeChainServiceError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, broadcastTransaction: ( uniffiHandle: bigint, tx: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeBitcoinChainService.lift(uniffiHandle); return await jsCallback.broadcastTransaction( FfiConverterString.lift(tx), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ChainServiceError.instanceOf, /*lowerError:*/ FfiConverterTypeChainServiceError.lower.bind( FfiConverterTypeChainServiceError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, recommendedFees: ( uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeBitcoinChainService.lift(uniffiHandle); return await jsCallback.recommendedFees({ signal }); }; const uniffiHandleSuccess = (returnValue: RecommendedFees) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeRecommendedFees.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ChainServiceError.instanceOf, /*lowerError:*/ FfiConverterTypeChainServiceError.lower.bind( FfiConverterTypeChainServiceError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, uniffiFree: (uniffiHandle: UniffiHandle): void => { // BitcoinChainService: this will throw a stale handle error if the handle isn't found. FfiConverterTypeBitcoinChainService.drop(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_bitcoinchainservice( uniffiCallbackInterfaceBitcoinChainService.vtable ); }, }; /** * `BreezSDK` is a wrapper around `SparkSDK` that provides a more structured API * with request/response objects and comprehensive error handling. */ export interface BreezSdkInterface { /** * Adds a new contact. * * # Arguments * * * `request` - The request containing the contact details * * # Returns * * The created contact or an error */ addContact( request: AddContactRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Registers a listener to receive SDK events * * The SDK holds the listener until it is removed with * `remove_event_listener` or until `disconnect` unregisters all * listeners. A held listener that references the SDK instance keeps * that instance alive. * * # Arguments * * * `listener` - An implementation of the `EventListener` trait * * # Returns * * A unique identifier for the listener, which can be used to remove it later */ addEventListener( listener: EventListener, asyncOpts_?: { signal: AbortSignal } ): Promise; /** * Authorize transferring the current owner's registered lightning address * username to `request.transferee_pubkey`. Returns a * [`TransferAuthorization`] to hand to the new owner, who * claims it via [`BreezSdk::claim_lightning_address_transfer`]. * Errors if the current owner has no lightning address registered. */ authorizeLightningAddressTransfer( request: AuthorizeTransferRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Builds the unsigned package for the batch prepared by * [`BreezSdk::prepare_send_batch`], for signing outside the SDK. * * Publish the signed package with * [`BreezSdk::publish_signed_transfer_package`], which returns every payment. */ buildUnsignedBatchPackage( request: BuildUnsignedBatchPackageRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; buildUnsignedLnurlPayPackage( request: BuildUnsignedLnurlPayPackageRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; buildUnsignedTransferPackage( request: BuildUnsignedTransferPackageRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Initiates a Bitcoin purchase flow via an external provider. * * Returns a URL the user should open to complete the purchase. * The request variant determines the provider and its parameters: * * - [`BuyBitcoinRequest::Moonpay`]: Fiat-to-Bitcoin via on-chain deposit. * - [`BuyBitcoinRequest::CashApp`]: Lightning invoice + `cash.app` deep link (mainnet only). */ buyBitcoin( request: BuyBitcoinRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Check whether a username is free for this wallet to register. * * The check is signed with the wallet's identity key, so every call costs * a signing operation and a server round trip: run it when the user * finishes typing, not on every keystroke. */ checkLightningAddressAvailable( req: CheckLightningAddressRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Verifies a message signature against the provided public key. The message * is SHA256 hashed before verification. The signature can be hex encoded * in either DER or compact format. */ checkMessage( request: CheckMessageRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Reads an exit you kept back against the chain: which of its transactions * are now in a block, and whether it can still be finished as it stands. * * Needs neither the wallet's leaves nor a signer, so an exit can be followed * from the response alone. Store the response in place of the one you passed * in, and broadcast what its statuses leave to send. */ checkUnilateralExit( request: CheckUnilateralExitRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; claimDeposit( request: ClaimDepositRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; claimHtlcPayment( request: ClaimHtlcPaymentRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Claim a lightning address username handed over by its current owner, * using the [`TransferAuthorization`] from * [`BreezSdk::authorize_lightning_address_transfer`]. Completes the * takeover and returns the newly-owned address. */ claimLightningAddressTransfer( request: ClaimTransferRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Deletes a contact by its ID. * * # Arguments * * * `id` - The ID of the contact to delete * * # Returns * * Success or an error */ deleteContact( id: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Give up this wallet's lightning address. * * The server holds the address for this wallet afterwards: while the hold * stands only this wallet can register it, so payers who kept the old * address are not redirected to someone else. How long a hold stands is * the server's policy. */ deleteLightningAddress(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; /** * Stops the SDK's background tasks * * This method stops the background tasks started by the `start()` method. * It should be called before your application terminates to ensure proper cleanup. * * It also unregisters all event listeners, so listeners that reference * the SDK no longer keep it alive after this call. * * # Returns * * Result containing either success or an `SdkError` if the background task couldn't be stopped */ disconnect(asyncOpts_?: { signal: AbortSignal }): /*throws*/ Promise; /** * Serializes everything needed to unilaterally exit this wallet's funds * while the Spark operators are unreachable, so it can be kept somewhere * the wallet's own storage cannot take with it. * * The state goes stale as the wallet is used: export again whenever a * `UnilateralExitStateChanged` event arrives. */ exportUnilateralExitState(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; /** * Quotes both ways of claiming a deposit, so the caller can offer a choice * between claiming ahead of maturity for a spread and waiting for the cheaper * claim at maturity. * * The early quote is requested from the provider on each call rather than read * from cache, so call this when a user is deciding, not on a timer. */ fetchClaimDepositQuote( request: FetchClaimDepositQuoteRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; fetchConversionLimits( request: FetchConversionLimitsRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Returns the available cross-chain routes. * * Use [`CrossChainRouteFilter::Send`] to get routes for sending from Spark * (filtered by the parsed recipient address), * [`CrossChainRouteFilter::PaymentLink`] for routes fundable by an external * fiat rail (`prepare_payment_link`), or * [`CrossChainRouteFilter::Receive`] to get routes for receiving into Spark * (optionally filtered by a source contract address). */ getCrossChainRoutes( filter: CrossChainRouteFilter, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise>; /** * Returns the balance of the wallet in satoshis */ getInfo( request: GetInfoRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; getLightningAddress(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; getPayment( request: GetPaymentRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Returns an instance of the [`TokenIssuer`] for managing token issuance. */ getTokenIssuer(): TokenIssuerInterface; /** * Returns the metadata for the given token identifiers. * * Results are not guaranteed to be in the same order as the input token identifiers. * * If the metadata is not found locally in cache, it will be queried from * the Spark network and then cached. */ getTokensMetadata( request: GetTokensMetadataRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Returns the user settings for the wallet. * * Some settings are fetched from the Spark network so network requests are performed. */ getUserSettings(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; /** * Merges a previously exported exit state back into the wallet, without * contacting the Spark operators. A leaf the exit state does not record * this wallet as the owner of is skipped. * * A leaf the wallet can already exit keeps the data it has: an exit state * carries no mark of when it was taken, so the imported copy is used only * where the wallet has nothing that works. Importing an out of date state * therefore never costs the wallet the ability to exit a leaf. * * The exit state must come from the same network the SDK is configured * for. * * An out of date exit state can restore funds that have since been spent, * so the balance may read high until the next sync reconciles it with the * Spark operators. */ importUnilateralExitState( request: ImportUnilateralExitStateRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Lists contacts with optional pagination. * * # Arguments * * * `request` - The request containing optional pagination parameters * * # Returns * * A list of contacts or an error */ listContacts( request: ListContactsRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise>; /** * List fiat currencies for which there is a known exchange rate, * sorted by the canonical name of the currency. */ listFiatCurrencies(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; /** * List the latest rates of fiat currencies, sorted by name. */ listFiatRates(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; /** * Lists payments from the storage with pagination * * This method provides direct access to the payment history stored in the database. * It returns payments in reverse chronological order (newest first). * * # Arguments * * * `request` - Contains pagination parameters (offset and limit) * * # Returns * * * `Ok(ListPaymentsResponse)` - Contains the list of payments if successful * * `Err(SdkError)` - If there was an error accessing the storage */ listPayments( request: ListPaymentsRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; listUnclaimedDeposits( request: ListUnclaimedDepositsRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Lists all webhooks currently registered for this wallet. * * # Returns * * A list of registered webhooks with their IDs, URLs, and subscribed event types */ listWebhooks(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise>; /** * Performs LNURL-auth with the service. * * This method implements the LNURL-auth protocol as specified in LUD-04 and LUD-05. * It derives a domain-specific linking key, signs the challenge, and sends the * authentication request to the service. */ lnurlAuth( requestData: LnurlAuthRequestDetails, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; lnurlPay( request: LnurlPayRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Performs an LNURL withdraw operation for the amount of satoshis to * withdraw and the LNURL withdraw request details. The LNURL withdraw request * details can be obtained from calling [`BreezSdk::parse`]. * * The method generates a Lightning invoice for the withdraw amount, stores * the LNURL withdraw metadata, and performs the LNURL withdraw using the generated * invoice. * * If the `completion_timeout_secs` parameter is provided and greater than 0, the * method will wait for the payment to be completed within that period. If the * withdraw is completed within the timeout, the `payment` field in the response * will be set with the payment details. If the `completion_timeout_secs` * parameter is not provided or set to 0, the method will not wait for the payment * to be completed. If the withdraw is not completed within the * timeout, the `payment` field will be empty. * * # Arguments * * * `request` - The LNURL withdraw request * * # Returns * * Result containing either: * * `LnurlWithdrawResponse` - The payment details if the withdraw request was successful * * `SdkError` - If there was an error during the withdraw process */ lnurlWithdraw( request: LnurlWithdrawRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Manually drives leaf optimization, blocking until the requested work * is done. * * With [`OptimizationMode::Full`] (the default) the call runs the entire * optimization in a single invocation. With * [`OptimizationMode::SingleRound`] it executes one round and returns — * the caller drives the loop by inspecting the * [`OptimizeLeavesResponse::outcome`] and calling again until * `InProgress` no longer appears. * * Returns an error if another optimization run (auto or manual) is * already in flight ([`SdkError::OptimizationAlreadyRunning`]), or if * the SDK preempted this run to free leaves for a payment * ([`SdkError::OptimizationCancelled`]). * * Manual runs do not emit events; events ([`SdkEvent::AutoOptimization`]) * are reserved for the background auto-optimizer. */ optimizeLeaves( request: OptimizeLeavesRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; parse( input: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; prepareLnurlPay( request: PrepareLnurlPayRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Prepare a payment link that sends USDC/USDT to an external-chain * recipient, funded by Cash App over Lightning. * * Creates a cross-chain order and returns a `cash.app` deep link the payer * opens. Once paid, the provider delivers the stablecoin to `address`. No * funds move through the Spark wallet. Only available on mainnet. */ preparePaymentLink( request: PreparePaymentLinkRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Prepares a send to several payees, all paid by one transaction. * * Each recipient is a Spark address or a Spark invoice, and one batch may * span several tokens. The response resolves every invoice into the asset * and amount it requests, and reports what the batch debits per asset. * * A batch pays tokens: sending sats to several payees at once is not * supported yet, so a recipient that resolves to sats is rejected. * * A batch that pays a Spark invoice is limited to a single token: the * operators reject a transaction that carries an invoice and pays more * than one. Send those as one batch per token. */ prepareSendBatch( request: PrepareSendBatchRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; prepareSendPayment( request: PrepareSendPaymentRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Quotes a unilateral exit without any funding UTXOs: selects which leaves * would exit, computes the exact fee for the given funding kind, and reports * how much to fund. */ prepareUnilateralExit( request: PrepareUnilateralExitRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; publishSignedLnurlPayPackage( request: PublishSignedLnurlPayPackageRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; publishSignedTransferPackage( request: PublishSignedTransferPackageRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; receivePayment( request: ReceivePaymentRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Get the recommended BTC fees based on the configured chain service. */ recommendedFees(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; refundDeposit( request: RefundDepositRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Runs one full pass of the pending-conversion refunder and returns how * many conversions were refunded, skipped (held back by a safety window), * or failed. * * The pass has two parts: refunding locally-marked failed conversions, and * reconciling against Flashnet's clawback-eligible listing to catch * conversions with no local marker (e.g. a storage write that never * landed). The SDK's periodic background schedule runs only the local * part; the reconcile runs at SDK init and on each call to this method, so * this is the explicit entry point for driving a full pass on demand. */ refundPendingConversions(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; registerLightningAddress( request: RegisterLightningAddressRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Registers a webhook to receive notifications for wallet events. * * When registered events occur (e.g., a Lightning payment is received), * the Spark service provider will send an HTTP POST to the specified URL * with a payload signed using HMAC-SHA256 with the provided secret. * * # Arguments * * * `request` - The webhook registration details including URL, secret, and event types * * # Returns * * A response containing the unique identifier of the registered webhook */ registerWebhook( request: RegisterWebhookRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Removes a previously registered event listener * * # Arguments * * * `id` - The listener ID returned from `add_event_listener` * * # Returns * * `true` if the listener was found and removed, `false` otherwise */ removeEventListener( id: string, asyncOpts_?: { signal: AbortSignal } ): Promise; /** * Sends the batch prepared by [`BreezSdk::prepare_send_batch`], returning * one payment per recipient in recipient order. * * Retrying after a failure that leaves the outcome unknown may pay twice: * a token transfer has no idempotency key, since the operator can only be * asked about a transaction by a hash that is computed while broadcasting. * Look for the batch with a `Token` payment details filter on the * transaction hash before sending it again. */ sendBatch( request: SendBatchRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; sendPayment( request: SendPaymentRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Signs a message with the wallet's identity key. The message is SHA256 * hashed before signing. The returned signature will be hex encoded in * DER format by default, or compact format if specified. * * Messages in the `breez-lnurl:` namespace are refused: it is reserved for * the SDK's own requests to the Lightning address server. */ signMessage( request: SignMessageRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Synchronizes the wallet with the Spark network */ syncWallet( request: SyncWalletRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Builds and signs a complete unilateral exit from a `prepare_unilateral_exit` * quote and the actual funding UTXOs, returning the full transaction set in * topological broadcast order without broadcasting. Broadcast it over time, * respecting each transaction's `depends_on` and `csv_timelock_blocks`. * * It reads on-chain state first: an already-confirmed fan-out or CPFP node * is not rebuilt, and a leaf refund already on-chain (recognized by the * leaf's refund address, so any refund variant counts) is swept directly. * Re-running after partial progress therefore resumes rather than restarts. */ unilateralExit( request: UnilateralExitRequest, signer: CpfpSigner, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Unregisters a previously registered webhook. * * After unregistering, the Spark service provider will no longer send * notifications to the webhook URL. * * # Arguments * * * `request` - The unregister request containing the webhook ID */ unregisterWebhook( request: UnregisterWebhookRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Updates an existing contact. * * # Arguments * * * `request` - The request containing the updated contact details * * # Returns * * The updated contact or an error */ updateContact( request: UpdateContactRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Updates the user settings for the wallet. * * Some settings are updated on the Spark network so network requests may be performed. */ updateUserSettings( request: UpdateUserSettingsRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * `BreezSDK` is a wrapper around `SparkSDK` that provides a more structured API * with request/response objects and comprehensive error handling. */ export class BreezSdk extends UniffiAbstractObject implements BreezSdkInterface { readonly [uniffiTypeNameSymbol] = 'BreezSdk'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeBreezSdkObjectFactory.bless(pointer); } /** * Adds a new contact. * * # Arguments * * * `request` - The request containing the contact details * * # Returns * * The created contact or an error */ public async addContact( request: AddContactRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_add_contact( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeAddContactRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeContact.lift.bind( FfiConverterTypeContact ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Registers a listener to receive SDK events * * The SDK holds the listener until it is removed with * `remove_event_listener` or until `disconnect` unregisters all * listeners. A held listener that references the SDK instance keeps * that instance alive. * * # Arguments * * * `listener` - An implementation of the `EventListener` trait * * # Returns * * A unique identifier for the listener, which can be used to remove it later */ public async addEventListener( listener: EventListener, asyncOpts_?: { signal: AbortSignal } ): Promise { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_add_event_listener( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeEventListener.lower(listener) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_ ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Authorize transferring the current owner's registered lightning address * username to `request.transferee_pubkey`. Returns a * [`TransferAuthorization`] to hand to the new owner, who * claims it via [`BreezSdk::claim_lightning_address_transfer`]. * Errors if the current owner has no lightning address registered. */ public async authorizeLightningAddressTransfer( request: AuthorizeTransferRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_authorize_lightning_address_transfer( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeAuthorizeTransferRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeTransferAuthorization.lift.bind( FfiConverterTypeTransferAuthorization ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Builds the unsigned package for the batch prepared by * [`BreezSdk::prepare_send_batch`], for signing outside the SDK. * * Publish the signed package with * [`BreezSdk::publish_signed_transfer_package`], which returns every payment. */ public async buildUnsignedBatchPackage( request: BuildUnsignedBatchPackageRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_build_unsigned_batch_package( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeBuildUnsignedBatchPackageRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeUnsignedTransferPackage.lift.bind( FfiConverterTypeUnsignedTransferPackage ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async buildUnsignedLnurlPayPackage( request: BuildUnsignedLnurlPayPackageRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_build_unsigned_lnurl_pay_package( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeBuildUnsignedLnurlPayPackageRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeUnsignedTransferPackage.lift.bind( FfiConverterTypeUnsignedTransferPackage ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async buildUnsignedTransferPackage( request: BuildUnsignedTransferPackageRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_build_unsigned_transfer_package( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeBuildUnsignedTransferPackageRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeUnsignedTransferPackage.lift.bind( FfiConverterTypeUnsignedTransferPackage ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Initiates a Bitcoin purchase flow via an external provider. * * Returns a URL the user should open to complete the purchase. * The request variant determines the provider and its parameters: * * - [`BuyBitcoinRequest::Moonpay`]: Fiat-to-Bitcoin via on-chain deposit. * - [`BuyBitcoinRequest::CashApp`]: Lightning invoice + `cash.app` deep link (mainnet only). */ public async buyBitcoin( request: BuyBitcoinRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_buy_bitcoin( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeBuyBitcoinRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeBuyBitcoinResponse.lift.bind( FfiConverterTypeBuyBitcoinResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Check whether a username is free for this wallet to register. * * The check is signed with the wallet's identity key, so every call costs * a signing operation and a server round trip: run it when the user * finishes typing, not on every keystroke. */ public async checkLightningAddressAvailable( req: CheckLightningAddressRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_check_lightning_address_available( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeCheckLightningAddressRequest.lower(req) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_i8, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_i8, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_i8, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_i8, /*liftFunc:*/ FfiConverterBool.lift.bind(FfiConverterBool), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Verifies a message signature against the provided public key. The message * is SHA256 hashed before verification. The signature can be hex encoded * in either DER or compact format. */ public async checkMessage( request: CheckMessageRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_check_message( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeCheckMessageRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeCheckMessageResponse.lift.bind( FfiConverterTypeCheckMessageResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Reads an exit you kept back against the chain: which of its transactions * are now in a block, and whether it can still be finished as it stands. * * Needs neither the wallet's leaves nor a signer, so an exit can be followed * from the response alone. Store the response in place of the one you passed * in, and broadcast what its statuses leave to send. */ public async checkUnilateralExit( request: CheckUnilateralExitRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_check_unilateral_exit( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeCheckUnilateralExitRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeCheckUnilateralExitResponse.lift.bind( FfiConverterTypeCheckUnilateralExitResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async claimDeposit( request: ClaimDepositRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_claim_deposit( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeClaimDepositRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeClaimDepositResponse.lift.bind( FfiConverterTypeClaimDepositResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async claimHtlcPayment( request: ClaimHtlcPaymentRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_claim_htlc_payment( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeClaimHtlcPaymentRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeClaimHtlcPaymentResponse.lift.bind( FfiConverterTypeClaimHtlcPaymentResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Claim a lightning address username handed over by its current owner, * using the [`TransferAuthorization`] from * [`BreezSdk::authorize_lightning_address_transfer`]. Completes the * takeover and returns the newly-owned address. */ public async claimLightningAddressTransfer( request: ClaimTransferRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_claim_lightning_address_transfer( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeClaimTransferRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeLightningAddressInfo.lift.bind( FfiConverterTypeLightningAddressInfo ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Deletes a contact by its ID. * * # Arguments * * * `id` - The ID of the contact to delete * * # Returns * * Success or an error */ public async deleteContact( id: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_delete_contact( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterString.lower(id) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Give up this wallet's lightning address. * * The server holds the address for this wallet afterwards: while the hold * stands only this wallet can register it, so payers who kept the old * address are not redirected to someone else. How long a hold stands is * the server's policy. */ public async deleteLightningAddress(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_delete_lightning_address( uniffiTypeBreezSdkObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Stops the SDK's background tasks * * This method stops the background tasks started by the `start()` method. * It should be called before your application terminates to ensure proper cleanup. * * It also unregisters all event listeners, so listeners that reference * the SDK no longer keep it alive after this call. * * # Returns * * Result containing either success or an `SdkError` if the background task couldn't be stopped */ public async disconnect(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_disconnect( uniffiTypeBreezSdkObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Serializes everything needed to unilaterally exit this wallet's funds * while the Spark operators are unreachable, so it can be kept somewhere * the wallet's own storage cannot take with it. * * The state goes stale as the wallet is used: export again whenever a * `UnilateralExitStateChanged` event arrives. */ public async exportUnilateralExitState(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_export_unilateral_exit_state( uniffiTypeBreezSdkObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeExportUnilateralExitStateResponse.lift.bind( FfiConverterTypeExportUnilateralExitStateResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Quotes both ways of claiming a deposit, so the caller can offer a choice * between claiming ahead of maturity for a spread and waiting for the cheaper * claim at maturity. * * The early quote is requested from the provider on each call rather than read * from cache, so call this when a user is deciding, not on a timer. */ public async fetchClaimDepositQuote( request: FetchClaimDepositQuoteRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_fetch_claim_deposit_quote( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeFetchClaimDepositQuoteRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeFetchClaimDepositQuoteResponse.lift.bind( FfiConverterTypeFetchClaimDepositQuoteResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async fetchConversionLimits( request: FetchConversionLimitsRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_fetch_conversion_limits( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeFetchConversionLimitsRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeFetchConversionLimitsResponse.lift.bind( FfiConverterTypeFetchConversionLimitsResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Returns the available cross-chain routes. * * Use [`CrossChainRouteFilter::Send`] to get routes for sending from Spark * (filtered by the parsed recipient address), * [`CrossChainRouteFilter::PaymentLink`] for routes fundable by an external * fiat rail (`prepare_payment_link`), or * [`CrossChainRouteFilter::Receive`] to get routes for receiving into Spark * (optionally filtered by a source contract address). */ public async getCrossChainRoutes( filter: CrossChainRouteFilter, asyncOpts_?: { signal: AbortSignal } ): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_get_cross_chain_routes( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeCrossChainRouteFilter.lower(filter) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayTypeCrossChainRoutePair.lift.bind( FfiConverterArrayTypeCrossChainRoutePair ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Returns the balance of the wallet in satoshis */ public async getInfo( request: GetInfoRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_get_info( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeGetInfoRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeGetInfoResponse.lift.bind( FfiConverterTypeGetInfoResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async getLightningAddress(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_get_lightning_address( uniffiTypeBreezSdkObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterOptionalTypeLightningAddressInfo.lift.bind( FfiConverterOptionalTypeLightningAddressInfo ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async getPayment( request: GetPaymentRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_get_payment( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeGetPaymentRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeGetPaymentResponse.lift.bind( FfiConverterTypeGetPaymentResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Returns an instance of the [`TokenIssuer`] for managing token issuance. */ public getTokenIssuer(): TokenIssuerInterface { return FfiConverterTypeTokenIssuer.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_get_token_issuer( uniffiTypeBreezSdkObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift ) ); } /** * Returns the metadata for the given token identifiers. * * Results are not guaranteed to be in the same order as the input token identifiers. * * If the metadata is not found locally in cache, it will be queried from * the Spark network and then cached. */ public async getTokensMetadata( request: GetTokensMetadataRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_get_tokens_metadata( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeGetTokensMetadataRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeGetTokensMetadataResponse.lift.bind( FfiConverterTypeGetTokensMetadataResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Returns the user settings for the wallet. * * Some settings are fetched from the Spark network so network requests are performed. */ public async getUserSettings(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_get_user_settings( uniffiTypeBreezSdkObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeUserSettings.lift.bind( FfiConverterTypeUserSettings ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Merges a previously exported exit state back into the wallet, without * contacting the Spark operators. A leaf the exit state does not record * this wallet as the owner of is skipped. * * A leaf the wallet can already exit keeps the data it has: an exit state * carries no mark of when it was taken, so the imported copy is used only * where the wallet has nothing that works. Importing an out of date state * therefore never costs the wallet the ability to exit a leaf. * * The exit state must come from the same network the SDK is configured * for. * * An out of date exit state can restore funds that have since been spent, * so the balance may read high until the next sync reconciles it with the * Spark operators. */ public async importUnilateralExitState( request: ImportUnilateralExitStateRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_import_unilateral_exit_state( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeImportUnilateralExitStateRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeImportUnilateralExitStateResponse.lift.bind( FfiConverterTypeImportUnilateralExitStateResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Lists contacts with optional pagination. * * # Arguments * * * `request` - The request containing optional pagination parameters * * # Returns * * A list of contacts or an error */ public async listContacts( request: ListContactsRequest, asyncOpts_?: { signal: AbortSignal } ): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_list_contacts( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeListContactsRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayTypeContact.lift.bind( FfiConverterArrayTypeContact ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * List fiat currencies for which there is a known exchange rate, * sorted by the canonical name of the currency. */ public async listFiatCurrencies(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_list_fiat_currencies( uniffiTypeBreezSdkObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeListFiatCurrenciesResponse.lift.bind( FfiConverterTypeListFiatCurrenciesResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * List the latest rates of fiat currencies, sorted by name. */ public async listFiatRates(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_list_fiat_rates( uniffiTypeBreezSdkObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeListFiatRatesResponse.lift.bind( FfiConverterTypeListFiatRatesResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Lists payments from the storage with pagination * * This method provides direct access to the payment history stored in the database. * It returns payments in reverse chronological order (newest first). * * # Arguments * * * `request` - Contains pagination parameters (offset and limit) * * # Returns * * * `Ok(ListPaymentsResponse)` - Contains the list of payments if successful * * `Err(SdkError)` - If there was an error accessing the storage */ public async listPayments( request: ListPaymentsRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_list_payments( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeListPaymentsRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeListPaymentsResponse.lift.bind( FfiConverterTypeListPaymentsResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async listUnclaimedDeposits( request: ListUnclaimedDepositsRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_list_unclaimed_deposits( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeListUnclaimedDepositsRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeListUnclaimedDepositsResponse.lift.bind( FfiConverterTypeListUnclaimedDepositsResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Lists all webhooks currently registered for this wallet. * * # Returns * * A list of registered webhooks with their IDs, URLs, and subscribed event types */ public async listWebhooks(asyncOpts_?: { signal: AbortSignal; }): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_list_webhooks( uniffiTypeBreezSdkObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayTypeWebhook.lift.bind( FfiConverterArrayTypeWebhook ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Performs LNURL-auth with the service. * * This method implements the LNURL-auth protocol as specified in LUD-04 and LUD-05. * It derives a domain-specific linking key, signs the challenge, and sends the * authentication request to the service. */ public async lnurlAuth( requestData: LnurlAuthRequestDetails, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_lnurl_auth( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeLnurlAuthRequestDetails.lower(requestData) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeLnurlCallbackStatus.lift.bind( FfiConverterTypeLnurlCallbackStatus ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async lnurlPay( request: LnurlPayRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_lnurl_pay( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeLnurlPayRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeLnurlPayResponse.lift.bind( FfiConverterTypeLnurlPayResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Performs an LNURL withdraw operation for the amount of satoshis to * withdraw and the LNURL withdraw request details. The LNURL withdraw request * details can be obtained from calling [`BreezSdk::parse`]. * * The method generates a Lightning invoice for the withdraw amount, stores * the LNURL withdraw metadata, and performs the LNURL withdraw using the generated * invoice. * * If the `completion_timeout_secs` parameter is provided and greater than 0, the * method will wait for the payment to be completed within that period. If the * withdraw is completed within the timeout, the `payment` field in the response * will be set with the payment details. If the `completion_timeout_secs` * parameter is not provided or set to 0, the method will not wait for the payment * to be completed. If the withdraw is not completed within the * timeout, the `payment` field will be empty. * * # Arguments * * * `request` - The LNURL withdraw request * * # Returns * * Result containing either: * * `LnurlWithdrawResponse` - The payment details if the withdraw request was successful * * `SdkError` - If there was an error during the withdraw process */ public async lnurlWithdraw( request: LnurlWithdrawRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_lnurl_withdraw( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeLnurlWithdrawRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeLnurlWithdrawResponse.lift.bind( FfiConverterTypeLnurlWithdrawResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Manually drives leaf optimization, blocking until the requested work * is done. * * With [`OptimizationMode::Full`] (the default) the call runs the entire * optimization in a single invocation. With * [`OptimizationMode::SingleRound`] it executes one round and returns — * the caller drives the loop by inspecting the * [`OptimizeLeavesResponse::outcome`] and calling again until * `InProgress` no longer appears. * * Returns an error if another optimization run (auto or manual) is * already in flight ([`SdkError::OptimizationAlreadyRunning`]), or if * the SDK preempted this run to free leaves for a payment * ([`SdkError::OptimizationCancelled`]). * * Manual runs do not emit events; events ([`SdkEvent::AutoOptimization`]) * are reserved for the background auto-optimizer. */ public async optimizeLeaves( request: OptimizeLeavesRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_optimize_leaves( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeOptimizeLeavesRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeOptimizeLeavesResponse.lift.bind( FfiConverterTypeOptimizeLeavesResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async parse( input: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_parse( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterString.lower(input) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeInputType.lift.bind( FfiConverterTypeInputType ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async prepareLnurlPay( request: PrepareLnurlPayRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_lnurl_pay( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypePrepareLnurlPayRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePrepareLnurlPayResponse.lift.bind( FfiConverterTypePrepareLnurlPayResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Prepare a payment link that sends USDC/USDT to an external-chain * recipient, funded by Cash App over Lightning. * * Creates a cross-chain order and returns a `cash.app` deep link the payer * opens. Once paid, the provider delivers the stablecoin to `address`. No * funds move through the Spark wallet. Only available on mainnet. */ public async preparePaymentLink( request: PreparePaymentLinkRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_payment_link( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypePreparePaymentLinkRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePreparePaymentLinkResponse.lift.bind( FfiConverterTypePreparePaymentLinkResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Prepares a send to several payees, all paid by one transaction. * * Each recipient is a Spark address or a Spark invoice, and one batch may * span several tokens. The response resolves every invoice into the asset * and amount it requests, and reports what the batch debits per asset. * * A batch pays tokens: sending sats to several payees at once is not * supported yet, so a recipient that resolves to sats is rejected. * * A batch that pays a Spark invoice is limited to a single token: the * operators reject a transaction that carries an invoice and pays more * than one. Send those as one batch per token. */ public async prepareSendBatch( request: PrepareSendBatchRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_send_batch( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypePrepareSendBatchRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePrepareSendBatchResponse.lift.bind( FfiConverterTypePrepareSendBatchResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async prepareSendPayment( request: PrepareSendPaymentRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_send_payment( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypePrepareSendPaymentRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePrepareSendPaymentResponse.lift.bind( FfiConverterTypePrepareSendPaymentResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Quotes a unilateral exit without any funding UTXOs: selects which leaves * would exit, computes the exact fee for the given funding kind, and reports * how much to fund. */ public async prepareUnilateralExit( request: PrepareUnilateralExitRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_prepare_unilateral_exit( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypePrepareUnilateralExitRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePrepareUnilateralExitResponse.lift.bind( FfiConverterTypePrepareUnilateralExitResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async publishSignedLnurlPayPackage( request: PublishSignedLnurlPayPackageRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_publish_signed_lnurl_pay_package( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypePublishSignedLnurlPayPackageRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePublishSignedLnurlPayResponse.lift.bind( FfiConverterTypePublishSignedLnurlPayResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async publishSignedTransferPackage( request: PublishSignedTransferPackageRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_publish_signed_transfer_package( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypePublishSignedTransferPackageRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePublishSignedTransferPackageResponse.lift.bind( FfiConverterTypePublishSignedTransferPackageResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async receivePayment( request: ReceivePaymentRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_receive_payment( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeReceivePaymentRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeReceivePaymentResponse.lift.bind( FfiConverterTypeReceivePaymentResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Get the recommended BTC fees based on the configured chain service. */ public async recommendedFees(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_recommended_fees( uniffiTypeBreezSdkObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeRecommendedFees.lift.bind( FfiConverterTypeRecommendedFees ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async refundDeposit( request: RefundDepositRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_refund_deposit( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeRefundDepositRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeRefundDepositResponse.lift.bind( FfiConverterTypeRefundDepositResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Runs one full pass of the pending-conversion refunder and returns how * many conversions were refunded, skipped (held back by a safety window), * or failed. * * The pass has two parts: refunding locally-marked failed conversions, and * reconciling against Flashnet's clawback-eligible listing to catch * conversions with no local marker (e.g. a storage write that never * landed). The SDK's periodic background schedule runs only the local * part; the reconcile runs at SDK init and on each call to this method, so * this is the explicit entry point for driving a full pass on demand. */ public async refundPendingConversions(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_refund_pending_conversions( uniffiTypeBreezSdkObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeRefundPendingConversionsResponse.lift.bind( FfiConverterTypeRefundPendingConversionsResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async registerLightningAddress( request: RegisterLightningAddressRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_register_lightning_address( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeRegisterLightningAddressRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeLightningAddressInfo.lift.bind( FfiConverterTypeLightningAddressInfo ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Registers a webhook to receive notifications for wallet events. * * When registered events occur (e.g., a Lightning payment is received), * the Spark service provider will send an HTTP POST to the specified URL * with a payload signed using HMAC-SHA256 with the provided secret. * * # Arguments * * * `request` - The webhook registration details including URL, secret, and event types * * # Returns * * A response containing the unique identifier of the registered webhook */ public async registerWebhook( request: RegisterWebhookRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_register_webhook( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeRegisterWebhookRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeRegisterWebhookResponse.lift.bind( FfiConverterTypeRegisterWebhookResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Removes a previously registered event listener * * # Arguments * * * `id` - The listener ID returned from `add_event_listener` * * # Returns * * `true` if the listener was found and removed, `false` otherwise */ public async removeEventListener( id: string, asyncOpts_?: { signal: AbortSignal } ): Promise { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_remove_event_listener( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterString.lower(id) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_i8, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_i8, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_i8, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_i8, /*liftFunc:*/ FfiConverterBool.lift.bind(FfiConverterBool), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_ ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Sends the batch prepared by [`BreezSdk::prepare_send_batch`], returning * one payment per recipient in recipient order. * * Retrying after a failure that leaves the outcome unknown may pay twice: * a token transfer has no idempotency key, since the operator can only be * asked about a transaction by a hash that is computed while broadcasting. * Look for the batch with a `Token` payment details filter on the * transaction hash before sending it again. */ public async sendBatch( request: SendBatchRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_send_batch( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeSendBatchRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeSendBatchResponse.lift.bind( FfiConverterTypeSendBatchResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async sendPayment( request: SendPaymentRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_send_payment( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeSendPaymentRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeSendPaymentResponse.lift.bind( FfiConverterTypeSendPaymentResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Signs a message with the wallet's identity key. The message is SHA256 * hashed before signing. The returned signature will be hex encoded in * DER format by default, or compact format if specified. * * Messages in the `breez-lnurl:` namespace are refused: it is reserved for * the SDK's own requests to the Lightning address server. */ public async signMessage( request: SignMessageRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_sign_message( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeSignMessageRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeSignMessageResponse.lift.bind( FfiConverterTypeSignMessageResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Synchronizes the wallet with the Spark network */ public async syncWallet( request: SyncWalletRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_sync_wallet( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeSyncWalletRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeSyncWalletResponse.lift.bind( FfiConverterTypeSyncWalletResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Builds and signs a complete unilateral exit from a `prepare_unilateral_exit` * quote and the actual funding UTXOs, returning the full transaction set in * topological broadcast order without broadcasting. Broadcast it over time, * respecting each transaction's `depends_on` and `csv_timelock_blocks`. * * It reads on-chain state first: an already-confirmed fan-out or CPFP node * is not rebuilt, and a leaf refund already on-chain (recognized by the * leaf's refund address, so any refund variant counts) is swept directly. * Re-running after partial progress therefore resumes rather than restarts. */ public async unilateralExit( request: UnilateralExitRequest, signer: CpfpSigner, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_unilateral_exit( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeUnilateralExitRequest.lower(request), FfiConverterTypeCpfpSigner.lower(signer) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeUnilateralExitResponse.lift.bind( FfiConverterTypeUnilateralExitResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Unregisters a previously registered webhook. * * After unregistering, the Spark service provider will no longer send * notifications to the webhook URL. * * # Arguments * * * `request` - The unregister request containing the webhook ID */ public async unregisterWebhook( request: UnregisterWebhookRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_unregister_webhook( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeUnregisterWebhookRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Updates an existing contact. * * # Arguments * * * `request` - The request containing the updated contact details * * # Returns * * The updated contact or an error */ public async updateContact( request: UpdateContactRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_update_contact( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeUpdateContactRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeContact.lift.bind( FfiConverterTypeContact ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Updates the user settings for the wallet. * * Some settings are updated on the Spark network so network requests may be performed. */ public async updateUserSettings( request: UpdateUserSettingsRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_update_user_settings( uniffiTypeBreezSdkObjectFactory.clonePointer(this), FfiConverterTypeUpdateUserSettingsRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeBreezSdkObjectFactory.pointer(this); uniffiTypeBreezSdkObjectFactory.freePointer(pointer); uniffiTypeBreezSdkObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is BreezSdk { return uniffiTypeBreezSdkObjectFactory.isConcreteType(obj); } } const uniffiTypeBreezSdkObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): BreezSdkInterface { const instance = Object.create(BreezSdk.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'BreezSdk'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_breezsdk_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: BreezSdkInterface): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: BreezSdkInterface): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_breezsdk( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_breezsdk( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is BreezSdkInterface { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'BreezSdk' ); }, }; })(); // FfiConverter for BreezSdkInterface const FfiConverterTypeBreezSdk = new FfiConverterObject( uniffiTypeBreezSdkObjectFactory ); /** * Signer for external UTXO inputs in CPFP fee-bumping transactions. * * Signs the non-finalized inputs of a PSBT (serialized as bytes) and returns the * signed PSBT (also serialized as bytes). */ export interface CpfpSigner { signPsbt( psbtBytes: ArrayBuffer, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * Signer for external UTXO inputs in CPFP fee-bumping transactions. * * Signs the non-finalized inputs of a PSBT (serialized as bytes) and returns the * signed PSBT (also serialized as bytes). */ export class CpfpSignerImpl extends UniffiAbstractObject implements CpfpSigner { readonly [uniffiTypeNameSymbol] = 'CpfpSignerImpl'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeCpfpSignerImplObjectFactory.bless(pointer); } public async signPsbt( psbtBytes: ArrayBuffer, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_cpfpsigner_sign_psbt( uniffiTypeCpfpSignerImplObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(psbtBytes) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayBuffer.lift.bind( FfiConverterArrayBuffer ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeCpfpSignerImplObjectFactory.pointer(this); uniffiTypeCpfpSignerImplObjectFactory.freePointer(pointer); uniffiTypeCpfpSignerImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is CpfpSignerImpl { return uniffiTypeCpfpSignerImplObjectFactory.isConcreteType(obj); } } const uniffiTypeCpfpSignerImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): CpfpSigner { const instance = Object.create(CpfpSignerImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'CpfpSignerImpl'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_cpfpsigner_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: CpfpSigner): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: CpfpSigner): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_cpfpsigner( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_cpfpsigner( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is CpfpSigner { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'CpfpSignerImpl' ); }, }; })(); // FfiConverter for CpfpSigner const FfiConverterTypeCpfpSigner = new FfiConverterObjectWithCallbacks( uniffiTypeCpfpSignerImplObjectFactory ); // Add a vtavble for the callbacks that go in CpfpSigner. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceCpfpSigner: { vtable: UniffiVTableCallbackInterfaceCpfpSigner; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { signPsbt: ( uniffiHandle: bigint, psbtBytes: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeCpfpSigner.lift(uniffiHandle); return await jsCallback.signPsbt( FfiConverterArrayBuffer.lift(psbtBytes), { signal } ); }; const uniffiHandleSuccess = (returnValue: ArrayBuffer) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterArrayBuffer.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, uniffiFree: (uniffiHandle: UniffiHandle): void => { // CpfpSigner: this will throw a stale handle error if the handle isn't found. FfiConverterTypeCpfpSigner.drop(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_cpfpsigner( uniffiCallbackInterfaceCpfpSigner.vtable ); }, }; /** * External signer trait that can be implemented by users and passed to the SDK. * * This trait mirrors the `BreezSigner` trait but uses FFI-compatible types (bytes, strings) * instead of Rust-specific types. This allows it to be exposed through FFI and WASM bindings. * * All methods accept and return simple types: * - Derivation paths as strings (e.g., "m/44'/0'/0'") * - Public keys, signatures, and other crypto primitives as Vec * - Spark-specific types as serialized representations * * Errors are returned as `SignerError` for FFI compatibility. */ export interface ExternalBreezSigner { /** * Derives a public key for the given BIP32 derivation path. * * # Arguments * * `path` - BIP32 derivation path as a string (e.g., "m/44'/0'/0'/0/0") * * # Returns * The derived public key as 33 bytes, or a `SignerError` * * See also: [JavaScript `getPublicKeyFromDerivation`](https://docs.spark.money/wallets/spark-signer#get-public-key-from-derivation) */ derivePublicKey( path: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Signs a message using ECDSA at the given derivation path. * * The message should be a 32-byte digest (typically a hash of the original data). * * # Arguments * * `message` - The 32-byte message digest to sign * * `path` - BIP32 derivation path as a string * * # Returns * 64-byte compact ECDSA signature, or a `SignerError` */ signEcdsa( message: MessageBytes, path: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Signs a message using recoverable ECDSA at the given derivation path. * * The message should be a 32-byte digest (typically a hash of the original data). * * # Arguments * * `message` - The 32-byte message digest to sign * * `path` - BIP32 derivation path as a string * * # Returns * 65 bytes: recovery ID (31 + `recovery_id`) + 64-byte signature, or a `SignerError` */ signEcdsaRecoverable( message: MessageBytes, path: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Encrypts a message using ECIES at the given derivation path. * * # Arguments * * `message` - The message to encrypt * * `path` - BIP32 derivation path for the encryption key * * # Returns * Encrypted data, or a `SignerError` */ encryptEcies( message: ArrayBuffer, path: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Decrypts a message using ECIES at the given derivation path. * * # Arguments * * `message` - The encrypted message * * `path` - BIP32 derivation path for the decryption key * * # Returns * Decrypted data, or a `SignerError` * * See also: [JavaScript `decryptEcies`](https://docs.spark.money/wallets/spark-signer#decrypt-ecies) */ decryptEcies( message: ArrayBuffer, path: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Signs a hash using Schnorr signature at the given derivation path. * * # Arguments * * `hash` - The 32-byte hash to sign (must be 32 bytes) * * `path` - BIP32 derivation path as a string * * # Returns * 64-byte Schnorr signature, or a `SignerError` */ signHashSchnorr( hash: ArrayBuffer, path: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * HMAC-SHA256 of a message at the given derivation path. * * # Arguments * * `message` - The message to hash * * `path` - BIP32 derivation path as a string * * # Returns * 32-byte HMAC-SHA256, or a `SignerError` * * See also: [JavaScript `htlcHMAC`](https://docs.spark.money/wallets/spark-signer#generate-htlc-hmac) */ hmacSha256( message: ArrayBuffer, path: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * External signer trait that can be implemented by users and passed to the SDK. * * This trait mirrors the `BreezSigner` trait but uses FFI-compatible types (bytes, strings) * instead of Rust-specific types. This allows it to be exposed through FFI and WASM bindings. * * All methods accept and return simple types: * - Derivation paths as strings (e.g., "m/44'/0'/0'") * - Public keys, signatures, and other crypto primitives as Vec * - Spark-specific types as serialized representations * * Errors are returned as `SignerError` for FFI compatibility. */ export class ExternalBreezSignerImpl extends UniffiAbstractObject implements ExternalBreezSigner { readonly [uniffiTypeNameSymbol] = 'ExternalBreezSignerImpl'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeExternalBreezSignerImplObjectFactory.bless(pointer); } /** * Derives a public key for the given BIP32 derivation path. * * # Arguments * * `path` - BIP32 derivation path as a string (e.g., "m/44'/0'/0'/0/0") * * # Returns * The derived public key as 33 bytes, or a `SignerError` * * See also: [JavaScript `getPublicKeyFromDerivation`](https://docs.spark.money/wallets/spark-signer#get-public-key-from-derivation) */ public async derivePublicKey( path: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalbreezsigner_derive_public_key( uniffiTypeExternalBreezSignerImplObjectFactory.clonePointer(this), FfiConverterString.lower(path) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePublicKeyBytes.lift.bind( FfiConverterTypePublicKeyBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Signs a message using ECDSA at the given derivation path. * * The message should be a 32-byte digest (typically a hash of the original data). * * # Arguments * * `message` - The 32-byte message digest to sign * * `path` - BIP32 derivation path as a string * * # Returns * 64-byte compact ECDSA signature, or a `SignerError` */ public async signEcdsa( message: MessageBytes, path: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalbreezsigner_sign_ecdsa( uniffiTypeExternalBreezSignerImplObjectFactory.clonePointer(this), FfiConverterTypeMessageBytes.lower(message), FfiConverterString.lower(path) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeEcdsaSignatureBytes.lift.bind( FfiConverterTypeEcdsaSignatureBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Signs a message using recoverable ECDSA at the given derivation path. * * The message should be a 32-byte digest (typically a hash of the original data). * * # Arguments * * `message` - The 32-byte message digest to sign * * `path` - BIP32 derivation path as a string * * # Returns * 65 bytes: recovery ID (31 + `recovery_id`) + 64-byte signature, or a `SignerError` */ public async signEcdsaRecoverable( message: MessageBytes, path: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalbreezsigner_sign_ecdsa_recoverable( uniffiTypeExternalBreezSignerImplObjectFactory.clonePointer(this), FfiConverterTypeMessageBytes.lower(message), FfiConverterString.lower(path) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeRecoverableEcdsaSignatureBytes.lift.bind( FfiConverterTypeRecoverableEcdsaSignatureBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Encrypts a message using ECIES at the given derivation path. * * # Arguments * * `message` - The message to encrypt * * `path` - BIP32 derivation path for the encryption key * * # Returns * Encrypted data, or a `SignerError` */ public async encryptEcies( message: ArrayBuffer, path: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalbreezsigner_encrypt_ecies( uniffiTypeExternalBreezSignerImplObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(message), FfiConverterString.lower(path) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayBuffer.lift.bind( FfiConverterArrayBuffer ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Decrypts a message using ECIES at the given derivation path. * * # Arguments * * `message` - The encrypted message * * `path` - BIP32 derivation path for the decryption key * * # Returns * Decrypted data, or a `SignerError` * * See also: [JavaScript `decryptEcies`](https://docs.spark.money/wallets/spark-signer#decrypt-ecies) */ public async decryptEcies( message: ArrayBuffer, path: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalbreezsigner_decrypt_ecies( uniffiTypeExternalBreezSignerImplObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(message), FfiConverterString.lower(path) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayBuffer.lift.bind( FfiConverterArrayBuffer ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Signs a hash using Schnorr signature at the given derivation path. * * # Arguments * * `hash` - The 32-byte hash to sign (must be 32 bytes) * * `path` - BIP32 derivation path as a string * * # Returns * 64-byte Schnorr signature, or a `SignerError` */ public async signHashSchnorr( hash: ArrayBuffer, path: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalbreezsigner_sign_hash_schnorr( uniffiTypeExternalBreezSignerImplObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(hash), FfiConverterString.lower(path) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeSchnorrSignatureBytes.lift.bind( FfiConverterTypeSchnorrSignatureBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * HMAC-SHA256 of a message at the given derivation path. * * # Arguments * * `message` - The message to hash * * `path` - BIP32 derivation path as a string * * # Returns * 32-byte HMAC-SHA256, or a `SignerError` * * See also: [JavaScript `htlcHMAC`](https://docs.spark.money/wallets/spark-signer#generate-htlc-hmac) */ public async hmacSha256( message: ArrayBuffer, path: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalbreezsigner_hmac_sha256( uniffiTypeExternalBreezSignerImplObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(message), FfiConverterString.lower(path) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeHashedMessageBytes.lift.bind( FfiConverterTypeHashedMessageBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeExternalBreezSignerImplObjectFactory.pointer(this); uniffiTypeExternalBreezSignerImplObjectFactory.freePointer(pointer); uniffiTypeExternalBreezSignerImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is ExternalBreezSignerImpl { return uniffiTypeExternalBreezSignerImplObjectFactory.isConcreteType(obj); } } const uniffiTypeExternalBreezSignerImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): ExternalBreezSigner { const instance = Object.create(ExternalBreezSignerImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'ExternalBreezSignerImpl'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_externalbreezsigner_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: ExternalBreezSigner): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: ExternalBreezSigner): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_externalbreezsigner( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_externalbreezsigner( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is ExternalBreezSigner { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'ExternalBreezSignerImpl' ); }, }; })(); // FfiConverter for ExternalBreezSigner const FfiConverterTypeExternalBreezSigner = new FfiConverterObjectWithCallbacks( uniffiTypeExternalBreezSignerImplObjectFactory ); // Add a vtavble for the callbacks that go in ExternalBreezSigner. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceExternalBreezSigner: { vtable: UniffiVTableCallbackInterfaceExternalBreezSigner; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { derivePublicKey: ( uniffiHandle: bigint, path: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalBreezSigner.lift(uniffiHandle); return await jsCallback.derivePublicKey(FfiConverterString.lift(path), { signal, }); }; const uniffiHandleSuccess = (returnValue: PublicKeyBytes) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypePublicKeyBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, signEcdsa: ( uniffiHandle: bigint, message: Uint8Array, path: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalBreezSigner.lift(uniffiHandle); return await jsCallback.signEcdsa( FfiConverterTypeMessageBytes.lift(message), FfiConverterString.lift(path), { signal } ); }; const uniffiHandleSuccess = (returnValue: EcdsaSignatureBytes) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeEcdsaSignatureBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, signEcdsaRecoverable: ( uniffiHandle: bigint, message: Uint8Array, path: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalBreezSigner.lift(uniffiHandle); return await jsCallback.signEcdsaRecoverable( FfiConverterTypeMessageBytes.lift(message), FfiConverterString.lift(path), { signal } ); }; const uniffiHandleSuccess = ( returnValue: RecoverableEcdsaSignatureBytes ) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeRecoverableEcdsaSignatureBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, encryptEcies: ( uniffiHandle: bigint, message: Uint8Array, path: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalBreezSigner.lift(uniffiHandle); return await jsCallback.encryptEcies( FfiConverterArrayBuffer.lift(message), FfiConverterString.lift(path), { signal } ); }; const uniffiHandleSuccess = (returnValue: ArrayBuffer) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterArrayBuffer.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, decryptEcies: ( uniffiHandle: bigint, message: Uint8Array, path: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalBreezSigner.lift(uniffiHandle); return await jsCallback.decryptEcies( FfiConverterArrayBuffer.lift(message), FfiConverterString.lift(path), { signal } ); }; const uniffiHandleSuccess = (returnValue: ArrayBuffer) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterArrayBuffer.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, signHashSchnorr: ( uniffiHandle: bigint, hash: Uint8Array, path: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalBreezSigner.lift(uniffiHandle); return await jsCallback.signHashSchnorr( FfiConverterArrayBuffer.lift(hash), FfiConverterString.lift(path), { signal } ); }; const uniffiHandleSuccess = (returnValue: SchnorrSignatureBytes) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeSchnorrSignatureBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, hmacSha256: ( uniffiHandle: bigint, message: Uint8Array, path: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalBreezSigner.lift(uniffiHandle); return await jsCallback.hmacSha256( FfiConverterArrayBuffer.lift(message), FfiConverterString.lift(path), { signal } ); }; const uniffiHandleSuccess = (returnValue: HashedMessageBytes) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeHashedMessageBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, uniffiFree: (uniffiHandle: UniffiHandle): void => { // ExternalBreezSigner: this will throw a stale handle error if the handle isn't found. FfiConverterTypeExternalBreezSigner.drop(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_externalbreezsigner( uniffiCallbackInterfaceExternalBreezSigner.vtable ); }, }; /** * External signer that provides signing only, without the SDK's local * ECIES/HMAC operations. * * Implement this instead of [`ExternalBreezSigner`] for a signer that can't * release key material for local encryption (for example a policy-restricted * enclave). The capability is declared by the type: the SDK keeps session * tokens in plaintext and the features that rely on ECIES/HMAC are unavailable. */ export interface ExternalSigningSigner { /** * Derives a public key for the given BIP32 derivation path. * * # Arguments * * `path` - BIP32 derivation path as a string (e.g., "m/44'/0'/0'/0/0") * * # Returns * The derived public key as 33 bytes, or a `SignerError` * * See also: [JavaScript `getPublicKeyFromDerivation`](https://docs.spark.money/wallets/spark-signer#get-public-key-from-derivation) */ derivePublicKey( path: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Signs a message using ECDSA at the given derivation path. * * The message should be a 32-byte digest (typically a hash of the original data). * * # Arguments * * `message` - The 32-byte message digest to sign * * `path` - BIP32 derivation path as a string * * # Returns * 64-byte compact ECDSA signature, or a `SignerError` */ signEcdsa( message: MessageBytes, path: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Signs a message using recoverable ECDSA at the given derivation path. * * The message should be a 32-byte digest (typically a hash of the original data). * * # Arguments * * `message` - The 32-byte message digest to sign * * `path` - BIP32 derivation path as a string * * # Returns * 65 bytes: recovery ID (31 + `recovery_id`) + 64-byte signature, or a `SignerError` */ signEcdsaRecoverable( message: MessageBytes, path: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Signs a hash using Schnorr signature at the given derivation path. * * # Arguments * * `hash` - The 32-byte hash to sign (must be 32 bytes) * * `path` - BIP32 derivation path as a string * * # Returns * 64-byte Schnorr signature, or a `SignerError` */ signHashSchnorr( hash: ArrayBuffer, path: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * External signer that provides signing only, without the SDK's local * ECIES/HMAC operations. * * Implement this instead of [`ExternalBreezSigner`] for a signer that can't * release key material for local encryption (for example a policy-restricted * enclave). The capability is declared by the type: the SDK keeps session * tokens in plaintext and the features that rely on ECIES/HMAC are unavailable. */ export class ExternalSigningSignerImpl extends UniffiAbstractObject implements ExternalSigningSigner { readonly [uniffiTypeNameSymbol] = 'ExternalSigningSignerImpl'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeExternalSigningSignerImplObjectFactory.bless(pointer); } /** * Derives a public key for the given BIP32 derivation path. * * # Arguments * * `path` - BIP32 derivation path as a string (e.g., "m/44'/0'/0'/0/0") * * # Returns * The derived public key as 33 bytes, or a `SignerError` * * See also: [JavaScript `getPublicKeyFromDerivation`](https://docs.spark.money/wallets/spark-signer#get-public-key-from-derivation) */ public async derivePublicKey( path: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsigningsigner_derive_public_key( uniffiTypeExternalSigningSignerImplObjectFactory.clonePointer(this), FfiConverterString.lower(path) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePublicKeyBytes.lift.bind( FfiConverterTypePublicKeyBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Signs a message using ECDSA at the given derivation path. * * The message should be a 32-byte digest (typically a hash of the original data). * * # Arguments * * `message` - The 32-byte message digest to sign * * `path` - BIP32 derivation path as a string * * # Returns * 64-byte compact ECDSA signature, or a `SignerError` */ public async signEcdsa( message: MessageBytes, path: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsigningsigner_sign_ecdsa( uniffiTypeExternalSigningSignerImplObjectFactory.clonePointer(this), FfiConverterTypeMessageBytes.lower(message), FfiConverterString.lower(path) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeEcdsaSignatureBytes.lift.bind( FfiConverterTypeEcdsaSignatureBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Signs a message using recoverable ECDSA at the given derivation path. * * The message should be a 32-byte digest (typically a hash of the original data). * * # Arguments * * `message` - The 32-byte message digest to sign * * `path` - BIP32 derivation path as a string * * # Returns * 65 bytes: recovery ID (31 + `recovery_id`) + 64-byte signature, or a `SignerError` */ public async signEcdsaRecoverable( message: MessageBytes, path: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsigningsigner_sign_ecdsa_recoverable( uniffiTypeExternalSigningSignerImplObjectFactory.clonePointer(this), FfiConverterTypeMessageBytes.lower(message), FfiConverterString.lower(path) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeRecoverableEcdsaSignatureBytes.lift.bind( FfiConverterTypeRecoverableEcdsaSignatureBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Signs a hash using Schnorr signature at the given derivation path. * * # Arguments * * `hash` - The 32-byte hash to sign (must be 32 bytes) * * `path` - BIP32 derivation path as a string * * # Returns * 64-byte Schnorr signature, or a `SignerError` */ public async signHashSchnorr( hash: ArrayBuffer, path: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsigningsigner_sign_hash_schnorr( uniffiTypeExternalSigningSignerImplObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(hash), FfiConverterString.lower(path) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeSchnorrSignatureBytes.lift.bind( FfiConverterTypeSchnorrSignatureBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeExternalSigningSignerImplObjectFactory.pointer(this); uniffiTypeExternalSigningSignerImplObjectFactory.freePointer(pointer); uniffiTypeExternalSigningSignerImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is ExternalSigningSignerImpl { return uniffiTypeExternalSigningSignerImplObjectFactory.isConcreteType(obj); } } const uniffiTypeExternalSigningSignerImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): ExternalSigningSigner { const instance = Object.create(ExternalSigningSignerImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'ExternalSigningSignerImpl'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_externalsigningsigner_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: ExternalSigningSigner): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: ExternalSigningSigner): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_externalsigningsigner( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_externalsigningsigner( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is ExternalSigningSigner { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'ExternalSigningSignerImpl' ); }, }; })(); // FfiConverter for ExternalSigningSigner const FfiConverterTypeExternalSigningSigner = new FfiConverterObjectWithCallbacks( uniffiTypeExternalSigningSignerImplObjectFactory ); // Add a vtavble for the callbacks that go in ExternalSigningSigner. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceExternalSigningSigner: { vtable: UniffiVTableCallbackInterfaceExternalSigningSigner; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { derivePublicKey: ( uniffiHandle: bigint, path: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSigningSigner.lift(uniffiHandle); return await jsCallback.derivePublicKey(FfiConverterString.lift(path), { signal, }); }; const uniffiHandleSuccess = (returnValue: PublicKeyBytes) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypePublicKeyBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, signEcdsa: ( uniffiHandle: bigint, message: Uint8Array, path: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSigningSigner.lift(uniffiHandle); return await jsCallback.signEcdsa( FfiConverterTypeMessageBytes.lift(message), FfiConverterString.lift(path), { signal } ); }; const uniffiHandleSuccess = (returnValue: EcdsaSignatureBytes) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeEcdsaSignatureBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, signEcdsaRecoverable: ( uniffiHandle: bigint, message: Uint8Array, path: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSigningSigner.lift(uniffiHandle); return await jsCallback.signEcdsaRecoverable( FfiConverterTypeMessageBytes.lift(message), FfiConverterString.lift(path), { signal } ); }; const uniffiHandleSuccess = ( returnValue: RecoverableEcdsaSignatureBytes ) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeRecoverableEcdsaSignatureBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, signHashSchnorr: ( uniffiHandle: bigint, hash: Uint8Array, path: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSigningSigner.lift(uniffiHandle); return await jsCallback.signHashSchnorr( FfiConverterArrayBuffer.lift(hash), FfiConverterString.lift(path), { signal } ); }; const uniffiHandleSuccess = (returnValue: SchnorrSignatureBytes) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeSchnorrSignatureBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, uniffiFree: (uniffiHandle: UniffiHandle): void => { // ExternalSigningSigner: this will throw a stale handle error if the handle isn't found. FfiConverterTypeExternalSigningSigner.drop(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_externalsigningsigner( uniffiCallbackInterfaceExternalSigningSigner.vtable ); }, }; /** * FFI-compatible mirror of `spark_wallet::SparkSigner`. */ export interface ExternalSparkSigner { /** * The wallet identity public key (33 bytes compressed). */ getIdentityPublicKey(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; /** * The signing public key for a tree leaf. */ getPublicKeyForLeaf( leafId: ExternalTreeNodeId, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Whether this signer is backed by a remote service, so its operations are * network round-trips rather than local computation. Local signers return * false; a hosted signer like Turnkey returns true so the SDK can avoid * redundant calls, e.g. re-deriving keys for leaves it has already verified. */ isRemote(): boolean; /** * The static-deposit signing public key at `index`. */ getStaticDepositPublicKey( index: /*u32*/ number, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * ECDSA-sign a server authentication challenge with the identity key. */ signAuthenticationChallenge( challenge: ArrayBuffer, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * ECDSA-sign an arbitrary user message with the identity key. */ signMessage( message: ArrayBuffer, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Schnorr-sign `sighash` to spend a tree leaf's P2TR refund output as a * BIP341 key-path spend (empty script tree). */ signLeafRefundSpend( leafId: ExternalTreeNodeId, sighash: ArrayBuffer, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Produce FROST shares for a batch of jobs. */ signFrost( jobs: Array, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise>; /** * Prepare an outbound transfer (key-tweak + packages + payload signature). */ prepareTransfer( request: ExternalPrepareTransferRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Claim an inbound transfer (key-tweak step). */ prepareClaim( request: ExternalPrepareClaimRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Prepare a Lightning receive (in-enclave preimage + Feldman split). */ prepareLightningReceive( request: ExternalPrepareLightningReceiveRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Prepare a static deposit (export secret to SSP + FROST-sign tree txs). */ prepareStaticDeposit( request: ExternalPrepareStaticDepositRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Begin a static-deposit refund (user-commits-first). */ startStaticDepositRefund( request: ExternalStartStaticDepositRefundRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Finish a static-deposit refund (aggregate into the final signature). */ signStaticDepositRefund( request: ExternalSignStaticDepositRefundRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Schnorr-sign a Spark invoice (sats or tokens) with the identity key. */ signSparkInvoice( request: ExternalSignSparkInvoiceRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Schnorr-sign a token-transaction digest with the identity key. */ prepareTokenTransaction( request: ExternalPrepareTokenTransactionRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Prepare a static-deposit claim (export secret in the clear + sign). */ prepareStaticDepositClaim( request: ExternalPrepareStaticDepositClaimRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * FFI-compatible mirror of `spark_wallet::SparkSigner`. */ export class ExternalSparkSignerImpl extends UniffiAbstractObject implements ExternalSparkSigner { readonly [uniffiTypeNameSymbol] = 'ExternalSparkSignerImpl'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeExternalSparkSignerImplObjectFactory.bless(pointer); } /** * The wallet identity public key (33 bytes compressed). */ public async getIdentityPublicKey(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_get_identity_public_key( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePublicKeyBytes.lift.bind( FfiConverterTypePublicKeyBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * The signing public key for a tree leaf. */ public async getPublicKeyForLeaf( leafId: ExternalTreeNodeId, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_get_public_key_for_leaf( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterTypeExternalTreeNodeId.lower(leafId) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePublicKeyBytes.lift.bind( FfiConverterTypePublicKeyBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Whether this signer is backed by a remote service, so its operations are * network round-trips rather than local computation. Local signers return * false; a hosted signer like Turnkey returns true so the SDK can avoid * redundant calls, e.g. re-deriving keys for leaves it has already verified. */ public isRemote(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_is_remote( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift ) ); } /** * The static-deposit signing public key at `index`. */ public async getStaticDepositPublicKey( index: /*u32*/ number, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_get_static_deposit_public_key( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterUInt32.lower(index) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePublicKeyBytes.lift.bind( FfiConverterTypePublicKeyBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * ECDSA-sign a server authentication challenge with the identity key. */ public async signAuthenticationChallenge( challenge: ArrayBuffer, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_sign_authentication_challenge( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(challenge) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeEcdsaSignatureBytes.lift.bind( FfiConverterTypeEcdsaSignatureBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * ECDSA-sign an arbitrary user message with the identity key. */ public async signMessage( message: ArrayBuffer, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_sign_message( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(message) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeEcdsaSignatureBytes.lift.bind( FfiConverterTypeEcdsaSignatureBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Schnorr-sign `sighash` to spend a tree leaf's P2TR refund output as a * BIP341 key-path spend (empty script tree). */ public async signLeafRefundSpend( leafId: ExternalTreeNodeId, sighash: ArrayBuffer, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_sign_leaf_refund_spend( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterTypeExternalTreeNodeId.lower(leafId), FfiConverterArrayBuffer.lower(sighash) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeSchnorrSignatureBytes.lift.bind( FfiConverterTypeSchnorrSignatureBytes ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Produce FROST shares for a batch of jobs. */ public async signFrost( jobs: Array, asyncOpts_?: { signal: AbortSignal } ): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_sign_frost( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterArrayTypeExternalFrostJob.lower(jobs) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayTypeExternalFrostShareResult.lift.bind( FfiConverterArrayTypeExternalFrostShareResult ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Prepare an outbound transfer (key-tweak + packages + payload signature). */ public async prepareTransfer( request: ExternalPrepareTransferRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_prepare_transfer( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterTypeExternalPrepareTransferRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeExternalPreparedTransfer.lift.bind( FfiConverterTypeExternalPreparedTransfer ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Claim an inbound transfer (key-tweak step). */ public async prepareClaim( request: ExternalPrepareClaimRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_prepare_claim( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterTypeExternalPrepareClaimRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeExternalPreparedClaim.lift.bind( FfiConverterTypeExternalPreparedClaim ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Prepare a Lightning receive (in-enclave preimage + Feldman split). */ public async prepareLightningReceive( request: ExternalPrepareLightningReceiveRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_prepare_lightning_receive( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterTypeExternalPrepareLightningReceiveRequest.lower( request ) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeExternalPreparedLightningReceive.lift.bind( FfiConverterTypeExternalPreparedLightningReceive ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Prepare a static deposit (export secret to SSP + FROST-sign tree txs). */ public async prepareStaticDeposit( request: ExternalPrepareStaticDepositRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_prepare_static_deposit( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterTypeExternalPrepareStaticDepositRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeExternalPreparedStaticDeposit.lift.bind( FfiConverterTypeExternalPreparedStaticDeposit ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Begin a static-deposit refund (user-commits-first). */ public async startStaticDepositRefund( request: ExternalStartStaticDepositRefundRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_start_static_deposit_refund( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterTypeExternalStartStaticDepositRefundRequest.lower( request ) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeExternalStartedStaticDepositRefund.lift.bind( FfiConverterTypeExternalStartedStaticDepositRefund ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Finish a static-deposit refund (aggregate into the final signature). */ public async signStaticDepositRefund( request: ExternalSignStaticDepositRefundRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_sign_static_deposit_refund( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterTypeExternalSignStaticDepositRefundRequest.lower( request ) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeExternalFrostSignature.lift.bind( FfiConverterTypeExternalFrostSignature ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Schnorr-sign a Spark invoice (sats or tokens) with the identity key. */ public async signSparkInvoice( request: ExternalSignSparkInvoiceRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_sign_spark_invoice( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterTypeExternalSignSparkInvoiceRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeExternalSignedSparkInvoice.lift.bind( FfiConverterTypeExternalSignedSparkInvoice ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Schnorr-sign a token-transaction digest with the identity key. */ public async prepareTokenTransaction( request: ExternalPrepareTokenTransactionRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_prepare_token_transaction( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterTypeExternalPrepareTokenTransactionRequest.lower( request ) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeExternalPreparedTokenTransaction.lift.bind( FfiConverterTypeExternalPreparedTokenTransaction ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Prepare a static-deposit claim (export secret in the clear + sign). */ public async prepareStaticDepositClaim( request: ExternalPrepareStaticDepositClaimRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_externalsparksigner_prepare_static_deposit_claim( uniffiTypeExternalSparkSignerImplObjectFactory.clonePointer(this), FfiConverterTypeExternalPrepareStaticDepositClaimRequest.lower( request ) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeExternalPreparedStaticDepositClaim.lift.bind( FfiConverterTypeExternalPreparedStaticDepositClaim ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSignerError.lift.bind( FfiConverterTypeSignerError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeExternalSparkSignerImplObjectFactory.pointer(this); uniffiTypeExternalSparkSignerImplObjectFactory.freePointer(pointer); uniffiTypeExternalSparkSignerImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is ExternalSparkSignerImpl { return uniffiTypeExternalSparkSignerImplObjectFactory.isConcreteType(obj); } } const uniffiTypeExternalSparkSignerImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): ExternalSparkSigner { const instance = Object.create(ExternalSparkSignerImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'ExternalSparkSignerImpl'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_externalsparksigner_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: ExternalSparkSigner): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: ExternalSparkSigner): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_externalsparksigner( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_externalsparksigner( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is ExternalSparkSigner { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'ExternalSparkSignerImpl' ); }, }; })(); // FfiConverter for ExternalSparkSigner const FfiConverterTypeExternalSparkSigner = new FfiConverterObjectWithCallbacks( uniffiTypeExternalSparkSignerImplObjectFactory ); // Add a vtavble for the callbacks that go in ExternalSparkSigner. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceExternalSparkSigner: { vtable: UniffiVTableCallbackInterfaceExternalSparkSigner; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { getIdentityPublicKey: ( uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.getIdentityPublicKey({ signal }); }; const uniffiHandleSuccess = (returnValue: PublicKeyBytes) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypePublicKeyBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getPublicKeyForLeaf: ( uniffiHandle: bigint, leafId: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.getPublicKeyForLeaf( FfiConverterTypeExternalTreeNodeId.lift(leafId), { signal } ); }; const uniffiHandleSuccess = (returnValue: PublicKeyBytes) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypePublicKeyBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, isRemote: (uniffiHandle: bigint) => { const uniffiMakeCall = (): boolean => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return jsCallback.isRemote(); }; const uniffiResult = UniffiResult.ready(); const uniffiHandleSuccess = (obj: any) => { UniffiResult.writeSuccess(uniffiResult, FfiConverterBool.lower(obj)); }; const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { UniffiResult.writeError(uniffiResult, code, errBuf); }; uniffiTraitInterfaceCall( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*lowerString:*/ FfiConverterString.lower ); return uniffiResult; }, getStaticDepositPublicKey: ( uniffiHandle: bigint, index: number, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.getStaticDepositPublicKey( FfiConverterUInt32.lift(index), { signal } ); }; const uniffiHandleSuccess = (returnValue: PublicKeyBytes) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypePublicKeyBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, signAuthenticationChallenge: ( uniffiHandle: bigint, challenge: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.signAuthenticationChallenge( FfiConverterArrayBuffer.lift(challenge), { signal } ); }; const uniffiHandleSuccess = (returnValue: EcdsaSignatureBytes) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeEcdsaSignatureBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, signMessage: ( uniffiHandle: bigint, message: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.signMessage( FfiConverterArrayBuffer.lift(message), { signal } ); }; const uniffiHandleSuccess = (returnValue: EcdsaSignatureBytes) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeEcdsaSignatureBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, signLeafRefundSpend: ( uniffiHandle: bigint, leafId: Uint8Array, sighash: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.signLeafRefundSpend( FfiConverterTypeExternalTreeNodeId.lift(leafId), FfiConverterArrayBuffer.lift(sighash), { signal } ); }; const uniffiHandleSuccess = (returnValue: SchnorrSignatureBytes) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeSchnorrSignatureBytes.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, signFrost: ( uniffiHandle: bigint, jobs: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise> => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.signFrost( FfiConverterArrayTypeExternalFrostJob.lift(jobs), { signal } ); }; const uniffiHandleSuccess = ( returnValue: Array ) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterArrayTypeExternalFrostShareResult.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, prepareTransfer: ( uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.prepareTransfer( FfiConverterTypeExternalPrepareTransferRequest.lift(request), { signal } ); }; const uniffiHandleSuccess = (returnValue: ExternalPreparedTransfer) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeExternalPreparedTransfer.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, prepareClaim: ( uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.prepareClaim( FfiConverterTypeExternalPrepareClaimRequest.lift(request), { signal } ); }; const uniffiHandleSuccess = (returnValue: ExternalPreparedClaim) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeExternalPreparedClaim.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, prepareLightningReceive: ( uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.prepareLightningReceive( FfiConverterTypeExternalPrepareLightningReceiveRequest.lift(request), { signal } ); }; const uniffiHandleSuccess = ( returnValue: ExternalPreparedLightningReceive ) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeExternalPreparedLightningReceive.lower( returnValue ), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, prepareStaticDeposit: ( uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.prepareStaticDeposit( FfiConverterTypeExternalPrepareStaticDepositRequest.lift(request), { signal } ); }; const uniffiHandleSuccess = ( returnValue: ExternalPreparedStaticDeposit ) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeExternalPreparedStaticDeposit.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, startStaticDepositRefund: ( uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.startStaticDepositRefund( FfiConverterTypeExternalStartStaticDepositRefundRequest.lift(request), { signal } ); }; const uniffiHandleSuccess = ( returnValue: ExternalStartedStaticDepositRefund ) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeExternalStartedStaticDepositRefund.lower( returnValue ), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, signStaticDepositRefund: ( uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.signStaticDepositRefund( FfiConverterTypeExternalSignStaticDepositRefundRequest.lift(request), { signal } ); }; const uniffiHandleSuccess = (returnValue: ExternalFrostSignature) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeExternalFrostSignature.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, signSparkInvoice: ( uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.signSparkInvoice( FfiConverterTypeExternalSignSparkInvoiceRequest.lift(request), { signal } ); }; const uniffiHandleSuccess = (returnValue: ExternalSignedSparkInvoice) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeExternalSignedSparkInvoice.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, prepareTokenTransaction: ( uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.prepareTokenTransaction( FfiConverterTypeExternalPrepareTokenTransactionRequest.lift(request), { signal } ); }; const uniffiHandleSuccess = ( returnValue: ExternalPreparedTokenTransaction ) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeExternalPreparedTokenTransaction.lower( returnValue ), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, prepareStaticDepositClaim: ( uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeExternalSparkSigner.lift(uniffiHandle); return await jsCallback.prepareStaticDepositClaim( FfiConverterTypeExternalPrepareStaticDepositClaimRequest.lift( request ), { signal } ); }; const uniffiHandleSuccess = ( returnValue: ExternalPreparedStaticDepositClaim ) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeExternalPreparedStaticDepositClaim.lower( returnValue ), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SignerError.instanceOf, /*lowerError:*/ FfiConverterTypeSignerError.lower.bind( FfiConverterTypeSignerError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, uniffiFree: (uniffiHandle: UniffiHandle): void => { // ExternalSparkSigner: this will throw a stale handle error if the handle isn't found. FfiConverterTypeExternalSparkSigner.drop(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_externalsparksigner( uniffiCallbackInterfaceExternalSparkSigner.vtable ); }, }; /** * Trait covering fiat-related functionality */ export interface FiatService { /** * List all supported fiat currencies for which there is a known exchange rate. */ fetchFiatCurrencies(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise>; /** * Get the live rates from the server. */ fetchFiatRates(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise>; } /** * Trait covering fiat-related functionality */ export class FiatServiceImpl extends UniffiAbstractObject implements FiatService { readonly [uniffiTypeNameSymbol] = 'FiatServiceImpl'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeFiatServiceImplObjectFactory.bless(pointer); } /** * List all supported fiat currencies for which there is a known exchange rate. */ public async fetchFiatCurrencies(asyncOpts_?: { signal: AbortSignal; }): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_fiatservice_fetch_fiat_currencies( uniffiTypeFiatServiceImplObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayTypeFiatCurrency.lift.bind( FfiConverterArrayTypeFiatCurrency ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeServiceConnectivityError.lift.bind( FfiConverterTypeServiceConnectivityError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Get the live rates from the server. */ public async fetchFiatRates(asyncOpts_?: { signal: AbortSignal; }): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_fiatservice_fetch_fiat_rates( uniffiTypeFiatServiceImplObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayTypeRate.lift.bind( FfiConverterArrayTypeRate ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeServiceConnectivityError.lift.bind( FfiConverterTypeServiceConnectivityError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeFiatServiceImplObjectFactory.pointer(this); uniffiTypeFiatServiceImplObjectFactory.freePointer(pointer); uniffiTypeFiatServiceImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is FiatServiceImpl { return uniffiTypeFiatServiceImplObjectFactory.isConcreteType(obj); } } const uniffiTypeFiatServiceImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): FiatService { const instance = Object.create(FiatServiceImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'FiatServiceImpl'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_fiatservice_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: FiatService): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: FiatService): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_fiatservice( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_fiatservice( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is FiatService { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'FiatServiceImpl' ); }, }; })(); // FfiConverter for FiatService const FfiConverterTypeFiatService = new FfiConverterObjectWithCallbacks( uniffiTypeFiatServiceImplObjectFactory ); // Add a vtavble for the callbacks that go in FiatService. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceFiatService: { vtable: UniffiVTableCallbackInterfaceFiatService; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { fetchFiatCurrencies: ( uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise> => { const jsCallback = FfiConverterTypeFiatService.lift(uniffiHandle); return await jsCallback.fetchFiatCurrencies({ signal }); }; const uniffiHandleSuccess = (returnValue: Array) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterArrayTypeFiatCurrency.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ServiceConnectivityError.instanceOf, /*lowerError:*/ FfiConverterTypeServiceConnectivityError.lower.bind( FfiConverterTypeServiceConnectivityError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, fetchFiatRates: ( uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise> => { const jsCallback = FfiConverterTypeFiatService.lift(uniffiHandle); return await jsCallback.fetchFiatRates({ signal }); }; const uniffiHandleSuccess = (returnValue: Array) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterArrayTypeRate.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ServiceConnectivityError.instanceOf, /*lowerError:*/ FfiConverterTypeServiceConnectivityError.lower.bind( FfiConverterTypeServiceConnectivityError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, uniffiFree: (uniffiHandle: UniffiHandle): void => { // FiatService: this will throw a stale handle error if the handle isn't found. FfiConverterTypeFiatService.drop(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_fiatservice( uniffiCallbackInterfaceFiatService.vtable ); }, }; /** * High-level orchestration over a [`PrfProvider`] and the internal * Nostr-backed label store. Two named flows match the real onboarding * states: * * - [`Self::register`]: first-time setup (create credential + derive * wallet + publish label) in one ceremony where the platform * supports dual-salt PRF. * - [`Self::sign_in`]: returning user. Fast path when the host has * the label cached locally; cold-restore-with-discovery when not. * * Label management hangs off the [`Self::labels`] sub-object. * * The `breez_api_key` is the Breez relay key used for authenticated * (NIP-42) label storage. Hosts that already construct the SDK * [`crate::Config`] can use [`Self::from_config`] to forward it. */ export interface PasskeyClientInterface { /** * One-shot capability + configuration probe. Collapses * [`PrfProvider::is_supported`] and * [`PrfProvider::check_domain_association`] into a single value * hosts can branch on. */ checkAvailability(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; /** * Single-CTA onboarding: silent sign-in, falling through to * registration when no credential exists on the device. * * The silent sign-in pins `prefer_immediately_available_credentials = * true` regardless of [`SignInRequest`]: the fallback depends on the OS * fast-failing with [`PrfProviderError::CredentialNotFound`] when no * local credential exists. Only `CredentialNotFound` flips to the * register path; every other error (`Cancel`, `Timeout`, ...) propagates * unchanged. * * On WASM the silent sign-in maps to `WebAuthn` `uiMode: 'immediate'` * where the browser advertises it. Web hosts gate on the browser's * immediate-mediation capability (the WASM client surfaces it): * without it the probe shows the standard picker and a dismiss is a * cancel, not `CredentialNotFound`, so it never reaches register. * Present an explicit create / sign-in choice there instead. */ connectWithPasskey( request: ConnectWithPasskeyRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Label sub-object. List or publish labels for this passkey's * identity. */ labels(): PasskeyLabelsInterface; /** * First-time setup. Drives [`PrfProvider::create_passkey`], which * returns the seeds inline where the platform evaluates PRF during * the create ceremony; otherwise the wallet-derivation flow behind * [`Passkey::setup_wallet`] runs as a second ceremony. The label is * validated before anything is created, and published in the * background: it may still be in flight when this returns `Ok`. */ register( request: RegisterRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Returning-user sign-in. Fast path (`label` set) skips the * label-store query; discovery path (`label = None`) derives * the configured default label and lists the user's labels in * the same ceremony. Never re-publishes the label. */ signIn( request: SignInRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * High-level orchestration over a [`PrfProvider`] and the internal * Nostr-backed label store. Two named flows match the real onboarding * states: * * - [`Self::register`]: first-time setup (create credential + derive * wallet + publish label) in one ceremony where the platform * supports dual-salt PRF. * - [`Self::sign_in`]: returning user. Fast path when the host has * the label cached locally; cold-restore-with-discovery when not. * * Label management hangs off the [`Self::labels`] sub-object. * * The `breez_api_key` is the Breez relay key used for authenticated * (NIP-42) label storage. Hosts that already construct the SDK * [`crate::Config`] can use [`Self::from_config`] to forward it. */ export class PasskeyClient extends UniffiAbstractObject implements PasskeyClientInterface { readonly [uniffiTypeNameSymbol] = 'PasskeyClient'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; /** * Construct with the default Nostr-backed label store. * * Fails when `config` carries a proxy the relay transport cannot * honour, rather than letting a wallet be created whose label can * never be published. */ constructor( prfProvider: PrfProvider, breezApiKey: string | undefined, config: PasskeyConfig | undefined ) /*throws*/ { super(); const pointer = uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypePasskeyError.lift.bind( FfiConverterTypePasskeyError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_constructor_passkeyclient_new( FfiConverterTypePrfProvider.lower(prfProvider), FfiConverterOptionalString.lower(breezApiKey), FfiConverterOptionalTypePasskeyConfig.lower(config), callStatus ); }, /*liftString:*/ FfiConverterString.lift ); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypePasskeyClientObjectFactory.bless(pointer); } /** * One-shot capability + configuration probe. Collapses * [`PrfProvider::is_supported`] and * [`PrfProvider::check_domain_association`] into a single value * hosts can branch on. */ public async checkAvailability(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_passkeyclient_check_availability( uniffiTypePasskeyClientObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePasskeyAvailability.lift.bind( FfiConverterTypePasskeyAvailability ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypePasskeyError.lift.bind( FfiConverterTypePasskeyError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Single-CTA onboarding: silent sign-in, falling through to * registration when no credential exists on the device. * * The silent sign-in pins `prefer_immediately_available_credentials = * true` regardless of [`SignInRequest`]: the fallback depends on the OS * fast-failing with [`PrfProviderError::CredentialNotFound`] when no * local credential exists. Only `CredentialNotFound` flips to the * register path; every other error (`Cancel`, `Timeout`, ...) propagates * unchanged. * * On WASM the silent sign-in maps to `WebAuthn` `uiMode: 'immediate'` * where the browser advertises it. Web hosts gate on the browser's * immediate-mediation capability (the WASM client surfaces it): * without it the probe shows the standard picker and a dismiss is a * cancel, not `CredentialNotFound`, so it never reaches register. * Present an explicit create / sign-in choice there instead. */ public async connectWithPasskey( request: ConnectWithPasskeyRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_passkeyclient_connect_with_passkey( uniffiTypePasskeyClientObjectFactory.clonePointer(this), FfiConverterTypeConnectWithPasskeyRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeConnectWithPasskeyResponse.lift.bind( FfiConverterTypeConnectWithPasskeyResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypePasskeyError.lift.bind( FfiConverterTypePasskeyError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Label sub-object. List or publish labels for this passkey's * identity. */ public labels(): PasskeyLabelsInterface { return FfiConverterTypePasskeyLabels.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_passkeyclient_labels( uniffiTypePasskeyClientObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift ) ); } /** * First-time setup. Drives [`PrfProvider::create_passkey`], which * returns the seeds inline where the platform evaluates PRF during * the create ceremony; otherwise the wallet-derivation flow behind * [`Passkey::setup_wallet`] runs as a second ceremony. The label is * validated before anything is created, and published in the * background: it may still be in flight when this returns `Ok`. */ public async register( request: RegisterRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_passkeyclient_register( uniffiTypePasskeyClientObjectFactory.clonePointer(this), FfiConverterTypeRegisterRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeRegisterResponse.lift.bind( FfiConverterTypeRegisterResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypePasskeyError.lift.bind( FfiConverterTypePasskeyError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Returning-user sign-in. Fast path (`label` set) skips the * label-store query; discovery path (`label = None`) derives * the configured default label and lists the user's labels in * the same ceremony. Never re-publishes the label. */ public async signIn( request: SignInRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_passkeyclient_sign_in( uniffiTypePasskeyClientObjectFactory.clonePointer(this), FfiConverterTypeSignInRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeSignInResponse.lift.bind( FfiConverterTypeSignInResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypePasskeyError.lift.bind( FfiConverterTypePasskeyError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypePasskeyClientObjectFactory.pointer(this); uniffiTypePasskeyClientObjectFactory.freePointer(pointer); uniffiTypePasskeyClientObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is PasskeyClient { return uniffiTypePasskeyClientObjectFactory.isConcreteType(obj); } } const uniffiTypePasskeyClientObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): PasskeyClientInterface { const instance = Object.create(PasskeyClient.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'PasskeyClient'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_passkeyclient_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: PasskeyClientInterface): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: PasskeyClientInterface): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_passkeyclient( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_passkeyclient( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is PasskeyClientInterface { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'PasskeyClient' ); }, }; })(); // FfiConverter for PasskeyClientInterface const FfiConverterTypePasskeyClient = new FfiConverterObject( uniffiTypePasskeyClientObjectFactory ); /** * Label sub-object surfaced from [`PasskeyClient::labels`]. Holds a * clone of the parent [`Passkey`] so calls re-use its cached identity. */ export interface PasskeyLabelsInterface { /** * List labels published for this passkey's identity. */ list(asyncOpts_?: { signal: AbortSignal }): /*throws*/ Promise>; /** * Idempotently publish `label` for this passkey's identity. */ store( label: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * Label sub-object surfaced from [`PasskeyClient::labels`]. Holds a * clone of the parent [`Passkey`] so calls re-use its cached identity. */ export class PasskeyLabels extends UniffiAbstractObject implements PasskeyLabelsInterface { readonly [uniffiTypeNameSymbol] = 'PasskeyLabels'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypePasskeyLabelsObjectFactory.bless(pointer); } /** * List labels published for this passkey's identity. */ public async list(asyncOpts_?: { signal: AbortSignal; }): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_passkeylabels_list( uniffiTypePasskeyLabelsObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayString.lift.bind( FfiConverterArrayString ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypePasskeyError.lift.bind( FfiConverterTypePasskeyError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Idempotently publish `label` for this passkey's identity. */ public async store( label: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_passkeylabels_store( uniffiTypePasskeyLabelsObjectFactory.clonePointer(this), FfiConverterString.lower(label) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypePasskeyError.lift.bind( FfiConverterTypePasskeyError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypePasskeyLabelsObjectFactory.pointer(this); uniffiTypePasskeyLabelsObjectFactory.freePointer(pointer); uniffiTypePasskeyLabelsObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is PasskeyLabels { return uniffiTypePasskeyLabelsObjectFactory.isConcreteType(obj); } } const uniffiTypePasskeyLabelsObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): PasskeyLabelsInterface { const instance = Object.create(PasskeyLabels.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'PasskeyLabels'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_passkeylabels_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: PasskeyLabelsInterface): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: PasskeyLabelsInterface): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_passkeylabels( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_passkeylabels( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is PasskeyLabelsInterface { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'PasskeyLabels' ); }, }; })(); // FfiConverter for PasskeyLabelsInterface const FfiConverterTypePasskeyLabels = new FfiConverterObject( uniffiTypePasskeyLabelsObjectFactory ); /** * This interface is used to observe outgoing Lightning, Spark, onchain Bitcoin and token payments. * * `before_send` is called before a payment is made; if the implementation returns an error the * payment is cancelled. `after_send` is called after a token payment has been broadcast to report * its final payment id; it cannot cancel the payment and any error it returns is ignored. */ export interface PaymentObserver { /** * Called before Lightning, Spark, onchain Bitcoin or token payments are made */ beforeSend( payments: Array, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Called after a token payment has been broadcast, mapping each provisional payment id * reported by `before_send` to its final payment id */ afterSend( updates: Array, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * This interface is used to observe outgoing Lightning, Spark, onchain Bitcoin and token payments. * * `before_send` is called before a payment is made; if the implementation returns an error the * payment is cancelled. `after_send` is called after a token payment has been broadcast to report * its final payment id; it cannot cancel the payment and any error it returns is ignored. */ export class PaymentObserverImpl extends UniffiAbstractObject implements PaymentObserver { readonly [uniffiTypeNameSymbol] = 'PaymentObserverImpl'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypePaymentObserverImplObjectFactory.bless(pointer); } /** * Called before Lightning, Spark, onchain Bitcoin or token payments are made */ public async beforeSend( payments: Array, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_paymentobserver_before_send( uniffiTypePaymentObserverImplObjectFactory.clonePointer(this), FfiConverterArrayTypeProvisionalPayment.lower(payments) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypePaymentObserverError.lift.bind( FfiConverterTypePaymentObserverError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Called after a token payment has been broadcast, mapping each provisional payment id * reported by `before_send` to its final payment id */ public async afterSend( updates: Array, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_paymentobserver_after_send( uniffiTypePaymentObserverImplObjectFactory.clonePointer(this), FfiConverterArrayTypePaymentIdUpdate.lower(updates) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypePaymentObserverError.lift.bind( FfiConverterTypePaymentObserverError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypePaymentObserverImplObjectFactory.pointer(this); uniffiTypePaymentObserverImplObjectFactory.freePointer(pointer); uniffiTypePaymentObserverImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is PaymentObserverImpl { return uniffiTypePaymentObserverImplObjectFactory.isConcreteType(obj); } } const uniffiTypePaymentObserverImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): PaymentObserver { const instance = Object.create(PaymentObserverImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'PaymentObserverImpl'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_paymentobserver_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: PaymentObserver): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: PaymentObserver): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_paymentobserver( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_paymentobserver( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is PaymentObserver { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'PaymentObserverImpl' ); }, }; })(); // FfiConverter for PaymentObserver const FfiConverterTypePaymentObserver = new FfiConverterObjectWithCallbacks( uniffiTypePaymentObserverImplObjectFactory ); // Add a vtavble for the callbacks that go in PaymentObserver. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfacePaymentObserver: { vtable: UniffiVTableCallbackInterfacePaymentObserver; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { beforeSend: ( uniffiHandle: bigint, payments: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypePaymentObserver.lift(uniffiHandle); return await jsCallback.beforeSend( FfiConverterArrayTypeProvisionalPayment.lift(payments), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ PaymentObserverError.instanceOf, /*lowerError:*/ FfiConverterTypePaymentObserverError.lower.bind( FfiConverterTypePaymentObserverError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, afterSend: ( uniffiHandle: bigint, updates: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypePaymentObserver.lift(uniffiHandle); return await jsCallback.afterSend( FfiConverterArrayTypePaymentIdUpdate.lift(updates), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ PaymentObserverError.instanceOf, /*lowerError:*/ FfiConverterTypePaymentObserverError.lower.bind( FfiConverterTypePaymentObserverError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, uniffiFree: (uniffiHandle: UniffiHandle): void => { // PaymentObserver: this will throw a stale handle error if the handle isn't found. FfiConverterTypePaymentObserver.drop(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_paymentobserver( uniffiCallbackInterfacePaymentObserver.vtable ); }, }; /** * Trait for PRF (Pseudo-Random Function) operations backing a * passkey-derived wallet seed. * * Each platform's built-in `PasskeyProvider` implements this by * authenticating with a platform passkey and evaluating the `WebAuthn` * PRF extension. Custom providers (CLI tools backed by `YubiKey`, FIDO2 * hmac-secret, on-disk key material, HSMs) implement the same contract: * anything that deterministically derives 32 bytes from a salt qualifies. */ export interface PrfProvider { /** * Derive 32-byte PRF outputs for `request.salts` in as few * authenticator ceremonies as the platform supports, preserving input * order. Empty `salts` returns an empty vec without prompting. Built-in * providers pair salts via `WebAuthn`'s `prf.eval.first` + `.second` * (halving prompts); custom providers without bulk support loop. * * `request.allow_credentials` and * `request.prefer_immediately_available_credentials` shape this single * ceremony; providers that don't model them (file-backed, `YubiKey`) * ignore them. Returns the seeds plus the credential ID observed in the * same assertion, absent when the provider does not surface it. */ deriveSeeds( request: DeriveSeedsRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Whether this provider can produce PRF outputs on the current * device. Hosts gate UX on the result. */ isSupported(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; /** * Explicit registration: drive the OS create ceremony, and where the * platform supports it, evaluate PRF for `salts` in the same * ceremony. Platform passkey providers override this to surface the * credential metadata hosts need for `exclude_credentials` * bookkeeping. CLI / hardware providers register lazily in * [`Self::derive_seeds`] and inherit the default `PrfNotSupported`. * * `exclude_credentials` lists already-registered IDs and surfaces * duplicates as `CredentialAlreadyExists`. The `user.id` is always * provider-minted and returned on `PasskeyCredential.user_id`. * * Returning seeds removes the assertion that would otherwise follow * a create, and with it the window where the new credential exists * but the platform cannot yet resolve it. Return `seeds: None` for * anything short of one output per salt (some authenticators drop * `prf.eval.second`): a partial result is not usable, and the caller * falls back to [`Self::derive_seeds`]. Empty `salts` means the * caller wants the credential only. * * Seeds returned here must equal what [`Self::derive_seeds`] would * return for the same salts. The wallet is derived from them either * way, so a mismatch means register and sign-in land on different * wallets, and the one register created is unreachable. */ createPasskey( excludeCredentials: Array, salts: Array, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Advisory check against the platform's out-of-band verification * source (iOS AASA / Android assetlinks / browser rpId scope). * The SDK never gates internally; hosts pick their own policy. * * Built-in providers override: * - **iOS/macOS**: AASA `webcredentials.apps` lookup. May be stale. * - **Android**: Digital Asset Links query. Degrades `NotAssociated` * to `Skipped` because `CredentialManager` runs its own check. * - **Browser**: `rpId` is a registrable suffix of `window.location.hostname`. * * Custom providers without a verification source inherit the * `Skipped` default. */ checkDomainAssociation(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; } /** * Trait for PRF (Pseudo-Random Function) operations backing a * passkey-derived wallet seed. * * Each platform's built-in `PasskeyProvider` implements this by * authenticating with a platform passkey and evaluating the `WebAuthn` * PRF extension. Custom providers (CLI tools backed by `YubiKey`, FIDO2 * hmac-secret, on-disk key material, HSMs) implement the same contract: * anything that deterministically derives 32 bytes from a salt qualifies. */ export class PrfProviderImpl extends UniffiAbstractObject implements PrfProvider { readonly [uniffiTypeNameSymbol] = 'PrfProviderImpl'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypePrfProviderImplObjectFactory.bless(pointer); } /** * Derive 32-byte PRF outputs for `request.salts` in as few * authenticator ceremonies as the platform supports, preserving input * order. Empty `salts` returns an empty vec without prompting. Built-in * providers pair salts via `WebAuthn`'s `prf.eval.first` + `.second` * (halving prompts); custom providers without bulk support loop. * * `request.allow_credentials` and * `request.prefer_immediately_available_credentials` shape this single * ceremony; providers that don't model them (file-backed, `YubiKey`) * ignore them. Returns the seeds plus the credential ID observed in the * same assertion, absent when the provider does not surface it. */ public async deriveSeeds( request: DeriveSeedsRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_prfprovider_derive_seeds( uniffiTypePrfProviderImplObjectFactory.clonePointer(this), FfiConverterTypeDeriveSeedsRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeDeriveSeedsOutput.lift.bind( FfiConverterTypeDeriveSeedsOutput ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypePrfProviderError.lift.bind( FfiConverterTypePrfProviderError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Whether this provider can produce PRF outputs on the current * device. Hosts gate UX on the result. */ public async isSupported(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_prfprovider_is_supported( uniffiTypePrfProviderImplObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_i8, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_i8, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_i8, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_i8, /*liftFunc:*/ FfiConverterBool.lift.bind(FfiConverterBool), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypePrfProviderError.lift.bind( FfiConverterTypePrfProviderError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Explicit registration: drive the OS create ceremony, and where the * platform supports it, evaluate PRF for `salts` in the same * ceremony. Platform passkey providers override this to surface the * credential metadata hosts need for `exclude_credentials` * bookkeeping. CLI / hardware providers register lazily in * [`Self::derive_seeds`] and inherit the default `PrfNotSupported`. * * `exclude_credentials` lists already-registered IDs and surfaces * duplicates as `CredentialAlreadyExists`. The `user.id` is always * provider-minted and returned on `PasskeyCredential.user_id`. * * Returning seeds removes the assertion that would otherwise follow * a create, and with it the window where the new credential exists * but the platform cannot yet resolve it. Return `seeds: None` for * anything short of one output per salt (some authenticators drop * `prf.eval.second`): a partial result is not usable, and the caller * falls back to [`Self::derive_seeds`]. Empty `salts` means the * caller wants the credential only. * * Seeds returned here must equal what [`Self::derive_seeds`] would * return for the same salts. The wallet is derived from them either * way, so a mismatch means register and sign-in land on different * wallets, and the one register created is unreachable. */ public async createPasskey( excludeCredentials: Array, salts: Array, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_prfprovider_create_passkey( uniffiTypePrfProviderImplObjectFactory.clonePointer(this), FfiConverterArrayArrayBuffer.lower(excludeCredentials), FfiConverterArrayString.lower(salts) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeCreatePasskeyOutput.lift.bind( FfiConverterTypeCreatePasskeyOutput ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypePrfProviderError.lift.bind( FfiConverterTypePrfProviderError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Advisory check against the platform's out-of-band verification * source (iOS AASA / Android assetlinks / browser rpId scope). * The SDK never gates internally; hosts pick their own policy. * * Built-in providers override: * - **iOS/macOS**: AASA `webcredentials.apps` lookup. May be stale. * - **Android**: Digital Asset Links query. Degrades `NotAssociated` * to `Skipped` because `CredentialManager` runs its own check. * - **Browser**: `rpId` is a registrable suffix of `window.location.hostname`. * * Custom providers without a verification source inherit the * `Skipped` default. */ public async checkDomainAssociation(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_prfprovider_check_domain_association( uniffiTypePrfProviderImplObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeDomainAssociation.lift.bind( FfiConverterTypeDomainAssociation ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypePrfProviderError.lift.bind( FfiConverterTypePrfProviderError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypePrfProviderImplObjectFactory.pointer(this); uniffiTypePrfProviderImplObjectFactory.freePointer(pointer); uniffiTypePrfProviderImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is PrfProviderImpl { return uniffiTypePrfProviderImplObjectFactory.isConcreteType(obj); } } const uniffiTypePrfProviderImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): PrfProvider { const instance = Object.create(PrfProviderImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'PrfProviderImpl'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_prfprovider_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: PrfProvider): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: PrfProvider): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_prfprovider( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_prfprovider( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is PrfProvider { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'PrfProviderImpl' ); }, }; })(); // FfiConverter for PrfProvider const FfiConverterTypePrfProvider = new FfiConverterObjectWithCallbacks( uniffiTypePrfProviderImplObjectFactory ); // Add a vtavble for the callbacks that go in PrfProvider. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfacePrfProvider: { vtable: UniffiVTableCallbackInterfacePrfProvider; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { deriveSeeds: ( uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypePrfProvider.lift(uniffiHandle); return await jsCallback.deriveSeeds( FfiConverterTypeDeriveSeedsRequest.lift(request), { signal } ); }; const uniffiHandleSuccess = (returnValue: DeriveSeedsOutput) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeDeriveSeedsOutput.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ PrfProviderError.instanceOf, /*lowerError:*/ FfiConverterTypePrfProviderError.lower.bind( FfiConverterTypePrfProviderError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, isSupported: ( uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompleteI8, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypePrfProvider.lift(uniffiHandle); return await jsCallback.isSupported({ signal }); }; const uniffiHandleSuccess = (returnValue: boolean) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructI8 */ { returnValue: FfiConverterBool.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructI8 */ { returnValue: 0, // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ PrfProviderError.instanceOf, /*lowerError:*/ FfiConverterTypePrfProviderError.lower.bind( FfiConverterTypePrfProviderError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, createPasskey: ( uniffiHandle: bigint, excludeCredentials: Uint8Array, salts: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypePrfProvider.lift(uniffiHandle); return await jsCallback.createPasskey( FfiConverterArrayArrayBuffer.lift(excludeCredentials), FfiConverterArrayString.lift(salts), { signal } ); }; const uniffiHandleSuccess = (returnValue: CreatePasskeyOutput) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeCreatePasskeyOutput.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ PrfProviderError.instanceOf, /*lowerError:*/ FfiConverterTypePrfProviderError.lower.bind( FfiConverterTypePrfProviderError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, checkDomainAssociation: ( uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypePrfProvider.lift(uniffiHandle); return await jsCallback.checkDomainAssociation({ signal }); }; const uniffiHandleSuccess = (returnValue: DomainAssociation) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeDomainAssociation.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ PrfProviderError.instanceOf, /*lowerError:*/ FfiConverterTypePrfProviderError.lower.bind( FfiConverterTypePrfProviderError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, uniffiFree: (uniffiHandle: UniffiHandle): void => { // PrfProvider: this will throw a stale handle error if the handle isn't found. FfiConverterTypePrfProvider.drop(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_prfprovider( uniffiCallbackInterfacePrfProvider.vtable ); }, }; /** * The four per-tenant stores produced by a [`StorageBackend`]. * * An opaque handle: the SDK reads its stores internally; the fields never * cross the FFI boundary. */ export interface ResolvedStoresInterface {} /** * The four per-tenant stores produced by a [`StorageBackend`]. * * An opaque handle: the SDK reads its stores internally; the fields never * cross the FFI boundary. */ export class ResolvedStores extends UniffiAbstractObject implements ResolvedStoresInterface { readonly [uniffiTypeNameSymbol] = 'ResolvedStores'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeResolvedStoresObjectFactory.bless(pointer); } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeResolvedStoresObjectFactory.pointer(this); uniffiTypeResolvedStoresObjectFactory.freePointer(pointer); uniffiTypeResolvedStoresObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is ResolvedStores { return uniffiTypeResolvedStoresObjectFactory.isConcreteType(obj); } } const uniffiTypeResolvedStoresObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): ResolvedStoresInterface { const instance = Object.create(ResolvedStores.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'ResolvedStores'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_resolvedstores_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: ResolvedStoresInterface): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: ResolvedStoresInterface): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_resolvedstores( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_resolvedstores( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is ResolvedStoresInterface { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'ResolvedStores' ); }, }; })(); // FfiConverter for ResolvedStoresInterface const FfiConverterTypeResolvedStores = new FfiConverterObject( uniffiTypeResolvedStoresObjectFactory ); /** * REST client trait for making HTTP requests. * * This trait provides a way for users to supply their own HTTP client implementation * for use with the SDK. The SDK will use this client for all HTTP operations including * LNURL flows and chain service requests. */ export interface RestClient { /** * Makes a GET request and logs on DEBUG. * ### Arguments * - `url`: the URL on which GET will be called * - `headers`: optional headers that will be set on the request */ getRequest( url: string, headers: Map | undefined, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Makes a POST request, and logs on DEBUG. * ### Arguments * - `url`: the URL on which POST will be called * - `headers`: the optional POST headers * - `body`: the optional POST body */ postRequest( url: string, headers: Map | undefined, body: string | undefined, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Makes a DELETE request, and logs on DEBUG. * ### Arguments * - `url`: the URL on which DELETE will be called * - `headers`: the optional DELETE headers * - `body`: the optional DELETE body */ deleteRequest( url: string, headers: Map | undefined, body: string | undefined, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * REST client trait for making HTTP requests. * * This trait provides a way for users to supply their own HTTP client implementation * for use with the SDK. The SDK will use this client for all HTTP operations including * LNURL flows and chain service requests. */ export class RestClientImpl extends UniffiAbstractObject implements RestClient { readonly [uniffiTypeNameSymbol] = 'RestClientImpl'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeRestClientImplObjectFactory.bless(pointer); } /** * Makes a GET request and logs on DEBUG. * ### Arguments * - `url`: the URL on which GET will be called * - `headers`: optional headers that will be set on the request */ public async getRequest( url: string, headers: Map | undefined, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_restclient_get_request( uniffiTypeRestClientImplObjectFactory.clonePointer(this), FfiConverterString.lower(url), FfiConverterOptionalMapStringString.lower(headers) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeRestResponse.lift.bind( FfiConverterTypeRestResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeServiceConnectivityError.lift.bind( FfiConverterTypeServiceConnectivityError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Makes a POST request, and logs on DEBUG. * ### Arguments * - `url`: the URL on which POST will be called * - `headers`: the optional POST headers * - `body`: the optional POST body */ public async postRequest( url: string, headers: Map | undefined, body: string | undefined, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_restclient_post_request( uniffiTypeRestClientImplObjectFactory.clonePointer(this), FfiConverterString.lower(url), FfiConverterOptionalMapStringString.lower(headers), FfiConverterOptionalString.lower(body) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeRestResponse.lift.bind( FfiConverterTypeRestResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeServiceConnectivityError.lift.bind( FfiConverterTypeServiceConnectivityError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Makes a DELETE request, and logs on DEBUG. * ### Arguments * - `url`: the URL on which DELETE will be called * - `headers`: the optional DELETE headers * - `body`: the optional DELETE body */ public async deleteRequest( url: string, headers: Map | undefined, body: string | undefined, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_restclient_delete_request( uniffiTypeRestClientImplObjectFactory.clonePointer(this), FfiConverterString.lower(url), FfiConverterOptionalMapStringString.lower(headers), FfiConverterOptionalString.lower(body) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeRestResponse.lift.bind( FfiConverterTypeRestResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeServiceConnectivityError.lift.bind( FfiConverterTypeServiceConnectivityError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeRestClientImplObjectFactory.pointer(this); uniffiTypeRestClientImplObjectFactory.freePointer(pointer); uniffiTypeRestClientImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is RestClientImpl { return uniffiTypeRestClientImplObjectFactory.isConcreteType(obj); } } const uniffiTypeRestClientImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): RestClient { const instance = Object.create(RestClientImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'RestClientImpl'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_restclient_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: RestClient): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: RestClient): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_restclient( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_restclient( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is RestClient { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'RestClientImpl' ); }, }; })(); // FfiConverter for RestClient const FfiConverterTypeRestClient = new FfiConverterObjectWithCallbacks( uniffiTypeRestClientImplObjectFactory ); // Add a vtavble for the callbacks that go in RestClient. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceRestClient: { vtable: UniffiVTableCallbackInterfaceRestClient; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { getRequest: ( uniffiHandle: bigint, url: Uint8Array, headers: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeRestClient.lift(uniffiHandle); return await jsCallback.getRequest( FfiConverterString.lift(url), FfiConverterOptionalMapStringString.lift(headers), { signal } ); }; const uniffiHandleSuccess = (returnValue: RestResponse) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeRestResponse.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ServiceConnectivityError.instanceOf, /*lowerError:*/ FfiConverterTypeServiceConnectivityError.lower.bind( FfiConverterTypeServiceConnectivityError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, postRequest: ( uniffiHandle: bigint, url: Uint8Array, headers: Uint8Array, body: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeRestClient.lift(uniffiHandle); return await jsCallback.postRequest( FfiConverterString.lift(url), FfiConverterOptionalMapStringString.lift(headers), FfiConverterOptionalString.lift(body), { signal } ); }; const uniffiHandleSuccess = (returnValue: RestResponse) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeRestResponse.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ServiceConnectivityError.instanceOf, /*lowerError:*/ FfiConverterTypeServiceConnectivityError.lower.bind( FfiConverterTypeServiceConnectivityError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, deleteRequest: ( uniffiHandle: bigint, url: Uint8Array, headers: Uint8Array, body: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeRestClient.lift(uniffiHandle); return await jsCallback.deleteRequest( FfiConverterString.lift(url), FfiConverterOptionalMapStringString.lift(headers), FfiConverterOptionalString.lift(body), { signal } ); }; const uniffiHandleSuccess = (returnValue: RestResponse) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeRestResponse.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ServiceConnectivityError.instanceOf, /*lowerError:*/ FfiConverterTypeServiceConnectivityError.lower.bind( FfiConverterTypeServiceConnectivityError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, uniffiFree: (uniffiHandle: UniffiHandle): void => { // RestClient: this will throw a stale handle error if the handle isn't found. FfiConverterTypeRestClient.drop(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_restclient( uniffiCallbackInterfaceRestClient.vtable ); }, }; /** * Builder for creating `BreezSdk` instances with customizable components. */ export interface SdkBuilderInterface { /** * Builds the `BreezSdk` instance with the configured components. */ build(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; /** * Sets the account number for key derivation. All wallet keys derive from * the seed at `m/8797555'/'`, so each account number * yields an independent wallet from the same seed. Defaults to 0 on * Regtest and 1 on all other networks when unset. * Arguments: * - `account_number`: The account number in the derivation path. */ withAccountNumber( accountNumber: /*u32*/ number, asyncOpts_?: { signal: AbortSignal } ): Promise; /** * Sets the chain service to be used by the SDK. * Arguments: * - `chain_service`: The chain service to be used. */ withChainService( chainService: BitcoinChainService, asyncOpts_?: { signal: AbortSignal } ): Promise; /** * Sets the root storage directory to initialize the default storage with. * This initializes both storage and real-time sync storage with the * default implementations. * Arguments: * - `storage_dir`: The data directory for storage. */ withDefaultStorage( storageDir: string, asyncOpts_?: { signal: AbortSignal } ): Promise; /** * Sets the fiat service to be used by the SDK. * Arguments: * - `fiat_service`: The fiat service to be used. */ withFiatService( fiatService: FiatService, asyncOpts_?: { signal: AbortSignal } ): Promise; withLnurlClient( lnurlClient: RestClient, asyncOpts_?: { signal: AbortSignal } ): Promise; /** * Sets the payment observer to be used by the SDK. * Arguments: * - `payment_observer`: The payment observer to be used. */ withPaymentObserver( paymentObserver: PaymentObserver, asyncOpts_?: { signal: AbortSignal } ): Promise; /** * Sets the REST chain service to be used by the SDK. * Arguments: * - `url`: The base URL of the REST API. * - `api_type`: The API type to be used. * - `credentials`: Optional credentials for basic authentication. */ withRestChainService( url: string, apiType: ChainApiType, credentials: Credentials | undefined, asyncOpts_?: { signal: AbortSignal } ): Promise; /** * Overrides the session store used to cache auth tokens, replacing the one * the backend provides. Supply any [`SessionStore`]: for example one that * wraps the backend's own store (from * [`default_session_store`](crate::default_session_store)) to add at-rest * encryption, which the SDK does not apply itself. * Arguments: * - `session_store`: The session store to use in place of the backend's. */ withSessionStore( sessionStore: SessionStore, asyncOpts_?: { signal: AbortSignal } ): Promise; /** * Threads a shared [`SdkContext`](crate::SdkContext) into the builder. * * Construct the context once via * [`new_shared_sdk_context`](crate::new_shared_sdk_context) and pass the * same `Arc` to every `SdkBuilder` whose SDKs should share its resources * (operator gRPC channels, SSP HTTP client, database pool). */ withSharedContext( context: SdkContextInterface, asyncOpts_?: { signal: AbortSignal } ): Promise; /** * **Deprecated.** Use * [`with_storage_backend`](SdkBuilder::with_storage_backend) with * [`custom_storage`](crate::custom_storage). * Arguments: * - `storage`: The storage implementation to be used. */ withStorage( storage: Storage, asyncOpts_?: { signal: AbortSignal } ): Promise; /** * Sets the storage backend to be used by the SDK. * * Build the [`StorageBackend`](crate::StorageBackend) via * [`default_storage`](crate::default_storage), * [`postgres_storage`](crate::postgres_storage), * [`mysql_storage`](crate::mysql_storage) or * [`custom_storage`](crate::custom_storage). * Arguments: * - `storage`: The storage backend to be used. */ withStorageBackend( storage: StorageBackend, asyncOpts_?: { signal: AbortSignal } ): Promise; } /** * Builder for creating `BreezSdk` instances with customizable components. */ export class SdkBuilder extends UniffiAbstractObject implements SdkBuilderInterface { readonly [uniffiTypeNameSymbol] = 'SdkBuilder'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; /** * Creates a new `SdkBuilder` with the provided configuration. * Arguments: * - `config`: The configuration to be used. * - `seed`: The seed for wallet generation. */ constructor(config: Config, seed: Seed) { super(); const pointer = uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_constructor_sdkbuilder_new( FfiConverterTypeConfig.lower(config), FfiConverterTypeSeed.lower(seed), callStatus ); }, /*liftString:*/ FfiConverterString.lift ); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSdkBuilderObjectFactory.bless(pointer); } /** * Creates a new `SdkBuilder` with the provided configuration and external * signers (e.g. from `create_turnkey_signer`), so signer-based SDKs can be * composed with any storage backend or shared context, unlike * `connect_with_signer` which is fixed to the default storage. * Arguments: * - `config`: The configuration to be used. * - `breez_signer`: External signer for non-Spark SDK signing (LNURL-auth, * sync, message signing, ECIES). * - `spark_signer`: External high-level Spark signer for the Spark wallet. */ public static newWithSigner( config: Config, breezSigner: ExternalBreezSigner, sparkSigner: ExternalSparkSigner ): SdkBuilderInterface { return FfiConverterTypeSdkBuilder.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_constructor_sdkbuilder_new_with_signer( FfiConverterTypeConfig.lower(config), FfiConverterTypeExternalBreezSigner.lower(breezSigner), FfiConverterTypeExternalSparkSigner.lower(sparkSigner), callStatus ); }, /*liftString:*/ FfiConverterString.lift ) ); } /** * Creates a new `SdkBuilder` with a signing-only external signer. * * Use this for a signer that can't perform the SDK's local ECIES/HMAC * operations (for example a policy-restricted enclave). The SDK keeps * session tokens in plaintext and disables the features that rely on * ECIES/HMAC. * Arguments: * - `config`: The configuration to be used. * - `breez_signer`: Signing-only external signer for non-Spark SDK signing. * - `spark_signer`: External high-level Spark signer for the Spark wallet. */ public static newWithSigningOnlySigner( config: Config, breezSigner: ExternalSigningSigner, sparkSigner: ExternalSparkSigner ): SdkBuilderInterface { return FfiConverterTypeSdkBuilder.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_constructor_sdkbuilder_new_with_signing_only_signer( FfiConverterTypeConfig.lower(config), FfiConverterTypeExternalSigningSigner.lower(breezSigner), FfiConverterTypeExternalSparkSigner.lower(sparkSigner), callStatus ); }, /*liftString:*/ FfiConverterString.lift ) ); } /** * Builds the `BreezSdk` instance with the configured components. */ public async build(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_build( uniffiTypeSdkBuilderObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_pointer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_pointer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_pointer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_pointer, /*liftFunc:*/ FfiConverterTypeBreezSdk.lift.bind( FfiConverterTypeBreezSdk ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Sets the account number for key derivation. All wallet keys derive from * the seed at `m/8797555'/'`, so each account number * yields an independent wallet from the same seed. Defaults to 0 on * Regtest and 1 on all other networks when unset. * Arguments: * - `account_number`: The account number in the derivation path. */ public async withAccountNumber( accountNumber: /*u32*/ number, asyncOpts_?: { signal: AbortSignal } ): Promise { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_account_number( uniffiTypeSdkBuilderObjectFactory.clonePointer(this), FfiConverterUInt32.lower(accountNumber) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_ ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Sets the chain service to be used by the SDK. * Arguments: * - `chain_service`: The chain service to be used. */ public async withChainService( chainService: BitcoinChainService, asyncOpts_?: { signal: AbortSignal } ): Promise { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_chain_service( uniffiTypeSdkBuilderObjectFactory.clonePointer(this), FfiConverterTypeBitcoinChainService.lower(chainService) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_ ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Sets the root storage directory to initialize the default storage with. * This initializes both storage and real-time sync storage with the * default implementations. * Arguments: * - `storage_dir`: The data directory for storage. */ public async withDefaultStorage( storageDir: string, asyncOpts_?: { signal: AbortSignal } ): Promise { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_default_storage( uniffiTypeSdkBuilderObjectFactory.clonePointer(this), FfiConverterString.lower(storageDir) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_ ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Sets the fiat service to be used by the SDK. * Arguments: * - `fiat_service`: The fiat service to be used. */ public async withFiatService( fiatService: FiatService, asyncOpts_?: { signal: AbortSignal } ): Promise { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_fiat_service( uniffiTypeSdkBuilderObjectFactory.clonePointer(this), FfiConverterTypeFiatService.lower(fiatService) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_ ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async withLnurlClient( lnurlClient: RestClient, asyncOpts_?: { signal: AbortSignal } ): Promise { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_lnurl_client( uniffiTypeSdkBuilderObjectFactory.clonePointer(this), FfiConverterTypeRestClient.lower(lnurlClient) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_ ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Sets the payment observer to be used by the SDK. * Arguments: * - `payment_observer`: The payment observer to be used. */ public async withPaymentObserver( paymentObserver: PaymentObserver, asyncOpts_?: { signal: AbortSignal } ): Promise { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_payment_observer( uniffiTypeSdkBuilderObjectFactory.clonePointer(this), FfiConverterTypePaymentObserver.lower(paymentObserver) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_ ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Sets the REST chain service to be used by the SDK. * Arguments: * - `url`: The base URL of the REST API. * - `api_type`: The API type to be used. * - `credentials`: Optional credentials for basic authentication. */ public async withRestChainService( url: string, apiType: ChainApiType, credentials: Credentials | undefined, asyncOpts_?: { signal: AbortSignal } ): Promise { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_rest_chain_service( uniffiTypeSdkBuilderObjectFactory.clonePointer(this), FfiConverterString.lower(url), FfiConverterTypeChainApiType.lower(apiType), FfiConverterOptionalTypeCredentials.lower(credentials) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_ ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Overrides the session store used to cache auth tokens, replacing the one * the backend provides. Supply any [`SessionStore`]: for example one that * wraps the backend's own store (from * [`default_session_store`](crate::default_session_store)) to add at-rest * encryption, which the SDK does not apply itself. * Arguments: * - `session_store`: The session store to use in place of the backend's. */ public async withSessionStore( sessionStore: SessionStore, asyncOpts_?: { signal: AbortSignal } ): Promise { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_session_store( uniffiTypeSdkBuilderObjectFactory.clonePointer(this), FfiConverterTypeSessionStore.lower(sessionStore) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_ ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Threads a shared [`SdkContext`](crate::SdkContext) into the builder. * * Construct the context once via * [`new_shared_sdk_context`](crate::new_shared_sdk_context) and pass the * same `Arc` to every `SdkBuilder` whose SDKs should share its resources * (operator gRPC channels, SSP HTTP client, database pool). */ public async withSharedContext( context: SdkContextInterface, asyncOpts_?: { signal: AbortSignal } ): Promise { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_shared_context( uniffiTypeSdkBuilderObjectFactory.clonePointer(this), FfiConverterTypeSdkContext.lower(context) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_ ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * **Deprecated.** Use * [`with_storage_backend`](SdkBuilder::with_storage_backend) with * [`custom_storage`](crate::custom_storage). * Arguments: * - `storage`: The storage implementation to be used. */ public async withStorage( storage: Storage, asyncOpts_?: { signal: AbortSignal } ): Promise { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_storage( uniffiTypeSdkBuilderObjectFactory.clonePointer(this), FfiConverterTypeStorage.lower(storage) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_ ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Sets the storage backend to be used by the SDK. * * Build the [`StorageBackend`](crate::StorageBackend) via * [`default_storage`](crate::default_storage), * [`postgres_storage`](crate::postgres_storage), * [`mysql_storage`](crate::mysql_storage) or * [`custom_storage`](crate::custom_storage). * Arguments: * - `storage`: The storage backend to be used. */ public async withStorageBackend( storage: StorageBackend, asyncOpts_?: { signal: AbortSignal } ): Promise { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_storage_backend( uniffiTypeSdkBuilderObjectFactory.clonePointer(this), FfiConverterTypeStorageBackend.lower(storage) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_ ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSdkBuilderObjectFactory.pointer(this); uniffiTypeSdkBuilderObjectFactory.freePointer(pointer); uniffiTypeSdkBuilderObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is SdkBuilder { return uniffiTypeSdkBuilderObjectFactory.isConcreteType(obj); } } const uniffiTypeSdkBuilderObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): SdkBuilderInterface { const instance = Object.create(SdkBuilder.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'SdkBuilder'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_sdkbuilder_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: SdkBuilderInterface): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: SdkBuilderInterface): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_sdkbuilder( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_sdkbuilder( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is SdkBuilderInterface { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'SdkBuilder' ); }, }; })(); // FfiConverter for SdkBuilderInterface const FfiConverterTypeSdkBuilder = new FfiConverterObject( uniffiTypeSdkBuilderObjectFactory ); /** * Process-shared resources that can back many `BreezSdk` instances. * * Construct one with [`new_shared_sdk_context`] and pass the same `Arc` to every * [`SdkBuilder`](crate::SdkBuilder) whose SDKs should share those resources * (a single HTTP client across SSP / chain / LNURL / JWT / etc., a gRPC * channel pool to the Spark operators, the Breez backend gRPC client, …). * Useful for multi-tenant servers that load many wallets in one process. * * To share a database connection pool across SDKs, pass a * [`StorageBackend`](crate::StorageBackend) as * [`SdkContextConfig::storage`]: every SDK built from the context reuses it. * * The struct is intentionally opaque — all fields are crate-private. There * is no way to inject pre-built sub-components: the factory builds them * from settings so callers don't need to know about session stores or * connection-manager wiring. */ export interface SdkContextInterface {} /** * Process-shared resources that can back many `BreezSdk` instances. * * Construct one with [`new_shared_sdk_context`] and pass the same `Arc` to every * [`SdkBuilder`](crate::SdkBuilder) whose SDKs should share those resources * (a single HTTP client across SSP / chain / LNURL / JWT / etc., a gRPC * channel pool to the Spark operators, the Breez backend gRPC client, …). * Useful for multi-tenant servers that load many wallets in one process. * * To share a database connection pool across SDKs, pass a * [`StorageBackend`](crate::StorageBackend) as * [`SdkContextConfig::storage`]: every SDK built from the context reuses it. * * The struct is intentionally opaque — all fields are crate-private. There * is no way to inject pre-built sub-components: the factory builds them * from settings so callers don't need to know about session stores or * connection-manager wiring. */ export class SdkContext extends UniffiAbstractObject implements SdkContextInterface { readonly [uniffiTypeNameSymbol] = 'SdkContext'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSdkContextObjectFactory.bless(pointer); } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSdkContextObjectFactory.pointer(this); uniffiTypeSdkContextObjectFactory.freePointer(pointer); uniffiTypeSdkContextObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is SdkContext { return uniffiTypeSdkContextObjectFactory.isConcreteType(obj); } } const uniffiTypeSdkContextObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): SdkContextInterface { const instance = Object.create(SdkContext.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'SdkContext'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_sdkcontext_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: SdkContextInterface): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: SdkContextInterface): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_sdkcontext( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_sdkcontext( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is SdkContextInterface { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'SdkContext' ); }, }; })(); // FfiConverter for SdkContextInterface const FfiConverterTypeSdkContext = new FfiConverterObject( uniffiTypeSdkContextObjectFactory ); /** * Persistent storage for authentication sessions, keyed by the service's * identity public key. Implementations should be thread-safe and may be * backed by an in-memory map (default) or a shared database for cross-pod * auth sharing. */ export interface SessionStore { getSession( serviceIdentityKey: PublicKey, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; setSession( serviceIdentityKey: PublicKey, session: Session, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * Persistent storage for authentication sessions, keyed by the service's * identity public key. Implementations should be thread-safe and may be * backed by an in-memory map (default) or a shared database for cross-pod * auth sharing. */ export class SessionStoreImpl extends UniffiAbstractObject implements SessionStore { readonly [uniffiTypeNameSymbol] = 'SessionStoreImpl'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSessionStoreImplObjectFactory.bless(pointer); } public async getSession( serviceIdentityKey: PublicKey, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sessionstore_get_session( uniffiTypeSessionStoreImplObjectFactory.clonePointer(this), FfiConverterTypePublicKey.lower(serviceIdentityKey) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeSession.lift.bind( FfiConverterTypeSession ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSessionStoreError.lift.bind( FfiConverterTypeSessionStoreError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async setSession( serviceIdentityKey: PublicKey, session: Session, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sessionstore_set_session( uniffiTypeSessionStoreImplObjectFactory.clonePointer(this), FfiConverterTypePublicKey.lower(serviceIdentityKey), FfiConverterTypeSession.lower(session) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSessionStoreError.lift.bind( FfiConverterTypeSessionStoreError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSessionStoreImplObjectFactory.pointer(this); uniffiTypeSessionStoreImplObjectFactory.freePointer(pointer); uniffiTypeSessionStoreImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is SessionStoreImpl { return uniffiTypeSessionStoreImplObjectFactory.isConcreteType(obj); } } const uniffiTypeSessionStoreImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): SessionStore { const instance = Object.create(SessionStoreImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'SessionStoreImpl'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_sessionstore_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: SessionStore): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: SessionStore): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_sessionstore( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_sessionstore( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is SessionStore { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'SessionStoreImpl' ); }, }; })(); // FfiConverter for SessionStore const FfiConverterTypeSessionStore = new FfiConverterObjectWithCallbacks( uniffiTypeSessionStoreImplObjectFactory ); // Add a vtavble for the callbacks that go in SessionStore. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceSessionStore: { vtable: UniffiVTableCallbackInterfaceSessionStore; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { getSession: ( uniffiHandle: bigint, serviceIdentityKey: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeSessionStore.lift(uniffiHandle); return await jsCallback.getSession( FfiConverterTypePublicKey.lift(serviceIdentityKey), { signal } ); }; const uniffiHandleSuccess = (returnValue: Session) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeSession.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SessionStoreError.instanceOf, /*lowerError:*/ FfiConverterTypeSessionStoreError.lower.bind( FfiConverterTypeSessionStoreError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, setSession: ( uniffiHandle: bigint, serviceIdentityKey: Uint8Array, session: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeSessionStore.lift(uniffiHandle); return await jsCallback.setSession( FfiConverterTypePublicKey.lift(serviceIdentityKey), FfiConverterTypeSession.lift(session), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ SessionStoreError.instanceOf, /*lowerError:*/ FfiConverterTypeSessionStoreError.lower.bind( FfiConverterTypeSessionStoreError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, uniffiFree: (uniffiHandle: UniffiHandle): void => { // SessionStore: this will throw a stale handle error if the handle isn't found. FfiConverterTypeSessionStore.drop(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_sessionstore( uniffiCallbackInterfaceSessionStore.vtable ); }, }; /** * Trait for persistent storage */ export interface Storage { deleteCachedItem( key: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; getCachedItem( key: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; setCachedItem( key: string, value: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Lists payments with optional filters and pagination * * # Arguments * * * `list_payments_request` - The request to list payments * * # Returns * * A vector of payments or a `StorageError` */ listPayments( request: StorageListPaymentsRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise>; /** * Inserts or updates a payment unless it would replace a terminal status. * * Same-status updates are still persisted so details can be enriched. * * Returns `true` if the caller should emit a payment event (new payment was * inserted, or status transitioned). Returns `false` for redundant * same-status updates and for rejected updates against a terminal stored * status */ applyPaymentUpdate( payment: Payment, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Inserts payment metadata into storage * * # Arguments * * * `payment_id` - The ID of the payment * * `metadata` - The metadata to insert * * # Returns * * Success or a `StorageError` */ insertPaymentMetadata( paymentId: string, metadata: PaymentMetadata, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Gets a payment by its ID * # Arguments * * * `id` - The ID of the payment to retrieve * * # Returns * * The payment if found or None if not found */ getPaymentById( id: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Gets a payment by its invoice * # Arguments * * * `invoice` - The invoice of the payment to retrieve * # Returns * * The payment if found or None if not found */ getPaymentByInvoice( invoice: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Gets payments that have any of the specified parent payment IDs. * Used to load related payments for a set of parent payments. * * # Arguments * * * `parent_payment_ids` - The IDs of the parent payments * * # Returns * * A map of `parent_payment_id` -> Vec or a `StorageError` */ getPaymentsByParentIds( parentPaymentIds: Array, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise>>; /** * Add a deposit to storage (upsert: updates `is_mature` and `amount_sats` on conflict) * # Arguments * * * `txid` - The transaction ID of the deposit * * `vout` - The output index of the deposit * * `amount_sats` - The amount of the deposit in sats * * `is_mature` - Whether the deposit UTXO has enough confirmations to be claimable * * # Returns * * Success or a `StorageError` */ addDeposit( txid: string, vout: /*u32*/ number, amountSats: /*u64*/ bigint, isMature: boolean, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Removes an unclaimed deposit from storage * # Arguments * * * `txid` - The transaction ID of the deposit * * `vout` - The output index of the deposit * * # Returns * * Success or a `StorageError` */ deleteDeposit( txid: string, vout: /*u32*/ number, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Lists all unclaimed deposits from storage * # Returns * * A vector of `DepositInfo` or a `StorageError` */ listDeposits(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise>; /** * Updates or inserts unclaimed deposit details * # Arguments * * * `txid` - The transaction ID of the deposit * * `vout` - The output index of the deposit * * `payload` - The payload for the update * * # Returns * * Success or a `StorageError` */ updateDeposit( txid: string, vout: /*u32*/ number, payload: UpdateDepositPayload, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; setLnurlMetadata( metadata: Array, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Lists contacts from storage with optional pagination */ listContacts( request: ListContactsRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise>; /** * Gets a single contact by its ID */ getContact( id: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Inserts or updates a contact in storage (upsert by id). * Preserves `created_at` on update. */ insertContact( contact: Contact, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Deletes a contact by its ID */ deleteContact( id: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Inserts or overwrites a cross-chain swap row (upsert by `(provider, id)`). */ setCrossChainSwap( swap: StoredCrossChainSwap, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Gets a single cross-chain swap row by its `(provider, id)`, or `None` if absent. */ getCrossChainSwap( provider: string, id: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Lists all non-terminal cross-chain swap rows for a single provider * (`provider = ? AND is_terminal = false`). */ listActiveCrossChainSwaps( provider: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise>; addOutgoingChange( record: UnversionedRecordChange, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; completeOutgoingSync( record: Record, localRevision: /*u64*/ bigint, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; getPendingOutgoingChanges( limit: /*u32*/ number, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise>; /** * Get the last committed sync revision. * * The `sync_revision` table tracks the highest revision that has been committed * (i.e. acknowledged by the server or received from it). It does NOT include * pending outgoing queue ids. This value is used by the sync protocol to * request changes from the server. */ getLastRevision(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; /** * Insert incoming records from remote sync */ insertIncomingRecords( records: Array, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Delete an incoming record after it has been processed */ deleteIncomingRecord( record: Record, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Get incoming records that need to be processed, up to the specified limit */ getIncomingRecords( limit: /*u32*/ number, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise>; /** * Get the latest outgoing record if any exists */ getLatestOutgoingChange(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; /** * Update the sync state record from an incoming record */ updateRecordFromIncoming( record: Record, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * Trait for persistent storage */ export class StorageImpl extends UniffiAbstractObject implements Storage { readonly [uniffiTypeNameSymbol] = 'StorageImpl'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeStorageImplObjectFactory.bless(pointer); } public async deleteCachedItem( key: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_delete_cached_item( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterString.lower(key) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async getCachedItem( key: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_cached_item( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterString.lower(key) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterOptionalString.lift.bind( FfiConverterOptionalString ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async setCachedItem( key: string, value: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_set_cached_item( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterString.lower(key), FfiConverterString.lower(value) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Lists payments with optional filters and pagination * * # Arguments * * * `list_payments_request` - The request to list payments * * # Returns * * A vector of payments or a `StorageError` */ public async listPayments( request: StorageListPaymentsRequest, asyncOpts_?: { signal: AbortSignal } ): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_list_payments( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterTypeStorageListPaymentsRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayTypePayment.lift.bind( FfiConverterArrayTypePayment ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Inserts or updates a payment unless it would replace a terminal status. * * Same-status updates are still persisted so details can be enriched. * * Returns `true` if the caller should emit a payment event (new payment was * inserted, or status transitioned). Returns `false` for redundant * same-status updates and for rejected updates against a terminal stored * status */ public async applyPaymentUpdate( payment: Payment, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_apply_payment_update( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterTypePayment.lower(payment) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_i8, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_i8, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_i8, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_i8, /*liftFunc:*/ FfiConverterBool.lift.bind(FfiConverterBool), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Inserts payment metadata into storage * * # Arguments * * * `payment_id` - The ID of the payment * * `metadata` - The metadata to insert * * # Returns * * Success or a `StorageError` */ public async insertPaymentMetadata( paymentId: string, metadata: PaymentMetadata, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_insert_payment_metadata( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterString.lower(paymentId), FfiConverterTypePaymentMetadata.lower(metadata) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Gets a payment by its ID * # Arguments * * * `id` - The ID of the payment to retrieve * * # Returns * * The payment if found or None if not found */ public async getPaymentById( id: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_payment_by_id( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterString.lower(id) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePayment.lift.bind( FfiConverterTypePayment ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Gets a payment by its invoice * # Arguments * * * `invoice` - The invoice of the payment to retrieve * # Returns * * The payment if found or None if not found */ public async getPaymentByInvoice( invoice: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_payment_by_invoice( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterString.lower(invoice) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterOptionalTypePayment.lift.bind( FfiConverterOptionalTypePayment ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Gets payments that have any of the specified parent payment IDs. * Used to load related payments for a set of parent payments. * * # Arguments * * * `parent_payment_ids` - The IDs of the parent payments * * # Returns * * A map of `parent_payment_id` -> Vec or a `StorageError` */ public async getPaymentsByParentIds( parentPaymentIds: Array, asyncOpts_?: { signal: AbortSignal } ): Promise>> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_payments_by_parent_ids( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterArrayString.lower(parentPaymentIds) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterMapStringArrayTypePayment.lift.bind( FfiConverterMapStringArrayTypePayment ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Add a deposit to storage (upsert: updates `is_mature` and `amount_sats` on conflict) * # Arguments * * * `txid` - The transaction ID of the deposit * * `vout` - The output index of the deposit * * `amount_sats` - The amount of the deposit in sats * * `is_mature` - Whether the deposit UTXO has enough confirmations to be claimable * * # Returns * * Success or a `StorageError` */ public async addDeposit( txid: string, vout: /*u32*/ number, amountSats: /*u64*/ bigint, isMature: boolean, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_add_deposit( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterString.lower(txid), FfiConverterUInt32.lower(vout), FfiConverterUInt64.lower(amountSats), FfiConverterBool.lower(isMature) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Removes an unclaimed deposit from storage * # Arguments * * * `txid` - The transaction ID of the deposit * * `vout` - The output index of the deposit * * # Returns * * Success or a `StorageError` */ public async deleteDeposit( txid: string, vout: /*u32*/ number, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_delete_deposit( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterString.lower(txid), FfiConverterUInt32.lower(vout) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Lists all unclaimed deposits from storage * # Returns * * A vector of `DepositInfo` or a `StorageError` */ public async listDeposits(asyncOpts_?: { signal: AbortSignal; }): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_list_deposits( uniffiTypeStorageImplObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayTypeDepositInfo.lift.bind( FfiConverterArrayTypeDepositInfo ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Updates or inserts unclaimed deposit details * # Arguments * * * `txid` - The transaction ID of the deposit * * `vout` - The output index of the deposit * * `payload` - The payload for the update * * # Returns * * Success or a `StorageError` */ public async updateDeposit( txid: string, vout: /*u32*/ number, payload: UpdateDepositPayload, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_update_deposit( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterString.lower(txid), FfiConverterUInt32.lower(vout), FfiConverterTypeUpdateDepositPayload.lower(payload) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async setLnurlMetadata( metadata: Array, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_set_lnurl_metadata( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterArrayTypeSetLnurlMetadataItem.lower(metadata) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Lists contacts from storage with optional pagination */ public async listContacts( request: ListContactsRequest, asyncOpts_?: { signal: AbortSignal } ): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_list_contacts( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterTypeListContactsRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayTypeContact.lift.bind( FfiConverterArrayTypeContact ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Gets a single contact by its ID */ public async getContact( id: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_contact( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterString.lower(id) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeContact.lift.bind( FfiConverterTypeContact ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Inserts or updates a contact in storage (upsert by id). * Preserves `created_at` on update. */ public async insertContact( contact: Contact, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_insert_contact( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterTypeContact.lower(contact) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Deletes a contact by its ID */ public async deleteContact( id: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_delete_contact( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterString.lower(id) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Inserts or overwrites a cross-chain swap row (upsert by `(provider, id)`). */ public async setCrossChainSwap( swap: StoredCrossChainSwap, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_set_cross_chain_swap( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterTypeStoredCrossChainSwap.lower(swap) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Gets a single cross-chain swap row by its `(provider, id)`, or `None` if absent. */ public async getCrossChainSwap( provider: string, id: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_cross_chain_swap( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterString.lower(provider), FfiConverterString.lower(id) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterOptionalTypeStoredCrossChainSwap.lift.bind( FfiConverterOptionalTypeStoredCrossChainSwap ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Lists all non-terminal cross-chain swap rows for a single provider * (`provider = ? AND is_terminal = false`). */ public async listActiveCrossChainSwaps( provider: string, asyncOpts_?: { signal: AbortSignal } ): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_list_active_cross_chain_swaps( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterString.lower(provider) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayTypeStoredCrossChainSwap.lift.bind( FfiConverterArrayTypeStoredCrossChainSwap ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async addOutgoingChange( record: UnversionedRecordChange, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_add_outgoing_change( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterTypeUnversionedRecordChange.lower(record) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_u64, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_u64, /*liftFunc:*/ FfiConverterUInt64.lift.bind(FfiConverterUInt64), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async completeOutgoingSync( record: Record, localRevision: /*u64*/ bigint, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_complete_outgoing_sync( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterTypeRecord.lower(record), FfiConverterUInt64.lower(localRevision) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } public async getPendingOutgoingChanges( limit: /*u32*/ number, asyncOpts_?: { signal: AbortSignal } ): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_pending_outgoing_changes( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterUInt32.lower(limit) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayTypeOutgoingChange.lift.bind( FfiConverterArrayTypeOutgoingChange ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Get the last committed sync revision. * * The `sync_revision` table tracks the highest revision that has been committed * (i.e. acknowledged by the server or received from it). It does NOT include * pending outgoing queue ids. This value is used by the sync protocol to * request changes from the server. */ public async getLastRevision(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_last_revision( uniffiTypeStorageImplObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_u64, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_u64, /*liftFunc:*/ FfiConverterUInt64.lift.bind(FfiConverterUInt64), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Insert incoming records from remote sync */ public async insertIncomingRecords( records: Array, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_insert_incoming_records( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterArrayTypeRecord.lower(records) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Delete an incoming record after it has been processed */ public async deleteIncomingRecord( record: Record, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_delete_incoming_record( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterTypeRecord.lower(record) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Get incoming records that need to be processed, up to the specified limit */ public async getIncomingRecords( limit: /*u32*/ number, asyncOpts_?: { signal: AbortSignal } ): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_incoming_records( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterUInt32.lower(limit) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterArrayTypeIncomingChange.lift.bind( FfiConverterArrayTypeIncomingChange ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Get the latest outgoing record if any exists */ public async getLatestOutgoingChange(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_get_latest_outgoing_change( uniffiTypeStorageImplObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterOptionalTypeOutgoingChange.lift.bind( FfiConverterOptionalTypeOutgoingChange ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Update the sync state record from an incoming record */ public async updateRecordFromIncoming( record: Record, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storage_update_record_from_incoming( uniffiTypeStorageImplObjectFactory.clonePointer(this), FfiConverterTypeRecord.lower(record) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_void, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeStorageError.lift.bind( FfiConverterTypeStorageError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeStorageImplObjectFactory.pointer(this); uniffiTypeStorageImplObjectFactory.freePointer(pointer); uniffiTypeStorageImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is StorageImpl { return uniffiTypeStorageImplObjectFactory.isConcreteType(obj); } } const uniffiTypeStorageImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): Storage { const instance = Object.create(StorageImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'StorageImpl'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_storage_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: Storage): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: Storage): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_storage( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_storage( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is Storage { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'StorageImpl' ); }, }; })(); // FfiConverter for Storage const FfiConverterTypeStorage = new FfiConverterObjectWithCallbacks( uniffiTypeStorageImplObjectFactory ); // Add a vtavble for the callbacks that go in Storage. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceStorage: { vtable: UniffiVTableCallbackInterfaceStorage; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { deleteCachedItem: ( uniffiHandle: bigint, key: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.deleteCachedItem(FfiConverterString.lift(key), { signal, }); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getCachedItem: ( uniffiHandle: bigint, key: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.getCachedItem(FfiConverterString.lift(key), { signal, }); }; const uniffiHandleSuccess = (returnValue: string | undefined) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterOptionalString.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, setCachedItem: ( uniffiHandle: bigint, key: Uint8Array, value: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.setCachedItem( FfiConverterString.lift(key), FfiConverterString.lift(value), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, listPayments: ( uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise> => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.listPayments( FfiConverterTypeStorageListPaymentsRequest.lift(request), { signal } ); }; const uniffiHandleSuccess = (returnValue: Array) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterArrayTypePayment.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, applyPaymentUpdate: ( uniffiHandle: bigint, payment: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteI8, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.applyPaymentUpdate( FfiConverterTypePayment.lift(payment), { signal } ); }; const uniffiHandleSuccess = (returnValue: boolean) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructI8 */ { returnValue: FfiConverterBool.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructI8 */ { returnValue: 0, // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, insertPaymentMetadata: ( uniffiHandle: bigint, paymentId: Uint8Array, metadata: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.insertPaymentMetadata( FfiConverterString.lift(paymentId), FfiConverterTypePaymentMetadata.lift(metadata), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getPaymentById: ( uniffiHandle: bigint, id: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.getPaymentById(FfiConverterString.lift(id), { signal, }); }; const uniffiHandleSuccess = (returnValue: Payment) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypePayment.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getPaymentByInvoice: ( uniffiHandle: bigint, invoice: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.getPaymentByInvoice( FfiConverterString.lift(invoice), { signal } ); }; const uniffiHandleSuccess = (returnValue: Payment | undefined) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterOptionalTypePayment.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getPaymentsByParentIds: ( uniffiHandle: bigint, parentPaymentIds: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise>> => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.getPaymentsByParentIds( FfiConverterArrayString.lift(parentPaymentIds), { signal } ); }; const uniffiHandleSuccess = ( returnValue: Map> ) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterMapStringArrayTypePayment.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, addDeposit: ( uniffiHandle: bigint, txid: Uint8Array, vout: number, amountSats: bigint, isMature: number, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.addDeposit( FfiConverterString.lift(txid), FfiConverterUInt32.lift(vout), FfiConverterUInt64.lift(amountSats), FfiConverterBool.lift(isMature), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, deleteDeposit: ( uniffiHandle: bigint, txid: Uint8Array, vout: number, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.deleteDeposit( FfiConverterString.lift(txid), FfiConverterUInt32.lift(vout), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, listDeposits: ( uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise> => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.listDeposits({ signal }); }; const uniffiHandleSuccess = (returnValue: Array) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterArrayTypeDepositInfo.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, updateDeposit: ( uniffiHandle: bigint, txid: Uint8Array, vout: number, payload: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.updateDeposit( FfiConverterString.lift(txid), FfiConverterUInt32.lift(vout), FfiConverterTypeUpdateDepositPayload.lift(payload), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, setLnurlMetadata: ( uniffiHandle: bigint, metadata: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.setLnurlMetadata( FfiConverterArrayTypeSetLnurlMetadataItem.lift(metadata), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, listContacts: ( uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise> => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.listContacts( FfiConverterTypeListContactsRequest.lift(request), { signal } ); }; const uniffiHandleSuccess = (returnValue: Array) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterArrayTypeContact.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getContact: ( uniffiHandle: bigint, id: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.getContact(FfiConverterString.lift(id), { signal, }); }; const uniffiHandleSuccess = (returnValue: Contact) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterTypeContact.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, insertContact: ( uniffiHandle: bigint, contact: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.insertContact( FfiConverterTypeContact.lift(contact), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, deleteContact: ( uniffiHandle: bigint, id: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.deleteContact(FfiConverterString.lift(id), { signal, }); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, setCrossChainSwap: ( uniffiHandle: bigint, swap: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.setCrossChainSwap( FfiConverterTypeStoredCrossChainSwap.lift(swap), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getCrossChainSwap: ( uniffiHandle: bigint, provider: Uint8Array, id: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.getCrossChainSwap( FfiConverterString.lift(provider), FfiConverterString.lift(id), { signal } ); }; const uniffiHandleSuccess = ( returnValue: StoredCrossChainSwap | undefined ) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterOptionalTypeStoredCrossChainSwap.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, listActiveCrossChainSwaps: ( uniffiHandle: bigint, provider: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise> => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.listActiveCrossChainSwaps( FfiConverterString.lift(provider), { signal } ); }; const uniffiHandleSuccess = ( returnValue: Array ) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterArrayTypeStoredCrossChainSwap.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, addOutgoingChange: ( uniffiHandle: bigint, record: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteU64, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.addOutgoingChange( FfiConverterTypeUnversionedRecordChange.lift(record), { signal } ); }; const uniffiHandleSuccess = (returnValue: /*u64*/ bigint) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructU64 */ { returnValue: FfiConverterUInt64.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructU64 */ { returnValue: 0n, // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, completeOutgoingSync: ( uniffiHandle: bigint, record: Uint8Array, localRevision: bigint, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.completeOutgoingSync( FfiConverterTypeRecord.lift(record), FfiConverterUInt64.lift(localRevision), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getPendingOutgoingChanges: ( uniffiHandle: bigint, limit: number, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise> => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.getPendingOutgoingChanges( FfiConverterUInt32.lift(limit), { signal } ); }; const uniffiHandleSuccess = (returnValue: Array) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterArrayTypeOutgoingChange.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getLastRevision: ( uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompleteU64, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.getLastRevision({ signal }); }; const uniffiHandleSuccess = (returnValue: /*u64*/ bigint) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructU64 */ { returnValue: FfiConverterUInt64.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructU64 */ { returnValue: 0n, // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, insertIncomingRecords: ( uniffiHandle: bigint, records: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.insertIncomingRecords( FfiConverterArrayTypeRecord.lift(records), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, deleteIncomingRecord: ( uniffiHandle: bigint, record: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.deleteIncomingRecord( FfiConverterTypeRecord.lift(record), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getIncomingRecords: ( uniffiHandle: bigint, limit: number, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise> => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.getIncomingRecords( FfiConverterUInt32.lift(limit), { signal } ); }; const uniffiHandleSuccess = (returnValue: Array) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterArrayTypeIncomingChange.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, getLatestOutgoingChange: ( uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompleteRustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.getLatestOutgoingChange({ signal }); }; const uniffiHandleSuccess = (returnValue: OutgoingChange | undefined) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: FfiConverterOptionalTypeOutgoingChange.lower(returnValue), callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructRustBuffer */ { returnValue: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, updateRecordFromIncoming: ( uniffiHandle: bigint, record: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleteVoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeStorage.lift(uniffiHandle); return await jsCallback.updateRecordFromIncoming( FfiConverterTypeRecord.lift(record), { signal } ); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { callStatus: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureStructVoid */ { // TODO create callstatus with error. callStatus: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ StorageError.instanceOf, /*lowerError:*/ FfiConverterTypeStorageError.lower.bind( FfiConverterTypeStorageError ), /*lowerString:*/ FfiConverterString.lower ); return uniffiForeignFuture; }, uniffiFree: (uniffiHandle: UniffiHandle): void => { // Storage: this will throw a stale handle error if the handle isn't found. FfiConverterTypeStorage.drop(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_breez_sdk_spark_fn_init_callback_vtable_storage( uniffiCallbackInterfaceStorage.vtable ); }, }; /** * A factory for a tenant's storage. * * A single backend may back many SDK instances; each * [`create_stores`](Self::create_stores) call yields the store set scoped to * one tenant `identity` (a serialized public key). `network` lets file-based * backends segregate tenants by network; database backends ignore it. */ export interface StorageBackend { createStores( network: Network, identity: ArrayBuffer, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * A factory for a tenant's storage. * * A single backend may back many SDK instances; each * [`create_stores`](Self::create_stores) call yields the store set scoped to * one tenant `identity` (a serialized public key). `network` lets file-based * backends segregate tenants by network; database backends ignore it. */ export class StorageBackendImpl extends UniffiAbstractObject implements StorageBackend { readonly [uniffiTypeNameSymbol] = 'StorageBackendImpl'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeStorageBackendImplObjectFactory.bless(pointer); } public async createStores( network: Network, identity: ArrayBuffer, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_storagebackend_create_stores( uniffiTypeStorageBackendImplObjectFactory.clonePointer(this), FfiConverterTypeNetwork.lower(network), FfiConverterArrayBuffer.lower(identity) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_pointer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_pointer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_pointer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_pointer, /*liftFunc:*/ FfiConverterTypeResolvedStores.lift.bind( FfiConverterTypeResolvedStores ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeStorageBackendImplObjectFactory.pointer(this); uniffiTypeStorageBackendImplObjectFactory.freePointer(pointer); uniffiTypeStorageBackendImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is StorageBackendImpl { return uniffiTypeStorageBackendImplObjectFactory.isConcreteType(obj); } } const uniffiTypeStorageBackendImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): StorageBackend { const instance = Object.create(StorageBackendImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'StorageBackendImpl'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_storagebackend_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: StorageBackend): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: StorageBackend): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_storagebackend( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_storagebackend( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is StorageBackend { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'StorageBackendImpl' ); }, }; })(); // FfiConverter for StorageBackend const FfiConverterTypeStorageBackend = new FfiConverterObject( uniffiTypeStorageBackendImplObjectFactory ); export interface TokenIssuerInterface { /** * Burns supply of the issuer token * * # Arguments * * * `request`: The request containing the amount of the supply to burn * * # Returns * * Result containing either: * * `Payment` - The payment representing the burn transaction * * `SdkError` - If there was an error during the burn process */ burnIssuerToken( request: BurnIssuerTokenRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Creates a new issuer token * * # Arguments * * * `request`: The request containing the token parameters * * # Returns * * Result containing either: * * `TokenMetadata` - The metadata of the created token * * `SdkError` - If there was an error during the token creation */ createIssuerToken( request: CreateIssuerTokenRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Freezes tokens held at the specified address * * # Arguments * * * `request`: The request containing the spark address where the tokens to be frozen are held * * # Returns * * Result containing either: * * `FreezeIssuerTokenResponse` - The response containing details of the freeze operation * * `SdkError` - If there was an error during the freeze process */ freezeIssuerToken( request: FreezeIssuerTokenRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Gets the issuer token balance * * # Returns * * Result containing either: * * `TokenBalance` - The balance of the issuer token * * `SdkError` - If there was an error during the retrieval or no issuer token exists */ getIssuerTokenBalance(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; /** * Gets the issuer token metadata * * # Returns * * Result containing either: * * `TokenMetadata` - The metadata of the issuer token * * `SdkError` - If there was an error during the retrieval or no issuer token exists */ getIssuerTokenMetadata(asyncOpts_?: { signal: AbortSignal; }): /*throws*/ Promise; /** * Mints supply for the issuer token * * # Arguments * * * `request`: The request contiaining the amount of the supply to mint * * # Returns * * Result containing either: * * `Payment` - The payment representing the minting transaction * * `SdkError` - If there was an error during the minting process */ mintIssuerToken( request: MintIssuerTokenRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; /** * Unfreezes tokens held at the specified address * * # Arguments * * * `request`: The request containing the spark address where the tokens to be unfrozen are held * * # Returns * * Result containing either: * * `UnfreezeIssuerTokenResponse` - The response containing details of the unfreeze operation * * `SdkError` - If there was an error during the unfreeze process */ unfreezeIssuerToken( request: UnfreezeIssuerTokenRequest, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } export class TokenIssuer extends UniffiAbstractObject implements TokenIssuerInterface { readonly [uniffiTypeNameSymbol] = 'TokenIssuer'; readonly [destructorGuardSymbol]: UniffiRustArcPtr; readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer; // No primary constructor declared for this class. private constructor(pointer: UnsafeMutableRawPointer) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeTokenIssuerObjectFactory.bless(pointer); } /** * Burns supply of the issuer token * * # Arguments * * * `request`: The request containing the amount of the supply to burn * * # Returns * * Result containing either: * * `Payment` - The payment representing the burn transaction * * `SdkError` - If there was an error during the burn process */ public async burnIssuerToken( request: BurnIssuerTokenRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_tokenissuer_burn_issuer_token( uniffiTypeTokenIssuerObjectFactory.clonePointer(this), FfiConverterTypeBurnIssuerTokenRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePayment.lift.bind( FfiConverterTypePayment ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Creates a new issuer token * * # Arguments * * * `request`: The request containing the token parameters * * # Returns * * Result containing either: * * `TokenMetadata` - The metadata of the created token * * `SdkError` - If there was an error during the token creation */ public async createIssuerToken( request: CreateIssuerTokenRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_tokenissuer_create_issuer_token( uniffiTypeTokenIssuerObjectFactory.clonePointer(this), FfiConverterTypeCreateIssuerTokenRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeTokenMetadata.lift.bind( FfiConverterTypeTokenMetadata ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Freezes tokens held at the specified address * * # Arguments * * * `request`: The request containing the spark address where the tokens to be frozen are held * * # Returns * * Result containing either: * * `FreezeIssuerTokenResponse` - The response containing details of the freeze operation * * `SdkError` - If there was an error during the freeze process */ public async freezeIssuerToken( request: FreezeIssuerTokenRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_tokenissuer_freeze_issuer_token( uniffiTypeTokenIssuerObjectFactory.clonePointer(this), FfiConverterTypeFreezeIssuerTokenRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeFreezeIssuerTokenResponse.lift.bind( FfiConverterTypeFreezeIssuerTokenResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Gets the issuer token balance * * # Returns * * Result containing either: * * `TokenBalance` - The balance of the issuer token * * `SdkError` - If there was an error during the retrieval or no issuer token exists */ public async getIssuerTokenBalance(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_tokenissuer_get_issuer_token_balance( uniffiTypeTokenIssuerObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeTokenBalance.lift.bind( FfiConverterTypeTokenBalance ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Gets the issuer token metadata * * # Returns * * Result containing either: * * `TokenMetadata` - The metadata of the issuer token * * `SdkError` - If there was an error during the retrieval or no issuer token exists */ public async getIssuerTokenMetadata(asyncOpts_?: { signal: AbortSignal; }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_tokenissuer_get_issuer_token_metadata( uniffiTypeTokenIssuerObjectFactory.clonePointer(this) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeTokenMetadata.lift.bind( FfiConverterTypeTokenMetadata ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Mints supply for the issuer token * * # Arguments * * * `request`: The request contiaining the amount of the supply to mint * * # Returns * * Result containing either: * * `Payment` - The payment representing the minting transaction * * `SdkError` - If there was an error during the minting process */ public async mintIssuerToken( request: MintIssuerTokenRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_tokenissuer_mint_issuer_token( uniffiTypeTokenIssuerObjectFactory.clonePointer(this), FfiConverterTypeMintIssuerTokenRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypePayment.lift.bind( FfiConverterTypePayment ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Unfreezes tokens held at the specified address * * # Arguments * * * `request`: The request containing the spark address where the tokens to be unfrozen are held * * # Returns * * Result containing either: * * `UnfreezeIssuerTokenResponse` - The response containing details of the unfreeze operation * * `SdkError` - If there was an error during the unfreeze process */ public async unfreezeIssuerToken( request: UnfreezeIssuerTokenRequest, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_tokenissuer_unfreeze_issuer_token( uniffiTypeTokenIssuerObjectFactory.clonePointer(this), FfiConverterTypeUnfreezeIssuerTokenRequest.lower(request) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_breez_sdk_spark_rust_future_free_rust_buffer, /*liftFunc:*/ FfiConverterTypeUnfreezeIssuerTokenResponse.lift.bind( FfiConverterTypeUnfreezeIssuerTokenResponse ), /*liftString:*/ FfiConverterString.lift, /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSdkError.lift.bind( FfiConverterTypeSdkError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy} */ uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeTokenIssuerObjectFactory.pointer(this); uniffiTypeTokenIssuerObjectFactory.freePointer(pointer); uniffiTypeTokenIssuerObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj: any): obj is TokenIssuer { return uniffiTypeTokenIssuerObjectFactory.isConcreteType(obj); } } const uniffiTypeTokenIssuerObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UnsafeMutableRawPointer): TokenIssuerInterface { const instance = Object.create(TokenIssuer.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = 'TokenIssuer'; return instance; }, bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_tokenissuer_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr: UniffiRustArcPtr) { ptr.markDestroyed(); }, pointer(obj: TokenIssuerInterface): UnsafeMutableRawPointer { if ((obj as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj as any)[pointerLiteralSymbol]; }, clonePointer(obj: TokenIssuerInterface): UnsafeMutableRawPointer { const pointer = this.pointer(obj); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_clone_tokenissuer( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UnsafeMutableRawPointer): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_breez_sdk_spark_fn_free_tokenissuer( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj: any): obj is TokenIssuerInterface { return ( obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'TokenIssuer' ); }, }; })(); // FfiConverter for TokenIssuerInterface const FfiConverterTypeTokenIssuer = new FfiConverterObject( uniffiTypeTokenIssuerObjectFactory ); // FfiConverter for boolean | undefined const FfiConverterOptionalBool = new FfiConverterOptional(FfiConverterBool); // FfiConverter for ArrayBuffer | undefined const FfiConverterOptionalArrayBuffer = new FfiConverterOptional( FfiConverterArrayBuffer ); // FfiConverter for Logger | undefined const FfiConverterOptionalTypeLogger = new FfiConverterOptional( FfiConverterTypeLogger ); // FfiConverter for ClaimDepositQuote | undefined const FfiConverterOptionalTypeClaimDepositQuote = new FfiConverterOptional( FfiConverterTypeClaimDepositQuote ); // FfiConverter for ConversionDetails | undefined const FfiConverterOptionalTypeConversionDetails = new FfiConverterOptional( FfiConverterTypeConversionDetails ); // FfiConverter for ConversionEstimate | undefined const FfiConverterOptionalTypeConversionEstimate = new FfiConverterOptional( FfiConverterTypeConversionEstimate ); // FfiConverter for ConversionOptions | undefined const FfiConverterOptionalTypeConversionOptions = new FfiConverterOptional( FfiConverterTypeConversionOptions ); // FfiConverter for Credentials | undefined const FfiConverterOptionalTypeCredentials = new FfiConverterOptional( FfiConverterTypeCredentials ); // FfiConverter for CrossChainConfig | undefined const FfiConverterOptionalTypeCrossChainConfig = new FfiConverterOptional( FfiConverterTypeCrossChainConfig ); // FfiConverter for CrossChainReceiveInfo | undefined const FfiConverterOptionalTypeCrossChainReceiveInfo = new FfiConverterOptional( FfiConverterTypeCrossChainReceiveInfo ); // FfiConverter for LightningAddressInfo | undefined const FfiConverterOptionalTypeLightningAddressInfo = new FfiConverterOptional( FfiConverterTypeLightningAddressInfo ); // FfiConverter for LnurlPayContext | undefined const FfiConverterOptionalTypeLnurlPayContext = new FfiConverterOptional( FfiConverterTypeLnurlPayContext ); // FfiConverter for LnurlPayInfo | undefined const FfiConverterOptionalTypeLnurlPayInfo = new FfiConverterOptional( FfiConverterTypeLnurlPayInfo ); // FfiConverter for LnurlReceiveMetadata | undefined const FfiConverterOptionalTypeLnurlReceiveMetadata = new FfiConverterOptional( FfiConverterTypeLnurlReceiveMetadata ); // FfiConverter for LnurlWithdrawInfo | undefined const FfiConverterOptionalTypeLnurlWithdrawInfo = new FfiConverterOptional( FfiConverterTypeLnurlWithdrawInfo ); // FfiConverter for OutgoingChange | undefined const FfiConverterOptionalTypeOutgoingChange = new FfiConverterOptional( FfiConverterTypeOutgoingChange ); // FfiConverter for PasskeyConfig | undefined const FfiConverterOptionalTypePasskeyConfig = new FfiConverterOptional( FfiConverterTypePasskeyConfig ); // FfiConverter for PasskeyCredential | undefined const FfiConverterOptionalTypePasskeyCredential = new FfiConverterOptional( FfiConverterTypePasskeyCredential ); // FfiConverter for PasskeyProviderOptions | undefined const FfiConverterOptionalTypePasskeyProviderOptions = new FfiConverterOptional( FfiConverterTypePasskeyProviderOptions ); // FfiConverter for Payment | undefined const FfiConverterOptionalTypePayment = new FfiConverterOptional( FfiConverterTypePayment ); // FfiConverter for ProxyConfig | undefined const FfiConverterOptionalTypeProxyConfig = new FfiConverterOptional( FfiConverterTypeProxyConfig ); // FfiConverter for Record | undefined const FfiConverterOptionalTypeRecord = new FfiConverterOptional( FfiConverterTypeRecord ); // FfiConverter for SparkConfig | undefined const FfiConverterOptionalTypeSparkConfig = new FfiConverterOptional( FfiConverterTypeSparkConfig ); // FfiConverter for SparkHtlcDetails | undefined const FfiConverterOptionalTypeSparkHtlcDetails = new FfiConverterOptional( FfiConverterTypeSparkHtlcDetails ); // FfiConverter for SparkHtlcOptions | undefined const FfiConverterOptionalTypeSparkHtlcOptions = new FfiConverterOptional( FfiConverterTypeSparkHtlcOptions ); // FfiConverter for SparkInvoicePaymentDetails | undefined const FfiConverterOptionalTypeSparkInvoicePaymentDetails = new FfiConverterOptional(FfiConverterTypeSparkInvoicePaymentDetails); // FfiConverter for StableBalanceConfig | undefined const FfiConverterOptionalTypeStableBalanceConfig = new FfiConverterOptional( FfiConverterTypeStableBalanceConfig ); // FfiConverter for StoredCrossChainSwap | undefined const FfiConverterOptionalTypeStoredCrossChainSwap = new FfiConverterOptional( FfiConverterTypeStoredCrossChainSwap ); // FfiConverter for Symbol | undefined const FfiConverterOptionalTypeSymbol = new FfiConverterOptional( FfiConverterTypeSymbol ); // FfiConverter for TurnkeyRetryConfig | undefined const FfiConverterOptionalTypeTurnkeyRetryConfig = new FfiConverterOptional( FfiConverterTypeTurnkeyRetryConfig ); // FfiConverter for string | undefined const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString); // FfiConverter for /*u32*/number | undefined const FfiConverterOptionalUInt32 = new FfiConverterOptional(FfiConverterUInt32); // FfiConverter for /*u64*/bigint | undefined const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64); // FfiConverter for Array const FfiConverterArrayArrayBuffer = new FfiConverterArray( FfiConverterArrayBuffer ); // FfiConverter for Array const FfiConverterArrayTypeBatchRecipient = new FfiConverterArray( FfiConverterTypeBatchRecipient ); // FfiConverter for Array const FfiConverterArrayTypeBatchTotal = new FfiConverterArray( FfiConverterTypeBatchTotal ); // FfiConverter for Array const FfiConverterArrayTypeBip21Extra = new FfiConverterArray( FfiConverterTypeBip21Extra ); // FfiConverter for Array const FfiConverterArrayTypeBolt11RouteHint = new FfiConverterArray( FfiConverterTypeBolt11RouteHint ); // FfiConverter for Array const FfiConverterArrayTypeBolt11RouteHintHop = new FfiConverterArray( FfiConverterTypeBolt11RouteHintHop ); // FfiConverter for Array const FfiConverterArrayTypeBolt12OfferBlindedPath = new FfiConverterArray( FfiConverterTypeBolt12OfferBlindedPath ); // FfiConverter for Array const FfiConverterArrayTypeConfirmedExitNode = new FfiConverterArray( FfiConverterTypeConfirmedExitNode ); // FfiConverter for Array const FfiConverterArrayTypeContact = new FfiConverterArray( FfiConverterTypeContact ); // FfiConverter for Array const FfiConverterArrayTypeConversion = new FfiConverterArray( FfiConverterTypeConversion ); // FfiConverter for Array const FfiConverterArrayTypeCrossChainRoutePair = new FfiConverterArray( FfiConverterTypeCrossChainRoutePair ); // FfiConverter for Array const FfiConverterArrayTypeDepositInfo = new FfiConverterArray( FfiConverterTypeDepositInfo ); // FfiConverter for Array const FfiConverterArrayTypeExitRefund = new FfiConverterArray( FfiConverterTypeExitRefund ); // FfiConverter for Array const FfiConverterArrayTypeExternalClaimLeafInput = new FfiConverterArray( FfiConverterTypeExternalClaimLeafInput ); // FfiConverter for Array const FfiConverterArrayTypeExternalFrostJob = new FfiConverterArray( FfiConverterTypeExternalFrostJob ); // FfiConverter for Array const FfiConverterArrayTypeExternalFrostShareResult = new FfiConverterArray( FfiConverterTypeExternalFrostShareResult ); // FfiConverter for Array const FfiConverterArrayTypeExternalInputParser = new FfiConverterArray( FfiConverterTypeExternalInputParser ); // FfiConverter for Array const FfiConverterArrayTypeExternalNewLeafKey = new FfiConverterArray( FfiConverterTypeExternalNewLeafKey ); // FfiConverter for Array const FfiConverterArrayTypeExternalOperatorPackage = new FfiConverterArray( FfiConverterTypeExternalOperatorPackage ); // FfiConverter for Array const FfiConverterArrayTypeExternalOperatorRecipient = new FfiConverterArray( FfiConverterTypeExternalOperatorRecipient ); // FfiConverter for Array const FfiConverterArrayTypeExternalTransferLeafInput = new FfiConverterArray( FfiConverterTypeExternalTransferLeafInput ); // FfiConverter for Array const FfiConverterArrayTypeFiatCurrency = new FfiConverterArray( FfiConverterTypeFiatCurrency ); // FfiConverter for Array const FfiConverterArrayTypeIdentifierCommitmentPair = new FfiConverterArray( FfiConverterTypeIdentifierCommitmentPair ); // FfiConverter for Array const FfiConverterArrayTypeIdentifierPublicKeyPair = new FfiConverterArray( FfiConverterTypeIdentifierPublicKeyPair ); // FfiConverter for Array const FfiConverterArrayTypeIdentifierSignaturePair = new FfiConverterArray( FfiConverterTypeIdentifierSignaturePair ); // FfiConverter for Array const FfiConverterArrayTypeIncomingChange = new FfiConverterArray( FfiConverterTypeIncomingChange ); // FfiConverter for Array const FfiConverterArrayTypeLocaleOverrides = new FfiConverterArray( FfiConverterTypeLocaleOverrides ); // FfiConverter for Array const FfiConverterArrayTypeLocalizedName = new FfiConverterArray( FfiConverterTypeLocalizedName ); // FfiConverter for Array const FfiConverterArrayTypeOutgoingChange = new FfiConverterArray( FfiConverterTypeOutgoingChange ); // FfiConverter for Array const FfiConverterArrayTypePayment = new FfiConverterArray( FfiConverterTypePayment ); // FfiConverter for Array const FfiConverterArrayTypePaymentIdUpdate = new FfiConverterArray( FfiConverterTypePaymentIdUpdate ); // FfiConverter for Array const FfiConverterArrayTypePerBranchFunding = new FfiConverterArray( FfiConverterTypePerBranchFunding ); // FfiConverter for Array const FfiConverterArrayTypeProvisionalPayment = new FfiConverterArray( FfiConverterTypeProvisionalPayment ); // FfiConverter for Array const FfiConverterArrayTypeRate = new FfiConverterArray(FfiConverterTypeRate); // FfiConverter for Array const FfiConverterArrayTypeRecord = new FfiConverterArray( FfiConverterTypeRecord ); // FfiConverter for Array const FfiConverterArrayTypeResolvedBatchRecipient = new FfiConverterArray( FfiConverterTypeResolvedBatchRecipient ); // FfiConverter for Array const FfiConverterArrayTypeSetLnurlMetadataItem = new FfiConverterArray( FfiConverterTypeSetLnurlMetadataItem ); // FfiConverter for Array const FfiConverterArrayTypeSparkSigningOperator = new FfiConverterArray( FfiConverterTypeSparkSigningOperator ); // FfiConverter for Array const FfiConverterArrayTypeStableBalanceToken = new FfiConverterArray( FfiConverterTypeStableBalanceToken ); // FfiConverter for Array const FfiConverterArrayTypeStoredCrossChainSwap = new FfiConverterArray( FfiConverterTypeStoredCrossChainSwap ); // FfiConverter for Array const FfiConverterArrayTypeTokenMetadata = new FfiConverterArray( FfiConverterTypeTokenMetadata ); // FfiConverter for Array const FfiConverterArrayTypeUnilateralExitLeaf = new FfiConverterArray( FfiConverterTypeUnilateralExitLeaf ); // FfiConverter for Array const FfiConverterArrayTypeUnilateralExitTransaction = new FfiConverterArray( FfiConverterTypeUnilateralExitTransaction ); // FfiConverter for Array const FfiConverterArrayTypeUtxo = new FfiConverterArray(FfiConverterTypeUtxo); // FfiConverter for Array const FfiConverterArrayTypeWebhook = new FfiConverterArray( FfiConverterTypeWebhook ); // FfiConverter for Array const FfiConverterArrayString = new FfiConverterArray(FfiConverterString); // FfiConverter for Array const FfiConverterArrayUInt64 = new FfiConverterArray(FfiConverterUInt64); // FfiConverter for Map> const FfiConverterMapStringArrayTypePayment = new FfiConverterMap( FfiConverterString, FfiConverterArrayTypePayment ); // FfiConverter for U128 | undefined const FfiConverterOptionalTypeu128 = new FfiConverterOptional( FfiConverterTypeu128 ); // FfiConverter for Amount | undefined const FfiConverterOptionalTypeAmount = new FfiConverterOptional( FfiConverterTypeAmount ); // FfiConverter for AmountAdjustmentReason | undefined const FfiConverterOptionalTypeAmountAdjustmentReason = new FfiConverterOptional( FfiConverterTypeAmountAdjustmentReason ); // FfiConverter for AssetFilter | undefined const FfiConverterOptionalTypeAssetFilter = new FfiConverterOptional( FfiConverterTypeAssetFilter ); // FfiConverter for BuildTransferPackageOptions | undefined const FfiConverterOptionalTypeBuildTransferPackageOptions = new FfiConverterOptional(FfiConverterTypeBuildTransferPackageOptions); // FfiConverter for ConversionFilter | undefined const FfiConverterOptionalTypeConversionFilter = new FfiConverterOptional( FfiConverterTypeConversionFilter ); // FfiConverter for ConversionInfo | undefined const FfiConverterOptionalTypeConversionInfo = new FfiConverterOptional( FfiConverterTypeConversionInfo ); // FfiConverter for ConversionPurpose | undefined const FfiConverterOptionalTypeConversionPurpose = new FfiConverterOptional( FfiConverterTypeConversionPurpose ); // FfiConverter for ConversionStatus | undefined const FfiConverterOptionalTypeConversionStatus = new FfiConverterOptional( FfiConverterTypeConversionStatus ); // FfiConverter for CrossChainFeeMode | undefined const FfiConverterOptionalTypeCrossChainFeeMode = new FfiConverterOptional( FfiConverterTypeCrossChainFeeMode ); // FfiConverter for DepositClaimError | undefined const FfiConverterOptionalTypeDepositClaimError = new FfiConverterOptional( FfiConverterTypeDepositClaimError ); // FfiConverter for Fee | undefined const FfiConverterOptionalTypeFee = new FfiConverterOptional( FfiConverterTypeFee ); // FfiConverter for FeePolicy | undefined const FfiConverterOptionalTypeFeePolicy = new FfiConverterOptional( FfiConverterTypeFeePolicy ); // FfiConverter for InstantClaimStatus | undefined const FfiConverterOptionalTypeInstantClaimStatus = new FfiConverterOptional( FfiConverterTypeInstantClaimStatus ); // FfiConverter for MaxFee | undefined const FfiConverterOptionalTypeMaxFee = new FfiConverterOptional( FfiConverterTypeMaxFee ); // FfiConverter for PaymentDetails | undefined const FfiConverterOptionalTypePaymentDetails = new FfiConverterOptional( FfiConverterTypePaymentDetails ); // FfiConverter for RefundState | undefined const FfiConverterOptionalTypeRefundState = new FfiConverterOptional( FfiConverterTypeRefundState ); // FfiConverter for SendPaymentOptions | undefined const FfiConverterOptionalTypeSendPaymentOptions = new FfiConverterOptional( FfiConverterTypeSendPaymentOptions ); // FfiConverter for SparkAsset | undefined const FfiConverterOptionalTypeSparkAsset = new FfiConverterOptional( FfiConverterTypeSparkAsset ); // FfiConverter for SparkMasterIdentityPublicKey | undefined const FfiConverterOptionalTypeSparkMasterIdentityPublicKey = new FfiConverterOptional(FfiConverterTypeSparkMasterIdentityPublicKey); // FfiConverter for StableBalanceActiveLabel | undefined const FfiConverterOptionalTypeStableBalanceActiveLabel = new FfiConverterOptional(FfiConverterTypeStableBalanceActiveLabel); // FfiConverter for SuccessAction | undefined const FfiConverterOptionalTypeSuccessAction = new FfiConverterOptional( FfiConverterTypeSuccessAction ); // FfiConverter for SuccessActionProcessed | undefined const FfiConverterOptionalTypeSuccessActionProcessed = new FfiConverterOptional( FfiConverterTypeSuccessActionProcessed ); // FfiConverter for SwapDegradation | undefined const FfiConverterOptionalTypeSwapDegradation = new FfiConverterOptional( FfiConverterTypeSwapDegradation ); // FfiConverter for TokenTransactionType | undefined const FfiConverterOptionalTypeTokenTransactionType = new FfiConverterOptional( FfiConverterTypeTokenTransactionType ); // FfiConverter for Map | undefined const FfiConverterOptionalMapStringString = new FfiConverterOptional( FfiConverterMapStringString ); // FfiConverter for StorageBackend | undefined const FfiConverterOptionalTypeStorageBackend = new FfiConverterOptional( FfiConverterTypeStorageBackend ); // FfiConverter for Array | undefined const FfiConverterOptionalArrayArrayBuffer = new FfiConverterOptional( FfiConverterArrayArrayBuffer ); // FfiConverter for Array | undefined const FfiConverterOptionalArrayTypeExternalInputParser = new FfiConverterOptional(FfiConverterArrayTypeExternalInputParser); // FfiConverter for Array const FfiConverterArrayTypeCpfpInput = new FfiConverterArray( FfiConverterTypeCpfpInput ); // FfiConverter for Array const FfiConverterArrayTypeDeliveryMethod = new FfiConverterArray( FfiConverterTypeDeliveryMethod ); // FfiConverter for Array const FfiConverterArrayTypeInputType = new FfiConverterArray( FfiConverterTypeInputType ); // FfiConverter for Array const FfiConverterArrayTypePaymentDetailsFilter = new FfiConverterArray( FfiConverterTypePaymentDetailsFilter ); // FfiConverter for Array const FfiConverterArrayTypePaymentStatus = new FfiConverterArray( FfiConverterTypePaymentStatus ); // FfiConverter for Array const FfiConverterArrayTypePaymentType = new FfiConverterArray( FfiConverterTypePaymentType ); // FfiConverter for Array const FfiConverterArrayTypeSparkAsset = new FfiConverterArray( FfiConverterTypeSparkAsset ); // FfiConverter for Array const FfiConverterArrayTypeSparkHtlcStatus = new FfiConverterArray( FfiConverterTypeSparkHtlcStatus ); // FfiConverter for Array const FfiConverterArrayTypeStoragePaymentDetailsFilter = new FfiConverterArray( FfiConverterTypeStoragePaymentDetailsFilter ); // FfiConverter for Array const FfiConverterArrayTypeWebhookEventType = new FfiConverterArray( FfiConverterTypeWebhookEventType ); // FfiConverter for Array | undefined const FfiConverterOptionalArrayTypePaymentDetailsFilter = new FfiConverterOptional(FfiConverterArrayTypePaymentDetailsFilter); // FfiConverter for Array | undefined const FfiConverterOptionalArrayTypePaymentStatus = new FfiConverterOptional( FfiConverterArrayTypePaymentStatus ); // FfiConverter for Array | undefined const FfiConverterOptionalArrayTypePaymentType = new FfiConverterOptional( FfiConverterArrayTypePaymentType ); // FfiConverter for Array | undefined const FfiConverterOptionalArrayTypeSparkHtlcStatus = new FfiConverterOptional( FfiConverterArrayTypeSparkHtlcStatus ); // FfiConverter for Array | undefined const FfiConverterOptionalArrayTypeStoragePaymentDetailsFilter = new FfiConverterOptional(FfiConverterArrayTypeStoragePaymentDetailsFilter); /** * This should be called before anything else. * * It is likely that this is being done for you by the library's `index.ts`. * * It checks versions of uniffi between when the Rust scaffolding was generated * and when the bindings were generated. * * It also initializes the machinery to enable Rust to talk back to Javascript. */ function uniffiEnsureInitialized() { // Get the bindings contract version from our ComponentInterface const bindingsContractVersion = 29; // Get the scaffolding contract version by calling the into the dylib const scaffoldingContractVersion = nativeModule().ubrn_ffi_breez_sdk_spark_uniffi_contract_version(); if (bindingsContractVersion !== scaffoldingContractVersion) { throw new UniffiInternalError.ContractVersionMismatch( scaffoldingContractVersion, bindingsContractVersion ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_connect() !== 40345 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_connect' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_connect_with_signer() !== 1399 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_connect_with_signer' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_connect_with_signing_only_signer() !== 17952 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_connect_with_signing_only_signer' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_create_turnkey_signer() !== 50635 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_create_turnkey_signer' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_create_turnkey_signing_only_signer() !== 37791 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_create_turnkey_signing_only_signer' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_custom_storage() !== 18116 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_custom_storage' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_default_config() !== 62194 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_default_config' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_default_external_signers() !== 58595 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_default_external_signers' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_default_server_config() !== 40188 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_default_server_config' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_default_session_store() !== 24904 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_default_session_store' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_default_storage() !== 56226 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_default_storage' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_get_spark_status() !== 51200 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_get_spark_status' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_init_logging() !== 8518 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_init_logging' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_new_rest_chain_service() !== 53269 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_new_rest_chain_service' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_new_shared_sdk_context() !== 7027 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_new_shared_sdk_context' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_single_key_cpfp_signer() !== 28762 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_func_single_key_cpfp_signer' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_address_utxos() !== 20959 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_address_utxos' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_address_txos() !== 10702 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_address_txos' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_transaction_status() !== 53546 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_transaction_status' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_tip_height() !== 5182 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_tip_height' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_transaction_hex() !== 35307 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_transaction_hex' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_outspend() !== 49726 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_get_outspend' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_broadcast_transaction() !== 54160 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_broadcast_transaction' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_recommended_fees() !== 31747 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_bitcoinchainservice_recommended_fees' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_add_contact() !== 26497 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_add_contact' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_add_event_listener() !== 19224 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_add_event_listener' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_authorize_lightning_address_transfer() !== 15257 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_authorize_lightning_address_transfer' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_batch_package() !== 52999 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_batch_package' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_lnurl_pay_package() !== 23822 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_lnurl_pay_package' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_transfer_package() !== 60228 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_build_unsigned_transfer_package' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_buy_bitcoin() !== 34179 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_buy_bitcoin' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_check_lightning_address_available() !== 3632 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_check_lightning_address_available' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_check_message() !== 4385 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_check_message' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_check_unilateral_exit() !== 27303 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_check_unilateral_exit' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_claim_deposit() !== 43529 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_claim_deposit' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_claim_htlc_payment() !== 57587 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_claim_htlc_payment' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_claim_lightning_address_transfer() !== 20680 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_claim_lightning_address_transfer' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_delete_contact() !== 15670 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_delete_contact' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_delete_lightning_address() !== 55630 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_delete_lightning_address' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_disconnect() !== 20026 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_disconnect' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_export_unilateral_exit_state() !== 63178 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_export_unilateral_exit_state' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_fetch_claim_deposit_quote() !== 30349 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_fetch_claim_deposit_quote' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_fetch_conversion_limits() !== 50958 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_fetch_conversion_limits' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_get_cross_chain_routes() !== 50302 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_get_cross_chain_routes' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_get_info() !== 6771 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_get_info' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_get_lightning_address() !== 36552 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_get_lightning_address' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_get_payment() !== 11540 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_get_payment' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_get_token_issuer() !== 26649 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_get_token_issuer' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_get_tokens_metadata() !== 40125 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_get_tokens_metadata' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_get_user_settings() !== 38537 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_get_user_settings' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_import_unilateral_exit_state() !== 62008 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_import_unilateral_exit_state' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_list_contacts() !== 2729 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_list_contacts' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_list_fiat_currencies() !== 63366 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_list_fiat_currencies' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_list_fiat_rates() !== 5904 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_list_fiat_rates' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_list_payments() !== 39170 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_list_payments' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_list_unclaimed_deposits() !== 22486 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_list_unclaimed_deposits' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_list_webhooks() !== 28432 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_list_webhooks' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_auth() !== 125 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_auth' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_pay() !== 10147 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_pay' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_withdraw() !== 45652 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_lnurl_withdraw' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_optimize_leaves() !== 39254 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_optimize_leaves' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_parse() !== 14285 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_parse' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_lnurl_pay() !== 37691 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_lnurl_pay' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_payment_link() !== 15201 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_payment_link' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_batch() !== 59347 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_batch' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_payment() !== 34185 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_send_payment' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_unilateral_exit() !== 36492 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_prepare_unilateral_exit' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_publish_signed_lnurl_pay_package() !== 48698 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_publish_signed_lnurl_pay_package' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_publish_signed_transfer_package() !== 59188 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_publish_signed_transfer_package' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_receive_payment() !== 36984 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_receive_payment' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_recommended_fees() !== 16947 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_recommended_fees' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_refund_deposit() !== 33646 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_refund_deposit' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_refund_pending_conversions() !== 11342 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_refund_pending_conversions' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_register_lightning_address() !== 530 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_register_lightning_address' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_register_webhook() !== 13529 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_register_webhook' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_remove_event_listener() !== 41066 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_remove_event_listener' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_batch() !== 34563 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_send_batch' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment() !== 54349 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_send_payment' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_sign_message() !== 47976 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_sign_message' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_sync_wallet() !== 30368 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_sync_wallet' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_unilateral_exit() !== 58676 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_unilateral_exit' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_unregister_webhook() !== 34100 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_unregister_webhook' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_update_contact() !== 21170 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_update_contact' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_update_user_settings() !== 1721 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_breezsdk_update_user_settings' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_cpfpsigner_sign_psbt() !== 20736 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_cpfpsigner_sign_psbt' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_derive_public_key() !== 26700 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_derive_public_key' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_sign_ecdsa() !== 17969 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_sign_ecdsa' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_sign_ecdsa_recoverable() !== 45907 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_sign_ecdsa_recoverable' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_encrypt_ecies() !== 5296 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_encrypt_ecies' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_decrypt_ecies() !== 6089 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_decrypt_ecies' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_sign_hash_schnorr() !== 1766 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_sign_hash_schnorr' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_hmac_sha256() !== 65429 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalbreezsigner_hmac_sha256' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_derive_public_key() !== 28092 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_derive_public_key' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_sign_ecdsa() !== 13755 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_sign_ecdsa' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_sign_ecdsa_recoverable() !== 34935 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_sign_ecdsa_recoverable' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_sign_hash_schnorr() !== 21395 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsigningsigner_sign_hash_schnorr' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_get_identity_public_key() !== 38705 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_get_identity_public_key' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_get_public_key_for_leaf() !== 39015 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_get_public_key_for_leaf' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_is_remote() !== 63049 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_is_remote' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_get_static_deposit_public_key() !== 54380 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_get_static_deposit_public_key' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_sign_authentication_challenge() !== 53611 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_sign_authentication_challenge' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_sign_message() !== 1815 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_sign_message' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_sign_leaf_refund_spend() !== 62629 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_sign_leaf_refund_spend' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_sign_frost() !== 58732 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_sign_frost' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_prepare_transfer() !== 29829 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_prepare_transfer' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_prepare_claim() !== 17684 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_prepare_claim' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_prepare_lightning_receive() !== 25306 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_prepare_lightning_receive' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_prepare_static_deposit() !== 3348 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_prepare_static_deposit' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_start_static_deposit_refund() !== 22709 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_start_static_deposit_refund' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_sign_static_deposit_refund() !== 52719 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_sign_static_deposit_refund' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_sign_spark_invoice() !== 39737 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_sign_spark_invoice' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_prepare_token_transaction() !== 12801 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_prepare_token_transaction' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_externalsparksigner_prepare_static_deposit_claim() !== 53174 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_externalsparksigner_prepare_static_deposit_claim' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_fiatservice_fetch_fiat_currencies() !== 19092 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_fiatservice_fetch_fiat_currencies' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_fiatservice_fetch_fiat_rates() !== 11512 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_fiatservice_fetch_fiat_rates' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_passkeyclient_check_availability() !== 35189 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_passkeyclient_check_availability' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_passkeyclient_connect_with_passkey() !== 32814 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_passkeyclient_connect_with_passkey' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_passkeyclient_labels() !== 35849 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_passkeyclient_labels' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_passkeyclient_register() !== 27748 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_passkeyclient_register' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_passkeyclient_sign_in() !== 42245 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_passkeyclient_sign_in' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_passkeylabels_list() !== 54877 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_passkeylabels_list' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_passkeylabels_store() !== 58514 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_passkeylabels_store' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_paymentobserver_before_send() !== 27806 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_paymentobserver_before_send' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_paymentobserver_after_send() !== 31673 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_paymentobserver_after_send' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_prfprovider_derive_seeds() !== 18550 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_prfprovider_derive_seeds' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_prfprovider_is_supported() !== 46331 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_prfprovider_is_supported' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_prfprovider_create_passkey() !== 61235 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_prfprovider_create_passkey' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_prfprovider_check_domain_association() !== 18713 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_prfprovider_check_domain_association' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_restclient_get_request() !== 8260 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_restclient_get_request' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_restclient_post_request() !== 24889 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_restclient_post_request' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_restclient_delete_request() !== 51072 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_restclient_delete_request' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_build() !== 8126 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_build' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_account_number() !== 6550 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_account_number' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_chain_service() !== 2848 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_chain_service' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_default_storage() !== 14543 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_default_storage' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_fiat_service() !== 37854 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_fiat_service' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_lnurl_client() !== 51060 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_lnurl_client' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_payment_observer() !== 21617 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_payment_observer' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_rest_chain_service() !== 63155 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_rest_chain_service' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_session_store() !== 32818 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_session_store' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_shared_context() !== 64829 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_shared_context' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_storage() !== 20369 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_storage' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_storage_backend() !== 28545 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_storage_backend' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sessionstore_get_session() !== 49546 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_sessionstore_get_session' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sessionstore_set_session() !== 13629 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_sessionstore_set_session' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_delete_cached_item() !== 6883 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_delete_cached_item' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_cached_item() !== 30248 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_get_cached_item' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_set_cached_item() !== 7970 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_set_cached_item' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_list_payments() !== 51078 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_list_payments' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_apply_payment_update() !== 8631 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_apply_payment_update' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_insert_payment_metadata() !== 32757 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_insert_payment_metadata' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_payment_by_id() !== 35394 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_get_payment_by_id' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_payment_by_invoice() !== 57075 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_get_payment_by_invoice' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_payments_by_parent_ids() !== 10948 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_get_payments_by_parent_ids' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_add_deposit() !== 35363 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_add_deposit' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_delete_deposit() !== 28477 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_delete_deposit' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_list_deposits() !== 62636 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_list_deposits' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_update_deposit() !== 18714 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_update_deposit' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_set_lnurl_metadata() !== 64210 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_set_lnurl_metadata' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_list_contacts() !== 10490 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_list_contacts' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_contact() !== 19980 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_get_contact' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_insert_contact() !== 38342 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_insert_contact' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_delete_contact() !== 50274 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_delete_contact' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_set_cross_chain_swap() !== 31116 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_set_cross_chain_swap' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_cross_chain_swap() !== 20172 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_get_cross_chain_swap' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_list_active_cross_chain_swaps() !== 23493 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_list_active_cross_chain_swaps' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_add_outgoing_change() !== 44890 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_add_outgoing_change' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_complete_outgoing_sync() !== 8492 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_complete_outgoing_sync' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_pending_outgoing_changes() !== 54668 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_get_pending_outgoing_changes' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_last_revision() !== 17237 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_get_last_revision' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_insert_incoming_records() !== 35265 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_insert_incoming_records' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_delete_incoming_record() !== 32789 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_delete_incoming_record' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_incoming_records() !== 18699 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_get_incoming_records' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_get_latest_outgoing_change() !== 59591 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_get_latest_outgoing_change' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storage_update_record_from_incoming() !== 30443 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storage_update_record_from_incoming' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_storagebackend_create_stores() !== 51497 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_storagebackend_create_stores' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_tokenissuer_burn_issuer_token() !== 56056 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_tokenissuer_burn_issuer_token' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_tokenissuer_create_issuer_token() !== 33277 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_tokenissuer_create_issuer_token' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_tokenissuer_freeze_issuer_token() !== 32344 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_tokenissuer_freeze_issuer_token' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_tokenissuer_get_issuer_token_balance() !== 9758 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_tokenissuer_get_issuer_token_balance' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_tokenissuer_get_issuer_token_metadata() !== 57707 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_tokenissuer_get_issuer_token_metadata' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_tokenissuer_mint_issuer_token() !== 36459 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_tokenissuer_mint_issuer_token' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_tokenissuer_unfreeze_issuer_token() !== 65025 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_tokenissuer_unfreeze_issuer_token' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_constructor_passkeyclient_new() !== 2983 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_constructor_passkeyclient_new' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_constructor_sdkbuilder_new() !== 65435 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_constructor_sdkbuilder_new' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_constructor_sdkbuilder_new_with_signer() !== 28871 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_constructor_sdkbuilder_new_with_signer' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_constructor_sdkbuilder_new_with_signing_only_signer() !== 27342 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_constructor_sdkbuilder_new_with_signing_only_signer' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_eventlistener_on_event() !== 24807 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_eventlistener_on_event' ); } if ( nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_logger_log() !== 11839 ) { throw new UniffiInternalError.ApiChecksumMismatch( 'uniffi_breez_sdk_spark_checksum_method_logger_log' ); } uniffiCallbackInterfaceEventListener.register(); uniffiCallbackInterfaceLogger.register(); uniffiCallbackInterfaceBitcoinChainService.register(); uniffiCallbackInterfaceCpfpSigner.register(); uniffiCallbackInterfaceExternalBreezSigner.register(); uniffiCallbackInterfaceExternalSigningSigner.register(); uniffiCallbackInterfaceExternalSparkSigner.register(); uniffiCallbackInterfaceFiatService.register(); uniffiCallbackInterfacePaymentObserver.register(); uniffiCallbackInterfacePrfProvider.register(); uniffiCallbackInterfaceRestClient.register(); uniffiCallbackInterfaceSessionStore.register(); uniffiCallbackInterfaceStorage.register(); } export default Object.freeze({ initialize: uniffiEnsureInitialized, converters: { FfiConverterTypeAddContactRequest, FfiConverterTypeAesSuccessActionData, FfiConverterTypeAesSuccessActionDataDecrypted, FfiConverterTypeAesSuccessActionDataResult, FfiConverterTypeAmount, FfiConverterTypeAmountAdjustmentReason, FfiConverterTypeAssetFilter, FfiConverterTypeAuthorizeTransferRequest, FfiConverterTypeAutoOptimizationEvent, FfiConverterTypeBatchDestination, FfiConverterTypeBatchRecipient, FfiConverterTypeBatchTotal, FfiConverterTypeBip21Details, FfiConverterTypeBip21Extra, FfiConverterTypeBitcoinAddressDetails, FfiConverterTypeBitcoinChainService, FfiConverterTypeBitcoinNetwork, FfiConverterTypeBolt11Invoice, FfiConverterTypeBolt11InvoiceDetails, FfiConverterTypeBolt11RouteHint, FfiConverterTypeBolt11RouteHintHop, FfiConverterTypeBolt12Invoice, FfiConverterTypeBolt12InvoiceDetails, FfiConverterTypeBolt12InvoiceRequestDetails, FfiConverterTypeBolt12Offer, FfiConverterTypeBolt12OfferBlindedPath, FfiConverterTypeBolt12OfferDetails, FfiConverterTypeBreezSdk, FfiConverterTypeBuildTransferPackageOptions, FfiConverterTypeBuildUnsignedBatchPackageRequest, FfiConverterTypeBuildUnsignedLnurlPayPackageRequest, FfiConverterTypeBuildUnsignedTransferPackageRequest, FfiConverterTypeBurnIssuerTokenRequest, FfiConverterTypeBuyBitcoinRequest, FfiConverterTypeBuyBitcoinResponse, FfiConverterTypeChainApiType, FfiConverterTypeChainServiceError, FfiConverterTypeCheckLightningAddressRequest, FfiConverterTypeCheckMessageRequest, FfiConverterTypeCheckMessageResponse, FfiConverterTypeCheckUnilateralExitRequest, FfiConverterTypeCheckUnilateralExitResponse, FfiConverterTypeClaimDepositQuote, FfiConverterTypeClaimDepositRequest, FfiConverterTypeClaimDepositResponse, FfiConverterTypeClaimHtlcPaymentRequest, FfiConverterTypeClaimHtlcPaymentResponse, FfiConverterTypeClaimTransferRequest, FfiConverterTypeConfig, FfiConverterTypeConfirmedExitNode, FfiConverterTypeConnectRequest, FfiConverterTypeConnectWithPasskeyRequest, FfiConverterTypeConnectWithPasskeyResponse, FfiConverterTypeConnectWithSignerRequest, FfiConverterTypeConnectWithSigningOnlySignerRequest, FfiConverterTypeContact, FfiConverterTypeConversion, FfiConverterTypeConversionAsset, FfiConverterTypeConversionChain, FfiConverterTypeConversionDetails, FfiConverterTypeConversionEstimate, FfiConverterTypeConversionFilter, FfiConverterTypeConversionInfo, FfiConverterTypeConversionOptions, FfiConverterTypeConversionProvider, FfiConverterTypeConversionPurpose, FfiConverterTypeConversionSide, FfiConverterTypeConversionStatus, FfiConverterTypeConversionType, FfiConverterTypeCpfpFundingKind, FfiConverterTypeCpfpInput, FfiConverterTypeCpfpSigner, FfiConverterTypeCreateIssuerTokenRequest, FfiConverterTypeCreatePasskeyOutput, FfiConverterTypeCredentials, FfiConverterTypeCrossChainAddressDetails, FfiConverterTypeCrossChainAddressFamily, FfiConverterTypeCrossChainConfig, FfiConverterTypeCrossChainFeeMode, FfiConverterTypeCrossChainProvider, FfiConverterTypeCrossChainProviderContext, FfiConverterTypeCrossChainReceiveInfo, FfiConverterTypeCrossChainRouteFilter, FfiConverterTypeCrossChainRoutePair, FfiConverterTypeCurrencyInfo, FfiConverterTypeDeliveryMethod, FfiConverterTypeDepositClaimError, FfiConverterTypeDepositInfo, FfiConverterTypeDeriveSeedsOutput, FfiConverterTypeDeriveSeedsRequest, FfiConverterTypeDomainAssociation, FfiConverterTypeEcdsaSignatureBytes, FfiConverterTypeErrorKind, FfiConverterTypeExitChainState, FfiConverterTypeExitLeafSelection, FfiConverterTypeExitNodeConfirmation, FfiConverterTypeExitRefund, FfiConverterTypeExitRefundState, FfiConverterTypeExitTransactionStatus, FfiConverterTypeExportUnilateralExitStateResponse, FfiConverterTypeExternalBreezSigner, FfiConverterTypeExternalClaimLeafInput, FfiConverterTypeExternalFrostCommitments, FfiConverterTypeExternalFrostDerivation, FfiConverterTypeExternalFrostJob, FfiConverterTypeExternalFrostShareResult, FfiConverterTypeExternalFrostSignature, FfiConverterTypeExternalFrostSignatureShare, FfiConverterTypeExternalIdentifier, FfiConverterTypeExternalInputParser, FfiConverterTypeExternalNewLeafKey, FfiConverterTypeExternalOperatorPackage, FfiConverterTypeExternalOperatorRecipient, FfiConverterTypeExternalPrepareClaimRequest, FfiConverterTypeExternalPrepareLightningReceiveRequest, FfiConverterTypeExternalPrepareStaticDepositClaimRequest, FfiConverterTypeExternalPrepareStaticDepositRequest, FfiConverterTypeExternalPrepareTokenTransactionRequest, FfiConverterTypeExternalPrepareTransferRequest, FfiConverterTypeExternalPreparedClaim, FfiConverterTypeExternalPreparedLightningReceive, FfiConverterTypeExternalPreparedStaticDeposit, FfiConverterTypeExternalPreparedStaticDepositClaim, FfiConverterTypeExternalPreparedTokenTransaction, FfiConverterTypeExternalPreparedTransfer, FfiConverterTypeExternalSignSparkInvoiceRequest, FfiConverterTypeExternalSignStaticDepositRefundRequest, FfiConverterTypeExternalSignedSparkInvoice, FfiConverterTypeExternalSigners, FfiConverterTypeExternalSigningCommitments, FfiConverterTypeExternalSigningSigner, FfiConverterTypeExternalSparkInvoiceKind, FfiConverterTypeExternalSparkSigner, FfiConverterTypeExternalStartStaticDepositRefundRequest, FfiConverterTypeExternalStartedStaticDepositRefund, FfiConverterTypeExternalTokenTransactionKind, FfiConverterTypeExternalTransferLeafInput, FfiConverterTypeExternalTreeNodeId, FfiConverterTypeFee, FfiConverterTypeFeePolicy, FfiConverterTypeFetchClaimDepositQuoteRequest, FfiConverterTypeFetchClaimDepositQuoteResponse, FfiConverterTypeFetchConversionLimitsRequest, FfiConverterTypeFetchConversionLimitsResponse, FfiConverterTypeFiatCurrency, FfiConverterTypeFiatService, FfiConverterTypeFreezeIssuerTokenRequest, FfiConverterTypeFreezeIssuerTokenResponse, FfiConverterTypeGetInfoRequest, FfiConverterTypeGetInfoResponse, FfiConverterTypeGetPaymentRequest, FfiConverterTypeGetPaymentResponse, FfiConverterTypeGetSparkStatusRequest, FfiConverterTypeGetTokensMetadataRequest, FfiConverterTypeGetTokensMetadataResponse, FfiConverterTypeHashedMessageBytes, FfiConverterTypeIdentifierCommitmentPair, FfiConverterTypeIdentifierPublicKeyPair, FfiConverterTypeIdentifierSignaturePair, FfiConverterTypeImportUnilateralExitStateRequest, FfiConverterTypeImportUnilateralExitStateResponse, FfiConverterTypeIncomingChange, FfiConverterTypeInputType, FfiConverterTypeInstantClaimStatus, FfiConverterTypeLeafOptimizationConfig, FfiConverterTypeLightningAddressDetails, FfiConverterTypeLightningAddressInfo, FfiConverterTypeListContactsRequest, FfiConverterTypeListFiatCurrenciesResponse, FfiConverterTypeListFiatRatesResponse, FfiConverterTypeListPaymentsRequest, FfiConverterTypeListPaymentsResponse, FfiConverterTypeListUnclaimedDepositsRequest, FfiConverterTypeListUnclaimedDepositsResponse, FfiConverterTypeLnurlAuthRequestDetails, FfiConverterTypeLnurlCallbackStatus, FfiConverterTypeLnurlErrorDetails, FfiConverterTypeLnurlInfo, FfiConverterTypeLnurlPayContext, FfiConverterTypeLnurlPayInfo, FfiConverterTypeLnurlPayRequest, FfiConverterTypeLnurlPayRequestDetails, FfiConverterTypeLnurlPayResponse, FfiConverterTypeLnurlReceiveMetadata, FfiConverterTypeLnurlWithdrawInfo, FfiConverterTypeLnurlWithdrawRequest, FfiConverterTypeLnurlWithdrawRequestDetails, FfiConverterTypeLnurlWithdrawResponse, FfiConverterTypeLocaleOverrides, FfiConverterTypeLocalizedName, FfiConverterTypeLogEntry, FfiConverterTypeMaxFee, FfiConverterTypeMessageBytes, FfiConverterTypeMessageSuccessActionData, FfiConverterTypeMintIssuerTokenRequest, FfiConverterTypeNetwork, FfiConverterTypeNewRestChainServiceRequest, FfiConverterTypeOnchainConfirmationSpeed, FfiConverterTypeOptimizationMode, FfiConverterTypeOptimizationOutcome, FfiConverterTypeOptimizeLeavesRequest, FfiConverterTypeOptimizeLeavesResponse, FfiConverterTypeOutgoingChange, FfiConverterTypeOutspend, FfiConverterTypePasskeyAvailability, FfiConverterTypePasskeyClient, FfiConverterTypePasskeyConfig, FfiConverterTypePasskeyCredential, FfiConverterTypePasskeyError, FfiConverterTypePasskeyLabels, FfiConverterTypePasskeyProviderOptions, FfiConverterTypePayment, FfiConverterTypePaymentDetails, FfiConverterTypePaymentDetailsFilter, FfiConverterTypePaymentIdUpdate, FfiConverterTypePaymentMetadata, FfiConverterTypePaymentMethod, FfiConverterTypePaymentObserver, FfiConverterTypePaymentObserverError, FfiConverterTypePaymentRequest, FfiConverterTypePaymentRequestSource, FfiConverterTypePaymentStatus, FfiConverterTypePaymentType, FfiConverterTypePerBranchFunding, FfiConverterTypePrepareLnurlPayRequest, FfiConverterTypePrepareLnurlPayResponse, FfiConverterTypePreparePaymentLinkRequest, FfiConverterTypePreparePaymentLinkResponse, FfiConverterTypePrepareSendBatchRequest, FfiConverterTypePrepareSendBatchResponse, FfiConverterTypePrepareSendPaymentRequest, FfiConverterTypePrepareSendPaymentResponse, FfiConverterTypePrepareUnilateralExitRequest, FfiConverterTypePrepareUnilateralExitResponse, FfiConverterTypePrfProvider, FfiConverterTypePrfProviderError, FfiConverterTypeProvisionalPayment, FfiConverterTypeProvisionalPaymentDetails, FfiConverterTypeProxyConfig, FfiConverterTypePublicKey, FfiConverterTypePublicKeyBytes, FfiConverterTypePublishSignedLnurlPayPackageRequest, FfiConverterTypePublishSignedLnurlPayResponse, FfiConverterTypePublishSignedTransferPackageRequest, FfiConverterTypePublishSignedTransferPackageResponse, FfiConverterTypeRate, FfiConverterTypeReceivePaymentMethod, FfiConverterTypeReceivePaymentRequest, FfiConverterTypeReceivePaymentResponse, FfiConverterTypeRecommendedFees, FfiConverterTypeRecord, FfiConverterTypeRecordChange, FfiConverterTypeRecordId, FfiConverterTypeRecoverableEcdsaSignatureBytes, FfiConverterTypeRefundDepositRequest, FfiConverterTypeRefundDepositResponse, FfiConverterTypeRefundPendingConversionsResponse, FfiConverterTypeRefundState, FfiConverterTypeRegisterLightningAddressRequest, FfiConverterTypeRegisterRequest, FfiConverterTypeRegisterResponse, FfiConverterTypeRegisterWebhookRequest, FfiConverterTypeRegisterWebhookResponse, FfiConverterTypeResolvedBatchRecipient, FfiConverterTypeResolvedStores, FfiConverterTypeRestClient, FfiConverterTypeRestResponse, FfiConverterTypeSchnorrSignatureBytes, FfiConverterTypeSdkBuilder, FfiConverterTypeSdkContext, FfiConverterTypeSdkContextConfig, FfiConverterTypeSdkError, FfiConverterTypeSdkEvent, FfiConverterTypeSecretBytes, FfiConverterTypeSeed, FfiConverterTypeSendBatchRequest, FfiConverterTypeSendBatchResponse, FfiConverterTypeSendOnchainFeeQuote, FfiConverterTypeSendOnchainSpeedFeeQuote, FfiConverterTypeSendPaymentMethod, FfiConverterTypeSendPaymentOptions, FfiConverterTypeSendPaymentRequest, FfiConverterTypeSendPaymentResponse, FfiConverterTypeServiceConnectivityError, FfiConverterTypeServiceStatus, FfiConverterTypeSession, FfiConverterTypeSessionStore, FfiConverterTypeSessionStoreError, FfiConverterTypeSetLnurlMetadataItem, FfiConverterTypeSetupWalletRequest, FfiConverterTypeSignInRequest, FfiConverterTypeSignInResponse, FfiConverterTypeSignMessageRequest, FfiConverterTypeSignMessageResponse, FfiConverterTypeSignedTransferPackage, FfiConverterTypeSignerError, FfiConverterTypeSigningOnlyExternalSigners, FfiConverterTypeSilentPaymentAddressDetails, FfiConverterTypeSparkAddressDetails, FfiConverterTypeSparkAsset, FfiConverterTypeSparkConfig, FfiConverterTypeSparkHtlcDetails, FfiConverterTypeSparkHtlcOptions, FfiConverterTypeSparkHtlcStatus, FfiConverterTypeSparkInvoiceDetails, FfiConverterTypeSparkInvoicePaymentDetails, FfiConverterTypeSparkMasterIdentityPublicKey, FfiConverterTypeSparkSigningOperator, FfiConverterTypeSparkSspConfig, FfiConverterTypeSparkStatus, FfiConverterTypeStableBalanceActiveLabel, FfiConverterTypeStableBalanceConfig, FfiConverterTypeStableBalanceToken, FfiConverterTypeStorage, FfiConverterTypeStorageBackend, FfiConverterTypeStorageError, FfiConverterTypeStorageListPaymentsRequest, FfiConverterTypeStoragePaymentDetailsFilter, FfiConverterTypeStoredCrossChainSwap, FfiConverterTypeSuccessAction, FfiConverterTypeSuccessActionProcessed, FfiConverterTypeSwapDegradation, FfiConverterTypeSymbol, FfiConverterTypeSyncWalletRequest, FfiConverterTypeSyncWalletResponse, FfiConverterTypeTokenBalance, FfiConverterTypeTokenIssuer, FfiConverterTypeTokenMetadata, FfiConverterTypeTokenOptimizationConfig, FfiConverterTypeTokenTransactionType, FfiConverterTypeTransferAuthorization, FfiConverterTypeTransferSignature, FfiConverterTypeTransferTarget, FfiConverterTypeTurnkeyConfig, FfiConverterTypeTurnkeyRetryConfig, FfiConverterTypeTxStatus, FfiConverterTypeUnfreezeIssuerTokenRequest, FfiConverterTypeUnfreezeIssuerTokenResponse, FfiConverterTypeUnilateralExitLeaf, FfiConverterTypeUnilateralExitRedoReason, FfiConverterTypeUnilateralExitRequest, FfiConverterTypeUnilateralExitResponse, FfiConverterTypeUnilateralExitTransaction, FfiConverterTypeUnilateralExitTxKind, FfiConverterTypeUnilateralExitVerdict, FfiConverterTypeUnregisterWebhookRequest, FfiConverterTypeUnsignedTransferPackage, FfiConverterTypeUnversionedRecordChange, FfiConverterTypeUpdateContactRequest, FfiConverterTypeUpdateDepositPayload, FfiConverterTypeUpdateUserSettingsRequest, FfiConverterTypeUrlSuccessActionData, FfiConverterTypeUserSettings, FfiConverterTypeUtxo, FfiConverterTypeWallet, FfiConverterTypeWalletSetup, FfiConverterTypeWebhook, FfiConverterTypeWebhookEventType, FfiConverterTypeu128, }, });