// 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! /* tslint:disable */ /* eslint-disable */ // @ts-nocheck import nativeModule from "./payjoin-ffi"; import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDroppedCallback, type UniffiForeignFutureDroppedCallbackStruct, type UniffiVTableCallbackInterfacePayjoinCanBroadcast, type UniffiVTableCallbackInterfacePayjoinIsInputOwned, type UniffiVTableCallbackInterfacePayjoinIsOutputKnown, type UniffiVTableCallbackInterfacePayjoinIsScriptOwned, type UniffiVTableCallbackInterfacePayjoinJsonReceiverSessionPersister, type UniffiForeignFutureResultVoid, type UniffiForeignFutureCompletevoid, type UniffiForeignFutureResultRustBuffer, type UniffiForeignFutureCompleterustBuffer, type UniffiVTableCallbackInterfacePayjoinJsonReceiverSessionPersisterAsync, type UniffiVTableCallbackInterfacePayjoinJsonSenderSessionPersister, type UniffiVTableCallbackInterfacePayjoinJsonSenderSessionPersisterAsync, type UniffiVTableCallbackInterfacePayjoinProcessPsbt, type UniffiVTableCallbackInterfacePayjoinTransactionFinder, } from "./payjoin-ffi"; import { type FfiConverter, type UniffiByteArray, type UniffiGcObject, type UniffiHandle, type UniffiObjectFactory, type UniffiReferenceHolder, type UniffiRustCallStatus, AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterInt32, FfiConverterObject, FfiConverterObjectAsError, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, UniffiThrownObject, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCallAsyncWithError, uniffiTraitInterfaceCallWithError, uniffiTypeNameSymbol, variantOrdinalSymbol, } from "@ubjs/core"; 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. /** * Fetch the OHTTP keys for a payjoin directory, proxied via an OHTTP relay. * * * `ohttp_relay` — HTTP `CONNECT` proxy used to request the keys. Proxying * ensures the client IP address is never revealed to the directory. * * `payjoin_directory` — directory to fetch the keys from. It stores and * forwards payjoin client payloads. * * Returns keys suitable for passing to a receiver session. */ export async function fetchOhttpKeys( ohttpRelay: string, payjoinDirectory: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_func_fetch_ohttp_keys( FfiConverterString.lower(ohttpRelay, nativeModule().rustbuffer_alloc), FfiConverterString.lower( payjoinDirectory, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeOhttpKeys.lift.bind( FfiConverterTypeOhttpKeys ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeOhttpKeysFetchError.lift.bind( FfiConverterTypeOhttpKeysFetchError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } /** * Applies the receiver's finalized inputs onto a cleared proposal PSBT. * * Exposed because every receiver finalize callback needs it, including the * BIP77 (v2) `finalize_proposal` path, where the callback runs in the host * language. PDK hands that callback a PSBT with the sender's finals stripped, so * returning the wallet-signed PSBT wholesale would reintroduce the sender's * finals and yield an invalid proposal. Copying per-input is the correct merge. * * * `cleared_psbt_base64` — the PSBT handed to the finalize callback. * * `signed_psbt_base64` — the same PSBT after the receiver's wallet signed it. */ export function mergeFinalizedProposalInputs( clearedPsbtBase64: string, signedPsbtBase64: string ): string /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeManualReceiveError.lift.bind( FfiConverterTypeManualReceiveError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_func_merge_finalized_proposal_inputs( FfiConverterString.lower( clearedPsbtBase64, nativeModule().rustbuffer_alloc ), FfiConverterString.lower( signedPsbtBase64, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Offline receiver step 1: ingest the sender's Original PSBT, run the receiver * checks, contribute one input, and return the provisional PSBT to sign. * * * `owned_scripts_hex` — the receiver's own scriptPubKeys, used to identify * which outputs belong to the receiver alongside `receive_address`. * * `owned_outpoints` — the receiver's wallet outpoints, formatted `txid:vout`. * Rejecting an Original PSBT that spends these stops a sender from getting the * receiver to spend its own coins. * * `seen_outpoints` — outpoints from previous payjoin sessions, formatted * `txid:vout`. Rejecting these blocks probing attacks that replay inputs to * discover the receiver's UTXO set. * * The broadcast-suitability check is skipped: an interactive receiver imports * the Original PSBT deliberately, so the anti-probing guard that check provides * is unnecessary and it would require a mempool connection this path lacks. */ export function receiverManualContribute( originalPsbtBase64: string, receiveAddress: string, disableOutputSubstitution: boolean, input: ManualReceiverInput, ownedScriptsHex: Array, ownedOutpoints: Array, seenOutpoints: Array ): ManualContributeResult /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterTypeManualContributeResult.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeManualReceiveError.lift.bind( FfiConverterTypeManualReceiveError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_func_receiver_manual_contribute( FfiConverterString.lower( originalPsbtBase64, nativeModule().rustbuffer_alloc ), FfiConverterString.lower( receiveAddress, nativeModule().rustbuffer_alloc ), FfiConverterBool.lower( disableOutputSubstitution, nativeModule().rustbuffer_alloc ), FfiConverterTypeManualReceiverInput.lower( input, nativeModule().rustbuffer_alloc ), FfiConverterSequenceString.lower( ownedScriptsHex, nativeModule().rustbuffer_alloc ), FfiConverterSequenceString.lower( ownedOutpoints, nativeModule().rustbuffer_alloc ), FfiConverterSequenceString.lower( seenOutpoints, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Offline receiver step 2: finalize the proposal from the state returned by * [`receiver_manual_contribute`] and the receiver-signed provisional PSBT. * * Returns the proposal PSBT to hand back to the sender out of band. */ export function receiverManualFinalize( provisionalState: string, signedPsbtBase64: string ): ManualFinalizeResult /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterTypeManualFinalizeResult.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeManualReceiveError.lift.bind( FfiConverterTypeManualReceiveError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_func_receiver_manual_finalize( FfiConverterString.lower( provisionalState, nativeModule().rustbuffer_alloc ), FfiConverterString.lower( signedPsbtBase64, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } export function replayReceiverEventLog( persister: JsonReceiverSessionPersister ): ReplayResultLike /*throws*/ { return FfiConverterTypeReplayResult.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverReplayError__as_error.lift.bind( FfiConverterTypeReceiverReplayError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_func_replay_receiver_event_log( FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } export async function replayReceiverEventLogAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_func_replay_receiver_event_log_async( FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeReplayResult.lift.bind( FfiConverterTypeReplayResult ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverReplayError__as_error.lift.bind( FfiConverterTypeReceiverReplayError__as_error ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } export function replaySenderEventLog( persister: JsonSenderSessionPersister ): SenderReplayResultLike /*throws*/ { return FfiConverterTypeSenderReplayResult.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSenderReplayError__as_error.lift.bind( FfiConverterTypeSenderReplayError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_func_replay_sender_event_log( FfiConverterTypeJsonSenderSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } export async function replaySenderEventLogAsync( persister: JsonSenderSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_func_replay_sender_event_log_async( FfiConverterTypeJsonSenderSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeSenderReplayResult.lift.bind( FfiConverterTypeSenderReplayResult ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSenderReplayError__as_error.lift.bind( FfiConverterTypeSenderReplayError__as_error ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } // Hermes (React Native ≥ 0.74) ships TextEncoder and encodeInto, but not // TextDecoder. For single-string decode (bytesToString), we polyfill via the // C++ string_from_buffer helper using a duck-typed object matching the // standard TextDecoder.decode signature. Once Hermes ships a real // TextDecoder, the `typeof` check will pick it up automatically. // // For array-of-strings decode (readStringFromBuffer), we keep a dedicated C++ // helper: the polyfill path (new Uint8Array view + decode) measured ~40% // slower on getStringArray benchmarks than a direct (buf, offset, length) // call, due to the per-read view allocation and extra property lookups in // string_from_buffer. const stringConverter = (() => { const encoder = new TextEncoder(); const decoder: { decode(input: UniffiByteArray): string } = typeof TextDecoder !== "undefined" ? new TextDecoder() : { decode: (bytes: UniffiByteArray) => nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_from_buffer( bytes, undefined as any ) as string, }; return { // Single-string lower() uses the C++ helper — TextEncoder.encode // measured ~43% slower on takeString benchmarks. stringToBytes: (s: string) => nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_buffer( s, undefined as any ), bytesToString: (ab: UniffiByteArray) => decoder.decode(ab), // Direct C++ call — bypasses uniffiCaller.rustCall() overhead. // Matters for N-element arrays. stringByteLength: (s: string) => nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length( s, undefined as any ) as number, // Encode directly into the RustBuffer backing store via // TextEncoder.encodeInto — zero intermediate allocation. Replaces // the old C++ write_string_into_buffer helper. writeStringIntoBuffer: (s: string, buf: any, offset: number): number => { const view = new Uint8Array( buf.arrayBuffer, offset, buf.arrayBuffer.byteLength - offset ); return encoder.encodeInto(s, view).written; }, // Dedicated C++ helper — avoids per-read Uint8Array allocation and // the double property-lookup in string_from_buffer. readStringFromBuffer: (buf: any, offset: number, length: number): string => nativeModule().ubrn_uniffi_internal_fn_func_ffi__read_string_from_buffer( buf, offset, length ) as string, }; })(); const FfiConverterString = uniffiCreateFfiConverterString(stringConverter); /** * Result of [`receiver_manual_contribute`]. */ export type ManualContributeResult = { /** * PSBT for the receiver's wallet to sign. */ provisionalPsbtBase64: string; /** * Opaque resumable state to pass to [`receiver_manual_finalize`]. */ provisionalState: string; }; /** * Generated factory for {@link ManualContributeResult} record objects. */ export const ManualContributeResult = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ManualContributeResult, ReturnType >(defaults); })(); return Object.freeze({ create, new: create, defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeManualContributeResult = (() => { type TypeName = ManualContributeResult; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { provisionalPsbtBase64: FfiConverterString.read(from), provisionalState: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.provisionalPsbtBase64, into); FfiConverterString.write(value.provisionalState, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.provisionalPsbtBase64) + FfiConverterString.allocationSize(value.provisionalState) ); } } return new FFIConverter(); })(); /** * Result of [`receiver_manual_finalize`]. */ export type ManualFinalizeResult = { /** * Proposal PSBT to hand back to the sender out of band. */ proposalPsbtBase64: string; }; /** * Generated factory for {@link ManualFinalizeResult} record objects. */ export const ManualFinalizeResult = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord< ManualFinalizeResult, ReturnType >(defaults); })(); return Object.freeze({ create, new: create, defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeManualFinalizeResult = (() => { type TypeName = ManualFinalizeResult; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { proposalPsbtBase64: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.proposalPsbtBase64, into); } allocationSize(value: TypeName): number { return FfiConverterString.allocationSize(value.proposalPsbtBase64); } } return new FFIConverter(); })(); /** * A wallet UTXO offered as the receiver's contribution. */ export type ManualReceiverInput = { /** * Hex-encoded txid (big-endian), as displayed by explorers. */ txid: string; /** * Output index. */ vout: number; /** * Amount in satoshis. */ value: bigint; /** * Hex-encoded scriptPubKey. */ scriptHex: string; }; /** * Generated factory for {@link ManualReceiverInput} record objects. */ export const ManualReceiverInput = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ create, new: create, defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeManualReceiverInput = (() => { type TypeName = ManualReceiverInput; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { txid: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), value: FfiConverterUInt64.read(from), scriptHex: FfiConverterString.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.txid, into); FfiConverterUInt32.write(value.vout, into); FfiConverterUInt64.write(value.value, into); FfiConverterString.write(value.scriptHex, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.txid) + FfiConverterUInt32.allocationSize(value.vout) + FfiConverterUInt64.allocationSize(value.value) + FfiConverterString.allocationSize(value.scriptHex) ); } } return new FFIConverter(); })(); /** * Primitive representation of an outpoint for the FFI boundary. */ export type OutPoint = { /** * Hex-encoded txid (big-endian). */ txid: string; /** * Output index. */ vout: number; }; /** * Generated factory for {@link OutPoint} record objects. */ export const OutPoint = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ create, new: create, defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeOutPoint = (() => { type TypeName = OutPoint; 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(); })(); /** * Primitive representation of a transaction output for the FFI boundary. */ export type TxOut = { /** * Amount in satoshis. */ valueSat: bigint; /** * Raw scriptPubKey bytes. */ scriptPubkey: ArrayBuffer; }; /** * Generated factory for {@link TxOut} record objects. */ export const TxOut = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ create, new: create, defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeTxOut = (() => { type TypeName = TxOut; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { valueSat: FfiConverterUInt64.read(from), scriptPubkey: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt64.write(value.valueSat, into); FfiConverterArrayBuffer.write(value.scriptPubkey, into); } allocationSize(value: TypeName): number { return ( FfiConverterUInt64.allocationSize(value.valueSat) + FfiConverterArrayBuffer.allocationSize(value.scriptPubkey) ); } } return new FFIConverter(); })(); /** * Primitive representation of a PSBT input for the FFI boundary. */ export type PsbtInput = { witnessUtxo?: TxOut; redeemScript?: ArrayBuffer; witnessScript?: ArrayBuffer; }; /** * Generated factory for {@link PsbtInput} record objects. */ export const PsbtInput = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ create, new: create, defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypePsbtInput = (() => { type TypeName = PsbtInput; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { witnessUtxo: FfiConverterOptionalTypeTxOut.read(from), redeemScript: FfiConverterOptionalBytes.read(from), witnessScript: FfiConverterOptionalBytes.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterOptionalTypeTxOut.write(value.witnessUtxo, into); FfiConverterOptionalBytes.write(value.redeemScript, into); FfiConverterOptionalBytes.write(value.witnessScript, into); } allocationSize(value: TypeName): number { return ( FfiConverterOptionalTypeTxOut.allocationSize(value.witnessUtxo) + FfiConverterOptionalBytes.allocationSize(value.redeemScript) + FfiConverterOptionalBytes.allocationSize(value.witnessScript) ); } } return new FFIConverter(); })(); /** * Represents data that needs to be transmitted to the receiver. * You need to send this request over HTTP(S) to the receiver. */ export type Request = { /** * URL to send the request to. * * This is full URL with scheme etc - you can pass it right to `reqwest` or a similar library. */ url: string; /** * The `Content-Type` header to use for the request. * * `text/plain` for v1 requests and `message/ohttp-req` for v2 requests. */ contentType: string; /** * Bytes to be sent to the receiver. * * This is properly encoded PSBT payload either in base64 in v1 or an OHTTP encapsulated payload in v2. */ body: ArrayBuffer; }; /** * Generated factory for {@link Request} record objects. */ export const Request = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ create, new: create, defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRequest = (() => { type TypeName = Request; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { url: FfiConverterString.read(from), contentType: FfiConverterString.read(from), body: FfiConverterArrayBuffer.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterString.write(value.url, into); FfiConverterString.write(value.contentType, into); FfiConverterArrayBuffer.write(value.body, into); } allocationSize(value: TypeName): number { return ( FfiConverterString.allocationSize(value.url) + FfiConverterString.allocationSize(value.contentType) + FfiConverterArrayBuffer.allocationSize(value.body) ); } } return new FFIConverter(); })(); export interface ClientResponseLike {} /** * @deprecated Use `ClientResponseLike` instead. */ export type ClientResponseInterface = ClientResponseLike; export class ClientResponse extends UniffiAbstractObject implements ClientResponseLike { readonly [uniffiTypeNameSymbol] = "ClientResponse"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeClientResponseObjectFactory.bless(pointer); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeClientResponseObjectFactory.pointer(this); uniffiTypeClientResponseObjectFactory.freePointer(pointer); uniffiTypeClientResponseObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ClientResponse { return uniffiTypeClientResponseObjectFactory.isConcreteType(obj_); } } const uniffiTypeClientResponseObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ClientResponseLike { const instance = Object.create(ClientResponse.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ClientResponse"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_clientresponse_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ClientResponseLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ClientResponseLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_clientresponse( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_clientresponse( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ClientResponseLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ClientResponse" ); }, }; })(); const FfiConverterTypeClientResponse = new FfiConverterObject( uniffiTypeClientResponseObjectFactory ); export type RequestOhttpContext = { request: Request; ohttpCtx: ClientResponseLike; }; /** * Generated factory for {@link RequestOhttpContext} record objects. */ export const RequestOhttpContext = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ create, new: create, defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRequestOhttpContext = (() => { type TypeName = RequestOhttpContext; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { request: FfiConverterTypeRequest.read(from), ohttpCtx: FfiConverterTypeClientResponse.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeRequest.write(value.request, into); FfiConverterTypeClientResponse.write(value.ohttpCtx, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeRequest.allocationSize(value.request) + FfiConverterTypeClientResponse.allocationSize(value.ohttpCtx) ); } } return new FFIConverter(); })(); export type RequestResponse = { request: Request; clientResponse: ClientResponseLike; }; /** * Generated factory for {@link RequestResponse} record objects. */ export const RequestResponse = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ create, new: create, defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRequestResponse = (() => { type TypeName = RequestResponse; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { request: FfiConverterTypeRequest.read(from), clientResponse: FfiConverterTypeClientResponse.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeRequest.write(value.request, into); FfiConverterTypeClientResponse.write(value.clientResponse, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeRequest.allocationSize(value.request) + FfiConverterTypeClientResponse.allocationSize(value.clientResponse) ); } } return new FFIConverter(); })(); /** * BIP-78 well-known error code, surfaced to bindings so senders can branch * on the code instead of parsing the Display string. */ export enum ErrorCode { /** * The payjoin endpoint is not available for now. */ Unavailable, /** * The receiver added some inputs but could not bump the fee. */ NotEnoughMoney, /** * This version of payjoin is not supported. */ VersionUnsupported, /** * The receiver rejected the original PSBT. */ OriginalPsbtRejected, /** * A well-known code newer than this binding understands. */ Unrecognized, } const FfiConverterTypeErrorCode = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ErrorCode; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return ErrorCode.Unavailable; case 2: return ErrorCode.NotEnoughMoney; case 3: return ErrorCode.VersionUnsupported; case 4: return ErrorCode.OriginalPsbtRejected; case 5: return ErrorCode.Unrecognized; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case ErrorCode.Unavailable: return ordinalConverter.write(1, into); case ErrorCode.NotEnoughMoney: return ordinalConverter.write(2, into); case ErrorCode.VersionUnsupported: return ordinalConverter.write(3, into); case ErrorCode.OriginalPsbtRejected: return ordinalConverter.write(4, into); case ErrorCode.Unrecognized: return ordinalConverter.write(5, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); /** * A well-known error that can be safely displayed to end users. */ export interface WellKnownErrorLike { /** * Return the BIP-78 well-known error code, letting senders branch on it * instead of parsing the Display string. */ code(): ErrorCode; } /** * @deprecated Use `WellKnownErrorLike` instead. */ export type WellKnownErrorInterface = WellKnownErrorLike; /** * A well-known error that can be safely displayed to end users. */ export class WellKnownError extends UniffiAbstractObject implements WellKnownErrorLike { readonly [uniffiTypeNameSymbol] = "WellKnownError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeWellKnownErrorObjectFactory.bless(pointer); } /** * Return the BIP-78 well-known error code, letting senders branch on it * instead of parsing the Display string. */ code(): ErrorCode { return ((__rb: Uint8Array) => { try { return FfiConverterTypeErrorCode.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wellknownerror_code( uniffiTypeWellKnownErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wellknownerror_uniffi_trait_display( uniffiTypeWellKnownErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wellknownerror_uniffi_trait_debug( uniffiTypeWellKnownErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeWellKnownErrorObjectFactory.pointer(this); uniffiTypeWellKnownErrorObjectFactory.freePointer(pointer); uniffiTypeWellKnownErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is WellKnownError { return uniffiTypeWellKnownErrorObjectFactory.isConcreteType(obj_); } } const uniffiTypeWellKnownErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): WellKnownErrorLike { const instance = Object.create(WellKnownError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "WellKnownError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_wellknownerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: WellKnownErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: WellKnownErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_wellknownerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_wellknownerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is WellKnownErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "WellKnownError" ); }, }; })(); const FfiConverterTypeWellKnownError = new FfiConverterObject( uniffiTypeWellKnownErrorObjectFactory ); /** * Error that may occur when the response from receiver is malformed. */ export interface ValidationErrorLike {} /** * @deprecated Use `ValidationErrorLike` instead. */ export type ValidationErrorInterface = ValidationErrorLike; /** * Error that may occur when the response from receiver is malformed. */ export class ValidationError extends UniffiAbstractObject implements ValidationErrorLike { readonly [uniffiTypeNameSymbol] = "ValidationError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeValidationErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_validationerror_uniffi_trait_display( uniffiTypeValidationErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_validationerror_uniffi_trait_debug( uniffiTypeValidationErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeValidationErrorObjectFactory.pointer(this); uniffiTypeValidationErrorObjectFactory.freePointer(pointer); uniffiTypeValidationErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ValidationError { return uniffiTypeValidationErrorObjectFactory.isConcreteType(obj_); } } const uniffiTypeValidationErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ValidationErrorLike { const instance = Object.create(ValidationError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ValidationError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_validationerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ValidationErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ValidationErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_validationerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_validationerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ValidationErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ValidationError" ); }, }; })(); const FfiConverterTypeValidationError = new FfiConverterObject( uniffiTypeValidationErrorObjectFactory ); // Error type: ResponseError export enum ResponseError_Tags { WellKnown = "WellKnown", Validation = "Validation", Unrecognized = "Unrecognized", } /** * Represent an error returned by Payjoin receiver. */ export const ResponseError = (() => { type WellKnown__interface = { tag: ResponseError_Tags.WellKnown; inner: Readonly<[WellKnownErrorLike]>; }; /** * `WellKnown` Errors are defined in the [`BIP78::ReceiverWellKnownError`] spec. * * It is safe to display `WellKnown` errors to end users. * * [`BIP78::ReceiverWellKnownError`]: https://github.com/bitcoin/bips/blob/master/bip-0078.mediawiki#user-content-Receivers_well_known_errors */ class WellKnown_ extends UniffiError implements WellKnown__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ResponseError"; readonly tag = ResponseError_Tags.WellKnown; readonly inner: Readonly<[WellKnownErrorLike]>; constructor(v0: WellKnownErrorLike) { super("ResponseError", "WellKnown"); this.inner = Object.freeze([v0]); } static new(v0: WellKnownErrorLike): WellKnown_ { return new WellKnown_(v0); } static instanceOf(obj: any): obj is WellKnown_ { return obj.tag === ResponseError_Tags.WellKnown; } static hasInner(obj: any): obj is WellKnown_ { return WellKnown_.instanceOf(obj); } static getInner(obj: WellKnown_): Readonly<[WellKnownErrorLike]> { return obj.inner; } } type Validation__interface = { tag: ResponseError_Tags.Validation; inner: Readonly<[ValidationErrorLike]>; }; /** * Errors caused by malformed responses. */ class Validation_ extends UniffiError implements Validation__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ResponseError"; readonly tag = ResponseError_Tags.Validation; readonly inner: Readonly<[ValidationErrorLike]>; constructor(v0: ValidationErrorLike) { super("ResponseError", "Validation"); this.inner = Object.freeze([v0]); } static new(v0: ValidationErrorLike): Validation_ { return new Validation_(v0); } static instanceOf(obj: any): obj is Validation_ { return obj.tag === ResponseError_Tags.Validation; } static hasInner(obj: any): obj is Validation_ { return Validation_.instanceOf(obj); } static getInner(obj: Validation_): Readonly<[ValidationErrorLike]> { return obj.inner; } } type Unrecognized__interface = { tag: ResponseError_Tags.Unrecognized; inner: Readonly<{ errorCode: string; msg: string }>; }; /** * `Unrecognized` Errors are NOT defined in the [`BIP78::ReceiverWellKnownError`] spec. * * It is NOT safe to display `Unrecognized` errors to end users as they could be used * maliciously to phish a non technical user. Only display them in debug logs. * * [`BIP78::ReceiverWellKnownError`]: https://github.com/bitcoin/bips/blob/master/bip-0078.mediawiki#user-content-Receivers_well_known_errors */ class Unrecognized_ extends UniffiError implements Unrecognized__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ResponseError"; readonly tag = ResponseError_Tags.Unrecognized; readonly inner: Readonly<{ errorCode: string; msg: string }>; constructor(inner: { errorCode: string; msg: string }) { super("ResponseError", "Unrecognized"); this.inner = Object.freeze(inner); } static new(inner: { errorCode: string; msg: string }): Unrecognized_ { return new Unrecognized_(inner); } static instanceOf(obj: any): obj is Unrecognized_ { return obj.tag === ResponseError_Tags.Unrecognized; } static hasInner(obj: any): obj is Unrecognized_ { return Unrecognized_.instanceOf(obj); } static getInner( obj: Unrecognized_ ): Readonly<{ errorCode: string; msg: string }> { return obj.inner; } } function instanceOf(obj: any): obj is ResponseError { return obj[uniffiTypeNameSymbol] === "ResponseError"; } return Object.freeze({ instanceOf, WellKnown: WellKnown_, Validation: Validation_, Unrecognized: Unrecognized_, }); })(); /** * Represent an error returned by Payjoin receiver. */ export type ResponseError = InstanceType< (typeof ResponseError)["WellKnown" | "Validation" | "Unrecognized"] >; // FfiConverter for enum ResponseError const FfiConverterTypeResponseError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ResponseError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ResponseError.WellKnown( FfiConverterTypeWellKnownError.read(from) ); case 2: return new ResponseError.Validation( FfiConverterTypeValidationError.read(from) ); case 3: return new ResponseError.Unrecognized({ errorCode: FfiConverterString.read(from), msg: FfiConverterString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ResponseError_Tags.WellKnown: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeWellKnownError.write(inner[0], into); return; } case ResponseError_Tags.Validation: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeValidationError.write(inner[0], into); return; } case ResponseError_Tags.Unrecognized: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner.errorCode, into); FfiConverterString.write(inner.msg, into); return; } default: // Throwing from here means that ResponseError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ResponseError_Tags.WellKnown: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeWellKnownError.allocationSize(inner[0]); return size; } case ResponseError_Tags.Validation: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeValidationError.allocationSize(inner[0]); return size; } case ResponseError_Tags.Unrecognized: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner.errorCode); size += FfiConverterString.allocationSize(inner.msg); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * Data required for validation of response. * This type is used to process the response. Get it from SenderBuilder's build methods. Then you only need to call .process_response() on it to continue BIP78 flow. */ export interface V1ContextLike { /** * Decodes and validates the response. * Call this method with response from receiver to continue BIP78 flow. If the response is valid you will get appropriate PSBT that you should sign and broadcast. */ processResponse(response: ArrayBuffer): /*throws*/ string; } /** * @deprecated Use `V1ContextLike` instead. */ export type V1ContextInterface = V1ContextLike; /** * Data required for validation of response. * This type is used to process the response. Get it from SenderBuilder's build methods. Then you only need to call .process_response() on it to continue BIP78 flow. */ export class V1Context extends UniffiAbstractObject implements V1ContextLike { readonly [uniffiTypeNameSymbol] = "V1Context"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeV1ContextObjectFactory.bless(pointer); } /** * Decodes and validates the response. * Call this method with response from receiver to continue BIP78 flow. If the response is valid you will get appropriate PSBT that you should sign and broadcast. */ processResponse(response: ArrayBuffer): string /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeResponseError.lift.bind( FfiConverterTypeResponseError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_v1context_process_response( uniffiTypeV1ContextObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower( response, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeV1ContextObjectFactory.pointer(this); uniffiTypeV1ContextObjectFactory.freePointer(pointer); uniffiTypeV1ContextObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is V1Context { return uniffiTypeV1ContextObjectFactory.isConcreteType(obj_); } } const uniffiTypeV1ContextObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): V1ContextLike { const instance = Object.create(V1Context.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "V1Context"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_v1context_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: V1ContextLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: V1ContextLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_v1context( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_v1context( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is V1ContextLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "V1Context" ); }, }; })(); const FfiConverterTypeV1Context = new FfiConverterObject( uniffiTypeV1ContextObjectFactory ); export type RequestV1Context = { request: Request; context: V1ContextLike; }; /** * Generated factory for {@link RequestV1Context} record objects. */ export const RequestV1Context = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>( defaults ); })(); return Object.freeze({ create, new: create, defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeRequestV1Context = (() => { type TypeName = RequestV1Context; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { request: FfiConverterTypeRequest.read(from), context: FfiConverterTypeV1Context.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeRequest.write(value.request, into); FfiConverterTypeV1Context.write(value.context, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeRequest.allocationSize(value.request) + FfiConverterTypeV1Context.allocationSize(value.context) ); } } return new FFIConverter(); })(); /** * Primitive representation of a transaction input for the FFI boundary. */ export type TxIn = { previousOutput: OutPoint; scriptSig: ArrayBuffer; sequence: number; witness: Array; }; /** * Generated factory for {@link TxIn} record objects. */ export const TxIn = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ create, new: create, defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeTxIn = (() => { type TypeName = TxIn; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { previousOutput: FfiConverterTypeOutPoint.read(from), scriptSig: FfiConverterArrayBuffer.read(from), sequence: FfiConverterUInt32.read(from), witness: FfiConverterSequenceBytes.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterTypeOutPoint.write(value.previousOutput, into); FfiConverterArrayBuffer.write(value.scriptSig, into); FfiConverterUInt32.write(value.sequence, into); FfiConverterSequenceBytes.write(value.witness, into); } allocationSize(value: TypeName): number { return ( FfiConverterTypeOutPoint.allocationSize(value.previousOutput) + FfiConverterArrayBuffer.allocationSize(value.scriptSig) + FfiConverterUInt32.allocationSize(value.sequence) + FfiConverterSequenceBytes.allocationSize(value.witness) ); } } return new FFIConverter(); })(); /** * Primitive representation of a weight measurement. */ export type Weight = { weightUnits: bigint; }; /** * Generated factory for {@link Weight} record objects. */ export const Weight = (() => { const defaults = () => ({}); const create = (() => { return uniffiCreateRecord>(defaults); })(); return Object.freeze({ create, new: create, defaults: () => Object.freeze(defaults()) as Partial, }); })(); const FfiConverterTypeWeight = (() => { type TypeName = Weight; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { return { weightUnits: FfiConverterUInt64.read(from), }; } write(value: TypeName, into: RustBuffer): void { FfiConverterUInt64.write(value.weightUnits, into); } allocationSize(value: TypeName): number { return FfiConverterUInt64.allocationSize(value.weightUnits); } } return new FFIConverter(); })(); // Error type: FfiValidationError export enum FfiValidationError_Tags { AmountOutOfRange = "AmountOutOfRange", ScriptEmpty = "ScriptEmpty", ScriptTooLarge = "ScriptTooLarge", WitnessItemsTooMany = "WitnessItemsTooMany", WitnessItemTooLarge = "WitnessItemTooLarge", WitnessTooLarge = "WitnessTooLarge", WeightOutOfRange = "WeightOutOfRange", FeeRateOutOfRange = "FeeRateOutOfRange", ExpirationOutOfRange = "ExpirationOutOfRange", } export const FfiValidationError = (() => { type AmountOutOfRange__interface = { tag: FfiValidationError_Tags.AmountOutOfRange; inner: Readonly<{ amountSat: bigint; maxSat: bigint }>; }; class AmountOutOfRange_ extends UniffiError implements AmountOutOfRange__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "FfiValidationError"; readonly tag = FfiValidationError_Tags.AmountOutOfRange; readonly inner: Readonly<{ amountSat: bigint; maxSat: bigint }>; constructor(inner: { amountSat: bigint; maxSat: bigint }) { super("FfiValidationError", "AmountOutOfRange"); this.inner = Object.freeze(inner); } static new(inner: { amountSat: bigint; maxSat: bigint; }): AmountOutOfRange_ { return new AmountOutOfRange_(inner); } static instanceOf(obj: any): obj is AmountOutOfRange_ { return obj.tag === FfiValidationError_Tags.AmountOutOfRange; } static hasInner(obj: any): obj is AmountOutOfRange_ { return AmountOutOfRange_.instanceOf(obj); } static getInner( obj: AmountOutOfRange_ ): Readonly<{ amountSat: bigint; maxSat: bigint }> { return obj.inner; } } type ScriptEmpty__interface = { tag: FfiValidationError_Tags.ScriptEmpty; inner: Readonly<{ field: string }>; }; class ScriptEmpty_ extends UniffiError implements ScriptEmpty__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "FfiValidationError"; readonly tag = FfiValidationError_Tags.ScriptEmpty; readonly inner: Readonly<{ field: string }>; constructor(inner: { field: string }) { super("FfiValidationError", "ScriptEmpty"); this.inner = Object.freeze(inner); } static new(inner: { field: string }): ScriptEmpty_ { return new ScriptEmpty_(inner); } static instanceOf(obj: any): obj is ScriptEmpty_ { return obj.tag === FfiValidationError_Tags.ScriptEmpty; } static hasInner(obj: any): obj is ScriptEmpty_ { return ScriptEmpty_.instanceOf(obj); } static getInner(obj: ScriptEmpty_): Readonly<{ field: string }> { return obj.inner; } } type ScriptTooLarge__interface = { tag: FfiValidationError_Tags.ScriptTooLarge; inner: Readonly<{ field: string; len: bigint; max: bigint }>; }; class ScriptTooLarge_ extends UniffiError implements ScriptTooLarge__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "FfiValidationError"; readonly tag = FfiValidationError_Tags.ScriptTooLarge; readonly inner: Readonly<{ field: string; len: bigint; max: bigint }>; constructor(inner: { field: string; len: bigint; max: bigint }) { super("FfiValidationError", "ScriptTooLarge"); this.inner = Object.freeze(inner); } static new(inner: { field: string; len: bigint; max: bigint; }): ScriptTooLarge_ { return new ScriptTooLarge_(inner); } static instanceOf(obj: any): obj is ScriptTooLarge_ { return obj.tag === FfiValidationError_Tags.ScriptTooLarge; } static hasInner(obj: any): obj is ScriptTooLarge_ { return ScriptTooLarge_.instanceOf(obj); } static getInner( obj: ScriptTooLarge_ ): Readonly<{ field: string; len: bigint; max: bigint }> { return obj.inner; } } type WitnessItemsTooMany__interface = { tag: FfiValidationError_Tags.WitnessItemsTooMany; inner: Readonly<{ count: bigint; max: bigint }>; }; class WitnessItemsTooMany_ extends UniffiError implements WitnessItemsTooMany__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "FfiValidationError"; readonly tag = FfiValidationError_Tags.WitnessItemsTooMany; readonly inner: Readonly<{ count: bigint; max: bigint }>; constructor(inner: { count: bigint; max: bigint }) { super("FfiValidationError", "WitnessItemsTooMany"); this.inner = Object.freeze(inner); } static new(inner: { count: bigint; max: bigint }): WitnessItemsTooMany_ { return new WitnessItemsTooMany_(inner); } static instanceOf(obj: any): obj is WitnessItemsTooMany_ { return obj.tag === FfiValidationError_Tags.WitnessItemsTooMany; } static hasInner(obj: any): obj is WitnessItemsTooMany_ { return WitnessItemsTooMany_.instanceOf(obj); } static getInner( obj: WitnessItemsTooMany_ ): Readonly<{ count: bigint; max: bigint }> { return obj.inner; } } type WitnessItemTooLarge__interface = { tag: FfiValidationError_Tags.WitnessItemTooLarge; inner: Readonly<{ index: bigint; len: bigint; max: bigint }>; }; class WitnessItemTooLarge_ extends UniffiError implements WitnessItemTooLarge__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "FfiValidationError"; readonly tag = FfiValidationError_Tags.WitnessItemTooLarge; readonly inner: Readonly<{ index: bigint; len: bigint; max: bigint }>; constructor(inner: { index: bigint; len: bigint; max: bigint }) { super("FfiValidationError", "WitnessItemTooLarge"); this.inner = Object.freeze(inner); } static new(inner: { index: bigint; len: bigint; max: bigint; }): WitnessItemTooLarge_ { return new WitnessItemTooLarge_(inner); } static instanceOf(obj: any): obj is WitnessItemTooLarge_ { return obj.tag === FfiValidationError_Tags.WitnessItemTooLarge; } static hasInner(obj: any): obj is WitnessItemTooLarge_ { return WitnessItemTooLarge_.instanceOf(obj); } static getInner( obj: WitnessItemTooLarge_ ): Readonly<{ index: bigint; len: bigint; max: bigint }> { return obj.inner; } } type WitnessTooLarge__interface = { tag: FfiValidationError_Tags.WitnessTooLarge; inner: Readonly<{ len: bigint; max: bigint }>; }; class WitnessTooLarge_ extends UniffiError implements WitnessTooLarge__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "FfiValidationError"; readonly tag = FfiValidationError_Tags.WitnessTooLarge; readonly inner: Readonly<{ len: bigint; max: bigint }>; constructor(inner: { len: bigint; max: bigint }) { super("FfiValidationError", "WitnessTooLarge"); this.inner = Object.freeze(inner); } static new(inner: { len: bigint; max: bigint }): WitnessTooLarge_ { return new WitnessTooLarge_(inner); } static instanceOf(obj: any): obj is WitnessTooLarge_ { return obj.tag === FfiValidationError_Tags.WitnessTooLarge; } static hasInner(obj: any): obj is WitnessTooLarge_ { return WitnessTooLarge_.instanceOf(obj); } static getInner( obj: WitnessTooLarge_ ): Readonly<{ len: bigint; max: bigint }> { return obj.inner; } } type WeightOutOfRange__interface = { tag: FfiValidationError_Tags.WeightOutOfRange; inner: Readonly<{ weightUnits: bigint; maxWu: bigint }>; }; class WeightOutOfRange_ extends UniffiError implements WeightOutOfRange__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "FfiValidationError"; readonly tag = FfiValidationError_Tags.WeightOutOfRange; readonly inner: Readonly<{ weightUnits: bigint; maxWu: bigint }>; constructor(inner: { weightUnits: bigint; maxWu: bigint }) { super("FfiValidationError", "WeightOutOfRange"); this.inner = Object.freeze(inner); } static new(inner: { weightUnits: bigint; maxWu: bigint; }): WeightOutOfRange_ { return new WeightOutOfRange_(inner); } static instanceOf(obj: any): obj is WeightOutOfRange_ { return obj.tag === FfiValidationError_Tags.WeightOutOfRange; } static hasInner(obj: any): obj is WeightOutOfRange_ { return WeightOutOfRange_.instanceOf(obj); } static getInner( obj: WeightOutOfRange_ ): Readonly<{ weightUnits: bigint; maxWu: bigint }> { return obj.inner; } } type FeeRateOutOfRange__interface = { tag: FfiValidationError_Tags.FeeRateOutOfRange; inner: Readonly<{ value: bigint; unit: string }>; }; class FeeRateOutOfRange_ extends UniffiError implements FeeRateOutOfRange__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "FfiValidationError"; readonly tag = FfiValidationError_Tags.FeeRateOutOfRange; readonly inner: Readonly<{ value: bigint; unit: string }>; constructor(inner: { value: bigint; unit: string }) { super("FfiValidationError", "FeeRateOutOfRange"); this.inner = Object.freeze(inner); } static new(inner: { value: bigint; unit: string }): FeeRateOutOfRange_ { return new FeeRateOutOfRange_(inner); } static instanceOf(obj: any): obj is FeeRateOutOfRange_ { return obj.tag === FfiValidationError_Tags.FeeRateOutOfRange; } static hasInner(obj: any): obj is FeeRateOutOfRange_ { return FeeRateOutOfRange_.instanceOf(obj); } static getInner( obj: FeeRateOutOfRange_ ): Readonly<{ value: bigint; unit: string }> { return obj.inner; } } type ExpirationOutOfRange__interface = { tag: FfiValidationError_Tags.ExpirationOutOfRange; inner: Readonly<{ seconds: bigint; max: bigint }>; }; class ExpirationOutOfRange_ extends UniffiError implements ExpirationOutOfRange__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "FfiValidationError"; readonly tag = FfiValidationError_Tags.ExpirationOutOfRange; readonly inner: Readonly<{ seconds: bigint; max: bigint }>; constructor(inner: { seconds: bigint; max: bigint }) { super("FfiValidationError", "ExpirationOutOfRange"); this.inner = Object.freeze(inner); } static new(inner: { seconds: bigint; max: bigint }): ExpirationOutOfRange_ { return new ExpirationOutOfRange_(inner); } static instanceOf(obj: any): obj is ExpirationOutOfRange_ { return obj.tag === FfiValidationError_Tags.ExpirationOutOfRange; } static hasInner(obj: any): obj is ExpirationOutOfRange_ { return ExpirationOutOfRange_.instanceOf(obj); } static getInner( obj: ExpirationOutOfRange_ ): Readonly<{ seconds: bigint; max: bigint }> { return obj.inner; } } function instanceOf(obj: any): obj is FfiValidationError { return obj[uniffiTypeNameSymbol] === "FfiValidationError"; } return Object.freeze({ instanceOf, AmountOutOfRange: AmountOutOfRange_, ScriptEmpty: ScriptEmpty_, ScriptTooLarge: ScriptTooLarge_, WitnessItemsTooMany: WitnessItemsTooMany_, WitnessItemTooLarge: WitnessItemTooLarge_, WitnessTooLarge: WitnessTooLarge_, WeightOutOfRange: WeightOutOfRange_, FeeRateOutOfRange: FeeRateOutOfRange_, ExpirationOutOfRange: ExpirationOutOfRange_, }); })(); export type FfiValidationError = InstanceType< (typeof FfiValidationError)[ | "AmountOutOfRange" | "ScriptEmpty" | "ScriptTooLarge" | "WitnessItemsTooMany" | "WitnessItemTooLarge" | "WitnessTooLarge" | "WeightOutOfRange" | "FeeRateOutOfRange" | "ExpirationOutOfRange"] >; // FfiConverter for enum FfiValidationError const FfiConverterTypeFfiValidationError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = FfiValidationError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new FfiValidationError.AmountOutOfRange({ amountSat: FfiConverterUInt64.read(from), maxSat: FfiConverterUInt64.read(from), }); case 2: return new FfiValidationError.ScriptEmpty({ field: FfiConverterString.read(from), }); case 3: return new FfiValidationError.ScriptTooLarge({ field: FfiConverterString.read(from), len: FfiConverterUInt64.read(from), max: FfiConverterUInt64.read(from), }); case 4: return new FfiValidationError.WitnessItemsTooMany({ count: FfiConverterUInt64.read(from), max: FfiConverterUInt64.read(from), }); case 5: return new FfiValidationError.WitnessItemTooLarge({ index: FfiConverterUInt64.read(from), len: FfiConverterUInt64.read(from), max: FfiConverterUInt64.read(from), }); case 6: return new FfiValidationError.WitnessTooLarge({ len: FfiConverterUInt64.read(from), max: FfiConverterUInt64.read(from), }); case 7: return new FfiValidationError.WeightOutOfRange({ weightUnits: FfiConverterUInt64.read(from), maxWu: FfiConverterUInt64.read(from), }); case 8: return new FfiValidationError.FeeRateOutOfRange({ value: FfiConverterUInt64.read(from), unit: FfiConverterString.read(from), }); case 9: return new FfiValidationError.ExpirationOutOfRange({ seconds: FfiConverterUInt64.read(from), max: FfiConverterUInt64.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case FfiValidationError_Tags.AmountOutOfRange: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterUInt64.write(inner.amountSat, into); FfiConverterUInt64.write(inner.maxSat, into); return; } case FfiValidationError_Tags.ScriptEmpty: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.field, into); return; } case FfiValidationError_Tags.ScriptTooLarge: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterString.write(inner.field, into); FfiConverterUInt64.write(inner.len, into); FfiConverterUInt64.write(inner.max, into); return; } case FfiValidationError_Tags.WitnessItemsTooMany: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterUInt64.write(inner.count, into); FfiConverterUInt64.write(inner.max, into); return; } case FfiValidationError_Tags.WitnessItemTooLarge: { ordinalConverter.write(5, into); const inner = value.inner; FfiConverterUInt64.write(inner.index, into); FfiConverterUInt64.write(inner.len, into); FfiConverterUInt64.write(inner.max, into); return; } case FfiValidationError_Tags.WitnessTooLarge: { ordinalConverter.write(6, into); const inner = value.inner; FfiConverterUInt64.write(inner.len, into); FfiConverterUInt64.write(inner.max, into); return; } case FfiValidationError_Tags.WeightOutOfRange: { ordinalConverter.write(7, into); const inner = value.inner; FfiConverterUInt64.write(inner.weightUnits, into); FfiConverterUInt64.write(inner.maxWu, into); return; } case FfiValidationError_Tags.FeeRateOutOfRange: { ordinalConverter.write(8, into); const inner = value.inner; FfiConverterUInt64.write(inner.value, into); FfiConverterString.write(inner.unit, into); return; } case FfiValidationError_Tags.ExpirationOutOfRange: { ordinalConverter.write(9, into); const inner = value.inner; FfiConverterUInt64.write(inner.seconds, into); FfiConverterUInt64.write(inner.max, into); return; } default: // Throwing from here means that FfiValidationError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case FfiValidationError_Tags.AmountOutOfRange: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterUInt64.allocationSize(inner.amountSat); size += FfiConverterUInt64.allocationSize(inner.maxSat); return size; } case FfiValidationError_Tags.ScriptEmpty: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.field); return size; } case FfiValidationError_Tags.ScriptTooLarge: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterString.allocationSize(inner.field); size += FfiConverterUInt64.allocationSize(inner.len); size += FfiConverterUInt64.allocationSize(inner.max); return size; } case FfiValidationError_Tags.WitnessItemsTooMany: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterUInt64.allocationSize(inner.count); size += FfiConverterUInt64.allocationSize(inner.max); return size; } case FfiValidationError_Tags.WitnessItemTooLarge: { const inner = value.inner; let size = ordinalConverter.allocationSize(5); size += FfiConverterUInt64.allocationSize(inner.index); size += FfiConverterUInt64.allocationSize(inner.len); size += FfiConverterUInt64.allocationSize(inner.max); return size; } case FfiValidationError_Tags.WitnessTooLarge: { const inner = value.inner; let size = ordinalConverter.allocationSize(6); size += FfiConverterUInt64.allocationSize(inner.len); size += FfiConverterUInt64.allocationSize(inner.max); return size; } case FfiValidationError_Tags.WeightOutOfRange: { const inner = value.inner; let size = ordinalConverter.allocationSize(7); size += FfiConverterUInt64.allocationSize(inner.weightUnits); size += FfiConverterUInt64.allocationSize(inner.maxWu); return size; } case FfiValidationError_Tags.FeeRateOutOfRange: { const inner = value.inner; let size = ordinalConverter.allocationSize(8); size += FfiConverterUInt64.allocationSize(inner.value); size += FfiConverterString.allocationSize(inner.unit); return size; } case FfiValidationError_Tags.ExpirationOutOfRange: { const inner = value.inner; let size = ordinalConverter.allocationSize(9); size += FfiConverterUInt64.allocationSize(inner.seconds); size += FfiConverterUInt64.allocationSize(inner.max); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Error type: ForeignError export enum ForeignError_Tags { InternalError = "InternalError", } export const ForeignError = (() => { type InternalError__interface = { tag: ForeignError_Tags.InternalError; inner: Readonly<[string]>; }; class InternalError_ extends UniffiError implements InternalError__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ForeignError"; readonly tag = ForeignError_Tags.InternalError; readonly inner: Readonly<[string]>; constructor(v0: string) { super("ForeignError", "InternalError"); this.inner = Object.freeze([v0]); } static new(v0: string): InternalError_ { return new InternalError_(v0); } static instanceOf(obj: any): obj is InternalError_ { return obj.tag === ForeignError_Tags.InternalError; } static hasInner(obj: any): obj is InternalError_ { return InternalError_.instanceOf(obj); } static getInner(obj: InternalError_): Readonly<[string]> { return obj.inner; } } function instanceOf(obj: any): obj is ForeignError { return obj[uniffiTypeNameSymbol] === "ForeignError"; } return Object.freeze({ instanceOf, InternalError: InternalError_, }); })(); export type ForeignError = InstanceType<(typeof ForeignError)["InternalError"]>; // FfiConverter for enum ForeignError const FfiConverterTypeForeignError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ForeignError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ForeignError.InternalError(FfiConverterString.read(from)); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ForeignError_Tags.InternalError: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } default: // Throwing from here means that ForeignError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ForeignError_Tags.InternalError: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * Session persister that should save and load events as JSON strings. */ export interface JsonReceiverSessionPersister { save(event: string): /*throws*/ void; load(): /*throws*/ Array; close(): /*throws*/ void; } /** * Session persister that should save and load events as JSON strings. */ export class JsonReceiverSessionPersisterImpl extends UniffiAbstractObject implements JsonReceiverSessionPersister { readonly [uniffiTypeNameSymbol] = "JsonReceiverSessionPersisterImpl"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeJsonReceiverSessionPersisterImplObjectFactory.bless(pointer); } save(event: string): void /*throws*/ { uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ), /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_jsonreceiversessionpersister_save( uniffiTypeJsonReceiverSessionPersisterImplObjectFactory.clonePointer( this ), FfiConverterString.lower(event, nativeModule().rustbuffer_alloc), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ); } load(): Array /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterSequenceString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_jsonreceiversessionpersister_load( uniffiTypeJsonReceiverSessionPersisterImplObjectFactory.clonePointer( this ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } close(): void /*throws*/ { uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ), /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_jsonreceiversessionpersister_close( uniffiTypeJsonReceiverSessionPersisterImplObjectFactory.clonePointer( this ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeJsonReceiverSessionPersisterImplObjectFactory.pointer(this); uniffiTypeJsonReceiverSessionPersisterImplObjectFactory.freePointer( pointer ); uniffiTypeJsonReceiverSessionPersisterImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is JsonReceiverSessionPersisterImpl { return uniffiTypeJsonReceiverSessionPersisterImplObjectFactory.isConcreteType( obj_ ); } } const uniffiTypeJsonReceiverSessionPersisterImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): JsonReceiverSessionPersister { const instance = Object.create( JsonReceiverSessionPersisterImpl.prototype ); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "JsonReceiverSessionPersisterImpl"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_jsonreceiversessionpersister_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: JsonReceiverSessionPersister): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: JsonReceiverSessionPersister): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_jsonreceiversessionpersister( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_jsonreceiversessionpersister( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is JsonReceiverSessionPersister { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "JsonReceiverSessionPersisterImpl" ); }, }; })(); const FfiConverterTypeJsonReceiverSessionPersister = new FfiConverterObjectWithCallbacks( uniffiTypeJsonReceiverSessionPersisterImplObjectFactory ); // Add a vtable for the callbacks that go in JsonReceiverSessionPersister. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceJsonReceiverSessionPersister: { vtable: any; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { save: (uniffiHandle: bigint, event: Uint8Array) => { const uniffiMakeCall = (): void => { const jsCallback = FfiConverterTypeJsonReceiverSessionPersister.lift(uniffiHandle); return jsCallback.save(FfiConverterString.lift(event)); }; const uniffiResult = UniffiResult.ready(); const uniffiHandleSuccess = (obj: any) => {}; const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { UniffiResult.writeError(uniffiResult, code, errBuf); }; uniffiTraitInterfaceCallWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiResult; }, load: (uniffiHandle: bigint) => { const uniffiMakeCall = (): Array => { const jsCallback = FfiConverterTypeJsonReceiverSessionPersister.lift(uniffiHandle); return jsCallback.load(); }; const uniffiResult = UniffiResult.ready(); const uniffiHandleSuccess = (obj: any) => { UniffiResult.writeSuccess( uniffiResult, FfiConverterSequenceString.lower(obj, nativeModule().rustbuffer_alloc) ); }; const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { UniffiResult.writeError(uniffiResult, code, errBuf); }; uniffiTraitInterfaceCallWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiResult; }, close: (uniffiHandle: bigint) => { const uniffiMakeCall = (): void => { const jsCallback = FfiConverterTypeJsonReceiverSessionPersister.lift(uniffiHandle); return jsCallback.close(); }; const uniffiResult = UniffiResult.ready(); const uniffiHandleSuccess = (obj: any) => {}; const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { UniffiResult.writeError(uniffiResult, code, errBuf); }; uniffiTraitInterfaceCallWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiResult; }, uniffi_free: (uniffiHandle: UniffiHandle): void => { // this will throw a stale handle error if the handle isn't found. FfiConverterTypeJsonReceiverSessionPersister.drop(uniffiHandle); }, uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { return FfiConverterTypeJsonReceiverSessionPersister.clone(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_init_callback_vtable_jsonreceiversessionpersister( uniffiCallbackInterfaceJsonReceiverSessionPersister.vtable ); }, }; /** * The replyable error type for the payjoin receiver, representing failures need to be * returned to the sender. * * The error handling is designed to: * 1. Provide structured error responses for protocol-level failures * 2. Hide implementation details of external errors for security * 3. Support proper error propagation through the receiver stack * 4. Provide errors according to BIP-78 JSON error specifications for return * after conversion into [`JsonReply`] */ export interface ProtocolErrorLike {} /** * @deprecated Use `ProtocolErrorLike` instead. */ export type ProtocolErrorInterface = ProtocolErrorLike; /** * The replyable error type for the payjoin receiver, representing failures need to be * returned to the sender. * * The error handling is designed to: * 1. Provide structured error responses for protocol-level failures * 2. Hide implementation details of external errors for security * 3. Support proper error propagation through the receiver stack * 4. Provide errors according to BIP-78 JSON error specifications for return * after conversion into [`JsonReply`] */ export class ProtocolError extends UniffiAbstractObject implements ProtocolErrorLike { readonly [uniffiTypeNameSymbol] = "ProtocolError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeProtocolErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_protocolerror_uniffi_trait_display( uniffiTypeProtocolErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_protocolerror_uniffi_trait_debug( uniffiTypeProtocolErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeProtocolErrorObjectFactory.pointer(this); uniffiTypeProtocolErrorObjectFactory.freePointer(pointer); uniffiTypeProtocolErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ProtocolError { return uniffiTypeProtocolErrorObjectFactory.isConcreteType(obj_); } } const uniffiTypeProtocolErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ProtocolErrorLike { const instance = Object.create(ProtocolError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ProtocolError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_protocolerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ProtocolErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ProtocolErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_protocolerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_protocolerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ProtocolErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ProtocolError" ); }, }; })(); const FfiConverterTypeProtocolError = new FfiConverterObject( uniffiTypeProtocolErrorObjectFactory ); /** * Error arising due to the specific application implementation * * e.g. database errors, network failures, wallet errors */ export interface ImplementationErrorLike {} /** * @deprecated Use `ImplementationErrorLike` instead. */ export type ImplementationErrorInterface = ImplementationErrorLike; /** * Error arising due to the specific application implementation * * e.g. database errors, network failures, wallet errors */ export class ImplementationError extends UniffiAbstractObject implements ImplementationErrorLike { readonly [uniffiTypeNameSymbol] = "ImplementationError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeImplementationErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_implementationerror_uniffi_trait_display( uniffiTypeImplementationErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_implementationerror_uniffi_trait_debug( uniffiTypeImplementationErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeImplementationErrorObjectFactory.pointer(this); uniffiTypeImplementationErrorObjectFactory.freePointer(pointer); uniffiTypeImplementationErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ImplementationError { return uniffiTypeImplementationErrorObjectFactory.isConcreteType(obj_); } } const uniffiTypeImplementationErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ImplementationErrorLike { const instance = Object.create(ImplementationError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ImplementationError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_implementationerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ImplementationErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ImplementationErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_implementationerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_implementationerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ImplementationErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ImplementationError" ); }, }; })(); const FfiConverterTypeImplementationError = new FfiConverterObject( uniffiTypeImplementationErrorObjectFactory ); export interface IntoUrlErrorLike {} /** * @deprecated Use `IntoUrlErrorLike` instead. */ export type IntoUrlErrorInterface = IntoUrlErrorLike; export class IntoUrlError extends UniffiAbstractObject implements IntoUrlErrorLike { readonly [uniffiTypeNameSymbol] = "IntoUrlError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeIntoUrlErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_intourlerror_uniffi_trait_display( uniffiTypeIntoUrlErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_intourlerror_uniffi_trait_debug( uniffiTypeIntoUrlErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeIntoUrlErrorObjectFactory.pointer(this); uniffiTypeIntoUrlErrorObjectFactory.freePointer(pointer); uniffiTypeIntoUrlErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is IntoUrlError { return uniffiTypeIntoUrlErrorObjectFactory.isConcreteType(obj_); } } const uniffiTypeIntoUrlErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): IntoUrlErrorLike { const instance = Object.create(IntoUrlError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "IntoUrlError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_intourlerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: IntoUrlErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: IntoUrlErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_intourlerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_intourlerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is IntoUrlErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "IntoUrlError" ); }, }; })(); const FfiConverterTypeIntoUrlError = new FfiConverterObject( uniffiTypeIntoUrlErrorObjectFactory ); // Error type: ReceiverError export enum ReceiverError_Tags { Protocol = "Protocol", Implementation = "Implementation", IntoUrl = "IntoUrl", Unexpected = "Unexpected", } /** * The top-level error type for the payjoin receiver */ export const ReceiverError = (() => { type Protocol__interface = { tag: ReceiverError_Tags.Protocol; inner: Readonly<[ProtocolErrorLike]>; }; /** * Error in underlying protocol function */ class Protocol_ extends UniffiError implements Protocol__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiverError"; readonly tag = ReceiverError_Tags.Protocol; readonly inner: Readonly<[ProtocolErrorLike]>; constructor(v0: ProtocolErrorLike) { super("ReceiverError", "Protocol"); this.inner = Object.freeze([v0]); } static new(v0: ProtocolErrorLike): Protocol_ { return new Protocol_(v0); } static instanceOf(obj: any): obj is Protocol_ { return obj.tag === ReceiverError_Tags.Protocol; } static hasInner(obj: any): obj is Protocol_ { return Protocol_.instanceOf(obj); } static getInner(obj: Protocol_): Readonly<[ProtocolErrorLike]> { return obj.inner; } } type Implementation__interface = { tag: ReceiverError_Tags.Implementation; inner: Readonly<[ImplementationErrorLike]>; }; /** * Error arising due to the specific receiver implementation * * e.g. database errors, network failures, wallet errors */ class Implementation_ extends UniffiError implements Implementation__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiverError"; readonly tag = ReceiverError_Tags.Implementation; readonly inner: Readonly<[ImplementationErrorLike]>; constructor(v0: ImplementationErrorLike) { super("ReceiverError", "Implementation"); this.inner = Object.freeze([v0]); } static new(v0: ImplementationErrorLike): Implementation_ { return new Implementation_(v0); } static instanceOf(obj: any): obj is Implementation_ { return obj.tag === ReceiverError_Tags.Implementation; } static hasInner(obj: any): obj is Implementation_ { return Implementation_.instanceOf(obj); } static getInner(obj: Implementation_): Readonly<[ImplementationErrorLike]> { return obj.inner; } } type IntoUrl__interface = { tag: ReceiverError_Tags.IntoUrl; inner: Readonly<[IntoUrlErrorLike]>; }; /** * Error that may occur when converting a some type to a URL */ class IntoUrl_ extends UniffiError implements IntoUrl__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiverError"; readonly tag = ReceiverError_Tags.IntoUrl; readonly inner: Readonly<[IntoUrlErrorLike]>; constructor(v0: IntoUrlErrorLike) { super("ReceiverError", "IntoUrl"); this.inner = Object.freeze([v0]); } static new(v0: IntoUrlErrorLike): IntoUrl_ { return new IntoUrl_(v0); } static instanceOf(obj: any): obj is IntoUrl_ { return obj.tag === ReceiverError_Tags.IntoUrl; } static hasInner(obj: any): obj is IntoUrl_ { return IntoUrl_.instanceOf(obj); } static getInner(obj: IntoUrl_): Readonly<[IntoUrlErrorLike]> { return obj.inner; } } type Unexpected__interface = { tag: ReceiverError_Tags.Unexpected; }; /** * Catch-all for unhandled error variants */ class Unexpected_ extends UniffiError implements Unexpected__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiverError"; readonly tag = ReceiverError_Tags.Unexpected; constructor() { super("ReceiverError", "Unexpected"); } static new(): Unexpected_ { return new Unexpected_(); } static instanceOf(obj: any): obj is Unexpected_ { return obj.tag === ReceiverError_Tags.Unexpected; } static hasInner(obj: any): obj is Unexpected_ { return false; } } function instanceOf(obj: any): obj is ReceiverError { return obj[uniffiTypeNameSymbol] === "ReceiverError"; } return Object.freeze({ instanceOf, Protocol: Protocol_, Implementation: Implementation_, IntoUrl: IntoUrl_, Unexpected: Unexpected_, }); })(); /** * The top-level error type for the payjoin receiver */ export type ReceiverError = InstanceType< (typeof ReceiverError)[ | "Protocol" | "Implementation" | "IntoUrl" | "Unexpected"] >; // FfiConverter for enum ReceiverError const FfiConverterTypeReceiverError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ReceiverError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ReceiverError.Protocol( FfiConverterTypeProtocolError.read(from) ); case 2: return new ReceiverError.Implementation( FfiConverterTypeImplementationError.read(from) ); case 3: return new ReceiverError.IntoUrl( FfiConverterTypeIntoUrlError.read(from) ); case 4: return new ReceiverError.Unexpected(); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ReceiverError_Tags.Protocol: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeProtocolError.write(inner[0], into); return; } case ReceiverError_Tags.Implementation: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeImplementationError.write(inner[0], into); return; } case ReceiverError_Tags.IntoUrl: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeIntoUrlError.write(inner[0], into); return; } case ReceiverError_Tags.Unexpected: { ordinalConverter.write(4, into); return; } default: // Throwing from here means that ReceiverError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ReceiverError_Tags.Protocol: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeProtocolError.allocationSize(inner[0]); return size; } case ReceiverError_Tags.Implementation: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeImplementationError.allocationSize(inner[0]); return size; } case ReceiverError_Tags.IntoUrl: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeIntoUrlError.allocationSize(inner[0]); return size; } case ReceiverError_Tags.Unexpected: { return ordinalConverter.allocationSize(4); } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Error type: ReceiverPersistedError export enum ReceiverPersistedError_Tags { Transient = "Transient", Fatal = "Fatal", Storage = "Storage", } /** * Error that may occur during state machine transitions */ export const ReceiverPersistedError = (() => { type Transient__interface = { tag: ReceiverPersistedError_Tags.Transient; inner: Readonly<[ReceiverError]>; }; /** * A transient error: nothing was persisted, and the failed transition * can be retried by calling it again on the same receiver object */ class Transient_ extends UniffiError implements Transient__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiverPersistedError"; readonly tag = ReceiverPersistedError_Tags.Transient; readonly inner: Readonly<[ReceiverError]>; constructor(v0: ReceiverError) { super("ReceiverPersistedError", "Transient"); this.inner = Object.freeze([v0]); } static new(v0: ReceiverError): Transient_ { return new Transient_(v0); } static instanceOf(obj: any): obj is Transient_ { return obj.tag === ReceiverPersistedError_Tags.Transient; } static hasInner(obj: any): obj is Transient_ { return Transient_.instanceOf(obj); } static getInner(obj: Transient_): Readonly<[ReceiverError]> { return obj.inner; } } type Fatal__interface = { tag: ReceiverPersistedError_Tags.Fatal; inner: Readonly<[ReceiverError]>; }; /** * A fatal error: the session is closed or has moved to an error state */ class Fatal_ extends UniffiError implements Fatal__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiverPersistedError"; readonly tag = ReceiverPersistedError_Tags.Fatal; readonly inner: Readonly<[ReceiverError]>; constructor(v0: ReceiverError) { super("ReceiverPersistedError", "Fatal"); this.inner = Object.freeze([v0]); } static new(v0: ReceiverError): Fatal_ { return new Fatal_(v0); } static instanceOf(obj: any): obj is Fatal_ { return obj.tag === ReceiverPersistedError_Tags.Fatal; } static hasInner(obj: any): obj is Fatal_ { return Fatal_.instanceOf(obj); } static getInner(obj: Fatal_): Readonly<[ReceiverError]> { return obj.inner; } } type Storage__interface = { tag: ReceiverPersistedError_Tags.Storage; inner: Readonly<[ImplementationErrorLike]>; }; /** * Storage error that could occur at application storage layer */ class Storage_ extends UniffiError implements Storage__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiverPersistedError"; readonly tag = ReceiverPersistedError_Tags.Storage; readonly inner: Readonly<[ImplementationErrorLike]>; constructor(v0: ImplementationErrorLike) { super("ReceiverPersistedError", "Storage"); this.inner = Object.freeze([v0]); } static new(v0: ImplementationErrorLike): Storage_ { return new Storage_(v0); } static instanceOf(obj: any): obj is Storage_ { return obj.tag === ReceiverPersistedError_Tags.Storage; } static hasInner(obj: any): obj is Storage_ { return Storage_.instanceOf(obj); } static getInner(obj: Storage_): Readonly<[ImplementationErrorLike]> { return obj.inner; } } function instanceOf(obj: any): obj is ReceiverPersistedError { return obj[uniffiTypeNameSymbol] === "ReceiverPersistedError"; } return Object.freeze({ instanceOf, Transient: Transient_, Fatal: Fatal_, Storage: Storage_, }); })(); /** * Error that may occur during state machine transitions */ export type ReceiverPersistedError = InstanceType< (typeof ReceiverPersistedError)["Transient" | "Fatal" | "Storage"] >; // FfiConverter for enum ReceiverPersistedError const FfiConverterTypeReceiverPersistedError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ReceiverPersistedError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ReceiverPersistedError.Transient( FfiConverterTypeReceiverError.read(from) ); case 2: return new ReceiverPersistedError.Fatal( FfiConverterTypeReceiverError.read(from) ); case 3: return new ReceiverPersistedError.Storage( FfiConverterTypeImplementationError.read(from) ); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ReceiverPersistedError_Tags.Transient: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeReceiverError.write(inner[0], into); return; } case ReceiverPersistedError_Tags.Fatal: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeReceiverError.write(inner[0], into); return; } case ReceiverPersistedError_Tags.Storage: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeImplementationError.write(inner[0], into); return; } default: // Throwing from here means that ReceiverPersistedError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ReceiverPersistedError_Tags.Transient: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeReceiverError.allocationSize(inner[0]); return size; } case ReceiverPersistedError_Tags.Fatal: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeReceiverError.allocationSize(inner[0]); return size; } case ReceiverPersistedError_Tags.Storage: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeImplementationError.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * Async session persister that should save and load events as JSON strings. */ export interface JsonReceiverSessionPersisterAsync { save( event: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; load(asyncOpts_?: { signal: AbortSignal }): /*throws*/ Promise>; close(asyncOpts_?: { signal: AbortSignal }): /*throws*/ Promise; } /** * Async session persister that should save and load events as JSON strings. */ export class JsonReceiverSessionPersisterAsyncImpl extends UniffiAbstractObject implements JsonReceiverSessionPersisterAsync { readonly [uniffiTypeNameSymbol] = "JsonReceiverSessionPersisterAsyncImpl"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeJsonReceiverSessionPersisterAsyncImplObjectFactory.bless( pointer ); } async save( event: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_jsonreceiversessionpersisterasync_save( uniffiTypeJsonReceiverSessionPersisterAsyncImplObjectFactory.clonePointer( this ), FfiConverterString.lower(event, nativeModule().rustbuffer_alloc) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_void, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } async load(asyncOpts_?: { signal: AbortSignal; }): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_jsonreceiversessionpersisterasync_load( uniffiTypeJsonReceiverSessionPersisterAsyncImplObjectFactory.clonePointer( this ) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_free_rust_buffer, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterSequenceString.lift.bind( FfiConverterSequenceString ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } async close(asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_jsonreceiversessionpersisterasync_close( uniffiTypeJsonReceiverSessionPersisterAsyncImplObjectFactory.clonePointer( this ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_void, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeJsonReceiverSessionPersisterAsyncImplObjectFactory.pointer( this ); uniffiTypeJsonReceiverSessionPersisterAsyncImplObjectFactory.freePointer( pointer ); uniffiTypeJsonReceiverSessionPersisterAsyncImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is JsonReceiverSessionPersisterAsyncImpl { return uniffiTypeJsonReceiverSessionPersisterAsyncImplObjectFactory.isConcreteType( obj_ ); } } const uniffiTypeJsonReceiverSessionPersisterAsyncImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): JsonReceiverSessionPersisterAsync { const instance = Object.create( JsonReceiverSessionPersisterAsyncImpl.prototype ); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "JsonReceiverSessionPersisterAsyncImpl"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_jsonreceiversessionpersisterasync_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: JsonReceiverSessionPersisterAsync): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: JsonReceiverSessionPersisterAsync): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_jsonreceiversessionpersisterasync( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_jsonreceiversessionpersisterasync( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is JsonReceiverSessionPersisterAsync { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "JsonReceiverSessionPersisterAsyncImpl" ); }, }; })(); const FfiConverterTypeJsonReceiverSessionPersisterAsync = new FfiConverterObjectWithCallbacks( uniffiTypeJsonReceiverSessionPersisterAsyncImplObjectFactory ); // Add a vtable for the callbacks that go in JsonReceiverSessionPersisterAsync. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceJsonReceiverSessionPersisterAsync: { vtable: any; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { save: ( uniffiHandle: bigint, event: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompletevoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeJsonReceiverSessionPersisterAsync.lift(uniffiHandle); return await jsCallback.save(FfiConverterString.lift(event), { signal, }); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureResultVoid */ { call_status: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureResultVoid */ { // TODO create callstatus with error. call_status: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiForeignFuture; }, load: ( uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise> => { const jsCallback = FfiConverterTypeJsonReceiverSessionPersisterAsync.lift(uniffiHandle); return await jsCallback.load({ signal }); }; const uniffiHandleSuccess = (returnValue: Array) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureResultRustBuffer */ { return_value: FfiConverterSequenceString.lower( returnValue, nativeModule().rustbuffer_alloc ), call_status: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureResultRustBuffer */ { return_value: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. call_status: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiForeignFuture; }, close: ( uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompletevoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeJsonReceiverSessionPersisterAsync.lift(uniffiHandle); return await jsCallback.close({ signal }); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureResultVoid */ { call_status: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureResultVoid */ { // TODO create callstatus with error. call_status: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiForeignFuture; }, uniffi_free: (uniffiHandle: UniffiHandle): void => { // this will throw a stale handle error if the handle isn't found. FfiConverterTypeJsonReceiverSessionPersisterAsync.drop(uniffiHandle); }, uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { return FfiConverterTypeJsonReceiverSessionPersisterAsync.clone( uniffiHandle ); }, }, register: () => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_init_callback_vtable_jsonreceiversessionpersisterasync( uniffiCallbackInterfaceJsonReceiverSessionPersisterAsync.vtable ); }, }; export interface PendingFallbackTransitionLike { save(persister: JsonReceiverSessionPersister): /*throws*/ void; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `PendingFallbackTransitionLike` instead. */ export type PendingFallbackTransitionInterface = PendingFallbackTransitionLike; export class PendingFallbackTransition extends UniffiAbstractObject implements PendingFallbackTransitionLike { readonly [uniffiTypeNameSymbol] = "PendingFallbackTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypePendingFallbackTransitionObjectFactory.bless(pointer); } save(persister: JsonReceiverSessionPersister): void /*throws*/ { uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pendingfallbacktransition_save( uniffiTypePendingFallbackTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pendingfallbacktransition_save_async( uniffiTypePendingFallbackTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_void, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypePendingFallbackTransitionObjectFactory.pointer(this); uniffiTypePendingFallbackTransitionObjectFactory.freePointer(pointer); uniffiTypePendingFallbackTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is PendingFallbackTransition { return uniffiTypePendingFallbackTransitionObjectFactory.isConcreteType( obj_ ); } } const uniffiTypePendingFallbackTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): PendingFallbackTransitionLike { const instance = Object.create(PendingFallbackTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "PendingFallbackTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_pendingfallbacktransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: PendingFallbackTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: PendingFallbackTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_pendingfallbacktransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_pendingfallbacktransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is PendingFallbackTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "PendingFallbackTransition" ); }, }; })(); const FfiConverterTypePendingFallbackTransition = new FfiConverterObject( uniffiTypePendingFallbackTransitionObjectFactory ); export interface ReceiverPendingFallbackLike { close(): PendingFallbackTransitionLike; fallbackTx(): ArrayBuffer; } /** * @deprecated Use `ReceiverPendingFallbackLike` instead. */ export type ReceiverPendingFallbackInterface = ReceiverPendingFallbackLike; export class ReceiverPendingFallback extends UniffiAbstractObject implements ReceiverPendingFallbackLike { readonly [uniffiTypeNameSymbol] = "ReceiverPendingFallback"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeReceiverPendingFallbackObjectFactory.bless(pointer); } close(): PendingFallbackTransitionLike { return FfiConverterTypePendingFallbackTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receiverpendingfallback_close( uniffiTypeReceiverPendingFallbackObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } fallbackTx(): ArrayBuffer { return ((__rb: Uint8Array) => { try { return FfiConverterArrayBuffer.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receiverpendingfallback_fallback_tx( uniffiTypeReceiverPendingFallbackObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeReceiverPendingFallbackObjectFactory.pointer(this); uniffiTypeReceiverPendingFallbackObjectFactory.freePointer(pointer); uniffiTypeReceiverPendingFallbackObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ReceiverPendingFallback { return uniffiTypeReceiverPendingFallbackObjectFactory.isConcreteType(obj_); } } const uniffiTypeReceiverPendingFallbackObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ReceiverPendingFallbackLike { const instance = Object.create(ReceiverPendingFallback.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ReceiverPendingFallback"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_receiverpendingfallback_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ReceiverPendingFallbackLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ReceiverPendingFallbackLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_receiverpendingfallback( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_receiverpendingfallback( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ReceiverPendingFallbackLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ReceiverPendingFallback" ); }, }; })(); const FfiConverterTypeReceiverPendingFallback = new FfiConverterObject( uniffiTypeReceiverPendingFallbackObjectFactory ); /** * A transition produced by cancelling a receiver session. */ export interface CancelTransitionLike { /** * Persist the cancellation and return pending fallback handling if needed. */ save( persister: JsonReceiverSessionPersister ): /*throws*/ ReceiverPendingFallbackLike | undefined; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `CancelTransitionLike` instead. */ export type CancelTransitionInterface = CancelTransitionLike; /** * A transition produced by cancelling a receiver session. */ export class CancelTransition extends UniffiAbstractObject implements CancelTransitionLike { readonly [uniffiTypeNameSymbol] = "CancelTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeCancelTransitionObjectFactory.bless(pointer); } /** * Persist the cancellation and return pending fallback handling if needed. */ save( persister: JsonReceiverSessionPersister ): ReceiverPendingFallbackLike | undefined /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterOptionalTypeReceiverPendingFallback.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_canceltransition_save( uniffiTypeCancelTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_canceltransition_save_async( uniffiTypeCancelTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_free_rust_buffer, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterOptionalTypeReceiverPendingFallback.lift.bind( FfiConverterOptionalTypeReceiverPendingFallback ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeCancelTransitionObjectFactory.pointer(this); uniffiTypeCancelTransitionObjectFactory.freePointer(pointer); uniffiTypeCancelTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is CancelTransition { return uniffiTypeCancelTransitionObjectFactory.isConcreteType(obj_); } } const uniffiTypeCancelTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): CancelTransitionLike { const instance = Object.create(CancelTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "CancelTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_canceltransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: CancelTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: CancelTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_canceltransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_canceltransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is CancelTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "CancelTransition" ); }, }; })(); const FfiConverterTypeCancelTransition = new FfiConverterObject( uniffiTypeCancelTransitionObjectFactory ); /** * Answers whether the receiver's wallet can sign the coin at a given outpoint. * Implement this against the wallet's own authoritative state, covering every * outpoint the wallet can sign, including locked and unconfirmed coins. */ export interface IsInputOwned { callback(outpoint: OutPoint): /*throws*/ boolean; } /** * Answers whether the receiver's wallet can sign the coin at a given outpoint. * Implement this against the wallet's own authoritative state, covering every * outpoint the wallet can sign, including locked and unconfirmed coins. */ export class IsInputOwnedImpl extends UniffiAbstractObject implements IsInputOwned { readonly [uniffiTypeNameSymbol] = "IsInputOwnedImpl"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeIsInputOwnedImplObjectFactory.bless(pointer); } callback(outpoint: OutPoint): boolean /*throws*/ { return FfiConverterBool.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_isinputowned_callback( uniffiTypeIsInputOwnedImplObjectFactory.clonePointer(this), FfiConverterTypeOutPoint.lower( outpoint, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeIsInputOwnedImplObjectFactory.pointer(this); uniffiTypeIsInputOwnedImplObjectFactory.freePointer(pointer); uniffiTypeIsInputOwnedImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is IsInputOwnedImpl { return uniffiTypeIsInputOwnedImplObjectFactory.isConcreteType(obj_); } } const uniffiTypeIsInputOwnedImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): IsInputOwned { const instance = Object.create(IsInputOwnedImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "IsInputOwnedImpl"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_isinputowned_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: IsInputOwned): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: IsInputOwned): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_isinputowned( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_isinputowned( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is IsInputOwned { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "IsInputOwnedImpl" ); }, }; })(); const FfiConverterTypeIsInputOwned = new FfiConverterObjectWithCallbacks( uniffiTypeIsInputOwnedImplObjectFactory ); // Add a vtable for the callbacks that go in IsInputOwned. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceIsInputOwned: { vtable: any; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { callback: (uniffiHandle: bigint, outpoint: Uint8Array) => { const uniffiMakeCall = (): boolean => { const jsCallback = FfiConverterTypeIsInputOwned.lift(uniffiHandle); return jsCallback.callback(FfiConverterTypeOutPoint.lift(outpoint)); }; const uniffiResult = UniffiResult.ready(); const uniffiHandleSuccess = (obj: any) => { UniffiResult.writeSuccess( uniffiResult, FfiConverterBool.lower(obj, nativeModule().rustbuffer_alloc) ); }; const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { UniffiResult.writeError(uniffiResult, code, errBuf); }; uniffiTraitInterfaceCallWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiResult; }, uniffi_free: (uniffiHandle: UniffiHandle): void => { // this will throw a stale handle error if the handle isn't found. FfiConverterTypeIsInputOwned.drop(uniffiHandle); }, uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { return FfiConverterTypeIsInputOwned.clone(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_init_callback_vtable_isinputowned( uniffiCallbackInterfaceIsInputOwned.vtable ); }, }; export interface IsOutputKnown { callback(outpoint: OutPoint): /*throws*/ boolean; } export class IsOutputKnownImpl extends UniffiAbstractObject implements IsOutputKnown { readonly [uniffiTypeNameSymbol] = "IsOutputKnownImpl"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeIsOutputKnownImplObjectFactory.bless(pointer); } callback(outpoint: OutPoint): boolean /*throws*/ { return FfiConverterBool.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_isoutputknown_callback( uniffiTypeIsOutputKnownImplObjectFactory.clonePointer(this), FfiConverterTypeOutPoint.lower( outpoint, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeIsOutputKnownImplObjectFactory.pointer(this); uniffiTypeIsOutputKnownImplObjectFactory.freePointer(pointer); uniffiTypeIsOutputKnownImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is IsOutputKnownImpl { return uniffiTypeIsOutputKnownImplObjectFactory.isConcreteType(obj_); } } const uniffiTypeIsOutputKnownImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): IsOutputKnown { const instance = Object.create(IsOutputKnownImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "IsOutputKnownImpl"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_isoutputknown_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: IsOutputKnown): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: IsOutputKnown): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_isoutputknown( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_isoutputknown( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is IsOutputKnown { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "IsOutputKnownImpl" ); }, }; })(); const FfiConverterTypeIsOutputKnown = new FfiConverterObjectWithCallbacks( uniffiTypeIsOutputKnownImplObjectFactory ); // Add a vtable for the callbacks that go in IsOutputKnown. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceIsOutputKnown: { vtable: any; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { callback: (uniffiHandle: bigint, outpoint: Uint8Array) => { const uniffiMakeCall = (): boolean => { const jsCallback = FfiConverterTypeIsOutputKnown.lift(uniffiHandle); return jsCallback.callback(FfiConverterTypeOutPoint.lift(outpoint)); }; const uniffiResult = UniffiResult.ready(); const uniffiHandleSuccess = (obj: any) => { UniffiResult.writeSuccess( uniffiResult, FfiConverterBool.lower(obj, nativeModule().rustbuffer_alloc) ); }; const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { UniffiResult.writeError(uniffiResult, code, errBuf); }; uniffiTraitInterfaceCallWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiResult; }, uniffi_free: (uniffiHandle: UniffiHandle): void => { // this will throw a stale handle error if the handle isn't found. FfiConverterTypeIsOutputKnown.drop(uniffiHandle); }, uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { return FfiConverterTypeIsOutputKnown.clone(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_init_callback_vtable_isoutputknown( uniffiCallbackInterfaceIsOutputKnown.vtable ); }, }; export interface IsScriptOwned { callback(script: ArrayBuffer): /*throws*/ boolean; } export class IsScriptOwnedImpl extends UniffiAbstractObject implements IsScriptOwned { readonly [uniffiTypeNameSymbol] = "IsScriptOwnedImpl"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeIsScriptOwnedImplObjectFactory.bless(pointer); } callback(script: ArrayBuffer): boolean /*throws*/ { return FfiConverterBool.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_isscriptowned_callback( uniffiTypeIsScriptOwnedImplObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower( script, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeIsScriptOwnedImplObjectFactory.pointer(this); uniffiTypeIsScriptOwnedImplObjectFactory.freePointer(pointer); uniffiTypeIsScriptOwnedImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is IsScriptOwnedImpl { return uniffiTypeIsScriptOwnedImplObjectFactory.isConcreteType(obj_); } } const uniffiTypeIsScriptOwnedImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): IsScriptOwned { const instance = Object.create(IsScriptOwnedImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "IsScriptOwnedImpl"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_isscriptowned_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: IsScriptOwned): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: IsScriptOwned): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_isscriptowned( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_isscriptowned( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is IsScriptOwned { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "IsScriptOwnedImpl" ); }, }; })(); const FfiConverterTypeIsScriptOwned = new FfiConverterObjectWithCallbacks( uniffiTypeIsScriptOwnedImplObjectFactory ); // Add a vtable for the callbacks that go in IsScriptOwned. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceIsScriptOwned: { vtable: any; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { callback: (uniffiHandle: bigint, script: Uint8Array) => { const uniffiMakeCall = (): boolean => { const jsCallback = FfiConverterTypeIsScriptOwned.lift(uniffiHandle); return jsCallback.callback(FfiConverterArrayBuffer.lift(script)); }; const uniffiResult = UniffiResult.ready(); const uniffiHandleSuccess = (obj: any) => { UniffiResult.writeSuccess( uniffiResult, FfiConverterBool.lower(obj, nativeModule().rustbuffer_alloc) ); }; const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { UniffiResult.writeError(uniffiResult, code, errBuf); }; uniffiTraitInterfaceCallWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiResult; }, uniffi_free: (uniffiHandle: UniffiHandle): void => { // this will throw a stale handle error if the handle isn't found. FfiConverterTypeIsScriptOwned.drop(uniffiHandle); }, uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { return FfiConverterTypeIsScriptOwned.clone(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_init_callback_vtable_isscriptowned( uniffiCallbackInterfaceIsScriptOwned.vtable ); }, }; export interface ProcessPsbt { callback(psbt: string): /*throws*/ string; } export class ProcessPsbtImpl extends UniffiAbstractObject implements ProcessPsbt { readonly [uniffiTypeNameSymbol] = "ProcessPsbtImpl"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeProcessPsbtImplObjectFactory.bless(pointer); } callback(psbt: string): string /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_processpsbt_callback( uniffiTypeProcessPsbtImplObjectFactory.clonePointer(this), FfiConverterString.lower(psbt, nativeModule().rustbuffer_alloc), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeProcessPsbtImplObjectFactory.pointer(this); uniffiTypeProcessPsbtImplObjectFactory.freePointer(pointer); uniffiTypeProcessPsbtImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ProcessPsbtImpl { return uniffiTypeProcessPsbtImplObjectFactory.isConcreteType(obj_); } } const uniffiTypeProcessPsbtImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ProcessPsbt { const instance = Object.create(ProcessPsbtImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ProcessPsbtImpl"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_processpsbt_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ProcessPsbt): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ProcessPsbt): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_processpsbt( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_processpsbt( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ProcessPsbt { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ProcessPsbtImpl" ); }, }; })(); const FfiConverterTypeProcessPsbt = new FfiConverterObjectWithCallbacks( uniffiTypeProcessPsbtImplObjectFactory ); // Add a vtable for the callbacks that go in ProcessPsbt. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceProcessPsbt: { vtable: any; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { callback: (uniffiHandle: bigint, psbt: Uint8Array) => { const uniffiMakeCall = (): string => { const jsCallback = FfiConverterTypeProcessPsbt.lift(uniffiHandle); return jsCallback.callback(FfiConverterString.lift(psbt)); }; const uniffiResult = UniffiResult.ready(); const uniffiHandleSuccess = (obj: any) => { UniffiResult.writeSuccess( uniffiResult, FfiConverterString.lower(obj, nativeModule().rustbuffer_alloc) ); }; const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { UniffiResult.writeError(uniffiResult, code, errBuf); }; uniffiTraitInterfaceCallWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiResult; }, uniffi_free: (uniffiHandle: UniffiHandle): void => { // this will throw a stale handle error if the handle isn't found. FfiConverterTypeProcessPsbt.drop(uniffiHandle); }, uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { return FfiConverterTypeProcessPsbt.clone(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_init_callback_vtable_processpsbt( uniffiCallbackInterfaceProcessPsbt.vtable ); }, }; /** * Error returned when a receiver request could not be created. * * Returned by `create_poll_request` and `create_post_request`. uniffi attaches * methods to Object types, so the expiry predicate is a method here rather than * a free function over the top-level `ReceiverError`. */ export interface ReceiverCreateRequestErrorLike { /** * Returns `true` if the request could not be created because the session * has expired. */ isExpired(): boolean; } /** * @deprecated Use `ReceiverCreateRequestErrorLike` instead. */ export type ReceiverCreateRequestErrorInterface = ReceiverCreateRequestErrorLike; /** * Error returned when a receiver request could not be created. * * Returned by `create_poll_request` and `create_post_request`. uniffi attaches * methods to Object types, so the expiry predicate is a method here rather than * a free function over the top-level `ReceiverError`. */ export class ReceiverCreateRequestError extends UniffiAbstractObject implements ReceiverCreateRequestErrorLike { readonly [uniffiTypeNameSymbol] = "ReceiverCreateRequestError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeReceiverCreateRequestErrorObjectFactory.bless(pointer); } /** * Returns `true` if the request could not be created because the session * has expired. */ isExpired(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receivercreaterequesterror_is_expired( uniffiTypeReceiverCreateRequestErrorObjectFactory.clonePointer( this ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receivercreaterequesterror_uniffi_trait_display( uniffiTypeReceiverCreateRequestErrorObjectFactory.clonePointer( this ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receivercreaterequesterror_uniffi_trait_debug( uniffiTypeReceiverCreateRequestErrorObjectFactory.clonePointer( this ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeReceiverCreateRequestErrorObjectFactory.pointer(this); uniffiTypeReceiverCreateRequestErrorObjectFactory.freePointer(pointer); uniffiTypeReceiverCreateRequestErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ReceiverCreateRequestError { return uniffiTypeReceiverCreateRequestErrorObjectFactory.isConcreteType( obj_ ); } static hasInner( obj_: any ): obj_ is UniffiThrownObject { return ( UniffiThrownObject.instanceOf(obj_) && ReceiverCreateRequestError.instanceOf(obj_.inner) ); } static getInner( err: UniffiThrownObject ): ReceiverCreateRequestError { return err.inner; } } const uniffiTypeReceiverCreateRequestErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ReceiverCreateRequestErrorLike { const instance = Object.create(ReceiverCreateRequestError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ReceiverCreateRequestError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_receivercreaterequesterror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ReceiverCreateRequestErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ReceiverCreateRequestErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_receivercreaterequesterror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_receivercreaterequesterror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ReceiverCreateRequestErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ReceiverCreateRequestError" ); }, }; })(); const FfiConverterTypeReceiverCreateRequestError = new FfiConverterObject( uniffiTypeReceiverCreateRequestErrorObjectFactory ); const FfiConverterTypeReceiverCreateRequestError__as_error = new FfiConverterObjectAsError( "ReceiverCreateRequestError", FfiConverterTypeReceiverCreateRequestError ); export interface TransactionFinder { callback(txid: string): /*throws*/ ArrayBuffer | undefined; } export class TransactionFinderImpl extends UniffiAbstractObject implements TransactionFinder { readonly [uniffiTypeNameSymbol] = "TransactionFinderImpl"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeTransactionFinderImplObjectFactory.bless(pointer); } callback(txid: string): ArrayBuffer | undefined /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterOptionalBytes.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_transactionfinder_callback( uniffiTypeTransactionFinderImplObjectFactory.clonePointer(this), FfiConverterString.lower(txid, nativeModule().rustbuffer_alloc), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeTransactionFinderImplObjectFactory.pointer(this); uniffiTypeTransactionFinderImplObjectFactory.freePointer(pointer); uniffiTypeTransactionFinderImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is TransactionFinderImpl { return uniffiTypeTransactionFinderImplObjectFactory.isConcreteType(obj_); } } const uniffiTypeTransactionFinderImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): TransactionFinder { const instance = Object.create(TransactionFinderImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "TransactionFinderImpl"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_transactionfinder_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: TransactionFinder): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: TransactionFinder): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_transactionfinder( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_transactionfinder( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is TransactionFinder { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "TransactionFinderImpl" ); }, }; })(); const FfiConverterTypeTransactionFinder = new FfiConverterObjectWithCallbacks( uniffiTypeTransactionFinderImplObjectFactory ); // Add a vtable for the callbacks that go in TransactionFinder. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceTransactionFinder: { vtable: any; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { callback: (uniffiHandle: bigint, txid: Uint8Array) => { const uniffiMakeCall = (): ArrayBuffer | undefined => { const jsCallback = FfiConverterTypeTransactionFinder.lift(uniffiHandle); return jsCallback.callback(FfiConverterString.lift(txid)); }; const uniffiResult = UniffiResult.ready(); const uniffiHandleSuccess = (obj: any) => { UniffiResult.writeSuccess( uniffiResult, FfiConverterOptionalBytes.lower(obj, nativeModule().rustbuffer_alloc) ); }; const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { UniffiResult.writeError(uniffiResult, code, errBuf); }; uniffiTraitInterfaceCallWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiResult; }, uniffi_free: (uniffiHandle: UniffiHandle): void => { // this will throw a stale handle error if the handle isn't found. FfiConverterTypeTransactionFinder.drop(uniffiHandle); }, uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { return FfiConverterTypeTransactionFinder.clone(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_init_callback_vtable_transactionfinder( uniffiCallbackInterfaceTransactionFinder.vtable ); }, }; export interface MonitorTransitionLike { save(persister: JsonReceiverSessionPersister): /*throws*/ void; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `MonitorTransitionLike` instead. */ export type MonitorTransitionInterface = MonitorTransitionLike; export class MonitorTransition extends UniffiAbstractObject implements MonitorTransitionLike { readonly [uniffiTypeNameSymbol] = "MonitorTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeMonitorTransitionObjectFactory.bless(pointer); } save(persister: JsonReceiverSessionPersister): void /*throws*/ { uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_monitortransition_save( uniffiTypeMonitorTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_monitortransition_save_async( uniffiTypeMonitorTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_void, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeMonitorTransitionObjectFactory.pointer(this); uniffiTypeMonitorTransitionObjectFactory.freePointer(pointer); uniffiTypeMonitorTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is MonitorTransition { return uniffiTypeMonitorTransitionObjectFactory.isConcreteType(obj_); } } const uniffiTypeMonitorTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): MonitorTransitionLike { const instance = Object.create(MonitorTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "MonitorTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_monitortransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: MonitorTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: MonitorTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_monitortransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_monitortransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is MonitorTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "MonitorTransition" ); }, }; })(); const FfiConverterTypeMonitorTransition = new FfiConverterObject( uniffiTypeMonitorTransitionObjectFactory ); export interface MonitorLike { /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike; /** * Check the network for the payjoin or fallback transaction via the * `find_transaction` callback. * * Returns a [`MonitorTransition`] that, once persisted, completes * the session if a transaction is found. */ checkForTransaction( findTransaction: TransactionFinder ): MonitorTransitionLike; /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean; } /** * @deprecated Use `MonitorLike` instead. */ export type MonitorInterface = MonitorLike; export class Monitor extends UniffiAbstractObject implements MonitorLike { readonly [uniffiTypeNameSymbol] = "Monitor"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeMonitorObjectFactory.bless(pointer); } /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike { return FfiConverterTypeCancelTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_monitor_cancel( uniffiTypeMonitorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Check the network for the payjoin or fallback transaction via the * `find_transaction` callback. * * Returns a [`MonitorTransition`] that, once persisted, completes * the session if a transaction is found. */ checkForTransaction( findTransaction: TransactionFinder ): MonitorTransitionLike { return FfiConverterTypeMonitorTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_monitor_check_for_transaction( uniffiTypeMonitorObjectFactory.clonePointer(this), FfiConverterTypeTransactionFinder.lower( findTransaction, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_monitor_proposal_txid_is_stable( uniffiTypeMonitorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeMonitorObjectFactory.pointer(this); uniffiTypeMonitorObjectFactory.freePointer(pointer); uniffiTypeMonitorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is Monitor { return uniffiTypeMonitorObjectFactory.isConcreteType(obj_); } } const uniffiTypeMonitorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): MonitorLike { const instance = Object.create(Monitor.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "Monitor"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_monitor_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: MonitorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: MonitorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_monitor( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_monitor( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is MonitorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "Monitor" ); }, }; })(); const FfiConverterTypeMonitor = new FfiConverterObject( uniffiTypeMonitorObjectFactory ); export interface PayjoinProposalTransitionLike { save(persister: JsonReceiverSessionPersister): /*throws*/ MonitorLike; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `PayjoinProposalTransitionLike` instead. */ export type PayjoinProposalTransitionInterface = PayjoinProposalTransitionLike; export class PayjoinProposalTransition extends UniffiAbstractObject implements PayjoinProposalTransitionLike { readonly [uniffiTypeNameSymbol] = "PayjoinProposalTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypePayjoinProposalTransitionObjectFactory.bless(pointer); } save(persister: JsonReceiverSessionPersister): MonitorLike /*throws*/ { return FfiConverterTypeMonitor.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_payjoinproposaltransition_save( uniffiTypePayjoinProposalTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_payjoinproposaltransition_save_async( uniffiTypePayjoinProposalTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeMonitor.lift.bind( FfiConverterTypeMonitor ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypePayjoinProposalTransitionObjectFactory.pointer(this); uniffiTypePayjoinProposalTransitionObjectFactory.freePointer(pointer); uniffiTypePayjoinProposalTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is PayjoinProposalTransition { return uniffiTypePayjoinProposalTransitionObjectFactory.isConcreteType( obj_ ); } } const uniffiTypePayjoinProposalTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): PayjoinProposalTransitionLike { const instance = Object.create(PayjoinProposalTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "PayjoinProposalTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_payjoinproposaltransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: PayjoinProposalTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: PayjoinProposalTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_payjoinproposaltransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_payjoinproposaltransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is PayjoinProposalTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "PayjoinProposalTransition" ); }, }; })(); const FfiConverterTypePayjoinProposalTransition = new FfiConverterObject( uniffiTypePayjoinProposalTransitionObjectFactory ); export interface PayjoinProposalLike { /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike; /** * Construct an OHTTP-encapsulated HTTP request carrying the Proposal PSBT. * * The inner HTTP method, body encoding, and target mailbox depend on * whether the original sender used Payjoin v2 (BIP 77) or Payjoin v1 * (BIP 78), as recorded in the session context: * * - v2 sender (reply key present): POST an HPKE-encrypted `PjV2MsgB` * payload to the sender's reply mailbox. * - v1 sender (no reply key): PUT the base64-encoded PSBT as cleartext * UTF-8 bytes to the receiver's own mailbox, per the * [BIP 77](https://github.com/bitcoin/bips/blob/master/bip-0077.md) * Backwards compatibility section. * * Both paths are then OHTTP-encapsulated to the directory's OHTTP Gateway. */ createPostRequest(ohttpRelay: string): /*throws*/ RequestResponse; /** * Processes the response for the final POST message from the receiver client in the v2 Payjoin protocol. * * This function decapsulates the response using the provided OHTTP context. If the response status is successful, it indicates that the Payjoin proposal has been accepted. Otherwise, it returns an error with the status code. * * After this function is called, the receiver can either wait for the Payjoin transaction to be broadcast or choose to broadcast the original PSBT. */ processResponse( body: ArrayBuffer, ohttpContext: ClientResponseLike ): PayjoinProposalTransitionLike; /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean; /** * Returns the finalized payjoin proposal PSBT. */ psbt(): string; } /** * @deprecated Use `PayjoinProposalLike` instead. */ export type PayjoinProposalInterface = PayjoinProposalLike; export class PayjoinProposal extends UniffiAbstractObject implements PayjoinProposalLike { readonly [uniffiTypeNameSymbol] = "PayjoinProposal"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypePayjoinProposalObjectFactory.bless(pointer); } /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike { return FfiConverterTypeCancelTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_payjoinproposal_cancel( uniffiTypePayjoinProposalObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Construct an OHTTP-encapsulated HTTP request carrying the Proposal PSBT. * * The inner HTTP method, body encoding, and target mailbox depend on * whether the original sender used Payjoin v2 (BIP 77) or Payjoin v1 * (BIP 78), as recorded in the session context: * * - v2 sender (reply key present): POST an HPKE-encrypted `PjV2MsgB` * payload to the sender's reply mailbox. * - v1 sender (no reply key): PUT the base64-encoded PSBT as cleartext * UTF-8 bytes to the receiver's own mailbox, per the * [BIP 77](https://github.com/bitcoin/bips/blob/master/bip-0077.md) * Backwards compatibility section. * * Both paths are then OHTTP-encapsulated to the directory's OHTTP Gateway. */ createPostRequest(ohttpRelay: string): RequestResponse /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterTypeRequestResponse.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverCreateRequestError__as_error.lift.bind( FfiConverterTypeReceiverCreateRequestError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_payjoinproposal_create_post_request( uniffiTypePayjoinProposalObjectFactory.clonePointer(this), FfiConverterString.lower( ohttpRelay, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Processes the response for the final POST message from the receiver client in the v2 Payjoin protocol. * * This function decapsulates the response using the provided OHTTP context. If the response status is successful, it indicates that the Payjoin proposal has been accepted. Otherwise, it returns an error with the status code. * * After this function is called, the receiver can either wait for the Payjoin transaction to be broadcast or choose to broadcast the original PSBT. */ processResponse( body: ArrayBuffer, ohttpContext: ClientResponseLike ): PayjoinProposalTransitionLike { return FfiConverterTypePayjoinProposalTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_payjoinproposal_process_response( uniffiTypePayjoinProposalObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower( body, nativeModule().rustbuffer_alloc ), FfiConverterTypeClientResponse.lower( ohttpContext, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_payjoinproposal_proposal_txid_is_stable( uniffiTypePayjoinProposalObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Returns the finalized payjoin proposal PSBT. */ psbt(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_payjoinproposal_psbt( uniffiTypePayjoinProposalObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypePayjoinProposalObjectFactory.pointer(this); uniffiTypePayjoinProposalObjectFactory.freePointer(pointer); uniffiTypePayjoinProposalObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is PayjoinProposal { return uniffiTypePayjoinProposalObjectFactory.isConcreteType(obj_); } } const uniffiTypePayjoinProposalObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): PayjoinProposalLike { const instance = Object.create(PayjoinProposal.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "PayjoinProposal"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_payjoinproposal_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: PayjoinProposalLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: PayjoinProposalLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_payjoinproposal( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_payjoinproposal( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is PayjoinProposalLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "PayjoinProposal" ); }, }; })(); const FfiConverterTypePayjoinProposal = new FfiConverterObject( uniffiTypePayjoinProposalObjectFactory ); export interface ProvisionalProposalTransitionLike { save(persister: JsonReceiverSessionPersister): /*throws*/ PayjoinProposalLike; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `ProvisionalProposalTransitionLike` instead. */ export type ProvisionalProposalTransitionInterface = ProvisionalProposalTransitionLike; export class ProvisionalProposalTransition extends UniffiAbstractObject implements ProvisionalProposalTransitionLike { readonly [uniffiTypeNameSymbol] = "ProvisionalProposalTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeProvisionalProposalTransitionObjectFactory.bless(pointer); } save( persister: JsonReceiverSessionPersister ): PayjoinProposalLike /*throws*/ { return FfiConverterTypePayjoinProposal.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_provisionalproposaltransition_save( uniffiTypeProvisionalProposalTransitionObjectFactory.clonePointer( this ), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_provisionalproposaltransition_save_async( uniffiTypeProvisionalProposalTransitionObjectFactory.clonePointer( this ), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypePayjoinProposal.lift.bind( FfiConverterTypePayjoinProposal ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeProvisionalProposalTransitionObjectFactory.pointer(this); uniffiTypeProvisionalProposalTransitionObjectFactory.freePointer(pointer); uniffiTypeProvisionalProposalTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ProvisionalProposalTransition { return uniffiTypeProvisionalProposalTransitionObjectFactory.isConcreteType( obj_ ); } } const uniffiTypeProvisionalProposalTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ProvisionalProposalTransitionLike { const instance = Object.create(ProvisionalProposalTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ProvisionalProposalTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_provisionalproposaltransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ProvisionalProposalTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ProvisionalProposalTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_provisionalproposaltransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_provisionalproposaltransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ProvisionalProposalTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ProvisionalProposalTransition" ); }, }; })(); const FfiConverterTypeProvisionalProposalTransition = new FfiConverterObject( uniffiTypeProvisionalProposalTransitionObjectFactory ); export interface ProvisionalProposalLike { /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike; /** * Finalize the proposal by signing the PSBT via the `process_psbt` callback. * * Returns a [`ProvisionalProposalTransition`] that, once persisted, * yields the final [`PayjoinProposal`]. */ finalizeProposal(processPsbt: ProcessPsbt): ProvisionalProposalTransitionLike; /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean; /** * Extract the PSBT that needs to be signed by the receiver's wallet. */ psbtToSign(): string; } /** * @deprecated Use `ProvisionalProposalLike` instead. */ export type ProvisionalProposalInterface = ProvisionalProposalLike; export class ProvisionalProposal extends UniffiAbstractObject implements ProvisionalProposalLike { readonly [uniffiTypeNameSymbol] = "ProvisionalProposal"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeProvisionalProposalObjectFactory.bless(pointer); } /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike { return FfiConverterTypeCancelTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_provisionalproposal_cancel( uniffiTypeProvisionalProposalObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Finalize the proposal by signing the PSBT via the `process_psbt` callback. * * Returns a [`ProvisionalProposalTransition`] that, once persisted, * yields the final [`PayjoinProposal`]. */ finalizeProposal( processPsbt: ProcessPsbt ): ProvisionalProposalTransitionLike { return FfiConverterTypeProvisionalProposalTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_provisionalproposal_finalize_proposal( uniffiTypeProvisionalProposalObjectFactory.clonePointer(this), FfiConverterTypeProcessPsbt.lower( processPsbt, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_provisionalproposal_proposal_txid_is_stable( uniffiTypeProvisionalProposalObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Extract the PSBT that needs to be signed by the receiver's wallet. */ psbtToSign(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_provisionalproposal_psbt_to_sign( uniffiTypeProvisionalProposalObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeProvisionalProposalObjectFactory.pointer(this); uniffiTypeProvisionalProposalObjectFactory.freePointer(pointer); uniffiTypeProvisionalProposalObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ProvisionalProposal { return uniffiTypeProvisionalProposalObjectFactory.isConcreteType(obj_); } } const uniffiTypeProvisionalProposalObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ProvisionalProposalLike { const instance = Object.create(ProvisionalProposal.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ProvisionalProposal"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_provisionalproposal_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ProvisionalProposalLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ProvisionalProposalLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_provisionalproposal( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_provisionalproposal( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ProvisionalProposalLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ProvisionalProposal" ); }, }; })(); const FfiConverterTypeProvisionalProposal = new FfiConverterObject( uniffiTypeProvisionalProposalObjectFactory ); export interface WantsFeeRangeTransitionLike { save( persister: JsonReceiverSessionPersister ): /*throws*/ ProvisionalProposalLike; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `WantsFeeRangeTransitionLike` instead. */ export type WantsFeeRangeTransitionInterface = WantsFeeRangeTransitionLike; export class WantsFeeRangeTransition extends UniffiAbstractObject implements WantsFeeRangeTransitionLike { readonly [uniffiTypeNameSymbol] = "WantsFeeRangeTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeWantsFeeRangeTransitionObjectFactory.bless(pointer); } save( persister: JsonReceiverSessionPersister ): ProvisionalProposalLike /*throws*/ { return FfiConverterTypeProvisionalProposal.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsfeerangetransition_save( uniffiTypeWantsFeeRangeTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsfeerangetransition_save_async( uniffiTypeWantsFeeRangeTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeProvisionalProposal.lift.bind( FfiConverterTypeProvisionalProposal ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeWantsFeeRangeTransitionObjectFactory.pointer(this); uniffiTypeWantsFeeRangeTransitionObjectFactory.freePointer(pointer); uniffiTypeWantsFeeRangeTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is WantsFeeRangeTransition { return uniffiTypeWantsFeeRangeTransitionObjectFactory.isConcreteType(obj_); } } const uniffiTypeWantsFeeRangeTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): WantsFeeRangeTransitionLike { const instance = Object.create(WantsFeeRangeTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "WantsFeeRangeTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_wantsfeerangetransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: WantsFeeRangeTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: WantsFeeRangeTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_wantsfeerangetransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_wantsfeerangetransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is WantsFeeRangeTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "WantsFeeRangeTransition" ); }, }; })(); const FfiConverterTypeWantsFeeRangeTransition = new FfiConverterObject( uniffiTypeWantsFeeRangeTransitionObjectFactory ); export interface WantsFeeRangeLike { /** * Applies additional fee contribution now that the receiver has contributed inputs * and may have added new outputs. * * How much the receiver ends up paying for fees depends on how much the sender stated they * were willing to pay in the parameters of the original proposal. For additional * inputs, fees will be subtracted from the sender's outputs as much as possible until we hit * the limit the sender specified in the Payjoin parameters. Any remaining fees for the new inputs * will be then subtracted from the change output of the receiver. * Fees for additional outputs are always subtracted from the receiver's outputs. * * `max_effective_fee_rate` is the maximum effective fee rate that the receiver is * willing to pay for their own input/output contributions. A `max_effective_fee_rate` * of zero indicates that the receiver is not willing to pay any additional * fees. Errors if the final effective fee rate exceeds `max_effective_fee_rate`. * * If not provided, `min_fee_rate_sat_per_vb` and `max_effective_fee_rate_sat_per_vb` default to the * minimum possible relay fee. * * The minimum effective fee limit is the highest of the minimum limit set by the sender in * the original proposal parameters and the limit passed in the `min_fee_rate_sat_per_vb` parameter. */ applyFeeRange( minFeeRateSatPerVb: bigint | undefined, maxEffectiveFeeRateSatPerVb: bigint | undefined ): /*throws*/ WantsFeeRangeTransitionLike; /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike; /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean; } /** * @deprecated Use `WantsFeeRangeLike` instead. */ export type WantsFeeRangeInterface = WantsFeeRangeLike; export class WantsFeeRange extends UniffiAbstractObject implements WantsFeeRangeLike { readonly [uniffiTypeNameSymbol] = "WantsFeeRange"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeWantsFeeRangeObjectFactory.bless(pointer); } /** * Applies additional fee contribution now that the receiver has contributed inputs * and may have added new outputs. * * How much the receiver ends up paying for fees depends on how much the sender stated they * were willing to pay in the parameters of the original proposal. For additional * inputs, fees will be subtracted from the sender's outputs as much as possible until we hit * the limit the sender specified in the Payjoin parameters. Any remaining fees for the new inputs * will be then subtracted from the change output of the receiver. * Fees for additional outputs are always subtracted from the receiver's outputs. * * `max_effective_fee_rate` is the maximum effective fee rate that the receiver is * willing to pay for their own input/output contributions. A `max_effective_fee_rate` * of zero indicates that the receiver is not willing to pay any additional * fees. Errors if the final effective fee rate exceeds `max_effective_fee_rate`. * * If not provided, `min_fee_rate_sat_per_vb` and `max_effective_fee_rate_sat_per_vb` default to the * minimum possible relay fee. * * The minimum effective fee limit is the highest of the minimum limit set by the sender in * the original proposal parameters and the limit passed in the `min_fee_rate_sat_per_vb` parameter. */ applyFeeRange( minFeeRateSatPerVb: bigint | undefined, maxEffectiveFeeRateSatPerVb: bigint | undefined ): WantsFeeRangeTransitionLike /*throws*/ { return FfiConverterTypeWantsFeeRangeTransition.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeFfiValidationError.lift.bind( FfiConverterTypeFfiValidationError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsfeerange_apply_fee_range( uniffiTypeWantsFeeRangeObjectFactory.clonePointer(this), FfiConverterOptionalUInt64.lower( minFeeRateSatPerVb, nativeModule().rustbuffer_alloc ), FfiConverterOptionalUInt64.lower( maxEffectiveFeeRateSatPerVb, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike { return FfiConverterTypeCancelTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsfeerange_cancel( uniffiTypeWantsFeeRangeObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsfeerange_proposal_txid_is_stable( uniffiTypeWantsFeeRangeObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeWantsFeeRangeObjectFactory.pointer(this); uniffiTypeWantsFeeRangeObjectFactory.freePointer(pointer); uniffiTypeWantsFeeRangeObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is WantsFeeRange { return uniffiTypeWantsFeeRangeObjectFactory.isConcreteType(obj_); } } const uniffiTypeWantsFeeRangeObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): WantsFeeRangeLike { const instance = Object.create(WantsFeeRange.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "WantsFeeRange"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_wantsfeerange_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: WantsFeeRangeLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: WantsFeeRangeLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_wantsfeerange( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_wantsfeerange( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is WantsFeeRangeLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "WantsFeeRange" ); }, }; })(); const FfiConverterTypeWantsFeeRange = new FfiConverterObject( uniffiTypeWantsFeeRangeObjectFactory ); export interface WantsInputsTransitionLike { save(persister: JsonReceiverSessionPersister): /*throws*/ WantsFeeRangeLike; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `WantsInputsTransitionLike` instead. */ export type WantsInputsTransitionInterface = WantsInputsTransitionLike; export class WantsInputsTransition extends UniffiAbstractObject implements WantsInputsTransitionLike { readonly [uniffiTypeNameSymbol] = "WantsInputsTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeWantsInputsTransitionObjectFactory.bless(pointer); } save(persister: JsonReceiverSessionPersister): WantsFeeRangeLike /*throws*/ { return FfiConverterTypeWantsFeeRange.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsinputstransition_save( uniffiTypeWantsInputsTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsinputstransition_save_async( uniffiTypeWantsInputsTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeWantsFeeRange.lift.bind( FfiConverterTypeWantsFeeRange ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeWantsInputsTransitionObjectFactory.pointer(this); uniffiTypeWantsInputsTransitionObjectFactory.freePointer(pointer); uniffiTypeWantsInputsTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is WantsInputsTransition { return uniffiTypeWantsInputsTransitionObjectFactory.isConcreteType(obj_); } } const uniffiTypeWantsInputsTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): WantsInputsTransitionLike { const instance = Object.create(WantsInputsTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "WantsInputsTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_wantsinputstransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: WantsInputsTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: WantsInputsTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_wantsinputstransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_wantsinputstransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is WantsInputsTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "WantsInputsTransition" ); }, }; })(); const FfiConverterTypeWantsInputsTransition = new FfiConverterObject( uniffiTypeWantsInputsTransitionObjectFactory ); export interface InputPairLike { /** * Returns the outpoint spent by this input pair. */ outpoint(): OutPoint; } /** * @deprecated Use `InputPairLike` instead. */ export type InputPairInterface = InputPairLike; export class InputPair extends UniffiAbstractObject implements InputPairLike { readonly [uniffiTypeNameSymbol] = "InputPair"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; constructor( txin: TxIn, psbtin: PsbtInput, expectedWeight: Weight | undefined ) /*throws*/ { super(); const pointer = uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeInputPairError.lift.bind( FfiConverterTypeInputPairError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_constructor_inputpair_new( FfiConverterTypeTxIn.lower(txin, nativeModule().rustbuffer_alloc), FfiConverterTypePsbtInput.lower( psbtin, nativeModule().rustbuffer_alloc ), FfiConverterOptionalTypeWeight.lower( expectedWeight, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeInputPairObjectFactory.bless(pointer); } /** * Returns the outpoint spent by this input pair. */ outpoint(): OutPoint { return ((__rb: Uint8Array) => { try { return FfiConverterTypeOutPoint.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_inputpair_outpoint( uniffiTypeInputPairObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeInputPairObjectFactory.pointer(this); uniffiTypeInputPairObjectFactory.freePointer(pointer); uniffiTypeInputPairObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is InputPair { return uniffiTypeInputPairObjectFactory.isConcreteType(obj_); } } const uniffiTypeInputPairObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): InputPairLike { const instance = Object.create(InputPair.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "InputPair"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_inputpair_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: InputPairLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: InputPairLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_inputpair( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_inputpair( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is InputPairLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "InputPair" ); }, }; })(); const FfiConverterTypeInputPair = new FfiConverterObject( uniffiTypeInputPairObjectFactory ); /** * Error that may occur when input contribution fails. */ export interface InputContributionErrorLike {} /** * @deprecated Use `InputContributionErrorLike` instead. */ export type InputContributionErrorInterface = InputContributionErrorLike; /** * Error that may occur when input contribution fails. */ export class InputContributionError extends UniffiAbstractObject implements InputContributionErrorLike { readonly [uniffiTypeNameSymbol] = "InputContributionError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeInputContributionErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_inputcontributionerror_uniffi_trait_display( uniffiTypeInputContributionErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_inputcontributionerror_uniffi_trait_debug( uniffiTypeInputContributionErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeInputContributionErrorObjectFactory.pointer(this); uniffiTypeInputContributionErrorObjectFactory.freePointer(pointer); uniffiTypeInputContributionErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is InputContributionError { return uniffiTypeInputContributionErrorObjectFactory.isConcreteType(obj_); } static hasInner( obj_: any ): obj_ is UniffiThrownObject { return ( UniffiThrownObject.instanceOf(obj_) && InputContributionError.instanceOf(obj_.inner) ); } static getInner( err: UniffiThrownObject ): InputContributionError { return err.inner; } } const uniffiTypeInputContributionErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): InputContributionErrorLike { const instance = Object.create(InputContributionError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "InputContributionError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_inputcontributionerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: InputContributionErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: InputContributionErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_inputcontributionerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_inputcontributionerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is InputContributionErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "InputContributionError" ); }, }; })(); const FfiConverterTypeInputContributionError = new FfiConverterObject( uniffiTypeInputContributionErrorObjectFactory ); const FfiConverterTypeInputContributionError__as_error = new FfiConverterObjectAsError( "InputContributionError", FfiConverterTypeInputContributionError ); /** * Error that may occur when coin selection fails. */ export interface CoinSelectionErrorLike {} /** * @deprecated Use `CoinSelectionErrorLike` instead. */ export type CoinSelectionErrorInterface = CoinSelectionErrorLike; /** * Error that may occur when coin selection fails. */ export class CoinSelectionError extends UniffiAbstractObject implements CoinSelectionErrorLike { readonly [uniffiTypeNameSymbol] = "CoinSelectionError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeCoinSelectionErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_coinselectionerror_uniffi_trait_display( uniffiTypeCoinSelectionErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_coinselectionerror_uniffi_trait_debug( uniffiTypeCoinSelectionErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeCoinSelectionErrorObjectFactory.pointer(this); uniffiTypeCoinSelectionErrorObjectFactory.freePointer(pointer); uniffiTypeCoinSelectionErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is CoinSelectionError { return uniffiTypeCoinSelectionErrorObjectFactory.isConcreteType(obj_); } static hasInner(obj_: any): obj_ is UniffiThrownObject { return ( UniffiThrownObject.instanceOf(obj_) && CoinSelectionError.instanceOf(obj_.inner) ); } static getInner( err: UniffiThrownObject ): CoinSelectionError { return err.inner; } } const uniffiTypeCoinSelectionErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): CoinSelectionErrorLike { const instance = Object.create(CoinSelectionError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "CoinSelectionError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_coinselectionerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: CoinSelectionErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: CoinSelectionErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_coinselectionerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_coinselectionerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is CoinSelectionErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "CoinSelectionError" ); }, }; })(); const FfiConverterTypeCoinSelectionError = new FfiConverterObject( uniffiTypeCoinSelectionErrorObjectFactory ); const FfiConverterTypeCoinSelectionError__as_error = new FfiConverterObjectAsError( "CoinSelectionError", FfiConverterTypeCoinSelectionError ); export interface WantsInputsLike { /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike; /** * Commit the input contributions and proceed to fee negotiation. * * Returns a [`WantsInputsTransition`] that, once persisted, * yields a [`WantsFeeRange`]. */ commitInputs(): WantsInputsTransitionLike; /** * Add the provided inputs to the payjoin proposal. * * Returns an updated [`WantsInputs`] with the contributed inputs. */ contributeInputs( replacementInputs: Array ): /*throws*/ WantsInputsLike; /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean; /** * Select receiver input such that the payjoin avoids surveillance. * Return the input chosen that has been applied to the Proposal. * * Proper coin selection allows payjoin to resemble ordinary transactions. * To ensure the resemblance, a number of heuristics must be avoided. * * UIH "Unnecessary input heuristic" is one class of them to avoid. We define * UIH1 and UIH2 according to the BlockSci practice * BlockSci UIH1 and UIH2: */ tryPreservingPrivacy( candidateInputs: Array ): /*throws*/ InputPairLike; } /** * @deprecated Use `WantsInputsLike` instead. */ export type WantsInputsInterface = WantsInputsLike; export class WantsInputs extends UniffiAbstractObject implements WantsInputsLike { readonly [uniffiTypeNameSymbol] = "WantsInputs"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeWantsInputsObjectFactory.bless(pointer); } /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike { return FfiConverterTypeCancelTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsinputs_cancel( uniffiTypeWantsInputsObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Commit the input contributions and proceed to fee negotiation. * * Returns a [`WantsInputsTransition`] that, once persisted, * yields a [`WantsFeeRange`]. */ commitInputs(): WantsInputsTransitionLike { return FfiConverterTypeWantsInputsTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsinputs_commit_inputs( uniffiTypeWantsInputsObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Add the provided inputs to the payjoin proposal. * * Returns an updated [`WantsInputs`] with the contributed inputs. */ contributeInputs( replacementInputs: Array ): WantsInputsLike /*throws*/ { return FfiConverterTypeWantsInputs.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeInputContributionError__as_error.lift.bind( FfiConverterTypeInputContributionError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsinputs_contribute_inputs( uniffiTypeWantsInputsObjectFactory.clonePointer(this), FfiConverterSequenceTypeInputPair.lower( replacementInputs, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsinputs_proposal_txid_is_stable( uniffiTypeWantsInputsObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Select receiver input such that the payjoin avoids surveillance. * Return the input chosen that has been applied to the Proposal. * * Proper coin selection allows payjoin to resemble ordinary transactions. * To ensure the resemblance, a number of heuristics must be avoided. * * UIH "Unnecessary input heuristic" is one class of them to avoid. We define * UIH1 and UIH2 according to the BlockSci practice * BlockSci UIH1 and UIH2: */ tryPreservingPrivacy( candidateInputs: Array ): InputPairLike /*throws*/ { return FfiConverterTypeInputPair.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeCoinSelectionError__as_error.lift.bind( FfiConverterTypeCoinSelectionError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsinputs_try_preserving_privacy( uniffiTypeWantsInputsObjectFactory.clonePointer(this), FfiConverterSequenceTypeInputPair.lower( candidateInputs, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeWantsInputsObjectFactory.pointer(this); uniffiTypeWantsInputsObjectFactory.freePointer(pointer); uniffiTypeWantsInputsObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is WantsInputs { return uniffiTypeWantsInputsObjectFactory.isConcreteType(obj_); } } const uniffiTypeWantsInputsObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): WantsInputsLike { const instance = Object.create(WantsInputs.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "WantsInputs"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_wantsinputs_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: WantsInputsLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: WantsInputsLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_wantsinputs( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_wantsinputs( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is WantsInputsLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "WantsInputs" ); }, }; })(); const FfiConverterTypeWantsInputs = new FfiConverterObject( uniffiTypeWantsInputsObjectFactory ); export interface WantsOutputsTransitionLike { save(persister: JsonReceiverSessionPersister): /*throws*/ WantsInputsLike; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `WantsOutputsTransitionLike` instead. */ export type WantsOutputsTransitionInterface = WantsOutputsTransitionLike; export class WantsOutputsTransition extends UniffiAbstractObject implements WantsOutputsTransitionLike { readonly [uniffiTypeNameSymbol] = "WantsOutputsTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeWantsOutputsTransitionObjectFactory.bless(pointer); } save(persister: JsonReceiverSessionPersister): WantsInputsLike /*throws*/ { return FfiConverterTypeWantsInputs.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsoutputstransition_save( uniffiTypeWantsOutputsTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsoutputstransition_save_async( uniffiTypeWantsOutputsTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeWantsInputs.lift.bind( FfiConverterTypeWantsInputs ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeWantsOutputsTransitionObjectFactory.pointer(this); uniffiTypeWantsOutputsTransitionObjectFactory.freePointer(pointer); uniffiTypeWantsOutputsTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is WantsOutputsTransition { return uniffiTypeWantsOutputsTransitionObjectFactory.isConcreteType(obj_); } } const uniffiTypeWantsOutputsTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): WantsOutputsTransitionLike { const instance = Object.create(WantsOutputsTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "WantsOutputsTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_wantsoutputstransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: WantsOutputsTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: WantsOutputsTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_wantsoutputstransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_wantsoutputstransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is WantsOutputsTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "WantsOutputsTransition" ); }, }; })(); const FfiConverterTypeWantsOutputsTransition = new FfiConverterObject( uniffiTypeWantsOutputsTransitionObjectFactory ); export enum OutputSubstitution { Enabled, Disabled, } const FfiConverterTypeOutputSubstitution = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = OutputSubstitution; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return OutputSubstitution.Enabled; case 2: return OutputSubstitution.Disabled; default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value) { case OutputSubstitution.Enabled: return ordinalConverter.write(1, into); case OutputSubstitution.Disabled: return ordinalConverter.write(2, into); } } allocationSize(value: TypeName): number { return ordinalConverter.allocationSize(0); } } return new FFIConverter(); })(); /** * Protocol error raised during output substitution. */ export interface OutputSubstitutionProtocolErrorLike {} /** * @deprecated Use `OutputSubstitutionProtocolErrorLike` instead. */ export type OutputSubstitutionProtocolErrorInterface = OutputSubstitutionProtocolErrorLike; /** * Protocol error raised during output substitution. */ export class OutputSubstitutionProtocolError extends UniffiAbstractObject implements OutputSubstitutionProtocolErrorLike { readonly [uniffiTypeNameSymbol] = "OutputSubstitutionProtocolError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeOutputSubstitutionProtocolErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_outputsubstitutionprotocolerror_uniffi_trait_display( uniffiTypeOutputSubstitutionProtocolErrorObjectFactory.clonePointer( this ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_outputsubstitutionprotocolerror_uniffi_trait_debug( uniffiTypeOutputSubstitutionProtocolErrorObjectFactory.clonePointer( this ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeOutputSubstitutionProtocolErrorObjectFactory.pointer(this); uniffiTypeOutputSubstitutionProtocolErrorObjectFactory.freePointer( pointer ); uniffiTypeOutputSubstitutionProtocolErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is OutputSubstitutionProtocolError { return uniffiTypeOutputSubstitutionProtocolErrorObjectFactory.isConcreteType( obj_ ); } } const uniffiTypeOutputSubstitutionProtocolErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): OutputSubstitutionProtocolErrorLike { const instance = Object.create( OutputSubstitutionProtocolError.prototype ); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "OutputSubstitutionProtocolError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_outputsubstitutionprotocolerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: OutputSubstitutionProtocolErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: OutputSubstitutionProtocolErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_outputsubstitutionprotocolerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_outputsubstitutionprotocolerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is OutputSubstitutionProtocolErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "OutputSubstitutionProtocolError" ); }, }; })(); const FfiConverterTypeOutputSubstitutionProtocolError = new FfiConverterObject( uniffiTypeOutputSubstitutionProtocolErrorObjectFactory ); // Error type: OutputSubstitutionError export enum OutputSubstitutionError_Tags { Protocol = "Protocol", FfiValidation = "FfiValidation", } /** * Error that may occur when output substitution fails. */ export const OutputSubstitutionError = (() => { type Protocol__interface = { tag: OutputSubstitutionError_Tags.Protocol; inner: Readonly<[OutputSubstitutionProtocolErrorLike]>; }; class Protocol_ extends UniffiError implements Protocol__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "OutputSubstitutionError"; readonly tag = OutputSubstitutionError_Tags.Protocol; readonly inner: Readonly<[OutputSubstitutionProtocolErrorLike]>; constructor(v0: OutputSubstitutionProtocolErrorLike) { super("OutputSubstitutionError", "Protocol"); this.inner = Object.freeze([v0]); } static new(v0: OutputSubstitutionProtocolErrorLike): Protocol_ { return new Protocol_(v0); } static instanceOf(obj: any): obj is Protocol_ { return obj.tag === OutputSubstitutionError_Tags.Protocol; } static hasInner(obj: any): obj is Protocol_ { return Protocol_.instanceOf(obj); } static getInner( obj: Protocol_ ): Readonly<[OutputSubstitutionProtocolErrorLike]> { return obj.inner; } } type FfiValidation__interface = { tag: OutputSubstitutionError_Tags.FfiValidation; inner: Readonly<[FfiValidationError]>; }; class FfiValidation_ extends UniffiError implements FfiValidation__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "OutputSubstitutionError"; readonly tag = OutputSubstitutionError_Tags.FfiValidation; readonly inner: Readonly<[FfiValidationError]>; constructor(v0: FfiValidationError) { super("OutputSubstitutionError", "FfiValidation"); this.inner = Object.freeze([v0]); } static new(v0: FfiValidationError): FfiValidation_ { return new FfiValidation_(v0); } static instanceOf(obj: any): obj is FfiValidation_ { return obj.tag === OutputSubstitutionError_Tags.FfiValidation; } static hasInner(obj: any): obj is FfiValidation_ { return FfiValidation_.instanceOf(obj); } static getInner(obj: FfiValidation_): Readonly<[FfiValidationError]> { return obj.inner; } } function instanceOf(obj: any): obj is OutputSubstitutionError { return obj[uniffiTypeNameSymbol] === "OutputSubstitutionError"; } return Object.freeze({ instanceOf, Protocol: Protocol_, FfiValidation: FfiValidation_, }); })(); /** * Error that may occur when output substitution fails. */ export type OutputSubstitutionError = InstanceType< (typeof OutputSubstitutionError)["Protocol" | "FfiValidation"] >; // FfiConverter for enum OutputSubstitutionError const FfiConverterTypeOutputSubstitutionError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = OutputSubstitutionError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new OutputSubstitutionError.Protocol( FfiConverterTypeOutputSubstitutionProtocolError.read(from) ); case 2: return new OutputSubstitutionError.FfiValidation( FfiConverterTypeFfiValidationError.read(from) ); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case OutputSubstitutionError_Tags.Protocol: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeOutputSubstitutionProtocolError.write(inner[0], into); return; } case OutputSubstitutionError_Tags.FfiValidation: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeFfiValidationError.write(inner[0], into); return; } default: // Throwing from here means that OutputSubstitutionError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case OutputSubstitutionError_Tags.Protocol: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeOutputSubstitutionProtocolError.allocationSize( inner[0] ); return size; } case OutputSubstitutionError_Tags.FfiValidation: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeFfiValidationError.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); export interface WantsOutputsLike { /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike; /** * Commit the output modifications and proceed to input contribution. * * Returns a [`WantsOutputsTransition`] that, once persisted, * yields a [`WantsInputs`]. */ commitOutputs(): WantsOutputsTransitionLike; /** * Returns whether output substitution is enabled for this session. */ outputSubstitution(): OutputSubstitution; /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean; /** * Replace all receiver outputs with the provided `replacement_outputs`, * and set up the `drain_script` as the receiver-owned output whose value * may be adjusted based on modifications in subsequent states. * * Returns an updated [`WantsOutputs`] with the replaced outputs. */ replaceReceiverOutputs( replacementOutputs: Array, drainScriptPubkey: ArrayBuffer ): /*throws*/ WantsOutputsLike; /** * Substitute the receiver output script with the provided script. * * Returns an updated [`WantsOutputs`] with the substituted output. */ substituteReceiverScript( outputScriptPubkey: ArrayBuffer ): /*throws*/ WantsOutputsLike; } /** * @deprecated Use `WantsOutputsLike` instead. */ export type WantsOutputsInterface = WantsOutputsLike; export class WantsOutputs extends UniffiAbstractObject implements WantsOutputsLike { readonly [uniffiTypeNameSymbol] = "WantsOutputs"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeWantsOutputsObjectFactory.bless(pointer); } /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike { return FfiConverterTypeCancelTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsoutputs_cancel( uniffiTypeWantsOutputsObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Commit the output modifications and proceed to input contribution. * * Returns a [`WantsOutputsTransition`] that, once persisted, * yields a [`WantsInputs`]. */ commitOutputs(): WantsOutputsTransitionLike { return FfiConverterTypeWantsOutputsTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsoutputs_commit_outputs( uniffiTypeWantsOutputsObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Returns whether output substitution is enabled for this session. */ outputSubstitution(): OutputSubstitution { return ((__rb: Uint8Array) => { try { return FfiConverterTypeOutputSubstitution.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsoutputs_output_substitution( uniffiTypeWantsOutputsObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsoutputs_proposal_txid_is_stable( uniffiTypeWantsOutputsObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Replace all receiver outputs with the provided `replacement_outputs`, * and set up the `drain_script` as the receiver-owned output whose value * may be adjusted based on modifications in subsequent states. * * Returns an updated [`WantsOutputs`] with the replaced outputs. */ replaceReceiverOutputs( replacementOutputs: Array, drainScriptPubkey: ArrayBuffer ): WantsOutputsLike /*throws*/ { return FfiConverterTypeWantsOutputs.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeOutputSubstitutionError.lift.bind( FfiConverterTypeOutputSubstitutionError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsoutputs_replace_receiver_outputs( uniffiTypeWantsOutputsObjectFactory.clonePointer(this), FfiConverterSequenceTypeTxOut.lower( replacementOutputs, nativeModule().rustbuffer_alloc ), FfiConverterArrayBuffer.lower( drainScriptPubkey, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Substitute the receiver output script with the provided script. * * Returns an updated [`WantsOutputs`] with the substituted output. */ substituteReceiverScript( outputScriptPubkey: ArrayBuffer ): WantsOutputsLike /*throws*/ { return FfiConverterTypeWantsOutputs.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeOutputSubstitutionError.lift.bind( FfiConverterTypeOutputSubstitutionError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_wantsoutputs_substitute_receiver_script( uniffiTypeWantsOutputsObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower( outputScriptPubkey, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeWantsOutputsObjectFactory.pointer(this); uniffiTypeWantsOutputsObjectFactory.freePointer(pointer); uniffiTypeWantsOutputsObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is WantsOutputs { return uniffiTypeWantsOutputsObjectFactory.isConcreteType(obj_); } } const uniffiTypeWantsOutputsObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): WantsOutputsLike { const instance = Object.create(WantsOutputs.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "WantsOutputs"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_wantsoutputs_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: WantsOutputsLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: WantsOutputsLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_wantsoutputs( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_wantsoutputs( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is WantsOutputsLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "WantsOutputs" ); }, }; })(); const FfiConverterTypeWantsOutputs = new FfiConverterObject( uniffiTypeWantsOutputsObjectFactory ); export interface OutputsUnknownTransitionLike { save(persister: JsonReceiverSessionPersister): /*throws*/ WantsOutputsLike; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `OutputsUnknownTransitionLike` instead. */ export type OutputsUnknownTransitionInterface = OutputsUnknownTransitionLike; export class OutputsUnknownTransition extends UniffiAbstractObject implements OutputsUnknownTransitionLike { readonly [uniffiTypeNameSymbol] = "OutputsUnknownTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeOutputsUnknownTransitionObjectFactory.bless(pointer); } save(persister: JsonReceiverSessionPersister): WantsOutputsLike /*throws*/ { return FfiConverterTypeWantsOutputs.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_outputsunknowntransition_save( uniffiTypeOutputsUnknownTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_outputsunknowntransition_save_async( uniffiTypeOutputsUnknownTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeWantsOutputs.lift.bind( FfiConverterTypeWantsOutputs ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeOutputsUnknownTransitionObjectFactory.pointer(this); uniffiTypeOutputsUnknownTransitionObjectFactory.freePointer(pointer); uniffiTypeOutputsUnknownTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is OutputsUnknownTransition { return uniffiTypeOutputsUnknownTransitionObjectFactory.isConcreteType(obj_); } } const uniffiTypeOutputsUnknownTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): OutputsUnknownTransitionLike { const instance = Object.create(OutputsUnknownTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "OutputsUnknownTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_outputsunknowntransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: OutputsUnknownTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: OutputsUnknownTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_outputsunknowntransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_outputsunknowntransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is OutputsUnknownTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "OutputsUnknownTransition" ); }, }; })(); const FfiConverterTypeOutputsUnknownTransition = new FfiConverterObject( uniffiTypeOutputsUnknownTransitionObjectFactory ); /** * The receiver has not yet identified which outputs belong to the receiver. * * Only accept PSBTs that send us money. * Identify those outputs with `identify_receiver_outputs()` to proceed */ export interface OutputsUnknownLike { /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike; /** * Identify which outputs in the original transaction belong to the receiver * and ensure at least one output pays the receiver. * * Returns an [`OutputsUnknownTransition`] that, once persisted, * yields a [`WantsOutputs`] to continue the proposal. */ identifyReceiverOutputs( isReceiverOutput: IsScriptOwned ): OutputsUnknownTransitionLike; /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean; } /** * @deprecated Use `OutputsUnknownLike` instead. */ export type OutputsUnknownInterface = OutputsUnknownLike; /** * The receiver has not yet identified which outputs belong to the receiver. * * Only accept PSBTs that send us money. * Identify those outputs with `identify_receiver_outputs()` to proceed */ export class OutputsUnknown extends UniffiAbstractObject implements OutputsUnknownLike { readonly [uniffiTypeNameSymbol] = "OutputsUnknown"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeOutputsUnknownObjectFactory.bless(pointer); } /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike { return FfiConverterTypeCancelTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_outputsunknown_cancel( uniffiTypeOutputsUnknownObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Identify which outputs in the original transaction belong to the receiver * and ensure at least one output pays the receiver. * * Returns an [`OutputsUnknownTransition`] that, once persisted, * yields a [`WantsOutputs`] to continue the proposal. */ identifyReceiverOutputs( isReceiverOutput: IsScriptOwned ): OutputsUnknownTransitionLike { return FfiConverterTypeOutputsUnknownTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_outputsunknown_identify_receiver_outputs( uniffiTypeOutputsUnknownObjectFactory.clonePointer(this), FfiConverterTypeIsScriptOwned.lower( isReceiverOutput, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_outputsunknown_proposal_txid_is_stable( uniffiTypeOutputsUnknownObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeOutputsUnknownObjectFactory.pointer(this); uniffiTypeOutputsUnknownObjectFactory.freePointer(pointer); uniffiTypeOutputsUnknownObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is OutputsUnknown { return uniffiTypeOutputsUnknownObjectFactory.isConcreteType(obj_); } } const uniffiTypeOutputsUnknownObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): OutputsUnknownLike { const instance = Object.create(OutputsUnknown.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "OutputsUnknown"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_outputsunknown_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: OutputsUnknownLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: OutputsUnknownLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_outputsunknown( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_outputsunknown( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is OutputsUnknownLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "OutputsUnknown" ); }, }; })(); const FfiConverterTypeOutputsUnknown = new FfiConverterObject( uniffiTypeOutputsUnknownObjectFactory ); export interface MaybeInputsSeenTransitionLike { save(persister: JsonReceiverSessionPersister): /*throws*/ OutputsUnknownLike; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `MaybeInputsSeenTransitionLike` instead. */ export type MaybeInputsSeenTransitionInterface = MaybeInputsSeenTransitionLike; export class MaybeInputsSeenTransition extends UniffiAbstractObject implements MaybeInputsSeenTransitionLike { readonly [uniffiTypeNameSymbol] = "MaybeInputsSeenTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeMaybeInputsSeenTransitionObjectFactory.bless(pointer); } save(persister: JsonReceiverSessionPersister): OutputsUnknownLike /*throws*/ { return FfiConverterTypeOutputsUnknown.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_maybeinputsseentransition_save( uniffiTypeMaybeInputsSeenTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_maybeinputsseentransition_save_async( uniffiTypeMaybeInputsSeenTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeOutputsUnknown.lift.bind( FfiConverterTypeOutputsUnknown ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeMaybeInputsSeenTransitionObjectFactory.pointer(this); uniffiTypeMaybeInputsSeenTransitionObjectFactory.freePointer(pointer); uniffiTypeMaybeInputsSeenTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is MaybeInputsSeenTransition { return uniffiTypeMaybeInputsSeenTransitionObjectFactory.isConcreteType( obj_ ); } } const uniffiTypeMaybeInputsSeenTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): MaybeInputsSeenTransitionLike { const instance = Object.create(MaybeInputsSeenTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "MaybeInputsSeenTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_maybeinputsseentransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: MaybeInputsSeenTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: MaybeInputsSeenTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_maybeinputsseentransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_maybeinputsseentransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is MaybeInputsSeenTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "MaybeInputsSeenTransition" ); }, }; })(); const FfiConverterTypeMaybeInputsSeenTransition = new FfiConverterObject( uniffiTypeMaybeInputsSeenTransitionObjectFactory ); export interface MaybeInputsSeenLike { /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike; /** * Check that none of the inputs have been seen before, preventing input * probing and replay attacks (where inputs have been used in a previous * payjoin attempt). * * Returns a [`MaybeInputsSeenTransition`] that, once persisted, * yields an [`OutputsUnknown`] to continue validation. */ checkNoInputsSeenBefore( isKnown: IsOutputKnown ): MaybeInputsSeenTransitionLike; /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean; } /** * @deprecated Use `MaybeInputsSeenLike` instead. */ export type MaybeInputsSeenInterface = MaybeInputsSeenLike; export class MaybeInputsSeen extends UniffiAbstractObject implements MaybeInputsSeenLike { readonly [uniffiTypeNameSymbol] = "MaybeInputsSeen"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeMaybeInputsSeenObjectFactory.bless(pointer); } /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike { return FfiConverterTypeCancelTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_maybeinputsseen_cancel( uniffiTypeMaybeInputsSeenObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Check that none of the inputs have been seen before, preventing input * probing and replay attacks (where inputs have been used in a previous * payjoin attempt). * * Returns a [`MaybeInputsSeenTransition`] that, once persisted, * yields an [`OutputsUnknown`] to continue validation. */ checkNoInputsSeenBefore( isKnown: IsOutputKnown ): MaybeInputsSeenTransitionLike { return FfiConverterTypeMaybeInputsSeenTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_maybeinputsseen_check_no_inputs_seen_before( uniffiTypeMaybeInputsSeenObjectFactory.clonePointer(this), FfiConverterTypeIsOutputKnown.lower( isKnown, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_maybeinputsseen_proposal_txid_is_stable( uniffiTypeMaybeInputsSeenObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeMaybeInputsSeenObjectFactory.pointer(this); uniffiTypeMaybeInputsSeenObjectFactory.freePointer(pointer); uniffiTypeMaybeInputsSeenObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is MaybeInputsSeen { return uniffiTypeMaybeInputsSeenObjectFactory.isConcreteType(obj_); } } const uniffiTypeMaybeInputsSeenObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): MaybeInputsSeenLike { const instance = Object.create(MaybeInputsSeen.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "MaybeInputsSeen"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_maybeinputsseen_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: MaybeInputsSeenLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: MaybeInputsSeenLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_maybeinputsseen( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_maybeinputsseen( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is MaybeInputsSeenLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "MaybeInputsSeen" ); }, }; })(); const FfiConverterTypeMaybeInputsSeen = new FfiConverterObject( uniffiTypeMaybeInputsSeenObjectFactory ); export interface MaybeInputsOwnedTransitionLike { save(persister: JsonReceiverSessionPersister): /*throws*/ MaybeInputsSeenLike; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `MaybeInputsOwnedTransitionLike` instead. */ export type MaybeInputsOwnedTransitionInterface = MaybeInputsOwnedTransitionLike; export class MaybeInputsOwnedTransition extends UniffiAbstractObject implements MaybeInputsOwnedTransitionLike { readonly [uniffiTypeNameSymbol] = "MaybeInputsOwnedTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeMaybeInputsOwnedTransitionObjectFactory.bless(pointer); } save( persister: JsonReceiverSessionPersister ): MaybeInputsSeenLike /*throws*/ { return FfiConverterTypeMaybeInputsSeen.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_maybeinputsownedtransition_save( uniffiTypeMaybeInputsOwnedTransitionObjectFactory.clonePointer( this ), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_maybeinputsownedtransition_save_async( uniffiTypeMaybeInputsOwnedTransitionObjectFactory.clonePointer( this ), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeMaybeInputsSeen.lift.bind( FfiConverterTypeMaybeInputsSeen ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeMaybeInputsOwnedTransitionObjectFactory.pointer(this); uniffiTypeMaybeInputsOwnedTransitionObjectFactory.freePointer(pointer); uniffiTypeMaybeInputsOwnedTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is MaybeInputsOwnedTransition { return uniffiTypeMaybeInputsOwnedTransitionObjectFactory.isConcreteType( obj_ ); } } const uniffiTypeMaybeInputsOwnedTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): MaybeInputsOwnedTransitionLike { const instance = Object.create(MaybeInputsOwnedTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "MaybeInputsOwnedTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_maybeinputsownedtransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: MaybeInputsOwnedTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: MaybeInputsOwnedTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_maybeinputsownedtransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_maybeinputsownedtransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is MaybeInputsOwnedTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "MaybeInputsOwnedTransition" ); }, }; })(); const FfiConverterTypeMaybeInputsOwnedTransition = new FfiConverterObject( uniffiTypeMaybeInputsOwnedTransitionObjectFactory ); export interface MaybeInputsOwnedLike { /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike; /** * Check that none of the Original PSBT's inputs belong to the receiver, * preventing an attacker from spending the receiver's own inputs. * * Returns a [`MaybeInputsOwnedTransition`] that, once persisted, * yields a [`MaybeInputsSeen`] to continue validation. */ checkInputsNotOwned(isOwned: IsInputOwned): MaybeInputsOwnedTransitionLike; /** * Extract the transaction from the Original PSBT for scheduling broadcast as a * fallback in case the payjoin does not complete. * * Returns the consensus-encoded raw transaction bytes. */ extractTxToScheduleBroadcast(): ArrayBuffer; /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean; } /** * @deprecated Use `MaybeInputsOwnedLike` instead. */ export type MaybeInputsOwnedInterface = MaybeInputsOwnedLike; export class MaybeInputsOwned extends UniffiAbstractObject implements MaybeInputsOwnedLike { readonly [uniffiTypeNameSymbol] = "MaybeInputsOwned"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeMaybeInputsOwnedObjectFactory.bless(pointer); } /** * Cancel the Payjoin session and return pending fallback handling. * * Returns an [`CancelTransition`] that, once persisted, yields a * [`ReceiverPendingFallback`]. */ cancel(): CancelTransitionLike { return FfiConverterTypeCancelTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_maybeinputsowned_cancel( uniffiTypeMaybeInputsOwnedObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Check that none of the Original PSBT's inputs belong to the receiver, * preventing an attacker from spending the receiver's own inputs. * * Returns a [`MaybeInputsOwnedTransition`] that, once persisted, * yields a [`MaybeInputsSeen`] to continue validation. */ checkInputsNotOwned(isOwned: IsInputOwned): MaybeInputsOwnedTransitionLike { return FfiConverterTypeMaybeInputsOwnedTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_maybeinputsowned_check_inputs_not_owned( uniffiTypeMaybeInputsOwnedObjectFactory.clonePointer(this), FfiConverterTypeIsInputOwned.lower( isOwned, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Extract the transaction from the Original PSBT for scheduling broadcast as a * fallback in case the payjoin does not complete. * * Returns the consensus-encoded raw transaction bytes. */ extractTxToScheduleBroadcast(): ArrayBuffer { return ((__rb: Uint8Array) => { try { return FfiConverterArrayBuffer.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_maybeinputsowned_extract_tx_to_schedule_broadcast( uniffiTypeMaybeInputsOwnedObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Whether the payjoin proposal's transaction ID is knowable in advance. * * If every sender input is native SegWit (empty script_sig), the * transaction ID computed from the unsigned proposal remains valid once * the sender re-signs, so the receiver can record it (e.g. to reconcile * an incoming payment) and monitor the network for it. If any sender * input finalizes with a non-empty script_sig — legacy inputs, but also * P2SH-wrapped SegWit — the sender's final script_sig changes the * transaction ID: any ID derived from the proposal before the sender * signs will never appear on the network, and monitoring concludes the * session without checking. */ proposalTxidIsStable(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_maybeinputsowned_proposal_txid_is_stable( uniffiTypeMaybeInputsOwnedObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeMaybeInputsOwnedObjectFactory.pointer(this); uniffiTypeMaybeInputsOwnedObjectFactory.freePointer(pointer); uniffiTypeMaybeInputsOwnedObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is MaybeInputsOwned { return uniffiTypeMaybeInputsOwnedObjectFactory.isConcreteType(obj_); } } const uniffiTypeMaybeInputsOwnedObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): MaybeInputsOwnedLike { const instance = Object.create(MaybeInputsOwned.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "MaybeInputsOwned"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_maybeinputsowned_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: MaybeInputsOwnedLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: MaybeInputsOwnedLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_maybeinputsowned( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_maybeinputsowned( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is MaybeInputsOwnedLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "MaybeInputsOwned" ); }, }; })(); const FfiConverterTypeMaybeInputsOwned = new FfiConverterObject( uniffiTypeMaybeInputsOwnedObjectFactory ); export interface AssumeInteractiveTransitionLike { save( persister: JsonReceiverSessionPersister ): /*throws*/ MaybeInputsOwnedLike; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `AssumeInteractiveTransitionLike` instead. */ export type AssumeInteractiveTransitionInterface = AssumeInteractiveTransitionLike; export class AssumeInteractiveTransition extends UniffiAbstractObject implements AssumeInteractiveTransitionLike { readonly [uniffiTypeNameSymbol] = "AssumeInteractiveTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeAssumeInteractiveTransitionObjectFactory.bless(pointer); } save( persister: JsonReceiverSessionPersister ): MaybeInputsOwnedLike /*throws*/ { return FfiConverterTypeMaybeInputsOwned.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_assumeinteractivetransition_save( uniffiTypeAssumeInteractiveTransitionObjectFactory.clonePointer( this ), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_assumeinteractivetransition_save_async( uniffiTypeAssumeInteractiveTransitionObjectFactory.clonePointer( this ), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeMaybeInputsOwned.lift.bind( FfiConverterTypeMaybeInputsOwned ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeAssumeInteractiveTransitionObjectFactory.pointer(this); uniffiTypeAssumeInteractiveTransitionObjectFactory.freePointer(pointer); uniffiTypeAssumeInteractiveTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is AssumeInteractiveTransition { return uniffiTypeAssumeInteractiveTransitionObjectFactory.isConcreteType( obj_ ); } } const uniffiTypeAssumeInteractiveTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): AssumeInteractiveTransitionLike { const instance = Object.create(AssumeInteractiveTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "AssumeInteractiveTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_assumeinteractivetransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: AssumeInteractiveTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: AssumeInteractiveTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_assumeinteractivetransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_assumeinteractivetransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is AssumeInteractiveTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "AssumeInteractiveTransition" ); }, }; })(); const FfiConverterTypeAssumeInteractiveTransition = new FfiConverterObject( uniffiTypeAssumeInteractiveTransitionObjectFactory ); export interface CanBroadcast { callback(tx: ArrayBuffer): /*throws*/ boolean; } export class CanBroadcastImpl extends UniffiAbstractObject implements CanBroadcast { readonly [uniffiTypeNameSymbol] = "CanBroadcastImpl"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeCanBroadcastImplObjectFactory.bless(pointer); } callback(tx: ArrayBuffer): boolean /*throws*/ { return FfiConverterBool.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_canbroadcast_callback( uniffiTypeCanBroadcastImplObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(tx, nativeModule().rustbuffer_alloc), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeCanBroadcastImplObjectFactory.pointer(this); uniffiTypeCanBroadcastImplObjectFactory.freePointer(pointer); uniffiTypeCanBroadcastImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is CanBroadcastImpl { return uniffiTypeCanBroadcastImplObjectFactory.isConcreteType(obj_); } } const uniffiTypeCanBroadcastImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): CanBroadcast { const instance = Object.create(CanBroadcastImpl.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "CanBroadcastImpl"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_canbroadcast_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: CanBroadcast): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: CanBroadcast): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_canbroadcast( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_canbroadcast( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is CanBroadcast { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "CanBroadcastImpl" ); }, }; })(); const FfiConverterTypeCanBroadcast = new FfiConverterObjectWithCallbacks( uniffiTypeCanBroadcastImplObjectFactory ); // Add a vtable for the callbacks that go in CanBroadcast. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceCanBroadcast: { vtable: any; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { callback: (uniffiHandle: bigint, tx: Uint8Array) => { const uniffiMakeCall = (): boolean => { const jsCallback = FfiConverterTypeCanBroadcast.lift(uniffiHandle); return jsCallback.callback(FfiConverterArrayBuffer.lift(tx)); }; const uniffiResult = UniffiResult.ready(); const uniffiHandleSuccess = (obj: any) => { UniffiResult.writeSuccess( uniffiResult, FfiConverterBool.lower(obj, nativeModule().rustbuffer_alloc) ); }; const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { UniffiResult.writeError(uniffiResult, code, errBuf); }; uniffiTraitInterfaceCallWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiResult; }, uniffi_free: (uniffiHandle: UniffiHandle): void => { // this will throw a stale handle error if the handle isn't found. FfiConverterTypeCanBroadcast.drop(uniffiHandle); }, uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { return FfiConverterTypeCanBroadcast.clone(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_init_callback_vtable_canbroadcast( uniffiCallbackInterfaceCanBroadcast.vtable ); }, }; export interface UncheckedOriginalPayloadTransitionLike { save( persister: JsonReceiverSessionPersister ): /*throws*/ MaybeInputsOwnedLike; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `UncheckedOriginalPayloadTransitionLike` instead. */ export type UncheckedOriginalPayloadTransitionInterface = UncheckedOriginalPayloadTransitionLike; export class UncheckedOriginalPayloadTransition extends UniffiAbstractObject implements UncheckedOriginalPayloadTransitionLike { readonly [uniffiTypeNameSymbol] = "UncheckedOriginalPayloadTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeUncheckedOriginalPayloadTransitionObjectFactory.bless(pointer); } save( persister: JsonReceiverSessionPersister ): MaybeInputsOwnedLike /*throws*/ { return FfiConverterTypeMaybeInputsOwned.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_uncheckedoriginalpayloadtransition_save( uniffiTypeUncheckedOriginalPayloadTransitionObjectFactory.clonePointer( this ), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_uncheckedoriginalpayloadtransition_save_async( uniffiTypeUncheckedOriginalPayloadTransitionObjectFactory.clonePointer( this ), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeMaybeInputsOwned.lift.bind( FfiConverterTypeMaybeInputsOwned ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeUncheckedOriginalPayloadTransitionObjectFactory.pointer(this); uniffiTypeUncheckedOriginalPayloadTransitionObjectFactory.freePointer( pointer ); uniffiTypeUncheckedOriginalPayloadTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is UncheckedOriginalPayloadTransition { return uniffiTypeUncheckedOriginalPayloadTransitionObjectFactory.isConcreteType( obj_ ); } } const uniffiTypeUncheckedOriginalPayloadTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): UncheckedOriginalPayloadTransitionLike { const instance = Object.create( UncheckedOriginalPayloadTransition.prototype ); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "UncheckedOriginalPayloadTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_uncheckedoriginalpayloadtransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: UncheckedOriginalPayloadTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: UncheckedOriginalPayloadTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_uncheckedoriginalpayloadtransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_uncheckedoriginalpayloadtransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType( obj_: any ): obj_ is UncheckedOriginalPayloadTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "UncheckedOriginalPayloadTransition" ); }, }; })(); const FfiConverterTypeUncheckedOriginalPayloadTransition = new FfiConverterObject( uniffiTypeUncheckedOriginalPayloadTransitionObjectFactory ); export interface UncheckedOriginalPayloadLike { /** * Call this method if the only way to initiate a Payjoin with this receiver * requires manual intervention, as in most consumer wallets. * * So-called "non-interactive" receivers, like payment processors, that allow arbitrary requests are otherwise vulnerable to probing attacks. * Those receivers call `extract_tx_to_check_broadcast()` and `attest_tested_and_scheduled_broadcast()` after making those checks downstream. */ assumeInteractiveReceiver(): AssumeInteractiveTransitionLike; /** * Cancel the Payjoin session immediately. * * Returns an [`CancelTransition`] that, once persisted, closes the * the receiver session. */ cancel(): CancelTransitionLike; /** * Check that the sender's Original PSBT is suitable for broadcast, ensuring * it can be used as a fallback if the payjoin does not complete. * * Returns an [`UncheckedOriginalPayloadTransition`] that, once persisted, * yields a [`MaybeInputsOwned`] to continue validation. */ checkBroadcastSuitability( minFeeRateSatPerKwu: bigint | undefined, canBroadcast: CanBroadcast ): /*throws*/ UncheckedOriginalPayloadTransitionLike; } /** * @deprecated Use `UncheckedOriginalPayloadLike` instead. */ export type UncheckedOriginalPayloadInterface = UncheckedOriginalPayloadLike; export class UncheckedOriginalPayload extends UniffiAbstractObject implements UncheckedOriginalPayloadLike { readonly [uniffiTypeNameSymbol] = "UncheckedOriginalPayload"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeUncheckedOriginalPayloadObjectFactory.bless(pointer); } /** * Call this method if the only way to initiate a Payjoin with this receiver * requires manual intervention, as in most consumer wallets. * * So-called "non-interactive" receivers, like payment processors, that allow arbitrary requests are otherwise vulnerable to probing attacks. * Those receivers call `extract_tx_to_check_broadcast()` and `attest_tested_and_scheduled_broadcast()` after making those checks downstream. */ assumeInteractiveReceiver(): AssumeInteractiveTransitionLike { return FfiConverterTypeAssumeInteractiveTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_uncheckedoriginalpayload_assume_interactive_receiver( uniffiTypeUncheckedOriginalPayloadObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Cancel the Payjoin session immediately. * * Returns an [`CancelTransition`] that, once persisted, closes the * the receiver session. */ cancel(): CancelTransitionLike { return FfiConverterTypeCancelTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_uncheckedoriginalpayload_cancel( uniffiTypeUncheckedOriginalPayloadObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Check that the sender's Original PSBT is suitable for broadcast, ensuring * it can be used as a fallback if the payjoin does not complete. * * Returns an [`UncheckedOriginalPayloadTransition`] that, once persisted, * yields a [`MaybeInputsOwned`] to continue validation. */ checkBroadcastSuitability( minFeeRateSatPerKwu: bigint | undefined, canBroadcast: CanBroadcast ): UncheckedOriginalPayloadTransitionLike /*throws*/ { return FfiConverterTypeUncheckedOriginalPayloadTransition.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeFfiValidationError.lift.bind( FfiConverterTypeFfiValidationError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_uncheckedoriginalpayload_check_broadcast_suitability( uniffiTypeUncheckedOriginalPayloadObjectFactory.clonePointer(this), FfiConverterOptionalUInt64.lower( minFeeRateSatPerKwu, nativeModule().rustbuffer_alloc ), FfiConverterTypeCanBroadcast.lower( canBroadcast, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeUncheckedOriginalPayloadObjectFactory.pointer(this); uniffiTypeUncheckedOriginalPayloadObjectFactory.freePointer(pointer); uniffiTypeUncheckedOriginalPayloadObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is UncheckedOriginalPayload { return uniffiTypeUncheckedOriginalPayloadObjectFactory.isConcreteType(obj_); } } const uniffiTypeUncheckedOriginalPayloadObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): UncheckedOriginalPayloadLike { const instance = Object.create(UncheckedOriginalPayload.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "UncheckedOriginalPayload"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_uncheckedoriginalpayload_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: UncheckedOriginalPayloadLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: UncheckedOriginalPayloadLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_uncheckedoriginalpayload( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_uncheckedoriginalpayload( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is UncheckedOriginalPayloadLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "UncheckedOriginalPayload" ); }, }; })(); const FfiConverterTypeUncheckedOriginalPayload = new FfiConverterObject( uniffiTypeUncheckedOriginalPayloadObjectFactory ); export interface PjUriLike { address(): string; /** * Number of sats requested as payment */ amountSats(): bigint | undefined; asString(): string; pjEndpoint(): string; /** * Sets the amount in sats and returns a new PjUri */ setAmountSats(amountSats: bigint): /*throws*/ PjUriLike; } /** * @deprecated Use `PjUriLike` instead. */ export type PjUriInterface = PjUriLike; export class PjUri extends UniffiAbstractObject implements PjUriLike { readonly [uniffiTypeNameSymbol] = "PjUri"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypePjUriObjectFactory.bless(pointer); } address(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pjuri_address( uniffiTypePjUriObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Number of sats requested as payment */ amountSats(): bigint | undefined { return ((__rb: Uint8Array) => { try { return FfiConverterOptionalUInt64.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pjuri_amount_sats( uniffiTypePjUriObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } asString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pjuri_as_string( uniffiTypePjUriObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } pjEndpoint(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pjuri_pj_endpoint( uniffiTypePjUriObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Sets the amount in sats and returns a new PjUri */ setAmountSats(amountSats: bigint): PjUriLike /*throws*/ { return FfiConverterTypePjUri.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeFfiValidationError.lift.bind( FfiConverterTypeFfiValidationError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pjuri_set_amount_sats( uniffiTypePjUriObjectFactory.clonePointer(this), FfiConverterUInt64.lower( amountSats, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypePjUriObjectFactory.pointer(this); uniffiTypePjUriObjectFactory.freePointer(pointer); uniffiTypePjUriObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is PjUri { return uniffiTypePjUriObjectFactory.isConcreteType(obj_); } } const uniffiTypePjUriObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): PjUriLike { const instance = Object.create(PjUri.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "PjUri"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_pjuri_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: PjUriLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: PjUriLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_pjuri( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_pjuri( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is PjUriLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "PjUri" ); }, }; })(); const FfiConverterTypePjUri = new FfiConverterObject( uniffiTypePjUriObjectFactory ); export interface InitializedTransitionLike { save( persister: JsonReceiverSessionPersister ): /*throws*/ InitializedTransitionOutcome; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `InitializedTransitionLike` instead. */ export type InitializedTransitionInterface = InitializedTransitionLike; export class InitializedTransition extends UniffiAbstractObject implements InitializedTransitionLike { readonly [uniffiTypeNameSymbol] = "InitializedTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeInitializedTransitionObjectFactory.bless(pointer); } save( persister: JsonReceiverSessionPersister ): InitializedTransitionOutcome /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterTypeInitializedTransitionOutcome.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_initializedtransition_save( uniffiTypeInitializedTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_initializedtransition_save_async( uniffiTypeInitializedTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_free_rust_buffer, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeInitializedTransitionOutcome.lift.bind( FfiConverterTypeInitializedTransitionOutcome ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeInitializedTransitionObjectFactory.pointer(this); uniffiTypeInitializedTransitionObjectFactory.freePointer(pointer); uniffiTypeInitializedTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is InitializedTransition { return uniffiTypeInitializedTransitionObjectFactory.isConcreteType(obj_); } } const uniffiTypeInitializedTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): InitializedTransitionLike { const instance = Object.create(InitializedTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "InitializedTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_initializedtransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: InitializedTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: InitializedTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_initializedtransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_initializedtransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is InitializedTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "InitializedTransition" ); }, }; })(); const FfiConverterTypeInitializedTransition = new FfiConverterObject( uniffiTypeInitializedTransitionObjectFactory ); export interface InitializedLike { /** * Cancel the Payjoin session immediately. * * Returns an [`CancelTransition`] that, once persisted, closes the * the receiver session. */ cancel(): CancelTransitionLike; /** * Construct an OHTTP encapsulated GET request, polling the mailbox for the Original PSBT */ createPollRequest(ohttpRelay: string): /*throws*/ RequestResponse; /** * Build a V2 Payjoin URI from the receiver's context */ pjUri(): PjUriLike; /** * Process the polling response from the directory. * * Returns an [`InitializedTransition`] that, once persisted, yields either * an [`UncheckedOriginalPayload`] if the sender's Original PSBT is available, * or [`Initialized`] if no proposal has arrived yet. */ processResponse( body: ArrayBuffer, ctx: ClientResponseLike ): InitializedTransitionLike; } /** * @deprecated Use `InitializedLike` instead. */ export type InitializedInterface = InitializedLike; export class Initialized extends UniffiAbstractObject implements InitializedLike { readonly [uniffiTypeNameSymbol] = "Initialized"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeInitializedObjectFactory.bless(pointer); } /** * Cancel the Payjoin session immediately. * * Returns an [`CancelTransition`] that, once persisted, closes the * the receiver session. */ cancel(): CancelTransitionLike { return FfiConverterTypeCancelTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_initialized_cancel( uniffiTypeInitializedObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Construct an OHTTP encapsulated GET request, polling the mailbox for the Original PSBT */ createPollRequest(ohttpRelay: string): RequestResponse /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterTypeRequestResponse.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverCreateRequestError__as_error.lift.bind( FfiConverterTypeReceiverCreateRequestError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_initialized_create_poll_request( uniffiTypeInitializedObjectFactory.clonePointer(this), FfiConverterString.lower( ohttpRelay, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Build a V2 Payjoin URI from the receiver's context */ pjUri(): PjUriLike { return FfiConverterTypePjUri.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_initialized_pj_uri( uniffiTypeInitializedObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Process the polling response from the directory. * * Returns an [`InitializedTransition`] that, once persisted, yields either * an [`UncheckedOriginalPayload`] if the sender's Original PSBT is available, * or [`Initialized`] if no proposal has arrived yet. */ processResponse( body: ArrayBuffer, ctx: ClientResponseLike ): InitializedTransitionLike { return FfiConverterTypeInitializedTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_initialized_process_response( uniffiTypeInitializedObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower( body, nativeModule().rustbuffer_alloc ), FfiConverterTypeClientResponse.lower( ctx, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeInitializedObjectFactory.pointer(this); uniffiTypeInitializedObjectFactory.freePointer(pointer); uniffiTypeInitializedObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is Initialized { return uniffiTypeInitializedObjectFactory.isConcreteType(obj_); } } const uniffiTypeInitializedObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): InitializedLike { const instance = Object.create(Initialized.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "Initialized"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_initialized_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: InitializedLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: InitializedLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_initialized( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_initialized( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is InitializedLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "Initialized" ); }, }; })(); const FfiConverterTypeInitialized = new FfiConverterObject( uniffiTypeInitializedObjectFactory ); // Enum: InitializedTransitionOutcome export enum InitializedTransitionOutcome_Tags { Progress = "Progress", Stasis = "Stasis", } export const InitializedTransitionOutcome = (() => { type Progress__interface = { tag: InitializedTransitionOutcome_Tags.Progress; inner: Readonly<{ inner: UncheckedOriginalPayloadLike }>; }; class Progress_ extends UniffiEnum implements Progress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "InitializedTransitionOutcome"; readonly tag = InitializedTransitionOutcome_Tags.Progress; readonly inner: Readonly<{ inner: UncheckedOriginalPayloadLike }>; constructor(inner: { inner: UncheckedOriginalPayloadLike }) { super("InitializedTransitionOutcome", "Progress"); this.inner = Object.freeze(inner); } static new(inner: { inner: UncheckedOriginalPayloadLike }): Progress_ { return new Progress_(inner); } static instanceOf(obj: any): obj is Progress_ { return obj.tag === InitializedTransitionOutcome_Tags.Progress; } } type Stasis__interface = { tag: InitializedTransitionOutcome_Tags.Stasis; inner: Readonly<{ inner: InitializedLike }>; }; class Stasis_ extends UniffiEnum implements Stasis__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "InitializedTransitionOutcome"; readonly tag = InitializedTransitionOutcome_Tags.Stasis; readonly inner: Readonly<{ inner: InitializedLike }>; constructor(inner: { inner: InitializedLike }) { super("InitializedTransitionOutcome", "Stasis"); this.inner = Object.freeze(inner); } static new(inner: { inner: InitializedLike }): Stasis_ { return new Stasis_(inner); } static instanceOf(obj: any): obj is Stasis_ { return obj.tag === InitializedTransitionOutcome_Tags.Stasis; } } function instanceOf(obj: any): obj is InitializedTransitionOutcome { return obj[uniffiTypeNameSymbol] === "InitializedTransitionOutcome"; } return Object.freeze({ instanceOf, Progress: Progress_, Stasis: Stasis_, }); })(); export type InitializedTransitionOutcome = InstanceType< (typeof InitializedTransitionOutcome)["Progress" | "Stasis"] >; // FfiConverter for enum InitializedTransitionOutcome const FfiConverterTypeInitializedTransitionOutcome = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = InitializedTransitionOutcome; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new InitializedTransitionOutcome.Progress({ inner: FfiConverterTypeUncheckedOriginalPayload.read(from), }); case 2: return new InitializedTransitionOutcome.Stasis({ inner: FfiConverterTypeInitialized.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case InitializedTransitionOutcome_Tags.Progress: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeUncheckedOriginalPayload.write(inner.inner, into); return; } case InitializedTransitionOutcome_Tags.Stasis: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeInitialized.write(inner.inner, into); return; } default: // Throwing from here means that InitializedTransitionOutcome_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case InitializedTransitionOutcome_Tags.Progress: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeUncheckedOriginalPayload.allocationSize( inner.inner ); return size; } case InitializedTransitionOutcome_Tags.Stasis: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeInitialized.allocationSize(inner.inner); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * Error validating a PSBT Input */ export interface PsbtInputErrorLike {} /** * @deprecated Use `PsbtInputErrorLike` instead. */ export type PsbtInputErrorInterface = PsbtInputErrorLike; /** * Error validating a PSBT Input */ export class PsbtInputError extends UniffiAbstractObject implements PsbtInputErrorLike { readonly [uniffiTypeNameSymbol] = "PsbtInputError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypePsbtInputErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_psbtinputerror_uniffi_trait_display( uniffiTypePsbtInputErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_psbtinputerror_uniffi_trait_debug( uniffiTypePsbtInputErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypePsbtInputErrorObjectFactory.pointer(this); uniffiTypePsbtInputErrorObjectFactory.freePointer(pointer); uniffiTypePsbtInputErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is PsbtInputError { return uniffiTypePsbtInputErrorObjectFactory.isConcreteType(obj_); } } const uniffiTypePsbtInputErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): PsbtInputErrorLike { const instance = Object.create(PsbtInputError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "PsbtInputError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_psbtinputerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: PsbtInputErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: PsbtInputErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_psbtinputerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_psbtinputerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is PsbtInputErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "PsbtInputError" ); }, }; })(); const FfiConverterTypePsbtInputError = new FfiConverterObject( uniffiTypePsbtInputErrorObjectFactory ); // Error type: InputPairError export enum InputPairError_Tags { InvalidOutPoint = "InvalidOutPoint", InvalidPsbtInput = "InvalidPsbtInput", FfiValidation = "FfiValidation", } /** * Error constructing an [`InputPair`](crate::InputPair). */ export const InputPairError = (() => { type InvalidOutPoint__interface = { tag: InputPairError_Tags.InvalidOutPoint; inner: Readonly<{ txid: string; vout: number }>; }; /** * Provided outpoint could not be parsed. */ class InvalidOutPoint_ extends UniffiError implements InvalidOutPoint__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "InputPairError"; readonly tag = InputPairError_Tags.InvalidOutPoint; readonly inner: Readonly<{ txid: string; vout: number }>; constructor(inner: { txid: string; vout: number }) { super("InputPairError", "InvalidOutPoint"); this.inner = Object.freeze(inner); } static new(inner: { txid: string; vout: number }): InvalidOutPoint_ { return new InvalidOutPoint_(inner); } static instanceOf(obj: any): obj is InvalidOutPoint_ { return obj.tag === InputPairError_Tags.InvalidOutPoint; } static hasInner(obj: any): obj is InvalidOutPoint_ { return InvalidOutPoint_.instanceOf(obj); } static getInner( obj: InvalidOutPoint_ ): Readonly<{ txid: string; vout: number }> { return obj.inner; } } type InvalidPsbtInput__interface = { tag: InputPairError_Tags.InvalidPsbtInput; inner: Readonly<[PsbtInputErrorLike]>; }; /** * PSBT input failed validation in the core library. */ class InvalidPsbtInput_ extends UniffiError implements InvalidPsbtInput__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "InputPairError"; readonly tag = InputPairError_Tags.InvalidPsbtInput; readonly inner: Readonly<[PsbtInputErrorLike]>; constructor(v0: PsbtInputErrorLike) { super("InputPairError", "InvalidPsbtInput"); this.inner = Object.freeze([v0]); } static new(v0: PsbtInputErrorLike): InvalidPsbtInput_ { return new InvalidPsbtInput_(v0); } static instanceOf(obj: any): obj is InvalidPsbtInput_ { return obj.tag === InputPairError_Tags.InvalidPsbtInput; } static hasInner(obj: any): obj is InvalidPsbtInput_ { return InvalidPsbtInput_.instanceOf(obj); } static getInner(obj: InvalidPsbtInput_): Readonly<[PsbtInputErrorLike]> { return obj.inner; } } type FfiValidation__interface = { tag: InputPairError_Tags.FfiValidation; inner: Readonly<[FfiValidationError]>; }; /** * Input failed validation in the FFI layer. */ class FfiValidation_ extends UniffiError implements FfiValidation__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "InputPairError"; readonly tag = InputPairError_Tags.FfiValidation; readonly inner: Readonly<[FfiValidationError]>; constructor(v0: FfiValidationError) { super("InputPairError", "FfiValidation"); this.inner = Object.freeze([v0]); } static new(v0: FfiValidationError): FfiValidation_ { return new FfiValidation_(v0); } static instanceOf(obj: any): obj is FfiValidation_ { return obj.tag === InputPairError_Tags.FfiValidation; } static hasInner(obj: any): obj is FfiValidation_ { return FfiValidation_.instanceOf(obj); } static getInner(obj: FfiValidation_): Readonly<[FfiValidationError]> { return obj.inner; } } function instanceOf(obj: any): obj is InputPairError { return obj[uniffiTypeNameSymbol] === "InputPairError"; } return Object.freeze({ instanceOf, InvalidOutPoint: InvalidOutPoint_, InvalidPsbtInput: InvalidPsbtInput_, FfiValidation: FfiValidation_, }); })(); /** * Error constructing an [`InputPair`](crate::InputPair). */ export type InputPairError = InstanceType< (typeof InputPairError)[ | "InvalidOutPoint" | "InvalidPsbtInput" | "FfiValidation"] >; // FfiConverter for enum InputPairError const FfiConverterTypeInputPairError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = InputPairError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new InputPairError.InvalidOutPoint({ txid: FfiConverterString.read(from), vout: FfiConverterUInt32.read(from), }); case 2: return new InputPairError.InvalidPsbtInput( FfiConverterTypePsbtInputError.read(from) ); case 3: return new InputPairError.FfiValidation( FfiConverterTypeFfiValidationError.read(from) ); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case InputPairError_Tags.InvalidOutPoint: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.txid, into); FfiConverterUInt32.write(inner.vout, into); return; } case InputPairError_Tags.InvalidPsbtInput: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypePsbtInputError.write(inner[0], into); return; } case InputPairError_Tags.FfiValidation: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeFfiValidationError.write(inner[0], into); return; } default: // Throwing from here means that InputPairError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case InputPairError_Tags.InvalidOutPoint: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.txid); size += FfiConverterUInt32.allocationSize(inner.vout); return size; } case InputPairError_Tags.InvalidPsbtInput: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypePsbtInputError.allocationSize(inner[0]); return size; } case InputPairError_Tags.FfiValidation: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeFfiValidationError.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Error type: ManualReceiveError export enum ManualReceiveError_Tags { Invalid = "Invalid", Check = "Check", } /** * Errors from the offline receiver primitives. */ export const ManualReceiveError = (() => { type Invalid__interface = { tag: ManualReceiveError_Tags.Invalid; inner: Readonly<{ message: string }>; }; /** * An input, address, script, or PSBT could not be parsed. */ class Invalid_ extends UniffiError implements Invalid__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ManualReceiveError"; readonly tag = ManualReceiveError_Tags.Invalid; readonly inner: Readonly<{ message: string }>; constructor(inner: { message: string }) { super("ManualReceiveError", "Invalid"); this.inner = Object.freeze(inner); } static new(inner: { message: string }): Invalid_ { return new Invalid_(inner); } static instanceOf(obj: any): obj is Invalid_ { return obj.tag === ManualReceiveError_Tags.Invalid; } static hasInner(obj: any): obj is Invalid_ { return Invalid_.instanceOf(obj); } static getInner(obj: Invalid_): Readonly<{ message: string }> { return obj.inner; } } type Check__interface = { tag: ManualReceiveError_Tags.Check; inner: Readonly<{ message: string }>; }; /** * A receiver protocol check rejected the sender's Original PSBT. */ class Check_ extends UniffiError implements Check__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ManualReceiveError"; readonly tag = ManualReceiveError_Tags.Check; readonly inner: Readonly<{ message: string }>; constructor(inner: { message: string }) { super("ManualReceiveError", "Check"); this.inner = Object.freeze(inner); } static new(inner: { message: string }): Check_ { return new Check_(inner); } static instanceOf(obj: any): obj is Check_ { return obj.tag === ManualReceiveError_Tags.Check; } static hasInner(obj: any): obj is Check_ { return Check_.instanceOf(obj); } static getInner(obj: Check_): Readonly<{ message: string }> { return obj.inner; } } function instanceOf(obj: any): obj is ManualReceiveError { return obj[uniffiTypeNameSymbol] === "ManualReceiveError"; } return Object.freeze({ instanceOf, Invalid: Invalid_, Check: Check_, }); })(); /** * Errors from the offline receiver primitives. */ export type ManualReceiveError = InstanceType< (typeof ManualReceiveError)["Invalid" | "Check"] >; // FfiConverter for enum ManualReceiveError const FfiConverterTypeManualReceiveError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ManualReceiveError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ManualReceiveError.Invalid({ message: FfiConverterString.read(from), }); case 2: return new ManualReceiveError.Check({ message: FfiConverterString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ManualReceiveError_Tags.Invalid: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.message, into); return; } case ManualReceiveError_Tags.Check: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterString.write(inner.message, into); return; } default: // Throwing from here means that ManualReceiveError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ManualReceiveError_Tags.Invalid: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.message); return size; } case ManualReceiveError_Tags.Check: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterString.allocationSize(inner.message); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Error type: OhttpKeysFetchError export enum OhttpKeysFetchError_Tags { Fetch = "Fetch", } /** * Errors from fetching OHTTP keys. */ export const OhttpKeysFetchError = (() => { type Fetch__interface = { tag: OhttpKeysFetchError_Tags.Fetch; inner: Readonly<{ message: string }>; }; /** * The relay or directory URL was malformed, unreachable, returned a * non-success status, or returned keys that failed to decode. */ class Fetch_ extends UniffiError implements Fetch__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "OhttpKeysFetchError"; readonly tag = OhttpKeysFetchError_Tags.Fetch; readonly inner: Readonly<{ message: string }>; constructor(inner: { message: string }) { super("OhttpKeysFetchError", "Fetch"); this.inner = Object.freeze(inner); } static new(inner: { message: string }): Fetch_ { return new Fetch_(inner); } static instanceOf(obj: any): obj is Fetch_ { return obj.tag === OhttpKeysFetchError_Tags.Fetch; } static hasInner(obj: any): obj is Fetch_ { return Fetch_.instanceOf(obj); } static getInner(obj: Fetch_): Readonly<{ message: string }> { return obj.inner; } } function instanceOf(obj: any): obj is OhttpKeysFetchError { return obj[uniffiTypeNameSymbol] === "OhttpKeysFetchError"; } return Object.freeze({ instanceOf, Fetch: Fetch_, }); })(); /** * Errors from fetching OHTTP keys. */ export type OhttpKeysFetchError = InstanceType< (typeof OhttpKeysFetchError)["Fetch"] >; // FfiConverter for enum OhttpKeysFetchError const FfiConverterTypeOhttpKeysFetchError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = OhttpKeysFetchError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new OhttpKeysFetchError.Fetch({ message: FfiConverterString.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case OhttpKeysFetchError_Tags.Fetch: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.message, into); return; } default: // Throwing from here means that OhttpKeysFetchError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case OhttpKeysFetchError_Tags.Fetch: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.message); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * Session persister that should save and load events as JSON strings. */ export interface JsonSenderSessionPersister { save(event: string): /*throws*/ void; load(): /*throws*/ Array; close(): /*throws*/ void; } /** * Session persister that should save and load events as JSON strings. */ export class JsonSenderSessionPersisterImpl extends UniffiAbstractObject implements JsonSenderSessionPersister { readonly [uniffiTypeNameSymbol] = "JsonSenderSessionPersisterImpl"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeJsonSenderSessionPersisterImplObjectFactory.bless(pointer); } save(event: string): void /*throws*/ { uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ), /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_jsonsendersessionpersister_save( uniffiTypeJsonSenderSessionPersisterImplObjectFactory.clonePointer( this ), FfiConverterString.lower(event, nativeModule().rustbuffer_alloc), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ); } load(): Array /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterSequenceString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_jsonsendersessionpersister_load( uniffiTypeJsonSenderSessionPersisterImplObjectFactory.clonePointer( this ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } close(): void /*throws*/ { uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ), /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_jsonsendersessionpersister_close( uniffiTypeJsonSenderSessionPersisterImplObjectFactory.clonePointer( this ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeJsonSenderSessionPersisterImplObjectFactory.pointer(this); uniffiTypeJsonSenderSessionPersisterImplObjectFactory.freePointer( pointer ); uniffiTypeJsonSenderSessionPersisterImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is JsonSenderSessionPersisterImpl { return uniffiTypeJsonSenderSessionPersisterImplObjectFactory.isConcreteType( obj_ ); } } const uniffiTypeJsonSenderSessionPersisterImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): JsonSenderSessionPersister { const instance = Object.create( JsonSenderSessionPersisterImpl.prototype ); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "JsonSenderSessionPersisterImpl"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_jsonsendersessionpersister_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: JsonSenderSessionPersister): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: JsonSenderSessionPersister): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_jsonsendersessionpersister( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_jsonsendersessionpersister( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is JsonSenderSessionPersister { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "JsonSenderSessionPersisterImpl" ); }, }; })(); const FfiConverterTypeJsonSenderSessionPersister = new FfiConverterObjectWithCallbacks( uniffiTypeJsonSenderSessionPersisterImplObjectFactory ); // Add a vtable for the callbacks that go in JsonSenderSessionPersister. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceJsonSenderSessionPersister: { vtable: any; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { save: (uniffiHandle: bigint, event: Uint8Array) => { const uniffiMakeCall = (): void => { const jsCallback = FfiConverterTypeJsonSenderSessionPersister.lift(uniffiHandle); return jsCallback.save(FfiConverterString.lift(event)); }; const uniffiResult = UniffiResult.ready(); const uniffiHandleSuccess = (obj: any) => {}; const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { UniffiResult.writeError(uniffiResult, code, errBuf); }; uniffiTraitInterfaceCallWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiResult; }, load: (uniffiHandle: bigint) => { const uniffiMakeCall = (): Array => { const jsCallback = FfiConverterTypeJsonSenderSessionPersister.lift(uniffiHandle); return jsCallback.load(); }; const uniffiResult = UniffiResult.ready(); const uniffiHandleSuccess = (obj: any) => { UniffiResult.writeSuccess( uniffiResult, FfiConverterSequenceString.lower(obj, nativeModule().rustbuffer_alloc) ); }; const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { UniffiResult.writeError(uniffiResult, code, errBuf); }; uniffiTraitInterfaceCallWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiResult; }, close: (uniffiHandle: bigint) => { const uniffiMakeCall = (): void => { const jsCallback = FfiConverterTypeJsonSenderSessionPersister.lift(uniffiHandle); return jsCallback.close(); }; const uniffiResult = UniffiResult.ready(); const uniffiHandleSuccess = (obj: any) => {}; const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { UniffiResult.writeError(uniffiResult, code, errBuf); }; uniffiTraitInterfaceCallWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiResult; }, uniffi_free: (uniffiHandle: UniffiHandle): void => { // this will throw a stale handle error if the handle isn't found. FfiConverterTypeJsonSenderSessionPersister.drop(uniffiHandle); }, uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { return FfiConverterTypeJsonSenderSessionPersister.clone(uniffiHandle); }, }, register: () => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_init_callback_vtable_jsonsendersessionpersister( uniffiCallbackInterfaceJsonSenderSessionPersister.vtable ); }, }; /** * Error returned for v2-specific payload decapsulation errors. */ export interface DecapsulationErrorLike {} /** * @deprecated Use `DecapsulationErrorLike` instead. */ export type DecapsulationErrorInterface = DecapsulationErrorLike; /** * Error returned for v2-specific payload decapsulation errors. */ export class DecapsulationError extends UniffiAbstractObject implements DecapsulationErrorLike { readonly [uniffiTypeNameSymbol] = "DecapsulationError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeDecapsulationErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_decapsulationerror_uniffi_trait_display( uniffiTypeDecapsulationErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_decapsulationerror_uniffi_trait_debug( uniffiTypeDecapsulationErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeDecapsulationErrorObjectFactory.pointer(this); uniffiTypeDecapsulationErrorObjectFactory.freePointer(pointer); uniffiTypeDecapsulationErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is DecapsulationError { return uniffiTypeDecapsulationErrorObjectFactory.isConcreteType(obj_); } } const uniffiTypeDecapsulationErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): DecapsulationErrorLike { const instance = Object.create(DecapsulationError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "DecapsulationError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_decapsulationerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: DecapsulationErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: DecapsulationErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_decapsulationerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_decapsulationerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is DecapsulationErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "DecapsulationError" ); }, }; })(); const FfiConverterTypeDecapsulationError = new FfiConverterObject( uniffiTypeDecapsulationErrorObjectFactory ); /** * Error building a Sender from a SenderBuilder. * * This error is unrecoverable. */ export interface SenderBuilderErrorLike {} /** * @deprecated Use `SenderBuilderErrorLike` instead. */ export type SenderBuilderErrorInterface = SenderBuilderErrorLike; /** * Error building a Sender from a SenderBuilder. * * This error is unrecoverable. */ export class SenderBuilderError extends UniffiAbstractObject implements SenderBuilderErrorLike { readonly [uniffiTypeNameSymbol] = "SenderBuilderError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSenderBuilderErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_senderbuildererror_uniffi_trait_display( uniffiTypeSenderBuilderErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_senderbuildererror_uniffi_trait_debug( uniffiTypeSenderBuilderErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } equals(other: SenderBuilderError): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_senderbuildererror_uniffi_trait_eq_eq( uniffiTypeSenderBuilderErrorObjectFactory.clonePointer(this), FfiConverterTypeSenderBuilderError.lower( other, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSenderBuilderErrorObjectFactory.pointer(this); uniffiTypeSenderBuilderErrorObjectFactory.freePointer(pointer); uniffiTypeSenderBuilderErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is SenderBuilderError { return uniffiTypeSenderBuilderErrorObjectFactory.isConcreteType(obj_); } } const uniffiTypeSenderBuilderErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): SenderBuilderErrorLike { const instance = Object.create(SenderBuilderError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "SenderBuilderError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_senderbuildererror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: SenderBuilderErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: SenderBuilderErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_senderbuildererror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_senderbuildererror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is SenderBuilderErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SenderBuilderError" ); }, }; })(); const FfiConverterTypeSenderBuilderError = new FfiConverterObject( uniffiTypeSenderBuilderErrorObjectFactory ); // Error type: SenderError export enum SenderError_Tags { Decapsulation = "Decapsulation", Response = "Response", Build = "Build", Unexpected = "Unexpected", } /** * Error raised by a sender state machine transition */ export const SenderError = (() => { type Decapsulation__interface = { tag: SenderError_Tags.Decapsulation; inner: Readonly<[DecapsulationErrorLike]>; }; /** * rust-payjoin sender Decapsulation error */ class Decapsulation_ extends UniffiError implements Decapsulation__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "SenderError"; readonly tag = SenderError_Tags.Decapsulation; readonly inner: Readonly<[DecapsulationErrorLike]>; constructor(v0: DecapsulationErrorLike) { super("SenderError", "Decapsulation"); this.inner = Object.freeze([v0]); } static new(v0: DecapsulationErrorLike): Decapsulation_ { return new Decapsulation_(v0); } static instanceOf(obj: any): obj is Decapsulation_ { return obj.tag === SenderError_Tags.Decapsulation; } static hasInner(obj: any): obj is Decapsulation_ { return Decapsulation_.instanceOf(obj); } static getInner(obj: Decapsulation_): Readonly<[DecapsulationErrorLike]> { return obj.inner; } } type Response__interface = { tag: SenderError_Tags.Response; inner: Readonly<[ResponseError]>; }; /** * rust-payjoin sender response error */ class Response_ extends UniffiError implements Response__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "SenderError"; readonly tag = SenderError_Tags.Response; readonly inner: Readonly<[ResponseError]>; constructor(v0: ResponseError) { super("SenderError", "Response"); this.inner = Object.freeze([v0]); } static new(v0: ResponseError): Response_ { return new Response_(v0); } static instanceOf(obj: any): obj is Response_ { return obj.tag === SenderError_Tags.Response; } static hasInner(obj: any): obj is Response_ { return Response_.instanceOf(obj); } static getInner(obj: Response_): Readonly<[ResponseError]> { return obj.inner; } } type Build__interface = { tag: SenderError_Tags.Build; inner: Readonly<[SenderBuilderErrorLike]>; }; /** * Sender Build error */ class Build_ extends UniffiError implements Build__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "SenderError"; readonly tag = SenderError_Tags.Build; readonly inner: Readonly<[SenderBuilderErrorLike]>; constructor(v0: SenderBuilderErrorLike) { super("SenderError", "Build"); this.inner = Object.freeze([v0]); } static new(v0: SenderBuilderErrorLike): Build_ { return new Build_(v0); } static instanceOf(obj: any): obj is Build_ { return obj.tag === SenderError_Tags.Build; } static hasInner(obj: any): obj is Build_ { return Build_.instanceOf(obj); } static getInner(obj: Build_): Readonly<[SenderBuilderErrorLike]> { return obj.inner; } } type Unexpected__interface = { tag: SenderError_Tags.Unexpected; }; /** * Unexpected error */ class Unexpected_ extends UniffiError implements Unexpected__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "SenderError"; readonly tag = SenderError_Tags.Unexpected; constructor() { super("SenderError", "Unexpected"); } static new(): Unexpected_ { return new Unexpected_(); } static instanceOf(obj: any): obj is Unexpected_ { return obj.tag === SenderError_Tags.Unexpected; } static hasInner(obj: any): obj is Unexpected_ { return false; } } function instanceOf(obj: any): obj is SenderError { return obj[uniffiTypeNameSymbol] === "SenderError"; } return Object.freeze({ instanceOf, Decapsulation: Decapsulation_, Response: Response_, Build: Build_, Unexpected: Unexpected_, }); })(); /** * Error raised by a sender state machine transition */ export type SenderError = InstanceType< (typeof SenderError)["Decapsulation" | "Response" | "Build" | "Unexpected"] >; // FfiConverter for enum SenderError const FfiConverterTypeSenderError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SenderError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new SenderError.Decapsulation( FfiConverterTypeDecapsulationError.read(from) ); case 2: return new SenderError.Response( FfiConverterTypeResponseError.read(from) ); case 3: return new SenderError.Build( FfiConverterTypeSenderBuilderError.read(from) ); case 4: return new SenderError.Unexpected(); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case SenderError_Tags.Decapsulation: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeDecapsulationError.write(inner[0], into); return; } case SenderError_Tags.Response: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeResponseError.write(inner[0], into); return; } case SenderError_Tags.Build: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeSenderBuilderError.write(inner[0], into); return; } case SenderError_Tags.Unexpected: { ordinalConverter.write(4, into); return; } default: // Throwing from here means that SenderError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case SenderError_Tags.Decapsulation: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeDecapsulationError.allocationSize(inner[0]); return size; } case SenderError_Tags.Response: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeResponseError.allocationSize(inner[0]); return size; } case SenderError_Tags.Build: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeSenderBuilderError.allocationSize(inner[0]); return size; } case SenderError_Tags.Unexpected: { return ordinalConverter.allocationSize(4); } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Error type: SenderPersistedError export enum SenderPersistedError_Tags { Transient = "Transient", Fatal = "Fatal", Storage = "Storage", } /** * Error that may occur during state machine transitions */ export const SenderPersistedError = (() => { type Transient__interface = { tag: SenderPersistedError_Tags.Transient; inner: Readonly<[SenderError]>; }; /** * A transient error: nothing was persisted, and the failed transition * can be retried by calling it again on the same sender object */ class Transient_ extends UniffiError implements Transient__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "SenderPersistedError"; readonly tag = SenderPersistedError_Tags.Transient; readonly inner: Readonly<[SenderError]>; constructor(v0: SenderError) { super("SenderPersistedError", "Transient"); this.inner = Object.freeze([v0]); } static new(v0: SenderError): Transient_ { return new Transient_(v0); } static instanceOf(obj: any): obj is Transient_ { return obj.tag === SenderPersistedError_Tags.Transient; } static hasInner(obj: any): obj is Transient_ { return Transient_.instanceOf(obj); } static getInner(obj: Transient_): Readonly<[SenderError]> { return obj.inner; } } type Fatal__interface = { tag: SenderPersistedError_Tags.Fatal; inner: Readonly<[SenderError]>; }; /** * A fatal error: the session is closed or has moved to an error state */ class Fatal_ extends UniffiError implements Fatal__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "SenderPersistedError"; readonly tag = SenderPersistedError_Tags.Fatal; readonly inner: Readonly<[SenderError]>; constructor(v0: SenderError) { super("SenderPersistedError", "Fatal"); this.inner = Object.freeze([v0]); } static new(v0: SenderError): Fatal_ { return new Fatal_(v0); } static instanceOf(obj: any): obj is Fatal_ { return obj.tag === SenderPersistedError_Tags.Fatal; } static hasInner(obj: any): obj is Fatal_ { return Fatal_.instanceOf(obj); } static getInner(obj: Fatal_): Readonly<[SenderError]> { return obj.inner; } } type Storage__interface = { tag: SenderPersistedError_Tags.Storage; inner: Readonly<[ImplementationErrorLike]>; }; /** * Storage error that could occur at application storage layer */ class Storage_ extends UniffiError implements Storage__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "SenderPersistedError"; readonly tag = SenderPersistedError_Tags.Storage; readonly inner: Readonly<[ImplementationErrorLike]>; constructor(v0: ImplementationErrorLike) { super("SenderPersistedError", "Storage"); this.inner = Object.freeze([v0]); } static new(v0: ImplementationErrorLike): Storage_ { return new Storage_(v0); } static instanceOf(obj: any): obj is Storage_ { return obj.tag === SenderPersistedError_Tags.Storage; } static hasInner(obj: any): obj is Storage_ { return Storage_.instanceOf(obj); } static getInner(obj: Storage_): Readonly<[ImplementationErrorLike]> { return obj.inner; } } function instanceOf(obj: any): obj is SenderPersistedError { return obj[uniffiTypeNameSymbol] === "SenderPersistedError"; } return Object.freeze({ instanceOf, Transient: Transient_, Fatal: Fatal_, Storage: Storage_, }); })(); /** * Error that may occur during state machine transitions */ export type SenderPersistedError = InstanceType< (typeof SenderPersistedError)["Transient" | "Fatal" | "Storage"] >; // FfiConverter for enum SenderPersistedError const FfiConverterTypeSenderPersistedError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SenderPersistedError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new SenderPersistedError.Transient( FfiConverterTypeSenderError.read(from) ); case 2: return new SenderPersistedError.Fatal( FfiConverterTypeSenderError.read(from) ); case 3: return new SenderPersistedError.Storage( FfiConverterTypeImplementationError.read(from) ); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case SenderPersistedError_Tags.Transient: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeSenderError.write(inner[0], into); return; } case SenderPersistedError_Tags.Fatal: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeSenderError.write(inner[0], into); return; } case SenderPersistedError_Tags.Storage: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeImplementationError.write(inner[0], into); return; } default: // Throwing from here means that SenderPersistedError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case SenderPersistedError_Tags.Transient: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeSenderError.allocationSize(inner[0]); return size; } case SenderPersistedError_Tags.Fatal: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeSenderError.allocationSize(inner[0]); return size; } case SenderPersistedError_Tags.Storage: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeImplementationError.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * Async session persister that should save and load events as JSON strings. */ export interface JsonSenderSessionPersisterAsync { save( event: string, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; load(asyncOpts_?: { signal: AbortSignal }): /*throws*/ Promise>; close(asyncOpts_?: { signal: AbortSignal }): /*throws*/ Promise; } /** * Async session persister that should save and load events as JSON strings. */ export class JsonSenderSessionPersisterAsyncImpl extends UniffiAbstractObject implements JsonSenderSessionPersisterAsync { readonly [uniffiTypeNameSymbol] = "JsonSenderSessionPersisterAsyncImpl"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeJsonSenderSessionPersisterAsyncImplObjectFactory.bless(pointer); } async save( event: string, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_jsonsendersessionpersisterasync_save( uniffiTypeJsonSenderSessionPersisterAsyncImplObjectFactory.clonePointer( this ), FfiConverterString.lower(event, nativeModule().rustbuffer_alloc) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_void, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } async load(asyncOpts_?: { signal: AbortSignal; }): Promise> /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_jsonsendersessionpersisterasync_load( uniffiTypeJsonSenderSessionPersisterAsyncImplObjectFactory.clonePointer( this ) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_free_rust_buffer, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterSequenceString.lift.bind( FfiConverterSequenceString ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } async close(asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_jsonsendersessionpersisterasync_close( uniffiTypeJsonSenderSessionPersisterAsyncImplObjectFactory.clonePointer( this ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_void, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeJsonSenderSessionPersisterAsyncImplObjectFactory.pointer( this ); uniffiTypeJsonSenderSessionPersisterAsyncImplObjectFactory.freePointer( pointer ); uniffiTypeJsonSenderSessionPersisterAsyncImplObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is JsonSenderSessionPersisterAsyncImpl { return uniffiTypeJsonSenderSessionPersisterAsyncImplObjectFactory.isConcreteType( obj_ ); } } const uniffiTypeJsonSenderSessionPersisterAsyncImplObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): JsonSenderSessionPersisterAsync { const instance = Object.create( JsonSenderSessionPersisterAsyncImpl.prototype ); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "JsonSenderSessionPersisterAsyncImpl"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_jsonsendersessionpersisterasync_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: JsonSenderSessionPersisterAsync): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: JsonSenderSessionPersisterAsync): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_jsonsendersessionpersisterasync( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_jsonsendersessionpersisterasync( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is JsonSenderSessionPersisterAsync { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "JsonSenderSessionPersisterAsyncImpl" ); }, }; })(); const FfiConverterTypeJsonSenderSessionPersisterAsync = new FfiConverterObjectWithCallbacks( uniffiTypeJsonSenderSessionPersisterAsyncImplObjectFactory ); // Add a vtable for the callbacks that go in JsonSenderSessionPersisterAsync. // Put the implementation in a struct so we don't pollute the top-level namespace const uniffiCallbackInterfaceJsonSenderSessionPersisterAsync: { vtable: any; register: () => void; } = { // Create the VTable using a series of closures. // ts automatically converts these into C callback functions. vtable: { save: ( uniffiHandle: bigint, event: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompletevoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeJsonSenderSessionPersisterAsync.lift(uniffiHandle); return await jsCallback.save(FfiConverterString.lift(event), { signal, }); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureResultVoid */ { call_status: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureResultVoid */ { // TODO create callstatus with error. call_status: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiForeignFuture; }, load: ( uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async ( signal: AbortSignal ): Promise> => { const jsCallback = FfiConverterTypeJsonSenderSessionPersisterAsync.lift(uniffiHandle); return await jsCallback.load({ signal }); }; const uniffiHandleSuccess = (returnValue: Array) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureResultRustBuffer */ { return_value: FfiConverterSequenceString.lower( returnValue, nativeModule().rustbuffer_alloc ), call_status: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureResultRustBuffer */ { return_value: /*empty*/ new Uint8Array(0), // TODO create callstatus with error. call_status: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiForeignFuture; }, close: ( uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompletevoid, uniffiCallbackData: bigint ) => { const uniffiMakeCall = async (signal: AbortSignal): Promise => { const jsCallback = FfiConverterTypeJsonSenderSessionPersisterAsync.lift(uniffiHandle); return await jsCallback.close({ signal }); }; const uniffiHandleSuccess = (returnValue: void) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureResultVoid */ { call_status: uniffiCaller.createCallStatus(), } ); }; const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { uniffiFutureCallback.call( uniffiFutureCallback, uniffiCallbackData, /* UniffiForeignFutureResultVoid */ { // TODO create callstatus with error. call_status: uniffiCaller.createErrorStatus(code, errorBuf), } ); }; const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( /*makeCall:*/ uniffiMakeCall, /*handleSuccess:*/ uniffiHandleSuccess, /*handleError:*/ uniffiHandleError, /*isErrorType:*/ ForeignError.instanceOf, /*lowerError:*/ FfiConverterTypeForeignError.lower.bind( FfiConverterTypeForeignError ), /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), /*alloc:*/ nativeModule().rustbuffer_alloc ); return uniffiForeignFuture; }, uniffi_free: (uniffiHandle: UniffiHandle): void => { // this will throw a stale handle error if the handle isn't found. FfiConverterTypeJsonSenderSessionPersisterAsync.drop(uniffiHandle); }, uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { return FfiConverterTypeJsonSenderSessionPersisterAsync.clone( uniffiHandle ); }, }, register: () => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_init_callback_vtable_jsonsendersessionpersisterasync( uniffiCallbackInterfaceJsonSenderSessionPersisterAsync.vtable ); }, }; export interface BroadcastedTransitionLike { save(persister: JsonSenderSessionPersister): /*throws*/ void; saveAsync( persister: JsonSenderSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `BroadcastedTransitionLike` instead. */ export type BroadcastedTransitionInterface = BroadcastedTransitionLike; export class BroadcastedTransition extends UniffiAbstractObject implements BroadcastedTransitionLike { readonly [uniffiTypeNameSymbol] = "BroadcastedTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeBroadcastedTransitionObjectFactory.bless(pointer); } save(persister: JsonSenderSessionPersister): void /*throws*/ { uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSenderPersistedError.lift.bind( FfiConverterTypeSenderPersistedError ), /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_broadcastedtransition_save( uniffiTypeBroadcastedTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonSenderSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ); } async saveAsync( persister: JsonSenderSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_broadcastedtransition_save_async( uniffiTypeBroadcastedTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonSenderSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_void, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_void, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_void, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_void, /*liftFunc:*/ (_v) => {}, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSenderPersistedError.lift.bind( FfiConverterTypeSenderPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeBroadcastedTransitionObjectFactory.pointer(this); uniffiTypeBroadcastedTransitionObjectFactory.freePointer(pointer); uniffiTypeBroadcastedTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is BroadcastedTransition { return uniffiTypeBroadcastedTransitionObjectFactory.isConcreteType(obj_); } } const uniffiTypeBroadcastedTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): BroadcastedTransitionLike { const instance = Object.create(BroadcastedTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "BroadcastedTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_broadcastedtransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: BroadcastedTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: BroadcastedTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_broadcastedtransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_broadcastedtransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is BroadcastedTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "BroadcastedTransition" ); }, }; })(); const FfiConverterTypeBroadcastedTransition = new FfiConverterObject( uniffiTypeBroadcastedTransitionObjectFactory ); export interface SenderPendingFallbackLike { /** * Mark the session as complete, signaling that the fallback transaction * has been broadcast or its control has been transferred. * * Persist the returned [`BroadcastedTransition`] to close the session. */ close(): BroadcastedTransitionLike; /** * Returns the fallback transaction as consensus-encoded raw bytes. * * This is the sender's original transaction that should be broadcast to * complete the payment without Payjoin. */ fallbackTx(): ArrayBuffer; } /** * @deprecated Use `SenderPendingFallbackLike` instead. */ export type SenderPendingFallbackInterface = SenderPendingFallbackLike; export class SenderPendingFallback extends UniffiAbstractObject implements SenderPendingFallbackLike { readonly [uniffiTypeNameSymbol] = "SenderPendingFallback"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSenderPendingFallbackObjectFactory.bless(pointer); } /** * Mark the session as complete, signaling that the fallback transaction * has been broadcast or its control has been transferred. * * Persist the returned [`BroadcastedTransition`] to close the session. */ close(): BroadcastedTransitionLike { return FfiConverterTypeBroadcastedTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_senderpendingfallback_close( uniffiTypeSenderPendingFallbackObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Returns the fallback transaction as consensus-encoded raw bytes. * * This is the sender's original transaction that should be broadcast to * complete the payment without Payjoin. */ fallbackTx(): ArrayBuffer { return ((__rb: Uint8Array) => { try { return FfiConverterArrayBuffer.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_senderpendingfallback_fallback_tx( uniffiTypeSenderPendingFallbackObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSenderPendingFallbackObjectFactory.pointer(this); uniffiTypeSenderPendingFallbackObjectFactory.freePointer(pointer); uniffiTypeSenderPendingFallbackObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is SenderPendingFallback { return uniffiTypeSenderPendingFallbackObjectFactory.isConcreteType(obj_); } } const uniffiTypeSenderPendingFallbackObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): SenderPendingFallbackLike { const instance = Object.create(SenderPendingFallback.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "SenderPendingFallback"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_senderpendingfallback_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: SenderPendingFallbackLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: SenderPendingFallbackLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_senderpendingfallback( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_senderpendingfallback( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is SenderPendingFallbackLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SenderPendingFallback" ); }, }; })(); const FfiConverterTypeSenderPendingFallback = new FfiConverterObject( uniffiTypeSenderPendingFallbackObjectFactory ); export interface SenderCancelTransitionLike { save( persister: JsonSenderSessionPersister ): /*throws*/ SenderPendingFallbackLike; saveAsync( persister: JsonSenderSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `SenderCancelTransitionLike` instead. */ export type SenderCancelTransitionInterface = SenderCancelTransitionLike; export class SenderCancelTransition extends UniffiAbstractObject implements SenderCancelTransitionLike { readonly [uniffiTypeNameSymbol] = "SenderCancelTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSenderCancelTransitionObjectFactory.bless(pointer); } save( persister: JsonSenderSessionPersister ): SenderPendingFallbackLike /*throws*/ { return FfiConverterTypeSenderPendingFallback.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSenderPersistedError.lift.bind( FfiConverterTypeSenderPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_sendercanceltransition_save( uniffiTypeSenderCancelTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonSenderSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonSenderSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_sendercanceltransition_save_async( uniffiTypeSenderCancelTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonSenderSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeSenderPendingFallback.lift.bind( FfiConverterTypeSenderPendingFallback ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSenderPersistedError.lift.bind( FfiConverterTypeSenderPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSenderCancelTransitionObjectFactory.pointer(this); uniffiTypeSenderCancelTransitionObjectFactory.freePointer(pointer); uniffiTypeSenderCancelTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is SenderCancelTransition { return uniffiTypeSenderCancelTransitionObjectFactory.isConcreteType(obj_); } } const uniffiTypeSenderCancelTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): SenderCancelTransitionLike { const instance = Object.create(SenderCancelTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "SenderCancelTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_sendercanceltransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: SenderCancelTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: SenderCancelTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_sendercanceltransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_sendercanceltransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is SenderCancelTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SenderCancelTransition" ); }, }; })(); const FfiConverterTypeSenderCancelTransition = new FfiConverterObject( uniffiTypeSenderCancelTransitionObjectFactory ); /** * Error returned when request could not be created. * * This error can currently only happen due to programmer mistake. * `unwrap()`ing it is thus considered OK in Rust but you may achieve nicer message by displaying * it. */ export interface CreateRequestErrorLike { /** * Returns `true` if the request could not be created because the session * has expired. */ isExpired(): boolean; } /** * @deprecated Use `CreateRequestErrorLike` instead. */ export type CreateRequestErrorInterface = CreateRequestErrorLike; /** * Error returned when request could not be created. * * This error can currently only happen due to programmer mistake. * `unwrap()`ing it is thus considered OK in Rust but you may achieve nicer message by displaying * it. */ export class CreateRequestError extends UniffiAbstractObject implements CreateRequestErrorLike { readonly [uniffiTypeNameSymbol] = "CreateRequestError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeCreateRequestErrorObjectFactory.bless(pointer); } /** * Returns `true` if the request could not be created because the session * has expired. */ isExpired(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_createrequesterror_is_expired( uniffiTypeCreateRequestErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_createrequesterror_uniffi_trait_display( uniffiTypeCreateRequestErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_createrequesterror_uniffi_trait_debug( uniffiTypeCreateRequestErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeCreateRequestErrorObjectFactory.pointer(this); uniffiTypeCreateRequestErrorObjectFactory.freePointer(pointer); uniffiTypeCreateRequestErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is CreateRequestError { return uniffiTypeCreateRequestErrorObjectFactory.isConcreteType(obj_); } static hasInner(obj_: any): obj_ is UniffiThrownObject { return ( UniffiThrownObject.instanceOf(obj_) && CreateRequestError.instanceOf(obj_.inner) ); } static getInner( err: UniffiThrownObject ): CreateRequestError { return err.inner; } } const uniffiTypeCreateRequestErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): CreateRequestErrorLike { const instance = Object.create(CreateRequestError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "CreateRequestError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_createrequesterror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: CreateRequestErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: CreateRequestErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_createrequesterror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_createrequesterror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is CreateRequestErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "CreateRequestError" ); }, }; })(); const FfiConverterTypeCreateRequestError = new FfiConverterObject( uniffiTypeCreateRequestErrorObjectFactory ); const FfiConverterTypeCreateRequestError__as_error = new FfiConverterObjectAsError( "CreateRequestError", FfiConverterTypeCreateRequestError ); export interface PollingForProposalTransitionLike { save( persister: JsonSenderSessionPersister ): /*throws*/ PollingForProposalTransitionOutcome; saveAsync( persister: JsonSenderSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `PollingForProposalTransitionLike` instead. */ export type PollingForProposalTransitionInterface = PollingForProposalTransitionLike; export class PollingForProposalTransition extends UniffiAbstractObject implements PollingForProposalTransitionLike { readonly [uniffiTypeNameSymbol] = "PollingForProposalTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypePollingForProposalTransitionObjectFactory.bless(pointer); } save( persister: JsonSenderSessionPersister ): PollingForProposalTransitionOutcome /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterTypePollingForProposalTransitionOutcome.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSenderPersistedError.lift.bind( FfiConverterTypeSenderPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pollingforproposaltransition_save( uniffiTypePollingForProposalTransitionObjectFactory.clonePointer( this ), FfiConverterTypeJsonSenderSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonSenderSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pollingforproposaltransition_save_async( uniffiTypePollingForProposalTransitionObjectFactory.clonePointer( this ), FfiConverterTypeJsonSenderSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_free_rust_buffer, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypePollingForProposalTransitionOutcome.lift.bind( FfiConverterTypePollingForProposalTransitionOutcome ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSenderPersistedError.lift.bind( FfiConverterTypeSenderPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypePollingForProposalTransitionObjectFactory.pointer(this); uniffiTypePollingForProposalTransitionObjectFactory.freePointer(pointer); uniffiTypePollingForProposalTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is PollingForProposalTransition { return uniffiTypePollingForProposalTransitionObjectFactory.isConcreteType( obj_ ); } } const uniffiTypePollingForProposalTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): PollingForProposalTransitionLike { const instance = Object.create(PollingForProposalTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "PollingForProposalTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_pollingforproposaltransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: PollingForProposalTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: PollingForProposalTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_pollingforproposaltransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_pollingforproposaltransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is PollingForProposalTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "PollingForProposalTransition" ); }, }; })(); const FfiConverterTypePollingForProposalTransition = new FfiConverterObject( uniffiTypePollingForProposalTransitionObjectFactory ); export interface PollingForProposalLike { /** * Cancel the Payjoin session immediately. * * Returns a [`SenderCancelTransition`] that, once persisted, yields a * [`SenderPendingFallback`] state. Call [`SenderPendingFallback::fallback_tx`] to get * the original transaction */ cancel(): SenderCancelTransitionLike; createPollRequest(ohttpRelay: string): /*throws*/ RequestOhttpContext; /** * Decodes and validates the response. * Call this method with a response from the receiver to continue the BIP77 flow. * A successful response can either be `None` if the relay has no response yet, * or `Some(Psbt)`. * If the response is a valid PSBT you should sign and broadcast it. */ processResponse( response: ArrayBuffer, ohttpCtx: ClientResponseLike ): PollingForProposalTransitionLike; } /** * @deprecated Use `PollingForProposalLike` instead. */ export type PollingForProposalInterface = PollingForProposalLike; export class PollingForProposal extends UniffiAbstractObject implements PollingForProposalLike { readonly [uniffiTypeNameSymbol] = "PollingForProposal"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypePollingForProposalObjectFactory.bless(pointer); } /** * Cancel the Payjoin session immediately. * * Returns a [`SenderCancelTransition`] that, once persisted, yields a * [`SenderPendingFallback`] state. Call [`SenderPendingFallback::fallback_tx`] to get * the original transaction */ cancel(): SenderCancelTransitionLike { return FfiConverterTypeSenderCancelTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pollingforproposal_cancel( uniffiTypePollingForProposalObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } createPollRequest(ohttpRelay: string): RequestOhttpContext /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterTypeRequestOhttpContext.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeCreateRequestError__as_error.lift.bind( FfiConverterTypeCreateRequestError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pollingforproposal_create_poll_request( uniffiTypePollingForProposalObjectFactory.clonePointer(this), FfiConverterString.lower( ohttpRelay, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Decodes and validates the response. * Call this method with a response from the receiver to continue the BIP77 flow. * A successful response can either be `None` if the relay has no response yet, * or `Some(Psbt)`. * If the response is a valid PSBT you should sign and broadcast it. */ processResponse( response: ArrayBuffer, ohttpCtx: ClientResponseLike ): PollingForProposalTransitionLike { return FfiConverterTypePollingForProposalTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pollingforproposal_process_response( uniffiTypePollingForProposalObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower( response, nativeModule().rustbuffer_alloc ), FfiConverterTypeClientResponse.lower( ohttpCtx, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypePollingForProposalObjectFactory.pointer(this); uniffiTypePollingForProposalObjectFactory.freePointer(pointer); uniffiTypePollingForProposalObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is PollingForProposal { return uniffiTypePollingForProposalObjectFactory.isConcreteType(obj_); } } const uniffiTypePollingForProposalObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): PollingForProposalLike { const instance = Object.create(PollingForProposal.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "PollingForProposal"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_pollingforproposal_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: PollingForProposalLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: PollingForProposalLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_pollingforproposal( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_pollingforproposal( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is PollingForProposalLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "PollingForProposal" ); }, }; })(); const FfiConverterTypePollingForProposal = new FfiConverterObject( uniffiTypePollingForProposalObjectFactory ); // Enum: PollingForProposalTransitionOutcome export enum PollingForProposalTransitionOutcome_Tags { Progress = "Progress", Stasis = "Stasis", } export const PollingForProposalTransitionOutcome = (() => { type Progress__interface = { tag: PollingForProposalTransitionOutcome_Tags.Progress; inner: Readonly<{ psbtBase64: string }>; }; class Progress_ extends UniffiEnum implements Progress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "PollingForProposalTransitionOutcome"; readonly tag = PollingForProposalTransitionOutcome_Tags.Progress; readonly inner: Readonly<{ psbtBase64: string }>; constructor(inner: { psbtBase64: string }) { super("PollingForProposalTransitionOutcome", "Progress"); this.inner = Object.freeze(inner); } static new(inner: { psbtBase64: string }): Progress_ { return new Progress_(inner); } static instanceOf(obj: any): obj is Progress_ { return obj.tag === PollingForProposalTransitionOutcome_Tags.Progress; } } type Stasis__interface = { tag: PollingForProposalTransitionOutcome_Tags.Stasis; inner: Readonly<{ inner: PollingForProposalLike }>; }; class Stasis_ extends UniffiEnum implements Stasis__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "PollingForProposalTransitionOutcome"; readonly tag = PollingForProposalTransitionOutcome_Tags.Stasis; readonly inner: Readonly<{ inner: PollingForProposalLike }>; constructor(inner: { inner: PollingForProposalLike }) { super("PollingForProposalTransitionOutcome", "Stasis"); this.inner = Object.freeze(inner); } static new(inner: { inner: PollingForProposalLike }): Stasis_ { return new Stasis_(inner); } static instanceOf(obj: any): obj is Stasis_ { return obj.tag === PollingForProposalTransitionOutcome_Tags.Stasis; } } function instanceOf(obj: any): obj is PollingForProposalTransitionOutcome { return obj[uniffiTypeNameSymbol] === "PollingForProposalTransitionOutcome"; } return Object.freeze({ instanceOf, Progress: Progress_, Stasis: Stasis_, }); })(); export type PollingForProposalTransitionOutcome = InstanceType< (typeof PollingForProposalTransitionOutcome)["Progress" | "Stasis"] >; // FfiConverter for enum PollingForProposalTransitionOutcome const FfiConverterTypePollingForProposalTransitionOutcome = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = PollingForProposalTransitionOutcome; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new PollingForProposalTransitionOutcome.Progress({ psbtBase64: FfiConverterString.read(from), }); case 2: return new PollingForProposalTransitionOutcome.Stasis({ inner: FfiConverterTypePollingForProposal.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case PollingForProposalTransitionOutcome_Tags.Progress: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner.psbtBase64, into); return; } case PollingForProposalTransitionOutcome_Tags.Stasis: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypePollingForProposal.write(inner.inner, into); return; } default: // Throwing from here means that PollingForProposalTransitionOutcome_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case PollingForProposalTransitionOutcome_Tags.Progress: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner.psbtBase64); return size; } case PollingForProposalTransitionOutcome_Tags.Stasis: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypePollingForProposal.allocationSize( inner.inner ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Error type: PsbtParseError export enum PsbtParseError_Tags { InvalidPsbt = "InvalidPsbt", } /** * FFI-visible PSBT parsing error surfaced at the sender boundary. */ export const PsbtParseError = (() => { type InvalidPsbt__interface = { tag: PsbtParseError_Tags.InvalidPsbt; inner: Readonly<[string]>; }; /** * The provided PSBT string could not be parsed. */ class InvalidPsbt_ extends UniffiError implements InvalidPsbt__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "PsbtParseError"; readonly tag = PsbtParseError_Tags.InvalidPsbt; readonly inner: Readonly<[string]>; constructor(v0: string) { super("PsbtParseError", "InvalidPsbt"); this.inner = Object.freeze([v0]); } static new(v0: string): InvalidPsbt_ { return new InvalidPsbt_(v0); } static instanceOf(obj: any): obj is InvalidPsbt_ { return obj.tag === PsbtParseError_Tags.InvalidPsbt; } static hasInner(obj: any): obj is InvalidPsbt_ { return InvalidPsbt_.instanceOf(obj); } static getInner(obj: InvalidPsbt_): Readonly<[string]> { return obj.inner; } } function instanceOf(obj: any): obj is PsbtParseError { return obj[uniffiTypeNameSymbol] === "PsbtParseError"; } return Object.freeze({ instanceOf, InvalidPsbt: InvalidPsbt_, }); })(); /** * FFI-visible PSBT parsing error surfaced at the sender boundary. */ export type PsbtParseError = InstanceType< (typeof PsbtParseError)["InvalidPsbt"] >; // FfiConverter for enum PsbtParseError const FfiConverterTypePsbtParseError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = PsbtParseError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new PsbtParseError.InvalidPsbt(FfiConverterString.read(from)); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case PsbtParseError_Tags.InvalidPsbt: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterString.write(inner[0], into); return; } default: // Throwing from here means that PsbtParseError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case PsbtParseError_Tags.InvalidPsbt: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterString.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); export interface HasReplyableErrorTransitionLike { save( persister: JsonReceiverSessionPersister ): /*throws*/ ReceiverPendingFallbackLike | undefined; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `HasReplyableErrorTransitionLike` instead. */ export type HasReplyableErrorTransitionInterface = HasReplyableErrorTransitionLike; export class HasReplyableErrorTransition extends UniffiAbstractObject implements HasReplyableErrorTransitionLike { readonly [uniffiTypeNameSymbol] = "HasReplyableErrorTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeHasReplyableErrorTransitionObjectFactory.bless(pointer); } save( persister: JsonReceiverSessionPersister ): ReceiverPendingFallbackLike | undefined /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterOptionalTypeReceiverPendingFallback.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_hasreplyableerrortransition_save( uniffiTypeHasReplyableErrorTransitionObjectFactory.clonePointer( this ), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_hasreplyableerrortransition_save_async( uniffiTypeHasReplyableErrorTransitionObjectFactory.clonePointer( this ), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_poll_rust_buffer, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_rust_buffer, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_rust_buffer, /*freeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_free_rust_buffer, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterOptionalTypeReceiverPendingFallback.lift.bind( FfiConverterOptionalTypeReceiverPendingFallback ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeReceiverPersistedError.lift.bind( FfiConverterTypeReceiverPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeHasReplyableErrorTransitionObjectFactory.pointer(this); uniffiTypeHasReplyableErrorTransitionObjectFactory.freePointer(pointer); uniffiTypeHasReplyableErrorTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is HasReplyableErrorTransition { return uniffiTypeHasReplyableErrorTransitionObjectFactory.isConcreteType( obj_ ); } } const uniffiTypeHasReplyableErrorTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): HasReplyableErrorTransitionLike { const instance = Object.create(HasReplyableErrorTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "HasReplyableErrorTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_hasreplyableerrortransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: HasReplyableErrorTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: HasReplyableErrorTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_hasreplyableerrortransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_hasreplyableerrortransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is HasReplyableErrorTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "HasReplyableErrorTransition" ); }, }; })(); const FfiConverterTypeHasReplyableErrorTransition = new FfiConverterObject( uniffiTypeHasReplyableErrorTransitionObjectFactory ); export interface HasReplyableErrorLike { /** * Cancel the Payjoin session without posting the receiver error response. * * Returns an [`CancelTransition`] that, once persisted, yields either * a [`ReceiverPendingFallback`] if current session has validated fallback tx, * or otherwise closes the session. */ cancel(): CancelTransitionLike; /** * Construct an OHTTP encapsulated POST request to post the receiver * error response to the directory so it can be retrieved by the sender. */ createErrorRequest(ohttpRelay: string): /*throws*/ RequestResponse; /** * Process the response from the directory after posting the receiver * error response. * * Returns a [`HasReplyableErrorTransition`] that, once persisted, * completes the error reporting and either yields a * [`ReceiverPendingFallback`] if current session has validated fallback tx, * or otherwise closes the session. */ processErrorResponse( body: ArrayBuffer, ohttpContext: ClientResponseLike ): HasReplyableErrorTransitionLike; } /** * @deprecated Use `HasReplyableErrorLike` instead. */ export type HasReplyableErrorInterface = HasReplyableErrorLike; export class HasReplyableError extends UniffiAbstractObject implements HasReplyableErrorLike { readonly [uniffiTypeNameSymbol] = "HasReplyableError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeHasReplyableErrorObjectFactory.bless(pointer); } /** * Cancel the Payjoin session without posting the receiver error response. * * Returns an [`CancelTransition`] that, once persisted, yields either * a [`ReceiverPendingFallback`] if current session has validated fallback tx, * or otherwise closes the session. */ cancel(): CancelTransitionLike { return FfiConverterTypeCancelTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_hasreplyableerror_cancel( uniffiTypeHasReplyableErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Construct an OHTTP encapsulated POST request to post the receiver * error response to the directory so it can be retrieved by the sender. */ createErrorRequest(ohttpRelay: string): RequestResponse /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterTypeRequestResponse.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverCreateRequestError__as_error.lift.bind( FfiConverterTypeReceiverCreateRequestError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_hasreplyableerror_create_error_request( uniffiTypeHasReplyableErrorObjectFactory.clonePointer(this), FfiConverterString.lower( ohttpRelay, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Process the response from the directory after posting the receiver * error response. * * Returns a [`HasReplyableErrorTransition`] that, once persisted, * completes the error reporting and either yields a * [`ReceiverPendingFallback`] if current session has validated fallback tx, * or otherwise closes the session. */ processErrorResponse( body: ArrayBuffer, ohttpContext: ClientResponseLike ): HasReplyableErrorTransitionLike { return FfiConverterTypeHasReplyableErrorTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_hasreplyableerror_process_error_response( uniffiTypeHasReplyableErrorObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower( body, nativeModule().rustbuffer_alloc ), FfiConverterTypeClientResponse.lower( ohttpContext, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeHasReplyableErrorObjectFactory.pointer(this); uniffiTypeHasReplyableErrorObjectFactory.freePointer(pointer); uniffiTypeHasReplyableErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is HasReplyableError { return uniffiTypeHasReplyableErrorObjectFactory.isConcreteType(obj_); } } const uniffiTypeHasReplyableErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): HasReplyableErrorLike { const instance = Object.create(HasReplyableError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "HasReplyableError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_hasreplyableerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: HasReplyableErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: HasReplyableErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_hasreplyableerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_hasreplyableerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is HasReplyableErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "HasReplyableError" ); }, }; })(); const FfiConverterTypeHasReplyableError = new FfiConverterObject( uniffiTypeHasReplyableErrorObjectFactory ); export interface ReceiverSessionOutcomeLike {} /** * @deprecated Use `ReceiverSessionOutcomeLike` instead. */ export type ReceiverSessionOutcomeInterface = ReceiverSessionOutcomeLike; export class ReceiverSessionOutcome extends UniffiAbstractObject implements ReceiverSessionOutcomeLike { readonly [uniffiTypeNameSymbol] = "ReceiverSessionOutcome"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeReceiverSessionOutcomeObjectFactory.bless(pointer); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeReceiverSessionOutcomeObjectFactory.pointer(this); uniffiTypeReceiverSessionOutcomeObjectFactory.freePointer(pointer); uniffiTypeReceiverSessionOutcomeObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ReceiverSessionOutcome { return uniffiTypeReceiverSessionOutcomeObjectFactory.isConcreteType(obj_); } } const uniffiTypeReceiverSessionOutcomeObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ReceiverSessionOutcomeLike { const instance = Object.create(ReceiverSessionOutcome.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ReceiverSessionOutcome"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_receiversessionoutcome_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ReceiverSessionOutcomeLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ReceiverSessionOutcomeLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_receiversessionoutcome( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_receiversessionoutcome( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ReceiverSessionOutcomeLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ReceiverSessionOutcome" ); }, }; })(); const FfiConverterTypeReceiverSessionOutcome = new FfiConverterObject( uniffiTypeReceiverSessionOutcomeObjectFactory ); // Enum: ReceiveSession export enum ReceiveSession_Tags { Initialized = "Initialized", UncheckedOriginalPayload = "UncheckedOriginalPayload", MaybeInputsOwned = "MaybeInputsOwned", MaybeInputsSeen = "MaybeInputsSeen", OutputsUnknown = "OutputsUnknown", WantsOutputs = "WantsOutputs", WantsInputs = "WantsInputs", WantsFeeRange = "WantsFeeRange", ProvisionalProposal = "ProvisionalProposal", PayjoinProposal = "PayjoinProposal", HasReplyableError = "HasReplyableError", Monitor = "Monitor", ReceiverPendingFallback = "ReceiverPendingFallback", Closed = "Closed", } export const ReceiveSession = (() => { type Initialized__interface = { tag: ReceiveSession_Tags.Initialized; inner: Readonly<{ inner: InitializedLike }>; }; class Initialized_ extends UniffiEnum implements Initialized__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiveSession"; readonly tag = ReceiveSession_Tags.Initialized; readonly inner: Readonly<{ inner: InitializedLike }>; constructor(inner: { inner: InitializedLike }) { super("ReceiveSession", "Initialized"); this.inner = Object.freeze(inner); } static new(inner: { inner: InitializedLike }): Initialized_ { return new Initialized_(inner); } static instanceOf(obj: any): obj is Initialized_ { return obj.tag === ReceiveSession_Tags.Initialized; } } type UncheckedOriginalPayload__interface = { tag: ReceiveSession_Tags.UncheckedOriginalPayload; inner: Readonly<{ inner: UncheckedOriginalPayloadLike }>; }; class UncheckedOriginalPayload_ extends UniffiEnum implements UncheckedOriginalPayload__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiveSession"; readonly tag = ReceiveSession_Tags.UncheckedOriginalPayload; readonly inner: Readonly<{ inner: UncheckedOriginalPayloadLike }>; constructor(inner: { inner: UncheckedOriginalPayloadLike }) { super("ReceiveSession", "UncheckedOriginalPayload"); this.inner = Object.freeze(inner); } static new(inner: { inner: UncheckedOriginalPayloadLike; }): UncheckedOriginalPayload_ { return new UncheckedOriginalPayload_(inner); } static instanceOf(obj: any): obj is UncheckedOriginalPayload_ { return obj.tag === ReceiveSession_Tags.UncheckedOriginalPayload; } } type MaybeInputsOwned__interface = { tag: ReceiveSession_Tags.MaybeInputsOwned; inner: Readonly<{ inner: MaybeInputsOwnedLike }>; }; class MaybeInputsOwned_ extends UniffiEnum implements MaybeInputsOwned__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiveSession"; readonly tag = ReceiveSession_Tags.MaybeInputsOwned; readonly inner: Readonly<{ inner: MaybeInputsOwnedLike }>; constructor(inner: { inner: MaybeInputsOwnedLike }) { super("ReceiveSession", "MaybeInputsOwned"); this.inner = Object.freeze(inner); } static new(inner: { inner: MaybeInputsOwnedLike }): MaybeInputsOwned_ { return new MaybeInputsOwned_(inner); } static instanceOf(obj: any): obj is MaybeInputsOwned_ { return obj.tag === ReceiveSession_Tags.MaybeInputsOwned; } } type MaybeInputsSeen__interface = { tag: ReceiveSession_Tags.MaybeInputsSeen; inner: Readonly<{ inner: MaybeInputsSeenLike }>; }; class MaybeInputsSeen_ extends UniffiEnum implements MaybeInputsSeen__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiveSession"; readonly tag = ReceiveSession_Tags.MaybeInputsSeen; readonly inner: Readonly<{ inner: MaybeInputsSeenLike }>; constructor(inner: { inner: MaybeInputsSeenLike }) { super("ReceiveSession", "MaybeInputsSeen"); this.inner = Object.freeze(inner); } static new(inner: { inner: MaybeInputsSeenLike }): MaybeInputsSeen_ { return new MaybeInputsSeen_(inner); } static instanceOf(obj: any): obj is MaybeInputsSeen_ { return obj.tag === ReceiveSession_Tags.MaybeInputsSeen; } } type OutputsUnknown__interface = { tag: ReceiveSession_Tags.OutputsUnknown; inner: Readonly<{ inner: OutputsUnknownLike }>; }; class OutputsUnknown_ extends UniffiEnum implements OutputsUnknown__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiveSession"; readonly tag = ReceiveSession_Tags.OutputsUnknown; readonly inner: Readonly<{ inner: OutputsUnknownLike }>; constructor(inner: { inner: OutputsUnknownLike }) { super("ReceiveSession", "OutputsUnknown"); this.inner = Object.freeze(inner); } static new(inner: { inner: OutputsUnknownLike }): OutputsUnknown_ { return new OutputsUnknown_(inner); } static instanceOf(obj: any): obj is OutputsUnknown_ { return obj.tag === ReceiveSession_Tags.OutputsUnknown; } } type WantsOutputs__interface = { tag: ReceiveSession_Tags.WantsOutputs; inner: Readonly<{ inner: WantsOutputsLike }>; }; class WantsOutputs_ extends UniffiEnum implements WantsOutputs__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiveSession"; readonly tag = ReceiveSession_Tags.WantsOutputs; readonly inner: Readonly<{ inner: WantsOutputsLike }>; constructor(inner: { inner: WantsOutputsLike }) { super("ReceiveSession", "WantsOutputs"); this.inner = Object.freeze(inner); } static new(inner: { inner: WantsOutputsLike }): WantsOutputs_ { return new WantsOutputs_(inner); } static instanceOf(obj: any): obj is WantsOutputs_ { return obj.tag === ReceiveSession_Tags.WantsOutputs; } } type WantsInputs__interface = { tag: ReceiveSession_Tags.WantsInputs; inner: Readonly<{ inner: WantsInputsLike }>; }; class WantsInputs_ extends UniffiEnum implements WantsInputs__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiveSession"; readonly tag = ReceiveSession_Tags.WantsInputs; readonly inner: Readonly<{ inner: WantsInputsLike }>; constructor(inner: { inner: WantsInputsLike }) { super("ReceiveSession", "WantsInputs"); this.inner = Object.freeze(inner); } static new(inner: { inner: WantsInputsLike }): WantsInputs_ { return new WantsInputs_(inner); } static instanceOf(obj: any): obj is WantsInputs_ { return obj.tag === ReceiveSession_Tags.WantsInputs; } } type WantsFeeRange__interface = { tag: ReceiveSession_Tags.WantsFeeRange; inner: Readonly<{ inner: WantsFeeRangeLike }>; }; class WantsFeeRange_ extends UniffiEnum implements WantsFeeRange__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiveSession"; readonly tag = ReceiveSession_Tags.WantsFeeRange; readonly inner: Readonly<{ inner: WantsFeeRangeLike }>; constructor(inner: { inner: WantsFeeRangeLike }) { super("ReceiveSession", "WantsFeeRange"); this.inner = Object.freeze(inner); } static new(inner: { inner: WantsFeeRangeLike }): WantsFeeRange_ { return new WantsFeeRange_(inner); } static instanceOf(obj: any): obj is WantsFeeRange_ { return obj.tag === ReceiveSession_Tags.WantsFeeRange; } } type ProvisionalProposal__interface = { tag: ReceiveSession_Tags.ProvisionalProposal; inner: Readonly<{ inner: ProvisionalProposalLike }>; }; class ProvisionalProposal_ extends UniffiEnum implements ProvisionalProposal__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiveSession"; readonly tag = ReceiveSession_Tags.ProvisionalProposal; readonly inner: Readonly<{ inner: ProvisionalProposalLike }>; constructor(inner: { inner: ProvisionalProposalLike }) { super("ReceiveSession", "ProvisionalProposal"); this.inner = Object.freeze(inner); } static new(inner: { inner: ProvisionalProposalLike; }): ProvisionalProposal_ { return new ProvisionalProposal_(inner); } static instanceOf(obj: any): obj is ProvisionalProposal_ { return obj.tag === ReceiveSession_Tags.ProvisionalProposal; } } type PayjoinProposal__interface = { tag: ReceiveSession_Tags.PayjoinProposal; inner: Readonly<{ inner: PayjoinProposalLike }>; }; class PayjoinProposal_ extends UniffiEnum implements PayjoinProposal__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiveSession"; readonly tag = ReceiveSession_Tags.PayjoinProposal; readonly inner: Readonly<{ inner: PayjoinProposalLike }>; constructor(inner: { inner: PayjoinProposalLike }) { super("ReceiveSession", "PayjoinProposal"); this.inner = Object.freeze(inner); } static new(inner: { inner: PayjoinProposalLike }): PayjoinProposal_ { return new PayjoinProposal_(inner); } static instanceOf(obj: any): obj is PayjoinProposal_ { return obj.tag === ReceiveSession_Tags.PayjoinProposal; } } type HasReplyableError__interface = { tag: ReceiveSession_Tags.HasReplyableError; inner: Readonly<{ inner: HasReplyableErrorLike }>; }; class HasReplyableError_ extends UniffiEnum implements HasReplyableError__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiveSession"; readonly tag = ReceiveSession_Tags.HasReplyableError; readonly inner: Readonly<{ inner: HasReplyableErrorLike }>; constructor(inner: { inner: HasReplyableErrorLike }) { super("ReceiveSession", "HasReplyableError"); this.inner = Object.freeze(inner); } static new(inner: { inner: HasReplyableErrorLike }): HasReplyableError_ { return new HasReplyableError_(inner); } static instanceOf(obj: any): obj is HasReplyableError_ { return obj.tag === ReceiveSession_Tags.HasReplyableError; } } type Monitor__interface = { tag: ReceiveSession_Tags.Monitor; inner: Readonly<{ inner: MonitorLike }>; }; class Monitor_ extends UniffiEnum implements Monitor__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiveSession"; readonly tag = ReceiveSession_Tags.Monitor; readonly inner: Readonly<{ inner: MonitorLike }>; constructor(inner: { inner: MonitorLike }) { super("ReceiveSession", "Monitor"); this.inner = Object.freeze(inner); } static new(inner: { inner: MonitorLike }): Monitor_ { return new Monitor_(inner); } static instanceOf(obj: any): obj is Monitor_ { return obj.tag === ReceiveSession_Tags.Monitor; } } type ReceiverPendingFallback__interface = { tag: ReceiveSession_Tags.ReceiverPendingFallback; inner: Readonly<{ inner: ReceiverPendingFallbackLike }>; }; class ReceiverPendingFallback_ extends UniffiEnum implements ReceiverPendingFallback__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiveSession"; readonly tag = ReceiveSession_Tags.ReceiverPendingFallback; readonly inner: Readonly<{ inner: ReceiverPendingFallbackLike }>; constructor(inner: { inner: ReceiverPendingFallbackLike }) { super("ReceiveSession", "ReceiverPendingFallback"); this.inner = Object.freeze(inner); } static new(inner: { inner: ReceiverPendingFallbackLike; }): ReceiverPendingFallback_ { return new ReceiverPendingFallback_(inner); } static instanceOf(obj: any): obj is ReceiverPendingFallback_ { return obj.tag === ReceiveSession_Tags.ReceiverPendingFallback; } } type Closed__interface = { tag: ReceiveSession_Tags.Closed; inner: Readonly<{ inner: ReceiverSessionOutcomeLike }>; }; class Closed_ extends UniffiEnum implements Closed__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiveSession"; readonly tag = ReceiveSession_Tags.Closed; readonly inner: Readonly<{ inner: ReceiverSessionOutcomeLike }>; constructor(inner: { inner: ReceiverSessionOutcomeLike }) { super("ReceiveSession", "Closed"); this.inner = Object.freeze(inner); } static new(inner: { inner: ReceiverSessionOutcomeLike }): Closed_ { return new Closed_(inner); } static instanceOf(obj: any): obj is Closed_ { return obj.tag === ReceiveSession_Tags.Closed; } } function instanceOf(obj: any): obj is ReceiveSession { return obj[uniffiTypeNameSymbol] === "ReceiveSession"; } return Object.freeze({ instanceOf, Initialized: Initialized_, UncheckedOriginalPayload: UncheckedOriginalPayload_, MaybeInputsOwned: MaybeInputsOwned_, MaybeInputsSeen: MaybeInputsSeen_, OutputsUnknown: OutputsUnknown_, WantsOutputs: WantsOutputs_, WantsInputs: WantsInputs_, WantsFeeRange: WantsFeeRange_, ProvisionalProposal: ProvisionalProposal_, PayjoinProposal: PayjoinProposal_, HasReplyableError: HasReplyableError_, Monitor: Monitor_, ReceiverPendingFallback: ReceiverPendingFallback_, Closed: Closed_, }); })(); export type ReceiveSession = InstanceType< (typeof ReceiveSession)[ | "Initialized" | "UncheckedOriginalPayload" | "MaybeInputsOwned" | "MaybeInputsSeen" | "OutputsUnknown" | "WantsOutputs" | "WantsInputs" | "WantsFeeRange" | "ProvisionalProposal" | "PayjoinProposal" | "HasReplyableError" | "Monitor" | "ReceiverPendingFallback" | "Closed"] >; // FfiConverter for enum ReceiveSession const FfiConverterTypeReceiveSession = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ReceiveSession; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ReceiveSession.Initialized({ inner: FfiConverterTypeInitialized.read(from), }); case 2: return new ReceiveSession.UncheckedOriginalPayload({ inner: FfiConverterTypeUncheckedOriginalPayload.read(from), }); case 3: return new ReceiveSession.MaybeInputsOwned({ inner: FfiConverterTypeMaybeInputsOwned.read(from), }); case 4: return new ReceiveSession.MaybeInputsSeen({ inner: FfiConverterTypeMaybeInputsSeen.read(from), }); case 5: return new ReceiveSession.OutputsUnknown({ inner: FfiConverterTypeOutputsUnknown.read(from), }); case 6: return new ReceiveSession.WantsOutputs({ inner: FfiConverterTypeWantsOutputs.read(from), }); case 7: return new ReceiveSession.WantsInputs({ inner: FfiConverterTypeWantsInputs.read(from), }); case 8: return new ReceiveSession.WantsFeeRange({ inner: FfiConverterTypeWantsFeeRange.read(from), }); case 9: return new ReceiveSession.ProvisionalProposal({ inner: FfiConverterTypeProvisionalProposal.read(from), }); case 10: return new ReceiveSession.PayjoinProposal({ inner: FfiConverterTypePayjoinProposal.read(from), }); case 11: return new ReceiveSession.HasReplyableError({ inner: FfiConverterTypeHasReplyableError.read(from), }); case 12: return new ReceiveSession.Monitor({ inner: FfiConverterTypeMonitor.read(from), }); case 13: return new ReceiveSession.ReceiverPendingFallback({ inner: FfiConverterTypeReceiverPendingFallback.read(from), }); case 14: return new ReceiveSession.Closed({ inner: FfiConverterTypeReceiverSessionOutcome.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ReceiveSession_Tags.Initialized: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeInitialized.write(inner.inner, into); return; } case ReceiveSession_Tags.UncheckedOriginalPayload: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeUncheckedOriginalPayload.write(inner.inner, into); return; } case ReceiveSession_Tags.MaybeInputsOwned: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeMaybeInputsOwned.write(inner.inner, into); return; } case ReceiveSession_Tags.MaybeInputsSeen: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterTypeMaybeInputsSeen.write(inner.inner, into); return; } case ReceiveSession_Tags.OutputsUnknown: { ordinalConverter.write(5, into); const inner = value.inner; FfiConverterTypeOutputsUnknown.write(inner.inner, into); return; } case ReceiveSession_Tags.WantsOutputs: { ordinalConverter.write(6, into); const inner = value.inner; FfiConverterTypeWantsOutputs.write(inner.inner, into); return; } case ReceiveSession_Tags.WantsInputs: { ordinalConverter.write(7, into); const inner = value.inner; FfiConverterTypeWantsInputs.write(inner.inner, into); return; } case ReceiveSession_Tags.WantsFeeRange: { ordinalConverter.write(8, into); const inner = value.inner; FfiConverterTypeWantsFeeRange.write(inner.inner, into); return; } case ReceiveSession_Tags.ProvisionalProposal: { ordinalConverter.write(9, into); const inner = value.inner; FfiConverterTypeProvisionalProposal.write(inner.inner, into); return; } case ReceiveSession_Tags.PayjoinProposal: { ordinalConverter.write(10, into); const inner = value.inner; FfiConverterTypePayjoinProposal.write(inner.inner, into); return; } case ReceiveSession_Tags.HasReplyableError: { ordinalConverter.write(11, into); const inner = value.inner; FfiConverterTypeHasReplyableError.write(inner.inner, into); return; } case ReceiveSession_Tags.Monitor: { ordinalConverter.write(12, into); const inner = value.inner; FfiConverterTypeMonitor.write(inner.inner, into); return; } case ReceiveSession_Tags.ReceiverPendingFallback: { ordinalConverter.write(13, into); const inner = value.inner; FfiConverterTypeReceiverPendingFallback.write(inner.inner, into); return; } case ReceiveSession_Tags.Closed: { ordinalConverter.write(14, into); const inner = value.inner; FfiConverterTypeReceiverSessionOutcome.write(inner.inner, into); return; } default: // Throwing from here means that ReceiveSession_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ReceiveSession_Tags.Initialized: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeInitialized.allocationSize(inner.inner); return size; } case ReceiveSession_Tags.UncheckedOriginalPayload: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeUncheckedOriginalPayload.allocationSize( inner.inner ); return size; } case ReceiveSession_Tags.MaybeInputsOwned: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeMaybeInputsOwned.allocationSize(inner.inner); return size; } case ReceiveSession_Tags.MaybeInputsSeen: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterTypeMaybeInputsSeen.allocationSize(inner.inner); return size; } case ReceiveSession_Tags.OutputsUnknown: { const inner = value.inner; let size = ordinalConverter.allocationSize(5); size += FfiConverterTypeOutputsUnknown.allocationSize(inner.inner); return size; } case ReceiveSession_Tags.WantsOutputs: { const inner = value.inner; let size = ordinalConverter.allocationSize(6); size += FfiConverterTypeWantsOutputs.allocationSize(inner.inner); return size; } case ReceiveSession_Tags.WantsInputs: { const inner = value.inner; let size = ordinalConverter.allocationSize(7); size += FfiConverterTypeWantsInputs.allocationSize(inner.inner); return size; } case ReceiveSession_Tags.WantsFeeRange: { const inner = value.inner; let size = ordinalConverter.allocationSize(8); size += FfiConverterTypeWantsFeeRange.allocationSize(inner.inner); return size; } case ReceiveSession_Tags.ProvisionalProposal: { const inner = value.inner; let size = ordinalConverter.allocationSize(9); size += FfiConverterTypeProvisionalProposal.allocationSize( inner.inner ); return size; } case ReceiveSession_Tags.PayjoinProposal: { const inner = value.inner; let size = ordinalConverter.allocationSize(10); size += FfiConverterTypePayjoinProposal.allocationSize(inner.inner); return size; } case ReceiveSession_Tags.HasReplyableError: { const inner = value.inner; let size = ordinalConverter.allocationSize(11); size += FfiConverterTypeHasReplyableError.allocationSize(inner.inner); return size; } case ReceiveSession_Tags.Monitor: { const inner = value.inner; let size = ordinalConverter.allocationSize(12); size += FfiConverterTypeMonitor.allocationSize(inner.inner); return size; } case ReceiveSession_Tags.ReceiverPendingFallback: { const inner = value.inner; let size = ordinalConverter.allocationSize(13); size += FfiConverterTypeReceiverPendingFallback.allocationSize( inner.inner ); return size; } case ReceiveSession_Tags.Closed: { const inner = value.inner; let size = ordinalConverter.allocationSize(14); size += FfiConverterTypeReceiverSessionOutcome.allocationSize( inner.inner ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); /** * Error parsing a Bitcoin address. */ export interface AddressParseErrorLike {} /** * @deprecated Use `AddressParseErrorLike` instead. */ export type AddressParseErrorInterface = AddressParseErrorLike; /** * Error parsing a Bitcoin address. */ export class AddressParseError extends UniffiAbstractObject implements AddressParseErrorLike { readonly [uniffiTypeNameSymbol] = "AddressParseError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeAddressParseErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_addressparseerror_uniffi_trait_display( uniffiTypeAddressParseErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_addressparseerror_uniffi_trait_debug( uniffiTypeAddressParseErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeAddressParseErrorObjectFactory.pointer(this); uniffiTypeAddressParseErrorObjectFactory.freePointer(pointer); uniffiTypeAddressParseErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is AddressParseError { return uniffiTypeAddressParseErrorObjectFactory.isConcreteType(obj_); } } const uniffiTypeAddressParseErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): AddressParseErrorLike { const instance = Object.create(AddressParseError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "AddressParseError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_addressparseerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: AddressParseErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: AddressParseErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_addressparseerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_addressparseerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is AddressParseErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "AddressParseError" ); }, }; })(); const FfiConverterTypeAddressParseError = new FfiConverterObject( uniffiTypeAddressParseErrorObjectFactory ); // Error type: ReceiverBuilderError export enum ReceiverBuilderError_Tags { InvalidAddress = "InvalidAddress", IntoUrl = "IntoUrl", } /** * Error that may occur when building a receiver session. */ export const ReceiverBuilderError = (() => { type InvalidAddress__interface = { tag: ReceiverBuilderError_Tags.InvalidAddress; inner: Readonly<[AddressParseErrorLike]>; }; /** * The provided Bitcoin address is invalid. */ class InvalidAddress_ extends UniffiError implements InvalidAddress__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiverBuilderError"; readonly tag = ReceiverBuilderError_Tags.InvalidAddress; readonly inner: Readonly<[AddressParseErrorLike]>; constructor(v0: AddressParseErrorLike) { super("ReceiverBuilderError", "InvalidAddress"); this.inner = Object.freeze([v0]); } static new(v0: AddressParseErrorLike): InvalidAddress_ { return new InvalidAddress_(v0); } static instanceOf(obj: any): obj is InvalidAddress_ { return obj.tag === ReceiverBuilderError_Tags.InvalidAddress; } static hasInner(obj: any): obj is InvalidAddress_ { return InvalidAddress_.instanceOf(obj); } static getInner(obj: InvalidAddress_): Readonly<[AddressParseErrorLike]> { return obj.inner; } } type IntoUrl__interface = { tag: ReceiverBuilderError_Tags.IntoUrl; inner: Readonly<[IntoUrlErrorLike]>; }; /** * Error that may occur when converting a value into a URL. */ class IntoUrl_ extends UniffiError implements IntoUrl__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "ReceiverBuilderError"; readonly tag = ReceiverBuilderError_Tags.IntoUrl; readonly inner: Readonly<[IntoUrlErrorLike]>; constructor(v0: IntoUrlErrorLike) { super("ReceiverBuilderError", "IntoUrl"); this.inner = Object.freeze([v0]); } static new(v0: IntoUrlErrorLike): IntoUrl_ { return new IntoUrl_(v0); } static instanceOf(obj: any): obj is IntoUrl_ { return obj.tag === ReceiverBuilderError_Tags.IntoUrl; } static hasInner(obj: any): obj is IntoUrl_ { return IntoUrl_.instanceOf(obj); } static getInner(obj: IntoUrl_): Readonly<[IntoUrlErrorLike]> { return obj.inner; } } function instanceOf(obj: any): obj is ReceiverBuilderError { return obj[uniffiTypeNameSymbol] === "ReceiverBuilderError"; } return Object.freeze({ instanceOf, InvalidAddress: InvalidAddress_, IntoUrl: IntoUrl_, }); })(); /** * Error that may occur when building a receiver session. */ export type ReceiverBuilderError = InstanceType< (typeof ReceiverBuilderError)["InvalidAddress" | "IntoUrl"] >; // FfiConverter for enum ReceiverBuilderError const FfiConverterTypeReceiverBuilderError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = ReceiverBuilderError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new ReceiverBuilderError.InvalidAddress( FfiConverterTypeAddressParseError.read(from) ); case 2: return new ReceiverBuilderError.IntoUrl( FfiConverterTypeIntoUrlError.read(from) ); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case ReceiverBuilderError_Tags.InvalidAddress: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeAddressParseError.write(inner[0], into); return; } case ReceiverBuilderError_Tags.IntoUrl: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeIntoUrlError.write(inner[0], into); return; } default: // Throwing from here means that ReceiverBuilderError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case ReceiverBuilderError_Tags.InvalidAddress: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeAddressParseError.allocationSize(inner[0]); return size; } case ReceiverBuilderError_Tags.IntoUrl: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeIntoUrlError.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); export interface WithReplyKeyTransitionLike { save( persister: JsonSenderSessionPersister ): /*throws*/ PollingForProposalLike; saveAsync( persister: JsonSenderSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `WithReplyKeyTransitionLike` instead. */ export type WithReplyKeyTransitionInterface = WithReplyKeyTransitionLike; export class WithReplyKeyTransition extends UniffiAbstractObject implements WithReplyKeyTransitionLike { readonly [uniffiTypeNameSymbol] = "WithReplyKeyTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeWithReplyKeyTransitionObjectFactory.bless(pointer); } save( persister: JsonSenderSessionPersister ): PollingForProposalLike /*throws*/ { return FfiConverterTypePollingForProposal.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSenderPersistedError.lift.bind( FfiConverterTypeSenderPersistedError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_withreplykeytransition_save( uniffiTypeWithReplyKeyTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonSenderSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonSenderSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_withreplykeytransition_save_async( uniffiTypeWithReplyKeyTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonSenderSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypePollingForProposal.lift.bind( FfiConverterTypePollingForProposal ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeSenderPersistedError.lift.bind( FfiConverterTypeSenderPersistedError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeWithReplyKeyTransitionObjectFactory.pointer(this); uniffiTypeWithReplyKeyTransitionObjectFactory.freePointer(pointer); uniffiTypeWithReplyKeyTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is WithReplyKeyTransition { return uniffiTypeWithReplyKeyTransitionObjectFactory.isConcreteType(obj_); } } const uniffiTypeWithReplyKeyTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): WithReplyKeyTransitionLike { const instance = Object.create(WithReplyKeyTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "WithReplyKeyTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_withreplykeytransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: WithReplyKeyTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: WithReplyKeyTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_withreplykeytransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_withreplykeytransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is WithReplyKeyTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "WithReplyKeyTransition" ); }, }; })(); const FfiConverterTypeWithReplyKeyTransition = new FfiConverterObject( uniffiTypeWithReplyKeyTransitionObjectFactory ); export interface WithReplyKeyLike { /** * Cancel the Payjoin session immediately. * * Returns a [`SenderCancelTransition`] that, once persisted, yields a * [`SenderPendingFallback`] state. Call [`SenderPendingFallback::fallback_tx`] to get * the original transaction */ cancel(): SenderCancelTransitionLike; /** * Construct serialized Request and Context from a Payjoin Proposal. * * Important: This request must not be retried or reused on failure. * Retransmitting the same ciphertext breaks OHTTP privacy properties. * The specific concern is that the relay can see that a request is being retried. */ createV2PostRequest(ohttpRelay: string): /*throws*/ RequestOhttpContext; /** * Decodes and validates the response. * Call this method with a response from the receiver to continue the BIP77 flow. * A successful response can either be `None` if the relay has no response yet, * or `Some(Psbt)`. * If the response is a valid PSBT you should sign and broadcast it. */ processResponse( response: ArrayBuffer, postCtx: ClientResponseLike ): WithReplyKeyTransitionLike; } /** * @deprecated Use `WithReplyKeyLike` instead. */ export type WithReplyKeyInterface = WithReplyKeyLike; export class WithReplyKey extends UniffiAbstractObject implements WithReplyKeyLike { readonly [uniffiTypeNameSymbol] = "WithReplyKey"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeWithReplyKeyObjectFactory.bless(pointer); } /** * Cancel the Payjoin session immediately. * * Returns a [`SenderCancelTransition`] that, once persisted, yields a * [`SenderPendingFallback`] state. Call [`SenderPendingFallback::fallback_tx`] to get * the original transaction */ cancel(): SenderCancelTransitionLike { return FfiConverterTypeSenderCancelTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_withreplykey_cancel( uniffiTypeWithReplyKeyObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Construct serialized Request and Context from a Payjoin Proposal. * * Important: This request must not be retried or reused on failure. * Retransmitting the same ciphertext breaks OHTTP privacy properties. * The specific concern is that the relay can see that a request is being retried. */ createV2PostRequest(ohttpRelay: string): RequestOhttpContext /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterTypeRequestOhttpContext.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeCreateRequestError__as_error.lift.bind( FfiConverterTypeCreateRequestError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_withreplykey_create_v2_post_request( uniffiTypeWithReplyKeyObjectFactory.clonePointer(this), FfiConverterString.lower( ohttpRelay, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Decodes and validates the response. * Call this method with a response from the receiver to continue the BIP77 flow. * A successful response can either be `None` if the relay has no response yet, * or `Some(Psbt)`. * If the response is a valid PSBT you should sign and broadcast it. */ processResponse( response: ArrayBuffer, postCtx: ClientResponseLike ): WithReplyKeyTransitionLike { return FfiConverterTypeWithReplyKeyTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_withreplykey_process_response( uniffiTypeWithReplyKeyObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower( response, nativeModule().rustbuffer_alloc ), FfiConverterTypeClientResponse.lower( postCtx, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeWithReplyKeyObjectFactory.pointer(this); uniffiTypeWithReplyKeyObjectFactory.freePointer(pointer); uniffiTypeWithReplyKeyObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is WithReplyKey { return uniffiTypeWithReplyKeyObjectFactory.isConcreteType(obj_); } } const uniffiTypeWithReplyKeyObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): WithReplyKeyLike { const instance = Object.create(WithReplyKey.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "WithReplyKey"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_withreplykey_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: WithReplyKeyLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: WithReplyKeyLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_withreplykey( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_withreplykey( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is WithReplyKeyLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "WithReplyKey" ); }, }; })(); const FfiConverterTypeWithReplyKey = new FfiConverterObject( uniffiTypeWithReplyKeyObjectFactory ); export interface SenderSessionOutcomeLike { isAborted(): boolean; isSuccess(): boolean; successPsbtBase64(): string | undefined; } /** * @deprecated Use `SenderSessionOutcomeLike` instead. */ export type SenderSessionOutcomeInterface = SenderSessionOutcomeLike; export class SenderSessionOutcome extends UniffiAbstractObject implements SenderSessionOutcomeLike { readonly [uniffiTypeNameSymbol] = "SenderSessionOutcome"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSenderSessionOutcomeObjectFactory.bless(pointer); } isAborted(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_sendersessionoutcome_is_aborted( uniffiTypeSenderSessionOutcomeObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } isSuccess(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_sendersessionoutcome_is_success( uniffiTypeSenderSessionOutcomeObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } successPsbtBase64(): string | undefined { return ((__rb: Uint8Array) => { try { return FfiConverterOptionalString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_sendersessionoutcome_success_psbt_base64( uniffiTypeSenderSessionOutcomeObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSenderSessionOutcomeObjectFactory.pointer(this); uniffiTypeSenderSessionOutcomeObjectFactory.freePointer(pointer); uniffiTypeSenderSessionOutcomeObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is SenderSessionOutcome { return uniffiTypeSenderSessionOutcomeObjectFactory.isConcreteType(obj_); } } const uniffiTypeSenderSessionOutcomeObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): SenderSessionOutcomeLike { const instance = Object.create(SenderSessionOutcome.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "SenderSessionOutcome"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_sendersessionoutcome_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: SenderSessionOutcomeLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: SenderSessionOutcomeLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_sendersessionoutcome( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_sendersessionoutcome( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is SenderSessionOutcomeLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SenderSessionOutcome" ); }, }; })(); const FfiConverterTypeSenderSessionOutcome = new FfiConverterObject( uniffiTypeSenderSessionOutcomeObjectFactory ); // Enum: SendSession export enum SendSession_Tags { WithReplyKey = "WithReplyKey", PollingForProposal = "PollingForProposal", SenderPendingFallback = "SenderPendingFallback", Closed = "Closed", } export const SendSession = (() => { type WithReplyKey__interface = { tag: SendSession_Tags.WithReplyKey; inner: Readonly<{ inner: WithReplyKeyLike }>; }; class WithReplyKey_ extends UniffiEnum implements WithReplyKey__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "SendSession"; readonly tag = SendSession_Tags.WithReplyKey; readonly inner: Readonly<{ inner: WithReplyKeyLike }>; constructor(inner: { inner: WithReplyKeyLike }) { super("SendSession", "WithReplyKey"); this.inner = Object.freeze(inner); } static new(inner: { inner: WithReplyKeyLike }): WithReplyKey_ { return new WithReplyKey_(inner); } static instanceOf(obj: any): obj is WithReplyKey_ { return obj.tag === SendSession_Tags.WithReplyKey; } } type PollingForProposal__interface = { tag: SendSession_Tags.PollingForProposal; inner: Readonly<{ inner: PollingForProposalLike }>; }; class PollingForProposal_ extends UniffiEnum implements PollingForProposal__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "SendSession"; readonly tag = SendSession_Tags.PollingForProposal; readonly inner: Readonly<{ inner: PollingForProposalLike }>; constructor(inner: { inner: PollingForProposalLike }) { super("SendSession", "PollingForProposal"); this.inner = Object.freeze(inner); } static new(inner: { inner: PollingForProposalLike }): PollingForProposal_ { return new PollingForProposal_(inner); } static instanceOf(obj: any): obj is PollingForProposal_ { return obj.tag === SendSession_Tags.PollingForProposal; } } type SenderPendingFallback__interface = { tag: SendSession_Tags.SenderPendingFallback; inner: Readonly<{ inner: SenderPendingFallbackLike }>; }; class SenderPendingFallback_ extends UniffiEnum implements SenderPendingFallback__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "SendSession"; readonly tag = SendSession_Tags.SenderPendingFallback; readonly inner: Readonly<{ inner: SenderPendingFallbackLike }>; constructor(inner: { inner: SenderPendingFallbackLike }) { super("SendSession", "SenderPendingFallback"); this.inner = Object.freeze(inner); } static new(inner: { inner: SenderPendingFallbackLike; }): SenderPendingFallback_ { return new SenderPendingFallback_(inner); } static instanceOf(obj: any): obj is SenderPendingFallback_ { return obj.tag === SendSession_Tags.SenderPendingFallback; } } type Closed__interface = { tag: SendSession_Tags.Closed; inner: Readonly<{ inner: SenderSessionOutcomeLike }>; }; class Closed_ extends UniffiEnum implements Closed__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "SendSession"; readonly tag = SendSession_Tags.Closed; readonly inner: Readonly<{ inner: SenderSessionOutcomeLike }>; constructor(inner: { inner: SenderSessionOutcomeLike }) { super("SendSession", "Closed"); this.inner = Object.freeze(inner); } static new(inner: { inner: SenderSessionOutcomeLike }): Closed_ { return new Closed_(inner); } static instanceOf(obj: any): obj is Closed_ { return obj.tag === SendSession_Tags.Closed; } } function instanceOf(obj: any): obj is SendSession { return obj[uniffiTypeNameSymbol] === "SendSession"; } return Object.freeze({ instanceOf, WithReplyKey: WithReplyKey_, PollingForProposal: PollingForProposal_, SenderPendingFallback: SenderPendingFallback_, Closed: Closed_, }); })(); export type SendSession = InstanceType< (typeof SendSession)[ | "WithReplyKey" | "PollingForProposal" | "SenderPendingFallback" | "Closed"] >; // FfiConverter for enum SendSession const FfiConverterTypeSendSession = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SendSession; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new SendSession.WithReplyKey({ inner: FfiConverterTypeWithReplyKey.read(from), }); case 2: return new SendSession.PollingForProposal({ inner: FfiConverterTypePollingForProposal.read(from), }); case 3: return new SendSession.SenderPendingFallback({ inner: FfiConverterTypeSenderPendingFallback.read(from), }); case 4: return new SendSession.Closed({ inner: FfiConverterTypeSenderSessionOutcome.read(from), }); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case SendSession_Tags.WithReplyKey: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypeWithReplyKey.write(inner.inner, into); return; } case SendSession_Tags.PollingForProposal: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypePollingForProposal.write(inner.inner, into); return; } case SendSession_Tags.SenderPendingFallback: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeSenderPendingFallback.write(inner.inner, into); return; } case SendSession_Tags.Closed: { ordinalConverter.write(4, into); const inner = value.inner; FfiConverterTypeSenderSessionOutcome.write(inner.inner, into); return; } default: // Throwing from here means that SendSession_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case SendSession_Tags.WithReplyKey: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypeWithReplyKey.allocationSize(inner.inner); return size; } case SendSession_Tags.PollingForProposal: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypePollingForProposal.allocationSize( inner.inner ); return size; } case SendSession_Tags.SenderPendingFallback: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeSenderPendingFallback.allocationSize( inner.inner ); return size; } case SendSession_Tags.Closed: { const inner = value.inner; let size = ordinalConverter.allocationSize(4); size += FfiConverterTypeSenderSessionOutcome.allocationSize( inner.inner ); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); // Error type: SenderInputError export enum SenderInputError_Tags { Psbt = "Psbt", Build = "Build", FfiValidation = "FfiValidation", } /** * Raised when inputs provided to the sender are malformed or sender build fails. */ export const SenderInputError = (() => { type Psbt__interface = { tag: SenderInputError_Tags.Psbt; inner: Readonly<[PsbtParseError]>; }; class Psbt_ extends UniffiError implements Psbt__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "SenderInputError"; readonly tag = SenderInputError_Tags.Psbt; readonly inner: Readonly<[PsbtParseError]>; constructor(v0: PsbtParseError) { super("SenderInputError", "Psbt"); this.inner = Object.freeze([v0]); } static new(v0: PsbtParseError): Psbt_ { return new Psbt_(v0); } static instanceOf(obj: any): obj is Psbt_ { return obj.tag === SenderInputError_Tags.Psbt; } static hasInner(obj: any): obj is Psbt_ { return Psbt_.instanceOf(obj); } static getInner(obj: Psbt_): Readonly<[PsbtParseError]> { return obj.inner; } } type Build__interface = { tag: SenderInputError_Tags.Build; inner: Readonly<[SenderBuilderErrorLike]>; }; class Build_ extends UniffiError implements Build__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "SenderInputError"; readonly tag = SenderInputError_Tags.Build; readonly inner: Readonly<[SenderBuilderErrorLike]>; constructor(v0: SenderBuilderErrorLike) { super("SenderInputError", "Build"); this.inner = Object.freeze([v0]); } static new(v0: SenderBuilderErrorLike): Build_ { return new Build_(v0); } static instanceOf(obj: any): obj is Build_ { return obj.tag === SenderInputError_Tags.Build; } static hasInner(obj: any): obj is Build_ { return Build_.instanceOf(obj); } static getInner(obj: Build_): Readonly<[SenderBuilderErrorLike]> { return obj.inner; } } type FfiValidation__interface = { tag: SenderInputError_Tags.FfiValidation; inner: Readonly<[FfiValidationError]>; }; class FfiValidation_ extends UniffiError implements FfiValidation__interface { /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol] = "SenderInputError"; readonly tag = SenderInputError_Tags.FfiValidation; readonly inner: Readonly<[FfiValidationError]>; constructor(v0: FfiValidationError) { super("SenderInputError", "FfiValidation"); this.inner = Object.freeze([v0]); } static new(v0: FfiValidationError): FfiValidation_ { return new FfiValidation_(v0); } static instanceOf(obj: any): obj is FfiValidation_ { return obj.tag === SenderInputError_Tags.FfiValidation; } static hasInner(obj: any): obj is FfiValidation_ { return FfiValidation_.instanceOf(obj); } static getInner(obj: FfiValidation_): Readonly<[FfiValidationError]> { return obj.inner; } } function instanceOf(obj: any): obj is SenderInputError { return obj[uniffiTypeNameSymbol] === "SenderInputError"; } return Object.freeze({ instanceOf, Psbt: Psbt_, Build: Build_, FfiValidation: FfiValidation_, }); })(); /** * Raised when inputs provided to the sender are malformed or sender build fails. */ export type SenderInputError = InstanceType< (typeof SenderInputError)["Psbt" | "Build" | "FfiValidation"] >; // FfiConverter for enum SenderInputError const FfiConverterTypeSenderInputError = (() => { const ordinalConverter = FfiConverterInt32; type TypeName = SenderInputError; class FFIConverter extends AbstractFfiConverterByteArray { read(from: RustBuffer): TypeName { switch (ordinalConverter.read(from)) { case 1: return new SenderInputError.Psbt( FfiConverterTypePsbtParseError.read(from) ); case 2: return new SenderInputError.Build( FfiConverterTypeSenderBuilderError.read(from) ); case 3: return new SenderInputError.FfiValidation( FfiConverterTypeFfiValidationError.read(from) ); default: throw new UniffiInternalError.UnexpectedEnumCase(); } } write(value: TypeName, into: RustBuffer): void { switch (value.tag) { case SenderInputError_Tags.Psbt: { ordinalConverter.write(1, into); const inner = value.inner; FfiConverterTypePsbtParseError.write(inner[0], into); return; } case SenderInputError_Tags.Build: { ordinalConverter.write(2, into); const inner = value.inner; FfiConverterTypeSenderBuilderError.write(inner[0], into); return; } case SenderInputError_Tags.FfiValidation: { ordinalConverter.write(3, into); const inner = value.inner; FfiConverterTypeFfiValidationError.write(inner[0], into); return; } default: // Throwing from here means that SenderInputError_Tags hasn't matched an ordinal. throw new UniffiInternalError.UnexpectedEnumCase(); } } allocationSize(value: TypeName): number { switch (value.tag) { case SenderInputError_Tags.Psbt: { const inner = value.inner; let size = ordinalConverter.allocationSize(1); size += FfiConverterTypePsbtParseError.allocationSize(inner[0]); return size; } case SenderInputError_Tags.Build: { const inner = value.inner; let size = ordinalConverter.allocationSize(2); size += FfiConverterTypeSenderBuilderError.allocationSize(inner[0]); return size; } case SenderInputError_Tags.FfiValidation: { const inner = value.inner; let size = ordinalConverter.allocationSize(3); size += FfiConverterTypeFfiValidationError.allocationSize(inner[0]); return size; } default: throw new UniffiInternalError.UnexpectedEnumCase(); } } } return new FFIConverter(); })(); export interface FeeRateErrorLike {} /** * @deprecated Use `FeeRateErrorLike` instead. */ export type FeeRateErrorInterface = FeeRateErrorLike; export class FeeRateError extends UniffiAbstractObject implements FeeRateErrorLike { readonly [uniffiTypeNameSymbol] = "FeeRateError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeFeeRateErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_feerateerror_uniffi_trait_display( uniffiTypeFeeRateErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_feerateerror_uniffi_trait_debug( uniffiTypeFeeRateErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeFeeRateErrorObjectFactory.pointer(this); uniffiTypeFeeRateErrorObjectFactory.freePointer(pointer); uniffiTypeFeeRateErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is FeeRateError { return uniffiTypeFeeRateErrorObjectFactory.isConcreteType(obj_); } static hasInner(obj_: any): obj_ is UniffiThrownObject { return ( UniffiThrownObject.instanceOf(obj_) && FeeRateError.instanceOf(obj_.inner) ); } static getInner(err: UniffiThrownObject): FeeRateError { return err.inner; } } const uniffiTypeFeeRateErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): FeeRateErrorLike { const instance = Object.create(FeeRateError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "FeeRateError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_feerateerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: FeeRateErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: FeeRateErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_feerateerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_feerateerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is FeeRateErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "FeeRateError" ); }, }; })(); const FfiConverterTypeFeeRateError = new FfiConverterObject( uniffiTypeFeeRateErrorObjectFactory ); const FfiConverterTypeFeeRateError__as_error = new FfiConverterObjectAsError( "FeeRateError", FfiConverterTypeFeeRateError ); export interface InitialReceiveTransitionLike { save(persister: JsonReceiverSessionPersister): /*throws*/ InitializedLike; saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `InitialReceiveTransitionLike` instead. */ export type InitialReceiveTransitionInterface = InitialReceiveTransitionLike; export class InitialReceiveTransition extends UniffiAbstractObject implements InitialReceiveTransitionLike { readonly [uniffiTypeNameSymbol] = "InitialReceiveTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeInitialReceiveTransitionObjectFactory.bless(pointer); } save(persister: JsonReceiverSessionPersister): InitializedLike /*throws*/ { return FfiConverterTypeInitialized.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_initialreceivetransition_save( uniffiTypeInitialReceiveTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonReceiverSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_initialreceivetransition_save_async( uniffiTypeInitialReceiveTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonReceiverSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeInitialized.lift.bind( FfiConverterTypeInitialized ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeInitialReceiveTransitionObjectFactory.pointer(this); uniffiTypeInitialReceiveTransitionObjectFactory.freePointer(pointer); uniffiTypeInitialReceiveTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is InitialReceiveTransition { return uniffiTypeInitialReceiveTransitionObjectFactory.isConcreteType(obj_); } } const uniffiTypeInitialReceiveTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): InitialReceiveTransitionLike { const instance = Object.create(InitialReceiveTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "InitialReceiveTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_initialreceivetransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: InitialReceiveTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: InitialReceiveTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_initialreceivetransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_initialreceivetransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is InitialReceiveTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "InitialReceiveTransition" ); }, }; })(); const FfiConverterTypeInitialReceiveTransition = new FfiConverterObject( uniffiTypeInitialReceiveTransitionObjectFactory ); export interface InitialSendTransitionLike { save(persister: JsonSenderSessionPersister): /*throws*/ WithReplyKeyLike; saveAsync( persister: JsonSenderSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): /*throws*/ Promise; } /** * @deprecated Use `InitialSendTransitionLike` instead. */ export type InitialSendTransitionInterface = InitialSendTransitionLike; export class InitialSendTransition extends UniffiAbstractObject implements InitialSendTransitionLike { readonly [uniffiTypeNameSymbol] = "InitialSendTransition"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeInitialSendTransitionObjectFactory.bless(pointer); } save(persister: JsonSenderSessionPersister): WithReplyKeyLike /*throws*/ { return FfiConverterTypeWithReplyKey.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_initialsendtransition_save( uniffiTypeInitialSendTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonSenderSessionPersister.lower( persister, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } async saveAsync( persister: JsonSenderSessionPersisterAsync, asyncOpts_?: { signal: AbortSignal } ): Promise /*throws*/ { const __stack = uniffiIsDebug ? new Error().stack : undefined; try { return await uniffiRustCallAsync( /*rustCaller:*/ uniffiCaller, /*rustFutureFunc:*/ () => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_initialsendtransition_save_async( uniffiTypeInitialSendTransitionObjectFactory.clonePointer(this), FfiConverterTypeJsonSenderSessionPersisterAsync.lower( persister, nativeModule().rustbuffer_alloc ) ); }, /*pollFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_poll_u64, /*cancelFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_cancel_u64, /*completeFunc:*/ nativeModule() .ubrn_ffi_payjoin_ffi_rust_future_complete_u64, /*freeFunc:*/ nativeModule().ubrn_ffi_payjoin_ffi_rust_future_free_u64, // Async returns always go through the JS-side converter: the // FFI symbol returns the future handle (u64), and the user-level // RustBuffer comes back via the shared `rust_future_complete_*` // export. The bytes the runtime hands back must be deserialized // here using the per-callable return-type converter. /*liftFunc:*/ FfiConverterTypeWithReplyKey.lift.bind( FfiConverterTypeWithReplyKey ), /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), /*asyncOpts:*/ asyncOpts_, /*errorHandler:*/ FfiConverterTypeForeignError.lift.bind( FfiConverterTypeForeignError ) ); } catch (__error: any) { if (uniffiIsDebug && __error instanceof Error) { __error.stack = __stack; } throw __error; } } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeInitialSendTransitionObjectFactory.pointer(this); uniffiTypeInitialSendTransitionObjectFactory.freePointer(pointer); uniffiTypeInitialSendTransitionObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is InitialSendTransition { return uniffiTypeInitialSendTransitionObjectFactory.isConcreteType(obj_); } } const uniffiTypeInitialSendTransitionObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): InitialSendTransitionLike { const instance = Object.create(InitialSendTransition.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "InitialSendTransition"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_initialsendtransition_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: InitialSendTransitionLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: InitialSendTransitionLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_initialsendtransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_initialsendtransition( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is InitialSendTransitionLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "InitialSendTransition" ); }, }; })(); const FfiConverterTypeInitialSendTransition = new FfiConverterObject( uniffiTypeInitialSendTransitionObjectFactory ); /** * The standard format for errors that can be replied as JSON. * * The JSON output includes the following fields: * ```json * { * "errorCode": "specific-error-code", * "message": "Human readable error message" * } * ``` */ export interface JsonReplyLike {} /** * @deprecated Use `JsonReplyLike` instead. */ export type JsonReplyInterface = JsonReplyLike; /** * The standard format for errors that can be replied as JSON. * * The JSON output includes the following fields: * ```json * { * "errorCode": "specific-error-code", * "message": "Human readable error message" * } * ``` */ export class JsonReply extends UniffiAbstractObject implements JsonReplyLike { readonly [uniffiTypeNameSymbol] = "JsonReply"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeJsonReplyObjectFactory.bless(pointer); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_jsonreply_uniffi_trait_debug( uniffiTypeJsonReplyObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toString(): string { return this.toDebugString(); } equals(other: JsonReply): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_jsonreply_uniffi_trait_eq_eq( uniffiTypeJsonReplyObjectFactory.clonePointer(this), FfiConverterTypeJsonReply.lower( other, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeJsonReplyObjectFactory.pointer(this); uniffiTypeJsonReplyObjectFactory.freePointer(pointer); uniffiTypeJsonReplyObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is JsonReply { return uniffiTypeJsonReplyObjectFactory.isConcreteType(obj_); } } const uniffiTypeJsonReplyObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): JsonReplyLike { const instance = Object.create(JsonReply.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "JsonReply"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_jsonreply_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: JsonReplyLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: JsonReplyLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_jsonreply( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_jsonreply( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is JsonReplyLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "JsonReply" ); }, }; })(); const FfiConverterTypeJsonReply = new FfiConverterObject( uniffiTypeJsonReplyObjectFactory ); export interface OhttpErrorLike {} /** * @deprecated Use `OhttpErrorLike` instead. */ export type OhttpErrorInterface = OhttpErrorLike; export class OhttpError extends UniffiAbstractObject implements OhttpErrorLike { readonly [uniffiTypeNameSymbol] = "OhttpError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeOhttpErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_ohttperror_uniffi_trait_display( uniffiTypeOhttpErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_ohttperror_uniffi_trait_debug( uniffiTypeOhttpErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeOhttpErrorObjectFactory.pointer(this); uniffiTypeOhttpErrorObjectFactory.freePointer(pointer); uniffiTypeOhttpErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is OhttpError { return uniffiTypeOhttpErrorObjectFactory.isConcreteType(obj_); } static hasInner(obj_: any): obj_ is UniffiThrownObject { return ( UniffiThrownObject.instanceOf(obj_) && OhttpError.instanceOf(obj_.inner) ); } static getInner(err: UniffiThrownObject): OhttpError { return err.inner; } } const uniffiTypeOhttpErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): OhttpErrorLike { const instance = Object.create(OhttpError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "OhttpError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_ohttperror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: OhttpErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: OhttpErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_ohttperror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_ohttperror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is OhttpErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "OhttpError" ); }, }; })(); const FfiConverterTypeOhttpError = new FfiConverterObject( uniffiTypeOhttpErrorObjectFactory ); const FfiConverterTypeOhttpError__as_error = new FfiConverterObjectAsError( "OhttpError", FfiConverterTypeOhttpError ); export interface OhttpKeysLike {} /** * @deprecated Use `OhttpKeysLike` instead. */ export type OhttpKeysInterface = OhttpKeysLike; export class OhttpKeys extends UniffiAbstractObject implements OhttpKeysLike { readonly [uniffiTypeNameSymbol] = "OhttpKeys"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeOhttpKeysObjectFactory.bless(pointer); } /** * Decode an OHTTP KeyConfig */ static decode(bytes: ArrayBuffer): OhttpKeysLike /*throws*/ { return FfiConverterTypeOhttpKeys.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeOhttpError__as_error.lift.bind( FfiConverterTypeOhttpError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_constructor_ohttpkeys_decode( FfiConverterArrayBuffer.lower( bytes, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeOhttpKeysObjectFactory.pointer(this); uniffiTypeOhttpKeysObjectFactory.freePointer(pointer); uniffiTypeOhttpKeysObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is OhttpKeys { return uniffiTypeOhttpKeysObjectFactory.isConcreteType(obj_); } } const uniffiTypeOhttpKeysObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): OhttpKeysLike { const instance = Object.create(OhttpKeys.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "OhttpKeys"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_ohttpkeys_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: OhttpKeysLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: OhttpKeysLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_ohttpkeys( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_ohttpkeys( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is OhttpKeysLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "OhttpKeys" ); }, }; })(); const FfiConverterTypeOhttpKeys = new FfiConverterObject( uniffiTypeOhttpKeysObjectFactory ); export interface PjNotSupportedLike {} /** * @deprecated Use `PjNotSupportedLike` instead. */ export type PjNotSupportedInterface = PjNotSupportedLike; export class PjNotSupported extends UniffiAbstractObject implements PjNotSupportedLike { readonly [uniffiTypeNameSymbol] = "PjNotSupported"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypePjNotSupportedObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pjnotsupported_uniffi_trait_display( uniffiTypePjNotSupportedObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pjnotsupported_uniffi_trait_debug( uniffiTypePjNotSupportedObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } equals(other: PjNotSupported): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pjnotsupported_uniffi_trait_eq_eq( uniffiTypePjNotSupportedObjectFactory.clonePointer(this), FfiConverterTypePjNotSupported.lower( other, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypePjNotSupportedObjectFactory.pointer(this); uniffiTypePjNotSupportedObjectFactory.freePointer(pointer); uniffiTypePjNotSupportedObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is PjNotSupported { return uniffiTypePjNotSupportedObjectFactory.isConcreteType(obj_); } static hasInner(obj_: any): obj_ is UniffiThrownObject { return ( UniffiThrownObject.instanceOf(obj_) && PjNotSupported.instanceOf(obj_.inner) ); } static getInner(err: UniffiThrownObject): PjNotSupported { return err.inner; } } const uniffiTypePjNotSupportedObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): PjNotSupportedLike { const instance = Object.create(PjNotSupported.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "PjNotSupported"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_pjnotsupported_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: PjNotSupportedLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: PjNotSupportedLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_pjnotsupported( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_pjnotsupported( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is PjNotSupportedLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "PjNotSupported" ); }, }; })(); const FfiConverterTypePjNotSupported = new FfiConverterObject( uniffiTypePjNotSupportedObjectFactory ); const FfiConverterTypePjNotSupported__as_error = new FfiConverterObjectAsError( "PjNotSupported", FfiConverterTypePjNotSupported ); export interface PjParamLike { /** * The receiver's ephemeral HPKE public key, as 33 compressed bytes. * * Stable for the lifetime of a receive session. Consumers use it to * deduplicate and resume sender sessions and to ensure a receiver key * is not reused across sessions, without parsing the endpoint fragment. */ receiverPubkey(): ArrayBuffer; } /** * @deprecated Use `PjParamLike` instead. */ export type PjParamInterface = PjParamLike; export class PjParam extends UniffiAbstractObject implements PjParamLike { readonly [uniffiTypeNameSymbol] = "PjParam"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypePjParamObjectFactory.bless(pointer); } /** * The receiver's ephemeral HPKE public key, as 33 compressed bytes. * * Stable for the lifetime of a receive session. Consumers use it to * deduplicate and resume sender sessions and to ensure a receiver key * is not reused across sessions, without parsing the endpoint fragment. */ receiverPubkey(): ArrayBuffer { return ((__rb: Uint8Array) => { try { return FfiConverterArrayBuffer.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_pjparam_receiver_pubkey( uniffiTypePjParamObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypePjParamObjectFactory.pointer(this); uniffiTypePjParamObjectFactory.freePointer(pointer); uniffiTypePjParamObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is PjParam { return uniffiTypePjParamObjectFactory.isConcreteType(obj_); } } const uniffiTypePjParamObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): PjParamLike { const instance = Object.create(PjParam.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "PjParam"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_pjparam_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: PjParamLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: PjParamLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_pjparam( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_pjparam( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is PjParamLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "PjParam" ); }, }; })(); const FfiConverterTypePjParam = new FfiConverterObject( uniffiTypePjParamObjectFactory ); export interface ReceiverBuilderLike { build(): InitialReceiveTransitionLike; withAmount(amountSats: bigint): /*throws*/ ReceiverBuilderLike; withExpiration(expirationSecs: bigint): /*throws*/ ReceiverBuilderLike; /** * Set the maximum effective fee rate the receiver is willing to pay for their own input/output contributions */ withMaxFeeRate( maxEffectiveFeeRateSatPerVb: bigint ): /*throws*/ ReceiverBuilderLike; } /** * @deprecated Use `ReceiverBuilderLike` instead. */ export type ReceiverBuilderInterface = ReceiverBuilderLike; export class ReceiverBuilder extends UniffiAbstractObject implements ReceiverBuilderLike { readonly [uniffiTypeNameSymbol] = "ReceiverBuilder"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; /** * Creates a new [`Initialized`] with the provided parameters. * * # Parameters * - `address`: The Bitcoin address for the payjoin session. * - `directory`: The URL of the store-and-forward payjoin directory. * - `ohttp_keys`: The OHTTP keys used for encrypting and decrypting HTTP requests and responses. * * # References * - [BIP 77: Payjoin Version 2: Serverless Payjoin](https://github.com/bitcoin/bips/blob/master/bip-0077.md) */ constructor( address: string, directory: string, ohttpKeys: OhttpKeysLike ) /*throws*/ { super(); const pointer = uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeReceiverBuilderError.lift.bind( FfiConverterTypeReceiverBuilderError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_constructor_receiverbuilder_new( FfiConverterString.lower(address, nativeModule().rustbuffer_alloc), FfiConverterString.lower(directory, nativeModule().rustbuffer_alloc), FfiConverterTypeOhttpKeys.lower( ohttpKeys, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeReceiverBuilderObjectFactory.bless(pointer); } build(): InitialReceiveTransitionLike { return FfiConverterTypeInitialReceiveTransition.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receiverbuilder_build( uniffiTypeReceiverBuilderObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } withAmount(amountSats: bigint): ReceiverBuilderLike /*throws*/ { return FfiConverterTypeReceiverBuilder.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeFfiValidationError.lift.bind( FfiConverterTypeFfiValidationError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receiverbuilder_with_amount( uniffiTypeReceiverBuilderObjectFactory.clonePointer(this), FfiConverterUInt64.lower( amountSats, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } withExpiration(expirationSecs: bigint): ReceiverBuilderLike /*throws*/ { return FfiConverterTypeReceiverBuilder.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeFfiValidationError.lift.bind( FfiConverterTypeFfiValidationError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receiverbuilder_with_expiration( uniffiTypeReceiverBuilderObjectFactory.clonePointer(this), FfiConverterUInt64.lower( expirationSecs, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Set the maximum effective fee rate the receiver is willing to pay for their own input/output contributions */ withMaxFeeRate( maxEffectiveFeeRateSatPerVb: bigint ): ReceiverBuilderLike /*throws*/ { return FfiConverterTypeReceiverBuilder.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeFeeRateError__as_error.lift.bind( FfiConverterTypeFeeRateError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receiverbuilder_with_max_fee_rate( uniffiTypeReceiverBuilderObjectFactory.clonePointer(this), FfiConverterUInt64.lower( maxEffectiveFeeRateSatPerVb, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeReceiverBuilderObjectFactory.pointer(this); uniffiTypeReceiverBuilderObjectFactory.freePointer(pointer); uniffiTypeReceiverBuilderObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ReceiverBuilder { return uniffiTypeReceiverBuilderObjectFactory.isConcreteType(obj_); } } const uniffiTypeReceiverBuilderObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ReceiverBuilderLike { const instance = Object.create(ReceiverBuilder.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ReceiverBuilder"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_receiverbuilder_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ReceiverBuilderLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ReceiverBuilderLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_receiverbuilder( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_receiverbuilder( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ReceiverBuilderLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ReceiverBuilder" ); }, }; })(); const FfiConverterTypeReceiverBuilder = new FfiConverterObject( uniffiTypeReceiverBuilderObjectFactory ); /** * Error that may occur when a receiver event log is replayed */ export interface ReceiverReplayErrorLike { /** * Returns `true` if the event log could not be replayed because the * session has expired. */ isExpired(): boolean; } /** * @deprecated Use `ReceiverReplayErrorLike` instead. */ export type ReceiverReplayErrorInterface = ReceiverReplayErrorLike; /** * Error that may occur when a receiver event log is replayed */ export class ReceiverReplayError extends UniffiAbstractObject implements ReceiverReplayErrorLike { readonly [uniffiTypeNameSymbol] = "ReceiverReplayError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeReceiverReplayErrorObjectFactory.bless(pointer); } /** * Returns `true` if the event log could not be replayed because the * session has expired. */ isExpired(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receiverreplayerror_is_expired( uniffiTypeReceiverReplayErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receiverreplayerror_uniffi_trait_display( uniffiTypeReceiverReplayErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receiverreplayerror_uniffi_trait_debug( uniffiTypeReceiverReplayErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeReceiverReplayErrorObjectFactory.pointer(this); uniffiTypeReceiverReplayErrorObjectFactory.freePointer(pointer); uniffiTypeReceiverReplayErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ReceiverReplayError { return uniffiTypeReceiverReplayErrorObjectFactory.isConcreteType(obj_); } static hasInner(obj_: any): obj_ is UniffiThrownObject { return ( UniffiThrownObject.instanceOf(obj_) && ReceiverReplayError.instanceOf(obj_.inner) ); } static getInner( err: UniffiThrownObject ): ReceiverReplayError { return err.inner; } } const uniffiTypeReceiverReplayErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ReceiverReplayErrorLike { const instance = Object.create(ReceiverReplayError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ReceiverReplayError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_receiverreplayerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ReceiverReplayErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ReceiverReplayErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_receiverreplayerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_receiverreplayerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ReceiverReplayErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ReceiverReplayError" ); }, }; })(); const FfiConverterTypeReceiverReplayError = new FfiConverterObject( uniffiTypeReceiverReplayErrorObjectFactory ); const FfiConverterTypeReceiverReplayError__as_error = new FfiConverterObjectAsError( "ReceiverReplayError", FfiConverterTypeReceiverReplayError ); export interface SerdeJsonErrorLike {} /** * @deprecated Use `SerdeJsonErrorLike` instead. */ export type SerdeJsonErrorInterface = SerdeJsonErrorLike; export class SerdeJsonError extends UniffiAbstractObject implements SerdeJsonErrorLike { readonly [uniffiTypeNameSymbol] = "SerdeJsonError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSerdeJsonErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_serdejsonerror_uniffi_trait_display( uniffiTypeSerdeJsonErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_serdejsonerror_uniffi_trait_debug( uniffiTypeSerdeJsonErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSerdeJsonErrorObjectFactory.pointer(this); uniffiTypeSerdeJsonErrorObjectFactory.freePointer(pointer); uniffiTypeSerdeJsonErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is SerdeJsonError { return uniffiTypeSerdeJsonErrorObjectFactory.isConcreteType(obj_); } static hasInner(obj_: any): obj_ is UniffiThrownObject { return ( UniffiThrownObject.instanceOf(obj_) && SerdeJsonError.instanceOf(obj_.inner) ); } static getInner(err: UniffiThrownObject): SerdeJsonError { return err.inner; } } const uniffiTypeSerdeJsonErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): SerdeJsonErrorLike { const instance = Object.create(SerdeJsonError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "SerdeJsonError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_serdejsonerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: SerdeJsonErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: SerdeJsonErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_serdejsonerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_serdejsonerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is SerdeJsonErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SerdeJsonError" ); }, }; })(); const FfiConverterTypeSerdeJsonError = new FfiConverterObject( uniffiTypeSerdeJsonErrorObjectFactory ); const FfiConverterTypeSerdeJsonError__as_error = new FfiConverterObjectAsError( "SerdeJsonError", FfiConverterTypeSerdeJsonError ); export interface ReceiverSessionEventLike { toJson(): /*throws*/ string; } /** * @deprecated Use `ReceiverSessionEventLike` instead. */ export type ReceiverSessionEventInterface = ReceiverSessionEventLike; export class ReceiverSessionEvent extends UniffiAbstractObject implements ReceiverSessionEventLike { readonly [uniffiTypeNameSymbol] = "ReceiverSessionEvent"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeReceiverSessionEventObjectFactory.bless(pointer); } static fromJson(json: string): ReceiverSessionEventLike /*throws*/ { return FfiConverterTypeReceiverSessionEvent.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSerdeJsonError__as_error.lift.bind( FfiConverterTypeSerdeJsonError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_constructor_receiversessionevent_from_json( FfiConverterString.lower(json, nativeModule().rustbuffer_alloc), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toJson(): string /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSerdeJsonError__as_error.lift.bind( FfiConverterTypeSerdeJsonError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receiversessionevent_to_json( uniffiTypeReceiverSessionEventObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeReceiverSessionEventObjectFactory.pointer(this); uniffiTypeReceiverSessionEventObjectFactory.freePointer(pointer); uniffiTypeReceiverSessionEventObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ReceiverSessionEvent { return uniffiTypeReceiverSessionEventObjectFactory.isConcreteType(obj_); } } const uniffiTypeReceiverSessionEventObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ReceiverSessionEventLike { const instance = Object.create(ReceiverSessionEvent.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ReceiverSessionEvent"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_receiversessionevent_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ReceiverSessionEventLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ReceiverSessionEventLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_receiversessionevent( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_receiversessionevent( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ReceiverSessionEventLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ReceiverSessionEvent" ); }, }; })(); const FfiConverterTypeReceiverSessionEvent = new FfiConverterObject( uniffiTypeReceiverSessionEventObjectFactory ); /** * Represents the status of a session that can be inferred from the information in the session * event log. */ export interface ReceiverSessionStatusLike {} /** * @deprecated Use `ReceiverSessionStatusLike` instead. */ export type ReceiverSessionStatusInterface = ReceiverSessionStatusLike; /** * Represents the status of a session that can be inferred from the information in the session * event log. */ export class ReceiverSessionStatus extends UniffiAbstractObject implements ReceiverSessionStatusLike { readonly [uniffiTypeNameSymbol] = "ReceiverSessionStatus"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeReceiverSessionStatusObjectFactory.bless(pointer); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeReceiverSessionStatusObjectFactory.pointer(this); uniffiTypeReceiverSessionStatusObjectFactory.freePointer(pointer); uniffiTypeReceiverSessionStatusObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ReceiverSessionStatus { return uniffiTypeReceiverSessionStatusObjectFactory.isConcreteType(obj_); } } const uniffiTypeReceiverSessionStatusObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ReceiverSessionStatusLike { const instance = Object.create(ReceiverSessionStatus.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ReceiverSessionStatus"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_receiversessionstatus_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ReceiverSessionStatusLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ReceiverSessionStatusLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_receiversessionstatus( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_receiversessionstatus( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ReceiverSessionStatusLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ReceiverSessionStatus" ); }, }; })(); const FfiConverterTypeReceiverSessionStatus = new FfiConverterObject( uniffiTypeReceiverSessionStatusObjectFactory ); export interface ReceiverSessionHistoryLike { /** * Fallback transaction from the session if present */ fallbackTx(): ArrayBuffer | undefined; /** * Receiver session Payjoin URI */ pjUri(): PjUriLike; /** * Helper method to query the current status of the session. */ status(): ReceiverSessionStatusLike; } /** * @deprecated Use `ReceiverSessionHistoryLike` instead. */ export type ReceiverSessionHistoryInterface = ReceiverSessionHistoryLike; export class ReceiverSessionHistory extends UniffiAbstractObject implements ReceiverSessionHistoryLike { readonly [uniffiTypeNameSymbol] = "ReceiverSessionHistory"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeReceiverSessionHistoryObjectFactory.bless(pointer); } /** * Fallback transaction from the session if present */ fallbackTx(): ArrayBuffer | undefined { return ((__rb: Uint8Array) => { try { return FfiConverterOptionalBytes.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receiversessionhistory_fallback_tx( uniffiTypeReceiverSessionHistoryObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Receiver session Payjoin URI */ pjUri(): PjUriLike { return FfiConverterTypePjUri.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receiversessionhistory_pj_uri( uniffiTypeReceiverSessionHistoryObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Helper method to query the current status of the session. */ status(): ReceiverSessionStatusLike { return FfiConverterTypeReceiverSessionStatus.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_receiversessionhistory_status( uniffiTypeReceiverSessionHistoryObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeReceiverSessionHistoryObjectFactory.pointer(this); uniffiTypeReceiverSessionHistoryObjectFactory.freePointer(pointer); uniffiTypeReceiverSessionHistoryObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ReceiverSessionHistory { return uniffiTypeReceiverSessionHistoryObjectFactory.isConcreteType(obj_); } } const uniffiTypeReceiverSessionHistoryObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ReceiverSessionHistoryLike { const instance = Object.create(ReceiverSessionHistory.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ReceiverSessionHistory"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_receiversessionhistory_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ReceiverSessionHistoryLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ReceiverSessionHistoryLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_receiversessionhistory( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_receiversessionhistory( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ReceiverSessionHistoryLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ReceiverSessionHistory" ); }, }; })(); const FfiConverterTypeReceiverSessionHistory = new FfiConverterObject( uniffiTypeReceiverSessionHistoryObjectFactory ); export interface ReplayResultLike { sessionHistory(): ReceiverSessionHistoryLike; state(): ReceiveSession; } /** * @deprecated Use `ReplayResultLike` instead. */ export type ReplayResultInterface = ReplayResultLike; export class ReplayResult extends UniffiAbstractObject implements ReplayResultLike { readonly [uniffiTypeNameSymbol] = "ReplayResult"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeReplayResultObjectFactory.bless(pointer); } sessionHistory(): ReceiverSessionHistoryLike { return FfiConverterTypeReceiverSessionHistory.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_replayresult_session_history( uniffiTypeReplayResultObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } state(): ReceiveSession { return ((__rb: Uint8Array) => { try { return FfiConverterTypeReceiveSession.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_replayresult_state( uniffiTypeReplayResultObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeReplayResultObjectFactory.pointer(this); uniffiTypeReplayResultObjectFactory.freePointer(pointer); uniffiTypeReplayResultObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is ReplayResult { return uniffiTypeReplayResultObjectFactory.isConcreteType(obj_); } } const uniffiTypeReplayResultObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): ReplayResultLike { const instance = Object.create(ReplayResult.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "ReplayResult"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_replayresult_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: ReplayResultLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: ReplayResultLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_replayresult( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_replayresult( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is ReplayResultLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ReplayResult" ); }, }; })(); const FfiConverterTypeReplayResult = new FfiConverterObject( uniffiTypeReplayResultObjectFactory ); /** * Builder for sender-side payjoin parameters * * These parameters define how client wants to handle Payjoin. */ export interface SenderBuilderLike { /** * Disable output substitution even if the receiver didn't. * * This forbids receiver switching output or decreasing amount. * It is generally **not** recommended to set this as it may prevent the receiver from * doing advanced operations such as opening LN channels and it also guarantees the * receiver will **not** reward the sender with a discount. */ alwaysDisableOutputSubstitution(): SenderBuilderLike; /** * Perform Payjoin without incentivizing the payee to cooperate. * * While it's generally better to offer some contribution some users may wish not to. * This function disables contribution. */ buildNonIncentivizing( minFeeRateSatPerKwu: bigint ): /*throws*/ InitialSendTransitionLike; buildRecommended( minFeeRateSatPerKwu: bigint ): /*throws*/ InitialSendTransitionLike; /** * Offer the receiver contribution to pay for his input. * * These parameters will allow the receiver to take `max_fee_contribution_sats` from given change * output to pay for additional inputs. The recommended fee is `size_of_one_input * fee_rate`. * * `change_index` specifies which output can be used to pay fee. If `None` is provided, then * the output is auto-detected unless the supplied transaction has more than two outputs. * * `clamp_fee_contribution` decreases fee contribution instead of erroring. * * If this option is true and a transaction with change amount lower than fee * contribution is provided then instead of returning error the fee contribution will * be just lowered in the request to match the change amount. */ buildWithAdditionalFee( maxFeeContributionSats: bigint, changeIndex: number | undefined, minFeeRateSatPerKwu: bigint, clampFeeContribution: boolean ): /*throws*/ InitialSendTransitionLike; } /** * @deprecated Use `SenderBuilderLike` instead. */ export type SenderBuilderInterface = SenderBuilderLike; /** * Builder for sender-side payjoin parameters * * These parameters define how client wants to handle Payjoin. */ export class SenderBuilder extends UniffiAbstractObject implements SenderBuilderLike { readonly [uniffiTypeNameSymbol] = "SenderBuilder"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; /** * Prepare an HTTP request and request context to process the response * * Call [`SenderBuilder::build_recommended()`] or other `build` methods * to create a [`WithReplyKey`] */ constructor(psbt: string, uri: PjUriLike) /*throws*/ { super(); const pointer = uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSenderInputError.lift.bind( FfiConverterTypeSenderInputError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_constructor_senderbuilder_new( FfiConverterString.lower(psbt, nativeModule().rustbuffer_alloc), FfiConverterTypePjUri.lower(uri, nativeModule().rustbuffer_alloc), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSenderBuilderObjectFactory.bless(pointer); } /** * Disable output substitution even if the receiver didn't. * * This forbids receiver switching output or decreasing amount. * It is generally **not** recommended to set this as it may prevent the receiver from * doing advanced operations such as opening LN channels and it also guarantees the * receiver will **not** reward the sender with a discount. */ alwaysDisableOutputSubstitution(): SenderBuilderLike { return FfiConverterTypeSenderBuilder.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_senderbuilder_always_disable_output_substitution( uniffiTypeSenderBuilderObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Perform Payjoin without incentivizing the payee to cooperate. * * While it's generally better to offer some contribution some users may wish not to. * This function disables contribution. */ buildNonIncentivizing( minFeeRateSatPerKwu: bigint ): InitialSendTransitionLike /*throws*/ { return FfiConverterTypeInitialSendTransition.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSenderInputError.lift.bind( FfiConverterTypeSenderInputError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_senderbuilder_build_non_incentivizing( uniffiTypeSenderBuilderObjectFactory.clonePointer(this), FfiConverterUInt64.lower( minFeeRateSatPerKwu, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } buildRecommended( minFeeRateSatPerKwu: bigint ): InitialSendTransitionLike /*throws*/ { return FfiConverterTypeInitialSendTransition.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSenderInputError.lift.bind( FfiConverterTypeSenderInputError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_senderbuilder_build_recommended( uniffiTypeSenderBuilderObjectFactory.clonePointer(this), FfiConverterUInt64.lower( minFeeRateSatPerKwu, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Offer the receiver contribution to pay for his input. * * These parameters will allow the receiver to take `max_fee_contribution_sats` from given change * output to pay for additional inputs. The recommended fee is `size_of_one_input * fee_rate`. * * `change_index` specifies which output can be used to pay fee. If `None` is provided, then * the output is auto-detected unless the supplied transaction has more than two outputs. * * `clamp_fee_contribution` decreases fee contribution instead of erroring. * * If this option is true and a transaction with change amount lower than fee * contribution is provided then instead of returning error the fee contribution will * be just lowered in the request to match the change amount. */ buildWithAdditionalFee( maxFeeContributionSats: bigint, changeIndex: number | undefined, minFeeRateSatPerKwu: bigint, clampFeeContribution: boolean ): InitialSendTransitionLike /*throws*/ { return FfiConverterTypeInitialSendTransition.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSenderInputError.lift.bind( FfiConverterTypeSenderInputError ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_senderbuilder_build_with_additional_fee( uniffiTypeSenderBuilderObjectFactory.clonePointer(this), FfiConverterUInt64.lower( maxFeeContributionSats, nativeModule().rustbuffer_alloc ), FfiConverterOptionalUInt8.lower( changeIndex, nativeModule().rustbuffer_alloc ), FfiConverterUInt64.lower( minFeeRateSatPerKwu, nativeModule().rustbuffer_alloc ), FfiConverterBool.lower( clampFeeContribution, nativeModule().rustbuffer_alloc ), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSenderBuilderObjectFactory.pointer(this); uniffiTypeSenderBuilderObjectFactory.freePointer(pointer); uniffiTypeSenderBuilderObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is SenderBuilder { return uniffiTypeSenderBuilderObjectFactory.isConcreteType(obj_); } } const uniffiTypeSenderBuilderObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): SenderBuilderLike { const instance = Object.create(SenderBuilder.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "SenderBuilder"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_senderbuilder_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: SenderBuilderLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: SenderBuilderLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_senderbuilder( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_senderbuilder( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is SenderBuilderLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SenderBuilder" ); }, }; })(); const FfiConverterTypeSenderBuilder = new FfiConverterObject( uniffiTypeSenderBuilderObjectFactory ); /** * Error that may occur when the sender session event log is replayed */ export interface SenderReplayErrorLike { /** * Returns `true` if the event log could not be replayed because the * session has expired. */ isExpired(): boolean; } /** * @deprecated Use `SenderReplayErrorLike` instead. */ export type SenderReplayErrorInterface = SenderReplayErrorLike; /** * Error that may occur when the sender session event log is replayed */ export class SenderReplayError extends UniffiAbstractObject implements SenderReplayErrorLike { readonly [uniffiTypeNameSymbol] = "SenderReplayError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSenderReplayErrorObjectFactory.bless(pointer); } /** * Returns `true` if the event log could not be replayed because the * session has expired. */ isExpired(): boolean { return FfiConverterBool.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_senderreplayerror_is_expired( uniffiTypeSenderReplayErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_senderreplayerror_uniffi_trait_display( uniffiTypeSenderReplayErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_senderreplayerror_uniffi_trait_debug( uniffiTypeSenderReplayErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSenderReplayErrorObjectFactory.pointer(this); uniffiTypeSenderReplayErrorObjectFactory.freePointer(pointer); uniffiTypeSenderReplayErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is SenderReplayError { return uniffiTypeSenderReplayErrorObjectFactory.isConcreteType(obj_); } static hasInner(obj_: any): obj_ is UniffiThrownObject { return ( UniffiThrownObject.instanceOf(obj_) && SenderReplayError.instanceOf(obj_.inner) ); } static getInner( err: UniffiThrownObject ): SenderReplayError { return err.inner; } } const uniffiTypeSenderReplayErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): SenderReplayErrorLike { const instance = Object.create(SenderReplayError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "SenderReplayError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_senderreplayerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: SenderReplayErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: SenderReplayErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_senderreplayerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_senderreplayerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is SenderReplayErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SenderReplayError" ); }, }; })(); const FfiConverterTypeSenderReplayError = new FfiConverterObject( uniffiTypeSenderReplayErrorObjectFactory ); const FfiConverterTypeSenderReplayError__as_error = new FfiConverterObjectAsError( "SenderReplayError", FfiConverterTypeSenderReplayError ); /** * Represents the status of a session that can be inferred from the information in the session * event log. */ export interface SenderSessionStatusLike {} /** * @deprecated Use `SenderSessionStatusLike` instead. */ export type SenderSessionStatusInterface = SenderSessionStatusLike; /** * Represents the status of a session that can be inferred from the information in the session * event log. */ export class SenderSessionStatus extends UniffiAbstractObject implements SenderSessionStatusLike { readonly [uniffiTypeNameSymbol] = "SenderSessionStatus"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSenderSessionStatusObjectFactory.bless(pointer); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSenderSessionStatusObjectFactory.pointer(this); uniffiTypeSenderSessionStatusObjectFactory.freePointer(pointer); uniffiTypeSenderSessionStatusObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is SenderSessionStatus { return uniffiTypeSenderSessionStatusObjectFactory.isConcreteType(obj_); } } const uniffiTypeSenderSessionStatusObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): SenderSessionStatusLike { const instance = Object.create(SenderSessionStatus.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "SenderSessionStatus"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_sendersessionstatus_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: SenderSessionStatusLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: SenderSessionStatusLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_sendersessionstatus( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_sendersessionstatus( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is SenderSessionStatusLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SenderSessionStatus" ); }, }; })(); const FfiConverterTypeSenderSessionStatus = new FfiConverterObject( uniffiTypeSenderSessionStatusObjectFactory ); export interface SenderSessionHistoryLike { /** * Fallback transaction from the session if present */ fallbackTx(): ArrayBuffer; pjParam(): PjParamLike; status(): SenderSessionStatusLike; } /** * @deprecated Use `SenderSessionHistoryLike` instead. */ export type SenderSessionHistoryInterface = SenderSessionHistoryLike; export class SenderSessionHistory extends UniffiAbstractObject implements SenderSessionHistoryLike { readonly [uniffiTypeNameSymbol] = "SenderSessionHistory"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSenderSessionHistoryObjectFactory.bless(pointer); } /** * Fallback transaction from the session if present */ fallbackTx(): ArrayBuffer { return ((__rb: Uint8Array) => { try { return FfiConverterArrayBuffer.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_sendersessionhistory_fallback_tx( uniffiTypeSenderSessionHistoryObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } pjParam(): PjParamLike { return FfiConverterTypePjParam.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_sendersessionhistory_pj_param( uniffiTypeSenderSessionHistoryObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } status(): SenderSessionStatusLike { return FfiConverterTypeSenderSessionStatus.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_sendersessionhistory_status( uniffiTypeSenderSessionHistoryObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSenderSessionHistoryObjectFactory.pointer(this); uniffiTypeSenderSessionHistoryObjectFactory.freePointer(pointer); uniffiTypeSenderSessionHistoryObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is SenderSessionHistory { return uniffiTypeSenderSessionHistoryObjectFactory.isConcreteType(obj_); } } const uniffiTypeSenderSessionHistoryObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): SenderSessionHistoryLike { const instance = Object.create(SenderSessionHistory.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "SenderSessionHistory"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_sendersessionhistory_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: SenderSessionHistoryLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: SenderSessionHistoryLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_sendersessionhistory( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_sendersessionhistory( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is SenderSessionHistoryLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SenderSessionHistory" ); }, }; })(); const FfiConverterTypeSenderSessionHistory = new FfiConverterObject( uniffiTypeSenderSessionHistoryObjectFactory ); export interface SenderReplayResultLike { sessionHistory(): SenderSessionHistoryLike; state(): SendSession; } /** * @deprecated Use `SenderReplayResultLike` instead. */ export type SenderReplayResultInterface = SenderReplayResultLike; export class SenderReplayResult extends UniffiAbstractObject implements SenderReplayResultLike { readonly [uniffiTypeNameSymbol] = "SenderReplayResult"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSenderReplayResultObjectFactory.bless(pointer); } sessionHistory(): SenderSessionHistoryLike { return FfiConverterTypeSenderSessionHistory.lift( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_senderreplayresult_session_history( uniffiTypeSenderReplayResultObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } state(): SendSession { return ((__rb: Uint8Array) => { try { return FfiConverterTypeSendSession.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_senderreplayresult_state( uniffiTypeSenderReplayResultObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSenderReplayResultObjectFactory.pointer(this); uniffiTypeSenderReplayResultObjectFactory.freePointer(pointer); uniffiTypeSenderReplayResultObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is SenderReplayResult { return uniffiTypeSenderReplayResultObjectFactory.isConcreteType(obj_); } } const uniffiTypeSenderReplayResultObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): SenderReplayResultLike { const instance = Object.create(SenderReplayResult.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "SenderReplayResult"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_senderreplayresult_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: SenderReplayResultLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: SenderReplayResultLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_senderreplayresult( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_senderreplayresult( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is SenderReplayResultLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SenderReplayResult" ); }, }; })(); const FfiConverterTypeSenderReplayResult = new FfiConverterObject( uniffiTypeSenderReplayResultObjectFactory ); export interface SenderSessionEventLike { toJson(): /*throws*/ string; } /** * @deprecated Use `SenderSessionEventLike` instead. */ export type SenderSessionEventInterface = SenderSessionEventLike; export class SenderSessionEvent extends UniffiAbstractObject implements SenderSessionEventLike { readonly [uniffiTypeNameSymbol] = "SenderSessionEvent"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSenderSessionEventObjectFactory.bless(pointer); } static fromJson(json: string): SenderSessionEventLike /*throws*/ { return FfiConverterTypeSenderSessionEvent.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSerdeJsonError__as_error.lift.bind( FfiConverterTypeSerdeJsonError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_constructor_sendersessionevent_from_json( FfiConverterString.lower(json, nativeModule().rustbuffer_alloc), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toJson(): string /*throws*/ { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeSerdeJsonError__as_error.lift.bind( FfiConverterTypeSerdeJsonError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_sendersessionevent_to_json( uniffiTypeSenderSessionEventObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSenderSessionEventObjectFactory.pointer(this); uniffiTypeSenderSessionEventObjectFactory.freePointer(pointer); uniffiTypeSenderSessionEventObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is SenderSessionEvent { return uniffiTypeSenderSessionEventObjectFactory.isConcreteType(obj_); } } const uniffiTypeSenderSessionEventObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): SenderSessionEventLike { const instance = Object.create(SenderSessionEvent.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "SenderSessionEvent"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_sendersessionevent_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: SenderSessionEventLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: SenderSessionEventLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_sendersessionevent( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_sendersessionevent( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is SenderSessionEventLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SenderSessionEvent" ); }, }; })(); const FfiConverterTypeSenderSessionEvent = new FfiConverterObject( uniffiTypeSenderSessionEventObjectFactory ); /** * Error that may occur during a v2 session typestate change */ export interface SessionErrorLike {} /** * @deprecated Use `SessionErrorLike` instead. */ export type SessionErrorInterface = SessionErrorLike; /** * Error that may occur during a v2 session typestate change */ export class SessionError extends UniffiAbstractObject implements SessionErrorLike { readonly [uniffiTypeNameSymbol] = "SessionError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeSessionErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_sessionerror_uniffi_trait_display( uniffiTypeSessionErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_sessionerror_uniffi_trait_debug( uniffiTypeSessionErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeSessionErrorObjectFactory.pointer(this); uniffiTypeSessionErrorObjectFactory.freePointer(pointer); uniffiTypeSessionErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is SessionError { return uniffiTypeSessionErrorObjectFactory.isConcreteType(obj_); } } const uniffiTypeSessionErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): SessionErrorLike { const instance = Object.create(SessionError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "SessionError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_sessionerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: SessionErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: SessionErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_sessionerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_sessionerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is SessionErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SessionError" ); }, }; })(); const FfiConverterTypeSessionError = new FfiConverterObject( uniffiTypeSessionErrorObjectFactory ); export interface UriLike { address(): string; /** * Gets the amount in satoshis. */ amountSats(): bigint | undefined; asString(): string; checkPjSupported(): /*throws*/ PjUriLike; label(): string | undefined; message(): string | undefined; } /** * @deprecated Use `UriLike` instead. */ export type UriInterface = UriLike; export class Uri extends UniffiAbstractObject implements UriLike { readonly [uniffiTypeNameSymbol] = "Uri"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeUriObjectFactory.bless(pointer); } static parse(uri: string): UriLike /*throws*/ { return FfiConverterTypeUri.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeUriParseError__as_error.lift.bind( FfiConverterTypeUriParseError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_constructor_uri_parse( FfiConverterString.lower(uri, nativeModule().rustbuffer_alloc), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } address(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_uri_address( uniffiTypeUriObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } /** * Gets the amount in satoshis. */ amountSats(): bigint | undefined { return ((__rb: Uint8Array) => { try { return FfiConverterOptionalUInt64.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_uri_amount_sats( uniffiTypeUriObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } asString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_uri_as_string( uniffiTypeUriObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } checkPjSupported(): PjUriLike /*throws*/ { return FfiConverterTypePjUri.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypePjNotSupported__as_error.lift.bind( FfiConverterTypePjNotSupported__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_uri_check_pj_supported( uniffiTypeUriObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } label(): string | undefined { return ((__rb: Uint8Array) => { try { return FfiConverterOptionalString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_uri_label( uniffiTypeUriObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } message(): string | undefined { return ((__rb: Uint8Array) => { try { return FfiConverterOptionalString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_uri_message( uniffiTypeUriObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeUriObjectFactory.pointer(this); uniffiTypeUriObjectFactory.freePointer(pointer); uniffiTypeUriObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is Uri { return uniffiTypeUriObjectFactory.isConcreteType(obj_); } } const uniffiTypeUriObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): UriLike { const instance = Object.create(Uri.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "Uri"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_uri_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: UriLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: UriLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_uri( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_uri( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is UriLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "Uri" ); }, }; })(); const FfiConverterTypeUri = new FfiConverterObject(uniffiTypeUriObjectFactory); export interface UriParseErrorLike {} /** * @deprecated Use `UriParseErrorLike` instead. */ export type UriParseErrorInterface = UriParseErrorLike; export class UriParseError extends UniffiAbstractObject implements UriParseErrorLike { readonly [uniffiTypeNameSymbol] = "UriParseError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeUriParseErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_uriparseerror_uniffi_trait_display( uniffiTypeUriParseErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_uriparseerror_uniffi_trait_debug( uniffiTypeUriParseErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeUriParseErrorObjectFactory.pointer(this); uniffiTypeUriParseErrorObjectFactory.freePointer(pointer); uniffiTypeUriParseErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is UriParseError { return uniffiTypeUriParseErrorObjectFactory.isConcreteType(obj_); } static hasInner(obj_: any): obj_ is UniffiThrownObject { return ( UniffiThrownObject.instanceOf(obj_) && UriParseError.instanceOf(obj_.inner) ); } static getInner(err: UniffiThrownObject): UriParseError { return err.inner; } } const uniffiTypeUriParseErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): UriParseErrorLike { const instance = Object.create(UriParseError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "UriParseError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_uriparseerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: UriParseErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: UriParseErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_uriparseerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_uriparseerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is UriParseErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "UriParseError" ); }, }; })(); const FfiConverterTypeUriParseError = new FfiConverterObject( uniffiTypeUriParseErrorObjectFactory ); const FfiConverterTypeUriParseError__as_error = new FfiConverterObjectAsError( "UriParseError", FfiConverterTypeUriParseError ); export interface UrlLike { asString(): string; query(): string | undefined; } /** * @deprecated Use `UrlLike` instead. */ export type UrlInterface = UrlLike; export class Url extends UniffiAbstractObject implements UrlLike { readonly [uniffiTypeNameSymbol] = "Url"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeUrlObjectFactory.bless(pointer); } static parse(input: string): UrlLike /*throws*/ { return FfiConverterTypeUrl.lift( uniffiCaller.rustCallWithError( /*liftError:*/ FfiConverterTypeUrlParseError__as_error.lift.bind( FfiConverterTypeUrlParseError__as_error ), /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_constructor_url_parse( FfiConverterString.lower(input, nativeModule().rustbuffer_alloc), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } asString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_url_as_string( uniffiTypeUrlObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } query(): string | undefined { return ((__rb: Uint8Array) => { try { return FfiConverterOptionalString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_url_query( uniffiTypeUrlObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeUrlObjectFactory.pointer(this); uniffiTypeUrlObjectFactory.freePointer(pointer); uniffiTypeUrlObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is Url { return uniffiTypeUrlObjectFactory.isConcreteType(obj_); } } const uniffiTypeUrlObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): UrlLike { const instance = Object.create(Url.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "Url"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_url_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: UrlLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: UrlLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_url( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_url( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is UrlLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "Url" ); }, }; })(); const FfiConverterTypeUrl = new FfiConverterObject(uniffiTypeUrlObjectFactory); export interface UrlParseErrorLike {} /** * @deprecated Use `UrlParseErrorLike` instead. */ export type UrlParseErrorInterface = UrlParseErrorLike; export class UrlParseError extends UniffiAbstractObject implements UrlParseErrorLike { readonly [uniffiTypeNameSymbol] = "UrlParseError"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; // No primary constructor declared for this class. private constructor(pointer: UniffiHandle) { super(); this[pointerLiteralSymbol] = pointer; this[destructorGuardSymbol] = uniffiTypeUrlParseErrorObjectFactory.bless(pointer); } toString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_urlparseerror_uniffi_trait_display( uniffiTypeUrlParseErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } toDebugString(): string { return ((__rb: Uint8Array) => { try { return FfiConverterString.lift(__rb); } finally { nativeModule().rustbuffer_free(__rb); } })( uniffiCaller.rustCall( /*caller:*/ (callStatus) => { return nativeModule().ubrn_uniffi_payjoin_ffi_fn_method_urlparseerror_uniffi_trait_debug( uniffiTypeUrlParseErrorObjectFactory.clonePointer(this), callStatus ); }, /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString) ) ); } uniffiDestroy(): void { const ptr = (this as any)[destructorGuardSymbol]; if (ptr !== undefined) { const pointer = uniffiTypeUrlParseErrorObjectFactory.pointer(this); uniffiTypeUrlParseErrorObjectFactory.freePointer(pointer); uniffiTypeUrlParseErrorObjectFactory.unbless(ptr); delete (this as any)[destructorGuardSymbol]; } } static instanceOf(obj_: any): obj_ is UrlParseError { return uniffiTypeUrlParseErrorObjectFactory.isConcreteType(obj_); } static hasInner(obj_: any): obj_ is UniffiThrownObject { return ( UniffiThrownObject.instanceOf(obj_) && UrlParseError.instanceOf(obj_.inner) ); } static getInner(err: UniffiThrownObject): UrlParseError { return err.inner; } } const uniffiTypeUrlParseErrorObjectFactory: UniffiObjectFactory = (() => { return { create(pointer: UniffiHandle): UrlParseErrorLike { const instance = Object.create(UrlParseError.prototype); instance[pointerLiteralSymbol] = pointer; instance[destructorGuardSymbol] = this.bless(pointer); instance[uniffiTypeNameSymbol] = "UrlParseError"; return instance; }, bless(p: UniffiHandle): UniffiGcObject { return uniffiCaller.rustCall( /*caller:*/ (status) => nativeModule().ubrn_uniffi_internal_fn_method_urlparseerror_ffi__bless_pointer( p, status ), /*liftString:*/ FfiConverterString.lift ); }, unbless(ptr_: UniffiGcObject) { ptr_.markDestroyed(); }, pointer(obj_: UrlParseErrorLike): UniffiHandle { if ((obj_ as any)[destructorGuardSymbol] === undefined) { throw new UniffiInternalError.UnexpectedNullPointer(); } return (obj_ as any)[pointerLiteralSymbol]; }, clonePointer(obj_: UrlParseErrorLike): UniffiHandle { const pointer = this.pointer(obj_); return uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_clone_urlparseerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, freePointer(pointer: UniffiHandle): void { uniffiCaller.rustCall( /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_payjoin_ffi_fn_free_urlparseerror( pointer, callStatus ), /*liftString:*/ FfiConverterString.lift ); }, isConcreteType(obj_: any): obj_ is UrlParseErrorLike { return ( obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "UrlParseError" ); }, }; })(); const FfiConverterTypeUrlParseError = new FfiConverterObject( uniffiTypeUrlParseErrorObjectFactory ); const FfiConverterTypeUrlParseError__as_error = new FfiConverterObjectAsError( "UrlParseError", FfiConverterTypeUrlParseError ); // FfiConverter for TxOut | undefined const FfiConverterOptionalTypeTxOut = new FfiConverterOptional( FfiConverterTypeTxOut ); // FfiConverter for ArrayBuffer | undefined const FfiConverterOptionalBytes = new FfiConverterOptional( FfiConverterArrayBuffer ); // FfiConverter for Array const FfiConverterSequenceBytes = new FfiConverterArray( FfiConverterArrayBuffer ); // FfiConverter for Array const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString); // FfiConverter for ReceiverPendingFallbackLike | undefined const FfiConverterOptionalTypeReceiverPendingFallback = new FfiConverterOptional(FfiConverterTypeReceiverPendingFallback); // FfiConverter for bigint | undefined const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64); // FfiConverter for Array const FfiConverterSequenceTypeInputPair = new FfiConverterArray( FfiConverterTypeInputPair ); // FfiConverter for Array const FfiConverterSequenceTypeTxOut = new FfiConverterArray( FfiConverterTypeTxOut ); // FfiConverter for string | undefined const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString); // FfiConverter for number | undefined const FfiConverterOptionalUInt8 = new FfiConverterOptional(FfiConverterUInt8); // FfiConverter for Weight | undefined const FfiConverterOptionalTypeWeight = new FfiConverterOptional( FfiConverterTypeWeight ); /** * 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 = 30; // Get the scaffolding contract version by calling the into the dylib const scaffoldingContractVersion = nativeModule().ubrn_ffi_payjoin_ffi_uniffi_contract_version(); if (bindingsContractVersion !== scaffoldingContractVersion) { throw new UniffiInternalError.ContractVersionMismatch( scaffoldingContractVersion, bindingsContractVersion ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_func_fetch_ohttp_keys() !== 38113 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_func_fetch_ohttp_keys" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_func_merge_finalized_proposal_inputs() !== 47822 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_func_merge_finalized_proposal_inputs" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_func_receiver_manual_contribute() !== 1898 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_func_receiver_manual_contribute" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_func_receiver_manual_finalize() !== 39445 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_func_receiver_manual_finalize" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_func_replay_receiver_event_log() !== 13704 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_func_replay_receiver_event_log" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_func_replay_receiver_event_log_async() !== 48438 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_func_replay_receiver_event_log_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_func_replay_sender_event_log() !== 61032 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_func_replay_sender_event_log" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_func_replay_sender_event_log_async() !== 16245 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_func_replay_sender_event_log_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_assumeinteractivetransition_save() !== 44208 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_assumeinteractivetransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_assumeinteractivetransition_save_async() !== 26091 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_assumeinteractivetransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_broadcastedtransition_save() !== 39673 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_broadcastedtransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_broadcastedtransition_save_async() !== 59857 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_broadcastedtransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_canbroadcast_callback() !== 1676 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_canbroadcast_callback" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_canceltransition_save() !== 50170 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_canceltransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_canceltransition_save_async() !== 38955 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_canceltransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_createrequesterror_is_expired() !== 56422 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_createrequesterror_is_expired" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_hasreplyableerror_cancel() !== 59108 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_hasreplyableerror_cancel" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_hasreplyableerror_create_error_request() !== 5940 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_hasreplyableerror_create_error_request" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_hasreplyableerror_process_error_response() !== 53341 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_hasreplyableerror_process_error_response" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_hasreplyableerrortransition_save() !== 26653 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_hasreplyableerrortransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_hasreplyableerrortransition_save_async() !== 37566 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_hasreplyableerrortransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_initialreceivetransition_save() !== 3384 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_initialreceivetransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_initialreceivetransition_save_async() !== 42909 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_initialreceivetransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_initialsendtransition_save() !== 42292 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_initialsendtransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_initialsendtransition_save_async() !== 4981 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_initialsendtransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_initialized_cancel() !== 27198 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_initialized_cancel" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_initialized_create_poll_request() !== 17891 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_initialized_create_poll_request" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_initialized_pj_uri() !== 53430 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_initialized_pj_uri" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_initialized_process_response() !== 13436 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_initialized_process_response" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_initializedtransition_save() !== 48548 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_initializedtransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_initializedtransition_save_async() !== 63235 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_initializedtransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_constructor_inputpair_new() !== 8855 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_constructor_inputpair_new" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_inputpair_outpoint() !== 5536 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_inputpair_outpoint" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_isinputowned_callback() !== 48701 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_isinputowned_callback" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_isoutputknown_callback() !== 838 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_isoutputknown_callback" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_isscriptowned_callback() !== 21846 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_isscriptowned_callback" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_jsonreceiversessionpersister_save() !== 45832 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_jsonreceiversessionpersister_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_jsonreceiversessionpersister_load() !== 50793 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_jsonreceiversessionpersister_load" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_jsonreceiversessionpersister_close() !== 14292 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_jsonreceiversessionpersister_close" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_jsonreceiversessionpersisterasync_save() !== 748 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_jsonreceiversessionpersisterasync_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_jsonreceiversessionpersisterasync_load() !== 48869 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_jsonreceiversessionpersisterasync_load" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_jsonreceiversessionpersisterasync_close() !== 3309 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_jsonreceiversessionpersisterasync_close" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_jsonsendersessionpersister_save() !== 10109 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_jsonsendersessionpersister_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_jsonsendersessionpersister_load() !== 18359 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_jsonsendersessionpersister_load" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_jsonsendersessionpersister_close() !== 51169 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_jsonsendersessionpersister_close" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_jsonsendersessionpersisterasync_save() !== 44188 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_jsonsendersessionpersisterasync_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_jsonsendersessionpersisterasync_load() !== 1649 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_jsonsendersessionpersisterasync_load" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_jsonsendersessionpersisterasync_close() !== 26625 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_jsonsendersessionpersisterasync_close" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_maybeinputsowned_cancel() !== 58055 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_maybeinputsowned_cancel" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_maybeinputsowned_check_inputs_not_owned() !== 11733 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_maybeinputsowned_check_inputs_not_owned" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_maybeinputsowned_extract_tx_to_schedule_broadcast() !== 5064 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_maybeinputsowned_extract_tx_to_schedule_broadcast" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_maybeinputsowned_proposal_txid_is_stable() !== 26719 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_maybeinputsowned_proposal_txid_is_stable" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_maybeinputsownedtransition_save() !== 2972 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_maybeinputsownedtransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_maybeinputsownedtransition_save_async() !== 65300 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_maybeinputsownedtransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_maybeinputsseen_cancel() !== 63747 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_maybeinputsseen_cancel" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_maybeinputsseen_check_no_inputs_seen_before() !== 4705 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_maybeinputsseen_check_no_inputs_seen_before" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_maybeinputsseen_proposal_txid_is_stable() !== 32136 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_maybeinputsseen_proposal_txid_is_stable" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_maybeinputsseentransition_save() !== 21571 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_maybeinputsseentransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_maybeinputsseentransition_save_async() !== 12181 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_maybeinputsseentransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_monitor_cancel() !== 36218 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_monitor_cancel" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_monitor_check_for_transaction() !== 2134 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_monitor_check_for_transaction" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_monitor_proposal_txid_is_stable() !== 33839 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_monitor_proposal_txid_is_stable" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_monitortransition_save() !== 12399 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_monitortransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_monitortransition_save_async() !== 62477 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_monitortransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_constructor_ohttpkeys_decode() !== 15251 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_constructor_ohttpkeys_decode" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_outputsunknown_cancel() !== 23477 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_outputsunknown_cancel" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_outputsunknown_identify_receiver_outputs() !== 1009 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_outputsunknown_identify_receiver_outputs" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_outputsunknown_proposal_txid_is_stable() !== 11343 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_outputsunknown_proposal_txid_is_stable" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_outputsunknowntransition_save() !== 19193 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_outputsunknowntransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_outputsunknowntransition_save_async() !== 2791 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_outputsunknowntransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_payjoinproposal_cancel() !== 26165 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_payjoinproposal_cancel" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_payjoinproposal_create_post_request() !== 35676 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_payjoinproposal_create_post_request" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_payjoinproposal_process_response() !== 37469 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_payjoinproposal_process_response" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_payjoinproposal_proposal_txid_is_stable() !== 52353 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_payjoinproposal_proposal_txid_is_stable" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_payjoinproposal_psbt() !== 21821 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_payjoinproposal_psbt" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_payjoinproposaltransition_save() !== 27143 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_payjoinproposaltransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_payjoinproposaltransition_save_async() !== 39796 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_payjoinproposaltransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_pendingfallbacktransition_save() !== 39178 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_pendingfallbacktransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_pendingfallbacktransition_save_async() !== 64579 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_pendingfallbacktransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_pjparam_receiver_pubkey() !== 53277 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_pjparam_receiver_pubkey" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_pjuri_address() !== 27219 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_pjuri_address" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_pjuri_amount_sats() !== 8108 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_pjuri_amount_sats" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_pjuri_as_string() !== 64511 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_pjuri_as_string" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_pjuri_pj_endpoint() !== 31776 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_pjuri_pj_endpoint" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_pjuri_set_amount_sats() !== 1859 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_pjuri_set_amount_sats" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_pollingforproposal_cancel() !== 47741 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_pollingforproposal_cancel" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_pollingforproposal_create_poll_request() !== 32643 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_pollingforproposal_create_poll_request" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_pollingforproposal_process_response() !== 20754 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_pollingforproposal_process_response" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_pollingforproposaltransition_save() !== 27667 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_pollingforproposaltransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_pollingforproposaltransition_save_async() !== 15565 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_pollingforproposaltransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_processpsbt_callback() !== 48978 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_processpsbt_callback" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_provisionalproposal_cancel() !== 7280 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_provisionalproposal_cancel" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_provisionalproposal_finalize_proposal() !== 61267 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_provisionalproposal_finalize_proposal" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_provisionalproposal_proposal_txid_is_stable() !== 42703 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_provisionalproposal_proposal_txid_is_stable" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_provisionalproposal_psbt_to_sign() !== 27438 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_provisionalproposal_psbt_to_sign" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_provisionalproposaltransition_save() !== 18164 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_provisionalproposaltransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_provisionalproposaltransition_save_async() !== 12995 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_provisionalproposaltransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_constructor_receiverbuilder_new() !== 10505 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_constructor_receiverbuilder_new" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_receiverbuilder_build() !== 13647 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_receiverbuilder_build" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_receiverbuilder_with_amount() !== 2870 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_receiverbuilder_with_amount" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_receiverbuilder_with_expiration() !== 29274 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_receiverbuilder_with_expiration" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_receiverbuilder_with_max_fee_rate() !== 58514 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_receiverbuilder_with_max_fee_rate" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_receivercreaterequesterror_is_expired() !== 38729 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_receivercreaterequesterror_is_expired" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_receiverpendingfallback_close() !== 60419 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_receiverpendingfallback_close" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_receiverpendingfallback_fallback_tx() !== 49510 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_receiverpendingfallback_fallback_tx" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_receiverreplayerror_is_expired() !== 4741 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_receiverreplayerror_is_expired" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_constructor_receiversessionevent_from_json() !== 14154 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_constructor_receiversessionevent_from_json" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_receiversessionevent_to_json() !== 41076 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_receiversessionevent_to_json" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_receiversessionhistory_fallback_tx() !== 34756 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_receiversessionhistory_fallback_tx" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_receiversessionhistory_pj_uri() !== 57310 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_receiversessionhistory_pj_uri" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_receiversessionhistory_status() !== 10385 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_receiversessionhistory_status" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_replayresult_session_history() !== 55491 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_replayresult_session_history" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_replayresult_state() !== 2251 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_replayresult_state" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_constructor_senderbuilder_new() !== 52547 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_constructor_senderbuilder_new" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_senderbuilder_always_disable_output_substitution() !== 28346 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_senderbuilder_always_disable_output_substitution" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_senderbuilder_build_non_incentivizing() !== 42680 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_senderbuilder_build_non_incentivizing" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_senderbuilder_build_recommended() !== 13866 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_senderbuilder_build_recommended" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_senderbuilder_build_with_additional_fee() !== 28445 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_senderbuilder_build_with_additional_fee" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_sendercanceltransition_save() !== 1529 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_sendercanceltransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_sendercanceltransition_save_async() !== 31225 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_sendercanceltransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_senderpendingfallback_close() !== 21623 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_senderpendingfallback_close" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_senderpendingfallback_fallback_tx() !== 22130 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_senderpendingfallback_fallback_tx" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_senderreplayerror_is_expired() !== 44935 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_senderreplayerror_is_expired" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_senderreplayresult_session_history() !== 16038 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_senderreplayresult_session_history" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_senderreplayresult_state() !== 58633 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_senderreplayresult_state" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_constructor_sendersessionevent_from_json() !== 23826 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_constructor_sendersessionevent_from_json" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_sendersessionevent_to_json() !== 35461 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_sendersessionevent_to_json" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_sendersessionhistory_fallback_tx() !== 59565 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_sendersessionhistory_fallback_tx" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_sendersessionhistory_pj_param() !== 39510 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_sendersessionhistory_pj_param" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_sendersessionhistory_status() !== 51514 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_sendersessionhistory_status" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_sendersessionoutcome_is_aborted() !== 55376 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_sendersessionoutcome_is_aborted" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_sendersessionoutcome_is_success() !== 61877 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_sendersessionoutcome_is_success" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_sendersessionoutcome_success_psbt_base64() !== 40315 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_sendersessionoutcome_success_psbt_base64" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_transactionfinder_callback() !== 45586 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_transactionfinder_callback" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_uncheckedoriginalpayload_assume_interactive_receiver() !== 52130 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_uncheckedoriginalpayload_assume_interactive_receiver" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_uncheckedoriginalpayload_cancel() !== 52737 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_uncheckedoriginalpayload_cancel" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_uncheckedoriginalpayload_check_broadcast_suitability() !== 57068 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_uncheckedoriginalpayload_check_broadcast_suitability" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_uncheckedoriginalpayloadtransition_save() !== 32663 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_uncheckedoriginalpayloadtransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_uncheckedoriginalpayloadtransition_save_async() !== 22782 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_uncheckedoriginalpayloadtransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_constructor_uri_parse() !== 39444 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_constructor_uri_parse" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_uri_address() !== 34358 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_uri_address" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_uri_amount_sats() !== 62466 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_uri_amount_sats" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_uri_as_string() !== 46511 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_uri_as_string" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_uri_check_pj_supported() !== 12792 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_uri_check_pj_supported" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_uri_label() !== 39648 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_uri_label" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_uri_message() !== 20241 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_uri_message" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_constructor_url_parse() !== 51375 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_constructor_url_parse" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_url_as_string() !== 33295 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_url_as_string" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_url_query() !== 23414 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_url_query" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_v1context_process_response() !== 58909 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_v1context_process_response" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsfeerange_apply_fee_range() !== 6849 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsfeerange_apply_fee_range" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsfeerange_cancel() !== 18205 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsfeerange_cancel" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsfeerange_proposal_txid_is_stable() !== 479 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsfeerange_proposal_txid_is_stable" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsfeerangetransition_save() !== 12620 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsfeerangetransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsfeerangetransition_save_async() !== 2420 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsfeerangetransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsinputs_cancel() !== 57208 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsinputs_cancel" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsinputs_commit_inputs() !== 52622 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsinputs_commit_inputs" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsinputs_contribute_inputs() !== 46287 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsinputs_contribute_inputs" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsinputs_proposal_txid_is_stable() !== 11272 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsinputs_proposal_txid_is_stable" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsinputs_try_preserving_privacy() !== 21242 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsinputs_try_preserving_privacy" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsinputstransition_save() !== 16591 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsinputstransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsinputstransition_save_async() !== 62094 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsinputstransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsoutputs_cancel() !== 2210 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsoutputs_cancel" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsoutputs_commit_outputs() !== 49982 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsoutputs_commit_outputs" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsoutputs_output_substitution() !== 16818 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsoutputs_output_substitution" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsoutputs_proposal_txid_is_stable() !== 65365 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsoutputs_proposal_txid_is_stable" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsoutputs_replace_receiver_outputs() !== 58770 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsoutputs_replace_receiver_outputs" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsoutputs_substitute_receiver_script() !== 39117 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsoutputs_substitute_receiver_script" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsoutputstransition_save() !== 24589 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsoutputstransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wantsoutputstransition_save_async() !== 24599 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wantsoutputstransition_save_async" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_wellknownerror_code() !== 42919 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_wellknownerror_code" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_withreplykey_cancel() !== 21671 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_withreplykey_cancel" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_withreplykey_create_v2_post_request() !== 7132 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_withreplykey_create_v2_post_request" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_withreplykey_process_response() !== 13691 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_withreplykey_process_response" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_withreplykeytransition_save() !== 6324 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_withreplykeytransition_save" ); } if ( nativeModule().ubrn_uniffi_payjoin_ffi_checksum_method_withreplykeytransition_save_async() !== 44204 ) { throw new UniffiInternalError.ApiChecksumMismatch( "uniffi_payjoin_ffi_checksum_method_withreplykeytransition_save_async" ); } uniffiCallbackInterfaceJsonReceiverSessionPersister.register(); uniffiCallbackInterfaceJsonReceiverSessionPersisterAsync.register(); uniffiCallbackInterfaceIsInputOwned.register(); uniffiCallbackInterfaceIsOutputKnown.register(); uniffiCallbackInterfaceIsScriptOwned.register(); uniffiCallbackInterfaceProcessPsbt.register(); uniffiCallbackInterfaceTransactionFinder.register(); uniffiCallbackInterfaceCanBroadcast.register(); uniffiCallbackInterfaceJsonSenderSessionPersister.register(); uniffiCallbackInterfaceJsonSenderSessionPersisterAsync.register(); } export default Object.freeze({ initialize: uniffiEnsureInitialized, converters: { FfiConverterTypeAddressParseError, FfiConverterTypeAssumeInteractiveTransition, FfiConverterTypeBroadcastedTransition, FfiConverterTypeCanBroadcast, FfiConverterTypeCancelTransition, FfiConverterTypeClientResponse, FfiConverterTypeCoinSelectionError, FfiConverterTypeCoinSelectionError__as_error, FfiConverterTypeCreateRequestError, FfiConverterTypeCreateRequestError__as_error, FfiConverterTypeDecapsulationError, FfiConverterTypeErrorCode, FfiConverterTypeFeeRateError, FfiConverterTypeFeeRateError__as_error, FfiConverterTypeFfiValidationError, FfiConverterTypeForeignError, FfiConverterTypeHasReplyableError, FfiConverterTypeHasReplyableErrorTransition, FfiConverterTypeImplementationError, FfiConverterTypeInitialReceiveTransition, FfiConverterTypeInitialSendTransition, FfiConverterTypeInitialized, FfiConverterTypeInitializedTransition, FfiConverterTypeInitializedTransitionOutcome, FfiConverterTypeInputContributionError, FfiConverterTypeInputContributionError__as_error, FfiConverterTypeInputPair, FfiConverterTypeInputPairError, FfiConverterTypeIntoUrlError, FfiConverterTypeIsInputOwned, FfiConverterTypeIsOutputKnown, FfiConverterTypeIsScriptOwned, FfiConverterTypeJsonReceiverSessionPersister, FfiConverterTypeJsonReceiverSessionPersisterAsync, FfiConverterTypeJsonReply, FfiConverterTypeJsonSenderSessionPersister, FfiConverterTypeJsonSenderSessionPersisterAsync, FfiConverterTypeManualContributeResult, FfiConverterTypeManualFinalizeResult, FfiConverterTypeManualReceiveError, FfiConverterTypeManualReceiverInput, FfiConverterTypeMaybeInputsOwned, FfiConverterTypeMaybeInputsOwnedTransition, FfiConverterTypeMaybeInputsSeen, FfiConverterTypeMaybeInputsSeenTransition, FfiConverterTypeMonitor, FfiConverterTypeMonitorTransition, FfiConverterTypeOhttpError, FfiConverterTypeOhttpError__as_error, FfiConverterTypeOhttpKeys, FfiConverterTypeOhttpKeysFetchError, FfiConverterTypeOutPoint, FfiConverterTypeOutputSubstitution, FfiConverterTypeOutputSubstitutionError, FfiConverterTypeOutputSubstitutionProtocolError, FfiConverterTypeOutputsUnknown, FfiConverterTypeOutputsUnknownTransition, FfiConverterTypePayjoinProposal, FfiConverterTypePayjoinProposalTransition, FfiConverterTypePendingFallbackTransition, FfiConverterTypePjNotSupported, FfiConverterTypePjNotSupported__as_error, FfiConverterTypePjParam, FfiConverterTypePjUri, FfiConverterTypePollingForProposal, FfiConverterTypePollingForProposalTransition, FfiConverterTypePollingForProposalTransitionOutcome, FfiConverterTypeProcessPsbt, FfiConverterTypeProtocolError, FfiConverterTypeProvisionalProposal, FfiConverterTypeProvisionalProposalTransition, FfiConverterTypePsbtInput, FfiConverterTypePsbtInputError, FfiConverterTypePsbtParseError, FfiConverterTypeReceiveSession, FfiConverterTypeReceiverBuilder, FfiConverterTypeReceiverBuilderError, FfiConverterTypeReceiverCreateRequestError, FfiConverterTypeReceiverCreateRequestError__as_error, FfiConverterTypeReceiverError, FfiConverterTypeReceiverPendingFallback, FfiConverterTypeReceiverPersistedError, FfiConverterTypeReceiverReplayError, FfiConverterTypeReceiverReplayError__as_error, FfiConverterTypeReceiverSessionEvent, FfiConverterTypeReceiverSessionHistory, FfiConverterTypeReceiverSessionOutcome, FfiConverterTypeReceiverSessionStatus, FfiConverterTypeReplayResult, FfiConverterTypeRequest, FfiConverterTypeRequestOhttpContext, FfiConverterTypeRequestResponse, FfiConverterTypeRequestV1Context, FfiConverterTypeResponseError, FfiConverterTypeSendSession, FfiConverterTypeSenderBuilder, FfiConverterTypeSenderBuilderError, FfiConverterTypeSenderCancelTransition, FfiConverterTypeSenderError, FfiConverterTypeSenderInputError, FfiConverterTypeSenderPendingFallback, FfiConverterTypeSenderPersistedError, FfiConverterTypeSenderReplayError, FfiConverterTypeSenderReplayError__as_error, FfiConverterTypeSenderReplayResult, FfiConverterTypeSenderSessionEvent, FfiConverterTypeSenderSessionHistory, FfiConverterTypeSenderSessionOutcome, FfiConverterTypeSenderSessionStatus, FfiConverterTypeSerdeJsonError, FfiConverterTypeSerdeJsonError__as_error, FfiConverterTypeSessionError, FfiConverterTypeTransactionFinder, FfiConverterTypeTxIn, FfiConverterTypeTxOut, FfiConverterTypeUncheckedOriginalPayload, FfiConverterTypeUncheckedOriginalPayloadTransition, FfiConverterTypeUri, FfiConverterTypeUriParseError, FfiConverterTypeUriParseError__as_error, FfiConverterTypeUrl, FfiConverterTypeUrlParseError, FfiConverterTypeUrlParseError__as_error, FfiConverterTypeV1Context, FfiConverterTypeValidationError, FfiConverterTypeWantsFeeRange, FfiConverterTypeWantsFeeRangeTransition, FfiConverterTypeWantsInputs, FfiConverterTypeWantsInputsTransition, FfiConverterTypeWantsOutputs, FfiConverterTypeWantsOutputsTransition, FfiConverterTypeWeight, FfiConverterTypeWellKnownError, FfiConverterTypeWithReplyKey, FfiConverterTypeWithReplyKeyTransition, }, });