@@ -62,7 +62,7 @@ impl Transaction {
6262/// A PaymentId is a unique identifier for a payment. It can be either a Lightning payment or a
6363/// Trusted payment. It is used to track the state of a payment and to provide information about
6464/// the payment to the user.
65- #[ derive( Debug , Clone , Hash , PartialEq , Eq , uniffi:: Object ) ]
65+ #[ derive( Debug , Clone , Hash , PartialEq , Eq , uniffi:: Enum ) ]
6666pub enum PaymentId {
6767 Lightning ( String ) ,
6868 Trusted ( String ) ,
@@ -77,14 +77,6 @@ impl From<OrangePaymentId> for PaymentId {
7777 }
7878}
7979
80- #[ uniffi:: export]
81- impl PaymentId {
82- /// Gets a string representation of this PaymentId
83- pub fn to_string ( & self ) -> String {
84- format ! ( "{self:?}" )
85- }
86- }
87-
8880/// The status of a transaction. This is used to track the state of a transaction
8981#[ derive( Debug , Clone , Copy , PartialEq , Eq , uniffi:: Enum ) ]
9082pub enum TxStatus {
@@ -173,7 +165,7 @@ pub enum Event {
173165 /// An outgoing payment was successful.
174166 PaymentSuccessful {
175167 /// A local identifier used to track the payment.
176- payment_id : Arc < PaymentId > ,
168+ payment_id : PaymentId ,
177169 /// The hash of the payment.
178170 payment_hash : Vec < u8 > ,
179171 /// The preimage to the `payment_hash`.
@@ -186,7 +178,7 @@ pub enum Event {
186178 /// An outgoing payment has failed.
187179 PaymentFailed {
188180 /// A local identifier used to track the payment.
189- payment_id : Arc < PaymentId > ,
181+ payment_id : PaymentId ,
190182 /// The hash of the payment.
191183 ///
192184 /// This will be `None` if the payment failed before receiving an invoice when paying a
@@ -202,7 +194,7 @@ pub enum Event {
202194 /// A payment has been received.
203195 PaymentReceived {
204196 /// A local identifier used to track the payment.
205- payment_id : Arc < PaymentId > ,
197+ payment_id : PaymentId ,
206198 /// The hash of the payment.
207199 payment_hash : Vec < u8 > ,
208200 /// The value, in msats, that has been received.
@@ -216,7 +208,7 @@ pub enum Event {
216208 /// A payment has been received.
217209 OnchainPaymentReceived {
218210 /// A local identifier used to track the payment.
219- payment_id : Arc < PaymentId > ,
211+ payment_id : PaymentId ,
220212 /// The transaction ID.
221213 txid : Vec < u8 > ,
222214 /// The value, in sats, that has been received.
@@ -252,7 +244,7 @@ pub enum Event {
252244 /// A rebalance from our trusted wallet has been initiated.
253245 RebalanceInitiated {
254246 /// The `payment_id` of the transaction that triggered the rebalance.
255- trigger_payment_id : Arc < PaymentId > ,
247+ trigger_payment_id : PaymentId ,
256248 /// The `payment_id` of the rebalance payment sent from the trusted wallet.
257249 trusted_rebalance_payment_id : Vec < u8 > ,
258250 /// The amount, in msats, of the rebalance payment.
@@ -261,7 +253,7 @@ pub enum Event {
261253 /// A rebalance from our trusted wallet was successful.
262254 RebalanceSuccessful {
263255 /// The `payment_id` of the transaction that triggered the rebalance.
264- trigger_payment_id : Arc < PaymentId > ,
256+ trigger_payment_id : PaymentId ,
265257 /// The `payment_id` of the rebalance payment sent from the trusted wallet.
266258 trusted_rebalance_payment_id : Vec < u8 > ,
267259 /// The `payment_id` of the rebalance payment sent to the LN wallet.
@@ -293,14 +285,14 @@ impl From<OrangeEvent> for Event {
293285 payment_preimage,
294286 fee_paid_msat,
295287 } => Event :: PaymentSuccessful {
296- payment_id : Arc :: new ( payment_id. into ( ) ) ,
288+ payment_id : payment_id. into ( ) ,
297289 payment_hash : payment_hash. 0 . to_vec ( ) ,
298290 payment_preimage : payment_preimage. 0 . to_vec ( ) ,
299291 fee_paid_msat,
300292 } ,
301293 OrangeEvent :: PaymentFailed { payment_id, payment_hash, reason } => {
302294 Event :: PaymentFailed {
303- payment_id : Arc :: new ( payment_id. into ( ) ) ,
295+ payment_id : payment_id. into ( ) ,
304296 payment_hash : payment_hash. map ( |h| h. 0 . to_vec ( ) ) ,
305297 reason : reason. map ( |r| format ! ( "{:?}" , r) ) ,
306298 }
@@ -312,15 +304,15 @@ impl From<OrangeEvent> for Event {
312304 custom_records,
313305 lsp_fee_msats,
314306 } => Event :: PaymentReceived {
315- payment_id : Arc :: new ( payment_id. into ( ) ) ,
307+ payment_id : payment_id. into ( ) ,
316308 payment_hash : payment_hash. 0 . to_vec ( ) ,
317309 amount_msat,
318310 custom_records : custom_records. into_iter ( ) . map ( |r| r. value ) . collect ( ) ,
319311 lsp_fee_msats,
320312 } ,
321313 OrangeEvent :: OnchainPaymentReceived { payment_id, txid, amount_sat, status : _ } => {
322314 Event :: OnchainPaymentReceived {
323- payment_id : Arc :: new ( payment_id. into ( ) ) ,
315+ payment_id : payment_id. into ( ) ,
324316 txid : txid. to_byte_array ( ) . to_vec ( ) ,
325317 amount_sat,
326318 }
@@ -352,7 +344,7 @@ impl From<OrangeEvent> for Event {
352344 trusted_rebalance_payment_id,
353345 amount_msat,
354346 } => Event :: RebalanceInitiated {
355- trigger_payment_id : Arc :: new ( trigger_payment_id. into ( ) ) ,
347+ trigger_payment_id : trigger_payment_id. into ( ) ,
356348 trusted_rebalance_payment_id : trusted_rebalance_payment_id. to_vec ( ) ,
357349 amount_msat,
358350 } ,
@@ -363,7 +355,7 @@ impl From<OrangeEvent> for Event {
363355 amount_msat,
364356 fee_msat,
365357 } => Event :: RebalanceSuccessful {
366- trigger_payment_id : Arc :: new ( trigger_payment_id. into ( ) ) ,
358+ trigger_payment_id : trigger_payment_id. into ( ) ,
367359 trusted_rebalance_payment_id : trusted_rebalance_payment_id. to_vec ( ) ,
368360 ln_rebalance_payment_id : ln_rebalance_payment_id. to_vec ( ) ,
369361 amount_msat,
0 commit comments