Skip to content

mysilio-co/swrlit-monetize

Repository files navigation

swrlit-monetize

swirl some coin in your cup

what's this?

swrlit-monetize combines the power of useSWR with magic of Inrupt's lit-podsolid-client and the revolutionary potential of Web Monetization to make it easy to monetize your React apps.

This library provides a single React hook that will pull your Interledger Payment Pointer from your Solid WebID Profile. To configure your payment pointer you can use Understory Garden or a number of other Solid applications.

how do I use it?

see the examples below

install in an existing project

npm install swrlit-monetize

examples

monetize a page in a Next.js app

Assuming you have configured your Solid Pod Profile with a Payment Pointer you can use the usePaymentPointer hook to create a meta tag that will monetize your page:

import { usePaymentPointer } from "swrlit-monetize"
import Head from 'next/head'

export default function Page({}){
  const webId = "https://travis.myunderstory.com/profile/card#me"
  const paymentPointer = usePaymentPointer(webId)

  return (
    <>
      <Head>
        <meta name="monetization" content={paymentPointer} />
      </Head>
      <p>this page is monetized for {paymentPointer}</p>
    </>
  )
}

About

swril some coin in your cup

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published