Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CI/IntegrationTests/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CI/IntegrationTests/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let package = Package(
name: "CashuWalletIntegrationTests",
platforms: [.macOS(.v13)],
dependencies: [
.package(url: "https://github.com/cashubtc/cdk-swift", exact: "0.17.3-rc.0")
.package(url: "https://github.com/cashubtc/cdk-swift", branch: "v0.17.0-nightly.20260802.g795aec2")
],
targets: [
.testTarget(
Expand Down
2 changes: 1 addition & 1 deletion CI/IntegrationTests/Tests/NutshellIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class MintIntegrationTestSuite: IntegrationTestBase {
}

func runGetMintKeysets() async throws {
let keysets = try await wallet.getMintKeysets(filter: .active)
let keysets = try await wallet.keysets(policy: nil).filter { $0.active == true }
XCTAssertFalse(keysets.isEmpty, "\(mintName) mint should have at least one active keyset")
for keyset in keysets {
XCTAssertEqual(keyset.unit, .sat, "Keyset unit should be sat")
Expand Down
56 changes: 24 additions & 32 deletions ios/CashuWallet.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions ios/CashuWallet/Core/Services/LightningService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,7 @@ class LightningService: ObservableObject {
mintUrl: quote.mintUrl,
amountIssued: quote.amountIssued,
amountPaid: quote.amountPaid,
updatedAt: quote.updatedAt,
estimatedBlocks: quote.estimatedBlocks,
paymentMethod: quote.paymentMethod,
secretKey: quote.secretKey,
Expand Down Expand Up @@ -1166,6 +1167,7 @@ class LightningService: ObservableObject {
mintUrl: quote.mintUrl,
amountIssued: quote.amountIssued,
amountPaid: quote.amountPaid,
updatedAt: quote.updatedAt,
estimatedBlocks: quote.estimatedBlocks,
paymentMethod: quote.paymentMethod,
secretKey: quote.secretKey,
Expand Down Expand Up @@ -1197,6 +1199,7 @@ class LightningService: ObservableObject {
mintUrl: quote.mintUrl,
amountIssued: quote.amountIssued,
amountPaid: quote.amountPaid,
updatedAt: quote.updatedAt,
estimatedBlocks: quote.estimatedBlocks ?? existingQuote.estimatedBlocks,
paymentMethod: paymentMethod,
secretKey: quote.secretKey ?? existingQuote.secretKey,
Expand Down
16 changes: 11 additions & 5 deletions ios/CashuWallet/Core/Services/TokenService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,16 @@ class TokenService: ObservableObject {

/// Decode token string without redeeming
func decodeToken(tokenString: String) throws -> Token {
return try Token.decode(encodedToken: tokenString)
return try Token.decode(encodedToken: tokenString)
}

private func mintKeysetInfos(for wallet: Wallet) async throws -> [KeySetInfo] {
try await wallet.keysets(policy: nil).map {
KeySetInfo(id: $0.id, unit: $0.unit, active: $0.active ?? false, inputFeePpk: $0.inputFeePpk)
}
}
/// Calculate the fee for receiving a token

/// Calculate the fee for receiving a token
func calculateReceiveFee(tokenString: String) async throws -> UInt64 {
guard let repo = walletRepository() else {
throw WalletError.notInitialized
Expand All @@ -264,7 +270,7 @@ class TokenService: ObservableObject {
// trap checkTokenSpendable documents for checkProofsSpent.
let proofs: [Proof]
do {
let keysets = try await wallet.getMintKeysets(filter: .all)
let keysets = try await mintKeysetInfos(for: wallet)
proofs = try token.proofs(mintKeysets: keysets)
} catch {
proofs = try token.proofsSimple()
Expand Down Expand Up @@ -317,7 +323,7 @@ class TokenService: ObservableObject {
let tokenUnit = tokenObj.unit() ?? .sat

let wallet = try await repo.getWallet(mintUrl: mintUrlObj, unit: tokenUnit)
let keysets = try await wallet.getMintKeysets(filter: .all)
let keysets = try await mintKeysetInfos(for: wallet)
let proofs = try tokenObj.proofs(mintKeysets: keysets)
let spentStates = try await wallet.checkProofsSpent(proofs: proofs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ extension WalletManager {
defaultFailureOutcome: .ambiguousFailure
) {
let wallet = try await walletRepository.getWallet(mintUrl: MintUrl(url: mintURL), unit: .sat)
let keysets = try await wallet.refreshKeysets()
let active = keysets.first(where: { $0.active }) ?? keysets.first
let keysets = try await wallet.keysets(policy: .refresh)
let active = keysets.first(where: { $0.active == true }) ?? keysets.first
return active?.inputFeePpk
}
} catch {
Expand Down
2 changes: 1 addition & 1 deletion ios/CashuWallet/Core/Wallet/WalletManager+Lifecycle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ extension WalletManager {
}

do {
let keysets = try await wallet.refreshKeysets()
let keysets = try await wallet.keysets(policy: .refresh)
AppLogger.wallet.info(
"refreshed keysets count=\(keysets.count, privacy: .public) resource=\(WalletOperationCoordinator.privacySafeIdentifier(mintUrl), privacy: .public)"
)
Expand Down
4 changes: 2 additions & 2 deletions ios/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ios/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/cashubtc/cdk-swift", exact: "0.17.3-rc.0")
.package(url: "https://github.com/cashubtc/cdk-swift", branch: "v0.17.0-nightly.20260802.g795aec2")
],
targets: [
.target(
Expand Down
Loading