@unslept/sdk 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Unslept contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,42 @@
1
- # Temporary Holding Version
1
+ # @unslept/sdk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Pay x402 paywalls from an Unslept agent account on Robinhood Chain. The client catches HTTP 402, checks the
4
+ agent's on-chain spending policy, settles the payment from the Unslept buffer and retries the request with the
5
+ payment proof.
6
+
7
+ ```sh
8
+ npm install @unslept/sdk viem
9
+ ```
10
+
11
+ ```ts
12
+ import { Unslept } from "@unslept/sdk";
13
+ import { privateKeyToAccount } from "viem/accounts";
14
+
15
+ const unslept = new Unslept({
16
+ agentAccount: process.env.UNSLEPT_AGENT_ACCOUNT,
17
+ signer: privateKeyToAccount(process.env.UNSLEPT_SIGNER_KEY as `0x${string}`),
18
+ network: "robinhood-chain",
19
+ });
20
+
21
+ const res = await unslept.fetch("https://example.com/paid-resource", undefined, { maxAmount: 50_000n }); // 0.05 USDG
22
+ ```
23
+
24
+ ## Configuration
25
+
26
+ The `robinhood-chain` preset reads its chain settings from the environment:
27
+
28
+ ```sh
29
+ # Robinhood Chain mainnet. Addresses are published in contracts/deployments/4663.json.
30
+ UNSLEPT_CHAIN_ID=4663
31
+ UNSLEPT_RPC_URL=https://rpc.mainnet.chain.robinhood.com
32
+ UNSLEPT_USDG=0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168
33
+ UNSLEPT_ROUTER=0x1FeAB3B8f88FB0667B686fDCB0206194e88c984b
34
+ UNSLEPT_BUFFERS=0xcD853fb30eCe3134Cf21e2f47B9e23eaf965F40D
35
+ ```
36
+
37
+ ## Errors
38
+
39
+ Policy refusals throw `UnsleptError` with a code: `PER_CALL_CAP`, `DAILY_CAP`, `PAYEE_NOT_ALLOWED`,
40
+ `AGENT_PAUSED`, `AGENT_REVOKED` or `MAX_AMOUNT`.
41
+
42
+ Unslept is experimental software on a guarded, unaudited mainnet launch. Yield is variable and not guaranteed. Give each agent a small daily cap.