@secondts/bark-react-native 0.2.0-beta.1 → 0.3.0-beta.1
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 +2 -2
- package/cpp/generated/bark.cpp +8716 -6407
- package/cpp/generated/bark.hpp +912 -235
- package/lib/commonjs/WalletNotifications.js +82 -0
- package/lib/commonjs/WalletNotifications.js.map +1 -0
- package/lib/commonjs/generated/bark-ffi.js.map +1 -1
- package/lib/commonjs/generated/bark.js +347 -6
- package/lib/commonjs/generated/bark.js.map +1 -1
- package/lib/commonjs/index.js +13 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/WalletNotifications.js +77 -0
- package/lib/module/WalletNotifications.js.map +1 -0
- package/lib/module/generated/bark-ffi.js.map +1 -1
- package/lib/module/generated/bark.js +346 -6
- 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/WalletNotifications.d.ts +41 -0
- package/lib/typescript/commonjs/src/WalletNotifications.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts +62 -1
- package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/generated/bark.d.ts +254 -4
- 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/WalletNotifications.d.ts +41 -0
- package/lib/typescript/module/src/WalletNotifications.d.ts.map +1 -0
- package/lib/typescript/module/src/generated/bark-ffi.d.ts +62 -1
- package/lib/typescript/module/src/generated/bark-ffi.d.ts.map +1 -1
- package/lib/typescript/module/src/generated/bark.d.ts +254 -4
- 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 +5 -7
- package/src/WalletNotifications.ts +86 -0
- package/src/generated/bark-ffi.ts +172 -1
- package/src/generated/bark.ts +584 -17
- package/src/index.tsx +3 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WalletNotifications = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Wraps the pull-based {@link NotificationHolderInterface} into a subscribe/unsubscribe API.
|
|
9
|
+
*
|
|
10
|
+
* The internal polling loop starts when the first listener subscribes and stops when the
|
|
11
|
+
* last listener unsubscribes. Re-subscribing after all listeners have been removed creates
|
|
12
|
+
* a fresh {@link NotificationHolderInterface} and restarts the loop.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const notifications = new WalletNotifications(wallet);
|
|
17
|
+
*
|
|
18
|
+
* const unsubscribe = notifications.subscribe((event) => {
|
|
19
|
+
* switch (event.tag) {
|
|
20
|
+
* case WalletNotification_Tags.MovementCreated:
|
|
21
|
+
* console.log('movement created', event.inner.movement);
|
|
22
|
+
* break;
|
|
23
|
+
* case WalletNotification_Tags.MovementUpdated:
|
|
24
|
+
* console.log('movement updated', event.inner.movement);
|
|
25
|
+
* break;
|
|
26
|
+
* case WalletNotification_Tags.ChannelLagging:
|
|
27
|
+
* console.log('channel lagging');
|
|
28
|
+
* break;
|
|
29
|
+
* }
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // later…
|
|
33
|
+
* unsubscribe();
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
class WalletNotifications {
|
|
37
|
+
holder = null;
|
|
38
|
+
listeners = new Set();
|
|
39
|
+
constructor(wallet) {
|
|
40
|
+
this.wallet = wallet;
|
|
41
|
+
}
|
|
42
|
+
subscribe(listener) {
|
|
43
|
+
this.listeners.add(listener);
|
|
44
|
+
if (this.listeners.size === 1) {
|
|
45
|
+
this.startLoop();
|
|
46
|
+
}
|
|
47
|
+
return () => {
|
|
48
|
+
this.listeners.delete(listener);
|
|
49
|
+
if (this.listeners.size === 0) {
|
|
50
|
+
this.holder?.cancelNextNotificationWait();
|
|
51
|
+
this.holder = null;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
startLoop() {
|
|
56
|
+
const localHolder = this.wallet.notifications();
|
|
57
|
+
this.holder = localHolder;
|
|
58
|
+
(async () => {
|
|
59
|
+
try {
|
|
60
|
+
while (true) {
|
|
61
|
+
const event = await localHolder.nextNotification();
|
|
62
|
+
if (event == null) break;
|
|
63
|
+
for (const listener of this.listeners) {
|
|
64
|
+
try {
|
|
65
|
+
listener(event);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
console.error('Wallet notification listener failed', err);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} catch (err) {
|
|
72
|
+
console.error('Wallet notification loop failed', err);
|
|
73
|
+
} finally {
|
|
74
|
+
if (this.holder === localHolder) {
|
|
75
|
+
this.holder = null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
})();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.WalletNotifications = WalletNotifications;
|
|
82
|
+
//# sourceMappingURL=WalletNotifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WalletNotifications","holder","listeners","Set","constructor","wallet","subscribe","listener","add","size","startLoop","delete","cancelNextNotificationWait","localHolder","notifications","event","nextNotification","err","console","error","exports"],"sourceRoot":"../../src","sources":["WalletNotifications.ts"],"mappings":";;;;;;AAQA;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;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,CAAC;EACvBC,MAAM,GAAuC,IAAI;EACxCC,SAAS,GAAG,IAAIC,GAAG,CAAsC,CAAC;EAE3EC,WAAWA,CAAkBC,MAAuB,EAAE;IAAA,KAAzBA,MAAuB,GAAvBA,MAAuB;EAAG;EAEvDC,SAASA,CAACC,QAA6C,EAAe;IACpE,IAAI,CAACL,SAAS,CAACM,GAAG,CAACD,QAAQ,CAAC;IAE5B,IAAI,IAAI,CAACL,SAAS,CAACO,IAAI,KAAK,CAAC,EAAE;MAC7B,IAAI,CAACC,SAAS,CAAC,CAAC;IAClB;IAEA,OAAO,MAAM;MACX,IAAI,CAACR,SAAS,CAACS,MAAM,CAACJ,QAAQ,CAAC;MAC/B,IAAI,IAAI,CAACL,SAAS,CAACO,IAAI,KAAK,CAAC,EAAE;QAC7B,IAAI,CAACR,MAAM,EAAEW,0BAA0B,CAAC,CAAC;QACzC,IAAI,CAACX,MAAM,GAAG,IAAI;MACpB;IACF,CAAC;EACH;EAEQS,SAASA,CAAA,EAAS;IACxB,MAAMG,WAAW,GAAG,IAAI,CAACR,MAAM,CAACS,aAAa,CAAC,CAAC;IAC/C,IAAI,CAACb,MAAM,GAAGY,WAAW;IAEzB,CAAC,YAAY;MACX,IAAI;QACF,OAAO,IAAI,EAAE;UACX,MAAME,KAAK,GAAG,MAAMF,WAAW,CAACG,gBAAgB,CAAC,CAAC;UAClD,IAAID,KAAK,IAAI,IAAI,EAAE;UACnB,KAAK,MAAMR,QAAQ,IAAI,IAAI,CAACL,SAAS,EAAE;YACrC,IAAI;cACFK,QAAQ,CAACQ,KAAK,CAAC;YACjB,CAAC,CAAC,OAAOE,GAAG,EAAE;cACZC,OAAO,CAACC,KAAK,CAAC,qCAAqC,EAAEF,GAAG,CAAC;YAC3D;UACF;QACF;MACF,CAAC,CAAC,OAAOA,GAAG,EAAE;QACZC,OAAO,CAACC,KAAK,CAAC,iCAAiC,EAAEF,GAAG,CAAC;MACvD,CAAC,SAAS;QACR,IAAI,IAAI,CAAChB,MAAM,KAAKY,WAAW,EAAE;UAC/B,IAAI,CAACZ,MAAM,GAAG,IAAI;QACpB;MACF;IACF,CAAC,EAAE,CAAC;EACN;AACF;AAACmB,OAAA,CAAApB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getter","globalThis","NativeBark","_default","exports","default","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/bark-ffi.ts"],"mappings":";;;;;;AAAA;AACA;;AAEA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["getter","globalThis","NativeBark","_default","exports","default","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/bark-ffi.ts"],"mappings":";;;;;;AAAA;AACA;;AAEA;AACA;AACA;;AA4vBA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAmC,GAAGA,CAAA,KACzCC,UAAU,CAASC,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAClBL,MAAM,EAErB;AA8JA;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,MAAMM,8CAGL,GAAG,IAAI;AACR,MAAMC,mCAGL,GAAG,IAAI","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.WalletProperties = exports.Wallet = exports.Vtxo = exports.RoundState = exports.PendingBoard = exports.OutPoint = exports.OnchainWallet = exports.OnchainBalance = exports.OffboardResult = exports.Network = exports.Movement = exports.LightningSend = exports.LightningReceive = exports.LightningInvoice = exports.ExitVtxo = exports.ExitTransactionStatus = exports.ExitProgressStatus = exports.ExitClaimTransaction = exports.Destination = exports.CpfpParams = exports.Config = exports.BlockRef = exports.BarkError_Tags = exports.BarkError = exports.Balance = exports.ArkInfo = exports.AddressWithIndex = void 0;
|
|
6
|
+
exports.default = exports.WalletProperties = exports.WalletNotification_Tags = exports.WalletNotification = exports.Wallet = exports.Vtxo = exports.RoundState = exports.PendingBoard = exports.OutPoint = exports.OnchainWallet = exports.OnchainBalance = exports.OffboardResult = exports.NotificationHolder = exports.Network = exports.Movement = exports.LightningSend = exports.LightningReceive = exports.LightningInvoice = exports.ExitVtxo = exports.ExitTransactionStatus = exports.ExitProgressStatus = exports.ExitClaimTransaction = exports.Destination = exports.CpfpParams = exports.Config = exports.BlockRef = exports.BarkError_Tags = exports.BarkError = exports.Balance = exports.ArkInfo = exports.AddressWithIndex = void 0;
|
|
7
7
|
exports.extractTxFromPsbt = extractTxFromPsbt;
|
|
8
8
|
exports.generateMnemonic = generateMnemonic;
|
|
9
9
|
exports.validateArkAddress = validateArkAddress;
|
|
@@ -2097,6 +2097,291 @@ const FfiConverterTypeNetwork = (() => {
|
|
|
2097
2097
|
return new FFIConverter();
|
|
2098
2098
|
})();
|
|
2099
2099
|
|
|
2100
|
+
// Enum: WalletNotification
|
|
2101
|
+
let WalletNotification_Tags = exports.WalletNotification_Tags = /*#__PURE__*/function (WalletNotification_Tags) {
|
|
2102
|
+
WalletNotification_Tags["MovementCreated"] = "MovementCreated";
|
|
2103
|
+
WalletNotification_Tags["MovementUpdated"] = "MovementUpdated";
|
|
2104
|
+
WalletNotification_Tags["ChannelLagging"] = "ChannelLagging";
|
|
2105
|
+
return WalletNotification_Tags;
|
|
2106
|
+
}({});
|
|
2107
|
+
/**
|
|
2108
|
+
* A notification event from the wallet
|
|
2109
|
+
*/
|
|
2110
|
+
const WalletNotification = exports.WalletNotification = (() => {
|
|
2111
|
+
/**
|
|
2112
|
+
* A new movement was created
|
|
2113
|
+
*/
|
|
2114
|
+
class MovementCreated_ extends _uniffiBindgenReactNative.UniffiEnum {
|
|
2115
|
+
/**
|
|
2116
|
+
* @private
|
|
2117
|
+
* This field is private and should not be used, use `tag` instead.
|
|
2118
|
+
*/
|
|
2119
|
+
[_uniffiBindgenReactNative.uniffiTypeNameSymbol] = "WalletNotification";
|
|
2120
|
+
tag = WalletNotification_Tags.MovementCreated;
|
|
2121
|
+
constructor(inner) {
|
|
2122
|
+
super("WalletNotification", "MovementCreated");
|
|
2123
|
+
this.inner = Object.freeze(inner);
|
|
2124
|
+
}
|
|
2125
|
+
static new(inner) {
|
|
2126
|
+
return new MovementCreated_(inner);
|
|
2127
|
+
}
|
|
2128
|
+
static instanceOf(obj) {
|
|
2129
|
+
return obj.tag === WalletNotification_Tags.MovementCreated;
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
/**
|
|
2133
|
+
* An existing movement was updated
|
|
2134
|
+
*/
|
|
2135
|
+
class MovementUpdated_ extends _uniffiBindgenReactNative.UniffiEnum {
|
|
2136
|
+
/**
|
|
2137
|
+
* @private
|
|
2138
|
+
* This field is private and should not be used, use `tag` instead.
|
|
2139
|
+
*/
|
|
2140
|
+
[_uniffiBindgenReactNative.uniffiTypeNameSymbol] = "WalletNotification";
|
|
2141
|
+
tag = WalletNotification_Tags.MovementUpdated;
|
|
2142
|
+
constructor(inner) {
|
|
2143
|
+
super("WalletNotification", "MovementUpdated");
|
|
2144
|
+
this.inner = Object.freeze(inner);
|
|
2145
|
+
}
|
|
2146
|
+
static new(inner) {
|
|
2147
|
+
return new MovementUpdated_(inner);
|
|
2148
|
+
}
|
|
2149
|
+
static instanceOf(obj) {
|
|
2150
|
+
return obj.tag === WalletNotification_Tags.MovementUpdated;
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
/**
|
|
2154
|
+
* The notification channel is lagging (some notifications were dropped)
|
|
2155
|
+
*/
|
|
2156
|
+
class ChannelLagging_ extends _uniffiBindgenReactNative.UniffiEnum {
|
|
2157
|
+
/**
|
|
2158
|
+
* @private
|
|
2159
|
+
* This field is private and should not be used, use `tag` instead.
|
|
2160
|
+
*/
|
|
2161
|
+
[_uniffiBindgenReactNative.uniffiTypeNameSymbol] = "WalletNotification";
|
|
2162
|
+
tag = WalletNotification_Tags.ChannelLagging;
|
|
2163
|
+
constructor() {
|
|
2164
|
+
super("WalletNotification", "ChannelLagging");
|
|
2165
|
+
}
|
|
2166
|
+
static new() {
|
|
2167
|
+
return new ChannelLagging_();
|
|
2168
|
+
}
|
|
2169
|
+
static instanceOf(obj) {
|
|
2170
|
+
return obj.tag === WalletNotification_Tags.ChannelLagging;
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
function instanceOf(obj) {
|
|
2174
|
+
return obj[_uniffiBindgenReactNative.uniffiTypeNameSymbol] === "WalletNotification";
|
|
2175
|
+
}
|
|
2176
|
+
return Object.freeze({
|
|
2177
|
+
instanceOf,
|
|
2178
|
+
MovementCreated: MovementCreated_,
|
|
2179
|
+
MovementUpdated: MovementUpdated_,
|
|
2180
|
+
ChannelLagging: ChannelLagging_
|
|
2181
|
+
});
|
|
2182
|
+
})();
|
|
2183
|
+
|
|
2184
|
+
/**
|
|
2185
|
+
* A notification event from the wallet
|
|
2186
|
+
*/
|
|
2187
|
+
|
|
2188
|
+
// FfiConverter for enum WalletNotification
|
|
2189
|
+
const FfiConverterTypeWalletNotification = (() => {
|
|
2190
|
+
const ordinalConverter = _uniffiBindgenReactNative.FfiConverterInt32;
|
|
2191
|
+
class FFIConverter extends _uniffiBindgenReactNative.AbstractFfiConverterByteArray {
|
|
2192
|
+
read(from) {
|
|
2193
|
+
switch (ordinalConverter.read(from)) {
|
|
2194
|
+
case 1:
|
|
2195
|
+
return new WalletNotification.MovementCreated({
|
|
2196
|
+
movement: FfiConverterTypeMovement.read(from)
|
|
2197
|
+
});
|
|
2198
|
+
case 2:
|
|
2199
|
+
return new WalletNotification.MovementUpdated({
|
|
2200
|
+
movement: FfiConverterTypeMovement.read(from)
|
|
2201
|
+
});
|
|
2202
|
+
case 3:
|
|
2203
|
+
return new WalletNotification.ChannelLagging();
|
|
2204
|
+
default:
|
|
2205
|
+
throw new _uniffiBindgenReactNative.UniffiInternalError.UnexpectedEnumCase();
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
write(value, into) {
|
|
2209
|
+
switch (value.tag) {
|
|
2210
|
+
case WalletNotification_Tags.MovementCreated:
|
|
2211
|
+
{
|
|
2212
|
+
ordinalConverter.write(1, into);
|
|
2213
|
+
const inner = value.inner;
|
|
2214
|
+
FfiConverterTypeMovement.write(inner.movement, into);
|
|
2215
|
+
return;
|
|
2216
|
+
}
|
|
2217
|
+
case WalletNotification_Tags.MovementUpdated:
|
|
2218
|
+
{
|
|
2219
|
+
ordinalConverter.write(2, into);
|
|
2220
|
+
const inner = value.inner;
|
|
2221
|
+
FfiConverterTypeMovement.write(inner.movement, into);
|
|
2222
|
+
return;
|
|
2223
|
+
}
|
|
2224
|
+
case WalletNotification_Tags.ChannelLagging:
|
|
2225
|
+
{
|
|
2226
|
+
ordinalConverter.write(3, into);
|
|
2227
|
+
return;
|
|
2228
|
+
}
|
|
2229
|
+
default:
|
|
2230
|
+
// Throwing from here means that WalletNotification_Tags hasn't matched an ordinal.
|
|
2231
|
+
throw new _uniffiBindgenReactNative.UniffiInternalError.UnexpectedEnumCase();
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
allocationSize(value) {
|
|
2235
|
+
switch (value.tag) {
|
|
2236
|
+
case WalletNotification_Tags.MovementCreated:
|
|
2237
|
+
{
|
|
2238
|
+
const inner = value.inner;
|
|
2239
|
+
let size = ordinalConverter.allocationSize(1);
|
|
2240
|
+
size += FfiConverterTypeMovement.allocationSize(inner.movement);
|
|
2241
|
+
return size;
|
|
2242
|
+
}
|
|
2243
|
+
case WalletNotification_Tags.MovementUpdated:
|
|
2244
|
+
{
|
|
2245
|
+
const inner = value.inner;
|
|
2246
|
+
let size = ordinalConverter.allocationSize(2);
|
|
2247
|
+
size += FfiConverterTypeMovement.allocationSize(inner.movement);
|
|
2248
|
+
return size;
|
|
2249
|
+
}
|
|
2250
|
+
case WalletNotification_Tags.ChannelLagging:
|
|
2251
|
+
{
|
|
2252
|
+
return ordinalConverter.allocationSize(3);
|
|
2253
|
+
}
|
|
2254
|
+
default:
|
|
2255
|
+
throw new _uniffiBindgenReactNative.UniffiInternalError.UnexpectedEnumCase();
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
return new FFIConverter();
|
|
2260
|
+
})();
|
|
2261
|
+
|
|
2262
|
+
/**
|
|
2263
|
+
* Pull-based handle for consuming wallet notifications.
|
|
2264
|
+
*
|
|
2265
|
+
* Obtain via `Wallet.notifications()`. Call `next_notification()` in a loop
|
|
2266
|
+
* to receive events. Call `cancel_next_notification_wait()` to unblock a
|
|
2267
|
+
* pending wait without destroying the underlying stream.
|
|
2268
|
+
*
|
|
2269
|
+
* Each call to `Wallet.notifications()` creates an independent stream backed
|
|
2270
|
+
* by a new broadcast receiver. Only one consumer loop per holder is assumed.
|
|
2271
|
+
*/
|
|
2272
|
+
|
|
2273
|
+
/**
|
|
2274
|
+
* Pull-based handle for consuming wallet notifications.
|
|
2275
|
+
*
|
|
2276
|
+
* Obtain via `Wallet.notifications()`. Call `next_notification()` in a loop
|
|
2277
|
+
* to receive events. Call `cancel_next_notification_wait()` to unblock a
|
|
2278
|
+
* pending wait without destroying the underlying stream.
|
|
2279
|
+
*
|
|
2280
|
+
* Each call to `Wallet.notifications()` creates an independent stream backed
|
|
2281
|
+
* by a new broadcast receiver. Only one consumer loop per holder is assumed.
|
|
2282
|
+
*/
|
|
2283
|
+
class NotificationHolder extends _uniffiBindgenReactNative.UniffiAbstractObject {
|
|
2284
|
+
[_uniffiBindgenReactNative.uniffiTypeNameSymbol] = "NotificationHolder";
|
|
2285
|
+
// No primary constructor declared for this class.
|
|
2286
|
+
constructor(pointer) {
|
|
2287
|
+
super();
|
|
2288
|
+
this[_uniffiBindgenReactNative.pointerLiteralSymbol] = pointer;
|
|
2289
|
+
this[_uniffiBindgenReactNative.destructorGuardSymbol] = uniffiTypeNotificationHolderObjectFactory.bless(pointer);
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
/**
|
|
2293
|
+
* Cancel the currently pending `next_notification()` wait.
|
|
2294
|
+
*
|
|
2295
|
+
* Causes a blocked `next_notification()` to return null.
|
|
2296
|
+
* Has no effect when no wait is active.
|
|
2297
|
+
* Does NOT destroy the underlying stream; subsequent calls to
|
|
2298
|
+
* `next_notification()` will still work.
|
|
2299
|
+
*/
|
|
2300
|
+
cancelNextNotificationWait() {
|
|
2301
|
+
uniffiCaller.rustCall(/*caller:*/callStatus => {
|
|
2302
|
+
(0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_method_notificationholder_cancel_next_notification_wait(uniffiTypeNotificationHolderObjectFactory.clonePointer(this), callStatus);
|
|
2303
|
+
}, /*liftString:*/FfiConverterString.lift);
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
/**
|
|
2307
|
+
* Wait for the next notification.
|
|
2308
|
+
*
|
|
2309
|
+
* Returns null if the wait was cancelled via `cancel_next_notification_wait()`
|
|
2310
|
+
* or if the wallet's notification source was shut down permanently.
|
|
2311
|
+
*
|
|
2312
|
+
* After a cancellation this method can be called again normally — the
|
|
2313
|
+
* underlying stream is preserved and a fresh cancel channel is set up on
|
|
2314
|
+
* every entry.
|
|
2315
|
+
*
|
|
2316
|
+
* Throws `BarkError.Internal` if called concurrently on the same holder.
|
|
2317
|
+
*/
|
|
2318
|
+
async nextNotification(asyncOpts_) /*throws*/{
|
|
2319
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
2320
|
+
try {
|
|
2321
|
+
return await (0, _uniffiBindgenReactNative.uniffiRustCallAsync)(/*rustCaller:*/uniffiCaller, /*rustFutureFunc:*/() => {
|
|
2322
|
+
return (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_method_notificationholder_next_notification(uniffiTypeNotificationHolderObjectFactory.clonePointer(this));
|
|
2323
|
+
}, /*pollFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer, /*cancelFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer, /*completeFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer, /*freeFunc:*/(0, _barkFfi.default)().ubrn_ffi_bark_ffi_rust_future_free_rust_buffer, /*liftFunc:*/FfiConverterOptionalTypeWalletNotification.lift.bind(FfiConverterOptionalTypeWalletNotification), /*liftString:*/FfiConverterString.lift, /*asyncOpts:*/asyncOpts_, /*errorHandler:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError));
|
|
2324
|
+
} catch (__error) {
|
|
2325
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
2326
|
+
__error.stack = __stack;
|
|
2327
|
+
}
|
|
2328
|
+
throw __error;
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
/**
|
|
2333
|
+
* {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
|
|
2334
|
+
*/
|
|
2335
|
+
uniffiDestroy() {
|
|
2336
|
+
const ptr = this[_uniffiBindgenReactNative.destructorGuardSymbol];
|
|
2337
|
+
if (ptr !== undefined) {
|
|
2338
|
+
const pointer = uniffiTypeNotificationHolderObjectFactory.pointer(this);
|
|
2339
|
+
uniffiTypeNotificationHolderObjectFactory.freePointer(pointer);
|
|
2340
|
+
uniffiTypeNotificationHolderObjectFactory.unbless(ptr);
|
|
2341
|
+
delete this[_uniffiBindgenReactNative.destructorGuardSymbol];
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
static instanceOf(obj) {
|
|
2345
|
+
return uniffiTypeNotificationHolderObjectFactory.isConcreteType(obj);
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
exports.NotificationHolder = NotificationHolder;
|
|
2349
|
+
const uniffiTypeNotificationHolderObjectFactory = (() => {
|
|
2350
|
+
return {
|
|
2351
|
+
create(pointer) {
|
|
2352
|
+
const instance = Object.create(NotificationHolder.prototype);
|
|
2353
|
+
instance[_uniffiBindgenReactNative.pointerLiteralSymbol] = pointer;
|
|
2354
|
+
instance[_uniffiBindgenReactNative.destructorGuardSymbol] = this.bless(pointer);
|
|
2355
|
+
instance[_uniffiBindgenReactNative.uniffiTypeNameSymbol] = "NotificationHolder";
|
|
2356
|
+
return instance;
|
|
2357
|
+
},
|
|
2358
|
+
bless(p) {
|
|
2359
|
+
return uniffiCaller.rustCall(/*caller:*/status => (0, _barkFfi.default)().ubrn_uniffi_internal_fn_method_notificationholder_ffi__bless_pointer(p, status), /*liftString:*/FfiConverterString.lift);
|
|
2360
|
+
},
|
|
2361
|
+
unbless(ptr) {
|
|
2362
|
+
ptr.markDestroyed();
|
|
2363
|
+
},
|
|
2364
|
+
pointer(obj) {
|
|
2365
|
+
if (obj[_uniffiBindgenReactNative.destructorGuardSymbol] === undefined) {
|
|
2366
|
+
throw new _uniffiBindgenReactNative.UniffiInternalError.UnexpectedNullPointer();
|
|
2367
|
+
}
|
|
2368
|
+
return obj[_uniffiBindgenReactNative.pointerLiteralSymbol];
|
|
2369
|
+
},
|
|
2370
|
+
clonePointer(obj) {
|
|
2371
|
+
const pointer = this.pointer(obj);
|
|
2372
|
+
return uniffiCaller.rustCall(/*caller:*/callStatus => (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_clone_notificationholder(pointer, callStatus), /*liftString:*/FfiConverterString.lift);
|
|
2373
|
+
},
|
|
2374
|
+
freePointer(pointer) {
|
|
2375
|
+
uniffiCaller.rustCall(/*caller:*/callStatus => (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_free_notificationholder(pointer, callStatus), /*liftString:*/FfiConverterString.lift);
|
|
2376
|
+
},
|
|
2377
|
+
isConcreteType(obj) {
|
|
2378
|
+
return obj[_uniffiBindgenReactNative.destructorGuardSymbol] && obj[_uniffiBindgenReactNative.uniffiTypeNameSymbol] === "NotificationHolder";
|
|
2379
|
+
}
|
|
2380
|
+
};
|
|
2381
|
+
})();
|
|
2382
|
+
// FfiConverter for NotificationHolderInterface
|
|
2383
|
+
const FfiConverterTypeNotificationHolder = new _uniffiBindgenReactNative.FfiConverterObject(uniffiTypeNotificationHolderObjectFactory);
|
|
2384
|
+
|
|
2100
2385
|
/**
|
|
2101
2386
|
* Onchain Bitcoin wallet for boarding and exits
|
|
2102
2387
|
*
|
|
@@ -2629,6 +2914,20 @@ class Wallet extends _uniffiBindgenReactNative.UniffiAbstractObject {
|
|
|
2629
2914
|
}, /*liftString:*/FfiConverterString.lift));
|
|
2630
2915
|
}
|
|
2631
2916
|
|
|
2917
|
+
/**
|
|
2918
|
+
* Get wallet movements filtered by payment method
|
|
2919
|
+
*
|
|
2920
|
+
* # Arguments
|
|
2921
|
+
*
|
|
2922
|
+
* * `payment_method_type` - Type (e.g. "ark", "bitcoin", "invoice", "offer", "lightning_address", "custom")
|
|
2923
|
+
* * `payment_method_value` - Value (e.g. an address or invoice string)
|
|
2924
|
+
*/
|
|
2925
|
+
historyByPaymentMethod(paymentMethodType, paymentMethodValue) /*throws*/{
|
|
2926
|
+
return FfiConverterArrayTypeMovement.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError), /*caller:*/callStatus => {
|
|
2927
|
+
return (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_method_wallet_history_by_payment_method(uniffiTypeWalletObjectFactory.clonePointer(this), FfiConverterString.lower(paymentMethodType), FfiConverterString.lower(paymentMethodValue), callStatus);
|
|
2928
|
+
}, /*liftString:*/FfiConverterString.lift));
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2632
2931
|
/**
|
|
2633
2932
|
* Import a serialized VTXO into the wallet
|
|
2634
2933
|
*
|
|
@@ -2788,6 +3087,19 @@ class Wallet extends _uniffiBindgenReactNative.UniffiAbstractObject {
|
|
|
2788
3087
|
return (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_method_wallet_next_round_start_time(uniffiTypeWalletObjectFactory.clonePointer(this), callStatus);
|
|
2789
3088
|
}, /*liftString:*/FfiConverterString.lift));
|
|
2790
3089
|
}
|
|
3090
|
+
|
|
3091
|
+
/**
|
|
3092
|
+
* Get a pull-based notification holder for this wallet.
|
|
3093
|
+
*
|
|
3094
|
+
* Call `next_notification()` in a loop to receive events.
|
|
3095
|
+
* Call `cancel_next_notification_wait()` to unblock a pending wait without
|
|
3096
|
+
* destroying the stream.
|
|
3097
|
+
*/
|
|
3098
|
+
notifications() {
|
|
3099
|
+
return FfiConverterTypeNotificationHolder.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
|
|
3100
|
+
return (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_method_wallet_notifications(uniffiTypeWalletObjectFactory.clonePointer(this), callStatus);
|
|
3101
|
+
}, /*liftString:*/FfiConverterString.lift));
|
|
3102
|
+
}
|
|
2791
3103
|
offboardAll(bitcoinAddress) /*throws*/{
|
|
2792
3104
|
return FfiConverterTypeOffboardResult.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError), /*caller:*/callStatus => {
|
|
2793
3105
|
return (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_method_wallet_offboard_all(uniffiTypeWalletObjectFactory.clonePointer(this), FfiConverterString.lower(bitcoinAddress), callStatus);
|
|
@@ -2828,7 +3140,7 @@ class Wallet extends _uniffiBindgenReactNative.UniffiAbstractObject {
|
|
|
2828
3140
|
}
|
|
2829
3141
|
|
|
2830
3142
|
/**
|
|
2831
|
-
*
|
|
3143
|
+
* DEPRECATED: use `peek_address` instead
|
|
2832
3144
|
*/
|
|
2833
3145
|
peakAddress(index) /*throws*/{
|
|
2834
3146
|
return FfiConverterString.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError), /*caller:*/callStatus => {
|
|
@@ -2836,6 +3148,15 @@ class Wallet extends _uniffiBindgenReactNative.UniffiAbstractObject {
|
|
|
2836
3148
|
}, /*liftString:*/FfiConverterString.lift));
|
|
2837
3149
|
}
|
|
2838
3150
|
|
|
3151
|
+
/**
|
|
3152
|
+
* Peek at an address at a specific index
|
|
3153
|
+
*/
|
|
3154
|
+
peekAddress(index) /*throws*/{
|
|
3155
|
+
return FfiConverterString.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError), /*caller:*/callStatus => {
|
|
3156
|
+
return (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_method_wallet_peek_address(uniffiTypeWalletObjectFactory.clonePointer(this), _uniffiBindgenReactNative.FfiConverterUInt32.lower(index), callStatus);
|
|
3157
|
+
}, /*liftString:*/FfiConverterString.lift));
|
|
3158
|
+
}
|
|
3159
|
+
|
|
2839
3160
|
/**
|
|
2840
3161
|
* Get all VTXOs that are part of pending boards
|
|
2841
3162
|
*/
|
|
@@ -3062,9 +3383,9 @@ class Wallet extends _uniffiBindgenReactNative.UniffiAbstractObject {
|
|
|
3062
3383
|
}, /*liftString:*/FfiConverterString.lift);
|
|
3063
3384
|
}
|
|
3064
3385
|
tryClaimAllLightningReceives(wait) /*throws*/{
|
|
3065
|
-
uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError), /*caller:*/callStatus => {
|
|
3066
|
-
(0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_method_wallet_try_claim_all_lightning_receives(uniffiTypeWalletObjectFactory.clonePointer(this), _uniffiBindgenReactNative.FfiConverterBool.lower(wait), callStatus);
|
|
3067
|
-
}, /*liftString:*/FfiConverterString.lift);
|
|
3386
|
+
return FfiConverterArrayTypeLightningReceive.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeBarkError.lift.bind(FfiConverterTypeBarkError), /*caller:*/callStatus => {
|
|
3387
|
+
return (0, _barkFfi.default)().ubrn_uniffi_bark_ffi_fn_method_wallet_try_claim_all_lightning_receives(uniffiTypeWalletObjectFactory.clonePointer(this), _uniffiBindgenReactNative.FfiConverterBool.lower(wait), callStatus);
|
|
3388
|
+
}, /*liftString:*/FfiConverterString.lift));
|
|
3068
3389
|
}
|
|
3069
3390
|
|
|
3070
3391
|
/**
|
|
@@ -3209,6 +3530,9 @@ const FfiConverterArrayTypeVtxo = new _uniffiBindgenReactNative.FfiConverterArra
|
|
|
3209
3530
|
// FfiConverter for Array<string>
|
|
3210
3531
|
const FfiConverterArrayString = new _uniffiBindgenReactNative.FfiConverterArray(FfiConverterString);
|
|
3211
3532
|
|
|
3533
|
+
// FfiConverter for WalletNotification | undefined
|
|
3534
|
+
const FfiConverterOptionalTypeWalletNotification = new _uniffiBindgenReactNative.FfiConverterOptional(FfiConverterTypeWalletNotification);
|
|
3535
|
+
|
|
3212
3536
|
// FfiConverter for Array<string> | undefined
|
|
3213
3537
|
const FfiConverterOptionalArrayString = new _uniffiBindgenReactNative.FfiConverterOptional(FfiConverterArrayString);
|
|
3214
3538
|
|
|
@@ -3242,6 +3566,12 @@ function uniffiEnsureInitialized() {
|
|
|
3242
3566
|
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_func_validate_mnemonic() !== 2707) {
|
|
3243
3567
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_func_validate_mnemonic");
|
|
3244
3568
|
}
|
|
3569
|
+
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_notificationholder_cancel_next_notification_wait() !== 48074) {
|
|
3570
|
+
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_notificationholder_cancel_next_notification_wait");
|
|
3571
|
+
}
|
|
3572
|
+
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_notificationholder_next_notification() !== 10262) {
|
|
3573
|
+
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_notificationholder_next_notification");
|
|
3574
|
+
}
|
|
3245
3575
|
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_onchainwallet_balance() !== 22016) {
|
|
3246
3576
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_onchainwallet_balance");
|
|
3247
3577
|
}
|
|
@@ -3344,6 +3674,9 @@ function uniffiEnsureInitialized() {
|
|
|
3344
3674
|
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_history() !== 21880) {
|
|
3345
3675
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_history");
|
|
3346
3676
|
}
|
|
3677
|
+
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_history_by_payment_method() !== 52617) {
|
|
3678
|
+
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_history_by_payment_method");
|
|
3679
|
+
}
|
|
3347
3680
|
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_import_vtxo() !== 31318) {
|
|
3348
3681
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_import_vtxo");
|
|
3349
3682
|
}
|
|
@@ -3389,6 +3722,9 @@ function uniffiEnsureInitialized() {
|
|
|
3389
3722
|
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_next_round_start_time() !== 55091) {
|
|
3390
3723
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_next_round_start_time");
|
|
3391
3724
|
}
|
|
3725
|
+
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_notifications() !== 32641) {
|
|
3726
|
+
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_notifications");
|
|
3727
|
+
}
|
|
3392
3728
|
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_offboard_all() !== 61123) {
|
|
3393
3729
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_offboard_all");
|
|
3394
3730
|
}
|
|
@@ -3407,6 +3743,9 @@ function uniffiEnsureInitialized() {
|
|
|
3407
3743
|
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_peak_address() !== 23469) {
|
|
3408
3744
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_peak_address");
|
|
3409
3745
|
}
|
|
3746
|
+
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_peek_address() !== 35297) {
|
|
3747
|
+
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_peek_address");
|
|
3748
|
+
}
|
|
3410
3749
|
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_pending_board_vtxos() !== 58145) {
|
|
3411
3750
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_pending_board_vtxos");
|
|
3412
3751
|
}
|
|
@@ -3476,7 +3815,7 @@ function uniffiEnsureInitialized() {
|
|
|
3476
3815
|
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_sync_pending_boards() !== 8863) {
|
|
3477
3816
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_sync_pending_boards");
|
|
3478
3817
|
}
|
|
3479
|
-
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_try_claim_all_lightning_receives() !==
|
|
3818
|
+
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_try_claim_all_lightning_receives() !== 8587) {
|
|
3480
3819
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch("uniffi_bark_ffi_checksum_method_wallet_try_claim_all_lightning_receives");
|
|
3481
3820
|
}
|
|
3482
3821
|
if ((0, _barkFfi.default)().ubrn_uniffi_bark_ffi_checksum_method_wallet_try_claim_lightning_receive() !== 60644) {
|
|
@@ -3555,6 +3894,7 @@ var _default = exports.default = Object.freeze({
|
|
|
3555
3894
|
FfiConverterTypeLightningSend,
|
|
3556
3895
|
FfiConverterTypeMovement,
|
|
3557
3896
|
FfiConverterTypeNetwork,
|
|
3897
|
+
FfiConverterTypeNotificationHolder,
|
|
3558
3898
|
FfiConverterTypeOffboardResult,
|
|
3559
3899
|
FfiConverterTypeOnchainBalance,
|
|
3560
3900
|
FfiConverterTypeOnchainWallet,
|
|
@@ -3563,6 +3903,7 @@ var _default = exports.default = Object.freeze({
|
|
|
3563
3903
|
FfiConverterTypeRoundState,
|
|
3564
3904
|
FfiConverterTypeVtxo,
|
|
3565
3905
|
FfiConverterTypeWallet,
|
|
3906
|
+
FfiConverterTypeWalletNotification,
|
|
3566
3907
|
FfiConverterTypeWalletProperties
|
|
3567
3908
|
}
|
|
3568
3909
|
});
|