WIP Allow users to zap photos

Working, basic implementation of zaps for photos. No fetching or
rendering of receipts yet.
This commit is contained in:
2026-08-20 10:34:10 -06:00
parent 09aefa6e19
commit 644d6a2856
9 changed files with 1401 additions and 1 deletions
+66
View File
@@ -100,10 +100,76 @@ export class MockNostrRelayService extends Service {
}
}
export class MockNostrZapService extends Service {
@tracked _lightningAddress = 'user@example.com';
@tracked _endpoint = {
callback: 'https://example.com/callback',
minSendable: 1000,
maxSendable: 100_000_000,
allowsNostr: true,
nostrPubkey: 'c'.repeat(64),
};
@tracked _webLNAvailable = false;
@tracked _zapResult = {
invoice: 'lnbc1u1pjtestinvoice1234567890',
zapRequest: { id: 'zap-req-1' },
};
@tracked _parsedInvoice = {
amount: 1_000_000,
expiry: 9_999_999_999,
description: 'test zap',
};
@tracked recipientRelays = null;
getLightningAddress() {
return this._lightningAddress;
}
async resolveLnurl() {
if (!this._endpoint.allowsNostr) {
throw new Error('This lightning address does not support Nostr zaps');
}
return this._endpoint;
}
async loadRecipientRelays() {
this.recipientRelays = ['wss://relay.test'];
return this.recipientRelays;
}
getZapRelays() {
return (
this.recipientRelays || [
'wss://relay.damus.io',
'wss://nos.lol',
'wss://relay.primal.net',
]
);
}
hasWebLN() {
return this._webLNAvailable;
}
async zap() {
return this._zapResult;
}
parseInvoice() {
return this._parsedInvoice;
}
async payWithWebln() {
return {};
}
}
export function setupNostrMocks(hooks) {
hooks.beforeEach(function () {
this.owner.register('service:nostrAuth', MockNostrAuthService);
this.owner.register('service:nostrData', MockNostrDataService);
this.owner.register('service:nostrRelay', MockNostrRelayService);
this.owner.register('service:nostrZap', MockNostrZapService);
});
}