swrlit-monetize
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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>
    </>
  )
}

Readme

Keywords

none

Package Sidebar

Install

npm i swrlit-monetize

Homepage

swrlit.me/

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

8.91 kB

Total Files

14

Last publish

Collaborators

  • tvachon