This commit is contained in:
boufni95 2026-01-08 18:53:15 +00:00
parent cb755c9c01
commit e9a8865192
3 changed files with 8 additions and 0 deletions

View file

@ -333,6 +333,7 @@ export class ReverseSwaps {
]);
const tweakedKey = TaprootUtils.tweakMusig(
musig,
// swap tree can either be a string or an object
SwapTreeSerializer.deserializeSwapTree(createdResponse.swapTree).tree,
);

View file

@ -633,6 +633,7 @@ export default class {
preimage: Buffer.from(txSwap.preimage, 'hex'),
}
}
// the swap and the invoice payment are linked, swap will not start until the invoice payment is started, and will not complete once the invoice payment is completed
let swapResult = { ok: false, error: "swap never completed" } as { ok: true, txId: string } | { ok: false, error: string }
this.swaps.reverseSwaps.SubscribeToTransactionSwap(data, result => {
swapResult = result

View file

@ -256,9 +256,12 @@ export class NostrPool {
const processApps = (settings: NostrSettings) => {
const apps: Record<string, AppInfo> = {}
let providerInfo: (LinkedProviderInfo & { appPub: string }) | undefined = undefined
for (const app of settings.apps) {
apps[app.publicKey] = app
// add provider info if the app has a provider
if (app.provider) {
// make sure only one provider is configured
if (providerInfo) {
throw new Error("found more than one provider")
}
@ -269,10 +272,12 @@ const processApps = (settings: NostrSettings) => {
const rSettings: RelaySettings[] = []
new Set(settings.relays).forEach(r => {
const filters = [getServiceFilter(apps)]
// check if this service relay is also a provider relay, and add the beacon filter if so
if (providerInfo && providerInfo.relayUrl === r) {
providerAssigned = true
filters.push(getBeaconFilter(providerInfo.pubkey))
}
// add the relay settings to the list
rSettings.push({
relayUrl: r,
serviceRelay: true,
@ -280,6 +285,7 @@ const processApps = (settings: NostrSettings) => {
filters: filters,
})
})
// if no provider was assigned to a service relay, add the provider relay settings with a provider filter
if (!providerAssigned && providerInfo) {
rSettings.push({
relayUrl: providerInfo.relayUrl,