Skip to content

Commit

Permalink
docs: add wallet linking, deprecations
Browse files Browse the repository at this point in the history
- Add wallet linking documentation for RSS feeds, social web
- Update HTML wallet linking documentation to align with other formats
- Add dedicated deprecations page
- Remove deprecated MonetizationEvent properties from navigation
  • Loading branch information
jeremiahlee committed Dec 19, 2024
1 parent 32ca64a commit f624411
Show file tree
Hide file tree
Showing 5 changed files with 367 additions and 62 deletions.
87 changes: 37 additions & 50 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,78 +89,65 @@ export default defineConfig({
collapsed: true,
items: [
{
label: 'Web Monetization API',
label: 'Wallet linking',
items: [
{
label: 'HTML <link> rel=monetization',
label: 'Webpage (HTML)',
link: '/docs/references/html',
},
{
label: 'Monetization events',
collapsed: true,
items: [
{
label: 'MonetizationEvent',
link: '/docs/references/monetizationevent',
},
{
label: 'amountSent',
link: '/docs/references/attributes/amountsent',
},
{
label: 'incomingPayment',
link: '/docs/references/attributes/incomingpayment',
},
{
label: 'paymentPointer',
link: '/docs/references/attributes/paymentpointer',
},
{
label: 'amount',
link: '/docs/references/attributes/amount',
badge: { text: 'deprecated', variant: 'danger' },
},
{
label: 'assetCode',
link: '/docs/references/attributes/assetcode',
badge: { text: 'deprecated', variant: 'danger' },
},
{
label: 'assetScale',
link: '/docs/references/attributes/assetscale',
badge: { text: 'deprecated', variant: 'danger' },
},
{
label: 'receipt',
link: '/docs/references/attributes/receipt',
badge: { text: 'deprecated', variant: 'danger' },
},
],
label: 'Feed (RSS, Atom, JSON Feed)',
link: '/docs/references/rss-atom-jsonfeed',
},
{
label: 'Social (Activity Streams)',
link: '/docs/references/activitystreams',
}
],
},
{
label: 'HTTP headers',
label: 'Browser events',
collapsed: true,
items: [
{
label: 'Content-Security-Policy: monetization-src',
link: '/docs/references/csp-monetization-src',
label: 'GlobalEventHandlers: onmonetization',
link: '/docs/references/onmonetization',
},
{
label: 'Permissions-Policy: monetization',
link: '/docs/references/permissions-policy-monetization',
label: 'MonetizationEvent',
link: '/docs/references/monetizationevent',
},
{
label: 'amountSent',
link: '/docs/references/attributes/amountsent',
},
{
label: 'incomingPayment',
link: '/docs/references/attributes/incomingpayment',
},
{
label: 'paymentPointer',
link: '/docs/references/attributes/paymentpointer',
},
],
},
{
label: 'Events',
label: 'HTTP headers',
items: [
{
label: 'GlobalEventHandlers: onmonetization',
link: '/docs/references/onmonetization',
label: 'Content-Security-Policy: monetization-src',
link: '/docs/references/csp-monetization-src',
},
{
label: 'Permissions-Policy: monetization',
link: '/docs/references/permissions-policy-monetization',
},
],
},
{
label: 'Deprecations',
link: '/docs/references/deprecations',
}
],
},
{
Expand Down
111 changes: 111 additions & 0 deletions src/content/docs/docs/references/activitystreams.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
title: 'Activity Streams JSON-LD'
---

Social web community servers and apps can expose the wallet address of a user’s profile or post to a Web Monetization client, such as the Web Monetization browser extension or embedded SDK.

Web Monetization links are represented in [Activity Streams 2.0](https://www.w3.org/TR/activitystreams-core/) [Object Types](https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object) using the `monetization` property from the Open Payments namespace (`https://interledger.org/ns/openpayments`).

### User `Profile` example

```jsonc
{
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",

// Add the Open Payments namespace
"https://interledger.org/ns/openpayments",

{
"Hashtag": "as:Hashtag"
}
],
"id": "https://alpaca.gold/users/Jeremiah",
"type": "Person",
"following": "https://alpaca.gold/users/Jeremiah/following",
"followers": "https://alpaca.gold/users/Jeremiah/followers",
"inbox": "https://alpaca.gold/users/Jeremiah/inbox",
"outbox": "https://alpaca.gold/users/Jeremiah/outbox",
"preferredUsername": "Jeremiah",
"name": "Jeremiah Lee",
"summary": "<p>I want you to get paid when you go viral. <a href=\"https://alpaca.gold/tags/WebMonetizationRocks\" class=\"mention hashtag\" rel=\"tag\">#<span>WebMonetizationRocks</span></a></p>",
"url": "https://alpaca.gold/@Jeremiah",
"published": "2023-01-06T00:00:00Z",
"publicKey": {},
"endpoints": {
"sharedInbox": "https://alpaca.gold/inbox"
},
"tag": [{
"type": "Hashtag",
"href": "https://alpaca.gold/tags/WebMonetizationRocks",
"name": "#WebMonetizationRocks"
}],

// Wallet address when viewing this user’s profile
"monetization": "https://fynbos.me/jeremiah"
}
```

### User post (`Note`) example

```jsonc
{
"@context": [
"https://www.w3.org/ns/activitystreams",

// Add the Open Payments namespace
"https://interledger.org/ns/openpayments",

{
"ostatus": "http://ostatus.org#",
"atomUri": "ostatus:atomUri",
"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
"conversation": "ostatus:conversation",
"sensitive": "as:sensitive",
"Hashtag": "as:Hashtag"
}
],
"id": "https://alpaca.gold/users/Jeremiah/statuses/113677237228956618",
"type": "Note",
"published": "2024-12-19T02:56:24Z",
"url": "https://alpaca.gold/@Jeremiah/113677237228956618",
"attributedTo": "https://alpaca.gold/users/Jeremiah",
"to": ["https://www.w3.org/ns/activitystreams#Public"],
"cc": ["https://alpaca.gold/users/Jeremiah/followers"],
"sensitive": false,
"atomUri": "https://alpaca.gold/users/Jeremiah/statuses/113677237228956618",
"inReplyToAtomUri": null,
"conversation": "tag:alpaca.gold,2024-12-19:objectId=3727991:objectType=Conversation",
"content": "<p>When you go viral, you should get paid. <a href=\"https://alpaca.gold/tags/WebMonetizationRocks\" class=\"mention hashtag\" rel=\"tag\">#<span>WebMonetizationRocks</span></a></p>",
"attachment": [],
"tag": [{
"type": "Hashtag",
"href": "https://alpaca.gold/tags/webmonetizationrocks",
"name": "#webmonetizationrocks"
}],
"replies": {
"id": "https://alpaca.gold/users/Jeremiah/statuses/113677237228956618/replies",
"type": "Collection",
"first": {
"type": "CollectionPage",
"next": "https://alpaca.gold/users/Jeremiah/statuses/113677237228956618/replies?only_other_accounts=true&page=true",
"partOf": "https://alpaca.gold/users/Jeremiah/statuses/113677237228956618/replies",
"items": []
}
},
"likes": {
"id": "https://alpaca.gold/users/Jeremiah/statuses/113677237228956618/likes",
"type": "Collection",
"totalItems": 42
},
"shares": {
"id": "https://alpaca.gold/users/Jeremiah/statuses/113677237228956618/shares",
"type": "Collection",
"totalItems": 9
},

// Wallet address when viewing this Note
"monetization": "https://fynbos.me/jeremiah"
}
```
25 changes: 25 additions & 0 deletions src/content/docs/docs/references/deprecations.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: 'Deprecations'
---

import { LinkOut } from '@interledger/docs-design-system'

## 2024-01-01

### `<meta>` element removed

Earlier versions of the Web Monetization specification supported both the `<meta>` and `<link>` elements. Now, only the `<link>` element is supported.

### Interledger Protocol payment pointers replaced with Open Payments wallet addresses

Web Monetization now uses the [Open Payments API specification](https://openpayments.dev/) instead of the [STREAM Interledger Transport protocol](https://interledger.org/developers/rfcs/stream-protocol/). A monetization link now must be the URL of an Open Payments wallet address. Open Payments wallet addresses do not support payment pointer shorthand (e.g. `$wallet.example/alice`) and must be fully expressed URLs (e.g. `https://wallet.example/alice`).

If your Web Monetization provider has not provided you a wallet address, try converting your payment pointer from a shorthand form to URL on <LinkOut href="https://paymentpointers.org">paymentpointers.org</LinkOut>.

### `MonetizationEvent` attributes `amount`, `assetCode`, `assetScale`, `receipt` removed

Web Monetization now uses the [Open Payments API specification](https://openpayments.dev/) instead of the [STREAM Interledger Transport protocol](https://interledger.org/developers/rfcs/stream-protocol/).

`MonetizationEvent` now represents the amount sent instead of the amount received. The new `incomingPayment` attribute may be used to determine the amount received. Therefore, `amount`, `assetCode`, `assetScale` are no longer attributes on the event. Consider using [`amountSent`](/docs/references/attributes/amountsent) instead.

STREAM receipts are no longer relevant to the `MonetizationEvent` and have been removed.
18 changes: 6 additions & 12 deletions src/content/docs/docs/references/html.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,22 @@ import BrowserCompat from '/src/components/docs/BrowserCompat.astro'
import data from '/src/data/browser-compat-data/link.json'
import { LinkOut } from '@interledger/docs-design-system'

The `<link>` element enables you to [add Web Monetization to an HTML document](/docs/guides/monetize-page). The `rel` value must be `monetization`. The `href` value must be a URL representing an Open Payments-enabled wallet address, such as a payment pointer.
Web Monetization wallet addresses are represented in HTML documents using the `<link>` element with the `rel="monetization"` attribute. The `rel` value must be `monetization`. The `href` value must be a URL of an Open Payments-enabled wallet address.

```html
<link rel="monetization" href="https://wallet.example/alice">
```

A single HTML document can contain multiple monetization `<link>` elements; however, it's up to each WM provider to decide how they want to handle this scenario. We recommend WM providers split the payments evenly between the links.

## Payment pointers and meta elements

The first version of the Web Monetization spec supported both the `<meta>` and `<link>` elements. The `<meta>` element supported payment pointers written in shorthand form (e.g., `$wallet.example/alice`).

Now, Web Monetization only supports the `<link>` element. The `<link>` element does not support shorthand and requires payment pointers be in URL format (e.g., `https://wallet.example/alice`). In most cases, you can simply replace the `$` with `https://`. However, we suggest entering your payment pointer into the input field on <LinkOut href="https://paymentpointers.org">paymentpointers.org</LinkOut> to convert it from shorthand to URL.

:::note
The Web Monetization specification references payment pointers, but any Open Payments-enabled wallet address in URL form can be used as the 'href' value.
:::
An HTML document may contain multiple monetization `<link>` elements. Web Monetization providers decide how handle this scenario. We recommend Web Monetization providers split the payments evenly between the links.

## Specifications

<Specification anchor='link-type-monetization' />

## Related

- [Guide: Add Web Monetization to a webpage](/docs/guides/monetize-page)

{/* ## Browser compatibility */}

{/* <BrowserCompat json={data} /> */}
Loading

0 comments on commit f624411

Please sign in to comment.