comments
This commit is contained in:
parent
cb755c9c01
commit
e9a8865192
3 changed files with 8 additions and 0 deletions
|
|
@ -333,6 +333,7 @@ export class ReverseSwaps {
|
||||||
]);
|
]);
|
||||||
const tweakedKey = TaprootUtils.tweakMusig(
|
const tweakedKey = TaprootUtils.tweakMusig(
|
||||||
musig,
|
musig,
|
||||||
|
// swap tree can either be a string or an object
|
||||||
SwapTreeSerializer.deserializeSwapTree(createdResponse.swapTree).tree,
|
SwapTreeSerializer.deserializeSwapTree(createdResponse.swapTree).tree,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -633,6 +633,7 @@ export default class {
|
||||||
preimage: Buffer.from(txSwap.preimage, 'hex'),
|
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 }
|
let swapResult = { ok: false, error: "swap never completed" } as { ok: true, txId: string } | { ok: false, error: string }
|
||||||
this.swaps.reverseSwaps.SubscribeToTransactionSwap(data, result => {
|
this.swaps.reverseSwaps.SubscribeToTransactionSwap(data, result => {
|
||||||
swapResult = result
|
swapResult = result
|
||||||
|
|
|
||||||
|
|
@ -256,9 +256,12 @@ export class NostrPool {
|
||||||
const processApps = (settings: NostrSettings) => {
|
const processApps = (settings: NostrSettings) => {
|
||||||
const apps: Record<string, AppInfo> = {}
|
const apps: Record<string, AppInfo> = {}
|
||||||
let providerInfo: (LinkedProviderInfo & { appPub: string }) | undefined = undefined
|
let providerInfo: (LinkedProviderInfo & { appPub: string }) | undefined = undefined
|
||||||
|
|
||||||
for (const app of settings.apps) {
|
for (const app of settings.apps) {
|
||||||
apps[app.publicKey] = app
|
apps[app.publicKey] = app
|
||||||
|
// add provider info if the app has a provider
|
||||||
if (app.provider) {
|
if (app.provider) {
|
||||||
|
// make sure only one provider is configured
|
||||||
if (providerInfo) {
|
if (providerInfo) {
|
||||||
throw new Error("found more than one provider")
|
throw new Error("found more than one provider")
|
||||||
}
|
}
|
||||||
|
|
@ -269,10 +272,12 @@ const processApps = (settings: NostrSettings) => {
|
||||||
const rSettings: RelaySettings[] = []
|
const rSettings: RelaySettings[] = []
|
||||||
new Set(settings.relays).forEach(r => {
|
new Set(settings.relays).forEach(r => {
|
||||||
const filters = [getServiceFilter(apps)]
|
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) {
|
if (providerInfo && providerInfo.relayUrl === r) {
|
||||||
providerAssigned = true
|
providerAssigned = true
|
||||||
filters.push(getBeaconFilter(providerInfo.pubkey))
|
filters.push(getBeaconFilter(providerInfo.pubkey))
|
||||||
}
|
}
|
||||||
|
// add the relay settings to the list
|
||||||
rSettings.push({
|
rSettings.push({
|
||||||
relayUrl: r,
|
relayUrl: r,
|
||||||
serviceRelay: true,
|
serviceRelay: true,
|
||||||
|
|
@ -280,6 +285,7 @@ const processApps = (settings: NostrSettings) => {
|
||||||
filters: filters,
|
filters: filters,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
// if no provider was assigned to a service relay, add the provider relay settings with a provider filter
|
||||||
if (!providerAssigned && providerInfo) {
|
if (!providerAssigned && providerInfo) {
|
||||||
rSettings.push({
|
rSettings.push({
|
||||||
relayUrl: providerInfo.relayUrl,
|
relayUrl: providerInfo.relayUrl,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue