@x1id/resolve 0.43.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/dist/checkout.d.ts +6 -6
- package/dist/checkout.js +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -312,6 +312,32 @@ for (const a of liveAttestations(atts)) {
|
|
|
312
312
|
integrator joining a live attestation to its paired text record reads the same
|
|
313
313
|
mapping the program, resolver and app badge use.
|
|
314
314
|
|
|
315
|
+
## Removing a verification
|
|
316
|
+
|
|
317
|
+
A name's current authority (owner, or NFT holder if tokenized) can remove any of
|
|
318
|
+
its own attestations with `remove_own_attestation` (registry upgrade 7, live on
|
|
319
|
+
mainnet and testnet). A validator link (kind 6) can also be removed by the
|
|
320
|
+
withdraw authority stored in its `attestor` field, without the owner. The
|
|
321
|
+
account is closed and its rent refunded to whoever paid it:
|
|
322
|
+
|
|
323
|
+
- kinds 0–5: the stored `attestor`, since it paid the rent;
|
|
324
|
+
- kind 6: the signer.
|
|
325
|
+
|
|
326
|
+
Any other `recipient` fails with 6238 `AttestationRefundMismatch`.
|
|
327
|
+
|
|
328
|
+
```ts
|
|
329
|
+
import { buildRemoveOwnAttestationIx } from "@x1id/resolve";
|
|
330
|
+
|
|
331
|
+
const ix = buildRemoveOwnAttestationIx({
|
|
332
|
+
programId,
|
|
333
|
+
signer: wallet, // handle authority (or, for kind 6, the stored withdraw authority)
|
|
334
|
+
handle: handleAccount,
|
|
335
|
+
attestation: att.account, // from fetchAttestations
|
|
336
|
+
recipient: att.kind === 6 ? wallet : att.attestor,
|
|
337
|
+
holderTokenAccount, // only when the handle is tokenized and the holder signs
|
|
338
|
+
});
|
|
339
|
+
```
|
|
340
|
+
|
|
315
341
|
## Attestation gating (allowlists)
|
|
316
342
|
|
|
317
343
|
Gate your app, Discord, mint, or airdrop by whether an `@handle` holds a
|
package/dist/checkout.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* X1ID Pay checkout widget ([Pay 7], docs/x1id-pay-checkout.md): the
|
|
3
|
-
* postMessage protocol between a merchant page and the
|
|
3
|
+
* postMessage protocol between a merchant page and the X1 Pay invoice page (app.x1pay.me),
|
|
4
4
|
* plus the merchant-side controller that opens the checkout popup.
|
|
5
5
|
*
|
|
6
6
|
* The widget only PAYS an invoice that already exists on chain. The merchant
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Flow (all messages are plain JSON-able objects, see {@link CheckoutMessage}):
|
|
15
15
|
*
|
|
16
|
-
* merchant page (origin M) popup:
|
|
16
|
+
* merchant page (origin M) popup: X1 Pay app (origin A)
|
|
17
17
|
* ─────────────────────── ──────────────────────────
|
|
18
18
|
* window.open(A/invoice?address=…&embed=1&origin=M&sid=S)
|
|
19
19
|
* ◀── ready {sid, invoice} (targetOrigin M)
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
* opener is anything else; it trusts an `ack` only when `event.source` is
|
|
28
28
|
* its opener and `event.origin` is exactly that origin;
|
|
29
29
|
* - the merchant accepts a message only when `event.source` is the popup it
|
|
30
|
-
* opened, `event.origin` is exactly the
|
|
30
|
+
* opened, `event.origin` is exactly the X1 Pay app origin, and the session id
|
|
31
31
|
* (`sid`, 128 random bits per checkout) and invoice match.
|
|
32
32
|
*
|
|
33
|
-
* No iframe mode: the
|
|
33
|
+
* No iframe mode: the X1 Pay app keeps `frame-ancestors 'none'` /
|
|
34
34
|
* `X-Frame-Options: DENY` (clickjacking), and wallet extensions work in a
|
|
35
35
|
* top-level window.
|
|
36
36
|
*
|
|
@@ -42,7 +42,7 @@ export declare const CHECKOUT_PROTOCOL = "x1id-checkout";
|
|
|
42
42
|
/** Protocol version on every message. */
|
|
43
43
|
export declare const CHECKOUT_VERSION = 1;
|
|
44
44
|
/** Where the hosted checkout lives. */
|
|
45
|
-
export declare const DEFAULT_CHECKOUT_APP_ORIGIN = "https://app.
|
|
45
|
+
export declare const DEFAULT_CHECKOUT_APP_ORIGIN = "https://app.x1pay.me";
|
|
46
46
|
/**
|
|
47
47
|
* - `paid`: the invoice page read the Invoice account back as Paid.
|
|
48
48
|
* - `cancelled`: the payer returned to the merchant without paying.
|
|
@@ -181,7 +181,7 @@ export interface OpenCheckoutOptions {
|
|
|
181
181
|
readonly invoice: string;
|
|
182
182
|
/** Override the hosted checkout origin (e.g. a testnet deployment). */
|
|
183
183
|
readonly appOrigin?: string;
|
|
184
|
-
/** Called once the popup has proved it is the
|
|
184
|
+
/** Called once the popup has proved it is the X1 Pay app for this checkout. */
|
|
185
185
|
readonly onReady?: () => void;
|
|
186
186
|
/** Popup size. */
|
|
187
187
|
readonly width?: number;
|
package/dist/checkout.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* X1ID Pay checkout widget ([Pay 7], docs/x1id-pay-checkout.md): the
|
|
3
|
-
* postMessage protocol between a merchant page and the
|
|
3
|
+
* postMessage protocol between a merchant page and the X1 Pay invoice page (app.x1pay.me),
|
|
4
4
|
* plus the merchant-side controller that opens the checkout popup.
|
|
5
5
|
*
|
|
6
6
|
* The widget only PAYS an invoice that already exists on chain. The merchant
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Flow (all messages are plain JSON-able objects, see {@link CheckoutMessage}):
|
|
15
15
|
*
|
|
16
|
-
* merchant page (origin M) popup:
|
|
16
|
+
* merchant page (origin M) popup: X1 Pay app (origin A)
|
|
17
17
|
* ─────────────────────── ──────────────────────────
|
|
18
18
|
* window.open(A/invoice?address=…&embed=1&origin=M&sid=S)
|
|
19
19
|
* ◀── ready {sid, invoice} (targetOrigin M)
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
* opener is anything else; it trusts an `ack` only when `event.source` is
|
|
28
28
|
* its opener and `event.origin` is exactly that origin;
|
|
29
29
|
* - the merchant accepts a message only when `event.source` is the popup it
|
|
30
|
-
* opened, `event.origin` is exactly the
|
|
30
|
+
* opened, `event.origin` is exactly the X1 Pay app origin, and the session id
|
|
31
31
|
* (`sid`, 128 random bits per checkout) and invoice match.
|
|
32
32
|
*
|
|
33
|
-
* No iframe mode: the
|
|
33
|
+
* No iframe mode: the X1 Pay app keeps `frame-ancestors 'none'` /
|
|
34
34
|
* `X-Frame-Options: DENY` (clickjacking), and wallet extensions work in a
|
|
35
35
|
* top-level window.
|
|
36
36
|
*
|
|
@@ -42,7 +42,7 @@ export const CHECKOUT_PROTOCOL = "x1id-checkout";
|
|
|
42
42
|
/** Protocol version on every message. */
|
|
43
43
|
export const CHECKOUT_VERSION = 1;
|
|
44
44
|
/** Where the hosted checkout lives. */
|
|
45
|
-
export const DEFAULT_CHECKOUT_APP_ORIGIN = "https://app.
|
|
45
|
+
export const DEFAULT_CHECKOUT_APP_ORIGIN = "https://app.x1pay.me";
|
|
46
46
|
// ---------------------------------------------------------------------------
|
|
47
47
|
// validation
|
|
48
48
|
// ---------------------------------------------------------------------------
|
|
@@ -232,7 +232,7 @@ export function parseCheckoutParams(get) {
|
|
|
232
232
|
* straight from a click handler). */
|
|
233
233
|
export class CheckoutPopupBlockedError extends Error {
|
|
234
234
|
constructor() {
|
|
235
|
-
super("The browser blocked the
|
|
235
|
+
super("The browser blocked the X1 Pay checkout window. Open checkout from a click handler.");
|
|
236
236
|
this.name = "CheckoutPopupBlockedError";
|
|
237
237
|
}
|
|
238
238
|
}
|