@@ -10,6 +10,7 @@ use wasm_bindgen::prelude::*;
10
10
11
11
use crate :: error:: { into_err, Result } ;
12
12
use crate :: key:: { JsPublicKey , JsSecretKey } ;
13
+ use crate :: types:: time:: JsTimestamp ;
13
14
14
15
/// NIP47 Response Error codes
15
16
#[ wasm_bindgen( js_name = Nip47ErrorCode ) ]
@@ -327,9 +328,9 @@ impl From<JsLookupInvoiceRequestParams> for LookupInvoiceRequestParams {
327
328
#[ wasm_bindgen( js_name = ListTransactionsRequestParams ) ]
328
329
pub struct JsListTransactionsRequestParams {
329
330
/// Starting timestamp in seconds since epoch
330
- pub from : Option < u64 > ,
331
+ pub from : Option < JsTimestamp > ,
331
332
/// Ending timestamp in seconds since epoch
332
- pub until : Option < u64 > ,
333
+ pub until : Option < JsTimestamp > ,
333
334
/// Number of invoices to return
334
335
pub limit : Option < u64 > ,
335
336
/// Offset of the first invoice to return
@@ -343,8 +344,8 @@ pub struct JsListTransactionsRequestParams {
343
344
impl From < ListTransactionsRequestParams > for JsListTransactionsRequestParams {
344
345
fn from ( value : ListTransactionsRequestParams ) -> Self {
345
346
Self {
346
- from : value. from ,
347
- until : value. until ,
347
+ from : value. from . map ( |t| t . into ( ) ) ,
348
+ until : value. until . map ( |t| t . into ( ) ) ,
348
349
limit : value. limit ,
349
350
offset : value. offset ,
350
351
unpaid : value. unpaid ,
@@ -356,8 +357,8 @@ impl From<ListTransactionsRequestParams> for JsListTransactionsRequestParams {
356
357
impl From < JsListTransactionsRequestParams > for ListTransactionsRequestParams {
357
358
fn from ( value : JsListTransactionsRequestParams ) -> Self {
358
359
Self {
359
- from : value. from ,
360
- until : value. until ,
360
+ from : value. from . map ( |t| * t ) ,
361
+ until : value. until . map ( |t| * t ) ,
361
362
limit : value. limit ,
362
363
offset : value. offset ,
363
364
unpaid : value. unpaid ,
@@ -464,14 +465,14 @@ pub struct JsLookupInvoiceResponseResult {
464
465
/// Fees paid in millisatoshis
465
466
pub fees_paid : u64 ,
466
467
/// Creation timestamp in seconds since epoch
467
- pub created_at : u64 ,
468
+ pub created_at : JsTimestamp ,
468
469
/// Expiration timestamp in seconds since epoch
469
- pub expires_at : u64 ,
470
+ pub expires_at : JsTimestamp ,
470
471
/// Settled timestamp in seconds since epoch
471
- pub settled_at : Option < u64 > ,
472
- /// Optional metadata about the payment
473
- #[ wasm_bindgen( getter_with_clone) ]
474
- pub metadata : String ,
472
+ pub settled_at : Option < JsTimestamp > ,
473
+ // // / Optional metadata about the payment
474
+ // #[wasm_bindgen(getter_with_clone)]
475
+ // pub metadata: String, // TODO: this is not a string
475
476
}
476
477
477
478
impl From < LookupInvoiceResponseResult > for JsLookupInvoiceResponseResult {
@@ -485,10 +486,10 @@ impl From<LookupInvoiceResponseResult> for JsLookupInvoiceResponseResult {
485
486
payment_hash : value. payment_hash ,
486
487
amount : value. amount ,
487
488
fees_paid : value. fees_paid ,
488
- created_at : value. created_at ,
489
- expires_at : value. expires_at ,
490
- settled_at : value. settled_at ,
491
- metadata : value. metadata . to_string ( ) ,
489
+ created_at : value. created_at . into ( ) ,
490
+ expires_at : value. expires_at . into ( ) ,
491
+ settled_at : value. settled_at . map ( |t| t . into ( ) ) ,
492
+ // metadata: value.metadata.to_string(),
492
493
}
493
494
}
494
495
}
@@ -504,10 +505,10 @@ impl From<JsLookupInvoiceResponseResult> for LookupInvoiceResponseResult {
504
505
payment_hash : value. payment_hash ,
505
506
amount : value. amount ,
506
507
fees_paid : value. fees_paid ,
507
- created_at : value. created_at ,
508
- expires_at : value. expires_at ,
509
- settled_at : value. settled_at ,
510
- metadata : value . metadata . into ( ) ,
508
+ created_at : * value. created_at ,
509
+ expires_at : * value. expires_at ,
510
+ settled_at : value. settled_at . map ( |t| * t ) ,
511
+ metadata : None ,
511
512
}
512
513
}
513
514
}
0 commit comments