@secondts/bark-react-native 0.25.0 → 0.26.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 +519 -31
- package/cpp/generated/bark.hpp +28 -2
- package/lib/commonjs/generated/bark-ffi.js.map +1 -1
- package/lib/commonjs/generated/bark.js +436 -61
- package/lib/commonjs/generated/bark.js.map +1 -1
- package/lib/module/generated/bark-ffi.js.map +1 -1
- package/lib/module/generated/bark.js +436 -61
- package/lib/module/generated/bark.js.map +1 -1
- package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts +34 -8
- package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/generated/bark.d.ts +1580 -159
- package/lib/typescript/commonjs/src/generated/bark.d.ts.map +1 -1
- package/lib/typescript/module/src/generated/bark-ffi.d.ts +34 -8
- package/lib/typescript/module/src/generated/bark-ffi.d.ts.map +1 -1
- package/lib/typescript/module/src/generated/bark.d.ts +1580 -159
- package/lib/typescript/module/src/generated/bark.d.ts.map +1 -1
- package/package.json +4 -4
- package/scripts/postinstall.js +35 -9
- package/src/generated/bark-ffi.ts +81 -8
- package/src/generated/bark.ts +3373 -539
package/src/generated/bark.ts
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
Cursor,
|
|
24
24
|
FfiConverterArray,
|
|
25
25
|
FfiConverterBool,
|
|
26
|
+
FfiConverterFloat64,
|
|
26
27
|
FfiConverterInt64,
|
|
27
28
|
FfiConverterObject,
|
|
28
29
|
FfiConverterObjectWithCallbacks,
|
|
@@ -59,6 +60,48 @@ const uniffiIsDebug =
|
|
|
59
60
|
|
|
60
61
|
// Public interface members begin here.
|
|
61
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Turn logging off and detach the current logger, which is never released.
|
|
65
|
+
*
|
|
66
|
+
* React Native calls this when its JS runtime starts, so a logger left by a
|
|
67
|
+
* runtime that was reloaded is never called.
|
|
68
|
+
*/
|
|
69
|
+
export function clearLogger(): void {
|
|
70
|
+
uniffiCaller.rustCall(
|
|
71
|
+
/*caller:*/ (callStatus) => {
|
|
72
|
+
nativeModule().ubrn_uniffi_bark_ffi_fn_func_clear_logger(callStatus);
|
|
73
|
+
},
|
|
74
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Decode a BOLT11 invoice, for example to show its amount, description,
|
|
80
|
+
* payee and expiry before paying it.
|
|
81
|
+
*
|
|
82
|
+
* Only decodes: it does not check the invoice's network or whether it has
|
|
83
|
+
* expired. `Wallet::parse_payment_request` checks the network.
|
|
84
|
+
*/
|
|
85
|
+
export function decodeBolt11Invoice(
|
|
86
|
+
invoice: string
|
|
87
|
+
): Bolt11InvoiceDetails /*throws*/ {
|
|
88
|
+
const __rb: Uint8Array = uniffiCaller.rustCallWithError(
|
|
89
|
+
/*liftError:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError),
|
|
90
|
+
/*caller:*/ (callStatus) => {
|
|
91
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_func_decode_bolt11_invoice(
|
|
92
|
+
FfiConverterString.lower(invoice, nativeModule().rustbuffer_alloc),
|
|
93
|
+
callStatus
|
|
94
|
+
);
|
|
95
|
+
},
|
|
96
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
97
|
+
);
|
|
98
|
+
try {
|
|
99
|
+
return FfiConverterTypeBolt11InvoiceDetails.lift(__rb);
|
|
100
|
+
} finally {
|
|
101
|
+
nativeModule().rustbuffer_free(__rb);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
62
105
|
/**
|
|
63
106
|
* Default for `Config.vtxo_key_gap_limit`: the run of consecutive unused
|
|
64
107
|
* seed-derived VTXO key indices a scan crosses before concluding a VTXO
|
|
@@ -201,10 +244,41 @@ export function maxVtxoKeyGapLimit(): number {
|
|
|
201
244
|
}
|
|
202
245
|
|
|
203
246
|
/**
|
|
204
|
-
*
|
|
247
|
+
* Network and seed fingerprint of the wallet in `datadir`, or `None` when no
|
|
248
|
+
* wallet is initialized there. Same side-effect guarantees as
|
|
249
|
+
* [`wallet_exists`].
|
|
250
|
+
*
|
|
251
|
+
* Not named `datadir_info`: the Go bindings would export it as `DatadirInfo`,
|
|
252
|
+
* which collides with the record of the same name.
|
|
253
|
+
*/
|
|
254
|
+
export function readDatadirInfo(
|
|
255
|
+
datadir: string
|
|
256
|
+
): DatadirInfo | undefined /*throws*/ {
|
|
257
|
+
const __rb: Uint8Array = uniffiCaller.rustCallWithError(
|
|
258
|
+
/*liftError:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError),
|
|
259
|
+
/*caller:*/ (callStatus) => {
|
|
260
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_func_read_datadir_info(
|
|
261
|
+
FfiConverterString.lower(datadir, nativeModule().rustbuffer_alloc),
|
|
262
|
+
callStatus
|
|
263
|
+
);
|
|
264
|
+
},
|
|
265
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
266
|
+
);
|
|
267
|
+
try {
|
|
268
|
+
return FfiConverterOptionalTypeDatadirInfo.lift(__rb);
|
|
269
|
+
} finally {
|
|
270
|
+
nativeModule().rustbuffer_free(__rb);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Send bark's log records at or above `max_level` to `logger`.
|
|
276
|
+
*
|
|
277
|
+
* Calling this again replaces the current logger and level. The replaced
|
|
278
|
+
* logger is never released. `clear_logger` turns logging off.
|
|
205
279
|
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
280
|
+
* Errors if another logger for Rust's `log` crate was installed in this
|
|
281
|
+
* process before the first call.
|
|
208
282
|
*/
|
|
209
283
|
export function setLogger(
|
|
210
284
|
logger: BarkLogger,
|
|
@@ -269,6 +343,31 @@ export function validateMnemonic(mnemonic: string): boolean /*throws*/ {
|
|
|
269
343
|
);
|
|
270
344
|
}
|
|
271
345
|
|
|
346
|
+
/**
|
|
347
|
+
* Whether `datadir` holds an initialized bark wallet.
|
|
348
|
+
*
|
|
349
|
+
* Answers without side effects: the database is opened read-only, no
|
|
350
|
+
* migration runs and no file or directory is created. Returns `false` for a
|
|
351
|
+
* missing or empty directory and for a database that never got its wallet
|
|
352
|
+
* properties (for example after a crash during creation). Returns an error
|
|
353
|
+
* when a database exists but cannot be read, so a corrupt wallet is never
|
|
354
|
+
* mistaken for an absent one.
|
|
355
|
+
*/
|
|
356
|
+
export function walletExists(datadir: string): boolean /*throws*/ {
|
|
357
|
+
return FfiConverterBool.lift(
|
|
358
|
+
uniffiCaller.rustCallWithError(
|
|
359
|
+
/*liftError:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError),
|
|
360
|
+
/*caller:*/ (callStatus) => {
|
|
361
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_func_wallet_exists(
|
|
362
|
+
FfiConverterString.lower(datadir, nativeModule().rustbuffer_alloc),
|
|
363
|
+
callStatus
|
|
364
|
+
);
|
|
365
|
+
},
|
|
366
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
367
|
+
)
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
|
|
272
371
|
// Hermes (React Native ≥ 0.74) ships TextEncoder and encodeInto, but not
|
|
273
372
|
// TextDecoder. For single-string decode (bytesToString), we polyfill via the
|
|
274
373
|
// C++ string_from_buffer helper using a duck-typed object matching the
|
|
@@ -934,194 +1033,1413 @@ const FfiConverterTypeArkInfo = (() => {
|
|
|
934
1033
|
return new FFIConverter();
|
|
935
1034
|
})();
|
|
936
1035
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1036
|
+
// Enum: PaymentMethod
|
|
1037
|
+
export enum PaymentMethod_Tags {
|
|
1038
|
+
Ark = "Ark",
|
|
1039
|
+
Bitcoin = "Bitcoin",
|
|
1040
|
+
OutputScript = "OutputScript",
|
|
1041
|
+
Invoice = "Invoice",
|
|
1042
|
+
Offer = "Offer",
|
|
1043
|
+
LightningAddress = "LightningAddress",
|
|
1044
|
+
Lnurl = "Lnurl",
|
|
1045
|
+
Custom = "Custom",
|
|
1046
|
+
}
|
|
946
1047
|
/**
|
|
947
|
-
*
|
|
1048
|
+
* A payment destination, mirroring `bark::movement::PaymentMethod`.
|
|
1049
|
+
*
|
|
1050
|
+
* Each variant carries the destination as a string. `type` and `value`
|
|
1051
|
+
* match upstream's JSON encoding (`{"type":"ark","value":"tark1…"}`), which
|
|
1052
|
+
* is what `Movement.sent_to_addresses` and `Movement.received_on_addresses`
|
|
1053
|
+
* hold and what `Wallet::history_by_payment_method` takes.
|
|
948
1054
|
*/
|
|
949
|
-
export const
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1055
|
+
export const PaymentMethod = (() => {
|
|
1056
|
+
type Ark__interface = {
|
|
1057
|
+
tag: PaymentMethod_Tags.Ark;
|
|
1058
|
+
inner: Readonly<{ value: string }>;
|
|
1059
|
+
};
|
|
1060
|
+
/**
|
|
1061
|
+
* An Ark address.
|
|
1062
|
+
*/
|
|
1063
|
+
class Ark_ extends UniffiEnum implements Ark__interface {
|
|
1064
|
+
/**
|
|
1065
|
+
* @private
|
|
1066
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1067
|
+
*/
|
|
1068
|
+
readonly [uniffiTypeNameSymbol] = "PaymentMethod";
|
|
1069
|
+
readonly tag = PaymentMethod_Tags.Ark;
|
|
1070
|
+
readonly inner: Readonly<{ value: string }>;
|
|
1071
|
+
constructor(inner: { value: string }) {
|
|
1072
|
+
super("PaymentMethod", "Ark");
|
|
960
1073
|
|
|
961
|
-
|
|
962
|
-
type TypeName = Balance;
|
|
963
|
-
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
964
|
-
readFromCursor(c: Cursor): TypeName {
|
|
965
|
-
return {
|
|
966
|
-
spendableSats: FfiConverterUInt64.readFromCursor(c),
|
|
967
|
-
pendingInRoundSats: FfiConverterUInt64.readFromCursor(c),
|
|
968
|
-
pendingExitSats: FfiConverterUInt64.readFromCursor(c),
|
|
969
|
-
pendingLightningSendSats: FfiConverterUInt64.readFromCursor(c),
|
|
970
|
-
claimableLightningReceiveSats: FfiConverterUInt64.readFromCursor(c),
|
|
971
|
-
pendingBoardSats: FfiConverterUInt64.readFromCursor(c),
|
|
972
|
-
};
|
|
1074
|
+
this.inner = Object.freeze(inner);
|
|
973
1075
|
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
FfiConverterUInt64.writeIntoCursor(value.pendingInRoundSats, c);
|
|
977
|
-
FfiConverterUInt64.writeIntoCursor(value.pendingExitSats, c);
|
|
978
|
-
FfiConverterUInt64.writeIntoCursor(value.pendingLightningSendSats, c);
|
|
979
|
-
FfiConverterUInt64.writeIntoCursor(
|
|
980
|
-
value.claimableLightningReceiveSats,
|
|
981
|
-
c
|
|
982
|
-
);
|
|
983
|
-
FfiConverterUInt64.writeIntoCursor(value.pendingBoardSats, c);
|
|
1076
|
+
static new(inner: { value: string }): Ark_ {
|
|
1077
|
+
return new Ark_(inner);
|
|
984
1078
|
}
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
FfiConverterUInt64.allocationSize(value.pendingInRoundSats) +
|
|
989
|
-
FfiConverterUInt64.allocationSize(value.pendingExitSats) +
|
|
990
|
-
FfiConverterUInt64.allocationSize(value.pendingLightningSendSats) +
|
|
991
|
-
FfiConverterUInt64.allocationSize(value.claimableLightningReceiveSats) +
|
|
992
|
-
FfiConverterUInt64.allocationSize(value.pendingBoardSats)
|
|
993
|
-
);
|
|
1079
|
+
|
|
1080
|
+
static instanceOf(obj: any): obj is Ark_ {
|
|
1081
|
+
return obj.tag === PaymentMethod_Tags.Ark;
|
|
994
1082
|
}
|
|
995
1083
|
}
|
|
996
|
-
return new FFIConverter();
|
|
997
|
-
})();
|
|
998
|
-
|
|
999
|
-
/**
|
|
1000
|
-
* Reference to a block in the blockchain
|
|
1001
|
-
*/
|
|
1002
|
-
export type BlockRef = {
|
|
1003
|
-
height: number;
|
|
1004
|
-
hash: string;
|
|
1005
|
-
};
|
|
1006
1084
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1085
|
+
type Bitcoin__interface = {
|
|
1086
|
+
tag: PaymentMethod_Tags.Bitcoin;
|
|
1087
|
+
inner: Readonly<{ value: string }>;
|
|
1088
|
+
};
|
|
1089
|
+
/**
|
|
1090
|
+
* An onchain bitcoin address.
|
|
1091
|
+
*/
|
|
1092
|
+
class Bitcoin_ extends UniffiEnum implements Bitcoin__interface {
|
|
1093
|
+
/**
|
|
1094
|
+
* @private
|
|
1095
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1096
|
+
*/
|
|
1097
|
+
readonly [uniffiTypeNameSymbol] = "PaymentMethod";
|
|
1098
|
+
readonly tag = PaymentMethod_Tags.Bitcoin;
|
|
1099
|
+
readonly inner: Readonly<{ value: string }>;
|
|
1100
|
+
constructor(inner: { value: string }) {
|
|
1101
|
+
super("PaymentMethod", "Bitcoin");
|
|
1021
1102
|
|
|
1022
|
-
|
|
1023
|
-
type TypeName = BlockRef;
|
|
1024
|
-
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1025
|
-
readFromCursor(c: Cursor): TypeName {
|
|
1026
|
-
return {
|
|
1027
|
-
height: FfiConverterUInt32.readFromCursor(c),
|
|
1028
|
-
hash: FfiConverterString.readFromCursor(c),
|
|
1029
|
-
};
|
|
1103
|
+
this.inner = Object.freeze(inner);
|
|
1030
1104
|
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
FfiConverterString.writeIntoCursor(value.hash, c);
|
|
1105
|
+
static new(inner: { value: string }): Bitcoin_ {
|
|
1106
|
+
return new Bitcoin_(inner);
|
|
1034
1107
|
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
FfiConverterString.allocationSize(value.hash)
|
|
1039
|
-
);
|
|
1108
|
+
|
|
1109
|
+
static instanceOf(obj: any): obj is Bitcoin_ {
|
|
1110
|
+
return obj.tag === PaymentMethod_Tags.Bitcoin;
|
|
1040
1111
|
}
|
|
1041
1112
|
}
|
|
1042
|
-
return new FFIConverter();
|
|
1043
|
-
})();
|
|
1044
|
-
|
|
1045
|
-
/**
|
|
1046
|
-
* Destination for an externally funded board (e.g. a payjoin receive).
|
|
1047
|
-
*
|
|
1048
|
-
* The funding script commits to the derived keypair and expiry height, so
|
|
1049
|
-
* `keypair_index` and `expiry_height` must be passed back unchanged to
|
|
1050
|
-
* `board_psbt` once the funding PSBT is available — including on retries
|
|
1051
|
-
* after the sender changes the transaction.
|
|
1052
|
-
*/
|
|
1053
|
-
export type BoardFundingInfo = {
|
|
1054
|
-
address: string;
|
|
1055
|
-
expiryHeight: number;
|
|
1056
|
-
keypairIndex: number;
|
|
1057
|
-
};
|
|
1058
1113
|
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
})
|
|
1114
|
+
type OutputScript__interface = {
|
|
1115
|
+
tag: PaymentMethod_Tags.OutputScript;
|
|
1116
|
+
inner: Readonly<{ value: string }>;
|
|
1117
|
+
};
|
|
1118
|
+
/**
|
|
1119
|
+
* A hex-encoded onchain output script. bark cannot pay these yet.
|
|
1120
|
+
*/
|
|
1121
|
+
class OutputScript_ extends UniffiEnum implements OutputScript__interface {
|
|
1122
|
+
/**
|
|
1123
|
+
* @private
|
|
1124
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1125
|
+
*/
|
|
1126
|
+
readonly [uniffiTypeNameSymbol] = "PaymentMethod";
|
|
1127
|
+
readonly tag = PaymentMethod_Tags.OutputScript;
|
|
1128
|
+
readonly inner: Readonly<{ value: string }>;
|
|
1129
|
+
constructor(inner: { value: string }) {
|
|
1130
|
+
super("PaymentMethod", "OutputScript");
|
|
1075
1131
|
|
|
1076
|
-
|
|
1077
|
-
type TypeName = BoardFundingInfo;
|
|
1078
|
-
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1079
|
-
readFromCursor(c: Cursor): TypeName {
|
|
1080
|
-
return {
|
|
1081
|
-
address: FfiConverterString.readFromCursor(c),
|
|
1082
|
-
expiryHeight: FfiConverterUInt32.readFromCursor(c),
|
|
1083
|
-
keypairIndex: FfiConverterUInt32.readFromCursor(c),
|
|
1084
|
-
};
|
|
1132
|
+
this.inner = Object.freeze(inner);
|
|
1085
1133
|
}
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
FfiConverterUInt32.writeIntoCursor(value.expiryHeight, c);
|
|
1089
|
-
FfiConverterUInt32.writeIntoCursor(value.keypairIndex, c);
|
|
1134
|
+
static new(inner: { value: string }): OutputScript_ {
|
|
1135
|
+
return new OutputScript_(inner);
|
|
1090
1136
|
}
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
FfiConverterUInt32.allocationSize(value.expiryHeight) +
|
|
1095
|
-
FfiConverterUInt32.allocationSize(value.keypairIndex)
|
|
1096
|
-
);
|
|
1137
|
+
|
|
1138
|
+
static instanceOf(obj: any): obj is OutputScript_ {
|
|
1139
|
+
return obj.tag === PaymentMethod_Tags.OutputScript;
|
|
1097
1140
|
}
|
|
1098
1141
|
}
|
|
1099
|
-
return new FFIConverter();
|
|
1100
|
-
})();
|
|
1101
1142
|
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
bitcoindAddress?: string;
|
|
1107
|
-
bitcoindCookiefile?: string;
|
|
1108
|
-
bitcoindUser?: string;
|
|
1109
|
-
bitcoindPass?: string;
|
|
1110
|
-
vtxoRefreshExpiryThreshold?: number;
|
|
1111
|
-
vtxoExitMargin?: number;
|
|
1112
|
-
htlcRecvClaimDelta?: number;
|
|
1113
|
-
fallbackFeeRate?: bigint;
|
|
1114
|
-
roundTxRequiredConfirmations?: number;
|
|
1115
|
-
daemonSyncIntervalSecs?: bigint;
|
|
1116
|
-
offboardRequiredConfirmations?: number;
|
|
1117
|
-
daemonManualSync?: boolean;
|
|
1118
|
-
lightningReceiveClaimRetries?: number;
|
|
1119
|
-
userAgent?: string;
|
|
1143
|
+
type Invoice__interface = {
|
|
1144
|
+
tag: PaymentMethod_Tags.Invoice;
|
|
1145
|
+
inner: Readonly<{ value: string }>;
|
|
1146
|
+
};
|
|
1120
1147
|
/**
|
|
1121
|
-
*
|
|
1122
|
-
*
|
|
1123
|
-
|
|
1124
|
-
|
|
1148
|
+
* A lightning invoice, BOLT11 or BOLT12. `decode_bolt11_invoice` reads
|
|
1149
|
+
* a BOLT11 invoice's amount, description, payee and expiry.
|
|
1150
|
+
*/
|
|
1151
|
+
class Invoice_ extends UniffiEnum implements Invoice__interface {
|
|
1152
|
+
/**
|
|
1153
|
+
* @private
|
|
1154
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1155
|
+
*/
|
|
1156
|
+
readonly [uniffiTypeNameSymbol] = "PaymentMethod";
|
|
1157
|
+
readonly tag = PaymentMethod_Tags.Invoice;
|
|
1158
|
+
readonly inner: Readonly<{ value: string }>;
|
|
1159
|
+
constructor(inner: { value: string }) {
|
|
1160
|
+
super("PaymentMethod", "Invoice");
|
|
1161
|
+
|
|
1162
|
+
this.inner = Object.freeze(inner);
|
|
1163
|
+
}
|
|
1164
|
+
static new(inner: { value: string }): Invoice_ {
|
|
1165
|
+
return new Invoice_(inner);
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
static instanceOf(obj: any): obj is Invoice_ {
|
|
1169
|
+
return obj.tag === PaymentMethod_Tags.Invoice;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
type Offer__interface = {
|
|
1174
|
+
tag: PaymentMethod_Tags.Offer;
|
|
1175
|
+
inner: Readonly<{ value: string }>;
|
|
1176
|
+
};
|
|
1177
|
+
/**
|
|
1178
|
+
* A reusable BOLT12 offer.
|
|
1179
|
+
*/
|
|
1180
|
+
class Offer_ extends UniffiEnum implements Offer__interface {
|
|
1181
|
+
/**
|
|
1182
|
+
* @private
|
|
1183
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1184
|
+
*/
|
|
1185
|
+
readonly [uniffiTypeNameSymbol] = "PaymentMethod";
|
|
1186
|
+
readonly tag = PaymentMethod_Tags.Offer;
|
|
1187
|
+
readonly inner: Readonly<{ value: string }>;
|
|
1188
|
+
constructor(inner: { value: string }) {
|
|
1189
|
+
super("PaymentMethod", "Offer");
|
|
1190
|
+
|
|
1191
|
+
this.inner = Object.freeze(inner);
|
|
1192
|
+
}
|
|
1193
|
+
static new(inner: { value: string }): Offer_ {
|
|
1194
|
+
return new Offer_(inner);
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
static instanceOf(obj: any): obj is Offer_ {
|
|
1198
|
+
return obj.tag === PaymentMethod_Tags.Offer;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
type LightningAddress__interface = {
|
|
1203
|
+
tag: PaymentMethod_Tags.LightningAddress;
|
|
1204
|
+
inner: Readonly<{ value: string }>;
|
|
1205
|
+
};
|
|
1206
|
+
/**
|
|
1207
|
+
* A lightning address (`user@domain`), resolved over LNURL-pay.
|
|
1208
|
+
*/
|
|
1209
|
+
class LightningAddress_
|
|
1210
|
+
extends UniffiEnum
|
|
1211
|
+
implements LightningAddress__interface
|
|
1212
|
+
{
|
|
1213
|
+
/**
|
|
1214
|
+
* @private
|
|
1215
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1216
|
+
*/
|
|
1217
|
+
readonly [uniffiTypeNameSymbol] = "PaymentMethod";
|
|
1218
|
+
readonly tag = PaymentMethod_Tags.LightningAddress;
|
|
1219
|
+
readonly inner: Readonly<{ value: string }>;
|
|
1220
|
+
constructor(inner: { value: string }) {
|
|
1221
|
+
super("PaymentMethod", "LightningAddress");
|
|
1222
|
+
|
|
1223
|
+
this.inner = Object.freeze(inner);
|
|
1224
|
+
}
|
|
1225
|
+
static new(inner: { value: string }): LightningAddress_ {
|
|
1226
|
+
return new LightningAddress_(inner);
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
static instanceOf(obj: any): obj is LightningAddress_ {
|
|
1230
|
+
return obj.tag === PaymentMethod_Tags.LightningAddress;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
type Lnurl__interface = {
|
|
1235
|
+
tag: PaymentMethod_Tags.Lnurl;
|
|
1236
|
+
inner: Readonly<{ value: string }>;
|
|
1237
|
+
};
|
|
1238
|
+
/**
|
|
1239
|
+
* An LNURL-pay link (`lnurl1…`).
|
|
1240
|
+
*/
|
|
1241
|
+
class Lnurl_ extends UniffiEnum implements Lnurl__interface {
|
|
1242
|
+
/**
|
|
1243
|
+
* @private
|
|
1244
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1245
|
+
*/
|
|
1246
|
+
readonly [uniffiTypeNameSymbol] = "PaymentMethod";
|
|
1247
|
+
readonly tag = PaymentMethod_Tags.Lnurl;
|
|
1248
|
+
readonly inner: Readonly<{ value: string }>;
|
|
1249
|
+
constructor(inner: { value: string }) {
|
|
1250
|
+
super("PaymentMethod", "Lnurl");
|
|
1251
|
+
|
|
1252
|
+
this.inner = Object.freeze(inner);
|
|
1253
|
+
}
|
|
1254
|
+
static new(inner: { value: string }): Lnurl_ {
|
|
1255
|
+
return new Lnurl_(inner);
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
static instanceOf(obj: any): obj is Lnurl_ {
|
|
1259
|
+
return obj.tag === PaymentMethod_Tags.Lnurl;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
type Custom__interface = {
|
|
1264
|
+
tag: PaymentMethod_Tags.Custom;
|
|
1265
|
+
inner: Readonly<{ value: string }>;
|
|
1266
|
+
};
|
|
1267
|
+
/**
|
|
1268
|
+
* A destination bark recognizes but cannot pay, such as an Arkade
|
|
1269
|
+
* address.
|
|
1270
|
+
*/
|
|
1271
|
+
class Custom_ extends UniffiEnum implements Custom__interface {
|
|
1272
|
+
/**
|
|
1273
|
+
* @private
|
|
1274
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1275
|
+
*/
|
|
1276
|
+
readonly [uniffiTypeNameSymbol] = "PaymentMethod";
|
|
1277
|
+
readonly tag = PaymentMethod_Tags.Custom;
|
|
1278
|
+
readonly inner: Readonly<{ value: string }>;
|
|
1279
|
+
constructor(inner: { value: string }) {
|
|
1280
|
+
super("PaymentMethod", "Custom");
|
|
1281
|
+
|
|
1282
|
+
this.inner = Object.freeze(inner);
|
|
1283
|
+
}
|
|
1284
|
+
static new(inner: { value: string }): Custom_ {
|
|
1285
|
+
return new Custom_(inner);
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
static instanceOf(obj: any): obj is Custom_ {
|
|
1289
|
+
return obj.tag === PaymentMethod_Tags.Custom;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
function instanceOf(obj: any): obj is PaymentMethod {
|
|
1294
|
+
return obj[uniffiTypeNameSymbol] === "PaymentMethod";
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
return Object.freeze({
|
|
1298
|
+
instanceOf,
|
|
1299
|
+
Ark: Ark_,
|
|
1300
|
+
Bitcoin: Bitcoin_,
|
|
1301
|
+
OutputScript: OutputScript_,
|
|
1302
|
+
Invoice: Invoice_,
|
|
1303
|
+
Offer: Offer_,
|
|
1304
|
+
LightningAddress: LightningAddress_,
|
|
1305
|
+
Lnurl: Lnurl_,
|
|
1306
|
+
Custom: Custom_,
|
|
1307
|
+
});
|
|
1308
|
+
})();
|
|
1309
|
+
/**
|
|
1310
|
+
* A payment destination, mirroring `bark::movement::PaymentMethod`.
|
|
1311
|
+
*
|
|
1312
|
+
* Each variant carries the destination as a string. `type` and `value`
|
|
1313
|
+
* match upstream's JSON encoding (`{"type":"ark","value":"tark1…"}`), which
|
|
1314
|
+
* is what `Movement.sent_to_addresses` and `Movement.received_on_addresses`
|
|
1315
|
+
* hold and what `Wallet::history_by_payment_method` takes.
|
|
1316
|
+
*/
|
|
1317
|
+
export type PaymentMethod = InstanceType<
|
|
1318
|
+
(typeof PaymentMethod)[
|
|
1319
|
+
| "Ark"
|
|
1320
|
+
| "Bitcoin"
|
|
1321
|
+
| "OutputScript"
|
|
1322
|
+
| "Invoice"
|
|
1323
|
+
| "Offer"
|
|
1324
|
+
| "LightningAddress"
|
|
1325
|
+
| "Lnurl"
|
|
1326
|
+
| "Custom"]
|
|
1327
|
+
>;
|
|
1328
|
+
|
|
1329
|
+
// FfiConverter for enum PaymentMethod
|
|
1330
|
+
const FfiConverterTypePaymentMethod = (() => {
|
|
1331
|
+
type TypeName = PaymentMethod;
|
|
1332
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1333
|
+
readFromCursor(c: Cursor): TypeName {
|
|
1334
|
+
switch (c.readI32()) {
|
|
1335
|
+
case 1:
|
|
1336
|
+
return new PaymentMethod.Ark({
|
|
1337
|
+
value: FfiConverterString.readFromCursor(c),
|
|
1338
|
+
});
|
|
1339
|
+
case 2:
|
|
1340
|
+
return new PaymentMethod.Bitcoin({
|
|
1341
|
+
value: FfiConverterString.readFromCursor(c),
|
|
1342
|
+
});
|
|
1343
|
+
case 3:
|
|
1344
|
+
return new PaymentMethod.OutputScript({
|
|
1345
|
+
value: FfiConverterString.readFromCursor(c),
|
|
1346
|
+
});
|
|
1347
|
+
case 4:
|
|
1348
|
+
return new PaymentMethod.Invoice({
|
|
1349
|
+
value: FfiConverterString.readFromCursor(c),
|
|
1350
|
+
});
|
|
1351
|
+
case 5:
|
|
1352
|
+
return new PaymentMethod.Offer({
|
|
1353
|
+
value: FfiConverterString.readFromCursor(c),
|
|
1354
|
+
});
|
|
1355
|
+
case 6:
|
|
1356
|
+
return new PaymentMethod.LightningAddress({
|
|
1357
|
+
value: FfiConverterString.readFromCursor(c),
|
|
1358
|
+
});
|
|
1359
|
+
case 7:
|
|
1360
|
+
return new PaymentMethod.Lnurl({
|
|
1361
|
+
value: FfiConverterString.readFromCursor(c),
|
|
1362
|
+
});
|
|
1363
|
+
case 8:
|
|
1364
|
+
return new PaymentMethod.Custom({
|
|
1365
|
+
value: FfiConverterString.readFromCursor(c),
|
|
1366
|
+
});
|
|
1367
|
+
default:
|
|
1368
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
1372
|
+
switch (value.tag) {
|
|
1373
|
+
case PaymentMethod_Tags.Ark: {
|
|
1374
|
+
c.writeI32(1);
|
|
1375
|
+
const inner = value.inner;
|
|
1376
|
+
FfiConverterString.writeIntoCursor(inner.value, c);
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
case PaymentMethod_Tags.Bitcoin: {
|
|
1380
|
+
c.writeI32(2);
|
|
1381
|
+
const inner = value.inner;
|
|
1382
|
+
FfiConverterString.writeIntoCursor(inner.value, c);
|
|
1383
|
+
return;
|
|
1384
|
+
}
|
|
1385
|
+
case PaymentMethod_Tags.OutputScript: {
|
|
1386
|
+
c.writeI32(3);
|
|
1387
|
+
const inner = value.inner;
|
|
1388
|
+
FfiConverterString.writeIntoCursor(inner.value, c);
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1391
|
+
case PaymentMethod_Tags.Invoice: {
|
|
1392
|
+
c.writeI32(4);
|
|
1393
|
+
const inner = value.inner;
|
|
1394
|
+
FfiConverterString.writeIntoCursor(inner.value, c);
|
|
1395
|
+
return;
|
|
1396
|
+
}
|
|
1397
|
+
case PaymentMethod_Tags.Offer: {
|
|
1398
|
+
c.writeI32(5);
|
|
1399
|
+
const inner = value.inner;
|
|
1400
|
+
FfiConverterString.writeIntoCursor(inner.value, c);
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
case PaymentMethod_Tags.LightningAddress: {
|
|
1404
|
+
c.writeI32(6);
|
|
1405
|
+
const inner = value.inner;
|
|
1406
|
+
FfiConverterString.writeIntoCursor(inner.value, c);
|
|
1407
|
+
return;
|
|
1408
|
+
}
|
|
1409
|
+
case PaymentMethod_Tags.Lnurl: {
|
|
1410
|
+
c.writeI32(7);
|
|
1411
|
+
const inner = value.inner;
|
|
1412
|
+
FfiConverterString.writeIntoCursor(inner.value, c);
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
case PaymentMethod_Tags.Custom: {
|
|
1416
|
+
c.writeI32(8);
|
|
1417
|
+
const inner = value.inner;
|
|
1418
|
+
FfiConverterString.writeIntoCursor(inner.value, c);
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
default:
|
|
1422
|
+
// Throwing from here means that PaymentMethod_Tags hasn't matched an ordinal.
|
|
1423
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
allocationSize(value: TypeName): number {
|
|
1427
|
+
switch (value.tag) {
|
|
1428
|
+
case PaymentMethod_Tags.Ark: {
|
|
1429
|
+
const inner = value.inner;
|
|
1430
|
+
let size = 4;
|
|
1431
|
+
size += FfiConverterString.allocationSize(inner.value);
|
|
1432
|
+
return size;
|
|
1433
|
+
}
|
|
1434
|
+
case PaymentMethod_Tags.Bitcoin: {
|
|
1435
|
+
const inner = value.inner;
|
|
1436
|
+
let size = 4;
|
|
1437
|
+
size += FfiConverterString.allocationSize(inner.value);
|
|
1438
|
+
return size;
|
|
1439
|
+
}
|
|
1440
|
+
case PaymentMethod_Tags.OutputScript: {
|
|
1441
|
+
const inner = value.inner;
|
|
1442
|
+
let size = 4;
|
|
1443
|
+
size += FfiConverterString.allocationSize(inner.value);
|
|
1444
|
+
return size;
|
|
1445
|
+
}
|
|
1446
|
+
case PaymentMethod_Tags.Invoice: {
|
|
1447
|
+
const inner = value.inner;
|
|
1448
|
+
let size = 4;
|
|
1449
|
+
size += FfiConverterString.allocationSize(inner.value);
|
|
1450
|
+
return size;
|
|
1451
|
+
}
|
|
1452
|
+
case PaymentMethod_Tags.Offer: {
|
|
1453
|
+
const inner = value.inner;
|
|
1454
|
+
let size = 4;
|
|
1455
|
+
size += FfiConverterString.allocationSize(inner.value);
|
|
1456
|
+
return size;
|
|
1457
|
+
}
|
|
1458
|
+
case PaymentMethod_Tags.LightningAddress: {
|
|
1459
|
+
const inner = value.inner;
|
|
1460
|
+
let size = 4;
|
|
1461
|
+
size += FfiConverterString.allocationSize(inner.value);
|
|
1462
|
+
return size;
|
|
1463
|
+
}
|
|
1464
|
+
case PaymentMethod_Tags.Lnurl: {
|
|
1465
|
+
const inner = value.inner;
|
|
1466
|
+
let size = 4;
|
|
1467
|
+
size += FfiConverterString.allocationSize(inner.value);
|
|
1468
|
+
return size;
|
|
1469
|
+
}
|
|
1470
|
+
case PaymentMethod_Tags.Custom: {
|
|
1471
|
+
const inner = value.inner;
|
|
1472
|
+
let size = 4;
|
|
1473
|
+
size += FfiConverterString.allocationSize(inner.value);
|
|
1474
|
+
return size;
|
|
1475
|
+
}
|
|
1476
|
+
default:
|
|
1477
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
return new FFIConverter();
|
|
1482
|
+
})();
|
|
1483
|
+
|
|
1484
|
+
// Enum: PaymentMethodParsingError
|
|
1485
|
+
export enum PaymentMethodParsingError_Tags {
|
|
1486
|
+
NetworkMismatch = "NetworkMismatch",
|
|
1487
|
+
InvalidArkAddress = "InvalidArkAddress",
|
|
1488
|
+
AmountMismatch = "AmountMismatch",
|
|
1489
|
+
InvalidAmount = "InvalidAmount",
|
|
1490
|
+
Unsupported = "Unsupported",
|
|
1491
|
+
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Why an option of a [`PaymentRequest`] may not be payable, mirroring
|
|
1494
|
+
* `bark::PaymentMethodParsingError`.
|
|
1495
|
+
*
|
|
1496
|
+
* Returned as data in [`AvailablePaymentMethod::errors`] rather than as an
|
|
1497
|
+
* error, so the caller can still show every option and flag the bad ones.
|
|
1498
|
+
*/
|
|
1499
|
+
export const PaymentMethodParsingError = (() => {
|
|
1500
|
+
type NetworkMismatch__interface = {
|
|
1501
|
+
tag: PaymentMethodParsingError_Tags.NetworkMismatch;
|
|
1502
|
+
};
|
|
1503
|
+
/**
|
|
1504
|
+
* The destination is for another bitcoin network than the wallet's.
|
|
1505
|
+
*/
|
|
1506
|
+
class NetworkMismatch_
|
|
1507
|
+
extends UniffiEnum
|
|
1508
|
+
implements NetworkMismatch__interface
|
|
1509
|
+
{
|
|
1510
|
+
/**
|
|
1511
|
+
* @private
|
|
1512
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1513
|
+
*/
|
|
1514
|
+
readonly [uniffiTypeNameSymbol] = "PaymentMethodParsingError";
|
|
1515
|
+
readonly tag = PaymentMethodParsingError_Tags.NetworkMismatch;
|
|
1516
|
+
constructor() {
|
|
1517
|
+
super("PaymentMethodParsingError", "NetworkMismatch");
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
static new(): NetworkMismatch_ {
|
|
1521
|
+
return new NetworkMismatch_();
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
static instanceOf(obj: any): obj is NetworkMismatch_ {
|
|
1525
|
+
return obj.tag === PaymentMethodParsingError_Tags.NetworkMismatch;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
type InvalidArkAddress__interface = {
|
|
1530
|
+
tag: PaymentMethodParsingError_Tags.InvalidArkAddress;
|
|
1531
|
+
inner: Readonly<{ reason: string }>;
|
|
1532
|
+
};
|
|
1533
|
+
/**
|
|
1534
|
+
* This wallet cannot pay the Ark address, for example because it
|
|
1535
|
+
* belongs to another Ark server. `reason` says which check failed.
|
|
1536
|
+
*/
|
|
1537
|
+
class InvalidArkAddress_
|
|
1538
|
+
extends UniffiEnum
|
|
1539
|
+
implements InvalidArkAddress__interface
|
|
1540
|
+
{
|
|
1541
|
+
/**
|
|
1542
|
+
* @private
|
|
1543
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1544
|
+
*/
|
|
1545
|
+
readonly [uniffiTypeNameSymbol] = "PaymentMethodParsingError";
|
|
1546
|
+
readonly tag = PaymentMethodParsingError_Tags.InvalidArkAddress;
|
|
1547
|
+
readonly inner: Readonly<{ reason: string }>;
|
|
1548
|
+
constructor(inner: { reason: string }) {
|
|
1549
|
+
super("PaymentMethodParsingError", "InvalidArkAddress");
|
|
1550
|
+
|
|
1551
|
+
this.inner = Object.freeze(inner);
|
|
1552
|
+
}
|
|
1553
|
+
static new(inner: { reason: string }): InvalidArkAddress_ {
|
|
1554
|
+
return new InvalidArkAddress_(inner);
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
static instanceOf(obj: any): obj is InvalidArkAddress_ {
|
|
1558
|
+
return obj.tag === PaymentMethodParsingError_Tags.InvalidArkAddress;
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
type AmountMismatch__interface = {
|
|
1563
|
+
tag: PaymentMethodParsingError_Tags.AmountMismatch;
|
|
1564
|
+
inner: Readonly<{ expectedSats: bigint; gotSats: bigint }>;
|
|
1565
|
+
};
|
|
1566
|
+
/**
|
|
1567
|
+
* The invoice or offer asks for `expected_sats`, but the URI's `amount`
|
|
1568
|
+
* is `got_sats`.
|
|
1569
|
+
*/
|
|
1570
|
+
class AmountMismatch_
|
|
1571
|
+
extends UniffiEnum
|
|
1572
|
+
implements AmountMismatch__interface
|
|
1573
|
+
{
|
|
1574
|
+
/**
|
|
1575
|
+
* @private
|
|
1576
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1577
|
+
*/
|
|
1578
|
+
readonly [uniffiTypeNameSymbol] = "PaymentMethodParsingError";
|
|
1579
|
+
readonly tag = PaymentMethodParsingError_Tags.AmountMismatch;
|
|
1580
|
+
readonly inner: Readonly<{ expectedSats: bigint; gotSats: bigint }>;
|
|
1581
|
+
constructor(inner: { expectedSats: bigint; gotSats: bigint }) {
|
|
1582
|
+
super("PaymentMethodParsingError", "AmountMismatch");
|
|
1583
|
+
|
|
1584
|
+
this.inner = Object.freeze(inner);
|
|
1585
|
+
}
|
|
1586
|
+
static new(inner: {
|
|
1587
|
+
expectedSats: bigint;
|
|
1588
|
+
gotSats: bigint;
|
|
1589
|
+
}): AmountMismatch_ {
|
|
1590
|
+
return new AmountMismatch_(inner);
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
static instanceOf(obj: any): obj is AmountMismatch_ {
|
|
1594
|
+
return obj.tag === PaymentMethodParsingError_Tags.AmountMismatch;
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
type InvalidAmount__interface = {
|
|
1599
|
+
tag: PaymentMethodParsingError_Tags.InvalidAmount;
|
|
1600
|
+
};
|
|
1601
|
+
/**
|
|
1602
|
+
* The destination's amount is invalid.
|
|
1603
|
+
*/
|
|
1604
|
+
class InvalidAmount_ extends UniffiEnum implements InvalidAmount__interface {
|
|
1605
|
+
/**
|
|
1606
|
+
* @private
|
|
1607
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1608
|
+
*/
|
|
1609
|
+
readonly [uniffiTypeNameSymbol] = "PaymentMethodParsingError";
|
|
1610
|
+
readonly tag = PaymentMethodParsingError_Tags.InvalidAmount;
|
|
1611
|
+
constructor() {
|
|
1612
|
+
super("PaymentMethodParsingError", "InvalidAmount");
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
static new(): InvalidAmount_ {
|
|
1616
|
+
return new InvalidAmount_();
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
static instanceOf(obj: any): obj is InvalidAmount_ {
|
|
1620
|
+
return obj.tag === PaymentMethodParsingError_Tags.InvalidAmount;
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
type Unsupported__interface = {
|
|
1625
|
+
tag: PaymentMethodParsingError_Tags.Unsupported;
|
|
1626
|
+
};
|
|
1627
|
+
/**
|
|
1628
|
+
* bark recognizes the destination but cannot pay it.
|
|
1629
|
+
*/
|
|
1630
|
+
class Unsupported_ extends UniffiEnum implements Unsupported__interface {
|
|
1631
|
+
/**
|
|
1632
|
+
* @private
|
|
1633
|
+
* This field is private and should not be used, use `tag` instead.
|
|
1634
|
+
*/
|
|
1635
|
+
readonly [uniffiTypeNameSymbol] = "PaymentMethodParsingError";
|
|
1636
|
+
readonly tag = PaymentMethodParsingError_Tags.Unsupported;
|
|
1637
|
+
constructor() {
|
|
1638
|
+
super("PaymentMethodParsingError", "Unsupported");
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
static new(): Unsupported_ {
|
|
1642
|
+
return new Unsupported_();
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
static instanceOf(obj: any): obj is Unsupported_ {
|
|
1646
|
+
return obj.tag === PaymentMethodParsingError_Tags.Unsupported;
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
function instanceOf(obj: any): obj is PaymentMethodParsingError {
|
|
1651
|
+
return obj[uniffiTypeNameSymbol] === "PaymentMethodParsingError";
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
return Object.freeze({
|
|
1655
|
+
instanceOf,
|
|
1656
|
+
NetworkMismatch: NetworkMismatch_,
|
|
1657
|
+
InvalidArkAddress: InvalidArkAddress_,
|
|
1658
|
+
AmountMismatch: AmountMismatch_,
|
|
1659
|
+
InvalidAmount: InvalidAmount_,
|
|
1660
|
+
Unsupported: Unsupported_,
|
|
1661
|
+
});
|
|
1662
|
+
})();
|
|
1663
|
+
/**
|
|
1664
|
+
* Why an option of a [`PaymentRequest`] may not be payable, mirroring
|
|
1665
|
+
* `bark::PaymentMethodParsingError`.
|
|
1666
|
+
*
|
|
1667
|
+
* Returned as data in [`AvailablePaymentMethod::errors`] rather than as an
|
|
1668
|
+
* error, so the caller can still show every option and flag the bad ones.
|
|
1669
|
+
*/
|
|
1670
|
+
export type PaymentMethodParsingError = InstanceType<
|
|
1671
|
+
(typeof PaymentMethodParsingError)[
|
|
1672
|
+
| "NetworkMismatch"
|
|
1673
|
+
| "InvalidArkAddress"
|
|
1674
|
+
| "AmountMismatch"
|
|
1675
|
+
| "InvalidAmount"
|
|
1676
|
+
| "Unsupported"]
|
|
1677
|
+
>;
|
|
1678
|
+
|
|
1679
|
+
// FfiConverter for enum PaymentMethodParsingError
|
|
1680
|
+
const FfiConverterTypePaymentMethodParsingError = (() => {
|
|
1681
|
+
type TypeName = PaymentMethodParsingError;
|
|
1682
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1683
|
+
readFromCursor(c: Cursor): TypeName {
|
|
1684
|
+
switch (c.readI32()) {
|
|
1685
|
+
case 1:
|
|
1686
|
+
return new PaymentMethodParsingError.NetworkMismatch();
|
|
1687
|
+
case 2:
|
|
1688
|
+
return new PaymentMethodParsingError.InvalidArkAddress({
|
|
1689
|
+
reason: FfiConverterString.readFromCursor(c),
|
|
1690
|
+
});
|
|
1691
|
+
case 3:
|
|
1692
|
+
return new PaymentMethodParsingError.AmountMismatch({
|
|
1693
|
+
expectedSats: FfiConverterUInt64.readFromCursor(c),
|
|
1694
|
+
gotSats: FfiConverterUInt64.readFromCursor(c),
|
|
1695
|
+
});
|
|
1696
|
+
case 4:
|
|
1697
|
+
return new PaymentMethodParsingError.InvalidAmount();
|
|
1698
|
+
case 5:
|
|
1699
|
+
return new PaymentMethodParsingError.Unsupported();
|
|
1700
|
+
default:
|
|
1701
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
1705
|
+
switch (value.tag) {
|
|
1706
|
+
case PaymentMethodParsingError_Tags.NetworkMismatch: {
|
|
1707
|
+
c.writeI32(1);
|
|
1708
|
+
return;
|
|
1709
|
+
}
|
|
1710
|
+
case PaymentMethodParsingError_Tags.InvalidArkAddress: {
|
|
1711
|
+
c.writeI32(2);
|
|
1712
|
+
const inner = value.inner;
|
|
1713
|
+
FfiConverterString.writeIntoCursor(inner.reason, c);
|
|
1714
|
+
return;
|
|
1715
|
+
}
|
|
1716
|
+
case PaymentMethodParsingError_Tags.AmountMismatch: {
|
|
1717
|
+
c.writeI32(3);
|
|
1718
|
+
const inner = value.inner;
|
|
1719
|
+
FfiConverterUInt64.writeIntoCursor(inner.expectedSats, c);
|
|
1720
|
+
FfiConverterUInt64.writeIntoCursor(inner.gotSats, c);
|
|
1721
|
+
return;
|
|
1722
|
+
}
|
|
1723
|
+
case PaymentMethodParsingError_Tags.InvalidAmount: {
|
|
1724
|
+
c.writeI32(4);
|
|
1725
|
+
return;
|
|
1726
|
+
}
|
|
1727
|
+
case PaymentMethodParsingError_Tags.Unsupported: {
|
|
1728
|
+
c.writeI32(5);
|
|
1729
|
+
return;
|
|
1730
|
+
}
|
|
1731
|
+
default:
|
|
1732
|
+
// Throwing from here means that PaymentMethodParsingError_Tags hasn't matched an ordinal.
|
|
1733
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
allocationSize(value: TypeName): number {
|
|
1737
|
+
switch (value.tag) {
|
|
1738
|
+
case PaymentMethodParsingError_Tags.NetworkMismatch: {
|
|
1739
|
+
return 4;
|
|
1740
|
+
}
|
|
1741
|
+
case PaymentMethodParsingError_Tags.InvalidArkAddress: {
|
|
1742
|
+
const inner = value.inner;
|
|
1743
|
+
let size = 4;
|
|
1744
|
+
size += FfiConverterString.allocationSize(inner.reason);
|
|
1745
|
+
return size;
|
|
1746
|
+
}
|
|
1747
|
+
case PaymentMethodParsingError_Tags.AmountMismatch: {
|
|
1748
|
+
const inner = value.inner;
|
|
1749
|
+
let size = 4;
|
|
1750
|
+
size += FfiConverterUInt64.allocationSize(inner.expectedSats);
|
|
1751
|
+
size += FfiConverterUInt64.allocationSize(inner.gotSats);
|
|
1752
|
+
return size;
|
|
1753
|
+
}
|
|
1754
|
+
case PaymentMethodParsingError_Tags.InvalidAmount: {
|
|
1755
|
+
return 4;
|
|
1756
|
+
}
|
|
1757
|
+
case PaymentMethodParsingError_Tags.Unsupported: {
|
|
1758
|
+
return 4;
|
|
1759
|
+
}
|
|
1760
|
+
default:
|
|
1761
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
return new FFIConverter();
|
|
1766
|
+
})();
|
|
1767
|
+
|
|
1768
|
+
/**
|
|
1769
|
+
* One way to pay a [`PaymentRequest`], mirroring
|
|
1770
|
+
* `bark::AvailablePaymentMethod`.
|
|
1771
|
+
*/
|
|
1772
|
+
export type AvailablePaymentMethod = {
|
|
1773
|
+
method: PaymentMethod;
|
|
1774
|
+
/**
|
|
1775
|
+
* Why this option may not be payable. Empty when bark found no problem.
|
|
1776
|
+
*/
|
|
1777
|
+
errors: Array<PaymentMethodParsingError>;
|
|
1778
|
+
/**
|
|
1779
|
+
* Whether `Wallet::send_payment` needs an amount for this method: always
|
|
1780
|
+
* for addresses and LNURL, and for invoices and offers that carry none.
|
|
1781
|
+
*/
|
|
1782
|
+
requiresAmount: boolean;
|
|
1783
|
+
};
|
|
1784
|
+
|
|
1785
|
+
/**
|
|
1786
|
+
* Generated factory for {@link AvailablePaymentMethod} record objects.
|
|
1787
|
+
*/
|
|
1788
|
+
export const AvailablePaymentMethod = (() => {
|
|
1789
|
+
const defaults = () => ({});
|
|
1790
|
+
const create = (() => {
|
|
1791
|
+
return uniffiCreateRecord<
|
|
1792
|
+
AvailablePaymentMethod,
|
|
1793
|
+
ReturnType<typeof defaults>
|
|
1794
|
+
>(defaults);
|
|
1795
|
+
})();
|
|
1796
|
+
return Object.freeze({
|
|
1797
|
+
create,
|
|
1798
|
+
new: create,
|
|
1799
|
+
defaults: () =>
|
|
1800
|
+
Object.freeze(defaults()) as Partial<AvailablePaymentMethod>,
|
|
1801
|
+
});
|
|
1802
|
+
})();
|
|
1803
|
+
|
|
1804
|
+
const FfiConverterTypeAvailablePaymentMethod = (() => {
|
|
1805
|
+
type TypeName = AvailablePaymentMethod;
|
|
1806
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1807
|
+
readFromCursor(c: Cursor): TypeName {
|
|
1808
|
+
return {
|
|
1809
|
+
method: FfiConverterTypePaymentMethod.readFromCursor(c),
|
|
1810
|
+
errors:
|
|
1811
|
+
FfiConverterSequenceTypePaymentMethodParsingError.readFromCursor(c),
|
|
1812
|
+
requiresAmount: FfiConverterBool.readFromCursor(c),
|
|
1813
|
+
};
|
|
1814
|
+
}
|
|
1815
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
1816
|
+
FfiConverterTypePaymentMethod.writeIntoCursor(value.method, c);
|
|
1817
|
+
FfiConverterSequenceTypePaymentMethodParsingError.writeIntoCursor(
|
|
1818
|
+
value.errors,
|
|
1819
|
+
c
|
|
1820
|
+
);
|
|
1821
|
+
FfiConverterBool.writeIntoCursor(value.requiresAmount, c);
|
|
1822
|
+
}
|
|
1823
|
+
allocationSize(value: TypeName): number {
|
|
1824
|
+
return (
|
|
1825
|
+
FfiConverterTypePaymentMethod.allocationSize(value.method) +
|
|
1826
|
+
FfiConverterSequenceTypePaymentMethodParsingError.allocationSize(
|
|
1827
|
+
value.errors
|
|
1828
|
+
) +
|
|
1829
|
+
FfiConverterBool.allocationSize(value.requiresAmount)
|
|
1830
|
+
);
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
return new FFIConverter();
|
|
1834
|
+
})();
|
|
1835
|
+
|
|
1836
|
+
export type Balance = {
|
|
1837
|
+
/**
|
|
1838
|
+
* Sats that can be spent right now. Excludes `needs_refresh_sats`.
|
|
1839
|
+
*/
|
|
1840
|
+
spendableSats: bigint;
|
|
1841
|
+
/**
|
|
1842
|
+
* Sats in VTXOs that have expired or reached the server's maximum exit
|
|
1843
|
+
* depth. They can still be offboarded, exited or refreshed, but not sent
|
|
1844
|
+
* out-of-round until maintenance has refreshed them.
|
|
1845
|
+
*/
|
|
1846
|
+
needsRefreshSats: bigint;
|
|
1847
|
+
pendingInRoundSats: bigint;
|
|
1848
|
+
pendingExitSats: bigint;
|
|
1849
|
+
pendingLightningSendSats: bigint;
|
|
1850
|
+
claimableLightningReceiveSats: bigint;
|
|
1851
|
+
pendingBoardSats: bigint;
|
|
1852
|
+
/**
|
|
1853
|
+
* Sats locked in an outgoing arkoor payment that has not completed yet.
|
|
1854
|
+
*/
|
|
1855
|
+
pendingArkoorSendSats: bigint;
|
|
1856
|
+
/**
|
|
1857
|
+
* Sats locked in an offboard whose transaction has not been broadcast
|
|
1858
|
+
* yet, including any change that comes back.
|
|
1859
|
+
*/
|
|
1860
|
+
pendingOffboardSats: bigint;
|
|
1861
|
+
};
|
|
1862
|
+
|
|
1863
|
+
/**
|
|
1864
|
+
* Generated factory for {@link Balance} record objects.
|
|
1865
|
+
*/
|
|
1866
|
+
export const Balance = (() => {
|
|
1867
|
+
const defaults = () => ({});
|
|
1868
|
+
const create = (() => {
|
|
1869
|
+
return uniffiCreateRecord<Balance, ReturnType<typeof defaults>>(defaults);
|
|
1870
|
+
})();
|
|
1871
|
+
return Object.freeze({
|
|
1872
|
+
create,
|
|
1873
|
+
new: create,
|
|
1874
|
+
defaults: () => Object.freeze(defaults()) as Partial<Balance>,
|
|
1875
|
+
});
|
|
1876
|
+
})();
|
|
1877
|
+
|
|
1878
|
+
const FfiConverterTypeBalance = (() => {
|
|
1879
|
+
type TypeName = Balance;
|
|
1880
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1881
|
+
readFromCursor(c: Cursor): TypeName {
|
|
1882
|
+
return {
|
|
1883
|
+
spendableSats: FfiConverterUInt64.readFromCursor(c),
|
|
1884
|
+
needsRefreshSats: FfiConverterUInt64.readFromCursor(c),
|
|
1885
|
+
pendingInRoundSats: FfiConverterUInt64.readFromCursor(c),
|
|
1886
|
+
pendingExitSats: FfiConverterUInt64.readFromCursor(c),
|
|
1887
|
+
pendingLightningSendSats: FfiConverterUInt64.readFromCursor(c),
|
|
1888
|
+
claimableLightningReceiveSats: FfiConverterUInt64.readFromCursor(c),
|
|
1889
|
+
pendingBoardSats: FfiConverterUInt64.readFromCursor(c),
|
|
1890
|
+
pendingArkoorSendSats: FfiConverterUInt64.readFromCursor(c),
|
|
1891
|
+
pendingOffboardSats: FfiConverterUInt64.readFromCursor(c),
|
|
1892
|
+
};
|
|
1893
|
+
}
|
|
1894
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
1895
|
+
FfiConverterUInt64.writeIntoCursor(value.spendableSats, c);
|
|
1896
|
+
FfiConverterUInt64.writeIntoCursor(value.needsRefreshSats, c);
|
|
1897
|
+
FfiConverterUInt64.writeIntoCursor(value.pendingInRoundSats, c);
|
|
1898
|
+
FfiConverterUInt64.writeIntoCursor(value.pendingExitSats, c);
|
|
1899
|
+
FfiConverterUInt64.writeIntoCursor(value.pendingLightningSendSats, c);
|
|
1900
|
+
FfiConverterUInt64.writeIntoCursor(
|
|
1901
|
+
value.claimableLightningReceiveSats,
|
|
1902
|
+
c
|
|
1903
|
+
);
|
|
1904
|
+
FfiConverterUInt64.writeIntoCursor(value.pendingBoardSats, c);
|
|
1905
|
+
FfiConverterUInt64.writeIntoCursor(value.pendingArkoorSendSats, c);
|
|
1906
|
+
FfiConverterUInt64.writeIntoCursor(value.pendingOffboardSats, c);
|
|
1907
|
+
}
|
|
1908
|
+
allocationSize(value: TypeName): number {
|
|
1909
|
+
return (
|
|
1910
|
+
FfiConverterUInt64.allocationSize(value.spendableSats) +
|
|
1911
|
+
FfiConverterUInt64.allocationSize(value.needsRefreshSats) +
|
|
1912
|
+
FfiConverterUInt64.allocationSize(value.pendingInRoundSats) +
|
|
1913
|
+
FfiConverterUInt64.allocationSize(value.pendingExitSats) +
|
|
1914
|
+
FfiConverterUInt64.allocationSize(value.pendingLightningSendSats) +
|
|
1915
|
+
FfiConverterUInt64.allocationSize(value.claimableLightningReceiveSats) +
|
|
1916
|
+
FfiConverterUInt64.allocationSize(value.pendingBoardSats) +
|
|
1917
|
+
FfiConverterUInt64.allocationSize(value.pendingArkoorSendSats) +
|
|
1918
|
+
FfiConverterUInt64.allocationSize(value.pendingOffboardSats)
|
|
1919
|
+
);
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
return new FFIConverter();
|
|
1923
|
+
})();
|
|
1924
|
+
|
|
1925
|
+
/**
|
|
1926
|
+
* The numbers to show a user without the breakdown of [`Balance`],
|
|
1927
|
+
* mirroring `bark::BalanceSummary`.
|
|
1928
|
+
*
|
|
1929
|
+
* Show `spendable_sats` as what a user can pay with and `total_sats` as what
|
|
1930
|
+
* a user owns.
|
|
1931
|
+
*/
|
|
1932
|
+
export type BalanceSummary = {
|
|
1933
|
+
/**
|
|
1934
|
+
* Sats that can be spent right now.
|
|
1935
|
+
*/
|
|
1936
|
+
spendableSats: bigint;
|
|
1937
|
+
/**
|
|
1938
|
+
* Sats that need a refresh before they can be sent again.
|
|
1939
|
+
*/
|
|
1940
|
+
needsRefreshSats: bigint;
|
|
1941
|
+
/**
|
|
1942
|
+
* Sats held by operations in progress. They either come back as
|
|
1943
|
+
* spendable or leave the wallet, for example to the onchain wallet.
|
|
1944
|
+
*/
|
|
1945
|
+
pendingSats: bigint;
|
|
1946
|
+
/**
|
|
1947
|
+
* All sats that belong to the wallet:
|
|
1948
|
+
* `spendable_sats + needs_refresh_sats + pending_sats`.
|
|
1949
|
+
*/
|
|
1950
|
+
totalSats: bigint;
|
|
1951
|
+
};
|
|
1952
|
+
|
|
1953
|
+
/**
|
|
1954
|
+
* Generated factory for {@link BalanceSummary} record objects.
|
|
1955
|
+
*/
|
|
1956
|
+
export const BalanceSummary = (() => {
|
|
1957
|
+
const defaults = () => ({});
|
|
1958
|
+
const create = (() => {
|
|
1959
|
+
return uniffiCreateRecord<BalanceSummary, ReturnType<typeof defaults>>(
|
|
1960
|
+
defaults
|
|
1961
|
+
);
|
|
1962
|
+
})();
|
|
1963
|
+
return Object.freeze({
|
|
1964
|
+
create,
|
|
1965
|
+
new: create,
|
|
1966
|
+
defaults: () => Object.freeze(defaults()) as Partial<BalanceSummary>,
|
|
1967
|
+
});
|
|
1968
|
+
})();
|
|
1969
|
+
|
|
1970
|
+
const FfiConverterTypeBalanceSummary = (() => {
|
|
1971
|
+
type TypeName = BalanceSummary;
|
|
1972
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1973
|
+
readFromCursor(c: Cursor): TypeName {
|
|
1974
|
+
return {
|
|
1975
|
+
spendableSats: FfiConverterUInt64.readFromCursor(c),
|
|
1976
|
+
needsRefreshSats: FfiConverterUInt64.readFromCursor(c),
|
|
1977
|
+
pendingSats: FfiConverterUInt64.readFromCursor(c),
|
|
1978
|
+
totalSats: FfiConverterUInt64.readFromCursor(c),
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
1982
|
+
FfiConverterUInt64.writeIntoCursor(value.spendableSats, c);
|
|
1983
|
+
FfiConverterUInt64.writeIntoCursor(value.needsRefreshSats, c);
|
|
1984
|
+
FfiConverterUInt64.writeIntoCursor(value.pendingSats, c);
|
|
1985
|
+
FfiConverterUInt64.writeIntoCursor(value.totalSats, c);
|
|
1986
|
+
}
|
|
1987
|
+
allocationSize(value: TypeName): number {
|
|
1988
|
+
return (
|
|
1989
|
+
FfiConverterUInt64.allocationSize(value.spendableSats) +
|
|
1990
|
+
FfiConverterUInt64.allocationSize(value.needsRefreshSats) +
|
|
1991
|
+
FfiConverterUInt64.allocationSize(value.pendingSats) +
|
|
1992
|
+
FfiConverterUInt64.allocationSize(value.totalSats)
|
|
1993
|
+
);
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
return new FFIConverter();
|
|
1997
|
+
})();
|
|
1998
|
+
|
|
1999
|
+
export type LightningInvoice = {
|
|
2000
|
+
invoice: string;
|
|
2001
|
+
paymentHash: string;
|
|
2002
|
+
amountSats: bigint;
|
|
2003
|
+
};
|
|
2004
|
+
|
|
2005
|
+
/**
|
|
2006
|
+
* Generated factory for {@link LightningInvoice} record objects.
|
|
2007
|
+
*/
|
|
2008
|
+
export const LightningInvoice = (() => {
|
|
2009
|
+
const defaults = () => ({});
|
|
2010
|
+
const create = (() => {
|
|
2011
|
+
return uniffiCreateRecord<LightningInvoice, ReturnType<typeof defaults>>(
|
|
2012
|
+
defaults
|
|
2013
|
+
);
|
|
2014
|
+
})();
|
|
2015
|
+
return Object.freeze({
|
|
2016
|
+
create,
|
|
2017
|
+
new: create,
|
|
2018
|
+
defaults: () => Object.freeze(defaults()) as Partial<LightningInvoice>,
|
|
2019
|
+
});
|
|
2020
|
+
})();
|
|
2021
|
+
|
|
2022
|
+
const FfiConverterTypeLightningInvoice = (() => {
|
|
2023
|
+
type TypeName = LightningInvoice;
|
|
2024
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
2025
|
+
readFromCursor(c: Cursor): TypeName {
|
|
2026
|
+
return {
|
|
2027
|
+
invoice: FfiConverterString.readFromCursor(c),
|
|
2028
|
+
paymentHash: FfiConverterString.readFromCursor(c),
|
|
2029
|
+
amountSats: FfiConverterUInt64.readFromCursor(c),
|
|
2030
|
+
};
|
|
2031
|
+
}
|
|
2032
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
2033
|
+
FfiConverterString.writeIntoCursor(value.invoice, c);
|
|
2034
|
+
FfiConverterString.writeIntoCursor(value.paymentHash, c);
|
|
2035
|
+
FfiConverterUInt64.writeIntoCursor(value.amountSats, c);
|
|
2036
|
+
}
|
|
2037
|
+
allocationSize(value: TypeName): number {
|
|
2038
|
+
return (
|
|
2039
|
+
FfiConverterString.allocationSize(value.invoice) +
|
|
2040
|
+
FfiConverterString.allocationSize(value.paymentHash) +
|
|
2041
|
+
FfiConverterUInt64.allocationSize(value.amountSats)
|
|
2042
|
+
);
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
return new FFIConverter();
|
|
2046
|
+
})();
|
|
2047
|
+
|
|
2048
|
+
/**
|
|
2049
|
+
* A BIP 321 URI built by `Wallet::bip321_uri`, with the destinations in it.
|
|
2050
|
+
*/
|
|
2051
|
+
export type Bip321Uri = {
|
|
2052
|
+
/**
|
|
2053
|
+
* The `bitcoin:` URI, for example to show as a QR code.
|
|
2054
|
+
*/
|
|
2055
|
+
uri: string;
|
|
2056
|
+
/**
|
|
2057
|
+
* The new Ark address in the URI.
|
|
2058
|
+
*/
|
|
2059
|
+
arkAddress?: string;
|
|
2060
|
+
/**
|
|
2061
|
+
* The new invoice in the URI. Follow the receive by its `payment_hash`.
|
|
2062
|
+
*/
|
|
2063
|
+
lightningInvoice?: LightningInvoice;
|
|
2064
|
+
/**
|
|
2065
|
+
* The onchain address in the URI.
|
|
2066
|
+
*/
|
|
2067
|
+
onchainAddress?: string;
|
|
2068
|
+
};
|
|
2069
|
+
|
|
2070
|
+
/**
|
|
2071
|
+
* Generated factory for {@link Bip321Uri} record objects.
|
|
2072
|
+
*/
|
|
2073
|
+
export const Bip321Uri = (() => {
|
|
2074
|
+
const defaults = () => ({});
|
|
2075
|
+
const create = (() => {
|
|
2076
|
+
return uniffiCreateRecord<Bip321Uri, ReturnType<typeof defaults>>(defaults);
|
|
2077
|
+
})();
|
|
2078
|
+
return Object.freeze({
|
|
2079
|
+
create,
|
|
2080
|
+
new: create,
|
|
2081
|
+
defaults: () => Object.freeze(defaults()) as Partial<Bip321Uri>,
|
|
2082
|
+
});
|
|
2083
|
+
})();
|
|
2084
|
+
|
|
2085
|
+
const FfiConverterTypeBip321Uri = (() => {
|
|
2086
|
+
type TypeName = Bip321Uri;
|
|
2087
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
2088
|
+
readFromCursor(c: Cursor): TypeName {
|
|
2089
|
+
return {
|
|
2090
|
+
uri: FfiConverterString.readFromCursor(c),
|
|
2091
|
+
arkAddress: FfiConverterOptionalString.readFromCursor(c),
|
|
2092
|
+
lightningInvoice:
|
|
2093
|
+
FfiConverterOptionalTypeLightningInvoice.readFromCursor(c),
|
|
2094
|
+
onchainAddress: FfiConverterOptionalString.readFromCursor(c),
|
|
2095
|
+
};
|
|
2096
|
+
}
|
|
2097
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
2098
|
+
FfiConverterString.writeIntoCursor(value.uri, c);
|
|
2099
|
+
FfiConverterOptionalString.writeIntoCursor(value.arkAddress, c);
|
|
2100
|
+
FfiConverterOptionalTypeLightningInvoice.writeIntoCursor(
|
|
2101
|
+
value.lightningInvoice,
|
|
2102
|
+
c
|
|
2103
|
+
);
|
|
2104
|
+
FfiConverterOptionalString.writeIntoCursor(value.onchainAddress, c);
|
|
2105
|
+
}
|
|
2106
|
+
allocationSize(value: TypeName): number {
|
|
2107
|
+
return (
|
|
2108
|
+
FfiConverterString.allocationSize(value.uri) +
|
|
2109
|
+
FfiConverterOptionalString.allocationSize(value.arkAddress) +
|
|
2110
|
+
FfiConverterOptionalTypeLightningInvoice.allocationSize(
|
|
2111
|
+
value.lightningInvoice
|
|
2112
|
+
) +
|
|
2113
|
+
FfiConverterOptionalString.allocationSize(value.onchainAddress)
|
|
2114
|
+
);
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
return new FFIConverter();
|
|
2118
|
+
})();
|
|
2119
|
+
|
|
2120
|
+
/**
|
|
2121
|
+
* What `Wallet::bip321_uri` puts in the URI. Every field is optional.
|
|
2122
|
+
*/
|
|
2123
|
+
export type Bip321UriOptions = {
|
|
2124
|
+
/**
|
|
2125
|
+
* The amount to request. A lightning invoice needs one.
|
|
2126
|
+
*
|
|
2127
|
+
* Default: none
|
|
2128
|
+
*/
|
|
2129
|
+
amountSats?: bigint;
|
|
2130
|
+
/**
|
|
2131
|
+
* Default: none
|
|
2132
|
+
*/
|
|
2133
|
+
label?: string;
|
|
2134
|
+
/**
|
|
2135
|
+
* Default: none
|
|
2136
|
+
*/
|
|
2137
|
+
message?: string;
|
|
2138
|
+
/**
|
|
2139
|
+
* Whether to include a new Ark address.
|
|
2140
|
+
*
|
|
2141
|
+
* Default: true
|
|
2142
|
+
*/
|
|
2143
|
+
ark: boolean;
|
|
2144
|
+
/**
|
|
2145
|
+
* Whether to include a new BOLT11 invoice. Ignored without
|
|
2146
|
+
* `amount_sats`.
|
|
2147
|
+
*
|
|
2148
|
+
* Default: true
|
|
2149
|
+
*/
|
|
2150
|
+
lightning: boolean;
|
|
2151
|
+
/**
|
|
2152
|
+
* An onchain address to include, such as one from the host's own
|
|
2153
|
+
* onchain wallet. It must be for the wallet's network. As in bark's own
|
|
2154
|
+
* builder, a mainnet address goes in the URI path and any other in a
|
|
2155
|
+
* `tb=` parameter.
|
|
2156
|
+
*
|
|
2157
|
+
* Default: none
|
|
2158
|
+
*/
|
|
2159
|
+
onchainAddress?: string;
|
|
2160
|
+
};
|
|
2161
|
+
|
|
2162
|
+
/**
|
|
2163
|
+
* Generated factory for {@link Bip321UriOptions} record objects.
|
|
2164
|
+
*/
|
|
2165
|
+
export const Bip321UriOptions = (() => {
|
|
2166
|
+
const defaults = () => ({
|
|
2167
|
+
amountSats: undefined,
|
|
2168
|
+
label: undefined,
|
|
2169
|
+
message: undefined,
|
|
2170
|
+
ark: true,
|
|
2171
|
+
lightning: true,
|
|
2172
|
+
onchainAddress: undefined,
|
|
2173
|
+
});
|
|
2174
|
+
const create = (() => {
|
|
2175
|
+
return uniffiCreateRecord<Bip321UriOptions, ReturnType<typeof defaults>>(
|
|
2176
|
+
defaults
|
|
2177
|
+
);
|
|
2178
|
+
})();
|
|
2179
|
+
return Object.freeze({
|
|
2180
|
+
create,
|
|
2181
|
+
new: create,
|
|
2182
|
+
defaults: () => Object.freeze(defaults()) as Partial<Bip321UriOptions>,
|
|
2183
|
+
});
|
|
2184
|
+
})();
|
|
2185
|
+
|
|
2186
|
+
const FfiConverterTypeBip321UriOptions = (() => {
|
|
2187
|
+
type TypeName = Bip321UriOptions;
|
|
2188
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
2189
|
+
readFromCursor(c: Cursor): TypeName {
|
|
2190
|
+
return {
|
|
2191
|
+
amountSats: FfiConverterOptionalUInt64.readFromCursor(c),
|
|
2192
|
+
label: FfiConverterOptionalString.readFromCursor(c),
|
|
2193
|
+
message: FfiConverterOptionalString.readFromCursor(c),
|
|
2194
|
+
ark: FfiConverterBool.readFromCursor(c),
|
|
2195
|
+
lightning: FfiConverterBool.readFromCursor(c),
|
|
2196
|
+
onchainAddress: FfiConverterOptionalString.readFromCursor(c),
|
|
2197
|
+
};
|
|
2198
|
+
}
|
|
2199
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
2200
|
+
FfiConverterOptionalUInt64.writeIntoCursor(value.amountSats, c);
|
|
2201
|
+
FfiConverterOptionalString.writeIntoCursor(value.label, c);
|
|
2202
|
+
FfiConverterOptionalString.writeIntoCursor(value.message, c);
|
|
2203
|
+
FfiConverterBool.writeIntoCursor(value.ark, c);
|
|
2204
|
+
FfiConverterBool.writeIntoCursor(value.lightning, c);
|
|
2205
|
+
FfiConverterOptionalString.writeIntoCursor(value.onchainAddress, c);
|
|
2206
|
+
}
|
|
2207
|
+
allocationSize(value: TypeName): number {
|
|
2208
|
+
return (
|
|
2209
|
+
FfiConverterOptionalUInt64.allocationSize(value.amountSats) +
|
|
2210
|
+
FfiConverterOptionalString.allocationSize(value.label) +
|
|
2211
|
+
FfiConverterOptionalString.allocationSize(value.message) +
|
|
2212
|
+
FfiConverterBool.allocationSize(value.ark) +
|
|
2213
|
+
FfiConverterBool.allocationSize(value.lightning) +
|
|
2214
|
+
FfiConverterOptionalString.allocationSize(value.onchainAddress)
|
|
2215
|
+
);
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
return new FFIConverter();
|
|
2219
|
+
})();
|
|
2220
|
+
|
|
2221
|
+
/**
|
|
2222
|
+
* Reference to a block in the blockchain
|
|
2223
|
+
*/
|
|
2224
|
+
export type BlockRef = {
|
|
2225
|
+
height: number;
|
|
2226
|
+
hash: string;
|
|
2227
|
+
};
|
|
2228
|
+
|
|
2229
|
+
/**
|
|
2230
|
+
* Generated factory for {@link BlockRef} record objects.
|
|
2231
|
+
*/
|
|
2232
|
+
export const BlockRef = (() => {
|
|
2233
|
+
const defaults = () => ({});
|
|
2234
|
+
const create = (() => {
|
|
2235
|
+
return uniffiCreateRecord<BlockRef, ReturnType<typeof defaults>>(defaults);
|
|
2236
|
+
})();
|
|
2237
|
+
return Object.freeze({
|
|
2238
|
+
create,
|
|
2239
|
+
new: create,
|
|
2240
|
+
defaults: () => Object.freeze(defaults()) as Partial<BlockRef>,
|
|
2241
|
+
});
|
|
2242
|
+
})();
|
|
2243
|
+
|
|
2244
|
+
const FfiConverterTypeBlockRef = (() => {
|
|
2245
|
+
type TypeName = BlockRef;
|
|
2246
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
2247
|
+
readFromCursor(c: Cursor): TypeName {
|
|
2248
|
+
return {
|
|
2249
|
+
height: FfiConverterUInt32.readFromCursor(c),
|
|
2250
|
+
hash: FfiConverterString.readFromCursor(c),
|
|
2251
|
+
};
|
|
2252
|
+
}
|
|
2253
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
2254
|
+
FfiConverterUInt32.writeIntoCursor(value.height, c);
|
|
2255
|
+
FfiConverterString.writeIntoCursor(value.hash, c);
|
|
2256
|
+
}
|
|
2257
|
+
allocationSize(value: TypeName): number {
|
|
2258
|
+
return (
|
|
2259
|
+
FfiConverterUInt32.allocationSize(value.height) +
|
|
2260
|
+
FfiConverterString.allocationSize(value.hash)
|
|
2261
|
+
);
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
return new FFIConverter();
|
|
2265
|
+
})();
|
|
2266
|
+
|
|
2267
|
+
/**
|
|
2268
|
+
* Destination for an externally funded board (e.g. a payjoin receive).
|
|
2269
|
+
*
|
|
2270
|
+
* The funding script commits to the derived keypair and expiry height, so
|
|
2271
|
+
* `keypair_index` and `expiry_height` must be passed back unchanged to
|
|
2272
|
+
* `board_psbt` once the funding PSBT is available — including on retries
|
|
2273
|
+
* after the sender changes the transaction.
|
|
2274
|
+
*/
|
|
2275
|
+
export type BoardFundingInfo = {
|
|
2276
|
+
address: string;
|
|
2277
|
+
expiryHeight: number;
|
|
2278
|
+
keypairIndex: number;
|
|
2279
|
+
};
|
|
2280
|
+
|
|
2281
|
+
/**
|
|
2282
|
+
* Generated factory for {@link BoardFundingInfo} record objects.
|
|
2283
|
+
*/
|
|
2284
|
+
export const BoardFundingInfo = (() => {
|
|
2285
|
+
const defaults = () => ({});
|
|
2286
|
+
const create = (() => {
|
|
2287
|
+
return uniffiCreateRecord<BoardFundingInfo, ReturnType<typeof defaults>>(
|
|
2288
|
+
defaults
|
|
2289
|
+
);
|
|
2290
|
+
})();
|
|
2291
|
+
return Object.freeze({
|
|
2292
|
+
create,
|
|
2293
|
+
new: create,
|
|
2294
|
+
defaults: () => Object.freeze(defaults()) as Partial<BoardFundingInfo>,
|
|
2295
|
+
});
|
|
2296
|
+
})();
|
|
2297
|
+
|
|
2298
|
+
const FfiConverterTypeBoardFundingInfo = (() => {
|
|
2299
|
+
type TypeName = BoardFundingInfo;
|
|
2300
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
2301
|
+
readFromCursor(c: Cursor): TypeName {
|
|
2302
|
+
return {
|
|
2303
|
+
address: FfiConverterString.readFromCursor(c),
|
|
2304
|
+
expiryHeight: FfiConverterUInt32.readFromCursor(c),
|
|
2305
|
+
keypairIndex: FfiConverterUInt32.readFromCursor(c),
|
|
2306
|
+
};
|
|
2307
|
+
}
|
|
2308
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
2309
|
+
FfiConverterString.writeIntoCursor(value.address, c);
|
|
2310
|
+
FfiConverterUInt32.writeIntoCursor(value.expiryHeight, c);
|
|
2311
|
+
FfiConverterUInt32.writeIntoCursor(value.keypairIndex, c);
|
|
2312
|
+
}
|
|
2313
|
+
allocationSize(value: TypeName): number {
|
|
2314
|
+
return (
|
|
2315
|
+
FfiConverterString.allocationSize(value.address) +
|
|
2316
|
+
FfiConverterUInt32.allocationSize(value.expiryHeight) +
|
|
2317
|
+
FfiConverterUInt32.allocationSize(value.keypairIndex)
|
|
2318
|
+
);
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
return new FFIConverter();
|
|
2322
|
+
})();
|
|
2323
|
+
|
|
2324
|
+
/**
|
|
2325
|
+
* Fields of a BOLT11 invoice, as returned by `decode_bolt11_invoice`.
|
|
2326
|
+
*/
|
|
2327
|
+
export type Bolt11InvoiceDetails = {
|
|
2328
|
+
paymentHash: string;
|
|
2329
|
+
/**
|
|
2330
|
+
* `None` for an amountless invoice, which needs an amount to pay.
|
|
2331
|
+
*/
|
|
2332
|
+
amountMsat?: bigint;
|
|
2333
|
+
/**
|
|
2334
|
+
* `amount_msat` rounded up to whole sats.
|
|
2335
|
+
*/
|
|
2336
|
+
amountSats?: bigint;
|
|
2337
|
+
/**
|
|
2338
|
+
* The description, when the invoice carries it directly.
|
|
2339
|
+
*/
|
|
2340
|
+
description?: string;
|
|
2341
|
+
/**
|
|
2342
|
+
* The hex SHA-256 of the description, when the invoice carries that
|
|
2343
|
+
* instead.
|
|
2344
|
+
*/
|
|
2345
|
+
descriptionHash?: string;
|
|
2346
|
+
/**
|
|
2347
|
+
* The payee's node public key, hex.
|
|
2348
|
+
*/
|
|
2349
|
+
payeePubkey: string;
|
|
2350
|
+
/**
|
|
2351
|
+
* Creation time, in unix seconds.
|
|
2352
|
+
*/
|
|
2353
|
+
createdAt: bigint;
|
|
2354
|
+
/**
|
|
2355
|
+
* Expiry time, in unix seconds. Compare it with the current time to
|
|
2356
|
+
* tell whether the invoice can still be paid.
|
|
2357
|
+
*/
|
|
2358
|
+
expiresAt: bigint;
|
|
2359
|
+
};
|
|
2360
|
+
|
|
2361
|
+
/**
|
|
2362
|
+
* Generated factory for {@link Bolt11InvoiceDetails} record objects.
|
|
2363
|
+
*/
|
|
2364
|
+
export const Bolt11InvoiceDetails = (() => {
|
|
2365
|
+
const defaults = () => ({});
|
|
2366
|
+
const create = (() => {
|
|
2367
|
+
return uniffiCreateRecord<
|
|
2368
|
+
Bolt11InvoiceDetails,
|
|
2369
|
+
ReturnType<typeof defaults>
|
|
2370
|
+
>(defaults);
|
|
2371
|
+
})();
|
|
2372
|
+
return Object.freeze({
|
|
2373
|
+
create,
|
|
2374
|
+
new: create,
|
|
2375
|
+
defaults: () => Object.freeze(defaults()) as Partial<Bolt11InvoiceDetails>,
|
|
2376
|
+
});
|
|
2377
|
+
})();
|
|
2378
|
+
|
|
2379
|
+
const FfiConverterTypeBolt11InvoiceDetails = (() => {
|
|
2380
|
+
type TypeName = Bolt11InvoiceDetails;
|
|
2381
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
2382
|
+
readFromCursor(c: Cursor): TypeName {
|
|
2383
|
+
return {
|
|
2384
|
+
paymentHash: FfiConverterString.readFromCursor(c),
|
|
2385
|
+
amountMsat: FfiConverterOptionalUInt64.readFromCursor(c),
|
|
2386
|
+
amountSats: FfiConverterOptionalUInt64.readFromCursor(c),
|
|
2387
|
+
description: FfiConverterOptionalString.readFromCursor(c),
|
|
2388
|
+
descriptionHash: FfiConverterOptionalString.readFromCursor(c),
|
|
2389
|
+
payeePubkey: FfiConverterString.readFromCursor(c),
|
|
2390
|
+
createdAt: FfiConverterUInt64.readFromCursor(c),
|
|
2391
|
+
expiresAt: FfiConverterUInt64.readFromCursor(c),
|
|
2392
|
+
};
|
|
2393
|
+
}
|
|
2394
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
2395
|
+
FfiConverterString.writeIntoCursor(value.paymentHash, c);
|
|
2396
|
+
FfiConverterOptionalUInt64.writeIntoCursor(value.amountMsat, c);
|
|
2397
|
+
FfiConverterOptionalUInt64.writeIntoCursor(value.amountSats, c);
|
|
2398
|
+
FfiConverterOptionalString.writeIntoCursor(value.description, c);
|
|
2399
|
+
FfiConverterOptionalString.writeIntoCursor(value.descriptionHash, c);
|
|
2400
|
+
FfiConverterString.writeIntoCursor(value.payeePubkey, c);
|
|
2401
|
+
FfiConverterUInt64.writeIntoCursor(value.createdAt, c);
|
|
2402
|
+
FfiConverterUInt64.writeIntoCursor(value.expiresAt, c);
|
|
2403
|
+
}
|
|
2404
|
+
allocationSize(value: TypeName): number {
|
|
2405
|
+
return (
|
|
2406
|
+
FfiConverterString.allocationSize(value.paymentHash) +
|
|
2407
|
+
FfiConverterOptionalUInt64.allocationSize(value.amountMsat) +
|
|
2408
|
+
FfiConverterOptionalUInt64.allocationSize(value.amountSats) +
|
|
2409
|
+
FfiConverterOptionalString.allocationSize(value.description) +
|
|
2410
|
+
FfiConverterOptionalString.allocationSize(value.descriptionHash) +
|
|
2411
|
+
FfiConverterString.allocationSize(value.payeePubkey) +
|
|
2412
|
+
FfiConverterUInt64.allocationSize(value.createdAt) +
|
|
2413
|
+
FfiConverterUInt64.allocationSize(value.expiresAt)
|
|
2414
|
+
);
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
return new FFIConverter();
|
|
2418
|
+
})();
|
|
2419
|
+
|
|
2420
|
+
export type Config = {
|
|
2421
|
+
serverAddress: string;
|
|
2422
|
+
serverAccessToken?: string;
|
|
2423
|
+
esploraAddress?: string;
|
|
2424
|
+
bitcoindAddress?: string;
|
|
2425
|
+
bitcoindCookiefile?: string;
|
|
2426
|
+
bitcoindUser?: string;
|
|
2427
|
+
bitcoindPass?: string;
|
|
2428
|
+
vtxoRefreshExpiryThreshold?: number;
|
|
2429
|
+
vtxoExitMargin?: number;
|
|
2430
|
+
htlcRecvClaimDelta?: number;
|
|
2431
|
+
fallbackFeeRate?: bigint;
|
|
2432
|
+
roundTxRequiredConfirmations?: number;
|
|
2433
|
+
daemonSyncIntervalSecs?: bigint;
|
|
2434
|
+
offboardRequiredConfirmations?: number;
|
|
2435
|
+
daemonManualSync?: boolean;
|
|
2436
|
+
lightningReceiveClaimRetries?: number;
|
|
2437
|
+
userAgent?: string;
|
|
2438
|
+
/**
|
|
2439
|
+
* How many consecutive unused seed-derived VTXO key indices a scan
|
|
2440
|
+
* crosses before concluding a VTXO isn't ours.
|
|
2441
|
+
*
|
|
2442
|
+
* Used by `Wallet::recover_vtxos` and `Wallet::import_vtxo(s)`, and by
|
|
1125
2443
|
* the seed-recovery scan that runs at wallet creation. Every match
|
|
1126
2444
|
* extends the window, so this bounds the run of unused indices, not the
|
|
1127
2445
|
* total keys derived. Raise it for a wallet that handed out many
|
|
@@ -1249,58 +2567,177 @@ const FfiConverterTypeConfig = (() => {
|
|
|
1249
2567
|
})();
|
|
1250
2568
|
|
|
1251
2569
|
/**
|
|
1252
|
-
* Parameters for creating a CPFP (Child Pays For Parent) transaction
|
|
2570
|
+
* Parameters for creating a CPFP (Child Pays For Parent) transaction
|
|
2571
|
+
*/
|
|
2572
|
+
export type CpfpParams = {
|
|
2573
|
+
txHex: string;
|
|
2574
|
+
feesType: string;
|
|
2575
|
+
effectiveFeeRateSatPerVb: bigint;
|
|
2576
|
+
currentPackageFeeSats?: bigint;
|
|
2577
|
+
};
|
|
2578
|
+
|
|
2579
|
+
/**
|
|
2580
|
+
* Generated factory for {@link CpfpParams} record objects.
|
|
2581
|
+
*/
|
|
2582
|
+
export const CpfpParams = (() => {
|
|
2583
|
+
const defaults = () => ({});
|
|
2584
|
+
const create = (() => {
|
|
2585
|
+
return uniffiCreateRecord<CpfpParams, ReturnType<typeof defaults>>(
|
|
2586
|
+
defaults
|
|
2587
|
+
);
|
|
2588
|
+
})();
|
|
2589
|
+
return Object.freeze({
|
|
2590
|
+
create,
|
|
2591
|
+
new: create,
|
|
2592
|
+
defaults: () => Object.freeze(defaults()) as Partial<CpfpParams>,
|
|
2593
|
+
});
|
|
2594
|
+
})();
|
|
2595
|
+
|
|
2596
|
+
const FfiConverterTypeCpfpParams = (() => {
|
|
2597
|
+
type TypeName = CpfpParams;
|
|
2598
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
2599
|
+
readFromCursor(c: Cursor): TypeName {
|
|
2600
|
+
return {
|
|
2601
|
+
txHex: FfiConverterString.readFromCursor(c),
|
|
2602
|
+
feesType: FfiConverterString.readFromCursor(c),
|
|
2603
|
+
effectiveFeeRateSatPerVb: FfiConverterUInt64.readFromCursor(c),
|
|
2604
|
+
currentPackageFeeSats: FfiConverterOptionalUInt64.readFromCursor(c),
|
|
2605
|
+
};
|
|
2606
|
+
}
|
|
2607
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
2608
|
+
FfiConverterString.writeIntoCursor(value.txHex, c);
|
|
2609
|
+
FfiConverterString.writeIntoCursor(value.feesType, c);
|
|
2610
|
+
FfiConverterUInt64.writeIntoCursor(value.effectiveFeeRateSatPerVb, c);
|
|
2611
|
+
FfiConverterOptionalUInt64.writeIntoCursor(
|
|
2612
|
+
value.currentPackageFeeSats,
|
|
2613
|
+
c
|
|
2614
|
+
);
|
|
2615
|
+
}
|
|
2616
|
+
allocationSize(value: TypeName): number {
|
|
2617
|
+
return (
|
|
2618
|
+
FfiConverterString.allocationSize(value.txHex) +
|
|
2619
|
+
FfiConverterString.allocationSize(value.feesType) +
|
|
2620
|
+
FfiConverterUInt64.allocationSize(value.effectiveFeeRateSatPerVb) +
|
|
2621
|
+
FfiConverterOptionalUInt64.allocationSize(value.currentPackageFeeSats)
|
|
2622
|
+
);
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
return new FFIConverter();
|
|
2626
|
+
})();
|
|
2627
|
+
|
|
2628
|
+
/**
|
|
2629
|
+
* What [`read_datadir_info`] found in a wallet directory.
|
|
2630
|
+
*/
|
|
2631
|
+
export type DatadirInfo = {
|
|
2632
|
+
/**
|
|
2633
|
+
* Path of the database file that was read.
|
|
2634
|
+
*/
|
|
2635
|
+
dbFile: string;
|
|
2636
|
+
network: Network;
|
|
2637
|
+
/**
|
|
2638
|
+
* Fingerprint of the wallet seed, as `Wallet::fingerprint` returns it.
|
|
2639
|
+
* Compare it against the seed you are about to open with to catch a
|
|
2640
|
+
* restore-over-the-wrong-wallet before any file is touched.
|
|
2641
|
+
*/
|
|
2642
|
+
fingerprint: string;
|
|
2643
|
+
};
|
|
2644
|
+
|
|
2645
|
+
/**
|
|
2646
|
+
* Generated factory for {@link DatadirInfo} record objects.
|
|
2647
|
+
*/
|
|
2648
|
+
export const DatadirInfo = (() => {
|
|
2649
|
+
const defaults = () => ({});
|
|
2650
|
+
const create = (() => {
|
|
2651
|
+
return uniffiCreateRecord<DatadirInfo, ReturnType<typeof defaults>>(
|
|
2652
|
+
defaults
|
|
2653
|
+
);
|
|
2654
|
+
})();
|
|
2655
|
+
return Object.freeze({
|
|
2656
|
+
create,
|
|
2657
|
+
new: create,
|
|
2658
|
+
defaults: () => Object.freeze(defaults()) as Partial<DatadirInfo>,
|
|
2659
|
+
});
|
|
2660
|
+
})();
|
|
2661
|
+
|
|
2662
|
+
const FfiConverterTypeDatadirInfo = (() => {
|
|
2663
|
+
type TypeName = DatadirInfo;
|
|
2664
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
2665
|
+
readFromCursor(c: Cursor): TypeName {
|
|
2666
|
+
return {
|
|
2667
|
+
dbFile: FfiConverterString.readFromCursor(c),
|
|
2668
|
+
network: FfiConverterTypeNetwork.readFromCursor(c),
|
|
2669
|
+
fingerprint: FfiConverterString.readFromCursor(c),
|
|
2670
|
+
};
|
|
2671
|
+
}
|
|
2672
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
2673
|
+
FfiConverterString.writeIntoCursor(value.dbFile, c);
|
|
2674
|
+
FfiConverterTypeNetwork.writeIntoCursor(value.network, c);
|
|
2675
|
+
FfiConverterString.writeIntoCursor(value.fingerprint, c);
|
|
2676
|
+
}
|
|
2677
|
+
allocationSize(value: TypeName): number {
|
|
2678
|
+
return (
|
|
2679
|
+
FfiConverterString.allocationSize(value.dbFile) +
|
|
2680
|
+
FfiConverterTypeNetwork.allocationSize(value.network) +
|
|
2681
|
+
FfiConverterString.allocationSize(value.fingerprint)
|
|
2682
|
+
);
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
return new FFIConverter();
|
|
2686
|
+
})();
|
|
2687
|
+
|
|
2688
|
+
/**
|
|
2689
|
+
* Wallet information that helps to debug issues, mirroring
|
|
2690
|
+
* `bark::DebugInfo` (what `bark debug-info` prints). Users can share it in
|
|
2691
|
+
* support requests.
|
|
1253
2692
|
*/
|
|
1254
|
-
export type
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
2693
|
+
export type DebugInfo = {
|
|
2694
|
+
network: Network;
|
|
2695
|
+
/**
|
|
2696
|
+
* The wallet's server mailbox id, hex-encoded like
|
|
2697
|
+
* `Wallet::mailbox_identifier`.
|
|
2698
|
+
*/
|
|
2699
|
+
mailboxId: string;
|
|
2700
|
+
/**
|
|
2701
|
+
* The xpub every VTXO keypair is derived from.
|
|
2702
|
+
*/
|
|
2703
|
+
vtxoXpub: string;
|
|
1259
2704
|
};
|
|
1260
2705
|
|
|
1261
2706
|
/**
|
|
1262
|
-
* Generated factory for {@link
|
|
2707
|
+
* Generated factory for {@link DebugInfo} record objects.
|
|
1263
2708
|
*/
|
|
1264
|
-
export const
|
|
2709
|
+
export const DebugInfo = (() => {
|
|
1265
2710
|
const defaults = () => ({});
|
|
1266
2711
|
const create = (() => {
|
|
1267
|
-
return uniffiCreateRecord<
|
|
1268
|
-
defaults
|
|
1269
|
-
);
|
|
2712
|
+
return uniffiCreateRecord<DebugInfo, ReturnType<typeof defaults>>(defaults);
|
|
1270
2713
|
})();
|
|
1271
2714
|
return Object.freeze({
|
|
1272
2715
|
create,
|
|
1273
2716
|
new: create,
|
|
1274
|
-
defaults: () => Object.freeze(defaults()) as Partial<
|
|
2717
|
+
defaults: () => Object.freeze(defaults()) as Partial<DebugInfo>,
|
|
1275
2718
|
});
|
|
1276
2719
|
})();
|
|
1277
2720
|
|
|
1278
|
-
const
|
|
1279
|
-
type TypeName =
|
|
2721
|
+
const FfiConverterTypeDebugInfo = (() => {
|
|
2722
|
+
type TypeName = DebugInfo;
|
|
1280
2723
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1281
2724
|
readFromCursor(c: Cursor): TypeName {
|
|
1282
2725
|
return {
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
currentPackageFeeSats: FfiConverterOptionalUInt64.readFromCursor(c),
|
|
2726
|
+
network: FfiConverterTypeNetwork.readFromCursor(c),
|
|
2727
|
+
mailboxId: FfiConverterString.readFromCursor(c),
|
|
2728
|
+
vtxoXpub: FfiConverterString.readFromCursor(c),
|
|
1287
2729
|
};
|
|
1288
2730
|
}
|
|
1289
2731
|
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
1290
|
-
|
|
1291
|
-
FfiConverterString.writeIntoCursor(value.
|
|
1292
|
-
|
|
1293
|
-
FfiConverterOptionalUInt64.writeIntoCursor(
|
|
1294
|
-
value.currentPackageFeeSats,
|
|
1295
|
-
c
|
|
1296
|
-
);
|
|
2732
|
+
FfiConverterTypeNetwork.writeIntoCursor(value.network, c);
|
|
2733
|
+
FfiConverterString.writeIntoCursor(value.mailboxId, c);
|
|
2734
|
+
FfiConverterString.writeIntoCursor(value.vtxoXpub, c);
|
|
1297
2735
|
}
|
|
1298
2736
|
allocationSize(value: TypeName): number {
|
|
1299
2737
|
return (
|
|
1300
|
-
|
|
1301
|
-
FfiConverterString.allocationSize(value.
|
|
1302
|
-
|
|
1303
|
-
FfiConverterOptionalUInt64.allocationSize(value.currentPackageFeeSats)
|
|
2738
|
+
FfiConverterTypeNetwork.allocationSize(value.network) +
|
|
2739
|
+
FfiConverterString.allocationSize(value.mailboxId) +
|
|
2740
|
+
FfiConverterString.allocationSize(value.vtxoXpub)
|
|
1304
2741
|
);
|
|
1305
2742
|
}
|
|
1306
2743
|
}
|
|
@@ -1366,9 +2803,10 @@ const FfiConverterTypeDestination = (() => {
|
|
|
1366
2803
|
*/
|
|
1367
2804
|
export type EmergencyExitFeeEstimate = {
|
|
1368
2805
|
/**
|
|
1369
|
-
* CPFP fees to broadcast every not-yet-confirmed exit transaction
|
|
1370
|
-
*
|
|
1371
|
-
*
|
|
2806
|
+
* CPFP fees to broadcast every not-yet-confirmed exit transaction,
|
|
2807
|
+
* scaled by the fee margin, so deliberately above `fee_rate × weight`.
|
|
2808
|
+
* Paid now from confirmed onchain funds; this is the onchain balance to
|
|
2809
|
+
* fund the exit with at that margin.
|
|
1372
2810
|
*/
|
|
1373
2811
|
exitBroadcastFeeSats: bigint;
|
|
1374
2812
|
/**
|
|
@@ -1381,9 +2819,9 @@ export type EmergencyExitFeeEstimate = {
|
|
|
1381
2819
|
*/
|
|
1382
2820
|
totalFeeSats: bigint;
|
|
1383
2821
|
/**
|
|
1384
|
-
* Fee rate the exit-broadcast leg was priced at
|
|
1385
|
-
* Unless an explicit rate was supplied, the claim
|
|
1386
|
-
* separately at the chain's `regular` rate.
|
|
2822
|
+
* Fee rate the exit-broadcast leg was priced at, before the fee margin
|
|
2823
|
+
* (sat/vB, rounded up). Unless an explicit rate was supplied, the claim
|
|
2824
|
+
* leg is priced separately at the chain's `regular` rate.
|
|
1387
2825
|
*/
|
|
1388
2826
|
feeRateSatPerVb: bigint;
|
|
1389
2827
|
/**
|
|
@@ -1392,10 +2830,12 @@ export type EmergencyExitFeeEstimate = {
|
|
|
1392
2830
|
*/
|
|
1393
2831
|
txsToBroadcast: bigint;
|
|
1394
2832
|
/**
|
|
1395
|
-
* Whether the wallet's
|
|
1396
|
-
*
|
|
1397
|
-
*
|
|
1398
|
-
*
|
|
2833
|
+
* Whether the onchain wallet's last synced balance covers
|
|
2834
|
+
* `exit_broadcast_fee_sats`. `false` without an onchain wallet.
|
|
2835
|
+
*
|
|
2836
|
+
* Deprecated: bark dropped this field. Compare `exit_broadcast_fee_sats`
|
|
2837
|
+
* against the onchain balance instead; this one goes away in a later
|
|
2838
|
+
* release, as it does in bark-rest.
|
|
1399
2839
|
*/
|
|
1400
2840
|
fundable: boolean;
|
|
1401
2841
|
};
|
|
@@ -1470,6 +2910,7 @@ export enum ExitStateKind {
|
|
|
1470
2910
|
ClaimInProgress,
|
|
1471
2911
|
Claimed,
|
|
1472
2912
|
VtxoAlreadySpent,
|
|
2913
|
+
VtxoSwept,
|
|
1473
2914
|
Canceled,
|
|
1474
2915
|
}
|
|
1475
2916
|
|
|
@@ -1493,6 +2934,8 @@ const FfiConverterTypeExitStateKind = (() => {
|
|
|
1493
2934
|
case 7:
|
|
1494
2935
|
return ExitStateKind.VtxoAlreadySpent;
|
|
1495
2936
|
case 8:
|
|
2937
|
+
return ExitStateKind.VtxoSwept;
|
|
2938
|
+
case 9:
|
|
1496
2939
|
return ExitStateKind.Canceled;
|
|
1497
2940
|
default:
|
|
1498
2941
|
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
@@ -1514,8 +2957,10 @@ const FfiConverterTypeExitStateKind = (() => {
|
|
|
1514
2957
|
return c.writeI32(6);
|
|
1515
2958
|
case ExitStateKind.VtxoAlreadySpent:
|
|
1516
2959
|
return c.writeI32(7);
|
|
1517
|
-
case ExitStateKind.
|
|
2960
|
+
case ExitStateKind.VtxoSwept:
|
|
1518
2961
|
return c.writeI32(8);
|
|
2962
|
+
case ExitStateKind.Canceled:
|
|
2963
|
+
return c.writeI32(9);
|
|
1519
2964
|
}
|
|
1520
2965
|
}
|
|
1521
2966
|
allocationSize(value: TypeName): number {
|
|
@@ -1778,55 +3223,6 @@ const FfiConverterTypeExitCancelResult = (() => {
|
|
|
1778
3223
|
return new FFIConverter();
|
|
1779
3224
|
})();
|
|
1780
3225
|
|
|
1781
|
-
/**
|
|
1782
|
-
* Claim transaction for exited funds
|
|
1783
|
-
*/
|
|
1784
|
-
export type ExitClaimTransaction = {
|
|
1785
|
-
psbtBase64: string;
|
|
1786
|
-
feeSats: bigint;
|
|
1787
|
-
};
|
|
1788
|
-
|
|
1789
|
-
/**
|
|
1790
|
-
* Generated factory for {@link ExitClaimTransaction} record objects.
|
|
1791
|
-
*/
|
|
1792
|
-
export const ExitClaimTransaction = (() => {
|
|
1793
|
-
const defaults = () => ({});
|
|
1794
|
-
const create = (() => {
|
|
1795
|
-
return uniffiCreateRecord<
|
|
1796
|
-
ExitClaimTransaction,
|
|
1797
|
-
ReturnType<typeof defaults>
|
|
1798
|
-
>(defaults);
|
|
1799
|
-
})();
|
|
1800
|
-
return Object.freeze({
|
|
1801
|
-
create,
|
|
1802
|
-
new: create,
|
|
1803
|
-
defaults: () => Object.freeze(defaults()) as Partial<ExitClaimTransaction>,
|
|
1804
|
-
});
|
|
1805
|
-
})();
|
|
1806
|
-
|
|
1807
|
-
const FfiConverterTypeExitClaimTransaction = (() => {
|
|
1808
|
-
type TypeName = ExitClaimTransaction;
|
|
1809
|
-
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1810
|
-
readFromCursor(c: Cursor): TypeName {
|
|
1811
|
-
return {
|
|
1812
|
-
psbtBase64: FfiConverterString.readFromCursor(c),
|
|
1813
|
-
feeSats: FfiConverterUInt64.readFromCursor(c),
|
|
1814
|
-
};
|
|
1815
|
-
}
|
|
1816
|
-
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
1817
|
-
FfiConverterString.writeIntoCursor(value.psbtBase64, c);
|
|
1818
|
-
FfiConverterUInt64.writeIntoCursor(value.feeSats, c);
|
|
1819
|
-
}
|
|
1820
|
-
allocationSize(value: TypeName): number {
|
|
1821
|
-
return (
|
|
1822
|
-
FfiConverterString.allocationSize(value.psbtBase64) +
|
|
1823
|
-
FfiConverterUInt64.allocationSize(value.feeSats)
|
|
1824
|
-
);
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
return new FFIConverter();
|
|
1828
|
-
})();
|
|
1829
|
-
|
|
1830
3226
|
// Enum: ExitTxOrigin
|
|
1831
3227
|
export enum ExitTxOrigin_Tags {
|
|
1832
3228
|
Wallet = "Wallet",
|
|
@@ -1939,74 +3335,212 @@ export type ExitTxOrigin = InstanceType<
|
|
|
1939
3335
|
(typeof ExitTxOrigin)["Wallet" | "Mempool" | "Block"]
|
|
1940
3336
|
>;
|
|
1941
3337
|
|
|
1942
|
-
// FfiConverter for enum ExitTxOrigin
|
|
1943
|
-
const FfiConverterTypeExitTxOrigin = (() => {
|
|
1944
|
-
type TypeName = ExitTxOrigin;
|
|
3338
|
+
// FfiConverter for enum ExitTxOrigin
|
|
3339
|
+
const FfiConverterTypeExitTxOrigin = (() => {
|
|
3340
|
+
type TypeName = ExitTxOrigin;
|
|
3341
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3342
|
+
readFromCursor(c: Cursor): TypeName {
|
|
3343
|
+
switch (c.readI32()) {
|
|
3344
|
+
case 1:
|
|
3345
|
+
return new ExitTxOrigin.Wallet({
|
|
3346
|
+
confirmedIn: FfiConverterOptionalTypeBlockRef.readFromCursor(c),
|
|
3347
|
+
});
|
|
3348
|
+
case 2:
|
|
3349
|
+
return new ExitTxOrigin.Mempool();
|
|
3350
|
+
case 3:
|
|
3351
|
+
return new ExitTxOrigin.Block({
|
|
3352
|
+
confirmedIn: FfiConverterTypeBlockRef.readFromCursor(c),
|
|
3353
|
+
});
|
|
3354
|
+
default:
|
|
3355
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3358
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
3359
|
+
switch (value.tag) {
|
|
3360
|
+
case ExitTxOrigin_Tags.Wallet: {
|
|
3361
|
+
c.writeI32(1);
|
|
3362
|
+
const inner = value.inner;
|
|
3363
|
+
FfiConverterOptionalTypeBlockRef.writeIntoCursor(
|
|
3364
|
+
inner.confirmedIn,
|
|
3365
|
+
c
|
|
3366
|
+
);
|
|
3367
|
+
return;
|
|
3368
|
+
}
|
|
3369
|
+
case ExitTxOrigin_Tags.Mempool: {
|
|
3370
|
+
c.writeI32(2);
|
|
3371
|
+
return;
|
|
3372
|
+
}
|
|
3373
|
+
case ExitTxOrigin_Tags.Block: {
|
|
3374
|
+
c.writeI32(3);
|
|
3375
|
+
const inner = value.inner;
|
|
3376
|
+
FfiConverterTypeBlockRef.writeIntoCursor(inner.confirmedIn, c);
|
|
3377
|
+
return;
|
|
3378
|
+
}
|
|
3379
|
+
default:
|
|
3380
|
+
// Throwing from here means that ExitTxOrigin_Tags hasn't matched an ordinal.
|
|
3381
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
allocationSize(value: TypeName): number {
|
|
3385
|
+
switch (value.tag) {
|
|
3386
|
+
case ExitTxOrigin_Tags.Wallet: {
|
|
3387
|
+
const inner = value.inner;
|
|
3388
|
+
let size = 4;
|
|
3389
|
+
size += FfiConverterOptionalTypeBlockRef.allocationSize(
|
|
3390
|
+
inner.confirmedIn
|
|
3391
|
+
);
|
|
3392
|
+
return size;
|
|
3393
|
+
}
|
|
3394
|
+
case ExitTxOrigin_Tags.Mempool: {
|
|
3395
|
+
return 4;
|
|
3396
|
+
}
|
|
3397
|
+
case ExitTxOrigin_Tags.Block: {
|
|
3398
|
+
const inner = value.inner;
|
|
3399
|
+
let size = 4;
|
|
3400
|
+
size += FfiConverterTypeBlockRef.allocationSize(inner.confirmedIn);
|
|
3401
|
+
return size;
|
|
3402
|
+
}
|
|
3403
|
+
default:
|
|
3404
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
3405
|
+
}
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
return new FFIConverter();
|
|
3409
|
+
})();
|
|
3410
|
+
|
|
3411
|
+
/**
|
|
3412
|
+
* The CPFP child of an exit transaction.
|
|
3413
|
+
*/
|
|
3414
|
+
export type ExitChildTransaction = {
|
|
3415
|
+
txid: string;
|
|
3416
|
+
txHex: string;
|
|
3417
|
+
/**
|
|
3418
|
+
* Who created the child. Only a `Wallet` child was paid for by this
|
|
3419
|
+
* wallet, which is what fee attribution needs.
|
|
3420
|
+
*/
|
|
3421
|
+
origin: ExitTxOrigin;
|
|
3422
|
+
/**
|
|
3423
|
+
* Effective fee rate of the child and its unconfirmed ancestors, in
|
|
3424
|
+
* sat/kwu. `None` until the mempool has been queried for it.
|
|
3425
|
+
*/
|
|
3426
|
+
feeRateSatPerKwu?: bigint;
|
|
3427
|
+
/**
|
|
3428
|
+
* Fee of the child plus the fees of its unconfirmed ancestors. `None`
|
|
3429
|
+
* until the mempool has been queried for it.
|
|
3430
|
+
*/
|
|
3431
|
+
totalFeeSats?: bigint;
|
|
3432
|
+
};
|
|
3433
|
+
|
|
3434
|
+
/**
|
|
3435
|
+
* Generated factory for {@link ExitChildTransaction} record objects.
|
|
3436
|
+
*/
|
|
3437
|
+
export const ExitChildTransaction = (() => {
|
|
3438
|
+
const defaults = () => ({});
|
|
3439
|
+
const create = (() => {
|
|
3440
|
+
return uniffiCreateRecord<
|
|
3441
|
+
ExitChildTransaction,
|
|
3442
|
+
ReturnType<typeof defaults>
|
|
3443
|
+
>(defaults);
|
|
3444
|
+
})();
|
|
3445
|
+
return Object.freeze({
|
|
3446
|
+
create,
|
|
3447
|
+
new: create,
|
|
3448
|
+
defaults: () => Object.freeze(defaults()) as Partial<ExitChildTransaction>,
|
|
3449
|
+
});
|
|
3450
|
+
})();
|
|
3451
|
+
|
|
3452
|
+
const FfiConverterTypeExitChildTransaction = (() => {
|
|
3453
|
+
type TypeName = ExitChildTransaction;
|
|
3454
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3455
|
+
readFromCursor(c: Cursor): TypeName {
|
|
3456
|
+
return {
|
|
3457
|
+
txid: FfiConverterString.readFromCursor(c),
|
|
3458
|
+
txHex: FfiConverterString.readFromCursor(c),
|
|
3459
|
+
origin: FfiConverterTypeExitTxOrigin.readFromCursor(c),
|
|
3460
|
+
feeRateSatPerKwu: FfiConverterOptionalUInt64.readFromCursor(c),
|
|
3461
|
+
totalFeeSats: FfiConverterOptionalUInt64.readFromCursor(c),
|
|
3462
|
+
};
|
|
3463
|
+
}
|
|
3464
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
3465
|
+
FfiConverterString.writeIntoCursor(value.txid, c);
|
|
3466
|
+
FfiConverterString.writeIntoCursor(value.txHex, c);
|
|
3467
|
+
FfiConverterTypeExitTxOrigin.writeIntoCursor(value.origin, c);
|
|
3468
|
+
FfiConverterOptionalUInt64.writeIntoCursor(value.feeRateSatPerKwu, c);
|
|
3469
|
+
FfiConverterOptionalUInt64.writeIntoCursor(value.totalFeeSats, c);
|
|
3470
|
+
}
|
|
3471
|
+
allocationSize(value: TypeName): number {
|
|
3472
|
+
return (
|
|
3473
|
+
FfiConverterString.allocationSize(value.txid) +
|
|
3474
|
+
FfiConverterString.allocationSize(value.txHex) +
|
|
3475
|
+
FfiConverterTypeExitTxOrigin.allocationSize(value.origin) +
|
|
3476
|
+
FfiConverterOptionalUInt64.allocationSize(value.feeRateSatPerKwu) +
|
|
3477
|
+
FfiConverterOptionalUInt64.allocationSize(value.totalFeeSats)
|
|
3478
|
+
);
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
return new FFIConverter();
|
|
3482
|
+
})();
|
|
3483
|
+
|
|
3484
|
+
/**
|
|
3485
|
+
* Claim transaction for exited funds
|
|
3486
|
+
*/
|
|
3487
|
+
export type ExitClaimTransaction = {
|
|
3488
|
+
psbtBase64: string;
|
|
3489
|
+
feeSats: bigint;
|
|
3490
|
+
/**
|
|
3491
|
+
* The exits the PSBT actually spends. Link the claim transaction to
|
|
3492
|
+
* these, not to the ids you asked for.
|
|
3493
|
+
*/
|
|
3494
|
+
vtxoIds: Array<string>;
|
|
3495
|
+
/**
|
|
3496
|
+
* Requested ids that were left out because they were not claimable when
|
|
3497
|
+
* the PSBT was built. Empty when draining all claimable exits.
|
|
3498
|
+
*/
|
|
3499
|
+
skippedVtxoIds: Array<string>;
|
|
3500
|
+
};
|
|
3501
|
+
|
|
3502
|
+
/**
|
|
3503
|
+
* Generated factory for {@link ExitClaimTransaction} record objects.
|
|
3504
|
+
*/
|
|
3505
|
+
export const ExitClaimTransaction = (() => {
|
|
3506
|
+
const defaults = () => ({});
|
|
3507
|
+
const create = (() => {
|
|
3508
|
+
return uniffiCreateRecord<
|
|
3509
|
+
ExitClaimTransaction,
|
|
3510
|
+
ReturnType<typeof defaults>
|
|
3511
|
+
>(defaults);
|
|
3512
|
+
})();
|
|
3513
|
+
return Object.freeze({
|
|
3514
|
+
create,
|
|
3515
|
+
new: create,
|
|
3516
|
+
defaults: () => Object.freeze(defaults()) as Partial<ExitClaimTransaction>,
|
|
3517
|
+
});
|
|
3518
|
+
})();
|
|
3519
|
+
|
|
3520
|
+
const FfiConverterTypeExitClaimTransaction = (() => {
|
|
3521
|
+
type TypeName = ExitClaimTransaction;
|
|
1945
3522
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1946
3523
|
readFromCursor(c: Cursor): TypeName {
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
return new ExitTxOrigin.Mempool();
|
|
1954
|
-
case 3:
|
|
1955
|
-
return new ExitTxOrigin.Block({
|
|
1956
|
-
confirmedIn: FfiConverterTypeBlockRef.readFromCursor(c),
|
|
1957
|
-
});
|
|
1958
|
-
default:
|
|
1959
|
-
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1960
|
-
}
|
|
3524
|
+
return {
|
|
3525
|
+
psbtBase64: FfiConverterString.readFromCursor(c),
|
|
3526
|
+
feeSats: FfiConverterUInt64.readFromCursor(c),
|
|
3527
|
+
vtxoIds: FfiConverterSequenceString.readFromCursor(c),
|
|
3528
|
+
skippedVtxoIds: FfiConverterSequenceString.readFromCursor(c),
|
|
3529
|
+
};
|
|
1961
3530
|
}
|
|
1962
3531
|
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
FfiConverterOptionalTypeBlockRef.writeIntoCursor(
|
|
1968
|
-
inner.confirmedIn,
|
|
1969
|
-
c
|
|
1970
|
-
);
|
|
1971
|
-
return;
|
|
1972
|
-
}
|
|
1973
|
-
case ExitTxOrigin_Tags.Mempool: {
|
|
1974
|
-
c.writeI32(2);
|
|
1975
|
-
return;
|
|
1976
|
-
}
|
|
1977
|
-
case ExitTxOrigin_Tags.Block: {
|
|
1978
|
-
c.writeI32(3);
|
|
1979
|
-
const inner = value.inner;
|
|
1980
|
-
FfiConverterTypeBlockRef.writeIntoCursor(inner.confirmedIn, c);
|
|
1981
|
-
return;
|
|
1982
|
-
}
|
|
1983
|
-
default:
|
|
1984
|
-
// Throwing from here means that ExitTxOrigin_Tags hasn't matched an ordinal.
|
|
1985
|
-
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
1986
|
-
}
|
|
3532
|
+
FfiConverterString.writeIntoCursor(value.psbtBase64, c);
|
|
3533
|
+
FfiConverterUInt64.writeIntoCursor(value.feeSats, c);
|
|
3534
|
+
FfiConverterSequenceString.writeIntoCursor(value.vtxoIds, c);
|
|
3535
|
+
FfiConverterSequenceString.writeIntoCursor(value.skippedVtxoIds, c);
|
|
1987
3536
|
}
|
|
1988
3537
|
allocationSize(value: TypeName): number {
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
);
|
|
1996
|
-
return size;
|
|
1997
|
-
}
|
|
1998
|
-
case ExitTxOrigin_Tags.Mempool: {
|
|
1999
|
-
return 4;
|
|
2000
|
-
}
|
|
2001
|
-
case ExitTxOrigin_Tags.Block: {
|
|
2002
|
-
const inner = value.inner;
|
|
2003
|
-
let size = 4;
|
|
2004
|
-
size += FfiConverterTypeBlockRef.allocationSize(inner.confirmedIn);
|
|
2005
|
-
return size;
|
|
2006
|
-
}
|
|
2007
|
-
default:
|
|
2008
|
-
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
2009
|
-
}
|
|
3538
|
+
return (
|
|
3539
|
+
FfiConverterString.allocationSize(value.psbtBase64) +
|
|
3540
|
+
FfiConverterUInt64.allocationSize(value.feeSats) +
|
|
3541
|
+
FfiConverterSequenceString.allocationSize(value.vtxoIds) +
|
|
3542
|
+
FfiConverterSequenceString.allocationSize(value.skippedVtxoIds)
|
|
3543
|
+
);
|
|
2010
3544
|
}
|
|
2011
3545
|
}
|
|
2012
3546
|
return new FFIConverter();
|
|
@@ -2367,6 +3901,52 @@ const FfiConverterTypeExitTx = (() => {
|
|
|
2367
3901
|
return new FFIConverter();
|
|
2368
3902
|
})();
|
|
2369
3903
|
|
|
3904
|
+
/**
|
|
3905
|
+
* A Bitcoin transaction outpoint (reference to a previous output)
|
|
3906
|
+
*/
|
|
3907
|
+
export type OutPoint = {
|
|
3908
|
+
txid: string;
|
|
3909
|
+
vout: number;
|
|
3910
|
+
};
|
|
3911
|
+
|
|
3912
|
+
/**
|
|
3913
|
+
* Generated factory for {@link OutPoint} record objects.
|
|
3914
|
+
*/
|
|
3915
|
+
export const OutPoint = (() => {
|
|
3916
|
+
const defaults = () => ({});
|
|
3917
|
+
const create = (() => {
|
|
3918
|
+
return uniffiCreateRecord<OutPoint, ReturnType<typeof defaults>>(defaults);
|
|
3919
|
+
})();
|
|
3920
|
+
return Object.freeze({
|
|
3921
|
+
create,
|
|
3922
|
+
new: create,
|
|
3923
|
+
defaults: () => Object.freeze(defaults()) as Partial<OutPoint>,
|
|
3924
|
+
});
|
|
3925
|
+
})();
|
|
3926
|
+
|
|
3927
|
+
const FfiConverterTypeOutPoint = (() => {
|
|
3928
|
+
type TypeName = OutPoint;
|
|
3929
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3930
|
+
readFromCursor(c: Cursor): TypeName {
|
|
3931
|
+
return {
|
|
3932
|
+
txid: FfiConverterString.readFromCursor(c),
|
|
3933
|
+
vout: FfiConverterUInt32.readFromCursor(c),
|
|
3934
|
+
};
|
|
3935
|
+
}
|
|
3936
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
3937
|
+
FfiConverterString.writeIntoCursor(value.txid, c);
|
|
3938
|
+
FfiConverterUInt32.writeIntoCursor(value.vout, c);
|
|
3939
|
+
}
|
|
3940
|
+
allocationSize(value: TypeName): number {
|
|
3941
|
+
return (
|
|
3942
|
+
FfiConverterString.allocationSize(value.txid) +
|
|
3943
|
+
FfiConverterUInt32.allocationSize(value.vout)
|
|
3944
|
+
);
|
|
3945
|
+
}
|
|
3946
|
+
}
|
|
3947
|
+
return new FFIConverter();
|
|
3948
|
+
})();
|
|
3949
|
+
|
|
2370
3950
|
// Enum: ExitState
|
|
2371
3951
|
export enum ExitState_Tags {
|
|
2372
3952
|
Start = "Start",
|
|
@@ -2376,6 +3956,7 @@ export enum ExitState_Tags {
|
|
|
2376
3956
|
ClaimInProgress = "ClaimInProgress",
|
|
2377
3957
|
Claimed = "Claimed",
|
|
2378
3958
|
VtxoAlreadySpent = "VtxoAlreadySpent",
|
|
3959
|
+
VtxoSwept = "VtxoSwept",
|
|
2379
3960
|
Canceled = "Canceled",
|
|
2380
3961
|
}
|
|
2381
3962
|
/**
|
|
@@ -2383,7 +3964,8 @@ export enum ExitState_Tags {
|
|
|
2383
3964
|
*
|
|
2384
3965
|
* Serde/TS tags match upstream's kebab-case serialization (`"start"`,
|
|
2385
3966
|
* `"processing"`, `"awaiting-delta"`, `"claimable"`, `"claim-in-progress"`,
|
|
2386
|
-
* `"claimed"`, `"vtxo-already-spent"`, `"canceled"`), with
|
|
3967
|
+
* `"claimed"`, `"vtxo-already-spent"`, `"vtxo-swept"`, `"canceled"`), with
|
|
3968
|
+
* camelCase fields.
|
|
2387
3969
|
*/
|
|
2388
3970
|
export const ExitState = (() => {
|
|
2389
3971
|
type Start__interface = {
|
|
@@ -2658,6 +4240,44 @@ export const ExitState = (() => {
|
|
|
2658
4240
|
}
|
|
2659
4241
|
}
|
|
2660
4242
|
|
|
4243
|
+
type VtxoSwept__interface = {
|
|
4244
|
+
tag: ExitState_Tags.VtxoSwept;
|
|
4245
|
+
inner: Readonly<{ tipHeight: number; spentInputs: Array<OutPoint> }>;
|
|
4246
|
+
};
|
|
4247
|
+
/**
|
|
4248
|
+
* Terminal: an output the exit chain needs was spent on chain by someone
|
|
4249
|
+
* else, in practice the server sweeping a VTXO that expired mid-exit.
|
|
4250
|
+
* `spent_inputs` are the exit transaction inputs that were taken. A
|
|
4251
|
+
* refresh may still be possible.
|
|
4252
|
+
*/
|
|
4253
|
+
class VtxoSwept_ extends UniffiEnum implements VtxoSwept__interface {
|
|
4254
|
+
/**
|
|
4255
|
+
* @private
|
|
4256
|
+
* This field is private and should not be used, use `tag` instead.
|
|
4257
|
+
*/
|
|
4258
|
+
readonly [uniffiTypeNameSymbol] = "ExitState";
|
|
4259
|
+
readonly tag = ExitState_Tags.VtxoSwept;
|
|
4260
|
+
readonly inner: Readonly<{
|
|
4261
|
+
tipHeight: number;
|
|
4262
|
+
spentInputs: Array<OutPoint>;
|
|
4263
|
+
}>;
|
|
4264
|
+
constructor(inner: { tipHeight: number; spentInputs: Array<OutPoint> }) {
|
|
4265
|
+
super("ExitState", "VtxoSwept");
|
|
4266
|
+
|
|
4267
|
+
this.inner = Object.freeze(inner);
|
|
4268
|
+
}
|
|
4269
|
+
static new(inner: {
|
|
4270
|
+
tipHeight: number;
|
|
4271
|
+
spentInputs: Array<OutPoint>;
|
|
4272
|
+
}): VtxoSwept_ {
|
|
4273
|
+
return new VtxoSwept_(inner);
|
|
4274
|
+
}
|
|
4275
|
+
|
|
4276
|
+
static instanceOf(obj: any): obj is VtxoSwept_ {
|
|
4277
|
+
return obj.tag === ExitState_Tags.VtxoSwept;
|
|
4278
|
+
}
|
|
4279
|
+
}
|
|
4280
|
+
|
|
2661
4281
|
type Canceled__interface = {
|
|
2662
4282
|
tag: ExitState_Tags.Canceled;
|
|
2663
4283
|
inner: Readonly<{ tipHeight: number }>;
|
|
@@ -2701,6 +4321,7 @@ export const ExitState = (() => {
|
|
|
2701
4321
|
ClaimInProgress: ClaimInProgress_,
|
|
2702
4322
|
Claimed: Claimed_,
|
|
2703
4323
|
VtxoAlreadySpent: VtxoAlreadySpent_,
|
|
4324
|
+
VtxoSwept: VtxoSwept_,
|
|
2704
4325
|
Canceled: Canceled_,
|
|
2705
4326
|
});
|
|
2706
4327
|
})();
|
|
@@ -2709,7 +4330,8 @@ export const ExitState = (() => {
|
|
|
2709
4330
|
*
|
|
2710
4331
|
* Serde/TS tags match upstream's kebab-case serialization (`"start"`,
|
|
2711
4332
|
* `"processing"`, `"awaiting-delta"`, `"claimable"`, `"claim-in-progress"`,
|
|
2712
|
-
* `"claimed"`, `"vtxo-already-spent"`, `"canceled"`), with
|
|
4333
|
+
* `"claimed"`, `"vtxo-already-spent"`, `"vtxo-swept"`, `"canceled"`), with
|
|
4334
|
+
* camelCase fields.
|
|
2713
4335
|
*/
|
|
2714
4336
|
export type ExitState = InstanceType<
|
|
2715
4337
|
(typeof ExitState)[
|
|
@@ -2720,6 +4342,7 @@ export type ExitState = InstanceType<
|
|
|
2720
4342
|
| "ClaimInProgress"
|
|
2721
4343
|
| "Claimed"
|
|
2722
4344
|
| "VtxoAlreadySpent"
|
|
4345
|
+
| "VtxoSwept"
|
|
2723
4346
|
| "Canceled"]
|
|
2724
4347
|
>;
|
|
2725
4348
|
|
|
@@ -2768,6 +4391,11 @@ const FfiConverterTypeExitState = (() => {
|
|
|
2768
4391
|
tipHeight: FfiConverterUInt32.readFromCursor(c),
|
|
2769
4392
|
});
|
|
2770
4393
|
case 8:
|
|
4394
|
+
return new ExitState.VtxoSwept({
|
|
4395
|
+
tipHeight: FfiConverterUInt32.readFromCursor(c),
|
|
4396
|
+
spentInputs: FfiConverterSequenceTypeOutPoint.readFromCursor(c),
|
|
4397
|
+
});
|
|
4398
|
+
case 9:
|
|
2771
4399
|
return new ExitState.Canceled({
|
|
2772
4400
|
tipHeight: FfiConverterUInt32.readFromCursor(c),
|
|
2773
4401
|
});
|
|
@@ -2831,10 +4459,20 @@ const FfiConverterTypeExitState = (() => {
|
|
|
2831
4459
|
FfiConverterUInt32.writeIntoCursor(inner.tipHeight, c);
|
|
2832
4460
|
return;
|
|
2833
4461
|
}
|
|
2834
|
-
case ExitState_Tags.
|
|
4462
|
+
case ExitState_Tags.VtxoSwept: {
|
|
2835
4463
|
c.writeI32(8);
|
|
2836
4464
|
const inner = value.inner;
|
|
2837
4465
|
FfiConverterUInt32.writeIntoCursor(inner.tipHeight, c);
|
|
4466
|
+
FfiConverterSequenceTypeOutPoint.writeIntoCursor(
|
|
4467
|
+
inner.spentInputs,
|
|
4468
|
+
c
|
|
4469
|
+
);
|
|
4470
|
+
return;
|
|
4471
|
+
}
|
|
4472
|
+
case ExitState_Tags.Canceled: {
|
|
4473
|
+
c.writeI32(9);
|
|
4474
|
+
const inner = value.inner;
|
|
4475
|
+
FfiConverterUInt32.writeIntoCursor(inner.tipHeight, c);
|
|
2838
4476
|
return;
|
|
2839
4477
|
}
|
|
2840
4478
|
default:
|
|
@@ -2899,6 +4537,15 @@ const FfiConverterTypeExitState = (() => {
|
|
|
2899
4537
|
size += FfiConverterUInt32.allocationSize(inner.tipHeight);
|
|
2900
4538
|
return size;
|
|
2901
4539
|
}
|
|
4540
|
+
case ExitState_Tags.VtxoSwept: {
|
|
4541
|
+
const inner = value.inner;
|
|
4542
|
+
let size = 4;
|
|
4543
|
+
size += FfiConverterUInt32.allocationSize(inner.tipHeight);
|
|
4544
|
+
size += FfiConverterSequenceTypeOutPoint.allocationSize(
|
|
4545
|
+
inner.spentInputs
|
|
4546
|
+
);
|
|
4547
|
+
return size;
|
|
4548
|
+
}
|
|
2902
4549
|
case ExitState_Tags.Canceled: {
|
|
2903
4550
|
const inner = value.inner;
|
|
2904
4551
|
let size = 4;
|
|
@@ -2965,14 +4612,84 @@ const FfiConverterTypeExitProgressStatus = (() => {
|
|
|
2965
4612
|
return new FFIConverter();
|
|
2966
4613
|
})();
|
|
2967
4614
|
|
|
4615
|
+
/**
|
|
4616
|
+
* One transaction of an exit: the exit transaction itself and, once it was
|
|
4617
|
+
* fee-bumped, the child that confirms it. A unilateral exit is a chain of
|
|
4618
|
+
* these, root first.
|
|
4619
|
+
*/
|
|
4620
|
+
export type ExitTransactionPackage = {
|
|
4621
|
+
exitTxid: string;
|
|
4622
|
+
exitTxHex: string;
|
|
4623
|
+
child?: ExitChildTransaction;
|
|
4624
|
+
};
|
|
4625
|
+
|
|
4626
|
+
/**
|
|
4627
|
+
* Generated factory for {@link ExitTransactionPackage} record objects.
|
|
4628
|
+
*/
|
|
4629
|
+
export const ExitTransactionPackage = (() => {
|
|
4630
|
+
const defaults = () => ({});
|
|
4631
|
+
const create = (() => {
|
|
4632
|
+
return uniffiCreateRecord<
|
|
4633
|
+
ExitTransactionPackage,
|
|
4634
|
+
ReturnType<typeof defaults>
|
|
4635
|
+
>(defaults);
|
|
4636
|
+
})();
|
|
4637
|
+
return Object.freeze({
|
|
4638
|
+
create,
|
|
4639
|
+
new: create,
|
|
4640
|
+
defaults: () =>
|
|
4641
|
+
Object.freeze(defaults()) as Partial<ExitTransactionPackage>,
|
|
4642
|
+
});
|
|
4643
|
+
})();
|
|
4644
|
+
|
|
4645
|
+
const FfiConverterTypeExitTransactionPackage = (() => {
|
|
4646
|
+
type TypeName = ExitTransactionPackage;
|
|
4647
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
4648
|
+
readFromCursor(c: Cursor): TypeName {
|
|
4649
|
+
return {
|
|
4650
|
+
exitTxid: FfiConverterString.readFromCursor(c),
|
|
4651
|
+
exitTxHex: FfiConverterString.readFromCursor(c),
|
|
4652
|
+
child: FfiConverterOptionalTypeExitChildTransaction.readFromCursor(c),
|
|
4653
|
+
};
|
|
4654
|
+
}
|
|
4655
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
4656
|
+
FfiConverterString.writeIntoCursor(value.exitTxid, c);
|
|
4657
|
+
FfiConverterString.writeIntoCursor(value.exitTxHex, c);
|
|
4658
|
+
FfiConverterOptionalTypeExitChildTransaction.writeIntoCursor(
|
|
4659
|
+
value.child,
|
|
4660
|
+
c
|
|
4661
|
+
);
|
|
4662
|
+
}
|
|
4663
|
+
allocationSize(value: TypeName): number {
|
|
4664
|
+
return (
|
|
4665
|
+
FfiConverterString.allocationSize(value.exitTxid) +
|
|
4666
|
+
FfiConverterString.allocationSize(value.exitTxHex) +
|
|
4667
|
+
FfiConverterOptionalTypeExitChildTransaction.allocationSize(value.child)
|
|
4668
|
+
);
|
|
4669
|
+
}
|
|
4670
|
+
}
|
|
4671
|
+
return new FFIConverter();
|
|
4672
|
+
})();
|
|
4673
|
+
|
|
2968
4674
|
/**
|
|
2969
4675
|
* Detailed status of an exit transaction
|
|
4676
|
+
*
|
|
4677
|
+
* Returned for live and finished exits alike by `get_exit_status`,
|
|
4678
|
+
* `list_all_exits`, `list_live_exits` and `list_finished_exits`.
|
|
2970
4679
|
*/
|
|
2971
4680
|
export type ExitTransactionStatus = {
|
|
2972
4681
|
vtxoId: string;
|
|
2973
4682
|
state: ExitState;
|
|
2974
4683
|
history?: Array<ExitState>;
|
|
4684
|
+
/**
|
|
4685
|
+
* Same as `transactions.len()`. Kept for callers that only want the count.
|
|
4686
|
+
*/
|
|
2975
4687
|
transactionCount: number;
|
|
4688
|
+
/**
|
|
4689
|
+
* The exit transaction chain, root first. Empty unless the status was
|
|
4690
|
+
* requested with `include_transactions`.
|
|
4691
|
+
*/
|
|
4692
|
+
transactions: Array<ExitTransactionPackage>;
|
|
2976
4693
|
};
|
|
2977
4694
|
|
|
2978
4695
|
/**
|
|
@@ -3002,6 +4719,8 @@ const FfiConverterTypeExitTransactionStatus = (() => {
|
|
|
3002
4719
|
state: FfiConverterTypeExitState.readFromCursor(c),
|
|
3003
4720
|
history: FfiConverterOptionalSequenceTypeExitState.readFromCursor(c),
|
|
3004
4721
|
transactionCount: FfiConverterUInt32.readFromCursor(c),
|
|
4722
|
+
transactions:
|
|
4723
|
+
FfiConverterSequenceTypeExitTransactionPackage.readFromCursor(c),
|
|
3005
4724
|
};
|
|
3006
4725
|
}
|
|
3007
4726
|
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
@@ -3012,6 +4731,10 @@ const FfiConverterTypeExitTransactionStatus = (() => {
|
|
|
3012
4731
|
c
|
|
3013
4732
|
);
|
|
3014
4733
|
FfiConverterUInt32.writeIntoCursor(value.transactionCount, c);
|
|
4734
|
+
FfiConverterSequenceTypeExitTransactionPackage.writeIntoCursor(
|
|
4735
|
+
value.transactions,
|
|
4736
|
+
c
|
|
4737
|
+
);
|
|
3015
4738
|
}
|
|
3016
4739
|
allocationSize(value: TypeName): number {
|
|
3017
4740
|
return (
|
|
@@ -3020,7 +4743,10 @@ const FfiConverterTypeExitTransactionStatus = (() => {
|
|
|
3020
4743
|
FfiConverterOptionalSequenceTypeExitState.allocationSize(
|
|
3021
4744
|
value.history
|
|
3022
4745
|
) +
|
|
3023
|
-
FfiConverterUInt32.allocationSize(value.transactionCount)
|
|
4746
|
+
FfiConverterUInt32.allocationSize(value.transactionCount) +
|
|
4747
|
+
FfiConverterSequenceTypeExitTransactionPackage.allocationSize(
|
|
4748
|
+
value.transactions
|
|
4749
|
+
)
|
|
3024
4750
|
);
|
|
3025
4751
|
}
|
|
3026
4752
|
}
|
|
@@ -3265,55 +4991,6 @@ const FfiConverterTypeImportVtxoArgs = (() => {
|
|
|
3265
4991
|
return new FFIConverter();
|
|
3266
4992
|
})();
|
|
3267
4993
|
|
|
3268
|
-
export type LightningInvoice = {
|
|
3269
|
-
invoice: string;
|
|
3270
|
-
paymentHash: string;
|
|
3271
|
-
amountSats: bigint;
|
|
3272
|
-
};
|
|
3273
|
-
|
|
3274
|
-
/**
|
|
3275
|
-
* Generated factory for {@link LightningInvoice} record objects.
|
|
3276
|
-
*/
|
|
3277
|
-
export const LightningInvoice = (() => {
|
|
3278
|
-
const defaults = () => ({});
|
|
3279
|
-
const create = (() => {
|
|
3280
|
-
return uniffiCreateRecord<LightningInvoice, ReturnType<typeof defaults>>(
|
|
3281
|
-
defaults
|
|
3282
|
-
);
|
|
3283
|
-
})();
|
|
3284
|
-
return Object.freeze({
|
|
3285
|
-
create,
|
|
3286
|
-
new: create,
|
|
3287
|
-
defaults: () => Object.freeze(defaults()) as Partial<LightningInvoice>,
|
|
3288
|
-
});
|
|
3289
|
-
})();
|
|
3290
|
-
|
|
3291
|
-
const FfiConverterTypeLightningInvoice = (() => {
|
|
3292
|
-
type TypeName = LightningInvoice;
|
|
3293
|
-
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3294
|
-
readFromCursor(c: Cursor): TypeName {
|
|
3295
|
-
return {
|
|
3296
|
-
invoice: FfiConverterString.readFromCursor(c),
|
|
3297
|
-
paymentHash: FfiConverterString.readFromCursor(c),
|
|
3298
|
-
amountSats: FfiConverterUInt64.readFromCursor(c),
|
|
3299
|
-
};
|
|
3300
|
-
}
|
|
3301
|
-
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
3302
|
-
FfiConverterString.writeIntoCursor(value.invoice, c);
|
|
3303
|
-
FfiConverterString.writeIntoCursor(value.paymentHash, c);
|
|
3304
|
-
FfiConverterUInt64.writeIntoCursor(value.amountSats, c);
|
|
3305
|
-
}
|
|
3306
|
-
allocationSize(value: TypeName): number {
|
|
3307
|
-
return (
|
|
3308
|
-
FfiConverterString.allocationSize(value.invoice) +
|
|
3309
|
-
FfiConverterString.allocationSize(value.paymentHash) +
|
|
3310
|
-
FfiConverterUInt64.allocationSize(value.amountSats)
|
|
3311
|
-
);
|
|
3312
|
-
}
|
|
3313
|
-
}
|
|
3314
|
-
return new FFIConverter();
|
|
3315
|
-
})();
|
|
3316
|
-
|
|
3317
4994
|
export type LightningReceive = {
|
|
3318
4995
|
paymentHash: string;
|
|
3319
4996
|
invoice: string;
|
|
@@ -3401,6 +5078,16 @@ const FfiConverterTypeLightningReceive = (() => {
|
|
|
3401
5078
|
|
|
3402
5079
|
export type LightningSend = {
|
|
3403
5080
|
invoice: string;
|
|
5081
|
+
/**
|
|
5082
|
+
* Payment hash of the invoice being paid. Poll `lightning_send_state`
|
|
5083
|
+
* with it; for BOLT12 there is no invoice string to parse it from.
|
|
5084
|
+
*/
|
|
5085
|
+
paymentHash: string;
|
|
5086
|
+
/**
|
|
5087
|
+
* Id of the `Movement` that records this send. `None` only for sends
|
|
5088
|
+
* checkpointed by a bark version that predates the field.
|
|
5089
|
+
*/
|
|
5090
|
+
movementId?: number;
|
|
3404
5091
|
/**
|
|
3405
5092
|
* Amount being paid, in sats (`payment_amount`).
|
|
3406
5093
|
*/
|
|
@@ -3443,6 +5130,8 @@ const FfiConverterTypeLightningSend = (() => {
|
|
|
3443
5130
|
readFromCursor(c: Cursor): TypeName {
|
|
3444
5131
|
return {
|
|
3445
5132
|
invoice: FfiConverterString.readFromCursor(c),
|
|
5133
|
+
paymentHash: FfiConverterString.readFromCursor(c),
|
|
5134
|
+
movementId: FfiConverterOptionalUInt32.readFromCursor(c),
|
|
3446
5135
|
amountSats: FfiConverterUInt64.readFromCursor(c),
|
|
3447
5136
|
feeSats: FfiConverterUInt64.readFromCursor(c),
|
|
3448
5137
|
htlcVtxoCount: FfiConverterUInt32.readFromCursor(c),
|
|
@@ -3451,6 +5140,8 @@ const FfiConverterTypeLightningSend = (() => {
|
|
|
3451
5140
|
}
|
|
3452
5141
|
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
3453
5142
|
FfiConverterString.writeIntoCursor(value.invoice, c);
|
|
5143
|
+
FfiConverterString.writeIntoCursor(value.paymentHash, c);
|
|
5144
|
+
FfiConverterOptionalUInt32.writeIntoCursor(value.movementId, c);
|
|
3454
5145
|
FfiConverterUInt64.writeIntoCursor(value.amountSats, c);
|
|
3455
5146
|
FfiConverterUInt64.writeIntoCursor(value.feeSats, c);
|
|
3456
5147
|
FfiConverterUInt32.writeIntoCursor(value.htlcVtxoCount, c);
|
|
@@ -3459,6 +5150,8 @@ const FfiConverterTypeLightningSend = (() => {
|
|
|
3459
5150
|
allocationSize(value: TypeName): number {
|
|
3460
5151
|
return (
|
|
3461
5152
|
FfiConverterString.allocationSize(value.invoice) +
|
|
5153
|
+
FfiConverterString.allocationSize(value.paymentHash) +
|
|
5154
|
+
FfiConverterOptionalUInt32.allocationSize(value.movementId) +
|
|
3462
5155
|
FfiConverterUInt64.allocationSize(value.amountSats) +
|
|
3463
5156
|
FfiConverterUInt64.allocationSize(value.feeSats) +
|
|
3464
5157
|
FfiConverterUInt32.allocationSize(value.htlcVtxoCount) +
|
|
@@ -3580,8 +5273,19 @@ const FfiConverterTypeMovement = (() => {
|
|
|
3580
5273
|
return new FFIConverter();
|
|
3581
5274
|
})();
|
|
3582
5275
|
|
|
5276
|
+
/**
|
|
5277
|
+
* What `offboard_all`, `offboard_vtxos` and `send_onchain` broadcast,
|
|
5278
|
+
* mirroring `bark::OffboardResult`.
|
|
5279
|
+
*/
|
|
3583
5280
|
export type OffboardResult = {
|
|
5281
|
+
/**
|
|
5282
|
+
* The offboard transaction the server built and bark broadcast.
|
|
5283
|
+
*/
|
|
3584
5284
|
txid: string;
|
|
5285
|
+
/**
|
|
5286
|
+
* The movement that records this offboard.
|
|
5287
|
+
*/
|
|
5288
|
+
movementId: number;
|
|
3585
5289
|
};
|
|
3586
5290
|
|
|
3587
5291
|
/**
|
|
@@ -3607,13 +5311,18 @@ const FfiConverterTypeOffboardResult = (() => {
|
|
|
3607
5311
|
readFromCursor(c: Cursor): TypeName {
|
|
3608
5312
|
return {
|
|
3609
5313
|
txid: FfiConverterString.readFromCursor(c),
|
|
5314
|
+
movementId: FfiConverterUInt32.readFromCursor(c),
|
|
3610
5315
|
};
|
|
3611
5316
|
}
|
|
3612
5317
|
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
3613
5318
|
FfiConverterString.writeIntoCursor(value.txid, c);
|
|
5319
|
+
FfiConverterUInt32.writeIntoCursor(value.movementId, c);
|
|
3614
5320
|
}
|
|
3615
5321
|
allocationSize(value: TypeName): number {
|
|
3616
|
-
return
|
|
5322
|
+
return (
|
|
5323
|
+
FfiConverterString.allocationSize(value.txid) +
|
|
5324
|
+
FfiConverterUInt32.allocationSize(value.movementId)
|
|
5325
|
+
);
|
|
3617
5326
|
}
|
|
3618
5327
|
}
|
|
3619
5328
|
return new FFIConverter();
|
|
@@ -3669,45 +5378,83 @@ const FfiConverterTypeOnchainBalance = (() => {
|
|
|
3669
5378
|
})();
|
|
3670
5379
|
|
|
3671
5380
|
/**
|
|
3672
|
-
* A
|
|
5381
|
+
* A parsed payment string, mirroring `bark::PaymentRequest`.
|
|
5382
|
+
*
|
|
5383
|
+
* `label` and `message` come from a BIP 321 URI. For a bare BOLT11 invoice
|
|
5384
|
+
* or BOLT12 offer, `amount_sats` is its amount and `message` its
|
|
5385
|
+
* description.
|
|
3673
5386
|
*/
|
|
3674
|
-
export type
|
|
3675
|
-
|
|
3676
|
-
|
|
5387
|
+
export type PaymentRequest = {
|
|
5388
|
+
amountSats?: bigint;
|
|
5389
|
+
label?: string;
|
|
5390
|
+
message?: string;
|
|
5391
|
+
/**
|
|
5392
|
+
* Every destination found, in the order bark parsed them.
|
|
5393
|
+
*/
|
|
5394
|
+
options: Array<AvailablePaymentMethod>;
|
|
5395
|
+
/**
|
|
5396
|
+
* The option to pay when the user doesn't pick one: Ark, then
|
|
5397
|
+
* lightning, then onchain, skipping options with errors. `None` when
|
|
5398
|
+
* every option has errors.
|
|
5399
|
+
*/
|
|
5400
|
+
defaultOption?: AvailablePaymentMethod;
|
|
3677
5401
|
};
|
|
3678
5402
|
|
|
3679
5403
|
/**
|
|
3680
|
-
* Generated factory for {@link
|
|
5404
|
+
* Generated factory for {@link PaymentRequest} record objects.
|
|
3681
5405
|
*/
|
|
3682
|
-
export const
|
|
5406
|
+
export const PaymentRequest = (() => {
|
|
3683
5407
|
const defaults = () => ({});
|
|
3684
5408
|
const create = (() => {
|
|
3685
|
-
return uniffiCreateRecord<
|
|
5409
|
+
return uniffiCreateRecord<PaymentRequest, ReturnType<typeof defaults>>(
|
|
5410
|
+
defaults
|
|
5411
|
+
);
|
|
3686
5412
|
})();
|
|
3687
5413
|
return Object.freeze({
|
|
3688
5414
|
create,
|
|
3689
5415
|
new: create,
|
|
3690
|
-
defaults: () => Object.freeze(defaults()) as Partial<
|
|
5416
|
+
defaults: () => Object.freeze(defaults()) as Partial<PaymentRequest>,
|
|
3691
5417
|
});
|
|
3692
5418
|
})();
|
|
3693
5419
|
|
|
3694
|
-
const
|
|
3695
|
-
type TypeName =
|
|
5420
|
+
const FfiConverterTypePaymentRequest = (() => {
|
|
5421
|
+
type TypeName = PaymentRequest;
|
|
3696
5422
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3697
5423
|
readFromCursor(c: Cursor): TypeName {
|
|
3698
5424
|
return {
|
|
3699
|
-
|
|
3700
|
-
|
|
5425
|
+
amountSats: FfiConverterOptionalUInt64.readFromCursor(c),
|
|
5426
|
+
label: FfiConverterOptionalString.readFromCursor(c),
|
|
5427
|
+
message: FfiConverterOptionalString.readFromCursor(c),
|
|
5428
|
+
options:
|
|
5429
|
+
FfiConverterSequenceTypeAvailablePaymentMethod.readFromCursor(c),
|
|
5430
|
+
defaultOption:
|
|
5431
|
+
FfiConverterOptionalTypeAvailablePaymentMethod.readFromCursor(c),
|
|
3701
5432
|
};
|
|
3702
5433
|
}
|
|
3703
5434
|
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
3704
|
-
|
|
3705
|
-
|
|
5435
|
+
FfiConverterOptionalUInt64.writeIntoCursor(value.amountSats, c);
|
|
5436
|
+
FfiConverterOptionalString.writeIntoCursor(value.label, c);
|
|
5437
|
+
FfiConverterOptionalString.writeIntoCursor(value.message, c);
|
|
5438
|
+
FfiConverterSequenceTypeAvailablePaymentMethod.writeIntoCursor(
|
|
5439
|
+
value.options,
|
|
5440
|
+
c
|
|
5441
|
+
);
|
|
5442
|
+
FfiConverterOptionalTypeAvailablePaymentMethod.writeIntoCursor(
|
|
5443
|
+
value.defaultOption,
|
|
5444
|
+
c
|
|
5445
|
+
);
|
|
3706
5446
|
}
|
|
3707
5447
|
allocationSize(value: TypeName): number {
|
|
3708
5448
|
return (
|
|
3709
|
-
|
|
3710
|
-
|
|
5449
|
+
FfiConverterOptionalUInt64.allocationSize(value.amountSats) +
|
|
5450
|
+
FfiConverterOptionalString.allocationSize(value.label) +
|
|
5451
|
+
FfiConverterOptionalString.allocationSize(value.message) +
|
|
5452
|
+
FfiConverterSequenceTypeAvailablePaymentMethod.allocationSize(
|
|
5453
|
+
value.options
|
|
5454
|
+
) +
|
|
5455
|
+
FfiConverterOptionalTypeAvailablePaymentMethod.allocationSize(
|
|
5456
|
+
value.defaultOption
|
|
5457
|
+
)
|
|
3711
5458
|
);
|
|
3712
5459
|
}
|
|
3713
5460
|
}
|
|
@@ -3718,6 +5465,10 @@ export type PendingBoard = {
|
|
|
3718
5465
|
vtxoId: string;
|
|
3719
5466
|
amountSats: bigint;
|
|
3720
5467
|
txid: string;
|
|
5468
|
+
/**
|
|
5469
|
+
* Id of the `Movement` that records this board.
|
|
5470
|
+
*/
|
|
5471
|
+
movementId: number;
|
|
3721
5472
|
};
|
|
3722
5473
|
|
|
3723
5474
|
/**
|
|
@@ -3745,18 +5496,21 @@ const FfiConverterTypePendingBoard = (() => {
|
|
|
3745
5496
|
vtxoId: FfiConverterString.readFromCursor(c),
|
|
3746
5497
|
amountSats: FfiConverterUInt64.readFromCursor(c),
|
|
3747
5498
|
txid: FfiConverterString.readFromCursor(c),
|
|
5499
|
+
movementId: FfiConverterUInt32.readFromCursor(c),
|
|
3748
5500
|
};
|
|
3749
5501
|
}
|
|
3750
5502
|
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
3751
5503
|
FfiConverterString.writeIntoCursor(value.vtxoId, c);
|
|
3752
5504
|
FfiConverterUInt64.writeIntoCursor(value.amountSats, c);
|
|
3753
5505
|
FfiConverterString.writeIntoCursor(value.txid, c);
|
|
5506
|
+
FfiConverterUInt32.writeIntoCursor(value.movementId, c);
|
|
3754
5507
|
}
|
|
3755
5508
|
allocationSize(value: TypeName): number {
|
|
3756
5509
|
return (
|
|
3757
5510
|
FfiConverterString.allocationSize(value.vtxoId) +
|
|
3758
5511
|
FfiConverterUInt64.allocationSize(value.amountSats) +
|
|
3759
|
-
FfiConverterString.allocationSize(value.txid)
|
|
5512
|
+
FfiConverterString.allocationSize(value.txid) +
|
|
5513
|
+
FfiConverterUInt32.allocationSize(value.movementId)
|
|
3760
5514
|
);
|
|
3761
5515
|
}
|
|
3762
5516
|
}
|
|
@@ -5798,68 +7552,311 @@ export const LightningSendStatus = (() => {
|
|
|
5798
7552
|
inner: Readonly<{ paymentHash: string; preimage: string }>;
|
|
5799
7553
|
};
|
|
5800
7554
|
/**
|
|
5801
|
-
* Send has settled; the preimage proves payment.
|
|
7555
|
+
* Send has settled; the preimage proves payment.
|
|
7556
|
+
*/
|
|
7557
|
+
class Paid_ extends UniffiEnum implements Paid__interface {
|
|
7558
|
+
/**
|
|
7559
|
+
* @private
|
|
7560
|
+
* This field is private and should not be used, use `tag` instead.
|
|
7561
|
+
*/
|
|
7562
|
+
readonly [uniffiTypeNameSymbol] = "LightningSendStatus";
|
|
7563
|
+
readonly tag = LightningSendStatus_Tags.Paid;
|
|
7564
|
+
readonly inner: Readonly<{ paymentHash: string; preimage: string }>;
|
|
7565
|
+
constructor(inner: { paymentHash: string; preimage: string }) {
|
|
7566
|
+
super("LightningSendStatus", "Paid");
|
|
7567
|
+
|
|
7568
|
+
this.inner = Object.freeze(inner);
|
|
7569
|
+
}
|
|
7570
|
+
static new(inner: { paymentHash: string; preimage: string }): Paid_ {
|
|
7571
|
+
return new Paid_(inner);
|
|
7572
|
+
}
|
|
7573
|
+
|
|
7574
|
+
static instanceOf(obj: any): obj is Paid_ {
|
|
7575
|
+
return obj.tag === LightningSendStatus_Tags.Paid;
|
|
7576
|
+
}
|
|
7577
|
+
}
|
|
7578
|
+
|
|
7579
|
+
function instanceOf(obj: any): obj is LightningSendStatus {
|
|
7580
|
+
return obj[uniffiTypeNameSymbol] === "LightningSendStatus";
|
|
7581
|
+
}
|
|
7582
|
+
|
|
7583
|
+
return Object.freeze({
|
|
7584
|
+
instanceOf,
|
|
7585
|
+
Unknown: Unknown_,
|
|
7586
|
+
InProgress: InProgress_,
|
|
7587
|
+
Paid: Paid_,
|
|
7588
|
+
});
|
|
7589
|
+
})();
|
|
7590
|
+
/**
|
|
7591
|
+
* Terminal/in-flight state of an outgoing lightning send.
|
|
7592
|
+
*
|
|
7593
|
+
* Mirrors `bark`'s `LightningSendState`. `pay_lightning_*` and
|
|
7594
|
+
* `check_lightning_payment` now return this so callers can drive the
|
|
7595
|
+
* crash-safe send flow themselves (initiate with `wait = false`, then poll).
|
|
7596
|
+
*/
|
|
7597
|
+
export type LightningSendStatus = InstanceType<
|
|
7598
|
+
(typeof LightningSendStatus)["Unknown" | "InProgress" | "Paid"]
|
|
7599
|
+
>;
|
|
7600
|
+
|
|
7601
|
+
// FfiConverter for enum LightningSendStatus
|
|
7602
|
+
const FfiConverterTypeLightningSendStatus = (() => {
|
|
7603
|
+
type TypeName = LightningSendStatus;
|
|
7604
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
7605
|
+
readFromCursor(c: Cursor): TypeName {
|
|
7606
|
+
switch (c.readI32()) {
|
|
7607
|
+
case 1:
|
|
7608
|
+
return new LightningSendStatus.Unknown();
|
|
7609
|
+
case 2:
|
|
7610
|
+
return new LightningSendStatus.InProgress({
|
|
7611
|
+
send: FfiConverterTypeLightningSend.readFromCursor(c),
|
|
7612
|
+
});
|
|
7613
|
+
case 3:
|
|
7614
|
+
return new LightningSendStatus.Paid({
|
|
7615
|
+
paymentHash: FfiConverterString.readFromCursor(c),
|
|
7616
|
+
preimage: FfiConverterString.readFromCursor(c),
|
|
7617
|
+
});
|
|
7618
|
+
default:
|
|
7619
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
7620
|
+
}
|
|
7621
|
+
}
|
|
7622
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
7623
|
+
switch (value.tag) {
|
|
7624
|
+
case LightningSendStatus_Tags.Unknown: {
|
|
7625
|
+
c.writeI32(1);
|
|
7626
|
+
return;
|
|
7627
|
+
}
|
|
7628
|
+
case LightningSendStatus_Tags.InProgress: {
|
|
7629
|
+
c.writeI32(2);
|
|
7630
|
+
const inner = value.inner;
|
|
7631
|
+
FfiConverterTypeLightningSend.writeIntoCursor(inner.send, c);
|
|
7632
|
+
return;
|
|
7633
|
+
}
|
|
7634
|
+
case LightningSendStatus_Tags.Paid: {
|
|
7635
|
+
c.writeI32(3);
|
|
7636
|
+
const inner = value.inner;
|
|
7637
|
+
FfiConverterString.writeIntoCursor(inner.paymentHash, c);
|
|
7638
|
+
FfiConverterString.writeIntoCursor(inner.preimage, c);
|
|
7639
|
+
return;
|
|
7640
|
+
}
|
|
7641
|
+
default:
|
|
7642
|
+
// Throwing from here means that LightningSendStatus_Tags hasn't matched an ordinal.
|
|
7643
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
7644
|
+
}
|
|
7645
|
+
}
|
|
7646
|
+
allocationSize(value: TypeName): number {
|
|
7647
|
+
switch (value.tag) {
|
|
7648
|
+
case LightningSendStatus_Tags.Unknown: {
|
|
7649
|
+
return 4;
|
|
7650
|
+
}
|
|
7651
|
+
case LightningSendStatus_Tags.InProgress: {
|
|
7652
|
+
const inner = value.inner;
|
|
7653
|
+
let size = 4;
|
|
7654
|
+
size += FfiConverterTypeLightningSend.allocationSize(inner.send);
|
|
7655
|
+
return size;
|
|
7656
|
+
}
|
|
7657
|
+
case LightningSendStatus_Tags.Paid: {
|
|
7658
|
+
const inner = value.inner;
|
|
7659
|
+
let size = 4;
|
|
7660
|
+
size += FfiConverterString.allocationSize(inner.paymentHash);
|
|
7661
|
+
size += FfiConverterString.allocationSize(inner.preimage);
|
|
7662
|
+
return size;
|
|
7663
|
+
}
|
|
7664
|
+
default:
|
|
7665
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
7666
|
+
}
|
|
7667
|
+
}
|
|
7668
|
+
}
|
|
7669
|
+
return new FFIConverter();
|
|
7670
|
+
})();
|
|
7671
|
+
|
|
7672
|
+
/**
|
|
7673
|
+
* Severity of a log record.
|
|
7674
|
+
*/
|
|
7675
|
+
export enum LogLevel {
|
|
7676
|
+
Error,
|
|
7677
|
+
Warn,
|
|
7678
|
+
Info,
|
|
7679
|
+
Debug,
|
|
7680
|
+
Trace,
|
|
7681
|
+
}
|
|
7682
|
+
|
|
7683
|
+
const FfiConverterTypeLogLevel = (() => {
|
|
7684
|
+
type TypeName = LogLevel;
|
|
7685
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
7686
|
+
readFromCursor(c: Cursor): TypeName {
|
|
7687
|
+
switch (c.readI32()) {
|
|
7688
|
+
case 1:
|
|
7689
|
+
return LogLevel.Error;
|
|
7690
|
+
case 2:
|
|
7691
|
+
return LogLevel.Warn;
|
|
7692
|
+
case 3:
|
|
7693
|
+
return LogLevel.Info;
|
|
7694
|
+
case 4:
|
|
7695
|
+
return LogLevel.Debug;
|
|
7696
|
+
case 5:
|
|
7697
|
+
return LogLevel.Trace;
|
|
7698
|
+
default:
|
|
7699
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
7700
|
+
}
|
|
7701
|
+
}
|
|
7702
|
+
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
7703
|
+
switch (value) {
|
|
7704
|
+
case LogLevel.Error:
|
|
7705
|
+
return c.writeI32(1);
|
|
7706
|
+
case LogLevel.Warn:
|
|
7707
|
+
return c.writeI32(2);
|
|
7708
|
+
case LogLevel.Info:
|
|
7709
|
+
return c.writeI32(3);
|
|
7710
|
+
case LogLevel.Debug:
|
|
7711
|
+
return c.writeI32(4);
|
|
7712
|
+
case LogLevel.Trace:
|
|
7713
|
+
return c.writeI32(5);
|
|
7714
|
+
}
|
|
7715
|
+
}
|
|
7716
|
+
allocationSize(value: TypeName): number {
|
|
7717
|
+
return 4;
|
|
7718
|
+
}
|
|
7719
|
+
}
|
|
7720
|
+
return new FFIConverter();
|
|
7721
|
+
})();
|
|
7722
|
+
|
|
7723
|
+
// Enum: PaymentResult
|
|
7724
|
+
export enum PaymentResult_Tags {
|
|
7725
|
+
Onchain = "Onchain",
|
|
7726
|
+
Lightning = "Lightning",
|
|
7727
|
+
Ark = "Ark",
|
|
7728
|
+
}
|
|
7729
|
+
/**
|
|
7730
|
+
* Outcome of `Wallet::send_payment`, mirroring `bark::PaymentInitOutput`.
|
|
7731
|
+
*/
|
|
7732
|
+
export const PaymentResult = (() => {
|
|
7733
|
+
type Onchain__interface = {
|
|
7734
|
+
tag: PaymentResult_Tags.Onchain;
|
|
7735
|
+
inner: Readonly<{ txid: string }>;
|
|
7736
|
+
};
|
|
7737
|
+
/**
|
|
7738
|
+
* The onchain payment's transaction was broadcast.
|
|
7739
|
+
*/
|
|
7740
|
+
class Onchain_ extends UniffiEnum implements Onchain__interface {
|
|
7741
|
+
/**
|
|
7742
|
+
* @private
|
|
7743
|
+
* This field is private and should not be used, use `tag` instead.
|
|
7744
|
+
*/
|
|
7745
|
+
readonly [uniffiTypeNameSymbol] = "PaymentResult";
|
|
7746
|
+
readonly tag = PaymentResult_Tags.Onchain;
|
|
7747
|
+
readonly inner: Readonly<{ txid: string }>;
|
|
7748
|
+
constructor(inner: { txid: string }) {
|
|
7749
|
+
super("PaymentResult", "Onchain");
|
|
7750
|
+
|
|
7751
|
+
this.inner = Object.freeze(inner);
|
|
7752
|
+
}
|
|
7753
|
+
static new(inner: { txid: string }): Onchain_ {
|
|
7754
|
+
return new Onchain_(inner);
|
|
7755
|
+
}
|
|
7756
|
+
|
|
7757
|
+
static instanceOf(obj: any): obj is Onchain_ {
|
|
7758
|
+
return obj.tag === PaymentResult_Tags.Onchain;
|
|
7759
|
+
}
|
|
7760
|
+
}
|
|
7761
|
+
|
|
7762
|
+
type Lightning__interface = {
|
|
7763
|
+
tag: PaymentResult_Tags.Lightning;
|
|
7764
|
+
inner: Readonly<{ invoice: string; paymentHash: string }>;
|
|
7765
|
+
};
|
|
7766
|
+
/**
|
|
7767
|
+
* The lightning payment was started. Unless `wait` was set it may still
|
|
7768
|
+
* be in flight: follow it with `lightning_send_state(payment_hash)`.
|
|
7769
|
+
* `invoice` is the one paid, which for an offer, lightning address or
|
|
7770
|
+
* LNURL is the one bark fetched.
|
|
7771
|
+
*/
|
|
7772
|
+
class Lightning_ extends UniffiEnum implements Lightning__interface {
|
|
7773
|
+
/**
|
|
7774
|
+
* @private
|
|
7775
|
+
* This field is private and should not be used, use `tag` instead.
|
|
7776
|
+
*/
|
|
7777
|
+
readonly [uniffiTypeNameSymbol] = "PaymentResult";
|
|
7778
|
+
readonly tag = PaymentResult_Tags.Lightning;
|
|
7779
|
+
readonly inner: Readonly<{ invoice: string; paymentHash: string }>;
|
|
7780
|
+
constructor(inner: { invoice: string; paymentHash: string }) {
|
|
7781
|
+
super("PaymentResult", "Lightning");
|
|
7782
|
+
|
|
7783
|
+
this.inner = Object.freeze(inner);
|
|
7784
|
+
}
|
|
7785
|
+
static new(inner: { invoice: string; paymentHash: string }): Lightning_ {
|
|
7786
|
+
return new Lightning_(inner);
|
|
7787
|
+
}
|
|
7788
|
+
|
|
7789
|
+
static instanceOf(obj: any): obj is Lightning_ {
|
|
7790
|
+
return obj.tag === PaymentResult_Tags.Lightning;
|
|
7791
|
+
}
|
|
7792
|
+
}
|
|
7793
|
+
|
|
7794
|
+
type Ark__interface = {
|
|
7795
|
+
tag: PaymentResult_Tags.Ark;
|
|
7796
|
+
inner: Readonly<{ movementId: number }>;
|
|
7797
|
+
};
|
|
7798
|
+
/**
|
|
7799
|
+
* The Ark payment was made. `movement_id` is the movement that records
|
|
7800
|
+
* it.
|
|
5802
7801
|
*/
|
|
5803
|
-
class
|
|
7802
|
+
class Ark_ extends UniffiEnum implements Ark__interface {
|
|
5804
7803
|
/**
|
|
5805
7804
|
* @private
|
|
5806
7805
|
* This field is private and should not be used, use `tag` instead.
|
|
5807
7806
|
*/
|
|
5808
|
-
readonly [uniffiTypeNameSymbol] = "
|
|
5809
|
-
readonly tag =
|
|
5810
|
-
readonly inner: Readonly<{
|
|
5811
|
-
constructor(inner: {
|
|
5812
|
-
super("
|
|
7807
|
+
readonly [uniffiTypeNameSymbol] = "PaymentResult";
|
|
7808
|
+
readonly tag = PaymentResult_Tags.Ark;
|
|
7809
|
+
readonly inner: Readonly<{ movementId: number }>;
|
|
7810
|
+
constructor(inner: { movementId: number }) {
|
|
7811
|
+
super("PaymentResult", "Ark");
|
|
5813
7812
|
|
|
5814
7813
|
this.inner = Object.freeze(inner);
|
|
5815
7814
|
}
|
|
5816
|
-
static new(inner: {
|
|
5817
|
-
return new
|
|
7815
|
+
static new(inner: { movementId: number }): Ark_ {
|
|
7816
|
+
return new Ark_(inner);
|
|
5818
7817
|
}
|
|
5819
7818
|
|
|
5820
|
-
static instanceOf(obj: any): obj is
|
|
5821
|
-
return obj.tag ===
|
|
7819
|
+
static instanceOf(obj: any): obj is Ark_ {
|
|
7820
|
+
return obj.tag === PaymentResult_Tags.Ark;
|
|
5822
7821
|
}
|
|
5823
7822
|
}
|
|
5824
7823
|
|
|
5825
|
-
function instanceOf(obj: any): obj is
|
|
5826
|
-
return obj[uniffiTypeNameSymbol] === "
|
|
7824
|
+
function instanceOf(obj: any): obj is PaymentResult {
|
|
7825
|
+
return obj[uniffiTypeNameSymbol] === "PaymentResult";
|
|
5827
7826
|
}
|
|
5828
7827
|
|
|
5829
7828
|
return Object.freeze({
|
|
5830
7829
|
instanceOf,
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
7830
|
+
Onchain: Onchain_,
|
|
7831
|
+
Lightning: Lightning_,
|
|
7832
|
+
Ark: Ark_,
|
|
5834
7833
|
});
|
|
5835
7834
|
})();
|
|
5836
7835
|
/**
|
|
5837
|
-
*
|
|
5838
|
-
*
|
|
5839
|
-
* Mirrors `bark`'s `LightningSendState`. `pay_lightning_*` and
|
|
5840
|
-
* `check_lightning_payment` now return this so callers can drive the
|
|
5841
|
-
* crash-safe send flow themselves (initiate with `wait = false`, then poll).
|
|
7836
|
+
* Outcome of `Wallet::send_payment`, mirroring `bark::PaymentInitOutput`.
|
|
5842
7837
|
*/
|
|
5843
|
-
export type
|
|
5844
|
-
(typeof
|
|
7838
|
+
export type PaymentResult = InstanceType<
|
|
7839
|
+
(typeof PaymentResult)["Onchain" | "Lightning" | "Ark"]
|
|
5845
7840
|
>;
|
|
5846
7841
|
|
|
5847
|
-
// FfiConverter for enum
|
|
5848
|
-
const
|
|
5849
|
-
type TypeName =
|
|
7842
|
+
// FfiConverter for enum PaymentResult
|
|
7843
|
+
const FfiConverterTypePaymentResult = (() => {
|
|
7844
|
+
type TypeName = PaymentResult;
|
|
5850
7845
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
5851
7846
|
readFromCursor(c: Cursor): TypeName {
|
|
5852
7847
|
switch (c.readI32()) {
|
|
5853
7848
|
case 1:
|
|
5854
|
-
return new
|
|
7849
|
+
return new PaymentResult.Onchain({
|
|
7850
|
+
txid: FfiConverterString.readFromCursor(c),
|
|
7851
|
+
});
|
|
5855
7852
|
case 2:
|
|
5856
|
-
return new
|
|
5857
|
-
|
|
7853
|
+
return new PaymentResult.Lightning({
|
|
7854
|
+
invoice: FfiConverterString.readFromCursor(c),
|
|
7855
|
+
paymentHash: FfiConverterString.readFromCursor(c),
|
|
5858
7856
|
});
|
|
5859
7857
|
case 3:
|
|
5860
|
-
return new
|
|
5861
|
-
|
|
5862
|
-
preimage: FfiConverterString.readFromCursor(c),
|
|
7858
|
+
return new PaymentResult.Ark({
|
|
7859
|
+
movementId: FfiConverterUInt32.readFromCursor(c),
|
|
5863
7860
|
});
|
|
5864
7861
|
default:
|
|
5865
7862
|
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
@@ -5867,44 +7864,49 @@ const FfiConverterTypeLightningSendStatus = (() => {
|
|
|
5867
7864
|
}
|
|
5868
7865
|
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
5869
7866
|
switch (value.tag) {
|
|
5870
|
-
case
|
|
7867
|
+
case PaymentResult_Tags.Onchain: {
|
|
5871
7868
|
c.writeI32(1);
|
|
7869
|
+
const inner = value.inner;
|
|
7870
|
+
FfiConverterString.writeIntoCursor(inner.txid, c);
|
|
5872
7871
|
return;
|
|
5873
7872
|
}
|
|
5874
|
-
case
|
|
7873
|
+
case PaymentResult_Tags.Lightning: {
|
|
5875
7874
|
c.writeI32(2);
|
|
5876
7875
|
const inner = value.inner;
|
|
5877
|
-
|
|
7876
|
+
FfiConverterString.writeIntoCursor(inner.invoice, c);
|
|
7877
|
+
FfiConverterString.writeIntoCursor(inner.paymentHash, c);
|
|
5878
7878
|
return;
|
|
5879
7879
|
}
|
|
5880
|
-
case
|
|
7880
|
+
case PaymentResult_Tags.Ark: {
|
|
5881
7881
|
c.writeI32(3);
|
|
5882
7882
|
const inner = value.inner;
|
|
5883
|
-
|
|
5884
|
-
FfiConverterString.writeIntoCursor(inner.preimage, c);
|
|
7883
|
+
FfiConverterUInt32.writeIntoCursor(inner.movementId, c);
|
|
5885
7884
|
return;
|
|
5886
7885
|
}
|
|
5887
7886
|
default:
|
|
5888
|
-
// Throwing from here means that
|
|
7887
|
+
// Throwing from here means that PaymentResult_Tags hasn't matched an ordinal.
|
|
5889
7888
|
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
5890
7889
|
}
|
|
5891
7890
|
}
|
|
5892
7891
|
allocationSize(value: TypeName): number {
|
|
5893
7892
|
switch (value.tag) {
|
|
5894
|
-
case
|
|
5895
|
-
return 4;
|
|
5896
|
-
}
|
|
5897
|
-
case LightningSendStatus_Tags.InProgress: {
|
|
7893
|
+
case PaymentResult_Tags.Onchain: {
|
|
5898
7894
|
const inner = value.inner;
|
|
5899
7895
|
let size = 4;
|
|
5900
|
-
size +=
|
|
7896
|
+
size += FfiConverterString.allocationSize(inner.txid);
|
|
5901
7897
|
return size;
|
|
5902
7898
|
}
|
|
5903
|
-
case
|
|
7899
|
+
case PaymentResult_Tags.Lightning: {
|
|
5904
7900
|
const inner = value.inner;
|
|
5905
7901
|
let size = 4;
|
|
7902
|
+
size += FfiConverterString.allocationSize(inner.invoice);
|
|
5906
7903
|
size += FfiConverterString.allocationSize(inner.paymentHash);
|
|
5907
|
-
size
|
|
7904
|
+
return size;
|
|
7905
|
+
}
|
|
7906
|
+
case PaymentResult_Tags.Ark: {
|
|
7907
|
+
const inner = value.inner;
|
|
7908
|
+
let size = 4;
|
|
7909
|
+
size += FfiConverterUInt32.allocationSize(inner.movementId);
|
|
5908
7910
|
return size;
|
|
5909
7911
|
}
|
|
5910
7912
|
default:
|
|
@@ -5915,57 +7917,6 @@ const FfiConverterTypeLightningSendStatus = (() => {
|
|
|
5915
7917
|
return new FFIConverter();
|
|
5916
7918
|
})();
|
|
5917
7919
|
|
|
5918
|
-
/**
|
|
5919
|
-
* Severity of a log record.
|
|
5920
|
-
*/
|
|
5921
|
-
export enum LogLevel {
|
|
5922
|
-
Error,
|
|
5923
|
-
Warn,
|
|
5924
|
-
Info,
|
|
5925
|
-
Debug,
|
|
5926
|
-
Trace,
|
|
5927
|
-
}
|
|
5928
|
-
|
|
5929
|
-
const FfiConverterTypeLogLevel = (() => {
|
|
5930
|
-
type TypeName = LogLevel;
|
|
5931
|
-
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
5932
|
-
readFromCursor(c: Cursor): TypeName {
|
|
5933
|
-
switch (c.readI32()) {
|
|
5934
|
-
case 1:
|
|
5935
|
-
return LogLevel.Error;
|
|
5936
|
-
case 2:
|
|
5937
|
-
return LogLevel.Warn;
|
|
5938
|
-
case 3:
|
|
5939
|
-
return LogLevel.Info;
|
|
5940
|
-
case 4:
|
|
5941
|
-
return LogLevel.Debug;
|
|
5942
|
-
case 5:
|
|
5943
|
-
return LogLevel.Trace;
|
|
5944
|
-
default:
|
|
5945
|
-
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
5946
|
-
}
|
|
5947
|
-
}
|
|
5948
|
-
writeIntoCursor(value: TypeName, c: Cursor): void {
|
|
5949
|
-
switch (value) {
|
|
5950
|
-
case LogLevel.Error:
|
|
5951
|
-
return c.writeI32(1);
|
|
5952
|
-
case LogLevel.Warn:
|
|
5953
|
-
return c.writeI32(2);
|
|
5954
|
-
case LogLevel.Info:
|
|
5955
|
-
return c.writeI32(3);
|
|
5956
|
-
case LogLevel.Debug:
|
|
5957
|
-
return c.writeI32(4);
|
|
5958
|
-
case LogLevel.Trace:
|
|
5959
|
-
return c.writeI32(5);
|
|
5960
|
-
}
|
|
5961
|
-
}
|
|
5962
|
-
allocationSize(value: TypeName): number {
|
|
5963
|
-
return 4;
|
|
5964
|
-
}
|
|
5965
|
-
}
|
|
5966
|
-
return new FFIConverter();
|
|
5967
|
-
})();
|
|
5968
|
-
|
|
5969
7920
|
// Enum: RecoveryStatus
|
|
5970
7921
|
export enum RecoveryStatus_Tags {
|
|
5971
7922
|
NotRun = "NotRun",
|
|
@@ -6577,7 +8528,11 @@ export interface CustomOnchainWalletCallbacks {
|
|
|
6577
8528
|
*/
|
|
6578
8529
|
prepareDrainTx(address: string, feeRateSatPerVb: bigint): /*throws*/ string;
|
|
6579
8530
|
/**
|
|
6580
|
-
* Sign and finalize a PSBT
|
|
8531
|
+
* Sign and finalize a PSBT, without recording the transaction
|
|
8532
|
+
*
|
|
8533
|
+
* The wallet must not treat the transaction as spent yet: a board that
|
|
8534
|
+
* fails after signing has to leave the wallet untouched. Once the
|
|
8535
|
+
* transaction is broadcast, Bark reports it through `register_tx`.
|
|
6581
8536
|
*
|
|
6582
8537
|
* # Arguments
|
|
6583
8538
|
* * `psbt_base64` - Base64-encoded PSBT
|
|
@@ -6586,7 +8541,7 @@ export interface CustomOnchainWalletCallbacks {
|
|
|
6586
8541
|
* Base64-encoded fully signed PSBT (all witnesses filled in). Rejected
|
|
6587
8542
|
* unless the unsigned transaction is unchanged.
|
|
6588
8543
|
*/
|
|
6589
|
-
|
|
8544
|
+
signPsbt(psbtBase64: string): /*throws*/ string;
|
|
6590
8545
|
/**
|
|
6591
8546
|
* Whether a script pubkey belongs to the wallet's keychains
|
|
6592
8547
|
*
|
|
@@ -6762,7 +8717,11 @@ export class CustomOnchainWalletCallbacksImpl
|
|
|
6762
8717
|
}
|
|
6763
8718
|
|
|
6764
8719
|
/**
|
|
6765
|
-
* Sign and finalize a PSBT
|
|
8720
|
+
* Sign and finalize a PSBT, without recording the transaction
|
|
8721
|
+
*
|
|
8722
|
+
* The wallet must not treat the transaction as spent yet: a board that
|
|
8723
|
+
* fails after signing has to leave the wallet untouched. Once the
|
|
8724
|
+
* transaction is broadcast, Bark reports it through `register_tx`.
|
|
6766
8725
|
*
|
|
6767
8726
|
* # Arguments
|
|
6768
8727
|
* * `psbt_base64` - Base64-encoded PSBT
|
|
@@ -6771,11 +8730,11 @@ export class CustomOnchainWalletCallbacksImpl
|
|
|
6771
8730
|
* Base64-encoded fully signed PSBT (all witnesses filled in). Rejected
|
|
6772
8731
|
* unless the unsigned transaction is unchanged.
|
|
6773
8732
|
*/
|
|
6774
|
-
|
|
8733
|
+
signPsbt(psbtBase64: string): string /*throws*/ {
|
|
6775
8734
|
const __rb: Uint8Array = uniffiCaller.rustCallWithError(
|
|
6776
8735
|
/*liftError:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError),
|
|
6777
8736
|
/*caller:*/ (callStatus) => {
|
|
6778
|
-
return nativeModule().
|
|
8737
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_customonchainwalletcallbacks_sign_psbt(
|
|
6779
8738
|
uniffiTypeCustomOnchainWalletCallbacksImplObjectFactory.clonePointer(
|
|
6780
8739
|
this
|
|
6781
8740
|
),
|
|
@@ -7143,11 +9102,11 @@ const uniffiCallbackInterfaceCustomOnchainWalletCallbacks: {
|
|
|
7143
9102
|
);
|
|
7144
9103
|
return uniffiResult;
|
|
7145
9104
|
},
|
|
7146
|
-
|
|
9105
|
+
sign_psbt: (uniffiHandle: bigint, psbtBase64: Uint8Array) => {
|
|
7147
9106
|
const uniffiMakeCall = (): string => {
|
|
7148
9107
|
const jsCallback =
|
|
7149
9108
|
FfiConverterTypeCustomOnchainWalletCallbacks.lift(uniffiHandle);
|
|
7150
|
-
return jsCallback.
|
|
9109
|
+
return jsCallback.signPsbt(FfiConverterString.lift(psbtBase64));
|
|
7151
9110
|
};
|
|
7152
9111
|
const uniffiResult = UniffiResult.ready<Uint8Array>();
|
|
7153
9112
|
const uniffiHandleSuccess = (obj: any) => {
|
|
@@ -7605,6 +9564,22 @@ export interface WalletLike {
|
|
|
7605
9564
|
asyncOpts_?: { signal: AbortSignal }
|
|
7606
9565
|
): /*throws*/ Promise<void>;
|
|
7607
9566
|
balance(asyncOpts_?: { signal: AbortSignal }): /*throws*/ Promise<Balance>;
|
|
9567
|
+
/**
|
|
9568
|
+
* The numbers to show a user, without the breakdown of `balance`: what
|
|
9569
|
+
* they can spend, what needs a refresh, what is pending and the total.
|
|
9570
|
+
*/
|
|
9571
|
+
balanceSummary(asyncOpts_?: {
|
|
9572
|
+
signal: AbortSignal;
|
|
9573
|
+
}): /*throws*/ Promise<BalanceSummary>;
|
|
9574
|
+
/**
|
|
9575
|
+
* Build a BIP 321 `bitcoin:` URI with a new Ark address, a new BOLT11
|
|
9576
|
+
* invoice (when there is an amount) and the caller's onchain address,
|
|
9577
|
+
* as `options` selects.
|
|
9578
|
+
*/
|
|
9579
|
+
bip321Uri(
|
|
9580
|
+
options: Bip321UriOptions,
|
|
9581
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
9582
|
+
): /*throws*/ Promise<Bip321Uri>;
|
|
7608
9583
|
boardAll(asyncOpts_?: {
|
|
7609
9584
|
signal: AbortSignal;
|
|
7610
9585
|
}): /*throws*/ Promise<PendingBoard>;
|
|
@@ -7685,6 +9660,13 @@ export interface WalletLike {
|
|
|
7685
9660
|
signal: AbortSignal;
|
|
7686
9661
|
}): /*throws*/ Promise<bigint>;
|
|
7687
9662
|
config(asyncOpts_?: { signal: AbortSignal }): Promise<Config>;
|
|
9663
|
+
/**
|
|
9664
|
+
* The network, mailbox id and VTXO xpub, as `bark debug-info` prints
|
|
9665
|
+
* them. Users can share this in support requests.
|
|
9666
|
+
*/
|
|
9667
|
+
debugInfo(asyncOpts_?: {
|
|
9668
|
+
signal: AbortSignal;
|
|
9669
|
+
}): /*throws*/ Promise<DebugInfo>;
|
|
7688
9670
|
/**
|
|
7689
9671
|
* Build a PSBT claiming exited VTXOs to `address`.
|
|
7690
9672
|
*
|
|
@@ -7715,16 +9697,18 @@ export interface WalletLike {
|
|
|
7715
9697
|
* spendable VTXO). `fee_rate_sat_per_vb` applies to both legs; omit it to
|
|
7716
9698
|
* use the chain's fast rate for the broadcast leg and regular rate for
|
|
7717
9699
|
* the claim leg. `destination` only affects the claim transaction's weight.
|
|
9700
|
+
* `fee_margin` scales the broadcast leg (finite and non-negative; default
|
|
9701
|
+
* 1.2).
|
|
7718
9702
|
*
|
|
7719
|
-
* The
|
|
7720
|
-
*
|
|
7721
|
-
*
|
|
7722
|
-
* and return an error.
|
|
9703
|
+
* The estimate never reads the onchain wallet, so it works before the
|
|
9704
|
+
* wallet holds funds and with callback wallets
|
|
9705
|
+
* (`CustomOnchainWalletCallbacks`) too.
|
|
7723
9706
|
*/
|
|
7724
9707
|
estimateEmergencyExitFee(
|
|
7725
9708
|
vtxoIds: Array<string>,
|
|
7726
9709
|
feeRateSatPerVb: bigint | undefined,
|
|
7727
9710
|
destination: string | undefined,
|
|
9711
|
+
feeMargin: number | undefined,
|
|
7728
9712
|
asyncOpts_?: { signal: AbortSignal }
|
|
7729
9713
|
): /*throws*/ Promise<EmergencyExitFeeEstimate>;
|
|
7730
9714
|
estimateLightningReceiveFee(
|
|
@@ -7744,6 +9728,14 @@ export interface WalletLike {
|
|
|
7744
9728
|
vtxoIds: Array<string>,
|
|
7745
9729
|
asyncOpts_?: { signal: AbortSignal }
|
|
7746
9730
|
): /*throws*/ Promise<FeeEstimate>;
|
|
9731
|
+
/**
|
|
9732
|
+
* Estimate the fee of paying `amount_sats` to `method`.
|
|
9733
|
+
*/
|
|
9734
|
+
estimatePaymentFee(
|
|
9735
|
+
method: PaymentMethod,
|
|
9736
|
+
amountSats: bigint,
|
|
9737
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
9738
|
+
): /*throws*/ Promise<FeeEstimate>;
|
|
7747
9739
|
estimateRefreshFee(
|
|
7748
9740
|
vtxoIds: Array<string>,
|
|
7749
9741
|
asyncOpts_?: { signal: AbortSignal }
|
|
@@ -7754,12 +9746,20 @@ export interface WalletLike {
|
|
|
7754
9746
|
asyncOpts_?: { signal: AbortSignal }
|
|
7755
9747
|
): /*throws*/ Promise<FeeEstimate>;
|
|
7756
9748
|
fingerprint(): string;
|
|
9749
|
+
/**
|
|
9750
|
+
* Status of one exit, live or finished. `None` if no exit was ever
|
|
9751
|
+
* started for the VTXO.
|
|
9752
|
+
*/
|
|
7757
9753
|
getExitStatus(
|
|
7758
9754
|
vtxoId: string,
|
|
7759
9755
|
includeHistory: boolean,
|
|
7760
9756
|
includeTransactions: boolean,
|
|
7761
9757
|
asyncOpts_?: { signal: AbortSignal }
|
|
7762
9758
|
): /*throws*/ Promise<ExitTransactionStatus | undefined>;
|
|
9759
|
+
/**
|
|
9760
|
+
* Live exits only. Finished exits leave this list; see
|
|
9761
|
+
* `list_finished_exits` and `get_exit_status`.
|
|
9762
|
+
*/
|
|
7763
9763
|
getExitVtxos(asyncOpts_?: {
|
|
7764
9764
|
signal: AbortSignal;
|
|
7765
9765
|
}): /*throws*/ Promise<Array<ExitVtxo>>;
|
|
@@ -7846,9 +9846,35 @@ export interface WalletLike {
|
|
|
7846
9846
|
paymentHash: string,
|
|
7847
9847
|
asyncOpts_?: { signal: AbortSignal }
|
|
7848
9848
|
): /*throws*/ Promise<LightningSendStatus>;
|
|
9849
|
+
/**
|
|
9850
|
+
* Status of every exit this wallet ever started, live and finished.
|
|
9851
|
+
*/
|
|
9852
|
+
listAllExits(
|
|
9853
|
+
includeHistory: boolean,
|
|
9854
|
+
includeTransactions: boolean,
|
|
9855
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
9856
|
+
): /*throws*/ Promise<Array<ExitTransactionStatus>>;
|
|
7849
9857
|
listClaimableExits(asyncOpts_?: {
|
|
7850
9858
|
signal: AbortSignal;
|
|
7851
9859
|
}): /*throws*/ Promise<Array<ExitVtxo>>;
|
|
9860
|
+
/**
|
|
9861
|
+
* Status of the exits in a terminal state: claimed, canceled, or aborted
|
|
9862
|
+
* because the VTXO was already spent or swept. They stay queryable after
|
|
9863
|
+
* completion, so a client need not snapshot them at drain time.
|
|
9864
|
+
*/
|
|
9865
|
+
listFinishedExits(
|
|
9866
|
+
includeHistory: boolean,
|
|
9867
|
+
includeTransactions: boolean,
|
|
9868
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
9869
|
+
): /*throws*/ Promise<Array<ExitTransactionStatus>>;
|
|
9870
|
+
/**
|
|
9871
|
+
* Status of the exits that are still progressing.
|
|
9872
|
+
*/
|
|
9873
|
+
listLiveExits(
|
|
9874
|
+
includeHistory: boolean,
|
|
9875
|
+
includeTransactions: boolean,
|
|
9876
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
9877
|
+
): /*throws*/ Promise<Array<ExitTransactionStatus>>;
|
|
7852
9878
|
/**
|
|
7853
9879
|
* Reserve VTXOs so wallet-driven flows leave them alone: a locked VTXO is
|
|
7854
9880
|
* excluded from coin selection.
|
|
@@ -7895,6 +9921,22 @@ export interface WalletLike {
|
|
|
7895
9921
|
bitcoinAddress: string,
|
|
7896
9922
|
asyncOpts_?: { signal: AbortSignal }
|
|
7897
9923
|
): /*throws*/ Promise<OffboardResult>;
|
|
9924
|
+
/**
|
|
9925
|
+
* Parse any payment string bark understands: a BIP 321 `bitcoin:` URI, a
|
|
9926
|
+
* `lightning:` URI (any case), a BOLT11 invoice, a BOLT12 offer, a
|
|
9927
|
+
* lightning address, an LNURL-pay link or LUD-17 `lnurlp://` URI, an Ark
|
|
9928
|
+
* address, a bitcoin address or a hex output script. Surrounding
|
|
9929
|
+
* whitespace is not trimmed.
|
|
9930
|
+
*
|
|
9931
|
+
* Problems with a single option (wrong network, an Ark address of
|
|
9932
|
+
* another server, an amount mismatch) are reported in that option's
|
|
9933
|
+
* `errors`. Errors only when nothing in the string can be paid at all.
|
|
9934
|
+
* Checking an Ark address needs a server connection.
|
|
9935
|
+
*/
|
|
9936
|
+
parsePaymentRequest(
|
|
9937
|
+
payment: string,
|
|
9938
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
9939
|
+
): /*throws*/ Promise<PaymentRequest>;
|
|
7898
9940
|
/**
|
|
7899
9941
|
* Pay to a Lightning Address (`user@domain`), resolved via LNURL-pay.
|
|
7900
9942
|
*/
|
|
@@ -7903,18 +9945,28 @@ export interface WalletLike {
|
|
|
7903
9945
|
amountSats: bigint,
|
|
7904
9946
|
comment: string | undefined,
|
|
7905
9947
|
wait: boolean,
|
|
9948
|
+
retryForSecs: bigint | undefined,
|
|
7906
9949
|
asyncOpts_?: { signal: AbortSignal }
|
|
7907
9950
|
): /*throws*/ Promise<LightningSendStatus>;
|
|
9951
|
+
/**
|
|
9952
|
+
* Pay a BOLT11 invoice.
|
|
9953
|
+
*
|
|
9954
|
+
* `retry_for_secs` is how long the Ark server keeps trying to pay,
|
|
9955
|
+
* capped to the server's maximum; `None` leaves it to the server and 0
|
|
9956
|
+
* makes a single attempt. The same holds for every `pay_*` method.
|
|
9957
|
+
*/
|
|
7908
9958
|
payLightningInvoice(
|
|
7909
9959
|
invoice: string,
|
|
7910
9960
|
amountSats: bigint | undefined,
|
|
7911
9961
|
wait: boolean,
|
|
9962
|
+
retryForSecs: bigint | undefined,
|
|
7912
9963
|
asyncOpts_?: { signal: AbortSignal }
|
|
7913
9964
|
): /*throws*/ Promise<LightningSendStatus>;
|
|
7914
9965
|
payLightningOffer(
|
|
7915
9966
|
offer: string,
|
|
7916
9967
|
amountSats: bigint | undefined,
|
|
7917
9968
|
wait: boolean,
|
|
9969
|
+
retryForSecs: bigint | undefined,
|
|
7918
9970
|
asyncOpts_?: { signal: AbortSignal }
|
|
7919
9971
|
): /*throws*/ Promise<LightningSendStatus>;
|
|
7920
9972
|
/**
|
|
@@ -7928,6 +9980,7 @@ export interface WalletLike {
|
|
|
7928
9980
|
amountSats: bigint,
|
|
7929
9981
|
comment: string | undefined,
|
|
7930
9982
|
wait: boolean,
|
|
9983
|
+
retryForSecs: bigint | undefined,
|
|
7931
9984
|
asyncOpts_?: { signal: AbortSignal }
|
|
7932
9985
|
): /*throws*/ Promise<LightningSendStatus>;
|
|
7933
9986
|
peekAddress(
|
|
@@ -8030,17 +10083,41 @@ export interface WalletLike {
|
|
|
8030
10083
|
*
|
|
8031
10084
|
* An address this bark cannot deliver to (see `validateArkoorAddress`) is
|
|
8032
10085
|
* rejected up front, leaving the VTXOs spendable rather than cosigned.
|
|
10086
|
+
*
|
|
10087
|
+
* Returns the id of the movement that records the payment.
|
|
8033
10088
|
*/
|
|
8034
10089
|
sendArkoorPayment(
|
|
8035
10090
|
arkAddress: string,
|
|
8036
10091
|
amountSats: bigint,
|
|
8037
10092
|
asyncOpts_?: { signal: AbortSignal }
|
|
8038
|
-
): /*throws*/ Promise<
|
|
10093
|
+
): /*throws*/ Promise<number>;
|
|
10094
|
+
/**
|
|
10095
|
+
* Send `amount_sats` from the offchain balance to an onchain address,
|
|
10096
|
+
* as an offboard. Returns the offboard txid and its movement id.
|
|
10097
|
+
*/
|
|
8039
10098
|
sendOnchain(
|
|
8040
10099
|
address: string,
|
|
8041
10100
|
amountSats: bigint,
|
|
8042
10101
|
asyncOpts_?: { signal: AbortSignal }
|
|
8043
|
-
): /*throws*/ Promise<
|
|
10102
|
+
): /*throws*/ Promise<OffboardResult>;
|
|
10103
|
+
/**
|
|
10104
|
+
* Pay `method` over the matching rail: Ark, lightning or onchain.
|
|
10105
|
+
*
|
|
10106
|
+
* `amount_sats` is required for addresses and LNURL, and for invoices
|
|
10107
|
+
* and offers without an amount (`AvailablePaymentMethod.requires_amount`).
|
|
10108
|
+
* `comment` only reaches lightning addresses and LNURL. `wait` and
|
|
10109
|
+
* `retry_for_secs` only affect lightning. `retry_for_secs` is how long
|
|
10110
|
+
* the Ark server keeps trying to pay, capped to the server's maximum;
|
|
10111
|
+
* `None` leaves it to the server and 0 makes a single attempt.
|
|
10112
|
+
*/
|
|
10113
|
+
sendPayment(
|
|
10114
|
+
method: PaymentMethod,
|
|
10115
|
+
amountSats: bigint | undefined,
|
|
10116
|
+
comment: string | undefined,
|
|
10117
|
+
wait: boolean,
|
|
10118
|
+
retryForSecs: bigint | undefined,
|
|
10119
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
10120
|
+
): /*throws*/ Promise<PaymentResult>;
|
|
8044
10121
|
signExitClaimInputs(
|
|
8045
10122
|
psbtBase64: string,
|
|
8046
10123
|
asyncOpts_?: { signal: AbortSignal }
|
|
@@ -8493,6 +10570,114 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
8493
10570
|
}
|
|
8494
10571
|
}
|
|
8495
10572
|
|
|
10573
|
+
/**
|
|
10574
|
+
* The numbers to show a user, without the breakdown of `balance`: what
|
|
10575
|
+
* they can spend, what needs a refresh, what is pending and the total.
|
|
10576
|
+
*/
|
|
10577
|
+
async balanceSummary(asyncOpts_?: {
|
|
10578
|
+
signal: AbortSignal;
|
|
10579
|
+
}): Promise<BalanceSummary> /*throws*/ {
|
|
10580
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
10581
|
+
try {
|
|
10582
|
+
return await uniffiRustCallAsync(
|
|
10583
|
+
/*rustCaller:*/ uniffiCaller,
|
|
10584
|
+
/*rustFutureFunc:*/ () => {
|
|
10585
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_balance_summary(
|
|
10586
|
+
uniffiTypeWalletObjectFactory.clonePointer(this)
|
|
10587
|
+
);
|
|
10588
|
+
},
|
|
10589
|
+
/*pollFunc:*/ nativeModule()
|
|
10590
|
+
.ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer,
|
|
10591
|
+
/*cancelFunc:*/ nativeModule()
|
|
10592
|
+
.ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer,
|
|
10593
|
+
/*completeFunc:*/ nativeModule()
|
|
10594
|
+
.ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer,
|
|
10595
|
+
/*freeFunc:*/ nativeModule()
|
|
10596
|
+
.ubrn_ffi_bark_ffi_rust_future_free_rust_buffer,
|
|
10597
|
+
// Async returns always go through the JS-side converter: the
|
|
10598
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
10599
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
10600
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
10601
|
+
// here using the per-callable return-type converter.
|
|
10602
|
+
// Borrowed view over foreign memory: the call site owns the free,
|
|
10603
|
+
// as on the sync paths. Unconditional — a no-op where buffers are
|
|
10604
|
+
// already JS-owned.
|
|
10605
|
+
/*liftFunc:*/ (__rb) => {
|
|
10606
|
+
try {
|
|
10607
|
+
return FfiConverterTypeBalanceSummary.lift(__rb);
|
|
10608
|
+
} finally {
|
|
10609
|
+
nativeModule().rustbuffer_free(__rb);
|
|
10610
|
+
}
|
|
10611
|
+
},
|
|
10612
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
10613
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
10614
|
+
/*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError)
|
|
10615
|
+
);
|
|
10616
|
+
} catch (__error: any) {
|
|
10617
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
10618
|
+
__error.stack = __stack;
|
|
10619
|
+
}
|
|
10620
|
+
throw __error;
|
|
10621
|
+
}
|
|
10622
|
+
}
|
|
10623
|
+
|
|
10624
|
+
/**
|
|
10625
|
+
* Build a BIP 321 `bitcoin:` URI with a new Ark address, a new BOLT11
|
|
10626
|
+
* invoice (when there is an amount) and the caller's onchain address,
|
|
10627
|
+
* as `options` selects.
|
|
10628
|
+
*/
|
|
10629
|
+
async bip321Uri(
|
|
10630
|
+
options: Bip321UriOptions,
|
|
10631
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
10632
|
+
): Promise<Bip321Uri> /*throws*/ {
|
|
10633
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
10634
|
+
try {
|
|
10635
|
+
return await uniffiRustCallAsync(
|
|
10636
|
+
/*rustCaller:*/ uniffiCaller,
|
|
10637
|
+
/*rustFutureFunc:*/ () => {
|
|
10638
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_bip321_uri(
|
|
10639
|
+
uniffiTypeWalletObjectFactory.clonePointer(this),
|
|
10640
|
+
FfiConverterTypeBip321UriOptions.lower(
|
|
10641
|
+
options,
|
|
10642
|
+
nativeModule().rustbuffer_alloc
|
|
10643
|
+
)
|
|
10644
|
+
);
|
|
10645
|
+
},
|
|
10646
|
+
/*pollFunc:*/ nativeModule()
|
|
10647
|
+
.ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer,
|
|
10648
|
+
/*cancelFunc:*/ nativeModule()
|
|
10649
|
+
.ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer,
|
|
10650
|
+
/*completeFunc:*/ nativeModule()
|
|
10651
|
+
.ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer,
|
|
10652
|
+
/*freeFunc:*/ nativeModule()
|
|
10653
|
+
.ubrn_ffi_bark_ffi_rust_future_free_rust_buffer,
|
|
10654
|
+
// Async returns always go through the JS-side converter: the
|
|
10655
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
10656
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
10657
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
10658
|
+
// here using the per-callable return-type converter.
|
|
10659
|
+
// Borrowed view over foreign memory: the call site owns the free,
|
|
10660
|
+
// as on the sync paths. Unconditional — a no-op where buffers are
|
|
10661
|
+
// already JS-owned.
|
|
10662
|
+
/*liftFunc:*/ (__rb) => {
|
|
10663
|
+
try {
|
|
10664
|
+
return FfiConverterTypeBip321Uri.lift(__rb);
|
|
10665
|
+
} finally {
|
|
10666
|
+
nativeModule().rustbuffer_free(__rb);
|
|
10667
|
+
}
|
|
10668
|
+
},
|
|
10669
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
10670
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
10671
|
+
/*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError)
|
|
10672
|
+
);
|
|
10673
|
+
} catch (__error: any) {
|
|
10674
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
10675
|
+
__error.stack = __stack;
|
|
10676
|
+
}
|
|
10677
|
+
throw __error;
|
|
10678
|
+
}
|
|
10679
|
+
}
|
|
10680
|
+
|
|
8496
10681
|
async boardAll(asyncOpts_?: {
|
|
8497
10682
|
signal: AbortSignal;
|
|
8498
10683
|
}): Promise<PendingBoard> /*throws*/ {
|
|
@@ -9184,6 +11369,57 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
9184
11369
|
}
|
|
9185
11370
|
}
|
|
9186
11371
|
|
|
11372
|
+
/**
|
|
11373
|
+
* The network, mailbox id and VTXO xpub, as `bark debug-info` prints
|
|
11374
|
+
* them. Users can share this in support requests.
|
|
11375
|
+
*/
|
|
11376
|
+
async debugInfo(asyncOpts_?: {
|
|
11377
|
+
signal: AbortSignal;
|
|
11378
|
+
}): Promise<DebugInfo> /*throws*/ {
|
|
11379
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
11380
|
+
try {
|
|
11381
|
+
return await uniffiRustCallAsync(
|
|
11382
|
+
/*rustCaller:*/ uniffiCaller,
|
|
11383
|
+
/*rustFutureFunc:*/ () => {
|
|
11384
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_debug_info(
|
|
11385
|
+
uniffiTypeWalletObjectFactory.clonePointer(this)
|
|
11386
|
+
);
|
|
11387
|
+
},
|
|
11388
|
+
/*pollFunc:*/ nativeModule()
|
|
11389
|
+
.ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer,
|
|
11390
|
+
/*cancelFunc:*/ nativeModule()
|
|
11391
|
+
.ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer,
|
|
11392
|
+
/*completeFunc:*/ nativeModule()
|
|
11393
|
+
.ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer,
|
|
11394
|
+
/*freeFunc:*/ nativeModule()
|
|
11395
|
+
.ubrn_ffi_bark_ffi_rust_future_free_rust_buffer,
|
|
11396
|
+
// Async returns always go through the JS-side converter: the
|
|
11397
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
11398
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
11399
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
11400
|
+
// here using the per-callable return-type converter.
|
|
11401
|
+
// Borrowed view over foreign memory: the call site owns the free,
|
|
11402
|
+
// as on the sync paths. Unconditional — a no-op where buffers are
|
|
11403
|
+
// already JS-owned.
|
|
11404
|
+
/*liftFunc:*/ (__rb) => {
|
|
11405
|
+
try {
|
|
11406
|
+
return FfiConverterTypeDebugInfo.lift(__rb);
|
|
11407
|
+
} finally {
|
|
11408
|
+
nativeModule().rustbuffer_free(__rb);
|
|
11409
|
+
}
|
|
11410
|
+
},
|
|
11411
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
11412
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
11413
|
+
/*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError)
|
|
11414
|
+
);
|
|
11415
|
+
} catch (__error: any) {
|
|
11416
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
11417
|
+
__error.stack = __stack;
|
|
11418
|
+
}
|
|
11419
|
+
throw __error;
|
|
11420
|
+
}
|
|
11421
|
+
}
|
|
11422
|
+
|
|
9187
11423
|
/**
|
|
9188
11424
|
* Build a PSBT claiming exited VTXOs to `address`.
|
|
9189
11425
|
*
|
|
@@ -9364,16 +11600,18 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
9364
11600
|
* spendable VTXO). `fee_rate_sat_per_vb` applies to both legs; omit it to
|
|
9365
11601
|
* use the chain's fast rate for the broadcast leg and regular rate for
|
|
9366
11602
|
* the claim leg. `destination` only affects the claim transaction's weight.
|
|
11603
|
+
* `fee_margin` scales the broadcast leg (finite and non-negative; default
|
|
11604
|
+
* 1.2).
|
|
9367
11605
|
*
|
|
9368
|
-
* The
|
|
9369
|
-
*
|
|
9370
|
-
*
|
|
9371
|
-
* and return an error.
|
|
11606
|
+
* The estimate never reads the onchain wallet, so it works before the
|
|
11607
|
+
* wallet holds funds and with callback wallets
|
|
11608
|
+
* (`CustomOnchainWalletCallbacks`) too.
|
|
9372
11609
|
*/
|
|
9373
11610
|
async estimateEmergencyExitFee(
|
|
9374
11611
|
vtxoIds: Array<string>,
|
|
9375
11612
|
feeRateSatPerVb: bigint | undefined,
|
|
9376
11613
|
destination: string | undefined,
|
|
11614
|
+
feeMargin: number | undefined = undefined,
|
|
9377
11615
|
asyncOpts_?: { signal: AbortSignal }
|
|
9378
11616
|
): Promise<EmergencyExitFeeEstimate> /*throws*/ {
|
|
9379
11617
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
@@ -9394,6 +11632,10 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
9394
11632
|
FfiConverterOptionalString.lower(
|
|
9395
11633
|
destination,
|
|
9396
11634
|
nativeModule().rustbuffer_alloc
|
|
11635
|
+
),
|
|
11636
|
+
FfiConverterOptionalFloat64.lower(
|
|
11637
|
+
feeMargin,
|
|
11638
|
+
nativeModule().rustbuffer_alloc
|
|
9397
11639
|
)
|
|
9398
11640
|
);
|
|
9399
11641
|
},
|
|
@@ -9639,6 +11881,66 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
9639
11881
|
}
|
|
9640
11882
|
}
|
|
9641
11883
|
|
|
11884
|
+
/**
|
|
11885
|
+
* Estimate the fee of paying `amount_sats` to `method`.
|
|
11886
|
+
*/
|
|
11887
|
+
async estimatePaymentFee(
|
|
11888
|
+
method: PaymentMethod,
|
|
11889
|
+
amountSats: bigint,
|
|
11890
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
11891
|
+
): Promise<FeeEstimate> /*throws*/ {
|
|
11892
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
11893
|
+
try {
|
|
11894
|
+
return await uniffiRustCallAsync(
|
|
11895
|
+
/*rustCaller:*/ uniffiCaller,
|
|
11896
|
+
/*rustFutureFunc:*/ () => {
|
|
11897
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_estimate_payment_fee(
|
|
11898
|
+
uniffiTypeWalletObjectFactory.clonePointer(this),
|
|
11899
|
+
FfiConverterTypePaymentMethod.lower(
|
|
11900
|
+
method,
|
|
11901
|
+
nativeModule().rustbuffer_alloc
|
|
11902
|
+
),
|
|
11903
|
+
FfiConverterUInt64.lower(
|
|
11904
|
+
amountSats,
|
|
11905
|
+
nativeModule().rustbuffer_alloc
|
|
11906
|
+
)
|
|
11907
|
+
);
|
|
11908
|
+
},
|
|
11909
|
+
/*pollFunc:*/ nativeModule()
|
|
11910
|
+
.ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer,
|
|
11911
|
+
/*cancelFunc:*/ nativeModule()
|
|
11912
|
+
.ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer,
|
|
11913
|
+
/*completeFunc:*/ nativeModule()
|
|
11914
|
+
.ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer,
|
|
11915
|
+
/*freeFunc:*/ nativeModule()
|
|
11916
|
+
.ubrn_ffi_bark_ffi_rust_future_free_rust_buffer,
|
|
11917
|
+
// Async returns always go through the JS-side converter: the
|
|
11918
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
11919
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
11920
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
11921
|
+
// here using the per-callable return-type converter.
|
|
11922
|
+
// Borrowed view over foreign memory: the call site owns the free,
|
|
11923
|
+
// as on the sync paths. Unconditional — a no-op where buffers are
|
|
11924
|
+
// already JS-owned.
|
|
11925
|
+
/*liftFunc:*/ (__rb) => {
|
|
11926
|
+
try {
|
|
11927
|
+
return FfiConverterTypeFeeEstimate.lift(__rb);
|
|
11928
|
+
} finally {
|
|
11929
|
+
nativeModule().rustbuffer_free(__rb);
|
|
11930
|
+
}
|
|
11931
|
+
},
|
|
11932
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
11933
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
11934
|
+
/*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError)
|
|
11935
|
+
);
|
|
11936
|
+
} catch (__error: any) {
|
|
11937
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
11938
|
+
__error.stack = __stack;
|
|
11939
|
+
}
|
|
11940
|
+
throw __error;
|
|
11941
|
+
}
|
|
11942
|
+
}
|
|
11943
|
+
|
|
9642
11944
|
async estimateRefreshFee(
|
|
9643
11945
|
vtxoIds: Array<string>,
|
|
9644
11946
|
asyncOpts_?: { signal: AbortSignal }
|
|
@@ -9762,6 +12064,10 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
9762
12064
|
}
|
|
9763
12065
|
}
|
|
9764
12066
|
|
|
12067
|
+
/**
|
|
12068
|
+
* Status of one exit, live or finished. `None` if no exit was ever
|
|
12069
|
+
* started for the VTXO.
|
|
12070
|
+
*/
|
|
9765
12071
|
async getExitStatus(
|
|
9766
12072
|
vtxoId: string,
|
|
9767
12073
|
includeHistory: boolean,
|
|
@@ -9821,6 +12127,10 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
9821
12127
|
}
|
|
9822
12128
|
}
|
|
9823
12129
|
|
|
12130
|
+
/**
|
|
12131
|
+
* Live exits only. Finished exits leave this list; see
|
|
12132
|
+
* `list_finished_exits` and `get_exit_status`.
|
|
12133
|
+
*/
|
|
9824
12134
|
async getExitVtxos(asyncOpts_?: {
|
|
9825
12135
|
signal: AbortSignal;
|
|
9826
12136
|
}): Promise<Array<ExitVtxo>> /*throws*/ {
|
|
@@ -10524,6 +12834,66 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
10524
12834
|
}
|
|
10525
12835
|
}
|
|
10526
12836
|
|
|
12837
|
+
/**
|
|
12838
|
+
* Status of every exit this wallet ever started, live and finished.
|
|
12839
|
+
*/
|
|
12840
|
+
async listAllExits(
|
|
12841
|
+
includeHistory: boolean = false,
|
|
12842
|
+
includeTransactions: boolean = false,
|
|
12843
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
12844
|
+
): Promise<Array<ExitTransactionStatus>> /*throws*/ {
|
|
12845
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
12846
|
+
try {
|
|
12847
|
+
return await uniffiRustCallAsync(
|
|
12848
|
+
/*rustCaller:*/ uniffiCaller,
|
|
12849
|
+
/*rustFutureFunc:*/ () => {
|
|
12850
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_list_all_exits(
|
|
12851
|
+
uniffiTypeWalletObjectFactory.clonePointer(this),
|
|
12852
|
+
FfiConverterBool.lower(
|
|
12853
|
+
includeHistory,
|
|
12854
|
+
nativeModule().rustbuffer_alloc
|
|
12855
|
+
),
|
|
12856
|
+
FfiConverterBool.lower(
|
|
12857
|
+
includeTransactions,
|
|
12858
|
+
nativeModule().rustbuffer_alloc
|
|
12859
|
+
)
|
|
12860
|
+
);
|
|
12861
|
+
},
|
|
12862
|
+
/*pollFunc:*/ nativeModule()
|
|
12863
|
+
.ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer,
|
|
12864
|
+
/*cancelFunc:*/ nativeModule()
|
|
12865
|
+
.ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer,
|
|
12866
|
+
/*completeFunc:*/ nativeModule()
|
|
12867
|
+
.ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer,
|
|
12868
|
+
/*freeFunc:*/ nativeModule()
|
|
12869
|
+
.ubrn_ffi_bark_ffi_rust_future_free_rust_buffer,
|
|
12870
|
+
// Async returns always go through the JS-side converter: the
|
|
12871
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
12872
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
12873
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
12874
|
+
// here using the per-callable return-type converter.
|
|
12875
|
+
// Borrowed view over foreign memory: the call site owns the free,
|
|
12876
|
+
// as on the sync paths. Unconditional — a no-op where buffers are
|
|
12877
|
+
// already JS-owned.
|
|
12878
|
+
/*liftFunc:*/ (__rb) => {
|
|
12879
|
+
try {
|
|
12880
|
+
return FfiConverterSequenceTypeExitTransactionStatus.lift(__rb);
|
|
12881
|
+
} finally {
|
|
12882
|
+
nativeModule().rustbuffer_free(__rb);
|
|
12883
|
+
}
|
|
12884
|
+
},
|
|
12885
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
12886
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
12887
|
+
/*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError)
|
|
12888
|
+
);
|
|
12889
|
+
} catch (__error: any) {
|
|
12890
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
12891
|
+
__error.stack = __stack;
|
|
12892
|
+
}
|
|
12893
|
+
throw __error;
|
|
12894
|
+
}
|
|
12895
|
+
}
|
|
12896
|
+
|
|
10527
12897
|
async listClaimableExits(asyncOpts_?: {
|
|
10528
12898
|
signal: AbortSignal;
|
|
10529
12899
|
}): Promise<Array<ExitVtxo>> /*throws*/ {
|
|
@@ -10532,8 +12902,130 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
10532
12902
|
return await uniffiRustCallAsync(
|
|
10533
12903
|
/*rustCaller:*/ uniffiCaller,
|
|
10534
12904
|
/*rustFutureFunc:*/ () => {
|
|
10535
|
-
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_list_claimable_exits(
|
|
10536
|
-
uniffiTypeWalletObjectFactory.clonePointer(this)
|
|
12905
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_list_claimable_exits(
|
|
12906
|
+
uniffiTypeWalletObjectFactory.clonePointer(this)
|
|
12907
|
+
);
|
|
12908
|
+
},
|
|
12909
|
+
/*pollFunc:*/ nativeModule()
|
|
12910
|
+
.ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer,
|
|
12911
|
+
/*cancelFunc:*/ nativeModule()
|
|
12912
|
+
.ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer,
|
|
12913
|
+
/*completeFunc:*/ nativeModule()
|
|
12914
|
+
.ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer,
|
|
12915
|
+
/*freeFunc:*/ nativeModule()
|
|
12916
|
+
.ubrn_ffi_bark_ffi_rust_future_free_rust_buffer,
|
|
12917
|
+
// Async returns always go through the JS-side converter: the
|
|
12918
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
12919
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
12920
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
12921
|
+
// here using the per-callable return-type converter.
|
|
12922
|
+
// Borrowed view over foreign memory: the call site owns the free,
|
|
12923
|
+
// as on the sync paths. Unconditional — a no-op where buffers are
|
|
12924
|
+
// already JS-owned.
|
|
12925
|
+
/*liftFunc:*/ (__rb) => {
|
|
12926
|
+
try {
|
|
12927
|
+
return FfiConverterSequenceTypeExitVtxo.lift(__rb);
|
|
12928
|
+
} finally {
|
|
12929
|
+
nativeModule().rustbuffer_free(__rb);
|
|
12930
|
+
}
|
|
12931
|
+
},
|
|
12932
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
12933
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
12934
|
+
/*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError)
|
|
12935
|
+
);
|
|
12936
|
+
} catch (__error: any) {
|
|
12937
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
12938
|
+
__error.stack = __stack;
|
|
12939
|
+
}
|
|
12940
|
+
throw __error;
|
|
12941
|
+
}
|
|
12942
|
+
}
|
|
12943
|
+
|
|
12944
|
+
/**
|
|
12945
|
+
* Status of the exits in a terminal state: claimed, canceled, or aborted
|
|
12946
|
+
* because the VTXO was already spent or swept. They stay queryable after
|
|
12947
|
+
* completion, so a client need not snapshot them at drain time.
|
|
12948
|
+
*/
|
|
12949
|
+
async listFinishedExits(
|
|
12950
|
+
includeHistory: boolean = false,
|
|
12951
|
+
includeTransactions: boolean = false,
|
|
12952
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
12953
|
+
): Promise<Array<ExitTransactionStatus>> /*throws*/ {
|
|
12954
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
12955
|
+
try {
|
|
12956
|
+
return await uniffiRustCallAsync(
|
|
12957
|
+
/*rustCaller:*/ uniffiCaller,
|
|
12958
|
+
/*rustFutureFunc:*/ () => {
|
|
12959
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_list_finished_exits(
|
|
12960
|
+
uniffiTypeWalletObjectFactory.clonePointer(this),
|
|
12961
|
+
FfiConverterBool.lower(
|
|
12962
|
+
includeHistory,
|
|
12963
|
+
nativeModule().rustbuffer_alloc
|
|
12964
|
+
),
|
|
12965
|
+
FfiConverterBool.lower(
|
|
12966
|
+
includeTransactions,
|
|
12967
|
+
nativeModule().rustbuffer_alloc
|
|
12968
|
+
)
|
|
12969
|
+
);
|
|
12970
|
+
},
|
|
12971
|
+
/*pollFunc:*/ nativeModule()
|
|
12972
|
+
.ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer,
|
|
12973
|
+
/*cancelFunc:*/ nativeModule()
|
|
12974
|
+
.ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer,
|
|
12975
|
+
/*completeFunc:*/ nativeModule()
|
|
12976
|
+
.ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer,
|
|
12977
|
+
/*freeFunc:*/ nativeModule()
|
|
12978
|
+
.ubrn_ffi_bark_ffi_rust_future_free_rust_buffer,
|
|
12979
|
+
// Async returns always go through the JS-side converter: the
|
|
12980
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
12981
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
12982
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
12983
|
+
// here using the per-callable return-type converter.
|
|
12984
|
+
// Borrowed view over foreign memory: the call site owns the free,
|
|
12985
|
+
// as on the sync paths. Unconditional — a no-op where buffers are
|
|
12986
|
+
// already JS-owned.
|
|
12987
|
+
/*liftFunc:*/ (__rb) => {
|
|
12988
|
+
try {
|
|
12989
|
+
return FfiConverterSequenceTypeExitTransactionStatus.lift(__rb);
|
|
12990
|
+
} finally {
|
|
12991
|
+
nativeModule().rustbuffer_free(__rb);
|
|
12992
|
+
}
|
|
12993
|
+
},
|
|
12994
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
12995
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
12996
|
+
/*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError)
|
|
12997
|
+
);
|
|
12998
|
+
} catch (__error: any) {
|
|
12999
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
13000
|
+
__error.stack = __stack;
|
|
13001
|
+
}
|
|
13002
|
+
throw __error;
|
|
13003
|
+
}
|
|
13004
|
+
}
|
|
13005
|
+
|
|
13006
|
+
/**
|
|
13007
|
+
* Status of the exits that are still progressing.
|
|
13008
|
+
*/
|
|
13009
|
+
async listLiveExits(
|
|
13010
|
+
includeHistory: boolean = false,
|
|
13011
|
+
includeTransactions: boolean = false,
|
|
13012
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
13013
|
+
): Promise<Array<ExitTransactionStatus>> /*throws*/ {
|
|
13014
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
13015
|
+
try {
|
|
13016
|
+
return await uniffiRustCallAsync(
|
|
13017
|
+
/*rustCaller:*/ uniffiCaller,
|
|
13018
|
+
/*rustFutureFunc:*/ () => {
|
|
13019
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_list_live_exits(
|
|
13020
|
+
uniffiTypeWalletObjectFactory.clonePointer(this),
|
|
13021
|
+
FfiConverterBool.lower(
|
|
13022
|
+
includeHistory,
|
|
13023
|
+
nativeModule().rustbuffer_alloc
|
|
13024
|
+
),
|
|
13025
|
+
FfiConverterBool.lower(
|
|
13026
|
+
includeTransactions,
|
|
13027
|
+
nativeModule().rustbuffer_alloc
|
|
13028
|
+
)
|
|
10537
13029
|
);
|
|
10538
13030
|
},
|
|
10539
13031
|
/*pollFunc:*/ nativeModule()
|
|
@@ -10554,7 +13046,7 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
10554
13046
|
// already JS-owned.
|
|
10555
13047
|
/*liftFunc:*/ (__rb) => {
|
|
10556
13048
|
try {
|
|
10557
|
-
return
|
|
13049
|
+
return FfiConverterSequenceTypeExitTransactionStatus.lift(__rb);
|
|
10558
13050
|
} finally {
|
|
10559
13051
|
nativeModule().rustbuffer_free(__rb);
|
|
10560
13052
|
}
|
|
@@ -11071,6 +13563,67 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
11071
13563
|
}
|
|
11072
13564
|
}
|
|
11073
13565
|
|
|
13566
|
+
/**
|
|
13567
|
+
* Parse any payment string bark understands: a BIP 321 `bitcoin:` URI, a
|
|
13568
|
+
* `lightning:` URI (any case), a BOLT11 invoice, a BOLT12 offer, a
|
|
13569
|
+
* lightning address, an LNURL-pay link or LUD-17 `lnurlp://` URI, an Ark
|
|
13570
|
+
* address, a bitcoin address or a hex output script. Surrounding
|
|
13571
|
+
* whitespace is not trimmed.
|
|
13572
|
+
*
|
|
13573
|
+
* Problems with a single option (wrong network, an Ark address of
|
|
13574
|
+
* another server, an amount mismatch) are reported in that option's
|
|
13575
|
+
* `errors`. Errors only when nothing in the string can be paid at all.
|
|
13576
|
+
* Checking an Ark address needs a server connection.
|
|
13577
|
+
*/
|
|
13578
|
+
async parsePaymentRequest(
|
|
13579
|
+
payment: string,
|
|
13580
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
13581
|
+
): Promise<PaymentRequest> /*throws*/ {
|
|
13582
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
13583
|
+
try {
|
|
13584
|
+
return await uniffiRustCallAsync(
|
|
13585
|
+
/*rustCaller:*/ uniffiCaller,
|
|
13586
|
+
/*rustFutureFunc:*/ () => {
|
|
13587
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_parse_payment_request(
|
|
13588
|
+
uniffiTypeWalletObjectFactory.clonePointer(this),
|
|
13589
|
+
FfiConverterString.lower(payment, nativeModule().rustbuffer_alloc)
|
|
13590
|
+
);
|
|
13591
|
+
},
|
|
13592
|
+
/*pollFunc:*/ nativeModule()
|
|
13593
|
+
.ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer,
|
|
13594
|
+
/*cancelFunc:*/ nativeModule()
|
|
13595
|
+
.ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer,
|
|
13596
|
+
/*completeFunc:*/ nativeModule()
|
|
13597
|
+
.ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer,
|
|
13598
|
+
/*freeFunc:*/ nativeModule()
|
|
13599
|
+
.ubrn_ffi_bark_ffi_rust_future_free_rust_buffer,
|
|
13600
|
+
// Async returns always go through the JS-side converter: the
|
|
13601
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
13602
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
13603
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
13604
|
+
// here using the per-callable return-type converter.
|
|
13605
|
+
// Borrowed view over foreign memory: the call site owns the free,
|
|
13606
|
+
// as on the sync paths. Unconditional — a no-op where buffers are
|
|
13607
|
+
// already JS-owned.
|
|
13608
|
+
/*liftFunc:*/ (__rb) => {
|
|
13609
|
+
try {
|
|
13610
|
+
return FfiConverterTypePaymentRequest.lift(__rb);
|
|
13611
|
+
} finally {
|
|
13612
|
+
nativeModule().rustbuffer_free(__rb);
|
|
13613
|
+
}
|
|
13614
|
+
},
|
|
13615
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
13616
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
13617
|
+
/*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError)
|
|
13618
|
+
);
|
|
13619
|
+
} catch (__error: any) {
|
|
13620
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
13621
|
+
__error.stack = __stack;
|
|
13622
|
+
}
|
|
13623
|
+
throw __error;
|
|
13624
|
+
}
|
|
13625
|
+
}
|
|
13626
|
+
|
|
11074
13627
|
/**
|
|
11075
13628
|
* Pay to a Lightning Address (`user@domain`), resolved via LNURL-pay.
|
|
11076
13629
|
*/
|
|
@@ -11079,6 +13632,7 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
11079
13632
|
amountSats: bigint,
|
|
11080
13633
|
comment: string | undefined,
|
|
11081
13634
|
wait: boolean = false,
|
|
13635
|
+
retryForSecs: bigint | undefined = undefined,
|
|
11082
13636
|
asyncOpts_?: { signal: AbortSignal }
|
|
11083
13637
|
): Promise<LightningSendStatus> /*throws*/ {
|
|
11084
13638
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
@@ -11100,7 +13654,11 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
11100
13654
|
comment,
|
|
11101
13655
|
nativeModule().rustbuffer_alloc
|
|
11102
13656
|
),
|
|
11103
|
-
FfiConverterBool.lower(wait, nativeModule().rustbuffer_alloc)
|
|
13657
|
+
FfiConverterBool.lower(wait, nativeModule().rustbuffer_alloc),
|
|
13658
|
+
FfiConverterOptionalUInt64.lower(
|
|
13659
|
+
retryForSecs,
|
|
13660
|
+
nativeModule().rustbuffer_alloc
|
|
13661
|
+
)
|
|
11104
13662
|
);
|
|
11105
13663
|
},
|
|
11106
13664
|
/*pollFunc:*/ nativeModule()
|
|
@@ -11138,10 +13696,18 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
11138
13696
|
}
|
|
11139
13697
|
}
|
|
11140
13698
|
|
|
13699
|
+
/**
|
|
13700
|
+
* Pay a BOLT11 invoice.
|
|
13701
|
+
*
|
|
13702
|
+
* `retry_for_secs` is how long the Ark server keeps trying to pay,
|
|
13703
|
+
* capped to the server's maximum; `None` leaves it to the server and 0
|
|
13704
|
+
* makes a single attempt. The same holds for every `pay_*` method.
|
|
13705
|
+
*/
|
|
11141
13706
|
async payLightningInvoice(
|
|
11142
13707
|
invoice: string,
|
|
11143
13708
|
amountSats: bigint | undefined,
|
|
11144
13709
|
wait: boolean = false,
|
|
13710
|
+
retryForSecs: bigint | undefined = undefined,
|
|
11145
13711
|
asyncOpts_?: { signal: AbortSignal }
|
|
11146
13712
|
): Promise<LightningSendStatus> /*throws*/ {
|
|
11147
13713
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
@@ -11156,7 +13722,11 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
11156
13722
|
amountSats,
|
|
11157
13723
|
nativeModule().rustbuffer_alloc
|
|
11158
13724
|
),
|
|
11159
|
-
FfiConverterBool.lower(wait, nativeModule().rustbuffer_alloc)
|
|
13725
|
+
FfiConverterBool.lower(wait, nativeModule().rustbuffer_alloc),
|
|
13726
|
+
FfiConverterOptionalUInt64.lower(
|
|
13727
|
+
retryForSecs,
|
|
13728
|
+
nativeModule().rustbuffer_alloc
|
|
13729
|
+
)
|
|
11160
13730
|
);
|
|
11161
13731
|
},
|
|
11162
13732
|
/*pollFunc:*/ nativeModule()
|
|
@@ -11198,6 +13768,7 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
11198
13768
|
offer: string,
|
|
11199
13769
|
amountSats: bigint | undefined,
|
|
11200
13770
|
wait: boolean = false,
|
|
13771
|
+
retryForSecs: bigint | undefined = undefined,
|
|
11201
13772
|
asyncOpts_?: { signal: AbortSignal }
|
|
11202
13773
|
): Promise<LightningSendStatus> /*throws*/ {
|
|
11203
13774
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
@@ -11212,7 +13783,11 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
11212
13783
|
amountSats,
|
|
11213
13784
|
nativeModule().rustbuffer_alloc
|
|
11214
13785
|
),
|
|
11215
|
-
FfiConverterBool.lower(wait, nativeModule().rustbuffer_alloc)
|
|
13786
|
+
FfiConverterBool.lower(wait, nativeModule().rustbuffer_alloc),
|
|
13787
|
+
FfiConverterOptionalUInt64.lower(
|
|
13788
|
+
retryForSecs,
|
|
13789
|
+
nativeModule().rustbuffer_alloc
|
|
13790
|
+
)
|
|
11216
13791
|
);
|
|
11217
13792
|
},
|
|
11218
13793
|
/*pollFunc:*/ nativeModule()
|
|
@@ -11261,6 +13836,7 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
11261
13836
|
amountSats: bigint,
|
|
11262
13837
|
comment: string | undefined,
|
|
11263
13838
|
wait: boolean = false,
|
|
13839
|
+
retryForSecs: bigint | undefined = undefined,
|
|
11264
13840
|
asyncOpts_?: { signal: AbortSignal }
|
|
11265
13841
|
): Promise<LightningSendStatus> /*throws*/ {
|
|
11266
13842
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
@@ -11279,7 +13855,11 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
11279
13855
|
comment,
|
|
11280
13856
|
nativeModule().rustbuffer_alloc
|
|
11281
13857
|
),
|
|
11282
|
-
FfiConverterBool.lower(wait, nativeModule().rustbuffer_alloc)
|
|
13858
|
+
FfiConverterBool.lower(wait, nativeModule().rustbuffer_alloc),
|
|
13859
|
+
FfiConverterOptionalUInt64.lower(
|
|
13860
|
+
retryForSecs,
|
|
13861
|
+
nativeModule().rustbuffer_alloc
|
|
13862
|
+
)
|
|
11283
13863
|
);
|
|
11284
13864
|
},
|
|
11285
13865
|
/*pollFunc:*/ nativeModule()
|
|
@@ -12214,12 +14794,14 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
12214
14794
|
*
|
|
12215
14795
|
* An address this bark cannot deliver to (see `validateArkoorAddress`) is
|
|
12216
14796
|
* rejected up front, leaving the VTXOs spendable rather than cosigned.
|
|
14797
|
+
*
|
|
14798
|
+
* Returns the id of the movement that records the payment.
|
|
12217
14799
|
*/
|
|
12218
14800
|
async sendArkoorPayment(
|
|
12219
14801
|
arkAddress: string,
|
|
12220
14802
|
amountSats: bigint,
|
|
12221
14803
|
asyncOpts_?: { signal: AbortSignal }
|
|
12222
|
-
): Promise<
|
|
14804
|
+
): Promise<number> /*throws*/ {
|
|
12223
14805
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
12224
14806
|
try {
|
|
12225
14807
|
return await uniffiRustCallAsync(
|
|
@@ -12237,13 +14819,17 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
12237
14819
|
)
|
|
12238
14820
|
);
|
|
12239
14821
|
},
|
|
12240
|
-
/*pollFunc:*/ nativeModule().
|
|
12241
|
-
/*cancelFunc:*/ nativeModule()
|
|
12242
|
-
.ubrn_ffi_bark_ffi_rust_future_cancel_void,
|
|
14822
|
+
/*pollFunc:*/ nativeModule().ubrn_ffi_bark_ffi_rust_future_poll_u32,
|
|
14823
|
+
/*cancelFunc:*/ nativeModule().ubrn_ffi_bark_ffi_rust_future_cancel_u32,
|
|
12243
14824
|
/*completeFunc:*/ nativeModule()
|
|
12244
|
-
.
|
|
12245
|
-
/*freeFunc:*/ nativeModule().
|
|
12246
|
-
|
|
14825
|
+
.ubrn_ffi_bark_ffi_rust_future_complete_u32,
|
|
14826
|
+
/*freeFunc:*/ nativeModule().ubrn_ffi_bark_ffi_rust_future_free_u32,
|
|
14827
|
+
// Async returns always go through the JS-side converter: the
|
|
14828
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
14829
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
14830
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
14831
|
+
// here using the per-callable return-type converter.
|
|
14832
|
+
/*liftFunc:*/ FfiConverterUInt32.lift.bind(FfiConverterUInt32),
|
|
12247
14833
|
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
12248
14834
|
/*asyncOpts:*/ asyncOpts_,
|
|
12249
14835
|
/*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError)
|
|
@@ -12256,11 +14842,15 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
12256
14842
|
}
|
|
12257
14843
|
}
|
|
12258
14844
|
|
|
14845
|
+
/**
|
|
14846
|
+
* Send `amount_sats` from the offchain balance to an onchain address,
|
|
14847
|
+
* as an offboard. Returns the offboard txid and its movement id.
|
|
14848
|
+
*/
|
|
12259
14849
|
async sendOnchain(
|
|
12260
14850
|
address: string,
|
|
12261
14851
|
amountSats: bigint,
|
|
12262
14852
|
asyncOpts_?: { signal: AbortSignal }
|
|
12263
|
-
): Promise<
|
|
14853
|
+
): Promise<OffboardResult> /*throws*/ {
|
|
12264
14854
|
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
12265
14855
|
try {
|
|
12266
14856
|
return await uniffiRustCallAsync(
|
|
@@ -12293,7 +14883,86 @@ export class Wallet extends UniffiAbstractObject implements WalletLike {
|
|
|
12293
14883
|
// already JS-owned.
|
|
12294
14884
|
/*liftFunc:*/ (__rb) => {
|
|
12295
14885
|
try {
|
|
12296
|
-
return
|
|
14886
|
+
return FfiConverterTypeOffboardResult.lift(__rb);
|
|
14887
|
+
} finally {
|
|
14888
|
+
nativeModule().rustbuffer_free(__rb);
|
|
14889
|
+
}
|
|
14890
|
+
},
|
|
14891
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
|
|
14892
|
+
/*asyncOpts:*/ asyncOpts_,
|
|
14893
|
+
/*errorHandler:*/ FfiConverterTypeError.lift.bind(FfiConverterTypeError)
|
|
14894
|
+
);
|
|
14895
|
+
} catch (__error: any) {
|
|
14896
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
14897
|
+
__error.stack = __stack;
|
|
14898
|
+
}
|
|
14899
|
+
throw __error;
|
|
14900
|
+
}
|
|
14901
|
+
}
|
|
14902
|
+
|
|
14903
|
+
/**
|
|
14904
|
+
* Pay `method` over the matching rail: Ark, lightning or onchain.
|
|
14905
|
+
*
|
|
14906
|
+
* `amount_sats` is required for addresses and LNURL, and for invoices
|
|
14907
|
+
* and offers without an amount (`AvailablePaymentMethod.requires_amount`).
|
|
14908
|
+
* `comment` only reaches lightning addresses and LNURL. `wait` and
|
|
14909
|
+
* `retry_for_secs` only affect lightning. `retry_for_secs` is how long
|
|
14910
|
+
* the Ark server keeps trying to pay, capped to the server's maximum;
|
|
14911
|
+
* `None` leaves it to the server and 0 makes a single attempt.
|
|
14912
|
+
*/
|
|
14913
|
+
async sendPayment(
|
|
14914
|
+
method: PaymentMethod,
|
|
14915
|
+
amountSats: bigint | undefined = undefined,
|
|
14916
|
+
comment: string | undefined = undefined,
|
|
14917
|
+
wait: boolean = false,
|
|
14918
|
+
retryForSecs: bigint | undefined = undefined,
|
|
14919
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
14920
|
+
): Promise<PaymentResult> /*throws*/ {
|
|
14921
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
14922
|
+
try {
|
|
14923
|
+
return await uniffiRustCallAsync(
|
|
14924
|
+
/*rustCaller:*/ uniffiCaller,
|
|
14925
|
+
/*rustFutureFunc:*/ () => {
|
|
14926
|
+
return nativeModule().ubrn_uniffi_bark_ffi_fn_method_wallet_send_payment(
|
|
14927
|
+
uniffiTypeWalletObjectFactory.clonePointer(this),
|
|
14928
|
+
FfiConverterTypePaymentMethod.lower(
|
|
14929
|
+
method,
|
|
14930
|
+
nativeModule().rustbuffer_alloc
|
|
14931
|
+
),
|
|
14932
|
+
FfiConverterOptionalUInt64.lower(
|
|
14933
|
+
amountSats,
|
|
14934
|
+
nativeModule().rustbuffer_alloc
|
|
14935
|
+
),
|
|
14936
|
+
FfiConverterOptionalString.lower(
|
|
14937
|
+
comment,
|
|
14938
|
+
nativeModule().rustbuffer_alloc
|
|
14939
|
+
),
|
|
14940
|
+
FfiConverterBool.lower(wait, nativeModule().rustbuffer_alloc),
|
|
14941
|
+
FfiConverterOptionalUInt64.lower(
|
|
14942
|
+
retryForSecs,
|
|
14943
|
+
nativeModule().rustbuffer_alloc
|
|
14944
|
+
)
|
|
14945
|
+
);
|
|
14946
|
+
},
|
|
14947
|
+
/*pollFunc:*/ nativeModule()
|
|
14948
|
+
.ubrn_ffi_bark_ffi_rust_future_poll_rust_buffer,
|
|
14949
|
+
/*cancelFunc:*/ nativeModule()
|
|
14950
|
+
.ubrn_ffi_bark_ffi_rust_future_cancel_rust_buffer,
|
|
14951
|
+
/*completeFunc:*/ nativeModule()
|
|
14952
|
+
.ubrn_ffi_bark_ffi_rust_future_complete_rust_buffer,
|
|
14953
|
+
/*freeFunc:*/ nativeModule()
|
|
14954
|
+
.ubrn_ffi_bark_ffi_rust_future_free_rust_buffer,
|
|
14955
|
+
// Async returns always go through the JS-side converter: the
|
|
14956
|
+
// FFI symbol returns the future handle (u64), and the user-level
|
|
14957
|
+
// RustBuffer comes back via the shared `rust_future_complete_*`
|
|
14958
|
+
// export. The bytes the runtime hands back must be deserialized
|
|
14959
|
+
// here using the per-callable return-type converter.
|
|
14960
|
+
// Borrowed view over foreign memory: the call site owns the free,
|
|
14961
|
+
// as on the sync paths. Unconditional — a no-op where buffers are
|
|
14962
|
+
// already JS-owned.
|
|
14963
|
+
/*liftFunc:*/ (__rb) => {
|
|
14964
|
+
try {
|
|
14965
|
+
return FfiConverterTypePaymentResult.lift(__rb);
|
|
12297
14966
|
} finally {
|
|
12298
14967
|
nativeModule().rustbuffer_free(__rb);
|
|
12299
14968
|
}
|
|
@@ -13149,9 +15818,19 @@ const FfiConverterSequenceTypePpmExpiryFeeEntry = new FfiConverterArray(
|
|
|
13149
15818
|
FfiConverterTypePpmExpiryFeeEntry
|
|
13150
15819
|
);
|
|
13151
15820
|
|
|
15821
|
+
// FfiConverter for Array<PaymentMethodParsingError>
|
|
15822
|
+
const FfiConverterSequenceTypePaymentMethodParsingError = new FfiConverterArray(
|
|
15823
|
+
FfiConverterTypePaymentMethodParsingError
|
|
15824
|
+
);
|
|
15825
|
+
|
|
13152
15826
|
// FfiConverter for string | undefined
|
|
13153
15827
|
const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
|
|
13154
15828
|
|
|
15829
|
+
// FfiConverter for LightningInvoice | undefined
|
|
15830
|
+
const FfiConverterOptionalTypeLightningInvoice = new FfiConverterOptional(
|
|
15831
|
+
FfiConverterTypeLightningInvoice
|
|
15832
|
+
);
|
|
15833
|
+
|
|
13155
15834
|
// FfiConverter for number | undefined
|
|
13156
15835
|
const FfiConverterOptionalUInt16 = new FfiConverterOptional(FfiConverterUInt16);
|
|
13157
15836
|
|
|
@@ -13169,19 +15848,29 @@ const FfiConverterOptionalTypeExitCancelFailure = new FfiConverterOptional(
|
|
|
13169
15848
|
FfiConverterTypeExitCancelFailure
|
|
13170
15849
|
);
|
|
13171
15850
|
|
|
13172
|
-
// FfiConverter for Array<string>
|
|
13173
|
-
const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
|
|
13174
|
-
|
|
13175
15851
|
// FfiConverter for BlockRef | undefined
|
|
13176
15852
|
const FfiConverterOptionalTypeBlockRef = new FfiConverterOptional(
|
|
13177
15853
|
FfiConverterTypeBlockRef
|
|
13178
15854
|
);
|
|
13179
15855
|
|
|
15856
|
+
// FfiConverter for Array<string>
|
|
15857
|
+
const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
|
|
15858
|
+
|
|
13180
15859
|
// FfiConverter for Array<ExitTx>
|
|
13181
15860
|
const FfiConverterSequenceTypeExitTx = new FfiConverterArray(
|
|
13182
15861
|
FfiConverterTypeExitTx
|
|
13183
15862
|
);
|
|
13184
15863
|
|
|
15864
|
+
// FfiConverter for Array<OutPoint>
|
|
15865
|
+
const FfiConverterSequenceTypeOutPoint = new FfiConverterArray(
|
|
15866
|
+
FfiConverterTypeOutPoint
|
|
15867
|
+
);
|
|
15868
|
+
|
|
15869
|
+
// FfiConverter for ExitChildTransaction | undefined
|
|
15870
|
+
const FfiConverterOptionalTypeExitChildTransaction = new FfiConverterOptional(
|
|
15871
|
+
FfiConverterTypeExitChildTransaction
|
|
15872
|
+
);
|
|
15873
|
+
|
|
13185
15874
|
// FfiConverter for Array<ExitState>
|
|
13186
15875
|
const FfiConverterSequenceTypeExitState = new FfiConverterArray(
|
|
13187
15876
|
FfiConverterTypeExitState
|
|
@@ -13192,9 +15881,24 @@ const FfiConverterOptionalSequenceTypeExitState = new FfiConverterOptional(
|
|
|
13192
15881
|
FfiConverterSequenceTypeExitState
|
|
13193
15882
|
);
|
|
13194
15883
|
|
|
15884
|
+
// FfiConverter for Array<ExitTransactionPackage>
|
|
15885
|
+
const FfiConverterSequenceTypeExitTransactionPackage = new FfiConverterArray(
|
|
15886
|
+
FfiConverterTypeExitTransactionPackage
|
|
15887
|
+
);
|
|
15888
|
+
|
|
13195
15889
|
// FfiConverter for bigint | undefined
|
|
13196
15890
|
const FfiConverterOptionalInt64 = new FfiConverterOptional(FfiConverterInt64);
|
|
13197
15891
|
|
|
15892
|
+
// FfiConverter for Array<AvailablePaymentMethod>
|
|
15893
|
+
const FfiConverterSequenceTypeAvailablePaymentMethod = new FfiConverterArray(
|
|
15894
|
+
FfiConverterTypeAvailablePaymentMethod
|
|
15895
|
+
);
|
|
15896
|
+
|
|
15897
|
+
// FfiConverter for AvailablePaymentMethod | undefined
|
|
15898
|
+
const FfiConverterOptionalTypeAvailablePaymentMethod = new FfiConverterOptional(
|
|
15899
|
+
FfiConverterTypeAvailablePaymentMethod
|
|
15900
|
+
);
|
|
15901
|
+
|
|
13198
15902
|
// FfiConverter for VtxoLockHolder | undefined
|
|
13199
15903
|
const FfiConverterOptionalTypeVtxoLockHolder = new FfiConverterOptional(
|
|
13200
15904
|
FfiConverterTypeVtxoLockHolder
|
|
@@ -13235,6 +15939,11 @@ const FfiConverterOptionalTypeArkInfo = new FfiConverterOptional(
|
|
|
13235
15939
|
FfiConverterTypeArkInfo
|
|
13236
15940
|
);
|
|
13237
15941
|
|
|
15942
|
+
// FfiConverter for number | undefined
|
|
15943
|
+
const FfiConverterOptionalFloat64 = new FfiConverterOptional(
|
|
15944
|
+
FfiConverterFloat64
|
|
15945
|
+
);
|
|
15946
|
+
|
|
13238
15947
|
// FfiConverter for ExitTransactionStatus | undefined
|
|
13239
15948
|
const FfiConverterOptionalTypeExitTransactionStatus = new FfiConverterOptional(
|
|
13240
15949
|
FfiConverterTypeExitTransactionStatus
|
|
@@ -13255,6 +15964,11 @@ const FfiConverterOptionalTypeImportVtxoArgs = new FfiConverterOptional(
|
|
|
13255
15964
|
FfiConverterTypeImportVtxoArgs
|
|
13256
15965
|
);
|
|
13257
15966
|
|
|
15967
|
+
// FfiConverter for Array<ExitTransactionStatus>
|
|
15968
|
+
const FfiConverterSequenceTypeExitTransactionStatus = new FfiConverterArray(
|
|
15969
|
+
FfiConverterTypeExitTransactionStatus
|
|
15970
|
+
);
|
|
15971
|
+
|
|
13258
15972
|
// FfiConverter for Array<PendingBoard>
|
|
13259
15973
|
const FfiConverterSequenceTypePendingBoard = new FfiConverterArray(
|
|
13260
15974
|
FfiConverterTypePendingBoard
|
|
@@ -13290,6 +16004,11 @@ const FfiConverterOptionalTypeRoundState = new FfiConverterOptional(
|
|
|
13290
16004
|
FfiConverterTypeRoundState
|
|
13291
16005
|
);
|
|
13292
16006
|
|
|
16007
|
+
// FfiConverter for DatadirInfo | undefined
|
|
16008
|
+
const FfiConverterOptionalTypeDatadirInfo = new FfiConverterOptional(
|
|
16009
|
+
FfiConverterTypeDatadirInfo
|
|
16010
|
+
);
|
|
16011
|
+
|
|
13293
16012
|
/**
|
|
13294
16013
|
* This should be called before anything else.
|
|
13295
16014
|
*
|
|
@@ -13312,6 +16031,21 @@ function uniffiEnsureInitialized() {
|
|
|
13312
16031
|
bindingsContractVersion
|
|
13313
16032
|
);
|
|
13314
16033
|
}
|
|
16034
|
+
if (
|
|
16035
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_func_clear_logger() !== 48287
|
|
16036
|
+
) {
|
|
16037
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
16038
|
+
"uniffi_bark_ffi_checksum_func_clear_logger"
|
|
16039
|
+
);
|
|
16040
|
+
}
|
|
16041
|
+
if (
|
|
16042
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_func_decode_bolt11_invoice() !==
|
|
16043
|
+
43493
|
|
16044
|
+
) {
|
|
16045
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
16046
|
+
"uniffi_bark_ffi_checksum_func_decode_bolt11_invoice"
|
|
16047
|
+
);
|
|
16048
|
+
}
|
|
13315
16049
|
if (
|
|
13316
16050
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_func_default_vtxo_key_gap_limit() !==
|
|
13317
16051
|
3344
|
|
@@ -13352,7 +16086,15 @@ function uniffiEnsureInitialized() {
|
|
|
13352
16086
|
);
|
|
13353
16087
|
}
|
|
13354
16088
|
if (
|
|
13355
|
-
nativeModule().
|
|
16089
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_func_read_datadir_info() !==
|
|
16090
|
+
62647
|
|
16091
|
+
) {
|
|
16092
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
16093
|
+
"uniffi_bark_ffi_checksum_func_read_datadir_info"
|
|
16094
|
+
);
|
|
16095
|
+
}
|
|
16096
|
+
if (
|
|
16097
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_func_set_logger() !== 17909
|
|
13356
16098
|
) {
|
|
13357
16099
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
13358
16100
|
"uniffi_bark_ffi_checksum_func_set_logger"
|
|
@@ -13374,9 +16116,16 @@ function uniffiEnsureInitialized() {
|
|
|
13374
16116
|
"uniffi_bark_ffi_checksum_func_validate_mnemonic"
|
|
13375
16117
|
);
|
|
13376
16118
|
}
|
|
16119
|
+
if (
|
|
16120
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_func_wallet_exists() !== 32702
|
|
16121
|
+
) {
|
|
16122
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
16123
|
+
"uniffi_bark_ffi_checksum_func_wallet_exists"
|
|
16124
|
+
);
|
|
16125
|
+
}
|
|
13377
16126
|
if (
|
|
13378
16127
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_barklogger_log() !==
|
|
13379
|
-
|
|
16128
|
+
3468
|
|
13380
16129
|
) {
|
|
13381
16130
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
13382
16131
|
"uniffi_bark_ffi_checksum_method_barklogger_log"
|
|
@@ -13407,11 +16156,11 @@ function uniffiEnsureInitialized() {
|
|
|
13407
16156
|
);
|
|
13408
16157
|
}
|
|
13409
16158
|
if (
|
|
13410
|
-
nativeModule().
|
|
13411
|
-
|
|
16159
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_sign_psbt() !==
|
|
16160
|
+
17958
|
|
13412
16161
|
) {
|
|
13413
16162
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
13414
|
-
"
|
|
16163
|
+
"uniffi_bark_ffi_checksum_method_customonchainwalletcallbacks_sign_psbt"
|
|
13415
16164
|
);
|
|
13416
16165
|
}
|
|
13417
16166
|
if (
|
|
@@ -13630,6 +16379,22 @@ function uniffiEnsureInitialized() {
|
|
|
13630
16379
|
"uniffi_bark_ffi_checksum_method_wallet_balance"
|
|
13631
16380
|
);
|
|
13632
16381
|
}
|
|
16382
|
+
if (
|
|
16383
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_balance_summary() !==
|
|
16384
|
+
9541
|
|
16385
|
+
) {
|
|
16386
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
16387
|
+
"uniffi_bark_ffi_checksum_method_wallet_balance_summary"
|
|
16388
|
+
);
|
|
16389
|
+
}
|
|
16390
|
+
if (
|
|
16391
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_bip321_uri() !==
|
|
16392
|
+
64697
|
|
16393
|
+
) {
|
|
16394
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
16395
|
+
"uniffi_bark_ffi_checksum_method_wallet_bip321_uri"
|
|
16396
|
+
);
|
|
16397
|
+
}
|
|
13633
16398
|
if (
|
|
13634
16399
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_board_all() !==
|
|
13635
16400
|
5667
|
|
@@ -13742,6 +16507,14 @@ function uniffiEnsureInitialized() {
|
|
|
13742
16507
|
"uniffi_bark_ffi_checksum_method_wallet_config"
|
|
13743
16508
|
);
|
|
13744
16509
|
}
|
|
16510
|
+
if (
|
|
16511
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_debug_info() !==
|
|
16512
|
+
12282
|
|
16513
|
+
) {
|
|
16514
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
16515
|
+
"uniffi_bark_ffi_checksum_method_wallet_debug_info"
|
|
16516
|
+
);
|
|
16517
|
+
}
|
|
13745
16518
|
if (
|
|
13746
16519
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_drain_exits() !==
|
|
13747
16520
|
45364
|
|
@@ -13768,7 +16541,7 @@ function uniffiEnsureInitialized() {
|
|
|
13768
16541
|
}
|
|
13769
16542
|
if (
|
|
13770
16543
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_estimate_emergency_exit_fee() !==
|
|
13771
|
-
|
|
16544
|
+
5118
|
|
13772
16545
|
) {
|
|
13773
16546
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
13774
16547
|
"uniffi_bark_ffi_checksum_method_wallet_estimate_emergency_exit_fee"
|
|
@@ -13806,6 +16579,14 @@ function uniffiEnsureInitialized() {
|
|
|
13806
16579
|
"uniffi_bark_ffi_checksum_method_wallet_estimate_offboard_fee"
|
|
13807
16580
|
);
|
|
13808
16581
|
}
|
|
16582
|
+
if (
|
|
16583
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_estimate_payment_fee() !==
|
|
16584
|
+
53689
|
|
16585
|
+
) {
|
|
16586
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
16587
|
+
"uniffi_bark_ffi_checksum_method_wallet_estimate_payment_fee"
|
|
16588
|
+
);
|
|
16589
|
+
}
|
|
13809
16590
|
if (
|
|
13810
16591
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_estimate_refresh_fee() !==
|
|
13811
16592
|
18182
|
|
@@ -13832,7 +16613,7 @@ function uniffiEnsureInitialized() {
|
|
|
13832
16613
|
}
|
|
13833
16614
|
if (
|
|
13834
16615
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_get_exit_status() !==
|
|
13835
|
-
|
|
16616
|
+
3037
|
|
13836
16617
|
) {
|
|
13837
16618
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
13838
16619
|
"uniffi_bark_ffi_checksum_method_wallet_get_exit_status"
|
|
@@ -13840,7 +16621,7 @@ function uniffiEnsureInitialized() {
|
|
|
13840
16621
|
}
|
|
13841
16622
|
if (
|
|
13842
16623
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_get_exit_vtxos() !==
|
|
13843
|
-
|
|
16624
|
+
35836
|
|
13844
16625
|
) {
|
|
13845
16626
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
13846
16627
|
"uniffi_bark_ffi_checksum_method_wallet_get_exit_vtxos"
|
|
@@ -13950,6 +16731,14 @@ function uniffiEnsureInitialized() {
|
|
|
13950
16731
|
"uniffi_bark_ffi_checksum_method_wallet_lightning_send_state"
|
|
13951
16732
|
);
|
|
13952
16733
|
}
|
|
16734
|
+
if (
|
|
16735
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_list_all_exits() !==
|
|
16736
|
+
11191
|
|
16737
|
+
) {
|
|
16738
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
16739
|
+
"uniffi_bark_ffi_checksum_method_wallet_list_all_exits"
|
|
16740
|
+
);
|
|
16741
|
+
}
|
|
13953
16742
|
if (
|
|
13954
16743
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_list_claimable_exits() !==
|
|
13955
16744
|
58660
|
|
@@ -13958,6 +16747,22 @@ function uniffiEnsureInitialized() {
|
|
|
13958
16747
|
"uniffi_bark_ffi_checksum_method_wallet_list_claimable_exits"
|
|
13959
16748
|
);
|
|
13960
16749
|
}
|
|
16750
|
+
if (
|
|
16751
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_list_finished_exits() !==
|
|
16752
|
+
44459
|
|
16753
|
+
) {
|
|
16754
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
16755
|
+
"uniffi_bark_ffi_checksum_method_wallet_list_finished_exits"
|
|
16756
|
+
);
|
|
16757
|
+
}
|
|
16758
|
+
if (
|
|
16759
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_list_live_exits() !==
|
|
16760
|
+
16771
|
|
16761
|
+
) {
|
|
16762
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
16763
|
+
"uniffi_bark_ffi_checksum_method_wallet_list_live_exits"
|
|
16764
|
+
);
|
|
16765
|
+
}
|
|
13961
16766
|
if (
|
|
13962
16767
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_lock_vtxos() !==
|
|
13963
16768
|
13415
|
|
@@ -14062,9 +16867,17 @@ function uniffiEnsureInitialized() {
|
|
|
14062
16867
|
"uniffi_bark_ffi_checksum_method_wallet_offboard_vtxos"
|
|
14063
16868
|
);
|
|
14064
16869
|
}
|
|
16870
|
+
if (
|
|
16871
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_parse_payment_request() !==
|
|
16872
|
+
2160
|
|
16873
|
+
) {
|
|
16874
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
16875
|
+
"uniffi_bark_ffi_checksum_method_wallet_parse_payment_request"
|
|
16876
|
+
);
|
|
16877
|
+
}
|
|
14065
16878
|
if (
|
|
14066
16879
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_pay_lightning_address() !==
|
|
14067
|
-
|
|
16880
|
+
45319
|
|
14068
16881
|
) {
|
|
14069
16882
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
14070
16883
|
"uniffi_bark_ffi_checksum_method_wallet_pay_lightning_address"
|
|
@@ -14072,7 +16885,7 @@ function uniffiEnsureInitialized() {
|
|
|
14072
16885
|
}
|
|
14073
16886
|
if (
|
|
14074
16887
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_pay_lightning_invoice() !==
|
|
14075
|
-
|
|
16888
|
+
48095
|
|
14076
16889
|
) {
|
|
14077
16890
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
14078
16891
|
"uniffi_bark_ffi_checksum_method_wallet_pay_lightning_invoice"
|
|
@@ -14080,7 +16893,7 @@ function uniffiEnsureInitialized() {
|
|
|
14080
16893
|
}
|
|
14081
16894
|
if (
|
|
14082
16895
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_pay_lightning_offer() !==
|
|
14083
|
-
|
|
16896
|
+
53553
|
|
14084
16897
|
) {
|
|
14085
16898
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
14086
16899
|
"uniffi_bark_ffi_checksum_method_wallet_pay_lightning_offer"
|
|
@@ -14088,7 +16901,7 @@ function uniffiEnsureInitialized() {
|
|
|
14088
16901
|
}
|
|
14089
16902
|
if (
|
|
14090
16903
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_pay_lnurl() !==
|
|
14091
|
-
|
|
16904
|
+
19202
|
|
14092
16905
|
) {
|
|
14093
16906
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
14094
16907
|
"uniffi_bark_ffi_checksum_method_wallet_pay_lnurl"
|
|
@@ -14256,7 +17069,7 @@ function uniffiEnsureInitialized() {
|
|
|
14256
17069
|
}
|
|
14257
17070
|
if (
|
|
14258
17071
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment() !==
|
|
14259
|
-
|
|
17072
|
+
61332
|
|
14260
17073
|
) {
|
|
14261
17074
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
14262
17075
|
"uniffi_bark_ffi_checksum_method_wallet_send_arkoor_payment"
|
|
@@ -14264,12 +17077,20 @@ function uniffiEnsureInitialized() {
|
|
|
14264
17077
|
}
|
|
14265
17078
|
if (
|
|
14266
17079
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_send_onchain() !==
|
|
14267
|
-
|
|
17080
|
+
11375
|
|
14268
17081
|
) {
|
|
14269
17082
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
14270
17083
|
"uniffi_bark_ffi_checksum_method_wallet_send_onchain"
|
|
14271
17084
|
);
|
|
14272
17085
|
}
|
|
17086
|
+
if (
|
|
17087
|
+
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_send_payment() !==
|
|
17088
|
+
15378
|
|
17089
|
+
) {
|
|
17090
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
17091
|
+
"uniffi_bark_ffi_checksum_method_wallet_send_payment"
|
|
17092
|
+
);
|
|
17093
|
+
}
|
|
14273
17094
|
if (
|
|
14274
17095
|
nativeModule().ubrn_uniffi_bark_ffi_checksum_method_wallet_sign_exit_claim_inputs() !==
|
|
14275
17096
|
12930
|
|
@@ -14422,23 +17243,32 @@ export default Object.freeze({
|
|
|
14422
17243
|
converters: {
|
|
14423
17244
|
FfiConverterTypeAddressWithIndex,
|
|
14424
17245
|
FfiConverterTypeArkInfo,
|
|
17246
|
+
FfiConverterTypeAvailablePaymentMethod,
|
|
14425
17247
|
FfiConverterTypeBalance,
|
|
17248
|
+
FfiConverterTypeBalanceSummary,
|
|
14426
17249
|
FfiConverterTypeBarkLogger,
|
|
17250
|
+
FfiConverterTypeBip321Uri,
|
|
17251
|
+
FfiConverterTypeBip321UriOptions,
|
|
14427
17252
|
FfiConverterTypeBlockRef,
|
|
14428
17253
|
FfiConverterTypeBoardFees,
|
|
14429
17254
|
FfiConverterTypeBoardFundingInfo,
|
|
17255
|
+
FfiConverterTypeBolt11InvoiceDetails,
|
|
14430
17256
|
FfiConverterTypeConfig,
|
|
14431
17257
|
FfiConverterTypeCpfpParams,
|
|
14432
17258
|
FfiConverterTypeCustomOnchainWalletCallbacks,
|
|
17259
|
+
FfiConverterTypeDatadirInfo,
|
|
17260
|
+
FfiConverterTypeDebugInfo,
|
|
14433
17261
|
FfiConverterTypeDestination,
|
|
14434
17262
|
FfiConverterTypeEmergencyExitFeeEstimate,
|
|
14435
17263
|
FfiConverterTypeError,
|
|
14436
17264
|
FfiConverterTypeExitCancelFailure,
|
|
14437
17265
|
FfiConverterTypeExitCancelResult,
|
|
17266
|
+
FfiConverterTypeExitChildTransaction,
|
|
14438
17267
|
FfiConverterTypeExitClaimTransaction,
|
|
14439
17268
|
FfiConverterTypeExitProgressStatus,
|
|
14440
17269
|
FfiConverterTypeExitState,
|
|
14441
17270
|
FfiConverterTypeExitStateKind,
|
|
17271
|
+
FfiConverterTypeExitTransactionPackage,
|
|
14442
17272
|
FfiConverterTypeExitTransactionStatus,
|
|
14443
17273
|
FfiConverterTypeExitTx,
|
|
14444
17274
|
FfiConverterTypeExitTxOrigin,
|
|
@@ -14464,6 +17294,10 @@ export default Object.freeze({
|
|
|
14464
17294
|
FfiConverterTypeOnchainUtxo,
|
|
14465
17295
|
FfiConverterTypeOnchainWallet,
|
|
14466
17296
|
FfiConverterTypeOutPoint,
|
|
17297
|
+
FfiConverterTypePaymentMethod,
|
|
17298
|
+
FfiConverterTypePaymentMethodParsingError,
|
|
17299
|
+
FfiConverterTypePaymentRequest,
|
|
17300
|
+
FfiConverterTypePaymentResult,
|
|
14467
17301
|
FfiConverterTypePendingBoard,
|
|
14468
17302
|
FfiConverterTypePpmExpiryFeeEntry,
|
|
14469
17303
|
FfiConverterTypeRecoveryBucket,
|