twzrd-x402-gate 0.9.1 → 0.9.2
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/QUICKSTART.md +11 -20
- package/README.md +54 -251
- package/dist/index.d.ts +3 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -7
- package/dist/index.js.map +1 -1
- package/dist/mpp-hook.d.ts +12 -39
- package/dist/mpp-hook.d.ts.map +1 -1
- package/dist/mpp-hook.js +13 -76
- package/dist/mpp-hook.js.map +1 -1
- package/dist/policy-runtime.d.ts +0 -2
- package/dist/policy-runtime.d.ts.map +1 -1
- package/dist/policy-runtime.js +0 -14
- package/dist/policy-runtime.js.map +1 -1
- package/dist/resource-bind.d.ts.map +1 -1
- package/dist/resource-bind.js +8 -27
- package/dist/resource-bind.js.map +1 -1
- package/dist/x402-client-hook.d.ts +11 -22
- package/dist/x402-client-hook.d.ts.map +1 -1
- package/dist/x402-client-hook.js +13 -57
- package/dist/x402-client-hook.js.map +1 -1
- package/package.json +3 -7
- package/dist/cloudflare-base.d.ts +0 -49
- package/dist/cloudflare-base.d.ts.map +0 -1
- package/dist/cloudflare-base.js +0 -113
- package/dist/cloudflare-base.js.map +0 -1
- package/dist/cloudflare-x402.d.ts +0 -29
- package/dist/cloudflare-x402.d.ts.map +0 -1
- package/dist/cloudflare-x402.js +0 -31
- package/dist/cloudflare-x402.js.map +0 -1
- package/dist/paying-fetch.d.ts +0 -15
- package/dist/paying-fetch.d.ts.map +0 -1
- package/dist/paying-fetch.js +0 -67
- package/dist/paying-fetch.js.map +0 -1
- package/dist/policy-fetch.d.ts +0 -18
- package/dist/policy-fetch.d.ts.map +0 -1
- package/dist/policy-fetch.js +0 -77
- package/dist/policy-fetch.js.map +0 -1
- package/dist/wash-default.d.ts +0 -106
- package/dist/wash-default.d.ts.map +0 -1
- package/dist/wash-default.js +0 -223
- package/dist/wash-default.js.map +0 -1
package/QUICKSTART.md
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# twzrd-x402-gate — Quickstart (15 minutes, 0 USDC)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Refuses payment to a wash-flagged merchant **before your wallet signs**. Free intel, no
|
|
4
|
+
API key, no signup, no config — every `TWZRD_*` env var is an optional override. If intel
|
|
5
|
+
is unreachable the gate never *invents* a wash flag (the wash check fails open); a failed
|
|
6
|
+
preflight blocks the payment by default (`TWZRD_FAIL_OPEN=true` to allow).
|
|
6
7
|
|
|
7
|
-
**Pin:** `twzrd-x402-gate@0.
|
|
8
|
+
**Pin:** `twzrd-x402-gate@0.8.18` + stock PayAI client `x402-solana@2.1.0` (official
|
|
9
|
+
`beforePayment` seat). `@x402/core` Path E remains supported; refuse script is fallback.
|
|
8
10
|
|
|
9
11
|
## 1. Stock PayAI client (default seat — copy-paste)
|
|
10
12
|
|
|
11
13
|
```bash
|
|
12
|
-
npm install twzrd-x402-gate@0.
|
|
14
|
+
npm install twzrd-x402-gate@0.8.18 x402-solana@2.1.0
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
> **ESM-only.** The package ships `import` conditions only — a CommonJS
|
|
@@ -17,16 +19,6 @@ npm install twzrd-x402-gate@0.9.0 x402-solana@3.0.0
|
|
|
17
19
|
> fails with `ERR_PACKAGE_PATH_NOT_EXPORTED`. Set `"type": "module"` in your
|
|
18
20
|
> package.json, use `.mjs`, or bundle ESM.
|
|
19
21
|
|
|
20
|
-
```typescript
|
|
21
|
-
import { createX402Client } from "x402-solana";
|
|
22
|
-
import { createTwzrdPayingClient } from "twzrd-x402-gate";
|
|
23
|
-
|
|
24
|
-
// was: createX402Client({ wallet })
|
|
25
|
-
const client = createX402Client(createTwzrdPayingClient({ wallet }));
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Or hook-only:
|
|
29
|
-
|
|
30
22
|
```typescript
|
|
31
23
|
import { createX402Client } from "x402-solana";
|
|
32
24
|
import { createTwzrdBeforePaymentHook } from "twzrd-x402-gate";
|
|
@@ -34,18 +26,17 @@ import { createTwzrdBeforePaymentHook } from "twzrd-x402-gate";
|
|
|
34
26
|
const client = createX402Client({
|
|
35
27
|
wallet,
|
|
36
28
|
network: "solana",
|
|
37
|
-
beforePayment: createTwzrdBeforePaymentHook(),
|
|
29
|
+
beforePayment: createTwzrdBeforePaymentHook({ refuseWashFlagged: true }),
|
|
38
30
|
});
|
|
39
31
|
```
|
|
40
32
|
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
Equivalent: `beforePayment: installTwzrdAutoGate("x402-solana", { refuseWashFlagged: true })`.
|
|
43
34
|
Then: `await client.fetch("https://merchant.example/paid");`
|
|
44
35
|
|
|
45
36
|
## 1b. Official `@x402/core` client (Path E)
|
|
46
37
|
|
|
47
38
|
```bash
|
|
48
|
-
npm install twzrd-x402-gate@0.
|
|
39
|
+
npm install twzrd-x402-gate@0.8.18 @x402/core @x402/fetch @x402/svm
|
|
49
40
|
```
|
|
50
41
|
|
|
51
42
|
```typescript
|
|
@@ -62,7 +53,7 @@ installTwzrdAutoGate(client, { refuseWashFlagged: true });
|
|
|
62
53
|
|
|
63
54
|
```bash
|
|
64
55
|
# Stock-client seat proof (beforePayment, signer_invocation_count=0)
|
|
65
|
-
# needs x402-solana@
|
|
56
|
+
# needs x402-solana@2.1.0 installed - the harness fallback runs but does not
|
|
66
57
|
# clear closure (its negative arm counts a would-be sign)
|
|
67
58
|
npm run x402-solana-before-payment-proof
|
|
68
59
|
# writes block-proof-<run_id>.json — hook: beforePayment
|
package/README.md
CHANGED
|
@@ -1,72 +1,35 @@
|
|
|
1
1
|
# twzrd-x402-gate
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**TWZRD is the spend-control SDK for agents paying over x402** — and the default
|
|
4
|
+
`onBeforePaymentCreation` policy engine for official x402 clients.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
to say **no** before the signature. TWZRD is that no — inside `beforePayment` /
|
|
7
|
-
fetch+sign, not inside PayAI’s SDK defaults, not as a shop at intel.twzrd.xyz.
|
|
6
|
+
### One call (named export `twzrd`)
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
prompt injection can spend anything the agent can sign. The gate closes it by
|
|
12
|
-
attaching the wallet to a policy runtime the injected content cannot
|
|
13
|
-
renegotiate: per-request cap, rolling daily ceiling, wash brake, endpoint
|
|
14
|
-
mandates, and a tamper-evident spend ledger that survives restarts. A fully
|
|
15
|
-
compromised agent spends at most what policy allows, to whom it allows, with
|
|
16
|
-
every decision signed.
|
|
8
|
+
```js
|
|
9
|
+
import { twzrd } from "twzrd-x402-gate";
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
```typescript
|
|
25
|
-
import { createX402Client } from "x402-solana";
|
|
26
|
-
import { createTwzrdPayingClient } from "twzrd-x402-gate";
|
|
27
|
-
|
|
28
|
-
// was: createX402Client({ wallet })
|
|
29
|
-
const client = createX402Client(createTwzrdPayingClient({ wallet }));
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Equivalent one-hook form:
|
|
33
|
-
|
|
34
|
-
```typescript
|
|
35
|
-
import { createX402Client } from "x402-solana";
|
|
36
|
-
import { createTwzrdBeforePaymentHook } from "twzrd-x402-gate";
|
|
37
|
-
|
|
38
|
-
const client = createX402Client({
|
|
39
|
-
wallet,
|
|
40
|
-
network: "solana",
|
|
41
|
-
beforePayment: createTwzrdBeforePaymentHook(), // wash default
|
|
11
|
+
const result = await twzrd.safeFetch(url, {
|
|
12
|
+
maxSpend: "0.10", // per-call cap AND cumulative budget
|
|
13
|
+
allowNetworks: ["solana", "base"],
|
|
14
|
+
requireOfferBinding: true, // demand a chain-verifiable bind-v1 receipt
|
|
15
|
+
pay, // your wallet signs — this SDK never holds keys
|
|
42
16
|
});
|
|
17
|
+
// result.verdict: "allow" | "warn" | "block" — blocks have signerInvocations === 0
|
|
18
|
+
// result.receipt: { strength: "hard"|"soft"|"refuse", leaf_hash, fact_type: "resource_bound" }
|
|
43
19
|
```
|
|
44
20
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
**fail-open** on timeout / non-2xx / throw (never invent wash).
|
|
48
|
-
No Path A, no requireReceipt, no second 402, no payment-control tokens.
|
|
49
|
-
|
|
50
|
-
**Full 0.8.x engine (named opt-in):** preflight + optional Path A / escalate /
|
|
51
|
-
paymentControl:
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
createTwzrdBeforePaymentHook({ engine: "full", /* … */ })
|
|
55
|
-
// or createTwzrdFullBeforePaymentHook({ … })
|
|
56
|
-
```
|
|
21
|
+
Full walkthrough: [QUICKSTART.md](https://github.com/twzrd-sol/twzrd-trust/blob/main/QUICKSTART.md) ·
|
|
22
|
+
verify receipts yourself: [REVIEW.md](https://github.com/twzrd-sol/twzrd-trust/blob/main/REVIEW.md)
|
|
57
23
|
|
|
58
|
-
|
|
59
|
-
|
|
24
|
+
**Core product (buyer gate):** after the client selects the exact payment requirement and
|
|
25
|
+
**before** payment payload creation / wallet signing — free preflight + merchant_card wash
|
|
26
|
+
refuse. Protects the **payer** from a risky **merchant** (`payTo`). Chain-neutral envelope;
|
|
27
|
+
**Solana-deep** reputation only (Base/EVM = explicit `unknown`).
|
|
60
28
|
|
|
61
|
-
|
|
62
|
-
> — set `"type": "module"` (or use `.mjs` / an ESM bundler).
|
|
63
|
-
|
|
64
|
-
### Default-on AutoGate (alternate seats)
|
|
29
|
+
### Default-on AutoGate (5 lines)
|
|
65
30
|
|
|
66
31
|
```bash
|
|
67
|
-
npm install twzrd-x402-gate@
|
|
68
|
-
# official @x402/* path (alternate seat):
|
|
69
|
-
# npm install twzrd-x402-gate@0.9.0 @x402/core @x402/fetch @x402/svm
|
|
32
|
+
npm install twzrd-x402-gate @x402/core @x402/fetch @x402/svm
|
|
70
33
|
```
|
|
71
34
|
|
|
72
35
|
```typescript
|
|
@@ -74,28 +37,26 @@ import { x402Client } from "@x402/core/client";
|
|
|
74
37
|
import { installTwzrdAutoGate } from "twzrd-x402-gate";
|
|
75
38
|
|
|
76
39
|
const client = new x402Client();
|
|
77
|
-
//
|
|
40
|
+
// refuseWashFlagged defaults true; gateOnCanSpend stays false unless you opt in
|
|
78
41
|
installTwzrdAutoGate(client, { refuseWashFlagged: true });
|
|
79
42
|
// then register schemes + wrapFetchWithPayment as usual
|
|
80
43
|
```
|
|
81
44
|
|
|
82
|
-
**Intercept proof (0 USDC,
|
|
45
|
+
**Intercept proof (0 USDC, wash seller never reaches signer):**
|
|
83
46
|
|
|
84
47
|
```bash
|
|
85
48
|
cd packages/twzrd-x402-gate && npm run autogate-block-proof
|
|
86
49
|
# writes block-proof-<run_id>.json (schema twzrd.autogate_block_proof.v1)
|
|
87
|
-
# public reason:
|
|
88
|
-
# or "TWZRD_TRUST_GATE_BLOCK: decision_block" (readiness block basis)
|
|
89
|
-
# fixture resolves live: wash_flagged seller if available, else decision=block
|
|
50
|
+
# public reason: TWZRD_TRUST_GATE_BLOCK: wash_flagged
|
|
90
51
|
```
|
|
91
52
|
|
|
92
|
-
`gateOnCanSpend` remains **opt-in** (`false` by default; set `true` or `TWZRD_GATE_ON_CAN_SPEND=1` only when you want hard cap enforcement).
|
|
53
|
+
`gateOnCanSpend` remains **opt-in** (`false` by default; set `true` or `TWZRD_GATE_ON_CAN_SPEND=1` only when you want hard cap enforcement).
|
|
93
54
|
|
|
94
|
-
**Optional:** a resource-server settle hook so merchants can apply **customer policy**
|
|
55
|
+
**Optional (0.8.1):** a resource-server settle hook so merchants can apply **customer policy**
|
|
95
56
|
before they settle and serve (abuse, sanctions, bots, “don’t serve this payer”). Not an equal
|
|
96
57
|
mirror of the buyer problem — settled USDC is final; wash resistance is mainly TWZRD scoring.
|
|
97
58
|
|
|
98
|
-
## Seller settle guard (`onBeforeSettle`) — optional
|
|
59
|
+
## Seller settle guard (`onBeforeSettle`) — optional 0.8.1
|
|
99
60
|
|
|
100
61
|
Resource servers can screen the **payer** before *they* settle an inbound payment and serve
|
|
101
62
|
the resource. Use for merchant policy (abuse / sanctions / bots / customer selection). TWZRD is
|
|
@@ -107,7 +68,7 @@ transfer on-chain. Wash/sybil edges are primarily discounted in TWZRD scoring, n
|
|
|
107
68
|
revenue refusal.
|
|
108
69
|
|
|
109
70
|
```bash
|
|
110
|
-
npm install twzrd-x402-gate@0.
|
|
71
|
+
npm install twzrd-x402-gate@0.8.18
|
|
111
72
|
```
|
|
112
73
|
|
|
113
74
|
```typescript
|
|
@@ -139,23 +100,7 @@ Offline demo: `npx tsx examples/seller-settle-guard.ts`
|
|
|
139
100
|
Fixture-backed SVM extract tests live in `test/seller-hook.test.ts` +
|
|
140
101
|
`test/fixtures/exact-svm-transfer-checked.ts`.
|
|
141
102
|
|
|
142
|
-
**PayAI
|
|
143
|
-
Both 2.1.0 and 3.0.0 are supported and produce an identical refuse transcript; 3.0.0
|
|
144
|
-
is the current release and what the install lines pin. The hook absorbs the one
|
|
145
|
-
breaking change between them (`declaredResource` is a string on 2.1.0, `{ url }` on
|
|
146
|
-
3.0.0) - see `src/x402-client-hook.ts` and `test/x402-solana-before-payment.test.ts`.
|
|
147
|
-
|
|
148
|
-
```typescript
|
|
149
|
-
import { createX402Client } from "x402-solana";
|
|
150
|
-
import { createTwzrdPayingClient } from "twzrd-x402-gate";
|
|
151
|
-
|
|
152
|
-
const client = createX402Client(createTwzrdPayingClient({ wallet }));
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
Also: `installTwzrdAutoGate("x402-solana", opts)` returns the same wash-default hook.
|
|
156
|
-
Prove refuse-before-sign: `npm run x402-solana-before-payment-proof`.
|
|
157
|
-
|
|
158
|
-
**PayAI agentic-payments** (alternate PayAI surface; prefer x402-solana@3.0.0 when available):
|
|
103
|
+
**PayAI agentic-payments** (the active PayAI SDK, not the dormant x402-solana):
|
|
159
104
|
`npx tsx examples/payai-agentic-onPaymentVerified.ts` — wire `onPaymentVerified`
|
|
160
105
|
→ `toPayaiVerifyResult` to screen payers before serving. Fail-open by default.
|
|
161
106
|
|
|
@@ -167,7 +112,7 @@ Prove refuse-before-sign: `npm run x402-solana-before-payment-proof`.
|
|
|
167
112
|
Install the published gate and run against wash fixtures:
|
|
168
113
|
|
|
169
114
|
```bash
|
|
170
|
-
npm install twzrd-x402-gate@0.
|
|
115
|
+
npm install twzrd-x402-gate@0.8.18
|
|
171
116
|
# from package root after install, or from a checkout:
|
|
172
117
|
npm run wash-dogfood
|
|
173
118
|
```
|
|
@@ -187,7 +132,7 @@ Gate dogfood: `approved=false` `reason=twzrd_decision_block`, **USDC spent = 0**
|
|
|
187
132
|
|
|
188
133
|
**Accurate paste line:**
|
|
189
134
|
|
|
190
|
-
> Preflight returned decision=block on wash seller 7G73PL… / HuSiSpc… (preflight_id 378468 / 378469, wash_flagged=true). Gate approved=false reason=twzrd_decision_block. No USDC spent. No tx broadcast. Repro: `npm i twzrd-x402-gate@0.
|
|
135
|
+
> Preflight returned decision=block on wash seller 7G73PL… / HuSiSpc… (preflight_id 378468 / 378469, wash_flagged=true). Gate approved=false reason=twzrd_decision_block. No USDC spent. No tx broadcast. Repro: `npm i twzrd-x402-gate@0.8.5 && npm run wash-dogfood` or gist above.
|
|
191
136
|
|
|
192
137
|
This is a **reproducible demonstration** that the free gate blocks known wash sellers with stamped `preflight_id`s and zero spend. It is **not** proof that external agents already default to this path at scale.
|
|
193
138
|
|
|
@@ -265,61 +210,11 @@ No AgentCash. No marketplace. No second probe. No TWZRD custody.
|
|
|
265
210
|
Wire `twzrdOnPaymentRequested` / prefer `onPaymentRequired` + `onBeforePayment` per
|
|
266
211
|
[lifecycle hooks](https://docs.x402.org/advanced-concepts/lifecycle-hooks). Same policy core.
|
|
267
212
|
|
|
268
|
-
### Cloudflare Agents x402 (Base)
|
|
269
|
-
|
|
270
|
-
Cloudflare's `withX402Client` takes an `onPaymentRequired` callback before its
|
|
271
|
-
automatic payment retry. Use the adapter below at that boundary:
|
|
272
|
-
|
|
273
|
-
```ts
|
|
274
|
-
import { createTwzrdCloudflareX402Approval } from "twzrd-x402-gate";
|
|
275
|
-
|
|
276
|
-
const approvePayment = createTwzrdCloudflareX402Approval({
|
|
277
|
-
// Base/EVM has no TWZRD behavioral reputation yet. Refuse it rather than
|
|
278
|
-
// presenting a policy allow as a trust verdict.
|
|
279
|
-
unsupportedNetworkMode: "strict",
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
await this.x402Client.callTool(approvePayment, {
|
|
283
|
-
name: "paid_tool",
|
|
284
|
-
arguments: {},
|
|
285
|
-
});
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
`observe` is available for an agent that intentionally permits unscored Base
|
|
289
|
-
payments, but it returns policy allow with `decision=unknown`; it is never a
|
|
290
|
-
TWZRD reputation approval. This adapter protects the Cloudflare x402 path only.
|
|
291
|
-
MPP is a separate protocol and belongs on its own `onChallenge` /
|
|
292
|
-
`onPaymentRequired` control path.
|
|
293
|
-
|
|
294
|
-
### Cloudflare Worker / Base x402 (edge-safe preflight)
|
|
295
|
-
|
|
296
|
-
For a Worker, import the dedicated subpath rather than the package root. It has
|
|
297
|
-
no Node-native imports and sends the exact Base `payTo` plus `chain_id: 8453` to
|
|
298
|
-
`/v1/intel/preflight` before a Viem account signs:
|
|
299
|
-
|
|
300
|
-
```ts
|
|
301
|
-
import { withTwzrdBasePreflight } from "twzrd-x402-gate/cloudflare-base";
|
|
302
|
-
|
|
303
|
-
const signature = await withTwzrdBasePreflight(
|
|
304
|
-
paymentRequirements, // accepts: [{ network: "eip155:8453", payTo: "0x..." }]
|
|
305
|
-
{ intelBase: "https://intel.twzrd.xyz" },
|
|
306
|
-
() => account.signTypedData(eip3009Authorization),
|
|
307
|
-
);
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
`block` throws `TwzrdBasePaymentBlockedError` and never invokes the signing
|
|
311
|
-
callback. `allow` and `warn` both proceed; enforce any additional amount or
|
|
312
|
-
mandate policy in the caller. Base is not presented as reputation-scored.
|
|
313
|
-
Checksummed and lowercase EVM addresses are accepted unchanged. The fixture in
|
|
314
|
-
[`test/cloudflare-base-edge.test.ts`](./test/cloudflare-base-edge.test.ts) proves
|
|
315
|
-
`block → zero signTypedData calls` and the compiled subpath is checked for Node
|
|
316
|
-
runtime leaks.
|
|
317
|
-
|
|
318
213
|
### Raw-fetch composition (injectible pay client only)
|
|
319
214
|
|
|
320
215
|
```typescript
|
|
321
216
|
import { installTwzrdAutoGate } from "twzrd-x402-gate";
|
|
322
|
-
import { wrapFetchWithPayment } from "@x402/fetch";
|
|
217
|
+
import { wrapFetchWithPayment } from "@x402/fetch";
|
|
323
218
|
|
|
324
219
|
// Guard RAW fetch, then hand to a client that still surfaces 402 to the guard layer
|
|
325
220
|
// — OR installTwzrdAutoGate(x402Client) (canonical) / installTwzrdX402ClientHook alias.
|
|
@@ -362,13 +257,11 @@ Dogfood (one public live proof path):
|
|
|
362
257
|
## Install
|
|
363
258
|
|
|
364
259
|
```bash
|
|
365
|
-
npm install twzrd-x402-gate@0.
|
|
260
|
+
npm install twzrd-x402-gate@0.8.18
|
|
366
261
|
```
|
|
367
262
|
|
|
368
|
-
|
|
369
|
-
`
|
|
370
|
-
may be one patch ahead until that release is on npm. Confirm with
|
|
371
|
-
`npm view twzrd-x402-gate version`.
|
|
263
|
+
Do not hardcode a version in this doc — every past pin here (**0.5.4**, **0.7.1**, **0.8.5**,
|
|
264
|
+
**0.8.6**) has gone stale. Check `npm view twzrd-x402-gate version` if in doubt.
|
|
372
265
|
|
|
373
266
|
Optional settle guard (resource-server **payer** policy): see **Seller settle guard
|
|
374
267
|
(`onBeforeSettle`) — optional 0.8.1** above. Do not confuse with facilitator
|
|
@@ -462,16 +355,15 @@ installTwzrdX402ClientHook(client, {
|
|
|
462
355
|
- Hook binding test:
|
|
463
356
|
[`test/intent-binding.test.ts`](./test/intent-binding.test.ts).
|
|
464
357
|
|
|
465
|
-
### On MPP (Machine Payments Protocol) — Solana
|
|
358
|
+
### On MPP (Machine Payments Protocol) — Solana charge only
|
|
466
359
|
|
|
467
|
-
`createTwzrdMppOnChallenge` guards `Mppx.create({ onChallenge })`.
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
(`allowUnevaluated: true` is an explicit ungated opt-out).
|
|
360
|
+
`createTwzrdMppOnChallenge` guards `Mppx.create({ onChallenge })`. The mppx
|
|
361
|
+
Solana method signs AND broadcasts the transaction inside `createCredential()`,
|
|
362
|
+
so `onChallenge` is the last deterministic checkpoint before money moves - and
|
|
363
|
+
mppx re-throws `onChallenge` errors, so a TWZRD block is an exception that means
|
|
364
|
+
**`createCredential()` never runs and nothing signs**. On allow, the guard
|
|
365
|
+
creates the credential for the exact challenge it evaluated; non-`solana/charge`
|
|
366
|
+
challenges fail closed (`allowUnevaluated: true` to opt out).
|
|
475
367
|
|
|
476
368
|
```typescript
|
|
477
369
|
import { Mppx } from "mppx/client";
|
|
@@ -487,30 +379,6 @@ const mppx = Mppx.create({
|
|
|
487
379
|
});
|
|
488
380
|
```
|
|
489
381
|
|
|
490
|
-
For Base, use mppx's EVM client with explicit local spend policy:
|
|
491
|
-
|
|
492
|
-
```typescript
|
|
493
|
-
import { Mppx } from "mppx/client";
|
|
494
|
-
import { evm } from "mppx/evm/client";
|
|
495
|
-
import { createTwzrdMppOnChallenge, createLocalDecisionSigner } from "twzrd-x402-gate";
|
|
496
|
-
|
|
497
|
-
const mppx = Mppx.create({
|
|
498
|
-
methods: [evm({ account: wallet })],
|
|
499
|
-
onChallenge: createTwzrdMppOnChallenge({
|
|
500
|
-
signer: createLocalDecisionSigner(),
|
|
501
|
-
policy: {
|
|
502
|
-
allowedNetworks: ["eip155:8453"],
|
|
503
|
-
allowedAssets: ["0x833589fCD6EDb6E08f4c7C32D4f71b54bdA02913"],
|
|
504
|
-
maxAmountUsd: "1.00",
|
|
505
|
-
},
|
|
506
|
-
}),
|
|
507
|
-
});
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
Base is **not reputation-scored**. The EVM path provides an actual pre-credential
|
|
511
|
-
local control point for Base USDC; it does not call a Solana-derived score or
|
|
512
|
-
present a local policy allow as a TWZRD trust verdict.
|
|
513
|
-
|
|
514
382
|
**Scope limit (honest):** the guard is authoritative only when no
|
|
515
383
|
`onChallengeReceived` event handler supplies a credential. mppx resolves
|
|
516
384
|
`eventCredential ?? onChallenge(...)`, so an event handler returning a credential
|
|
@@ -526,8 +394,6 @@ fails closed rather than approve a payment it cannot bind:
|
|
|
526
394
|
| Non-USD-pegged asset | `UNPRICED_ASSET` | Policy ceilings are USD; the wire amount is base-unit tokens. Pricing SOL would store `asset: solana:native` beside a **dollar** `amount` and lose the token quantity actually transferred. (A 1.5 SOL charge of `1500000000` at 9 decimals would otherwise evaluate as "$1.50" and sail under a $5 ceiling while moving ~$270.) USDC/USDT only until an intent version carries token amount + quote. |
|
|
527
395
|
| Unknown cluster | `UNKNOWN_CLUSTER` | mppx-solana's `resolveEndpoint` returns an unrecognized `cluster` **verbatim as the RPC endpoint URL**, and a network string containing "solana" is otherwise scored as mainnet - so `solana:https://seller-rpc.example` would inherit mainnet reputation for a chain never observed. Known cluster names only. |
|
|
528
396
|
| Misdeclared decimals | `MALFORMED_CHALLENGE` | A known stablecoin declaring the wrong decimals is a discount attempt, not a rounding error. |
|
|
529
|
-
| Non-Base EVM chain | `UNSUPPORTED_EVM_NETWORK` | EVM MPP is narrow: Base mainnet only. A testnet or another EVM network cannot inherit a Base USDC valuation. |
|
|
530
|
-
| EVM split recipients | `MULTI_LEG_CHARGE` | mppx EVM permits `splits`; each is an additional recipient. PaymentIntent v1 binds one amount to one payTo, so the guard refuses rather than approve transfers it cannot represent. |
|
|
531
397
|
|
|
532
398
|
The intent binds a **digest of the entire normalized challenge**, not just
|
|
533
399
|
`realm:id` - swapping `recipient` or `amount` under the same challenge id changes
|
|
@@ -580,10 +446,8 @@ Canonical entry point (design: `docs/strategy/install-autogate-design.md`). One
|
|
|
580
446
|
| Call | Adapter |
|
|
581
447
|
|------|---------|
|
|
582
448
|
| `installTwzrdAutoGate(payWrap, opts?)` | Fetch: guard raw fetch → pay client |
|
|
583
|
-
| `installTwzrdAutoGate(x402Client, opts?)` | Official
|
|
584
|
-
| `installTwzrdAutoGate("x402-solana", opts?)` | PayAI stock client `beforePayment` (2.1.0+) |
|
|
449
|
+
| `installTwzrdAutoGate(x402Client, opts?)` | Official x402 `onBeforePaymentCreation` |
|
|
585
450
|
| `installTwzrdAutoGate("mpp", opts)` | MPP `onChallenge` (returns handler) |
|
|
586
|
-
| `createTwzrdBeforePaymentHook(opts?)` | Same as `"x402-solana"` — pass to `createX402Client` |
|
|
587
451
|
|
|
588
452
|
Aliases: `installTwzrdX402ClientHook`, `createTwzrdMppOnChallenge` remain; docs prefer AutoGate.
|
|
589
453
|
Kill switch: `TWZRD_GATE_ENABLED=false` or `TWZRD_AUTO_GATE=0`. Uninstall x402 installs with `uninstallTwzrdAutoGate(client)`.
|
|
@@ -596,7 +460,7 @@ ever gets a chance to sign.
|
|
|
596
460
|
|
|
597
461
|
```typescript
|
|
598
462
|
import { installTwzrdAutoGate } from "twzrd-x402-gate";
|
|
599
|
-
import { wrapFetchWithPayment } from "@x402/
|
|
463
|
+
import { wrapFetchWithPayment } from "@x402/fetch";
|
|
600
464
|
|
|
601
465
|
const payingFetch = installTwzrdAutoGate((guarded) => wrapFetchWithPayment(guarded, buyerWallet));
|
|
602
466
|
|
|
@@ -647,7 +511,7 @@ manage the raw/paying composition yourself:
|
|
|
647
511
|
|
|
648
512
|
```typescript
|
|
649
513
|
import { withTwzrdGuard } from "twzrd-x402-gate";
|
|
650
|
-
import { wrapFetchWithPayment } from "@x402/
|
|
514
|
+
import { wrapFetchWithPayment } from "@x402/fetch";
|
|
651
515
|
|
|
652
516
|
const raw = globalThis.fetch; // MUST still surface HTTP 402
|
|
653
517
|
const guarded = withTwzrdGuard(raw); // guard sits upstream
|
|
@@ -682,49 +546,15 @@ const safeFetch = withTwzrdGuard(x402Fetch, {
|
|
|
682
546
|
});
|
|
683
547
|
```
|
|
684
548
|
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
stays free** (abort on `block` only — we do not tax their rail).
|
|
689
|
-
|
|
690
|
-
On the **buyer** install, if you pass `x402Fetch` (or use
|
|
691
|
-
`installTwzrdAutoGate(payWrap)`, which auto-wires `payWrap(raw)`), Path A
|
|
692
|
-
defaults on:
|
|
693
|
-
|
|
694
|
-
| Free decision | Resource price | What fires |
|
|
695
|
-
|---------------|----------------|------------|
|
|
696
|
-
| `block` | any | free refuse |
|
|
697
|
-
| `warn` | ≥ $2.50 | $0.05 V6 (`requireReceipt`) |
|
|
698
|
-
| `warn` | < $2.50 | $0.001 quick re-decide (`escalateOnWarn`) |
|
|
699
|
-
| `allow` | > $2.50 | $0.05 V6 |
|
|
700
|
-
| `allow` | ≤ $2.50 | free proceed |
|
|
701
|
-
|
|
702
|
-
```typescript
|
|
703
|
-
import { wrapFetchWithPayment } from "@x402/svm";
|
|
704
|
-
import { createTwzrdBeforePaymentHook } from "twzrd-x402-gate";
|
|
705
|
-
|
|
706
|
-
const x402Fetch = wrapFetchWithPayment(fetch, buyerWallet);
|
|
707
|
-
const client = createX402Client({
|
|
708
|
-
wallet: buyerWallet,
|
|
709
|
-
network: "solana",
|
|
710
|
-
beforePayment: createTwzrdBeforePaymentHook({
|
|
711
|
-
refuseWashFlagged: true,
|
|
712
|
-
x402Fetch, // turns Path A defaults on
|
|
713
|
-
}),
|
|
714
|
-
});
|
|
715
|
-
```
|
|
716
|
-
|
|
717
|
-
Opt out: `requireReceipt: false` and/or `escalateOnWarn: false`.
|
|
718
|
-
Refuse-only seats (no `x402Fetch`) stay free.
|
|
719
|
-
|
|
720
|
-
`evaluate_x402_resource` itself stays opt-in. `autoReceipt: true` still buys
|
|
721
|
-
$0.05 on every non-block (broader than the default ladder).
|
|
549
|
+
`autoReceipt` is **off by default** — it spends the **buyer's** USDC, so you opt in. When on,
|
|
550
|
+
every warn/allow verdict settles $0.05 USDC to TWZRD and returns a signed V6 trust credential
|
|
551
|
+
for the counterparty before you pay the resource.
|
|
722
552
|
|
|
723
553
|
**`x402Fetch` is yours to supply** (this package is dependency-free). Wire the proven
|
|
724
554
|
`@x402/svm` sponsored-feePayer client — the same one `twzrd-mcp-server` uses:
|
|
725
555
|
|
|
726
556
|
```typescript
|
|
727
|
-
import { wrapFetchWithPayment } from "@x402/
|
|
557
|
+
import { wrapFetchWithPayment } from "@x402/fetch";
|
|
728
558
|
const x402Fetch = wrapFetchWithPayment(fetch, buyerWallet); // settles 402 challenges
|
|
729
559
|
```
|
|
730
560
|
|
|
@@ -916,31 +746,17 @@ const gatedFetch = wrapFetchWithTwzrdGate(fetch, resolveConfig());
|
|
|
916
746
|
|
|
917
747
|
A payment is **blocked** when:
|
|
918
748
|
1. `decision ∈ blockDecisions` (default: `["block"]`)
|
|
919
|
-
2. `trust_score < preflightMinScore` (default: `40`)
|
|
920
|
-
`trust_score` is scored `0` (`policy.ts`: `card.trust_score ?? 0`), so a
|
|
921
|
-
missing score blocks under the default floor
|
|
749
|
+
2. `trust_score < preflightMinScore` (default: `40`)
|
|
922
750
|
3. `can_spend === false` — **only** when `gateOnCanSpend: true` (default `false`, opt-in)
|
|
923
|
-
4. `merchant_card.wash_flagged === true` — **on by default**
|
|
924
|
-
(`refuseWashFlagged`, `TWZRD_REFUSE_WASH_FLAGGED`); forces `verdict: "block"`
|
|
925
|
-
with `reason: twzrd_wash_flagged`. Only tightens, and fails **open** when the
|
|
926
|
-
card is unreachable or `wash_flagged` is `null` (never evaluated ≠ clean).
|
|
927
|
-
Soft-cap instead of hard refuse with `washMaxUsdc` / `TWZRD_WASH_MAX_USDC`.
|
|
928
751
|
|
|
929
752
|
`warn` is allowed unless overridden. Preflight network failure **fails closed** by default (a preflight outage blocks the payment, so an intel hiccup never silently approves a spend); set `failOpen: true` / `TWZRD_FAIL_OPEN=true` to opt into legacy allow-on-outage.
|
|
930
753
|
|
|
931
754
|
A 402 whose payment requirements yield **no identifiable seller wallet** (missing/empty `payTo`, or an unparseable `accepts[]`) is a different case from "unknown seller" — it always **blocks** with `reason: twzrd_unidentifiable_payment_recipient`, without ever calling the preflight network. This is unconditional (not affected by `failOpen`): `failOpen` governs what happens when the TWZRD *service* is unreachable, not what happens when the caller can't say who they're paying.
|
|
932
755
|
|
|
933
756
|
> **`can_spend` note:** the free preflight returns `can_spend=false` for most sellers
|
|
934
|
-
> not yet in the TWZRD corpus, including legitimate ones.
|
|
935
|
-
>
|
|
936
|
-
>
|
|
937
|
-
>
|
|
938
|
-
> This is **not** a blanket "unknown sellers are allowed by default". Conditions 1,
|
|
939
|
-
> 2 and 4 above are all active by default, and condition 2 is the one that catches
|
|
940
|
-
> unknown sellers: a card carrying no `trust_score` evaluates as `0` and blocks
|
|
941
|
-
> under the default `preflightMinScore: 40` with `twzrd_score_0_below_40`. To
|
|
942
|
-
> actually let unscored sellers through, lower or disable `preflightMinScore` —
|
|
943
|
-
> setting `gateOnCanSpend` does not govern it.
|
|
757
|
+
> not yet in the TWZRD corpus, including legitimate ones. The default is decision-only
|
|
758
|
+
> gating so unknown sellers on platforms like Agentic.Market are not blocked by default.
|
|
759
|
+
> Set `gateOnCanSpend: true` for strict mode.
|
|
944
760
|
|
|
945
761
|
## Config
|
|
946
762
|
|
|
@@ -951,24 +767,11 @@ A 402 whose payment requirements yield **no identifiable seller wallet** (missin
|
|
|
951
767
|
| `blockDecisions` | `TWZRD_BLOCK_DECISIONS` | `block` | Decisions that throw |
|
|
952
768
|
| `failOpen` | `TWZRD_FAIL_OPEN` | `false` | `true` opts into legacy allow-on-outage; default blocks (fail-closed) |
|
|
953
769
|
| `gateOnCanSpend` | `TWZRD_GATE_ON_CAN_SPEND` | `false` | Also block when `can_spend=false` |
|
|
954
|
-
| `refuseWashFlagged` | `TWZRD_REFUSE_WASH_FLAGGED` | **`true`** | Refuse when `merchant_card.wash_flagged === true` (Policy 4). Set `false` / `0` to opt out |
|
|
955
|
-
| `washMaxUsdc` | `TWZRD_WASH_MAX_USDC` | — | Soft cap instead of hard refuse on wash: allow up to this USDC amount |
|
|
956
|
-
| `unsupportedNetworkMode` | `TWZRD_UNSUPPORTED_NETWORK_MODE` | `observe` | Behavior on a non-Solana / unrecognized network |
|
|
957
|
-
| `fetch` | — | global `fetch` | Injected fetch used for preflight + merchant card (testing / custom agents) |
|
|
958
|
-
| `onWarnUpsell` | — | — | Callback fired on a `warn` verdict (Path A upsell hook) |
|
|
959
|
-
| `attribution` | `TWZRD_ATTRIBUTION_INTEGRATION` + `TWZRD_ATTRIBUTION_RUN_ID` | — | Opt-in run attribution (see below) |
|
|
960
|
-
|
|
961
|
-
The four options below are **not** `TwzrdGateConfig` fields — they belong to
|
|
962
|
-
`TwzrdGuardOptions` / `InstallAutoGateOptions` (`withTwzrdGuard` /
|
|
963
|
-
`installTwzrdAutoGate`). Passing them to `createTwzrdGate({...})` is a type error
|
|
964
|
-
and is silently dropped at runtime:
|
|
965
|
-
|
|
966
|
-
| Option | Env | Default | Description |
|
|
967
|
-
|---|---|---|---|
|
|
968
770
|
| `autoReceipt` | — | `false` | Auto-buy $0.05 TWZRD receipt on warn/allow |
|
|
969
771
|
| `x402Fetch` | — | — | x402-capable fetch for `autoReceipt` |
|
|
970
772
|
| `onReceipt` | — | — | Callback after receipt is captured |
|
|
971
773
|
| `disabled` (`installTwzrdAutoGate` only) | `TWZRD_AUTO_GATE=0`/`false` | `false` | Bypass the guard entirely — `payWrap` gets the raw, unguarded fetch |
|
|
774
|
+
| `attribution` | `TWZRD_ATTRIBUTION_INTEGRATION` + `TWZRD_ATTRIBUTION_RUN_ID` | — | Opt-in run attribution (see below) |
|
|
972
775
|
|
|
973
776
|
## Gate adoption proof (no-spend harness)
|
|
974
777
|
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export { classifyNetwork, decideUnsupportedNetwork, amountBucket, type NetworkCl
|
|
|
7
7
|
export type { TwzrdGateDecision } from "./types.js";
|
|
8
8
|
export { fetchMerchantCard, applyWashFlaggedPolicy, type TwzrdMerchantCard, type WashPolicyInput, type WashPolicyResult, } from "./merchant-card.js";
|
|
9
9
|
export { twzrdOnPaymentRequested } from "./mcp-hook.js";
|
|
10
|
-
export { createTwzrdCloudflareX402Approval, type CloudflareX402PaymentRequirements, } from "./cloudflare-x402.js";
|
|
11
10
|
export { wrapFetchWithTwzrdGate } from "./wrap-fetch.js";
|
|
12
11
|
export { evaluate_x402_resource, type EvaluateX402Options, type EvaluateX402Result, } from "./evaluate.js";
|
|
13
12
|
export { DEFAULT_REQUIRE_RECEIPT_MIN_SPEND_USDC, resolveRequireReceiptPolicy, shouldAttemptPathAReceipt, shouldRequirePathAReceipt, type RequireReceiptPolicy, type ResolvedRequireReceiptPolicy, } from "./receipt-policy.js";
|
|
@@ -17,15 +16,11 @@ export { installTwzrdAutoGate, uninstallTwzrdAutoGate, isTwzrdAutoGateDisabled,
|
|
|
17
16
|
export { TWZRD_TRUST_GATE_BLOCK_WASH, TWZRD_TRUST_GATE_BLOCK_CAN_SPEND, TWZRD_TRUST_GATE_BLOCK_DECISION, TWZRD_TRUST_GATE_BLOCK_BUDGET, toTrustGateBlockReason, } from "./trust-gate-reason.js";
|
|
18
17
|
export { attachBlockOutcomeAttestation, AUTOGATE_BLOCK_PROOF_SCHEMA, AUTOGATE_BLOCK_PROOF_SCHEMA_V1_1, AUTOGATE_BLOCK_PROOF_SCHEMA_V1_2, buildAutogateBlockProof, resolveInstalledPackageVersion, type AutogateBlockProof, type BuildAutogateBlockProofInput, type ExecutionMode, } from "./block-proof.js";
|
|
19
18
|
export { safeFetch, runAgentcashFetch, main as safeFetchMain, type SafeFetchOptions, type SafeFetchResult, } from "./safe-fetch.js";
|
|
20
|
-
export { installTwzrdX402ClientHook, twzrdBeforePaymentCreation, evaluateBeforePaymentCreation, createTwzrdBeforePaymentHook,
|
|
21
|
-
export { createTwzrdPayingClient, createTwzrdWashBeforePaymentHook, evaluateWashOnlyBeforePayment, mapWashRequirements, type WashDefaultOptions, type CreateTwzrdPayingClientInput, type CreateTwzrdPayingClientResult, type WashSelectedRequirements, type WashBeforePaymentContext, type WashBeforePaymentResult, } from "./wash-default.js";
|
|
22
|
-
export { createTwzrdPayingFetch, TwzrdWashAbortError } from "./paying-fetch.js";
|
|
19
|
+
export { installTwzrdX402ClientHook, twzrdBeforePaymentCreation, evaluateBeforePaymentCreation, createTwzrdBeforePaymentHook, mapX402SolanaRequirements, flattenDeclaredResource, resourceUrlFromPaymentRequired, type X402ClientLike, type X402SelectedRequirements, type X402DeclaredResource, type BeforePaymentCreationContext, type BeforePaymentCreationResult, type InstallX402ClientHookOptions, type X402PaymentControlOptions, type X402SolanaBeforePaymentContext, } from "./x402-client-hook.js";
|
|
23
20
|
export { RESOURCE_BIND_DOMAIN, RESOURCE_BIND_EXTRA_KEY, RESOURCE_BIND_MEMO_PREFIX, RESOURCE_BIND_MEMO_MAX, ZERO_BODY_HASH, canonicalResourceUrl, resourceBindLeafHash, networksEquivalent, rawReqFromPaymentRequired, rememberRawInvoice, wrapFetchRememberInvoice, resourceBindMemo, memoContainsResourceBind, stampResourceBind, evaluateResourceBind, type BindStrength, type ResourceBindReq, type ResourceBindDecision, } from "./resource-bind.js";
|
|
24
21
|
export { extractSvmMemoFromTransaction, extractSvmTransferLegs, evaluateResourceBindFromSvmTx, evaluateResourceBindLegsFromSvmTx, MEMO_PROGRAM_ADDRESS as RESOURCE_BIND_MEMO_PROGRAM, type ResourceBindLeafFields, type SvmTransferLegs, } from "./resource-bind-tx.js";
|
|
25
22
|
export { twzrd, spendControlSafeFetch, type SpendControlOptions, type SpendControlResult, } from "./spend-control.js";
|
|
26
|
-
export
|
|
27
|
-
export { createTwzrdPolicyFetch, TwzrdPolicyAbortError } from "./policy-fetch.js";
|
|
28
|
-
export type { CreateTwzrdPolicyFetchInput } from "./policy-fetch.js";
|
|
23
|
+
export { createFileSpendLedger } from "./spend-ledger-file.js";
|
|
29
24
|
export { runGateAdoptionProof, main as adoptionProofMain, ADOPTION_TRANSCRIPT_SCHEMA, ADOPTION_PROOF_SELLER, ADOPTION_PROOF_NETWORK, ADOPTION_PROOF_RESOURCE, type GateAdoptionTranscript, type GateAdoptionStep, type GateAdoptionAssertions, type GateAdoptionLineage, type RunGateAdoptionProofOptions, } from "./adoption-proof.js";
|
|
30
25
|
export { quickCheck, QUICK_PRICE_USDC, type QuickCheckResult, type QuickCheckOptions, type TwzrdTier, } from "./quick.js";
|
|
31
26
|
export { createSponsoredX402Fetch, type SponsorSettle, type SponsoredX402Options, } from "./sponsored.js";
|
|
@@ -34,9 +29,8 @@ export { canonicalJson, intentHash, toMicroUsd, fromMicroUsd, INTENT_HASH_PREFIX
|
|
|
34
29
|
export { assertIntentApproved, createDecisionRegistry, createLocalDecisionSigner, createSeededDecisionSigner, decisionPreimage, MAX_CITED_OUTCOMES, newDecisionId, normalizeCitedOutcomes, signDecision, verifyDecisionSignature, TwzrdIntentBindingError, type AssertIntentApprovedOptions, type BindingErrorCode, type DecisionConstraints, type DecisionRegistry, type DecisionSigner, type PaymentDecision, type PaymentDecisionVerdict, } from "./decision-token.js";
|
|
35
30
|
export { buildBlockedNeverSignedAttestation, buildOutcomeAttestation, computeDecisionOutcomeLeafV1, DECISION_OUTCOME_V1_DOMAIN, verifyOutcomeAttestationSignature, type DecisionOutcomeAttestation, type DecisionOutcomeFields, type OutcomeKind, type OutcomeVerdict, } from "./outcome-attestation.js";
|
|
36
31
|
export { createMemorySpendLedger, evaluateIntent, POLICY_VERSION, TWZRD_BUDGET_EXCEEDED, type CounterpartyIntelligence, type EvaluateIntentOptions, type IntelligenceProvider, type Mandate, type SpendLedger, type SpendPolicy, } from "./policy-runtime.js";
|
|
37
|
-
export { createFileSpendLedger } from "./spend-ledger-file.js";
|
|
38
32
|
export { ap2CheckoutToIntent, x402RequirementsToIntent, type Ap2Cart, type Ap2UserMandate, type X402IntentContext, } from "./intent-adapters.js";
|
|
39
|
-
export { createTwzrdMppOnChallenge, mppChallengeToIntent, mppChallengeDigest,
|
|
33
|
+
export { createTwzrdMppOnChallenge, mppChallengeToIntent, mppChallengeDigest, NATIVE_SOL_CURRENCY, TwzrdMppBlockError, type MppChallenge, type MppIntentContext, type MppOnChallengeHelpers, type MppOnChallengeOptions, type MppSolanaChargeRequest, } from "./mpp-hook.js";
|
|
40
34
|
export { approvalToIntelligence, counterpartyKnownFromApproval, createTwzrdIntelligenceProvider, intentAmountToPriceUsd, type TwzrdIntelligenceOptions, } from "./intelligence.js";
|
|
41
35
|
export { createTwzrdSettleGuard, defaultExtractPayer, extractSvmPayerFromTransaction, twzrdPayerScreen, toPayaiVerifyResult, type SettleGuardContext, type SettleGuardAbort, type SettleGuardResult, type PayerScreen, type ScreenFn, type GetPayerFn, type SettleGuardOptions, } from "./seller-hook.js";
|
|
42
36
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,KAAK,mBAAmB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAChH,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,GAChC,MAAM,cAAc,CAAC;AACtB,Y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