@breeztech/breez-sdk-spark-react-native 0.1.8-dev4 → 0.1.9-dev2
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/cpp/generated/breez_sdk_spark.cpp +64 -7
- package/cpp/generated/breez_sdk_spark.hpp +6 -0
- package/lib/commonjs/generated/breez_sdk_spark-ffi.js.map +1 -1
- package/lib/commonjs/generated/breez_sdk_spark.js +123 -20
- package/lib/commonjs/generated/breez_sdk_spark.js.map +1 -1
- package/lib/module/generated/breez_sdk_spark-ffi.js.map +1 -1
- package/lib/module/generated/breez_sdk_spark.js +122 -19
- package/lib/module/generated/breez_sdk_spark.js.map +1 -1
- package/lib/typescript/commonjs/src/generated/breez_sdk_spark-ffi.d.ts +4 -2
- package/lib/typescript/commonjs/src/generated/breez_sdk_spark-ffi.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/generated/breez_sdk_spark.d.ts +82 -6
- package/lib/typescript/commonjs/src/generated/breez_sdk_spark.d.ts.map +1 -1
- package/lib/typescript/module/src/generated/breez_sdk_spark-ffi.d.ts +4 -2
- package/lib/typescript/module/src/generated/breez_sdk_spark-ffi.d.ts.map +1 -1
- package/lib/typescript/module/src/generated/breez_sdk_spark.d.ts +82 -6
- package/lib/typescript/module/src/generated/breez_sdk_spark.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/generated/breez_sdk_spark-ffi.ts +10 -2
- package/src/generated/breez_sdk_spark.ts +184 -37
|
@@ -162,40 +162,21 @@ export function defaultConfig(network: Network): Config {
|
|
|
162
162
|
)
|
|
163
163
|
);
|
|
164
164
|
}
|
|
165
|
-
export
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
/*rustCaller:*/ uniffiCaller,
|
|
173
|
-
/*rustFutureFunc:*/ () => {
|
|
165
|
+
export function defaultStorage(dataDir: string): Storage /*throws*/ {
|
|
166
|
+
return FfiConverterTypeStorage.lift(
|
|
167
|
+
uniffiCaller.rustCallWithError(
|
|
168
|
+
/*liftError:*/ FfiConverterTypeSdkError.lift.bind(
|
|
169
|
+
FfiConverterTypeSdkError
|
|
170
|
+
),
|
|
171
|
+
/*caller:*/ (callStatus) => {
|
|
174
172
|
return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_func_default_storage(
|
|
175
|
-
FfiConverterString.lower(dataDir)
|
|
173
|
+
FfiConverterString.lower(dataDir),
|
|
174
|
+
callStatus
|
|
176
175
|
);
|
|
177
176
|
},
|
|
178
|
-
/*
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
.ubrn_ffi_breez_sdk_spark_rust_future_cancel_pointer,
|
|
182
|
-
/*completeFunc:*/ nativeModule()
|
|
183
|
-
.ubrn_ffi_breez_sdk_spark_rust_future_complete_pointer,
|
|
184
|
-
/*freeFunc:*/ nativeModule()
|
|
185
|
-
.ubrn_ffi_breez_sdk_spark_rust_future_free_pointer,
|
|
186
|
-
/*liftFunc:*/ FfiConverterTypeStorage.lift.bind(FfiConverterTypeStorage),
|
|
187
|
-
/*liftString:*/ FfiConverterString.lift,
|
|
188
|
-
/*asyncOpts:*/ asyncOpts_,
|
|
189
|
-
/*errorHandler:*/ FfiConverterTypeSdkError.lift.bind(
|
|
190
|
-
FfiConverterTypeSdkError
|
|
191
|
-
)
|
|
192
|
-
);
|
|
193
|
-
} catch (__error: any) {
|
|
194
|
-
if (uniffiIsDebug && __error instanceof Error) {
|
|
195
|
-
__error.stack = __stack;
|
|
196
|
-
}
|
|
197
|
-
throw __error;
|
|
198
|
-
}
|
|
177
|
+
/*liftString:*/ FfiConverterString.lift
|
|
178
|
+
)
|
|
179
|
+
);
|
|
199
180
|
}
|
|
200
181
|
export function initLogging(
|
|
201
182
|
logDir: string | undefined,
|
|
@@ -527,6 +508,12 @@ export type Config = {
|
|
|
527
508
|
* The domain used for receiving through lnurl-pay and lightning address.
|
|
528
509
|
*/
|
|
529
510
|
lnurlDomain: string | undefined;
|
|
511
|
+
/**
|
|
512
|
+
* When this is set to `true` we will prefer to use spark payments over
|
|
513
|
+
* lightning when sending and receiving. This has the benefit of lower fees
|
|
514
|
+
* but is at the cost of privacy.
|
|
515
|
+
*/
|
|
516
|
+
preferSparkOverLightning: boolean;
|
|
530
517
|
};
|
|
531
518
|
|
|
532
519
|
/**
|
|
@@ -567,6 +554,7 @@ const FfiConverterTypeConfig = (() => {
|
|
|
567
554
|
syncIntervalSecs: FfiConverterUInt32.read(from),
|
|
568
555
|
maxDepositClaimFee: FfiConverterOptionalTypeFee.read(from),
|
|
569
556
|
lnurlDomain: FfiConverterOptionalString.read(from),
|
|
557
|
+
preferSparkOverLightning: FfiConverterBool.read(from),
|
|
570
558
|
};
|
|
571
559
|
}
|
|
572
560
|
write(value: TypeName, into: RustBuffer): void {
|
|
@@ -575,6 +563,7 @@ const FfiConverterTypeConfig = (() => {
|
|
|
575
563
|
FfiConverterUInt32.write(value.syncIntervalSecs, into);
|
|
576
564
|
FfiConverterOptionalTypeFee.write(value.maxDepositClaimFee, into);
|
|
577
565
|
FfiConverterOptionalString.write(value.lnurlDomain, into);
|
|
566
|
+
FfiConverterBool.write(value.preferSparkOverLightning, into);
|
|
578
567
|
}
|
|
579
568
|
allocationSize(value: TypeName): number {
|
|
580
569
|
return (
|
|
@@ -582,7 +571,8 @@ const FfiConverterTypeConfig = (() => {
|
|
|
582
571
|
FfiConverterTypeNetwork.allocationSize(value.network) +
|
|
583
572
|
FfiConverterUInt32.allocationSize(value.syncIntervalSecs) +
|
|
584
573
|
FfiConverterOptionalTypeFee.allocationSize(value.maxDepositClaimFee) +
|
|
585
|
-
FfiConverterOptionalString.allocationSize(value.lnurlDomain)
|
|
574
|
+
FfiConverterOptionalString.allocationSize(value.lnurlDomain) +
|
|
575
|
+
FfiConverterBool.allocationSize(value.preferSparkOverLightning)
|
|
586
576
|
);
|
|
587
577
|
}
|
|
588
578
|
}
|
|
@@ -3346,6 +3336,55 @@ const FfiConverterTypeFee = (() => {
|
|
|
3346
3336
|
return new FFIConverter();
|
|
3347
3337
|
})();
|
|
3348
3338
|
|
|
3339
|
+
export enum KeySetType {
|
|
3340
|
+
Default,
|
|
3341
|
+
Taproot,
|
|
3342
|
+
NativeSegwit,
|
|
3343
|
+
WrappedSegwit,
|
|
3344
|
+
Legacy,
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3347
|
+
const FfiConverterTypeKeySetType = (() => {
|
|
3348
|
+
const ordinalConverter = FfiConverterInt32;
|
|
3349
|
+
type TypeName = KeySetType;
|
|
3350
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3351
|
+
read(from: RustBuffer): TypeName {
|
|
3352
|
+
switch (ordinalConverter.read(from)) {
|
|
3353
|
+
case 1:
|
|
3354
|
+
return KeySetType.Default;
|
|
3355
|
+
case 2:
|
|
3356
|
+
return KeySetType.Taproot;
|
|
3357
|
+
case 3:
|
|
3358
|
+
return KeySetType.NativeSegwit;
|
|
3359
|
+
case 4:
|
|
3360
|
+
return KeySetType.WrappedSegwit;
|
|
3361
|
+
case 5:
|
|
3362
|
+
return KeySetType.Legacy;
|
|
3363
|
+
default:
|
|
3364
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
3368
|
+
switch (value) {
|
|
3369
|
+
case KeySetType.Default:
|
|
3370
|
+
return ordinalConverter.write(1, into);
|
|
3371
|
+
case KeySetType.Taproot:
|
|
3372
|
+
return ordinalConverter.write(2, into);
|
|
3373
|
+
case KeySetType.NativeSegwit:
|
|
3374
|
+
return ordinalConverter.write(3, into);
|
|
3375
|
+
case KeySetType.WrappedSegwit:
|
|
3376
|
+
return ordinalConverter.write(4, into);
|
|
3377
|
+
case KeySetType.Legacy:
|
|
3378
|
+
return ordinalConverter.write(5, into);
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
allocationSize(value: TypeName): number {
|
|
3382
|
+
return ordinalConverter.allocationSize(0);
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
return new FFIConverter();
|
|
3386
|
+
})();
|
|
3387
|
+
|
|
3349
3388
|
export enum Network {
|
|
3350
3389
|
Mainnet,
|
|
3351
3390
|
Regtest,
|
|
@@ -4661,6 +4700,7 @@ export enum SdkEvent_Tags {
|
|
|
4661
4700
|
ClaimDepositsFailed = 'ClaimDepositsFailed',
|
|
4662
4701
|
ClaimDepositsSucceeded = 'ClaimDepositsSucceeded',
|
|
4663
4702
|
PaymentSucceeded = 'PaymentSucceeded',
|
|
4703
|
+
PaymentFailed = 'PaymentFailed',
|
|
4664
4704
|
}
|
|
4665
4705
|
/**
|
|
4666
4706
|
* Events emitted by the SDK
|
|
@@ -4790,6 +4830,33 @@ export const SdkEvent = (() => {
|
|
|
4790
4830
|
}
|
|
4791
4831
|
}
|
|
4792
4832
|
|
|
4833
|
+
type PaymentFailed__interface = {
|
|
4834
|
+
tag: SdkEvent_Tags.PaymentFailed;
|
|
4835
|
+
inner: Readonly<{ payment: Payment }>;
|
|
4836
|
+
};
|
|
4837
|
+
|
|
4838
|
+
class PaymentFailed_ extends UniffiEnum implements PaymentFailed__interface {
|
|
4839
|
+
/**
|
|
4840
|
+
* @private
|
|
4841
|
+
* This field is private and should not be used, use `tag` instead.
|
|
4842
|
+
*/
|
|
4843
|
+
readonly [uniffiTypeNameSymbol] = 'SdkEvent';
|
|
4844
|
+
readonly tag = SdkEvent_Tags.PaymentFailed;
|
|
4845
|
+
readonly inner: Readonly<{ payment: Payment }>;
|
|
4846
|
+
constructor(inner: { payment: Payment }) {
|
|
4847
|
+
super('SdkEvent', 'PaymentFailed');
|
|
4848
|
+
this.inner = Object.freeze(inner);
|
|
4849
|
+
}
|
|
4850
|
+
|
|
4851
|
+
static new(inner: { payment: Payment }): PaymentFailed_ {
|
|
4852
|
+
return new PaymentFailed_(inner);
|
|
4853
|
+
}
|
|
4854
|
+
|
|
4855
|
+
static instanceOf(obj: any): obj is PaymentFailed_ {
|
|
4856
|
+
return obj.tag === SdkEvent_Tags.PaymentFailed;
|
|
4857
|
+
}
|
|
4858
|
+
}
|
|
4859
|
+
|
|
4793
4860
|
function instanceOf(obj: any): obj is SdkEvent {
|
|
4794
4861
|
return obj[uniffiTypeNameSymbol] === 'SdkEvent';
|
|
4795
4862
|
}
|
|
@@ -4800,6 +4867,7 @@ export const SdkEvent = (() => {
|
|
|
4800
4867
|
ClaimDepositsFailed: ClaimDepositsFailed_,
|
|
4801
4868
|
ClaimDepositsSucceeded: ClaimDepositsSucceeded_,
|
|
4802
4869
|
PaymentSucceeded: PaymentSucceeded_,
|
|
4870
|
+
PaymentFailed: PaymentFailed_,
|
|
4803
4871
|
});
|
|
4804
4872
|
})();
|
|
4805
4873
|
|
|
@@ -4832,6 +4900,10 @@ const FfiConverterTypeSdkEvent = (() => {
|
|
|
4832
4900
|
return new SdkEvent.PaymentSucceeded({
|
|
4833
4901
|
payment: FfiConverterTypePayment.read(from),
|
|
4834
4902
|
});
|
|
4903
|
+
case 5:
|
|
4904
|
+
return new SdkEvent.PaymentFailed({
|
|
4905
|
+
payment: FfiConverterTypePayment.read(from),
|
|
4906
|
+
});
|
|
4835
4907
|
default:
|
|
4836
4908
|
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
4837
4909
|
}
|
|
@@ -4860,6 +4932,12 @@ const FfiConverterTypeSdkEvent = (() => {
|
|
|
4860
4932
|
FfiConverterTypePayment.write(inner.payment, into);
|
|
4861
4933
|
return;
|
|
4862
4934
|
}
|
|
4935
|
+
case SdkEvent_Tags.PaymentFailed: {
|
|
4936
|
+
ordinalConverter.write(5, into);
|
|
4937
|
+
const inner = value.inner;
|
|
4938
|
+
FfiConverterTypePayment.write(inner.payment, into);
|
|
4939
|
+
return;
|
|
4940
|
+
}
|
|
4863
4941
|
default:
|
|
4864
4942
|
// Throwing from here means that SdkEvent_Tags hasn't matched an ordinal.
|
|
4865
4943
|
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
@@ -4892,6 +4970,12 @@ const FfiConverterTypeSdkEvent = (() => {
|
|
|
4892
4970
|
size += FfiConverterTypePayment.allocationSize(inner.payment);
|
|
4893
4971
|
return size;
|
|
4894
4972
|
}
|
|
4973
|
+
case SdkEvent_Tags.PaymentFailed: {
|
|
4974
|
+
const inner = value.inner;
|
|
4975
|
+
let size = ordinalConverter.allocationSize(5);
|
|
4976
|
+
size += FfiConverterTypePayment.allocationSize(inner.payment);
|
|
4977
|
+
return size;
|
|
4978
|
+
}
|
|
4895
4979
|
default:
|
|
4896
4980
|
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
4897
4981
|
}
|
|
@@ -6112,7 +6196,7 @@ export interface BreezSdkInterface {
|
|
|
6112
6196
|
request: LnurlPayRequest,
|
|
6113
6197
|
asyncOpts_?: { signal: AbortSignal }
|
|
6114
6198
|
) /*throws*/ : Promise<LnurlPayResponse>;
|
|
6115
|
-
pollLightningSendPayment(
|
|
6199
|
+
pollLightningSendPayment(payment: Payment, sspId: string): void;
|
|
6116
6200
|
prepareLnurlPay(
|
|
6117
6201
|
request: PrepareLnurlPayRequest,
|
|
6118
6202
|
asyncOpts_?: { signal: AbortSignal }
|
|
@@ -6598,12 +6682,13 @@ export class BreezSdk
|
|
|
6598
6682
|
}
|
|
6599
6683
|
}
|
|
6600
6684
|
|
|
6601
|
-
public pollLightningSendPayment(
|
|
6685
|
+
public pollLightningSendPayment(payment: Payment, sspId: string): void {
|
|
6602
6686
|
uniffiCaller.rustCall(
|
|
6603
6687
|
/*caller:*/ (callStatus) => {
|
|
6604
6688
|
nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_breezsdk_poll_lightning_send_payment(
|
|
6605
6689
|
uniffiTypeBreezSdkObjectFactory.clonePointer(this),
|
|
6606
|
-
|
|
6690
|
+
FfiConverterTypePayment.lower(payment),
|
|
6691
|
+
FfiConverterString.lower(sspId),
|
|
6607
6692
|
callStatus
|
|
6608
6693
|
);
|
|
6609
6694
|
},
|
|
@@ -7076,6 +7161,17 @@ export interface SdkBuilderInterface {
|
|
|
7076
7161
|
chainService: BitcoinChainService,
|
|
7077
7162
|
asyncOpts_?: { signal: AbortSignal }
|
|
7078
7163
|
): Promise<void>;
|
|
7164
|
+
/**
|
|
7165
|
+
* Sets the key set type to be used by the SDK.
|
|
7166
|
+
* Arguments:
|
|
7167
|
+
* - `key_set_type`: The key set type which determines the derivation path.
|
|
7168
|
+
* - `use_address_index`: Controls the structure of the BIP derivation path.
|
|
7169
|
+
*/
|
|
7170
|
+
withKeySet(
|
|
7171
|
+
keySetType: KeySetType,
|
|
7172
|
+
useAddressIndex: boolean,
|
|
7173
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
7174
|
+
): Promise<void>;
|
|
7079
7175
|
withLnurlClient(
|
|
7080
7176
|
lnurlClient: RestClient,
|
|
7081
7177
|
asyncOpts_?: { signal: AbortSignal }
|
|
@@ -7207,6 +7303,48 @@ export class SdkBuilder
|
|
|
7207
7303
|
}
|
|
7208
7304
|
}
|
|
7209
7305
|
|
|
7306
|
+
/**
|
|
7307
|
+
* Sets the key set type to be used by the SDK.
|
|
7308
|
+
* Arguments:
|
|
7309
|
+
* - `key_set_type`: The key set type which determines the derivation path.
|
|
7310
|
+
* - `use_address_index`: Controls the structure of the BIP derivation path.
|
|
7311
|
+
*/
|
|
7312
|
+
public async withKeySet(
|
|
7313
|
+
keySetType: KeySetType,
|
|
7314
|
+
useAddressIndex: boolean,
|
|
7315
|
+
asyncOpts_?: { signal: AbortSignal }
|
|
7316
|
+
): Promise<void> {
|
|
7317
|
+
const __stack = uniffiIsDebug ? new Error().stack : undefined;
|
|
7318
|
+
try {
|
|
7319
|
+
return await uniffiRustCallAsync(
|
|
7320
|
+
/*rustCaller:*/ uniffiCaller,
|
|
7321
|
+
/*rustFutureFunc:*/ () => {
|
|
7322
|
+
return nativeModule().ubrn_uniffi_breez_sdk_spark_fn_method_sdkbuilder_with_key_set(
|
|
7323
|
+
uniffiTypeSdkBuilderObjectFactory.clonePointer(this),
|
|
7324
|
+
FfiConverterTypeKeySetType.lower(keySetType),
|
|
7325
|
+
FfiConverterBool.lower(useAddressIndex)
|
|
7326
|
+
);
|
|
7327
|
+
},
|
|
7328
|
+
/*pollFunc:*/ nativeModule()
|
|
7329
|
+
.ubrn_ffi_breez_sdk_spark_rust_future_poll_void,
|
|
7330
|
+
/*cancelFunc:*/ nativeModule()
|
|
7331
|
+
.ubrn_ffi_breez_sdk_spark_rust_future_cancel_void,
|
|
7332
|
+
/*completeFunc:*/ nativeModule()
|
|
7333
|
+
.ubrn_ffi_breez_sdk_spark_rust_future_complete_void,
|
|
7334
|
+
/*freeFunc:*/ nativeModule()
|
|
7335
|
+
.ubrn_ffi_breez_sdk_spark_rust_future_free_void,
|
|
7336
|
+
/*liftFunc:*/ (_v) => {},
|
|
7337
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
7338
|
+
/*asyncOpts:*/ asyncOpts_
|
|
7339
|
+
);
|
|
7340
|
+
} catch (__error: any) {
|
|
7341
|
+
if (uniffiIsDebug && __error instanceof Error) {
|
|
7342
|
+
__error.stack = __stack;
|
|
7343
|
+
}
|
|
7344
|
+
throw __error;
|
|
7345
|
+
}
|
|
7346
|
+
}
|
|
7347
|
+
|
|
7210
7348
|
public async withLnurlClient(
|
|
7211
7349
|
lnurlClient: RestClient,
|
|
7212
7350
|
asyncOpts_?: { signal: AbortSignal }
|
|
@@ -8744,7 +8882,7 @@ function uniffiEnsureInitialized() {
|
|
|
8744
8882
|
}
|
|
8745
8883
|
if (
|
|
8746
8884
|
nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_func_default_storage() !==
|
|
8747
|
-
|
|
8885
|
+
46285
|
|
8748
8886
|
) {
|
|
8749
8887
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
8750
8888
|
'uniffi_breez_sdk_spark_checksum_func_default_storage'
|
|
@@ -8879,7 +9017,7 @@ function uniffiEnsureInitialized() {
|
|
|
8879
9017
|
}
|
|
8880
9018
|
if (
|
|
8881
9019
|
nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_breezsdk_poll_lightning_send_payment() !==
|
|
8882
|
-
|
|
9020
|
+
57601
|
|
8883
9021
|
) {
|
|
8884
9022
|
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
8885
9023
|
'uniffi_breez_sdk_spark_checksum_method_breezsdk_poll_lightning_send_payment'
|
|
@@ -8981,6 +9119,14 @@ function uniffiEnsureInitialized() {
|
|
|
8981
9119
|
'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_chain_service'
|
|
8982
9120
|
);
|
|
8983
9121
|
}
|
|
9122
|
+
if (
|
|
9123
|
+
nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_key_set() !==
|
|
9124
|
+
55523
|
|
9125
|
+
) {
|
|
9126
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
9127
|
+
'uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_key_set'
|
|
9128
|
+
);
|
|
9129
|
+
}
|
|
8984
9130
|
if (
|
|
8985
9131
|
nativeModule().ubrn_uniffi_breez_sdk_spark_checksum_method_sdkbuilder_with_lnurl_client() !==
|
|
8986
9132
|
61720
|
|
@@ -9134,6 +9280,7 @@ export default Object.freeze({
|
|
|
9134
9280
|
FfiConverterTypeGetInfoResponse,
|
|
9135
9281
|
FfiConverterTypeGetPaymentRequest,
|
|
9136
9282
|
FfiConverterTypeGetPaymentResponse,
|
|
9283
|
+
FfiConverterTypeKeySetType,
|
|
9137
9284
|
FfiConverterTypeLightningAddressInfo,
|
|
9138
9285
|
FfiConverterTypeListPaymentsRequest,
|
|
9139
9286
|
FfiConverterTypeListPaymentsResponse,
|