Skip to content

Instantly share code, notes, and snippets.

View pavanjoshi914's full-sized avatar
🚩

Pavan Joshi pavanjoshi914

🚩
View GitHub Profile

Proposal: Adding contentMetadata and contentMetadataUri Fields in PayerData for Lud-18

Abstract

The current PayerData record of LUD-18 only includes fields such as PayerId, PayerName, PayerEmail, and PayerAddress. However, there is no provision for including metadata about the content for which the payment is made. This lack of provision for content metadata can lead to a lack of clarity regarding the content being paid for. To address this issue, we propose to add two fields to the PayerData record, namely contentMetadata and contentMetadataUri.

By including the contentMetadata and contentMetadataUri fields in the PayerData record of LUD-18, LNURL-supported wallets can display information about the content being paid for to their users. This information can include details such as the content type, title, author, and any other relevant information. This can help users make informed decisions about the content they are payi

@pavanjoshi914
pavanjoshi914 / video_script.md
Last active September 21, 2022 13:57
video script

Introduction - introduction + prototype1 explain

visual: Initial Banner

voiceover: The Lightning Network improved the scalability of the Bitcoin blockchain, sped up transaction processing, and reduced associated expenses. Here is a demonstration of making a lightning transaction to purchase a music using the Alby wallet on the Lightning Network, which can handle a million transactions per second.

visual: many transactions are done by the user......

visual: user revisits and contains list of transactions...

// after actions on client side
webln.sendPayment(invoice, metadata)
.then(function (r) {
// Required constraint to protect metadata as a rule while paying empty invoices
if (r != undefined) {
// Provide metadata after successful payment
// Eg. Allow users to download a song after payment is successful
}
})
// querying a single field having information about type of metadata
const metadataType = await db.metadata.get('type')
.where("host")
.equalsIgnoreCase(current_running_host)
.first();
console.log(metadataType);
// fetching metadata json ojbect stored in the column named metadataObject
const metadata = await db.metadata.get('metadataObject')
.where("host")
.equalsIgnoreCase(current_running_host)
.first();
for (const [key, value] of Object.entries(metadata)) {
if (key == "type") {
if (value == "AudioObject") {
// do something
// subscribe to the event
PubSub.subscribe("ln.sendPayment.success", persistMetadata);
// event definition
import db from "../db";
const persistMetadata = async (_message, data) => {
const host = data.origin.host;
import Dexie from "dexie";
import "fake-indexeddb/auto";
import browser from "webextension-polyfill";
import type { Allowance, Payment, Blocklist, Metadata } from "~/types";
class DB extends Dexie {
metadata: Dexie.Table<Metadata, number>
constructor() {
import PubSub from "pubsub-js";
import { updateAllowance } from "./allowances";
import {
paymentSuccessNotification,
paymentFailedNotification,
lnurlAuthSuccessNotification,
lnurlAuthFailedNotification,
} from "./notifications";
import { persistSuccessfullPayment } from "./persistPayments";
publishPaymentNotification: (
message: Message,
data: PaymentNotificationData
) => {
let status = "success"; // default. let's hope for success
if ("error" in data.response) {
status = "failed";
}
PubSub.publish(`ln.sendPayment.${status}`, {
response: data.response,
import { MetadataRenderer } from "~/schema/MetadataRenderer";
import { MetadataValidator } from "~/schema/metadataValidator";
type Props = {
amount: string | React.ReactNode;
amountAlt?: string;
description?: string | React.ReactNode;
metadata?: string;
};