forked from breez/spark-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.rs
More file actions
2143 lines (1877 loc) · 51.5 KB
/
Copy pathmodels.rs
File metadata and controls
2143 lines (1877 loc) · 51.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
use std::collections::HashMap;
pub use breez_sdk_spark::passkey::*;
pub use breez_sdk_spark::signer::*;
pub use breez_sdk_spark::sync_storage::*;
pub use breez_sdk_spark::*;
use flutter_rust_bridge::frb;
#[frb(mirror(BitcoinAddressDetails))]
pub struct _BitcoinAddressDetails {
pub address: String,
pub network: BitcoinNetwork,
pub source: PaymentRequestSource,
}
#[frb(mirror(BitcoinNetwork))]
pub enum _BitcoinNetwork {
Bitcoin,
Testnet3,
Testnet4,
Signet,
Regtest,
}
#[frb(mirror(Config))]
pub struct _Config {
pub api_key: Option<String>,
pub network: Network,
pub sync_interval_secs: u32,
pub max_deposit_claim_fee: Option<MaxFee>,
pub max_instant_deposit_claim_fee_bps: Option<u32>,
pub lnurl_domain: Option<String>,
pub prefer_spark_over_lightning: bool,
pub exit_chain_auto_fetch_enabled: bool,
pub external_input_parsers: Option<Vec<ExternalInputParser>>,
pub use_default_external_input_parsers: bool,
pub real_time_sync_server_url: Option<String>,
pub private_enabled_default: bool,
pub leaf_optimization_config: LeafOptimizationConfig,
pub token_optimization_config: TokenOptimizationConfig,
pub stable_balance_config: Option<StableBalanceConfig>,
/// Maximum number of concurrent transfer claims.
///
/// Controls how many pending Spark transfers can be claimed in parallel.
/// Default is 4. Increase for server environments with high incoming
/// payment volume to improve throughput.
pub max_concurrent_claims: u32,
pub spark_config: Option<SparkConfig>,
pub background_tasks_enabled: bool,
pub cross_chain_config: Option<CrossChainConfig>,
}
#[frb(mirror(CrossChainConfig))]
pub struct _CrossChainConfig {
pub default_slippage_bps: Option<u32>,
pub default_target_overpay_bps: Option<u32>,
}
#[frb(mirror(SparkConfig))]
pub struct _SparkConfig {
pub coordinator_identifier: String,
pub threshold: u32,
pub signing_operators: Vec<SparkSigningOperator>,
pub ssp_config: SparkSspConfig,
pub expected_withdraw_bond_sats: u64,
pub expected_withdraw_relative_block_locktime: u64,
pub max_token_transaction_inputs: Option<u32>,
}
#[frb(mirror(SparkSigningOperator))]
pub struct _SparkSigningOperator {
pub id: u32,
pub identifier: String,
pub address: String,
pub identity_public_key: String,
pub ca_cert_pem: Option<String>,
}
#[frb(mirror(SparkSspConfig))]
pub struct _SparkSspConfig {
pub base_url: String,
pub identity_public_key: String,
pub schema_endpoint: Option<String>,
}
#[frb(mirror(LeafOptimizationConfig))]
pub struct _LeafOptimizationConfig {
pub auto_enabled: bool,
pub multiplicity: u8,
}
#[frb(mirror(TokenOptimizationConfig))]
pub struct _TokenOptimizationConfig {
pub auto_enabled: bool,
pub target_output_count: u32,
pub min_outputs_threshold: u32,
}
#[frb(mirror(StableBalanceToken))]
pub struct _StableBalanceToken {
pub label: String,
pub token_identifier: String,
}
#[frb(mirror(StableBalanceConfig))]
pub struct _StableBalanceConfig {
pub tokens: Vec<StableBalanceToken>,
pub default_active_label: Option<String>,
pub threshold_sats: Option<u64>,
pub max_slippage_bps: Option<u32>,
}
#[frb(mirror(ExternalInputParser))]
pub struct _ExternalInputParser {
pub provider_id: String,
pub input_regex: String,
pub parser_url: String,
}
#[frb(mirror(Seed))]
pub enum _Seed {
Mnemonic {
mnemonic: String,
passphrase: Option<String>,
},
Entropy(Vec<u8>),
}
#[frb(mirror(ConnectRequest))]
pub struct _ConnectRequest {
pub config: Config,
pub seed: Seed,
pub storage_dir: String,
}
#[frb(mirror(CheckMessageRequest))]
pub struct _CheckMessageRequest {
pub message: String,
pub pubkey: String,
pub signature: String,
}
#[frb(mirror(CheckMessageResponse))]
pub struct _CheckMessageResponse {
pub is_valid: bool,
}
#[frb(mirror(ClaimDepositRequest))]
pub struct _ClaimDepositRequest {
pub txid: String,
pub vout: u32,
pub max_fee: Option<MaxFee>,
pub max_instant_fee_bps: Option<u32>,
}
#[frb(mirror(ClaimDepositResponse))]
pub struct _ClaimDepositResponse {
pub payment: Option<Payment>,
}
#[frb(mirror(Credentials))]
pub struct _Credentials {
pub username: String,
pub password: String,
}
#[frb(mirror(InstantClaimDeclineReason))]
pub enum _InstantClaimDeclineReason {
NoPlan,
FeeExceeded {
max_bps: u32,
quoted_bps: u32,
quoted_sats: u64,
},
SubmissionFailed,
}
#[frb(mirror(InstantClaimStatus))]
pub enum _InstantClaimStatus {
Declined { reason: InstantClaimDeclineReason },
Submitted { claim_id: String },
}
#[frb(mirror(DepositInfo))]
pub struct _DepositInfo {
pub txid: String,
pub vout: u32,
pub amount_sats: u64,
pub is_mature: bool,
pub refund_tx: Option<String>,
pub refund_tx_id: Option<String>,
pub claim_error: Option<DepositClaimError>,
pub instant_claim_status: Option<InstantClaimStatus>,
}
#[frb(mirror(MaxFee))]
pub enum _MaxFee {
Fixed { amount: u64 },
Rate { sat_per_vbyte: u64 },
NetworkRecommended { leeway_sat_per_vbyte: u64 },
}
#[frb(mirror(Fee))]
pub enum _Fee {
Fixed { amount: u64 },
Rate { sat_per_vbyte: u64 },
}
#[frb(mirror(CpfpInput))]
pub enum _CpfpInput {
P2wpkh {
txid: String,
vout: u32,
value: u64,
pubkey: String,
},
P2tr {
txid: String,
vout: u32,
value: u64,
pubkey: String,
},
Custom {
txid: String,
vout: u32,
value: u64,
script_pubkey_hex: String,
signed_input_weight: u64,
},
}
#[frb(mirror(CpfpFundingKind))]
pub enum _CpfpFundingKind {
P2wpkh,
P2tr,
Custom {
script_pubkey_hex: String,
signed_input_weight: u64,
},
}
#[frb(mirror(ExitLeafSelection))]
pub enum _ExitLeafSelection {
Auto,
Specific { leaf_ids: Vec<String> },
}
#[frb(mirror(UnilateralExitTxKind))]
pub enum _UnilateralExitTxKind {
FanOut,
Node,
Refund,
Sweep,
}
#[frb(mirror(ConfirmationStatus))]
pub enum _ConfirmationStatus {
Confirmed,
Unconfirmed,
Unverified,
}
#[frb(mirror(UnilateralExitTransaction))]
pub struct _UnilateralExitTransaction {
pub kind: UnilateralExitTxKind,
pub node_id: Option<String>,
pub txid: String,
pub tx_hex: String,
pub cpfp_tx_hex: Option<String>,
pub csv_timelock_blocks: Option<u32>,
pub depends_on: Vec<String>,
pub status: ConfirmationStatus,
}
#[frb(mirror(UnilateralExitLeaf))]
pub struct _UnilateralExitLeaf {
pub leaf_id: String,
pub value: u64,
}
#[frb(mirror(PerBranchFunding))]
pub struct _PerBranchFunding {
pub leaf_id: String,
pub funding_sat: u64,
}
#[frb(mirror(PrepareUnilateralExitRequest))]
pub struct _PrepareUnilateralExitRequest {
pub fee_rate_sat_per_vbyte: u64,
pub funding_kind: CpfpFundingKind,
pub destination: String,
pub selection: ExitLeafSelection,
}
#[frb(mirror(PrepareUnilateralExitResponse))]
pub struct _PrepareUnilateralExitResponse {
pub leaves: Vec<UnilateralExitLeaf>,
pub recoverable_value_sat: u64,
pub total_fee_sat: u64,
pub fanout_fee_sat: u64,
pub single_utxo_funding_sat: u64,
pub per_branch_funding: Vec<PerBranchFunding>,
pub fee_rate_sat_per_vbyte: u64,
pub destination: String,
}
#[frb(mirror(UnilateralExitRequest))]
pub struct _UnilateralExitRequest {
pub prepared: PrepareUnilateralExitResponse,
pub funding_inputs: Vec<CpfpInput>,
}
#[frb(mirror(UnilateralExitResponse))]
pub struct _UnilateralExitResponse {
pub recoverable_value_sat: u64,
pub total_fee_sat: u64,
pub leaves: Vec<UnilateralExitLeaf>,
pub transactions: Vec<UnilateralExitTransaction>,
}
#[frb(mirror(ExportUnilateralExitStateResponse))]
pub struct _ExportUnilateralExitStateResponse {
pub exit_state: String,
}
#[frb(mirror(ImportUnilateralExitStateRequest))]
pub struct _ImportUnilateralExitStateRequest {
pub exit_state: String,
}
#[frb(mirror(ImportUnilateralExitStateResponse))]
pub struct _ImportUnilateralExitStateResponse {
pub imported_leaves: u32,
pub skipped_foreign_leaves: u32,
pub skipped_conflicting_leaves: u32,
pub skipped_chains: u32,
}
#[frb(mirror(GetInfoRequest))]
pub struct _GetInfoRequest {
pub ensure_synced: Option<bool>,
}
#[frb(mirror(GetInfoResponse))]
pub struct _GetInfoResponse {
pub identity_pubkey: String,
pub balance_sats: u64,
pub token_balances: HashMap<String, TokenBalance>,
}
#[frb(mirror(TokenBalance))]
pub struct _TokenBalance {
pub balance: u128,
pub token_metadata: TokenMetadata,
}
#[frb(mirror(TokenMetadata))]
pub struct _TokenMetadata {
pub identifier: String,
pub issuer_public_key: String,
pub name: String,
pub ticker: String,
pub decimals: u32,
pub max_supply: u128,
pub is_freezable: bool,
}
#[frb(mirror(GetPaymentRequest))]
pub struct _GetPaymentRequest {
pub payment_id: String,
}
#[frb(mirror(GetPaymentResponse))]
pub struct _GetPaymentResponse {
pub payment: Payment,
}
#[frb(mirror(GetLightningReceiveRequestRequest))]
pub struct _GetLightningReceiveRequestRequest {
pub request_id: String,
}
#[frb(mirror(GetLightningReceiveRequestResponse))]
pub struct _GetLightningReceiveRequestResponse {
pub id: String,
pub status: LightningReceiveStatus,
pub invoice: String,
pub created_at: i64,
pub updated_at: i64,
pub transfer_id: Option<String>,
pub transfer_amount_sat: Option<u64>,
pub payment_preimage: Option<String>,
}
#[frb(mirror(GetPaymentByInvoiceRequest))]
pub struct _GetPaymentByInvoiceRequest {
pub invoice: String,
}
#[frb(mirror(GetPaymentByInvoiceResponse))]
pub struct _GetPaymentByInvoiceResponse {
pub payment: Option<Payment>,
}
#[frb(mirror(InputType))]
pub enum _InputType {
BitcoinAddress(BitcoinAddressDetails),
Bolt11Invoice(Bolt11InvoiceDetails),
Bolt12Invoice(Bolt12InvoiceDetails),
Bolt12Offer(Bolt12OfferDetails),
LightningAddress(LightningAddressDetails),
LnurlPay(LnurlPayRequestDetails),
SilentPaymentAddress(SilentPaymentAddressDetails),
LnurlAuth(LnurlAuthRequestDetails),
Url(String),
Bip21(Bip21Details),
Bolt12InvoiceRequest(Bolt12InvoiceRequestDetails),
LnurlWithdraw(LnurlWithdrawRequestDetails),
SparkAddress(SparkAddressDetails),
SparkInvoice(SparkInvoiceDetails),
CrossChainAddress(CrossChainAddressDetails),
}
#[frb(mirror(CrossChainAddressFamily))]
pub enum _CrossChainAddressFamily {
Evm,
Solana,
Tron,
}
#[frb(mirror(CrossChainAddressDetails))]
pub struct _CrossChainAddressDetails {
pub address: String,
pub address_family: CrossChainAddressFamily,
pub contract_address: Option<String>,
pub chain_id: Option<u64>,
pub amount: Option<u128>,
}
#[frb(mirror(SourceAsset))]
pub enum _SourceAsset {
Bitcoin,
Token { token_identifier: String },
}
#[frb(mirror(SourceChain))]
pub enum _SourceChain {
Spark,
Lightning,
Bitcoin,
}
#[frb(mirror(CrossChainFeeMode))]
pub enum _CrossChainFeeMode {
FeesExcluded,
FeesIncluded,
}
#[frb(mirror(CrossChainRoutePair))]
pub struct _CrossChainRoutePair {
pub provider: CrossChainProvider,
pub chain: String,
pub chain_id: Option<String>,
pub asset: String,
pub contract_address: Option<String>,
pub decimals: u8,
pub exact_out_eligible: bool,
pub supported_sources: Vec<SourceAsset>,
pub supported_source_chains: Vec<SourceChain>,
}
#[frb(mirror(CrossChainProviderContext))]
pub enum _CrossChainProviderContext {
Orchestra {
quote_id: String,
deposit_address: String,
deposit_amount: u128,
},
Boltz {
swap_id: String,
invoice: String,
invoice_amount_sats: u64,
max_slippage_bps: u32,
},
}
#[frb(mirror(CrossChainRouteFilter))]
pub enum _CrossChainRouteFilter {
Send {
address_details: CrossChainAddressDetails,
},
Receive {
contract_address: Option<String>,
},
PaymentLink {
address_details: CrossChainAddressDetails,
},
}
#[frb(mirror(PaymentDetailsFilter))]
pub enum _PaymentDetailsFilter {
Spark {
htlc_status: Option<Vec<SparkHtlcStatus>>,
conversion_refund_needed: Option<bool>,
},
Token {
conversion_refund_needed: Option<bool>,
tx_hash: Option<String>,
tx_type: Option<TokenTransactionType>,
},
Lightning {
htlc_status: Option<Vec<SparkHtlcStatus>>,
},
}
#[frb(mirror(ListPaymentsRequest))]
pub struct _ListPaymentsRequest {
pub type_filter: Option<Vec<PaymentType>>,
pub status_filter: Option<Vec<PaymentStatus>>,
pub asset_filter: Option<AssetFilter>,
pub payment_details_filter: Option<Vec<PaymentDetailsFilter>>,
pub from_timestamp: Option<u64>,
pub to_timestamp: Option<u64>,
pub offset: Option<u32>,
pub limit: Option<u32>,
pub sort_ascending: Option<bool>,
}
#[frb(mirror(AssetFilter))]
pub enum _AssetFilter {
Bitcoin,
Token { token_identifier: Option<String> },
}
#[frb(mirror(ListPaymentsResponse))]
pub struct _ListPaymentsResponse {
pub payments: Vec<Payment>,
}
#[frb(mirror(ListUnclaimedDepositsRequest))]
pub struct _ListUnclaimedDepositsRequest {}
#[frb(mirror(ListUnclaimedDepositsResponse))]
pub struct _ListUnclaimedDepositsResponse {
pub deposits: Vec<DepositInfo>,
}
#[frb(mirror(LnurlPayInfo))]
pub struct _LnurlPayInfo {
pub ln_address: Option<String>,
pub comment: Option<String>,
pub domain: Option<String>,
pub metadata: Option<String>,
pub processed_success_action: Option<SuccessActionProcessed>,
pub raw_success_action: Option<SuccessAction>,
}
#[frb(mirror(LnurlPayRequest))]
pub struct _LnurlPayRequest {
pub prepare_response: PrepareLnurlPayResponse,
pub idempotency_key: Option<String>,
}
#[frb(mirror(LnurlPayResponse))]
pub struct _LnurlPayResponse {
pub payment: Payment,
pub success_action: Option<SuccessActionProcessed>,
}
#[frb(mirror(LnurlWithdrawInfo))]
pub struct _LnurlWithdrawInfo {
pub withdraw_url: String,
}
#[frb(mirror(LnurlReceiveMetadata))]
pub struct _LnurlReceiveMetadata {
pub nostr_zap_request: Option<String>,
pub nostr_zap_receipt: Option<String>,
pub sender_comment: Option<String>,
}
#[frb(mirror(LnurlWithdrawRequest))]
pub struct _LnurlWithdrawRequest {
pub amount_sats: u64,
pub withdraw_request: LnurlWithdrawRequestDetails,
pub completion_timeout_secs: Option<u32>,
}
#[frb(mirror(LnurlWithdrawResponse))]
pub struct _LnurlWithdrawResponse {
pub payment_request: String,
pub payment: Option<Payment>,
}
#[frb(mirror(LnurlErrorDetails))]
pub struct _LnurlErrorDetails {
pub reason: String,
}
#[frb(mirror(LnurlCallbackStatus))]
pub enum _LnurlCallbackStatus {
Ok,
ErrorStatus { error_details: LnurlErrorDetails },
}
#[frb(mirror(OnchainConfirmationSpeed))]
pub enum _OnchainConfirmationSpeed {
Fast,
Medium,
Slow,
}
#[frb(mirror(FeePolicy))]
pub enum _FeePolicy {
/// Fees are added on top of the specified amount (default behavior).
FeesExcluded,
/// Fees are deducted from the specified amount.
FeesIncluded,
}
#[frb(mirror(PrepareLnurlPayRequest))]
pub struct _PrepareLnurlPayRequest {
pub amount: u128,
pub pay_request: LnurlPayRequestDetails,
pub comment: Option<String>,
pub validate_success_action_url: Option<bool>,
pub token_identifier: Option<String>,
pub conversion_options: Option<ConversionOptions>,
pub fee_policy: Option<FeePolicy>,
}
#[frb(mirror(PrepareLnurlPayResponse))]
pub struct _PrepareLnurlPayResponse {
pub amount_sats: u64,
pub comment: Option<String>,
pub pay_request: LnurlPayRequestDetails,
pub fee_sats: u64,
pub invoice_details: Bolt11InvoiceDetails,
pub success_action: Option<SuccessAction>,
pub conversion_estimate: Option<ConversionEstimate>,
pub fee_policy: FeePolicy,
}
#[frb(mirror(PaymentRequest))]
pub enum _PaymentRequest {
Input {
input: String,
},
CrossChain {
address: String,
route: CrossChainRoutePair,
max_slippage_bps: Option<u32>,
target_overpay_bps: Option<u32>,
},
}
#[frb(mirror(CrossChainProvider))]
pub enum _CrossChainProvider {
Orchestra,
Boltz,
}
#[frb(mirror(ExternalTreeNodeId))]
pub struct _ExternalTreeNodeId {
pub id: String,
}
#[frb(mirror(ExternalIdentifier))]
pub struct _ExternalIdentifier {
pub bytes: Vec<u8>,
}
#[frb(mirror(EcdsaSignatureBytes))]
pub struct _EcdsaSignatureBytes {
pub bytes: Vec<u8>,
}
#[frb(mirror(ExternalTransferLeafInput))]
pub struct _ExternalTransferLeafInput {
pub node_id: ExternalTreeNodeId,
pub new_leaf_id: ExternalTreeNodeId,
}
#[frb(mirror(ExternalOperatorRecipient))]
pub struct _ExternalOperatorRecipient {
pub id: u64,
pub identifier: ExternalIdentifier,
pub public_key: Vec<u8>,
}
#[frb(mirror(ExternalOperatorPackage))]
pub struct _ExternalOperatorPackage {
pub operator_identifier: ExternalIdentifier,
pub encrypted_package: Vec<u8>,
}
#[frb(mirror(ExternalNewLeafKey))]
pub struct _ExternalNewLeafKey {
pub node_id: ExternalTreeNodeId,
pub new_signing_public_key: Vec<u8>,
}
#[frb(mirror(ExternalPrepareTransferRequest))]
pub struct _ExternalPrepareTransferRequest {
pub transfer_id: String,
pub receiver_public_key: Vec<u8>,
pub leaves: Vec<ExternalTransferLeafInput>,
pub operator_recipients: Vec<ExternalOperatorRecipient>,
pub threshold: u32,
}
#[frb(mirror(ExternalPreparedTransfer))]
pub struct _ExternalPreparedTransfer {
pub operator_packages: Vec<ExternalOperatorPackage>,
pub new_leaf_keys: Vec<ExternalNewLeafKey>,
pub transfer_user_signature: EcdsaSignatureBytes,
}
#[frb(mirror(SchnorrSignatureBytes))]
pub struct _SchnorrSignatureBytes {
pub bytes: Vec<u8>,
}
#[frb(mirror(ExternalTokenTransactionKind))]
pub enum _ExternalTokenTransactionKind {
Freeze,
Partial,
Final,
}
#[frb(mirror(ExternalPrepareTokenTransactionRequest))]
pub struct _ExternalPrepareTokenTransactionRequest {
pub kind: ExternalTokenTransactionKind,
pub digest: Vec<u8>,
}
#[frb(mirror(ExternalPreparedTokenTransaction))]
pub struct _ExternalPreparedTokenTransaction {
pub signature: SchnorrSignatureBytes,
}
#[frb(mirror(UnsignedTransferPackage))]
pub enum _UnsignedTransferPackage {
Swap {
prepare_transfer: ExternalPrepareTransferRequest,
target_amounts: Vec<u64>,
amount_sat: u64,
fee_sat: u64,
},
Transfer {
prepare_transfer: ExternalPrepareTransferRequest,
amount_sat: u64,
fee_sat: u64,
target: TransferTarget,
},
Token {
prepare_token_transaction: ExternalPrepareTokenTransactionRequest,
token_context: Vec<u8>,
token_identifier: String,
amount: u128,
fee: u128,
is_swap: bool,
},
TokenBatch {
prepare_token_transaction: ExternalPrepareTokenTransactionRequest,
token_context: Vec<u8>,
totals: Vec<BatchTotal>,
is_swap: bool,
},
}
#[frb(mirror(TransferTarget))]
pub enum _TransferTarget {
Spark {
address: String,
spark_invoice: Option<String>,
},
Lightning {
bolt11: String,
lnurl_pay: Option<LnurlPayContext>,
fee_policy: FeePolicy,
completion_timeout_secs: Option<u32>,
},
CoopExit {
address: String,
fee_quote: SendOnchainFeeQuote,
confirmation_speed: OnchainConfirmationSpeed,
},
}
#[frb(mirror(LnurlPayContext))]
pub struct _LnurlPayContext {
pub pay_request: LnurlPayRequestDetails,
pub comment: Option<String>,
pub success_action: Option<SuccessAction>,
}
#[frb(mirror(SignedTransferPackage))]
pub struct _SignedTransferPackage {
pub unsigned: UnsignedTransferPackage,
pub signature: TransferSignature,
}
#[frb(mirror(TransferSignature))]
pub enum _TransferSignature {
Transfer {
signed: ExternalPreparedTransfer,
},
Token {
signed: ExternalPreparedTokenTransaction,
},
}
#[frb(mirror(BuildTransferPackageOptions))]
pub enum _BuildTransferPackageOptions {
BitcoinAddress {
confirmation_speed: OnchainConfirmationSpeed,
},
Bolt11Invoice {
prefer_spark: bool,
completion_timeout_secs: Option<u32>,
},
}
#[frb(mirror(BuildUnsignedTransferPackageRequest))]
pub struct _BuildUnsignedTransferPackageRequest {
pub prepare_response: PrepareSendPaymentResponse,
pub options: Option<BuildTransferPackageOptions>,
}
#[frb(mirror(PrepareSendPaymentRequest))]
pub struct _PrepareSendPaymentRequest {
pub payment_request: PaymentRequest,
pub amount: Option<u128>,
pub token_identifier: Option<String>,
pub conversion_options: Option<ConversionOptions>,
pub fee_policy: Option<FeePolicy>,
}
#[frb(mirror(PrepareSendPaymentResponse))]
pub struct _PrepareSendPaymentResponse {
pub payment_method: SendPaymentMethod,
pub amount: u128,
pub token_identifier: Option<String>,
pub conversion_estimate: Option<ConversionEstimate>,
pub fee_policy: FeePolicy,
}
#[frb(mirror(ReceivePaymentMethod))]
pub enum _ReceivePaymentMethod {
SparkAddress,
SparkInvoice {
amount: Option<u128>,
token_identifier: Option<String>,
expiry_time: Option<u64>,
description: Option<String>,
sender_public_key: Option<String>,
},
BitcoinAddress {
new_address: Option<bool>,
},
Bolt11Invoice {
description: String,
amount_sats: Option<u64>,
expiry_secs: Option<u32>,
payment_hash: Option<String>,
receiver_identity_public_key: Option<String>,
description_hash: Option<String>,
},
}
#[frb(mirror(ReceivePaymentRequest))]
pub struct _ReceivePaymentRequest {
pub payment_method: ReceivePaymentMethod,
}
#[frb(mirror(ReceivePaymentResponse))]
pub struct _ReceivePaymentResponse {
pub payment_request: String,
pub fee: u128,
pub lightning_receive_details: Option<LightningReceiveDetails>,
}
#[frb(mirror(LightningReceiveDetails))]
pub struct _LightningReceiveDetails {
pub receive_request_id: String,
pub status: LightningReceiveStatus,
pub created_at: i64,
pub updated_at: i64,
}
#[frb(mirror(LightningReceiveStatus))]
pub enum _LightningReceiveStatus {
InvoiceCreated,
HtlcReceived,
TransferCreated,
TransferCreationFailed,
PaymentPreimagePending,
PaymentPreimageRecovered,
PaymentPreimageQueryingFailed,
PaymentPreimageRecoveringFailed,
TransferCanceled,
HtlcFailed,
LightningPaymentReceived,
TransferFailed,
TransferCompleted,
RefundSigningCommitmentsQueryingFailed,
RefundSigningFailed,
Unknown,
}
#[frb(mirror(RefundDepositRequest))]
pub struct _RefundDepositRequest {
pub txid: String,
pub vout: u32,
pub destination_address: String,
pub fee: Fee,
}
#[frb(mirror(RefundDepositResponse))]
pub struct _RefundDepositResponse {
pub tx_id: String,
pub tx_hex: String,
}
#[frb(mirror(SendOnchainFeeQuote))]
pub struct _SendOnchainFeeQuote {
pub id: String,
pub expires_at: u64,
pub speed_fast: SendOnchainSpeedFeeQuote,
pub speed_medium: SendOnchainSpeedFeeQuote,
pub speed_slow: SendOnchainSpeedFeeQuote,
}
#[frb(mirror(SendOnchainSpeedFeeQuote))]
pub struct _SendOnchainSpeedFeeQuote {
pub user_fee_sat: u64,
pub l1_broadcast_fee_sat: u64,
}
#[frb(mirror(SendPaymentMethod))]
pub enum _SendPaymentMethod {
BitcoinAddress {
address: BitcoinAddressDetails,
fee_quote: SendOnchainFeeQuote,
},
Bolt11Invoice {
invoice_details: Bolt11InvoiceDetails,
spark_transfer_fee_sats: Option<u64>,
lightning_fee_sats: u64,
},
SparkAddress {
address: String,
fee: u128,
token_identifier: Option<String>,
},
SparkInvoice {
spark_invoice_details: SparkInvoiceDetails,
fee: u128,
token_identifier: Option<String>,
},
CrossChainAddress {
route: CrossChainRoutePair,
recipient_address: String,
amount_in: u128,
asset_amount_in: u128,
estimated_out: u128,
fee_amount: u128,
service_fee_amount: u128,
service_fee_asset: Option<String>,
source_transfer_fee_sats: u64,
fee_mode: CrossChainFeeMode,
expires_at: String,
provider_context: CrossChainProviderContext,
},
}
#[frb(mirror(SendPaymentOptions))]
pub enum _SendPaymentOptions {
BitcoinAddress {
confirmation_speed: OnchainConfirmationSpeed,
},
Bolt11Invoice {
prefer_spark: bool,
completion_timeout_secs: Option<u32>,
},
SparkAddress {
htlc_options: Option<SparkHtlcOptions>,
},
}
#[frb(mirror(SparkHtlcOptions))]
pub struct _SparkHtlcOptions {
pub payment_hash: String,
pub expiry_duration_secs: u64,
}
#[frb(mirror(SendPaymentRequest))]
pub struct _SendPaymentRequest {
pub prepare_response: PrepareSendPaymentResponse,