Skip to content

Commit 54047cb

Browse files
committed
Fix CI
1 parent 6b7155f commit 54047cb

File tree

8 files changed

+64
-55
lines changed

8 files changed

+64
-55
lines changed

crates/breez-sdk/core/src/sdk.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,8 +1762,8 @@ impl BreezSdk {
17621762
let pools_response = self
17631763
.flashnet_client
17641764
.list_pools(ListPoolsRequest {
1765-
asset_a_address: Some(asset_in_address.to_string()),
1766-
asset_b_address: Some(asset_out_address.to_string()),
1765+
asset_a_address: Some(asset_in_address.clone()),
1766+
asset_b_address: Some(asset_out_address.clone()),
17671767
sort: Some(PoolSortOrder::Volume24hDesc),
17681768
..Default::default()
17691769
})
@@ -1776,8 +1776,8 @@ impl BreezSdk {
17761776
let response = self
17771777
.flashnet_client
17781778
.simulate_swap(SimulateSwapRequest {
1779-
asset_in_address: asset_in_address.to_string(),
1780-
asset_out_address: asset_out_address.to_string(),
1779+
asset_in_address: asset_in_address.clone(),
1780+
asset_out_address: asset_out_address.clone(),
17811781
pool_id,
17821782
amount_in: request.amount,
17831783
integrator_bps: None,
@@ -1822,8 +1822,8 @@ impl BreezSdk {
18221822
let pools_response = self
18231823
.flashnet_client
18241824
.list_pools(ListPoolsRequest {
1825-
asset_a_address: Some(asset_in_address.to_string()),
1826-
asset_b_address: Some(asset_out_address.to_string()),
1825+
asset_a_address: Some(asset_in_address.clone()),
1826+
asset_b_address: Some(asset_out_address.clone()),
18271827
sort: Some(PoolSortOrder::Volume24hDesc),
18281828
..Default::default()
18291829
})
@@ -1848,8 +1848,8 @@ impl BreezSdk {
18481848
let swap_response_res = self
18491849
.flashnet_client
18501850
.execute_swap(ExecuteSwapRequest {
1851-
asset_in_address: asset_in_address.to_string(),
1852-
asset_out_address: asset_out_address.to_string(),
1851+
asset_in_address: asset_in_address.clone(),
1852+
asset_out_address: asset_out_address.clone(),
18531853
pool_id,
18541854
amount_in: request.prepare_response.send_amount,
18551855
max_slippage_bps,

crates/breez-sdk/wasm/js/web-storage/index.js

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -420,12 +420,6 @@ class IndexedDBStorage {
420420

421421
const payment = cursor.value;
422422

423-
// Apply filters
424-
if (!this._matchesFilters(payment, request)) {
425-
cursor.continue();
426-
return;
427-
}
428-
429423
if (skipped < actualOffset) {
430424
skipped++;
431425
cursor.continue();
@@ -440,6 +434,12 @@ class IndexedDBStorage {
440434
payment,
441435
metadata
442436
);
437+
438+
// Apply filters
439+
if (!this._matchesFilters(paymentWithMetadata, request)) {
440+
cursor.continue();
441+
return;
442+
}
443443

444444
// Fetch lnurl receive metadata if it's a lightning payment
445445
this._fetchLnurlReceiveMetadata(paymentWithMetadata, lnurlReceiveMetadataStore)
@@ -457,8 +457,11 @@ class IndexedDBStorage {
457457
};
458458
metadataRequest.onerror = () => {
459459
// Continue without metadata if it fails
460-
payments.push(payment);
461-
count++;
460+
if (this._matchesFilters(payment, request)) {
461+
payments.push(payment);
462+
count++;
463+
}
464+
462465
cursor.continue();
463466
};
464467
};
@@ -1586,42 +1589,44 @@ class IndexedDBStorage {
15861589
}
15871590
}
15881591

1589-
// If this is a Lightning payment and we have metadata
1590-
if (metadata && details && details.type == "lightning") {
1591-
if (metadata.lnurlDescription && !details.description) {
1592-
details.description = metadata.lnurlDescription;
1593-
}
1594-
// If lnurlPayInfo exists, parse and add to details
1595-
if (metadata.lnurlPayInfo) {
1596-
try {
1597-
details.lnurlPayInfo = JSON.parse(metadata.lnurlPayInfo);
1598-
} catch (e) {
1599-
throw new StorageError(
1600-
`Failed to parse lnurlPayInfo JSON for payment ${payment.id}: ${e.message}`,
1601-
e
1602-
);
1592+
if (metadata && details) {
1593+
if (details.type == "lightning") {
1594+
if (metadata.lnurlDescription && !details.description) {
1595+
details.description = metadata.lnurlDescription;
16031596
}
1604-
}
1605-
// If lnurlWithdrawInfo exists, parse and add to details
1606-
if (metadata.lnurlWithdrawInfo) {
1607-
try {
1608-
details.lnurlWithdrawInfo = JSON.parse(metadata.lnurlWithdrawInfo);
1609-
} catch (e) {
1610-
throw new StorageError(
1611-
`Failed to parse lnurlWithdrawInfo JSON for payment ${payment.id}: ${e.message}`,
1612-
e
1613-
);
1597+
// If lnurlPayInfo exists, parse and add to details
1598+
if (metadata.lnurlPayInfo) {
1599+
try {
1600+
details.lnurlPayInfo = JSON.parse(metadata.lnurlPayInfo);
1601+
} catch (e) {
1602+
throw new StorageError(
1603+
`Failed to parse lnurlPayInfo JSON for payment ${payment.id}: ${e.message}`,
1604+
e
1605+
);
1606+
}
16141607
}
1615-
}
1616-
// If transferRefundInfo exists, parse and add to details
1617-
if (metadata.transferRefundInfo) {
1618-
try {
1619-
details.transferRefundInfo = JSON.parse(metadata.transferRefundInfo);
1620-
} catch (e) {
1621-
throw new StorageError(
1622-
`Failed to parse transferRefundInfo JSON for payment ${payment.id}: ${e.message}`,
1623-
e
1624-
);
1608+
// If lnurlWithdrawInfo exists, parse and add to details
1609+
if (metadata.lnurlWithdrawInfo) {
1610+
try {
1611+
details.lnurlWithdrawInfo = JSON.parse(metadata.lnurlWithdrawInfo);
1612+
} catch (e) {
1613+
throw new StorageError(
1614+
`Failed to parse lnurlWithdrawInfo JSON for payment ${payment.id}: ${e.message}`,
1615+
e
1616+
);
1617+
}
1618+
}
1619+
} else if (details.type == "spark" || details.type == "token") {
1620+
// If transferRefundInfo exists, parse and add to details
1621+
if (metadata.transferRefundInfo) {
1622+
try {
1623+
details.transferRefundInfo = JSON.parse(metadata.transferRefundInfo);
1624+
} catch (e) {
1625+
throw new StorageError(
1626+
`Failed to parse transferRefundInfo JSON for payment ${payment.id}: ${e.message}`,
1627+
e
1628+
);
1629+
}
16251630
}
16261631
}
16271632
}

docs/breez-sdk/snippets/csharp/Htlcs.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ async Task ListClaimableHtlcPayments(BreezSdk sdk)
5656
htlcStatus: new List<SparkHtlcStatus> {
5757
SparkHtlcStatus.WaitingForPreimage
5858
},
59+
transferRefundNeeded: null
5960
)
6061
);
6162

docs/breez-sdk/snippets/go/htlcs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func ListClaimableHtlcPayments(sdk *breez_sdk_spark.BreezSdk) (*[]breez_sdk_spar
7171
statusFilter := []breez_sdk_spark.PaymentStatus{
7272
breez_sdk_spark.PaymentStatusPending,
7373
}
74-
paymentDetailsFilter := breez_sdk_spark.PaymentDetailsFilterSpark{
74+
var paymentDetailsFilter breez_sdk_spark.PaymentDetailsFilter = breez_sdk_spark.PaymentDetailsFilterSpark{
7575
HtlcStatus: &[]breez_sdk_spark.SparkHtlcStatus{
7676
breez_sdk_spark.SparkHtlcStatusWaitingForPreimage,
7777
},

docs/breez-sdk/snippets/kotlin_mpp_lib/shared/src/commonMain/kotlin/com/example/kotlinmpplib/Htlcs.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ class Htlcs {
5959
typeFilter = listOf(PaymentType.RECEIVE),
6060
statusFilter = listOf(PaymentStatus.PENDING),
6161
paymentDetailsFilter = PaymentDetailsFilter.Spark(
62-
htlcStatus = listOf(SparkHtlcStatus.WAITING_FOR_PREIMAGE)
62+
htlcStatus = listOf(SparkHtlcStatus.WAITING_FOR_PREIMAGE),
63+
transferRefundNeeded = null
6364
)
6465
)
6566

docs/breez-sdk/snippets/python/src/htlcs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ async def list_claimable_htlc_payments(sdk: BreezSdk):
5757
type_filter=[PaymentType.RECEIVE],
5858
status_filter=[PaymentStatus.PENDING],
5959
payment_details_filter=PaymentDetailsFilter.SPARK(
60-
htlc_status=[SparkHtlcStatus.WAITING_FOR_PREIMAGE]
60+
htlc_status=[SparkHtlcStatus.WAITING_FOR_PREIMAGE],
61+
transfer_refund_needed=None
6162
),
6263
)
6364

docs/breez-sdk/snippets/react-native/list_payments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const exampleListPaymentsFiltered = async (sdk: BreezSdk): Promise<Payment[]> =>
5151
offset: 0,
5252
limit: 50,
5353
// Sort order (true = oldest first, false = newest first)
54-
sortAscending: false,
54+
sortAscending: false
5555
})
5656
const payments = response.payments
5757
// ANCHOR_END: list-payments-filtered

docs/breez-sdk/snippets/swift/BreezSdkSnippets/Sources/Htlcs.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ func listClaimableHtlcPayments(sdk: BreezSdk) async throws -> [Payment] {
6767
typeFilter: [PaymentType.receive],
6868
statusFilter: [PaymentStatus.pending],
6969
paymentDetailsFilter: PaymentDetailsFilter.spark(
70-
htlcStatus: [SparkHtlcStatus.waitingForPreimage]
70+
htlcStatus: [SparkHtlcStatus.waitingForPreimage],
71+
transferRefundNeeded: nil
7172
)
7273
)
7374

0 commit comments

Comments
 (0)