@weftlabs/sdk 0.26.1 → 0.26.3
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 +28 -0
- package/dist/facilitator/middleware/index.js +1 -1
- package/dist/facilitator/middleware/index.js.map +1 -1
- package/dist/facilitator/middleware/index.mjs +1 -1
- package/dist/facilitator/middleware/index.mjs.map +1 -1
- package/dist/index.d.mts +111 -100
- package/dist/index.d.ts +111 -100
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +1 -1
- package/dist/server.mjs.map +1 -1
- package/docs/FetchResponse.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,6 +83,34 @@ console.log({ idempotencyKey, artifact });
|
|
|
83
83
|
Do not create a new key for a retry of the same logical purchase. The CLI
|
|
84
84
|
generates a key automatically and returns it in its success envelope.
|
|
85
85
|
|
|
86
|
+
## Retrieve a wallet-protected result
|
|
87
|
+
|
|
88
|
+
For an x402 Sign-In-With-X (SIWX) result endpoint, use the same buyer credential
|
|
89
|
+
as the paid submission and set an explicit zero ceiling:
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
const result = await weft.fetch(
|
|
93
|
+
{
|
|
94
|
+
url: "https://merchant.example/runs/your-run-id",
|
|
95
|
+
method: "GET",
|
|
96
|
+
maxCostUsd: "0",
|
|
97
|
+
},
|
|
98
|
+
{ idempotencyKey: "poll-your-run-id" },
|
|
99
|
+
);
|
|
100
|
+
console.log(result.paymentStatus, result.artifactId, result.bodyBase64);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Weft signs a fresh, resource-bound challenge with the buyer wallet. No local
|
|
104
|
+
wallet key is needed. The provider must support smart-wallet signatures and
|
|
105
|
+
issue a valid HTTPS challenge for the requested resource. Retrieval never
|
|
106
|
+
falls back to payment. Success returns `paymentStatus: "not_required"`,
|
|
107
|
+
`paidUsd: "0.00"`, and null `heldUsd` and `txHash`.
|
|
108
|
+
|
|
109
|
+
Repeat this GET until the provider reports a terminal job state. Polls read
|
|
110
|
+
fresh provider state even when the idempotency key is repeated. Do not repeat
|
|
111
|
+
the paid submission to poll. `SIWX_RETRIEVAL_FAILED` means the challenge was
|
|
112
|
+
unsafe or authentication failed; keep the zero ceiling when investigating.
|
|
113
|
+
|
|
86
114
|
## CLI
|
|
87
115
|
|
|
88
116
|
The `weft` executable is published separately as `@weftlabs/cli`.
|