@secondts/bark-react-native 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cpp/generated/bark.cpp +632 -5
- package/cpp/generated/bark.hpp +10 -0
- package/lib/commonjs/Logger.js +48 -0
- package/lib/commonjs/Logger.js.map +1 -0
- package/lib/commonjs/generated/bark-ffi.js.map +1 -1
- package/lib/commonjs/generated/bark.js +187 -4
- package/lib/commonjs/generated/bark.js.map +1 -1
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/Logger.js +43 -0
- package/lib/module/Logger.js.map +1 -0
- package/lib/module/generated/bark-ffi.js.map +1 -1
- package/lib/module/generated/bark.js +186 -4
- package/lib/module/generated/bark.js.map +1 -1
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/Logger.d.ts +18 -0
- package/lib/typescript/commonjs/src/Logger.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts +17 -1
- package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/generated/bark.d.ts +79 -2
- package/lib/typescript/commonjs/src/generated/bark.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/Logger.d.ts +18 -0
- package/lib/typescript/module/src/Logger.d.ts.map +1 -0
- package/lib/typescript/module/src/generated/bark-ffi.d.ts +17 -1
- package/lib/typescript/module/src/generated/bark-ffi.d.ts.map +1 -1
- package/lib/typescript/module/src/generated/bark.d.ts +79 -2
- package/lib/typescript/module/src/generated/bark.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +1 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/Logger.ts +42 -0
- package/src/generated/bark-ffi.ts +37 -1
- package/src/generated/bark.ts +333 -2
- package/src/index.tsx +3 -0
|
@@ -94,6 +94,12 @@ interface NativeModuleInterface {
|
|
|
94
94
|
config: Uint8Array,
|
|
95
95
|
datadir: Uint8Array
|
|
96
96
|
): bigint;
|
|
97
|
+
ubrn_uniffi_bark_ffi_fn_constructor_wallet_open_with_daemon(
|
|
98
|
+
mnemonic: Uint8Array,
|
|
99
|
+
config: Uint8Array,
|
|
100
|
+
datadir: Uint8Array,
|
|
101
|
+
onchainWallet: Uint8Array
|
|
102
|
+
): bigint;
|
|
97
103
|
ubrn_uniffi_bark_ffi_fn_constructor_wallet_open_with_onchain(
|
|
98
104
|
mnemonic: Uint8Array,
|
|
99
105
|
config: Uint8Array,
|
|
@@ -117,7 +123,8 @@ interface NativeModuleInterface {
|
|
|
117
123
|
): bigint;
|
|
118
124
|
ubrn_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice(
|
|
119
125
|
ptr: bigint,
|
|
120
|
-
amountSats: bigint
|
|
126
|
+
amountSats: bigint,
|
|
127
|
+
description: Uint8Array
|
|
121
128
|
): bigint;
|
|
122
129
|
ubrn_uniffi_bark_ffi_fn_method_wallet_broadcast_tx(
|
|
123
130
|
ptr: bigint,
|
|
@@ -340,6 +347,10 @@ interface NativeModuleInterface {
|
|
|
340
347
|
ptr: bigint,
|
|
341
348
|
vtxoIds: Uint8Array
|
|
342
349
|
): bigint;
|
|
350
|
+
ubrn_uniffi_bark_ffi_fn_method_wallet_run_daemon(
|
|
351
|
+
ptr: bigint,
|
|
352
|
+
onchainWallet: Uint8Array
|
|
353
|
+
): bigint;
|
|
343
354
|
ubrn_uniffi_bark_ffi_fn_method_wallet_send_arkoor_payment(
|
|
344
355
|
ptr: bigint,
|
|
345
356
|
arkAddress: Uint8Array,
|
|
@@ -362,6 +373,7 @@ interface NativeModuleInterface {
|
|
|
362
373
|
ptr: bigint,
|
|
363
374
|
vtxoIds: Uint8Array
|
|
364
375
|
): bigint;
|
|
376
|
+
ubrn_uniffi_bark_ffi_fn_method_wallet_stop_daemon(ptr: bigint): bigint;
|
|
365
377
|
ubrn_uniffi_bark_ffi_fn_method_wallet_sync(ptr: bigint): bigint;
|
|
366
378
|
ubrn_uniffi_bark_ffi_fn_method_wallet_sync_exits(
|
|
367
379
|
ptr: bigint,
|
|
@@ -384,6 +396,9 @@ interface NativeModuleInterface {
|
|
|
384
396
|
address: Uint8Array
|
|
385
397
|
): bigint;
|
|
386
398
|
ubrn_uniffi_bark_ffi_fn_method_wallet_vtxos(ptr: bigint): bigint;
|
|
399
|
+
ubrn_uniffi_bark_ffi_fn_init_callback_vtable_barklogger(
|
|
400
|
+
vtable: UniffiVTableCallbackInterfaceBarkLogger
|
|
401
|
+
): void;
|
|
387
402
|
ubrn_uniffi_bark_ffi_fn_init_callback_vtable_customonchainwalletcallbacks(
|
|
388
403
|
vtable: UniffiVTableCallbackInterfaceCustomOnchainWalletCallbacks
|
|
389
404
|
): void;
|
|
@@ -394,6 +409,11 @@ interface NativeModuleInterface {
|
|
|
394
409
|
ubrn_uniffi_bark_ffi_fn_func_generate_mnemonic(
|
|
395
410
|
uniffi_out_err: UniffiRustCallStatus
|
|
396
411
|
): Uint8Array;
|
|
412
|
+
ubrn_uniffi_bark_ffi_fn_func_set_logger(
|
|
413
|
+
logger: bigint,
|
|
414
|
+
maxLevel: Uint8Array,
|
|
415
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
416
|
+
): void;
|
|
397
417
|
ubrn_uniffi_bark_ffi_fn_func_validate_ark_address(
|
|
398
418
|
address: Uint8Array,
|
|
399
419
|
uniffi_out_err: UniffiRustCallStatus
|
|
@@ -536,6 +556,7 @@ interface NativeModuleInterface {
|
|
|
536
556
|
): void;
|
|
537
557
|
ubrn_uniffi_bark_ffi_checksum_func_extract_tx_from_psbt(): number;
|
|
538
558
|
ubrn_uniffi_bark_ffi_checksum_func_generate_mnemonic(): number;
|
|
559
|
+
ubrn_uniffi_bark_ffi_checksum_func_set_logger(): number;
|
|
539
560
|
ubrn_uniffi_bark_ffi_checksum_func_validate_ark_address(): number;
|
|
540
561
|
ubrn_uniffi_bark_ffi_checksum_func_validate_mnemonic(): number;
|
|
541
562
|
ubrn_uniffi_bark_ffi_checksum_method_notificationholder_cancel_next_notification_wait(): number;
|
|
@@ -615,12 +636,14 @@ interface NativeModuleInterface {
|
|
|
615
636
|
ubrn_uniffi_bark_ffi_checksum_method_wallet_refresh_server(): number;
|
|
616
637
|
ubrn_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos(): number;
|
|
617
638
|
ubrn_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_delegated(): number;
|
|
639
|
+
ubrn_uniffi_bark_ffi_checksum_method_wallet_run_daemon(): number;
|
|
618
640
|
ubrn_uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment(): number;
|
|
619
641
|
ubrn_uniffi_bark_ffi_checksum_method_wallet_send_onchain(): number;
|
|
620
642
|
ubrn_uniffi_bark_ffi_checksum_method_wallet_sign_exit_claim_inputs(): number;
|
|
621
643
|
ubrn_uniffi_bark_ffi_checksum_method_wallet_spendable_vtxos(): number;
|
|
622
644
|
ubrn_uniffi_bark_ffi_checksum_method_wallet_start_exit_for_entire_wallet(): number;
|
|
623
645
|
ubrn_uniffi_bark_ffi_checksum_method_wallet_start_exit_for_vtxos(): number;
|
|
646
|
+
ubrn_uniffi_bark_ffi_checksum_method_wallet_stop_daemon(): number;
|
|
624
647
|
ubrn_uniffi_bark_ffi_checksum_method_wallet_sync(): number;
|
|
625
648
|
ubrn_uniffi_bark_ffi_checksum_method_wallet_sync_exits(): number;
|
|
626
649
|
ubrn_uniffi_bark_ffi_checksum_method_wallet_sync_pending_boards(): number;
|
|
@@ -633,7 +656,9 @@ interface NativeModuleInterface {
|
|
|
633
656
|
ubrn_uniffi_bark_ffi_checksum_constructor_wallet_create(): number;
|
|
634
657
|
ubrn_uniffi_bark_ffi_checksum_constructor_wallet_create_with_onchain(): number;
|
|
635
658
|
ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open(): number;
|
|
659
|
+
ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open_with_daemon(): number;
|
|
636
660
|
ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open_with_onchain(): number;
|
|
661
|
+
ubrn_uniffi_bark_ffi_checksum_method_barklogger_log(): number;
|
|
637
662
|
ubrn_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_get_balance(): number;
|
|
638
663
|
ubrn_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_prepare_tx(): number;
|
|
639
664
|
ubrn_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_prepare_drain_tx(): number;
|
|
@@ -774,6 +799,12 @@ export type UniffiForeignFutureCompleteVoid = (
|
|
|
774
799
|
callbackData: bigint,
|
|
775
800
|
result: UniffiForeignFutureResultVoid
|
|
776
801
|
) => void;
|
|
802
|
+
type UniffiCallbackInterfaceBarkLoggerMethod0 = (
|
|
803
|
+
uniffiHandle: bigint,
|
|
804
|
+
level: Uint8Array,
|
|
805
|
+
target: Uint8Array,
|
|
806
|
+
message: Uint8Array
|
|
807
|
+
) => UniffiResult<void>;
|
|
777
808
|
type UniffiCallbackInterfaceCustomOnchainWalletCallbacksMethod0 = (
|
|
778
809
|
uniffiHandle: bigint
|
|
779
810
|
) => bigint;
|
|
@@ -811,6 +842,11 @@ type UniffiCallbackInterfaceCustomOnchainWalletCallbacksMethod8 = (
|
|
|
811
842
|
uniffiHandle: bigint,
|
|
812
843
|
txHex: Uint8Array
|
|
813
844
|
) => UniffiResult<void>;
|
|
845
|
+
export type UniffiVTableCallbackInterfaceBarkLogger = {
|
|
846
|
+
uniffiFree: UniffiCallbackInterfaceFree;
|
|
847
|
+
uniffiClone: UniffiCallbackInterfaceClone;
|
|
848
|
+
log: UniffiCallbackInterfaceBarkLoggerMethod0;
|
|
849
|
+
};
|
|
814
850
|
export type UniffiVTableCallbackInterfaceCustomOnchainWalletCallbacks = {
|
|
815
851
|
uniffiFree: UniffiCallbackInterfaceFree;
|
|
816
852
|
uniffiClone: UniffiCallbackInterfaceClone;
|
package/src/generated/bark.ts
CHANGED
|
@@ -32,6 +32,7 @@ import nativeModule, {
|
|
|
32
32
|
type UniffiForeignFutureCompleteRustBuffer,
|
|
33
33
|
type UniffiForeignFutureResultVoid,
|
|
34
34
|
type UniffiForeignFutureCompleteVoid,
|
|
35
|
+
type UniffiVTableCallbackInterfaceBarkLogger,
|
|
35
36
|
type UniffiVTableCallbackInterfaceCustomOnchainWalletCallbacks,
|
|
36
37
|
} from "./bark-ffi";
|
|
37
38
|
import {
|
|
@@ -65,6 +66,7 @@ import {
|
|
|
65
66
|
uniffiCreateFfiConverterString,
|
|
66
67
|
uniffiCreateRecord,
|
|
67
68
|
uniffiRustCallAsync,
|
|
69
|
+
uniffiTraitInterfaceCall,
|
|
68
70
|
uniffiTraitInterfaceCallWithError,
|
|
69
71
|
uniffiTypeNameSymbol,
|
|
70
72
|
variantOrdinalSymbol,
|
|
@@ -112,6 +114,28 @@ export function generateMnemonic(): string /*throws*/ {
|
|
|
112
114
|
)
|
|
113
115
|
);
|
|
114
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Install the foreign log sink. Must be called at most once,
|
|
119
|
+
* subsequent calls return an error
|
|
120
|
+
*/
|
|
121
|
+
export function setLogger(
|
|
122
|
+
logger: BarkLogger,
|
|
123
|
+
maxLevel: LogLevel
|
|
124
|
+
): void /*throws*/ {
|
|
125
|
+
uniffiCaller.rustCallWithError(
|
|
126
|
+
/*liftError:*/ FfiConverterTypeBarkError.lift.bind(
|
|
127
|
+
FfiConverterTypeBarkError
|
|
128
|
+
),
|
|
129
|
+
/*caller:*/ (callStatus) => {
|
|
130
|
+
nativeModule().ubrn_uniffi_bark_ffi_fn_func_set_logger(
|
|
131
|
+
FfiConverterTypeBarkLogger.lower(logger),
|
|
132
|
+
FfiConverterTypeLogLevel.lower(maxLevel),
|
|
133
|
+
callStatus
|
|
134
|
+
);
|
|
135
|
+
},
|
|
136
|
+
/*liftString:*/ FfiConverterString.lift
|
|
137
|
+
);
|
|
138
|
+
}
|
|
115
139
|
export function validateArkAddress(address: string): boolean /*throws*/ {
|
|
116
140
|
return FfiConverterBool.lift(
|
|
117
141
|
uniffiCaller.rustCallWithError(
|
|
@@ -145,6 +169,68 @@ export function validateMnemonic(mnemonic: string): boolean /*throws*/ {
|
|
|
145
169
|
);
|
|
146
170
|
}
|
|
147
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Foreign sink for log records. Implement in Dart/Swift/Kotlin and pass to
|
|
174
|
+
* [set_logger]. The `log()` method must not call back into bark APIs that
|
|
175
|
+
* emit log records.
|
|
176
|
+
*/
|
|
177
|
+
export interface BarkLogger {
|
|
178
|
+
log(level: LogLevel, target: string, message: string): void;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
182
|
+
const uniffiCallbackInterfaceBarkLogger: {
|
|
183
|
+
vtable: UniffiVTableCallbackInterfaceBarkLogger;
|
|
184
|
+
register: () => void;
|
|
185
|
+
} = {
|
|
186
|
+
// Create the VTable using a series of closures.
|
|
187
|
+
// ts automatically converts these into C callback functions.
|
|
188
|
+
vtable: {
|
|
189
|
+
log: (
|
|
190
|
+
uniffiHandle: bigint,
|
|
191
|
+
level: Uint8Array,
|
|
192
|
+
target: Uint8Array,
|
|
193
|
+
message: Uint8Array
|
|
194
|
+
) => {
|
|
195
|
+
const uniffiMakeCall = (): void => {
|
|
196
|
+
const jsCallback = FfiConverterTypeBarkLogger.lift(uniffiHandle);
|
|
197
|
+
return jsCallback.log(
|
|
198
|
+
FfiConverterTypeLogLevel.lift(level),
|
|
199
|
+
FfiConverterString.lift(target),
|
|
200
|
+
FfiConverterString.lift(message)
|
|
201
|
+
);
|
|
202
|
+
};
|
|
203
|
+
const uniffiResult = UniffiResult.ready<void>();
|
|
204
|
+
const uniffiHandleSuccess = (obj: any) => {};
|
|
205
|
+
const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => {
|
|
206
|
+
UniffiResult.writeError(uniffiResult, code, errBuf);
|
|
207
|
+
};
|
|
208
|
+
uniffiTraitInterfaceCall(
|
|
209
|
+
/*makeCall:*/ uniffiMakeCall,
|
|
210
|
+
/*handleSuccess:*/ uniffiHandleSuccess,
|
|
211
|
+
/*handleError:*/ uniffiHandleError,
|
|
212
|
+
/*lowerString:*/ FfiConverterString.lower
|
|
213
|
+
);
|
|
214
|
+
return uniffiResult;
|
|
215
|
+
},
|
|
216
|
+
uniffiFree: (uniffiHandle: UniffiHandle): void => {
|
|
217
|
+
// BarkLogger: this will throw a stale handle error if the handle isn't found.
|
|
218
|
+
FfiConverterTypeBarkLogger.drop(uniffiHandle);
|
|
219
|
+
},
|
|
220
|
+
uniffiClone: (uniffiHandle: UniffiHandle): UniffiHandle => {
|
|
221
|
+
return FfiConverterTypeBarkLogger.clone(uniffiHandle);
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
register: () => {
|
|
225
|
+
nativeModule().ubrn_uniffi_bark_ffi_fn_init_callback_vtable_barklogger(
|
|
226
|
+
uniffiCallbackInterfaceBarkLogger.vtable
|
|
227
|
+
);
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
// FfiConverter protocol for callback interfaces
|
|
232
|
+
const FfiConverterTypeBarkLogger = new FfiConverterCallback<BarkLogger>();
|
|
233
|
+
|
|
148
234
|
/**
|
|
149
235
|
* Callback interface for custom onchain wallet implementations
|
|
150
236
|
*
|
|
@@ -3029,6 +3115,58 @@ const FfiConverterTypeBarkError = (() => {
|
|
|
3029
3115
|
return new FFIConverter();
|
|
3030
3116
|
})();
|
|
3031
3117
|
|
|
3118
|
+
/**
|
|
3119
|
+
* Severity of a log record forwarded to a foreign [BarkLogger].
|
|
3120
|
+
*/
|
|
3121
|
+
export enum LogLevel {
|
|
3122
|
+
Error,
|
|
3123
|
+
Warn,
|
|
3124
|
+
Info,
|
|
3125
|
+
Debug,
|
|
3126
|
+
Trace,
|
|
3127
|
+
}
|
|
3128
|
+
|
|
3129
|
+
const FfiConverterTypeLogLevel = (() => {
|
|
3130
|
+
const ordinalConverter = FfiConverterInt32;
|
|
3131
|
+
type TypeName = LogLevel;
|
|
3132
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3133
|
+
read(from: RustBuffer): TypeName {
|
|
3134
|
+
switch (ordinalConverter.read(from)) {
|
|
3135
|
+
case 1:
|
|
3136
|
+
return LogLevel.Error;
|
|
3137
|
+
case 2:
|
|
3138
|
+
return LogLevel.Warn;
|
|
3139
|
+
case 3:
|
|
3140
|
+
return LogLevel.Info;
|
|
3141
|
+
case 4:
|
|
3142
|
+
return LogLevel.Debug;
|
|
3143
|
+
case 5:
|
|
3144
|
+
return LogLevel.Trace;
|
|
3145
|
+
default:
|
|
3146
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
3150
|
+
switch (value) {
|
|
3151
|
+
case LogLevel.Error:
|
|
3152
|
+
return ordinalConverter.write(1, into);
|
|
3153
|
+
case LogLevel.Warn:
|
|
3154
|
+
return ordinalConverter.write(2, into);
|
|
3155
|
+
case LogLevel.Info:
|
|
3156
|
+
return ordinalConverter.write(3, into);
|
|
3157
|
+
case LogLevel.Debug:
|
|
3158
|
+
return ordinalConverter.write(4, into);
|
|
3159
|
+
case LogLevel.Trace:
|
|
3160
|
+
return ordinalConverter.write(5, into);
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
allocationSize(value: TypeName): number {
|
|
3164
|
+
return ordinalConverter.allocationSize(0);
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
return new FFIConverter();
|
|
3168
|
+
})();
|
|
3169
|
+
|
|
3032
3170
|
/**
|
|
3033
3171
|
* Bitcoin network types
|
|
3034
3172
|
*/
|
|
@@ -3916,6 +4054,7 @@ export interface WalletLike {
|
|
|
3916
4054
|
): /*throws*/ Promise<PendingBoard>;
|
|
3917
4055
|
bolt11Invoice(
|
|
3918
4056
|
amountSats: /*u64*/ bigint,
|
|
4057
|
+
description: string | undefined,
|
|
3919
4058
|
asyncOpts_?: { signal: AbortSignal }
|
|
3920
4059
|
): /*throws*/ Promise<LightningInvoice>;
|
|
3921
4060
|
/**
|
|
@@ -4454,6 +4593,19 @@ export interface WalletLike {
|
|
|
4454
4593
|
vtxoIds: Array<string>,
|
|
4455
4594
|
asyncOpts_?: { signal: AbortSignal }
|
|
4456
4595
|
): /*throws*/ Promise<RoundState | undefined>;
|
|
4596
|
+
/**
|
|
4597
|
+
* Start a background daemon for the wallet.
|
|
4598
|
+
*
|
|
4599
|
+
* The daemon performs periodic syncs, exit progression and other
|
|
4600
|
+
* background work. It is stopped automatically when the wallet is dropped.
|
|
4601
|
+
* Callback-based onchain wallets are not supported for daemon mode and the
|
|
4602
|
+
* daemon will run without onchain capabilities in that case.
|
|
4603
|
+
* Calling this multiple times stops the previous daemon and starts a new one.
|
|
4604
|
+
*/
|
|
4605
|
+
runDaemon(
|
|
4606
|
+
onchainWallet: OnchainWalletLike | undefined,
|
|
4607
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
4608
|
+
): /*throws*/ Promise<void>;
|
|
4457
4609
|
sendArkoorPayment(
|
|
4458
4610
|
arkAddress: string,
|
|
4459
4611
|
amountSats: /*u64*/ bigint,
|
|
@@ -4501,6 +4653,10 @@ export interface WalletLike {
|
|
|
4501
4653
|
vtxoIds: Array<string>,
|
|
4502
4654
|
asyncOpts_?: { signal: AbortSignal }
|
|
4503
4655
|
): /*throws*/ Promise<void>;
|
|
4656
|
+
/**
|
|
4657
|
+
* Stop the running daemon if any. No-op otherwise.
|
|
4658
|
+
*/
|
|
4659
|
+
stopDaemon(asyncOpts_?: { signal: AbortSignal }): /*throws*/ Promise<void>;
|
|
4504
4660
|
/**
|
|
4505
4661
|
* Lightweight sync with Ark server and blockchain
|
|
4506
4662
|
* Note: Bark's sync() handles errors internally with logging.
|
|
@@ -4695,6 +4851,53 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
4695
4851
|
}
|
|
4696
4852
|
}
|
|
4697
4853
|
|
|
4854
|
+
/**
|
|
4855
|
+
* Open an existing Bark wallet and start running the daemon,
|
|
4856
|
+
* optionally with onchain capabilities.
|
|
4857
|
+
*
|
|
4858
|
+
* The daemon runs in the background and is stopped when the wallet is dropped.
|
|
4859
|
+
* Callback-based onchain wallets are not supported for daemon mode and the
|
|
4860
|
+
* wallet will be opened without onchain capabilities in that case.
|
|
4861
|
+
*/
|
|
4862
|
+
static async openWithDaemon(
|
|
4863
|
+
mnemonic: string,
|
|
4864
|
+
config: Config,
|
|
4865
|
+
datadir: string,
|
|
4866
|
+
onchainWallet: OnchainWalletLike | undefined,
|
|
4867
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
4868
|
+
): Promise<WalletLike> /*throws*/ {
|
|
4869
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
4870
|
+
try {
|
|
4871
|
+
return await uniffiRustCallAsync(
|
|
4872
|
+
/*rustCaller:*/ uniffiCaller,
|
|
4873
|
+
/*rustFutureFunc:*/ () => {
|
|
4874
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_constructor_wallet_open_with_daemon(
|
|
4875
|
+
FfiConverterString.lower(mnemonic),
|
|
4876
|
+
FfiConverterTypeConfig.lower(config),
|
|
4877
|
+
FfiConverterString.lower(datadir),
|
|
4878
|
+
FfiConverterOptionalTypeOnchainWallet.lower(onchainWallet)
|
|
4879
|
+
);
|
|
4880
|
+
},
|
|
4881
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_bark_ffi_rust_future_poll_u64,
|
|
4882
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_bark_ffi_rust_future_cancel_u64,
|
|
4883
|
+
/*completeFunc:*/ nativeModule()
|
|
4884
|
+
.ubrn_ffi_bark_ffi_rust_future_complete_u64,
|
|
4885
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_bark_ffi_rust_future_free_u64,
|
|
4886
|
+
/*liftFunc:*/ FfiConverterTypeWallet.lift.bind(FfiConverterTypeWallet),
|
|
4887
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
4888
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
4889
|
+
/*errorHandler:*/ FfiConverterTypeBarkError.lift.bind(
|
|
4890
|
+
FfiConverterTypeBarkError
|
|
4891
|
+
)
|
|
4892
|
+
);
|
|
4893
|
+
} catch (__error: any) {
|
|
4894
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
4895
|
+
__error.stack = __stack;
|
|
4896
|
+
}
|
|
4897
|
+
throw __error;
|
|
4898
|
+
}
|
|
4899
|
+
}
|
|
4900
|
+
|
|
4698
4901
|
/**
|
|
4699
4902
|
* Open an existing Bark wallet WITH onchain capabilities
|
|
4700
4903
|
*/
|
|
@@ -4981,6 +5184,7 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
4981
5184
|
|
|
4982
5185
|
async bolt11Invoice(
|
|
4983
5186
|
amountSats: /*u64*/ bigint,
|
|
5187
|
+
description: string | undefined,
|
|
4984
5188
|
asyncOpts_?: { signal: AbortSignal }
|
|
4985
5189
|
): Promise<LightningInvoice> /*throws*/ {
|
|
4986
5190
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
@@ -4990,7 +5194,8 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
4990
5194
|
/*rustFutureFunc:*/ () => {
|
|
4991
5195
|
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice(
|
|
4992
5196
|
uniffiTypeWalletObjectFactory.clonePointer(this),
|
|
4993
|
-
FfiConverterUInt64.lower(amountSats)
|
|
5197
|
+
FfiConverterUInt64.lower(amountSats),
|
|
5198
|
+
FfiConverterOptionalString.lower(description)
|
|
4994
5199
|
);
|
|
4995
5200
|
},
|
|
4996
5201
|
/*pollFunc:*/ nativeModule()
|
|
@@ -7628,6 +7833,50 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
7628
7833
|
}
|
|
7629
7834
|
}
|
|
7630
7835
|
|
|
7836
|
+
/**
|
|
7837
|
+
* Start a background daemon for the wallet.
|
|
7838
|
+
*
|
|
7839
|
+
* The daemon performs periodic syncs, exit progression and other
|
|
7840
|
+
* background work. It is stopped automatically when the wallet is dropped.
|
|
7841
|
+
* Callback-based onchain wallets are not supported for daemon mode and the
|
|
7842
|
+
* daemon will run without onchain capabilities in that case.
|
|
7843
|
+
* Calling this multiple times stops the previous daemon and starts a new one.
|
|
7844
|
+
*/
|
|
7845
|
+
async runDaemon(
|
|
7846
|
+
onchainWallet: OnchainWalletLike | undefined,
|
|
7847
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
7848
|
+
): Promise<void> /*throws*/ {
|
|
7849
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
7850
|
+
try {
|
|
7851
|
+
return await uniffiRustCallAsync(
|
|
7852
|
+
/*rustCaller:*/ uniffiCaller,
|
|
7853
|
+
/*rustFutureFunc:*/ () => {
|
|
7854
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_run_daemon(
|
|
7855
|
+
uniffiTypeWalletObjectFactory.clonePointer(this),
|
|
7856
|
+
FfiConverterOptionalTypeOnchainWallet.lower(onchainWallet)
|
|
7857
|
+
);
|
|
7858
|
+
},
|
|
7859
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_bark_ffi_rust_future_poll_void,
|
|
7860
|
+
/*cancelFunc:*/ nativeModule()
|
|
7861
|
+
.ubrn_ffi_bark_ffi_rust_future_cancel_void,
|
|
7862
|
+
/*completeFunc:*/ nativeModule()
|
|
7863
|
+
.ubrn_ffi_bark_ffi_rust_future_complete_void,
|
|
7864
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_bark_ffi_rust_future_free_void,
|
|
7865
|
+
/*liftFunc:*/ (_v) => {},
|
|
7866
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
7867
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
7868
|
+
/*errorHandler:*/ FfiConverterTypeBarkError.lift.bind(
|
|
7869
|
+
FfiConverterTypeBarkError
|
|
7870
|
+
)
|
|
7871
|
+
);
|
|
7872
|
+
} catch (__error: any) {
|
|
7873
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
7874
|
+
__error.stack = __stack;
|
|
7875
|
+
}
|
|
7876
|
+
throw __error;
|
|
7877
|
+
}
|
|
7878
|
+
}
|
|
7879
|
+
|
|
7631
7880
|
async sendArkoorPayment(
|
|
7632
7881
|
arkAddress: string,
|
|
7633
7882
|
amountSats: /*u64*/ bigint,
|
|
@@ -7871,6 +8120,42 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
7871
8120
|
}
|
|
7872
8121
|
}
|
|
7873
8122
|
|
|
8123
|
+
/**
|
|
8124
|
+
* Stop the running daemon if any. No-op otherwise.
|
|
8125
|
+
*/
|
|
8126
|
+
async stopDaemon(asyncOpts_?: {
|
|
8127
|
+
signal: AbortSignal;
|
|
8128
|
+
}): Promise<void> /*throws*/ {
|
|
8129
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
8130
|
+
try {
|
|
8131
|
+
return await uniffiRustCallAsync(
|
|
8132
|
+
/*rustCaller:*/ uniffiCaller,
|
|
8133
|
+
/*rustFutureFunc:*/ () => {
|
|
8134
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_stop_daemon(
|
|
8135
|
+
uniffiTypeWalletObjectFactory.clonePointer(this)
|
|
8136
|
+
);
|
|
8137
|
+
},
|
|
8138
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_bark_ffi_rust_future_poll_void,
|
|
8139
|
+
/*cancelFunc:*/ nativeModule()
|
|
8140
|
+
.ubrn_ffi_bark_ffi_rust_future_cancel_void,
|
|
8141
|
+
/*completeFunc:*/ nativeModule()
|
|
8142
|
+
.ubrn_ffi_bark_ffi_rust_future_complete_void,
|
|
8143
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_bark_ffi_rust_future_free_void,
|
|
8144
|
+
/*liftFunc:*/ (_v) => {},
|
|
8145
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
8146
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
8147
|
+
/*errorHandler:*/ FfiConverterTypeBarkError.lift.bind(
|
|
8148
|
+
FfiConverterTypeBarkError
|
|
8149
|
+
)
|
|
8150
|
+
);
|
|
8151
|
+
} catch (__error: any) {
|
|
8152
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
8153
|
+
__error.stack = __stack;
|
|
8154
|
+
}
|
|
8155
|
+
throw __error;
|
|
8156
|
+
}
|
|
8157
|
+
}
|
|
8158
|
+
|
|
7874
8159
|
/**
|
|
7875
8160
|
* Lightweight sync with Ark server and blockchain
|
|
7876
8161
|
* Note: Bark's sync() handles errors internally with logging.
|
|
@@ -8316,6 +8601,11 @@ const FfiConverterOptionalTypeWalletNotification = new FfiConverterOptional(
|
|
|
8316
8601
|
FfiConverterTypeWalletNotification
|
|
8317
8602
|
);
|
|
8318
8603
|
|
|
8604
|
+
// FfiConverter for OnchainWalletLike | undefined
|
|
8605
|
+
const FfiConverterOptionalTypeOnchainWallet = new FfiConverterOptional(
|
|
8606
|
+
FfiConverterTypeOnchainWallet
|
|
8607
|
+
);
|
|
8608
|
+
|
|
8319
8609
|
// FfiConverter for Array<string> | undefined
|
|
8320
8610
|
const FfiConverterOptionalArrayString = new FfiConverterOptional(
|
|
8321
8611
|
FfiConverterArrayString
|
|
@@ -8359,6 +8649,13 @@ function uniffiEnsureInitialized() {
|
|
|
8359
8649
|
"uniffi_bark_ffi_checksum_func_generate_mnemonic"
|
|
8360
8650
|
);
|
|
8361
8651
|
}
|
|
8652
|
+
if (
|
|
8653
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_func_set_logger() !== 62790
|
|
8654
|
+
) {
|
|
8655
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
8656
|
+
"uniffi_bark_ffi_checksum_func_set_logger"
|
|
8657
|
+
);
|
|
8658
|
+
}
|
|
8362
8659
|
if (
|
|
8363
8660
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_func_validate_ark_address() !==
|
|
8364
8661
|
49932
|
|
@@ -8473,7 +8770,7 @@ function uniffiEnsureInitialized() {
|
|
|
8473
8770
|
}
|
|
8474
8771
|
if (
|
|
8475
8772
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_bolt11_invoice() !==
|
|
8476
|
-
|
|
8773
|
+
47558
|
|
8477
8774
|
) {
|
|
8478
8775
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
8479
8776
|
"uniffi_bark_ffi_checksum_method_wallet_bolt11_invoice"
|
|
@@ -8991,6 +9288,14 @@ function uniffiEnsureInitialized() {
|
|
|
8991
9288
|
"uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_delegated"
|
|
8992
9289
|
);
|
|
8993
9290
|
}
|
|
9291
|
+
if (
|
|
9292
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_run_daemon() !==
|
|
9293
|
+
21553
|
|
9294
|
+
) {
|
|
9295
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
9296
|
+
"uniffi_bark_ffi_checksum_method_wallet_run_daemon"
|
|
9297
|
+
);
|
|
9298
|
+
}
|
|
8994
9299
|
if (
|
|
8995
9300
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment() !==
|
|
8996
9301
|
30372
|
|
@@ -9039,6 +9344,14 @@ function uniffiEnsureInitialized() {
|
|
|
9039
9344
|
"uniffi_bark_ffi_checksum_method_wallet_start_exit_for_vtxos"
|
|
9040
9345
|
);
|
|
9041
9346
|
}
|
|
9347
|
+
if (
|
|
9348
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_stop_daemon() !==
|
|
9349
|
+
9450
|
|
9350
|
+
) {
|
|
9351
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
9352
|
+
"uniffi_bark_ffi_checksum_method_wallet_stop_daemon"
|
|
9353
|
+
);
|
|
9354
|
+
}
|
|
9042
9355
|
if (
|
|
9043
9356
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_sync() !== 22105
|
|
9044
9357
|
) {
|
|
@@ -9133,6 +9446,14 @@ function uniffiEnsureInitialized() {
|
|
|
9133
9446
|
"uniffi_bark_ffi_checksum_constructor_wallet_open"
|
|
9134
9447
|
);
|
|
9135
9448
|
}
|
|
9449
|
+
if (
|
|
9450
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open_with_daemon() !==
|
|
9451
|
+
8446
|
|
9452
|
+
) {
|
|
9453
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
9454
|
+
"uniffi_bark_ffi_checksum_constructor_wallet_open_with_daemon"
|
|
9455
|
+
);
|
|
9456
|
+
}
|
|
9136
9457
|
if (
|
|
9137
9458
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open_with_onchain() !==
|
|
9138
9459
|
22896
|
|
@@ -9141,6 +9462,14 @@ function uniffiEnsureInitialized() {
|
|
|
9141
9462
|
"uniffi_bark_ffi_checksum_constructor_wallet_open_with_onchain"
|
|
9142
9463
|
);
|
|
9143
9464
|
}
|
|
9465
|
+
if (
|
|
9466
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_barklogger_log() !==
|
|
9467
|
+
1414
|
|
9468
|
+
) {
|
|
9469
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
9470
|
+
"uniffi_bark_ffi_checksum_method_barklogger_log"
|
|
9471
|
+
);
|
|
9472
|
+
}
|
|
9144
9473
|
if (
|
|
9145
9474
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_get_balance() !==
|
|
9146
9475
|
16407
|
|
@@ -9214,6 +9543,7 @@ function uniffiEnsureInitialized() {
|
|
|
9214
9543
|
);
|
|
9215
9544
|
}
|
|
9216
9545
|
|
|
9546
|
+
uniffiCallbackInterfaceBarkLogger.register();
|
|
9217
9547
|
uniffiCallbackInterfaceCustomOnchainWalletCallbacks.register();
|
|
9218
9548
|
}
|
|
9219
9549
|
|
|
@@ -9236,6 +9566,7 @@ export default Object.freeze({
|
|
|
9236
9566
|
FfiConverterTypeLightningInvoice,
|
|
9237
9567
|
FfiConverterTypeLightningReceive,
|
|
9238
9568
|
FfiConverterTypeLightningSend,
|
|
9569
|
+
FfiConverterTypeLogLevel,
|
|
9239
9570
|
FfiConverterTypeMovement,
|
|
9240
9571
|
FfiConverterTypeNetwork,
|
|
9241
9572
|
FfiConverterTypeNotificationHolder,
|