From 003d3ae48a14ee5f5b09197045607f0336fca2ef Mon Sep 17 00:00:00 2001 From: Ditto Date: Thu, 27 Aug 2026 14:20:42 +0200 Subject: [PATCH 1/2] chore(deps): update @agicash/breez-sdk-spark to 0.23.0-1 Move the dep to the root workspaces.catalog (shared by wallet-sdk and web-wallet) and adapt to the breaking API changes: - defaultExternalSigner -> defaultExternalSigners; identity key now comes from the async sparkSigner.getIdentityPublicKey(), so getSparkIdentityPublicKeyFromMnemonic is now async - Config.optimizationConfig -> Config.leafOptimizationConfig - prepareSendPayment paymentRequest is now a tagged union; wrap the bolt11 string as { type: 'input', input } - receive bolt11Invoice field receiverIdentityPubkey -> receiverIdentityPublicKey Co-Authored-By: Claude Fable 5 --- apps/web-wallet/package.json | 2 +- bun.lock | 7 ++++--- package.json | 1 + .../domain/receive/spark-receive-quote-core.ts | 2 +- .../domain/send/spark-send-quote-service.ts | 4 ++-- packages/wallet-sdk/lib/spark/wallet.ts | 12 ++++++------ packages/wallet-sdk/package.json | 2 +- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/apps/web-wallet/package.json b/apps/web-wallet/package.json index b9aba0625..ec049432d 100644 --- a/apps/web-wallet/package.json +++ b/apps/web-wallet/package.json @@ -19,7 +19,7 @@ "dependencies": { "@agicash/bc-ur": "0.1.0", "@agicash/bolt11": "workspace:*", - "@agicash/breez-sdk-spark": "0.13.5-1", + "@agicash/breez-sdk-spark": "catalog:", "@agicash/cashu": "workspace:*", "@agicash/ecies": "workspace:*", "@agicash/lnurl": "workspace:*", diff --git a/bun.lock b/bun.lock index d6b8f0a61..99a76226e 100644 --- a/bun.lock +++ b/bun.lock @@ -16,7 +16,7 @@ "dependencies": { "@agicash/bc-ur": "0.1.0", "@agicash/bolt11": "workspace:*", - "@agicash/breez-sdk-spark": "0.13.5-1", + "@agicash/breez-sdk-spark": "catalog:", "@agicash/cashu": "workspace:*", "@agicash/ecies": "workspace:*", "@agicash/lnurl": "workspace:*", @@ -194,7 +194,7 @@ "name": "@agicash/wallet-sdk", "dependencies": { "@agicash/bolt11": "workspace:*", - "@agicash/breez-sdk-spark": "0.13.5-1", + "@agicash/breez-sdk-spark": "catalog:", "@agicash/cashu": "workspace:*", "@agicash/ecies": "workspace:*", "@agicash/lnurl": "workspace:*", @@ -226,6 +226,7 @@ "@sentry/core@10.42.0": "patches/@sentry%2Fcore@10.42.0.patch", }, "catalog": { + "@agicash/breez-sdk-spark": "0.23.0-1", "@agicash/opensecret": "1.0.0-rc.0", "@cashu/cashu-ts": "3.6.1", "@noble/ciphers": "1.3.0", @@ -250,7 +251,7 @@ "@agicash/bolt11": ["@agicash/bolt11@workspace:packages/bolt11"], - "@agicash/breez-sdk-spark": ["@agicash/breez-sdk-spark@0.13.5-1", "", { "optionalDependencies": { "better-sqlite3": "^12.2.0", "pg": "^8.18.0" } }, "sha512-Sa8Re7nnT3U2sxxJ77FB1aYcsGSi1yJpBB9mOtE4/F5/WX9+De4eXr6zH/LgMphwrq/Gany3OEmJrvoAaIMqLA=="], + "@agicash/breez-sdk-spark": ["@agicash/breez-sdk-spark@0.23.0-1", "", { "optionalDependencies": { "better-sqlite3": "^12.2.0", "pg": "^8.18.0" } }, "sha512-vCX0daoeVaHmDafLhZKWKK07tlRx+SwWyDdGy/7sSZ8fGuX7IH9W12htYRW3J+DM3UCfDELyPm8sOWr+pXNSZQ=="], "@agicash/cashu": ["@agicash/cashu@workspace:packages/cashu"], diff --git a/package.json b/package.json index 47b6ca783..a4afc7ce4 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "workspaces": { "packages": ["apps/*", "packages/*"], "catalog": { + "@agicash/breez-sdk-spark": "0.23.0-1", "@agicash/opensecret": "1.0.0-rc.0", "@cashu/cashu-ts": "3.6.1", "@noble/ciphers": "1.3.0", diff --git a/packages/wallet-sdk/domain/receive/spark-receive-quote-core.ts b/packages/wallet-sdk/domain/receive/spark-receive-quote-core.ts index ac8ba8439..a6a24f7d0 100644 --- a/packages/wallet-sdk/domain/receive/spark-receive-quote-core.ts +++ b/packages/wallet-sdk/domain/receive/spark-receive-quote-core.ts @@ -239,7 +239,7 @@ export async function getLightningQuote({ type: 'bolt11Invoice', description: description ?? '', amountSats: amount.toNumber('sat'), - receiverIdentityPubkey, + receiverIdentityPublicKey: receiverIdentityPubkey, descriptionHash, }, }); diff --git a/packages/wallet-sdk/domain/send/spark-send-quote-service.ts b/packages/wallet-sdk/domain/send/spark-send-quote-service.ts index 149cbfd12..7fa59251b 100644 --- a/packages/wallet-sdk/domain/send/spark-send-quote-service.ts +++ b/packages/wallet-sdk/domain/send/spark-send-quote-service.ts @@ -145,7 +145,7 @@ export class SparkSendQuoteService { } const prepareResponse = await account.wallet.prepareSendPayment({ - paymentRequest, + paymentRequest: { type: 'input', input: paymentRequest }, amount: BigInt(amountRequestedInBtc.toNumber('sat')), }); @@ -256,7 +256,7 @@ export class SparkSendQuoteService { } const prepareResponse = await account.wallet.prepareSendPayment({ - paymentRequest: sendQuote.paymentRequest, + paymentRequest: { type: 'input', input: sendQuote.paymentRequest }, amount: BigInt(sendQuote.amount.toNumber('sat')), }); diff --git a/packages/wallet-sdk/lib/spark/wallet.ts b/packages/wallet-sdk/lib/spark/wallet.ts index 060245730..e5a2ba453 100644 --- a/packages/wallet-sdk/lib/spark/wallet.ts +++ b/packages/wallet-sdk/lib/spark/wallet.ts @@ -2,7 +2,7 @@ import { type BreezSdk, connect, defaultConfig, - defaultExternalSigner, + defaultExternalSigners, initLogging, } from '@agicash/breez-sdk-spark'; import { Money } from '@agicash/money'; @@ -27,12 +27,12 @@ export type SparkWalletConfig = { * @param network - The Breez SDK network ('mainnet' or 'regtest'). * @returns Hex-encoded compressed public key. */ -export function getSparkIdentityPublicKeyFromMnemonic( +export async function getSparkIdentityPublicKeyFromMnemonic( mnemonic: string, network: 'mainnet' | 'regtest', -): string { - const signer = defaultExternalSigner(mnemonic, null, network); - const publicKey = signer.identityPublicKey(); +): Promise { + const signers = defaultExternalSigners(mnemonic, null, network); + const publicKey = await signers.sparkSigner.getIdentityPublicKey(); return bytesToHex(new Uint8Array(publicKey.bytes)); } @@ -128,7 +128,7 @@ export function getSparkWallet({ apiKey, lnurlDomain: undefined, // Disables Breez's built-in lightning address recovery — we use our own ln address system privateEnabledDefault: true, - optimizationConfig: { + leafOptimizationConfig: { autoEnabled: true, multiplicity: 2, }, diff --git a/packages/wallet-sdk/package.json b/packages/wallet-sdk/package.json index 7c6e3736c..6f3469a21 100644 --- a/packages/wallet-sdk/package.json +++ b/packages/wallet-sdk/package.json @@ -20,7 +20,7 @@ }, "dependencies": { "@agicash/bolt11": "workspace:*", - "@agicash/breez-sdk-spark": "0.13.5-1", + "@agicash/breez-sdk-spark": "catalog:", "@agicash/cashu": "workspace:*", "@agicash/ecies": "workspace:*", "@agicash/lnurl": "workspace:*", From 64d6878de3b11e728ece01613fc6b4aea8130409 Mon Sep 17 00:00:00 2001 From: Ditto Date: Thu, 27 Aug 2026 14:28:39 +0200 Subject: [PATCH 2/2] refactor(wallet-sdk): rename getLightningQuote param to receiverIdentityPublicKey Match the Breez SDK field name so the call sites use shorthand instead of a rename mapping. The quote entity and repositories keep receiverIdentityPubkey, which traces to the receiver_identity_pubkey DB column. Co-Authored-By: Claude Fable 5 --- .../domain/receive/lightning-address-service.ts | 2 +- .../wallet-sdk/domain/receive/spark-receive-quote-core.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/wallet-sdk/domain/receive/lightning-address-service.ts b/packages/wallet-sdk/domain/receive/lightning-address-service.ts index b152cb565..72781e773 100644 --- a/packages/wallet-sdk/domain/receive/lightning-address-service.ts +++ b/packages/wallet-sdk/domain/receive/lightning-address-service.ts @@ -231,7 +231,7 @@ export class LightningAddressService { const lightningQuote = await sparkReceiveQuoteService.getLightningQuote({ wallet: account.wallet, amount: amountToReceive, - receiverIdentityPubkey: user.sparkIdentityPublicKey, + receiverIdentityPublicKey: user.sparkIdentityPublicKey, descriptionHash, }); diff --git a/packages/wallet-sdk/domain/receive/spark-receive-quote-core.ts b/packages/wallet-sdk/domain/receive/spark-receive-quote-core.ts index a6a24f7d0..e648af7fb 100644 --- a/packages/wallet-sdk/domain/receive/spark-receive-quote-core.ts +++ b/packages/wallet-sdk/domain/receive/spark-receive-quote-core.ts @@ -47,7 +47,7 @@ export type GetLightningQuoteParams = { * If provided, the incoming payment can only be claimed by the Spark wallet that controls the specified public key. * If not provided, the invoice will be created for the user that owns the Spark wallet. */ - receiverIdentityPubkey?: string; + receiverIdentityPublicKey?: string; /** * The description of the receive request (BOLT11 `d` tag). */ @@ -230,7 +230,7 @@ export type RepositoryCreateQuoteParams = { export async function getLightningQuote({ wallet, amount, - receiverIdentityPubkey, + receiverIdentityPublicKey, description, descriptionHash, }: GetLightningQuoteParams): Promise { @@ -239,7 +239,7 @@ export async function getLightningQuote({ type: 'bolt11Invoice', description: description ?? '', amountSats: amount.toNumber('sat'), - receiverIdentityPublicKey: receiverIdentityPubkey, + receiverIdentityPublicKey, descriptionHash, }, }); @@ -274,7 +274,7 @@ export async function getLightningQuote({ memo: description, }, status, - receiverIdentityPublicKey: receiverIdentityPubkey, + receiverIdentityPublicKey, }; }