Skip to content

Instantly share code, notes, and snippets.

View pavanjoshi914's full-sized avatar
🚩

Pavan Joshi pavanjoshi914

🚩
View GitHub Profile
import { MetadataValidator } from './metadataValidator';
import AudioObject from '~/app/components/Metadata/AudioObject';
export function MetadataRenderer(metadata: string | undefined) {
if (metadata != undefined) {
const metadataObject: object = JSON.parse(metadata);
const isMetadataValid: boolean = MetadataValidator(metadataObject);
if (isMetadataValid) {
for (const [key, value] of Object.entries(metadataObject)) {
if (key == "type") {
import { z } from "zod";
export const audioObjectSchema = z.object({
type: z.string(),
name: z.string().optional(),
creator: z.string().optional(),
image: z.string().optional(),
});
import { audioObjectSchema } from "./audioObjectSchema";
export function isBase64(str: string) {
if (str === "" || str.trim() === "") {
return false;
}
try {
return btoa(atob(str)) == str;
} catch (err) {
return false;

🖼 ImageObject

Type ImageObject is a derived type from https://schema.org/ImageObject, which means that for this particular data model type, any of the properties also mentioned at schema.org, may also be used. However, to structure metadata supported properties mentioned shall be used only.

Properties

Required properties

| Property | Expected Type | Description |

🎙 AudioObject

Type AudioObject is a derived type from https://schema.org/ImageObject, which means that for this particular data model type, any of the properties also mentioned at schema.org, may also be used. However, to structure metadata supported properties mentioned shall be used only.

Properties

Required properties

| Property | Expected Schema Type | Description |

// custom type decleration of some of the arguments
type RequestInvoiceArgs = {
amount?: string | number;
defaultAmount?: string | number;
minimumAmount?: string | number;
maximumAmount?: string | number;
defaultMemo?: string;
};
// webln provider class provides webln functionality and its exported so that in any file we can create an instance of the class and use the functionality class is providing.
@pavanjoshi914
pavanjoshi914 / post.md
Last active July 13, 2022 23:54
Making Bitcoin Transactions Smart And Interactive With Structured Metadata 🚀

Cover (3)

~By Pavan Joshi - Summer of Bitcoin 2022

A New Future of Bitcoin Transactions Resulting into Numerous Usecases💰

Abstract ⚡

@pavanjoshi914
pavanjoshi914 / spec-proposal.md
Last active June 27, 2022 22:31
Spec-Proposal: Extend Webln SendPayment method to pass metadata as a optional parameter.

Abstract

Specifications such as Webln bought better solutions to the UX for lightning networks. On top of this, many broad applications such as instant payments via a web browser using Bitcoin Sats (eg. Alby), tippings for content writers, podcasts and streamers (Medium tipping via Alby) and many more came into working. Along with every transaction we can also store additional information in form of metadata which can make specification such as Webln more broad and applicative in terms of interactivity.

Transaction lists as we know them from our private bank accounts are often a simple list of transactions sorted by date. Each transaction has data like Sender, Receiver, amount, reason and date.

The aim of this proposal is to extend existing standards such as Webln to enrich transactions with additional information as structured metadata so that transactions containing static data contain more meaningful information giving more interactivity to the transactions.

webln.sendPayment method

@pavanjoshi914
pavanjoshi914 / structured_metadata_passing.md
Last active June 27, 2022 21:19
Mechanism to pass metadata from client to Alby

Mechanism::

client side

Extend sendPayment method with optional parameter metadata

sendPayment(paymentRequest: string, metadata?: string): Promise<SendPaymentResponse>;