@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
package/lib/commonjs/index.js
CHANGED
|
@@ -33,6 +33,18 @@ Object.keys(_WalletNotifications).forEach(function (key) {
|
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
|
+
var _Logger = require("./Logger.js");
|
|
37
|
+
Object.keys(_Logger).forEach(function (key) {
|
|
38
|
+
if (key === "default" || key === "__esModule") return;
|
|
39
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
40
|
+
if (key in exports && exports[key] === _Logger[key]) return;
|
|
41
|
+
Object.defineProperty(exports, key, {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return _Logger[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
36
48
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
37
49
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
38
50
|
// Generated by uniffi-bindgen-react-native
|
|
@@ -72,4 +84,5 @@ async function uniffiInitAsync() {
|
|
|
72
84
|
var _default = exports.default = {
|
|
73
85
|
bark
|
|
74
86
|
}; // Hand-written helpers (appended by patch-bindings.sh).
|
|
87
|
+
// Hand-written helpers (appended by patch-bindings.sh).
|
|
75
88
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_NativeBarkReactNative","_interopRequireDefault","require","bark","_interopRequireWildcard","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_WalletNotifications","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","set","getOwnPropertyDescriptor","rustInstalled","installer","installRustCrate","initialized","initialize","uniffiInitAsync","_default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;AACA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAYA,IAAAC,IAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAH,IAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,IAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,IAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AA8BA,IAAAS,oBAAA,GAAAf,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAW,oBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,oBAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,oBAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;
|
|
1
|
+
{"version":3,"names":["_NativeBarkReactNative","_interopRequireDefault","require","bark","_interopRequireWildcard","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_WalletNotifications","_Logger","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","set","getOwnPropertyDescriptor","rustInstalled","installer","installRustCrate","initialized","initialize","uniffiInitAsync","_default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { LogLevel, setLogger } from "./generated/bark.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A `BarkLogger` that forwards records to the JS `console`.
|
|
7
|
+
*
|
|
8
|
+
* Useful as a default during development. For production, implement
|
|
9
|
+
* `BarkLogger` yourself to forward to Sentry, Reactotron, etc.
|
|
10
|
+
*/
|
|
11
|
+
export class ConsoleBarkLogger {
|
|
12
|
+
log(level, target, message) {
|
|
13
|
+
const line = `[bark][${LogLevel[level]}][${target}] ${message}`;
|
|
14
|
+
switch (level) {
|
|
15
|
+
case LogLevel.Error:
|
|
16
|
+
console.error(line);
|
|
17
|
+
break;
|
|
18
|
+
case LogLevel.Warn:
|
|
19
|
+
console.warn(line);
|
|
20
|
+
break;
|
|
21
|
+
case LogLevel.Info:
|
|
22
|
+
console.info(line);
|
|
23
|
+
break;
|
|
24
|
+
case LogLevel.Debug:
|
|
25
|
+
case LogLevel.Trace:
|
|
26
|
+
console.log(line);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Install a default `ConsoleBarkLogger`. Returns the logger so callers can
|
|
34
|
+
* later detach it via `clearLogger()`.
|
|
35
|
+
*
|
|
36
|
+
* Calling this multiple times replaces the previous logger in-place.
|
|
37
|
+
*/
|
|
38
|
+
export function barkAttachConsoleLogger(maxLevel = LogLevel.Info) {
|
|
39
|
+
const logger = new ConsoleBarkLogger();
|
|
40
|
+
setLogger(logger, maxLevel);
|
|
41
|
+
return logger;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=Logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LogLevel","setLogger","ConsoleBarkLogger","log","level","target","message","line","Error","console","error","Warn","warn","Info","info","Debug","Trace","barkAttachConsoleLogger","maxLevel","logger"],"sourceRoot":"../../src","sources":["Logger.ts"],"mappings":";;AAAA,SAASA,QAAQ,EAAmBC,SAAS,QAAQ,qBAAkB;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,CAAuB;EACnDC,GAAGA,CAACC,KAAe,EAAEC,MAAc,EAAEC,OAAe,EAAQ;IAC1D,MAAMC,IAAI,GAAG,UAAUP,QAAQ,CAACI,KAAK,CAAC,KAAKC,MAAM,KAAKC,OAAO,EAAE;IAC/D,QAAQF,KAAK;MACX,KAAKJ,QAAQ,CAACQ,KAAK;QACjBC,OAAO,CAACC,KAAK,CAACH,IAAI,CAAC;QACnB;MACF,KAAKP,QAAQ,CAACW,IAAI;QAChBF,OAAO,CAACG,IAAI,CAACL,IAAI,CAAC;QAClB;MACF,KAAKP,QAAQ,CAACa,IAAI;QAChBJ,OAAO,CAACK,IAAI,CAACP,IAAI,CAAC;QAClB;MACF,KAAKP,QAAQ,CAACe,KAAK;MACnB,KAAKf,QAAQ,CAACgB,KAAK;QACjBP,OAAO,CAACN,GAAG,CAACI,IAAI,CAAC;QACjB;IACJ;EACF;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASU,uBAAuBA,CACrCC,QAAkB,GAAGlB,QAAQ,CAACa,IAAI,EACtB;EACZ,MAAMM,MAAM,GAAG,IAAIjB,iBAAiB,CAAC,CAAC;EACtCD,SAAS,CAACkB,MAAM,EAAED,QAAQ,CAAC;EAC3B,OAAOC,MAAM;AACf","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getter","globalThis","NativeBark","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/bark-ffi.ts"],"mappings":";;AAAA;AACA;;AAEA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["getter","globalThis","NativeBark","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/bark-ffi.ts"],"mappings":";;AAAA;AACA;;AAEA;AACA;AACA;;AAwqBA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAmC,GAAGA,CAAA,KACzCC,UAAU,CAASC,UAAU;AAChC,eAAeF,MAAM;;AAErB;;AAyKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,8CAGL,GAAG,IAAI;AACR,MAAMC,mCAGL,GAAG,IAAI","ignoreList":[]}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
// @ts-nocheck
|
|
9
9
|
import nativeModule from "./bark-ffi.js";
|
|
10
|
-
import { AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterBool, FfiConverterCallback, FfiConverterInt32, FfiConverterInt64, FfiConverterObject, FfiConverterOptional, FfiConverterUInt16, FfiConverterUInt32, FfiConverterUInt64, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCallWithError, uniffiTypeNameSymbol } from "uniffi-bindgen-react-native";
|
|
10
|
+
import { AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterBool, FfiConverterCallback, FfiConverterInt32, FfiConverterInt64, FfiConverterObject, FfiConverterOptional, FfiConverterUInt16, FfiConverterUInt32, FfiConverterUInt64, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCall, uniffiTraitInterfaceCallWithError, uniffiTypeNameSymbol } from "uniffi-bindgen-react-native";
|
|
11
11
|
|
|
12
12
|
// Get converters from the other files, if any.
|
|
13
13
|
const uniffiCaller = new UniffiRustCaller(() => ({
|
|
@@ -30,6 +30,15 @@ export function generateMnemonic() /*throws*/{
|
|
|
30
30
|
return nativeModule().ubrn_uniffi_bark_ffi_fn_func_generate_mnemonic(callStatus);
|
|
31
31
|
}, /*liftString:*/FfiConverterString.lift));
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Install the foreign log sink. Must be called at most once,
|
|
35
|
+
* subsequent calls return an error
|
|
36
|
+
*/
|
|
37
|
+
export function setLogger(logger, maxLevel) /*throws*/{
|
|
38
|
+
uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError), /*caller:*/callStatus => {
|
|
39
|
+
nativeModule().ubrn_uniffi_bark_ffi_fn_func_set_logger(FfiConverterTypeBarkLogger.lower(logger), FfiConverterTypeLogLevel.lower(maxLevel), callStatus);
|
|
40
|
+
}, /*liftString:*/FfiConverterString.lift);
|
|
41
|
+
}
|
|
33
42
|
export function validateArkAddress(address) /*throws*/{
|
|
34
43
|
return FfiConverterBool.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError), /*caller:*/callStatus => {
|
|
35
44
|
return nativeModule().ubrn_uniffi_bark_ffi_fn_func_validate_ark_address(FfiConverterString.lower(address), callStatus);
|
|
@@ -41,6 +50,46 @@ export function validateMnemonic(mnemonic) /*throws*/{
|
|
|
41
50
|
}, /*liftString:*/FfiConverterString.lift));
|
|
42
51
|
}
|
|
43
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Foreign sink for log records. Implement in Dart/Swift/Kotlin and pass to
|
|
55
|
+
* [set_logger]. The `log()` method must not call back into bark APIs that
|
|
56
|
+
* emit log records.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
60
|
+
const uniffiCallbackInterfaceBarkLogger = {
|
|
61
|
+
// Create the VTable using a series of closures.
|
|
62
|
+
// ts automatically converts these into C callback functions.
|
|
63
|
+
vtable: {
|
|
64
|
+
log: (uniffiHandle, level, target, message) => {
|
|
65
|
+
const uniffiMakeCall = () => {
|
|
66
|
+
const jsCallback = FfiConverterTypeBarkLogger.lift(uniffiHandle);
|
|
67
|
+
return jsCallback.log(FfiConverterTypeLogLevel.lift(level), FfiConverterString.lift(target), FfiConverterString.lift(message));
|
|
68
|
+
};
|
|
69
|
+
const uniffiResult = UniffiResult.ready();
|
|
70
|
+
const uniffiHandleSuccess = obj => {};
|
|
71
|
+
const uniffiHandleError = (code, errBuf) => {
|
|
72
|
+
UniffiResult.writeError(uniffiResult, code, errBuf);
|
|
73
|
+
};
|
|
74
|
+
uniffiTraitInterfaceCall(/*makeCall:*/uniffiMakeCall, /*handleSuccess:*/uniffiHandleSuccess, /*handleError:*/uniffiHandleError, /*lowerString:*/FfiConverterString.lower);
|
|
75
|
+
return uniffiResult;
|
|
76
|
+
},
|
|
77
|
+
uniffiFree: uniffiHandle => {
|
|
78
|
+
// BarkLogger: this will throw a stale handle error if the handle isn't found.
|
|
79
|
+
FfiConverterTypeBarkLogger.drop(uniffiHandle);
|
|
80
|
+
},
|
|
81
|
+
uniffiClone: uniffiHandle => {
|
|
82
|
+
return FfiConverterTypeBarkLogger.clone(uniffiHandle);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
register: () => {
|
|
86
|
+
nativeModule().ubrn_uniffi_bark_ffi_fn_init_callback_vtable_barklogger(uniffiCallbackInterfaceBarkLogger.vtable);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// FfiConverter protocol for callback interfaces
|
|
91
|
+
const FfiConverterTypeBarkLogger = new FfiConverterCallback();
|
|
92
|
+
|
|
44
93
|
/**
|
|
45
94
|
* Callback interface for custom onchain wallet implementations
|
|
46
95
|
*
|
|
@@ -1847,6 +1896,57 @@ const FfiConverterTypeBarkError = (() => {
|
|
|
1847
1896
|
return new FFIConverter();
|
|
1848
1897
|
})();
|
|
1849
1898
|
|
|
1899
|
+
/**
|
|
1900
|
+
* Severity of a log record forwarded to a foreign [BarkLogger].
|
|
1901
|
+
*/
|
|
1902
|
+
export let LogLevel = /*#__PURE__*/function (LogLevel) {
|
|
1903
|
+
LogLevel[LogLevel["Error"] = 0] = "Error";
|
|
1904
|
+
LogLevel[LogLevel["Warn"] = 1] = "Warn";
|
|
1905
|
+
LogLevel[LogLevel["Info"] = 2] = "Info";
|
|
1906
|
+
LogLevel[LogLevel["Debug"] = 3] = "Debug";
|
|
1907
|
+
LogLevel[LogLevel["Trace"] = 4] = "Trace";
|
|
1908
|
+
return LogLevel;
|
|
1909
|
+
}({});
|
|
1910
|
+
const FfiConverterTypeLogLevel = (() => {
|
|
1911
|
+
const ordinalConverter = FfiConverterInt32;
|
|
1912
|
+
class FFIConverter extends AbstractFfiConverterByteArray {
|
|
1913
|
+
read(from) {
|
|
1914
|
+
switch (ordinalConverter.read(from)) {
|
|
1915
|
+
case 1:
|
|
1916
|
+
return LogLevel.Error;
|
|
1917
|
+
case 2:
|
|
1918
|
+
return LogLevel.Warn;
|
|
1919
|
+
case 3:
|
|
1920
|
+
return LogLevel.Info;
|
|
1921
|
+
case 4:
|
|
1922
|
+
return LogLevel.Debug;
|
|
1923
|
+
case 5:
|
|
1924
|
+
return LogLevel.Trace;
|
|
1925
|
+
default:
|
|
1926
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
write(value, into) {
|
|
1930
|
+
switch (value) {
|
|
1931
|
+
case LogLevel.Error:
|
|
1932
|
+
return ordinalConverter.write(1, into);
|
|
1933
|
+
case LogLevel.Warn:
|
|
1934
|
+
return ordinalConverter.write(2, into);
|
|
1935
|
+
case LogLevel.Info:
|
|
1936
|
+
return ordinalConverter.write(3, into);
|
|
1937
|
+
case LogLevel.Debug:
|
|
1938
|
+
return ordinalConverter.write(4, into);
|
|
1939
|
+
case LogLevel.Trace:
|
|
1940
|
+
return ordinalConverter.write(5, into);
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
allocationSize(value) {
|
|
1944
|
+
return ordinalConverter.allocationSize(0);
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
return new FFIConverter();
|
|
1948
|
+
})();
|
|
1949
|
+
|
|
1850
1950
|
/**
|
|
1851
1951
|
* Bitcoin network types
|
|
1852
1952
|
*/
|
|
@@ -2435,6 +2535,28 @@ export class Wallet extends UniffiAbstractObject {
|
|
|
2435
2535
|
}
|
|
2436
2536
|
}
|
|
2437
2537
|
|
|
2538
|
+
/**
|
|
2539
|
+
* Open an existing Bark wallet and start running the daemon,
|
|
2540
|
+
* optionally with onchain capabilities.
|
|
2541
|
+
*
|
|
2542
|
+
* The daemon runs in the background and is stopped when the wallet is dropped.
|
|
2543
|
+
* Callback-based onchain wallets are not supported for daemon mode and the
|
|
2544
|
+
* wallet will be opened without onchain capabilities in that case.
|
|
2545
|
+
*/
|
|
2546
|
+
static async openWithDaemon(mnemonic, config, datadir, onchainWallet, asyncOpts_) /*throws*/{
|
|
2547
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
2548
|
+
try {
|
|
2549
|
+
return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
|
|
2550
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_constructor_wallet_open_with_daemon(FfiConverterString.lower(mnemonic), FfiConverterTypeConfig.lower(config), FfiConverterString.lower(datadir), FfiConverterOptionalTypeOnchainWallet.lower(onchainWallet));
|
|
2551
|
+
}, /*pollFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_poll_u64, /*cancelFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_cancel_u64, /*completeFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_complete_u64, /*freeFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_free_u64, /*liftFunc:*/FfiConverterTypeWallet.lift.bind(FfiConverterTypeWallet), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError));
|
|
2552
|
+
} catch (__error) {
|
|
2553
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
2554
|
+
__error.stack = __stack;
|
|
2555
|
+
}
|
|
2556
|
+
throw __error;
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2438
2560
|
/**
|
|
2439
2561
|
* Open an existing Bark wallet WITH onchain capabilities
|
|
2440
2562
|
*/
|
|
@@ -2551,11 +2673,11 @@ export class Wallet extends UniffiAbstractObject {
|
|
|
2551
2673
|
throw __error;
|
|
2552
2674
|
}
|
|
2553
2675
|
}
|
|
2554
|
-
async bolt11Invoice(amountSats, asyncOpts_) /*throws*/{
|
|
2676
|
+
async bolt11Invoice(amountSats, description, asyncOpts_) /*throws*/{
|
|
2555
2677
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
2556
2678
|
try {
|
|
2557
2679
|
return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
|
|
2558
|
-
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice(uniffiTypeWalletObjectFactory.clonePointer(this), FfiConverterUInt64.lower(amountSats));
|
|
2680
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_bolt11_invoice(uniffiTypeWalletObjectFactory.clonePointer(this), FfiConverterUInt64.lower(amountSats), FfiConverterOptionalString.lower(description));
|
|
2559
2681
|
}, /*pollFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer, /*cancelFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer, /*completeFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer, /*freeFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_free_rust_buffer, /*liftFunc:*/FfiConverterTypeLightningInvoice.lift.bind(FfiConverterTypeLightningInvoice), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError));
|
|
2560
2682
|
} catch (__error) {
|
|
2561
2683
|
if (uniffiIsDebug && __error instanceof Error) {
|
|
@@ -3740,6 +3862,29 @@ export class Wallet extends UniffiAbstractObject {
|
|
|
3740
3862
|
throw __error;
|
|
3741
3863
|
}
|
|
3742
3864
|
}
|
|
3865
|
+
|
|
3866
|
+
/**
|
|
3867
|
+
* Start a background daemon for the wallet.
|
|
3868
|
+
*
|
|
3869
|
+
* The daemon performs periodic syncs, exit progression and other
|
|
3870
|
+
* background work. It is stopped automatically when the wallet is dropped.
|
|
3871
|
+
* Callback-based onchain wallets are not supported for daemon mode and the
|
|
3872
|
+
* daemon will run without onchain capabilities in that case.
|
|
3873
|
+
* Calling this multiple times stops the previous daemon and starts a new one.
|
|
3874
|
+
*/
|
|
3875
|
+
async runDaemon(onchainWallet, asyncOpts_) /*throws*/{
|
|
3876
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
3877
|
+
try {
|
|
3878
|
+
return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
|
|
3879
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_run_daemon(uniffiTypeWalletObjectFactory.clonePointer(this), FfiConverterOptionalTypeOnchainWallet.lower(onchainWallet));
|
|
3880
|
+
}, /*pollFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_poll_void, /*cancelFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_cancel_void, /*completeFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_complete_void, /*freeFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_free_void, /*liftFunc:*/_v => {}, /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError));
|
|
3881
|
+
} catch (__error) {
|
|
3882
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
3883
|
+
__error.stack = __stack;
|
|
3884
|
+
}
|
|
3885
|
+
throw __error;
|
|
3886
|
+
}
|
|
3887
|
+
}
|
|
3743
3888
|
async sendArkoorPayment(arkAddress, amountSats, asyncOpts_) /*throws*/{
|
|
3744
3889
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
3745
3890
|
try {
|
|
@@ -3846,6 +3991,23 @@ export class Wallet extends UniffiAbstractObject {
|
|
|
3846
3991
|
}
|
|
3847
3992
|
}
|
|
3848
3993
|
|
|
3994
|
+
/**
|
|
3995
|
+
* Stop the running daemon if any. No-op otherwise.
|
|
3996
|
+
*/
|
|
3997
|
+
async stopDaemon(asyncOpts_) /*throws*/{
|
|
3998
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
3999
|
+
try {
|
|
4000
|
+
return await uniffiRustCallAsync(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
|
|
4001
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_stop_daemon(uniffiTypeWalletObjectFactory.clonePointer(this));
|
|
4002
|
+
}, /*pollFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_poll_void, /*cancelFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_cancel_void, /*completeFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_complete_void, /*freeFunc:*/nativeModule().ubrn_ffi_bark_ffi_rust_future_free_void, /*liftFunc:*/_v => {}, /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError));
|
|
4003
|
+
} catch (__error) {
|
|
4004
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
4005
|
+
__error.stack = __stack;
|
|
4006
|
+
}
|
|
4007
|
+
throw __error;
|
|
4008
|
+
}
|
|
4009
|
+
}
|
|
4010
|
+
|
|
3849
4011
|
/**
|
|
3850
4012
|
* Lightweight sync with Ark server and blockchain
|
|
3851
4013
|
* Note: Bark's sync() handles errors internally with logging.
|
|
@@ -4080,6 +4242,9 @@ const FfiConverterArrayString = new FfiConverterArray(FfiConverterString);
|
|
|
4080
4242
|
// FfiConverter for WalletNotification | undefined
|
|
4081
4243
|
const FfiConverterOptionalTypeWalletNotification = new FfiConverterOptional(FfiConverterTypeWalletNotification);
|
|
4082
4244
|
|
|
4245
|
+
// FfiConverter for OnchainWalletLike | undefined
|
|
4246
|
+
const FfiConverterOptionalTypeOnchainWallet = new FfiConverterOptional(FfiConverterTypeOnchainWallet);
|
|
4247
|
+
|
|
4083
4248
|
// FfiConverter for Array<string> | undefined
|
|
4084
4249
|
const FfiConverterOptionalArrayString = new FfiConverterOptional(FfiConverterArrayString);
|
|
4085
4250
|
|
|
@@ -4107,6 +4272,9 @@ function uniffiEnsureInitialized() {
|
|
|
4107
4272
|
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_func_generate_mnemonic() !== 49933) {
|
|
4108
4273
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_func_generate_mnemonic");
|
|
4109
4274
|
}
|
|
4275
|
+
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_func_set_logger() !== 62790) {
|
|
4276
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_func_set_logger");
|
|
4277
|
+
}
|
|
4110
4278
|
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_func_validate_ark_address() !== 49932) {
|
|
4111
4279
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_func_validate_ark_address");
|
|
4112
4280
|
}
|
|
@@ -4149,7 +4317,7 @@ function uniffiEnsureInitialized() {
|
|
|
4149
4317
|
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_board_amount() !== 57213) {
|
|
4150
4318
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_board_amount");
|
|
4151
4319
|
}
|
|
4152
|
-
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_bolt11_invoice() !==
|
|
4320
|
+
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_bolt11_invoice() !== 47558) {
|
|
4153
4321
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_bolt11_invoice");
|
|
4154
4322
|
}
|
|
4155
4323
|
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_broadcast_tx() !== 10756) {
|
|
@@ -4344,6 +4512,9 @@ function uniffiEnsureInitialized() {
|
|
|
4344
4512
|
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_delegated() !== 16216) {
|
|
4345
4513
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_refresh_vtxos_delegated");
|
|
4346
4514
|
}
|
|
4515
|
+
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_run_daemon() !== 21553) {
|
|
4516
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_run_daemon");
|
|
4517
|
+
}
|
|
4347
4518
|
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment() !== 30372) {
|
|
4348
4519
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment");
|
|
4349
4520
|
}
|
|
@@ -4362,6 +4533,9 @@ function uniffiEnsureInitialized() {
|
|
|
4362
4533
|
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_start_exit_for_vtxos() !== 26632) {
|
|
4363
4534
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_start_exit_for_vtxos");
|
|
4364
4535
|
}
|
|
4536
|
+
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_stop_daemon() !== 9450) {
|
|
4537
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_stop_daemon");
|
|
4538
|
+
}
|
|
4365
4539
|
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_sync() !== 22105) {
|
|
4366
4540
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_sync");
|
|
4367
4541
|
}
|
|
@@ -4398,9 +4572,15 @@ function uniffiEnsureInitialized() {
|
|
|
4398
4572
|
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open() !== 31794) {
|
|
4399
4573
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_constructor_wallet_open");
|
|
4400
4574
|
}
|
|
4575
|
+
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open_with_daemon() !== 8446) {
|
|
4576
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_constructor_wallet_open_with_daemon");
|
|
4577
|
+
}
|
|
4401
4578
|
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_constructor_wallet_open_with_onchain() !== 22896) {
|
|
4402
4579
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_constructor_wallet_open_with_onchain");
|
|
4403
4580
|
}
|
|
4581
|
+
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_barklogger_log() !== 1414) {
|
|
4582
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_barklogger_log");
|
|
4583
|
+
}
|
|
4404
4584
|
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_get_balance() !== 16407) {
|
|
4405
4585
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_get_balance");
|
|
4406
4586
|
}
|
|
@@ -4428,6 +4608,7 @@ function uniffiEnsureInitialized() {
|
|
|
4428
4608
|
if (nativeModule().ubrn_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_store_signed_p2a_cpfp() !== 41685) {
|
|
4429
4609
|
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_store_signed_p2a_cpfp");
|
|
4430
4610
|
}
|
|
4611
|
+
uniffiCallbackInterfaceBarkLogger.register();
|
|
4431
4612
|
uniffiCallbackInterfaceCustomOnchainWalletCallbacks.register();
|
|
4432
4613
|
}
|
|
4433
4614
|
export default Object.freeze({
|
|
@@ -4449,6 +4630,7 @@ export default Object.freeze({
|
|
|
4449
4630
|
FfiConverterTypeLightningInvoice,
|
|
4450
4631
|
FfiConverterTypeLightningReceive,
|
|
4451
4632
|
FfiConverterTypeLightningSend,
|
|
4633
|
+
FfiConverterTypeLogLevel,
|
|
4452
4634
|
FfiConverterTypeMovement,
|
|
4453
4635
|
FfiConverterTypeNetwork,
|
|
4454
4636
|
FfiConverterTypeNotificationHolder,
|