@vaubanworks/sdk 0.0.0-stage → 0.2.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 vaubanworks
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,82 @@
1
- # Temporary Holding Version
1
+ # @vaubanworks/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
+ TypeScript client for [Vauban](https://vauban.works) vaults on Robinhood Chain (4663), built on [viem](https://viem.sh).
4
+
5
+ A Vauban vault holds an agent's funds and checks every call against four ramparts: spend caps (ditch), an allowlist (curtain), a time-lock on large moves (gate) and an owner freeze (keep). This SDK is the agent's and the owner's side of that vault.
6
+
7
+ > **Not audited.** One empty reference vault is live at `0xf9322f1546de5a121cdc09522e70af79e30e4097`. Do not route real funds through a Vauban vault yet.
8
+
9
+ ```bash
10
+ npm install @vaubanworks/sdk viem
11
+ ```
12
+
13
+ ## Ask before you sign
14
+
15
+ `rule()` is a read-only dry run. It returns `"pass"` or `"hold"`, or throws `Refused` with the rampart that would stop the call. Nothing is signed or sent.
16
+
17
+ ```ts
18
+ import { createPublicClient, createWalletClient, http } from "viem";
19
+ import { privateKeyToAccount } from "viem/accounts";
20
+ import { VaubanAgent, Refused, robinhoodChain } from "@vaubanworks/sdk";
21
+
22
+ const transport = http();
23
+ const agent = new VaubanAgent({
24
+ vault: "0xYourVault",
25
+ public: createPublicClient({ chain: robinhoodChain, transport }),
26
+ wallet: createWalletClient({ chain: robinhoodChain, transport, account: privateKeyToAccount(process.env.AGENT_KEY as `0x${string}`) }),
27
+ });
28
+
29
+ try {
30
+ console.log(await agent.rule({ target: "0x000000000000000000000000000000000000dEaD", value: 10n ** 18n }));
31
+ } catch (e) {
32
+ if (e instanceof Refused) console.log(e.rampart, e.code, e.reason);
33
+ // curtain CurtainNotListed 0x…dEaD selector 0x00000000 is not on the allowlist
34
+ }
35
+ ```
36
+
37
+ ## Agent
38
+
39
+ ```ts
40
+ const r = await agent.execute({ target, value, data }); // simulated first, then sent
41
+ if (r.kind === "held") console.log("waits at the gate until", r.eta);
42
+ await agent.release(r.id, { target, value, data }); // after the delay
43
+ ```
44
+
45
+ `execute`, `release` and `rule` throw `Refused` before any gas is spent when a rampart would refuse. `transferToken` and `approveToken` are shortcuts for ERC-20 moves; unlimited approvals are always refused.
46
+
47
+ ## Owner
48
+
49
+ ```ts
50
+ import { VaubanOwner, NATIVE } from "@vaubanworks/sdk";
51
+ import { parseEther, toFunctionSelector } from "viem";
52
+
53
+ const owner = new VaubanOwner({ vault, public: pub, wallet: ownerWallet });
54
+ await owner.allow(router, [toFunctionSelector("buy()")]);
55
+ await owner.setLimits(NATIVE, { perTx: parseEther("0.1"), perHour: parseEther("0.3"), perDay: parseEther("1"), holdAbove: parseEther("0.05") });
56
+ await owner.freeze();
57
+ ```
58
+
59
+ Also: `disallow`, `setGateDelay`, `unfreeze`, `cancel` (a held move), `withdraw`.
60
+
61
+ ## Reading
62
+
63
+ `readState(pub, vault)` returns owner, agent, frozen, gate delay, revision and balance. `listHeld(pub, vault, fromBlock)` returns the moves waiting at the gate. `listAllowed(pub, vault)` returns the curtain as it stands: each target with the selectors the agent may call, confirmed against `allowed()`.
64
+
65
+ ## Deploying a vault
66
+
67
+ The creation bytecode is a separate entry point, so the main import stays small:
68
+
69
+ ```ts
70
+ import { vaubanVaultAbi } from "@vaubanworks/sdk";
71
+ import { vaubanVaultBytecode } from "@vaubanworks/sdk/bytecode";
72
+
73
+ await wallet.deployContract({ abi: vaubanVaultAbi, bytecode: vaubanVaultBytecode, args: [owner, agent, 21600n] });
74
+ ```
75
+
76
+ ## Known limits
77
+
78
+ - Caps are fixed clock-hour and UTC-day buckets, not rolling: up to twice one cap can pass across a boundary.
79
+ - Only `transfer`, `transferFrom`, `approve` and `increaseAllowance` amounts are decoded. Any other value-moving function you allowlist is not capped, so list only functions you trust.
80
+ - Held moves do not expire.
81
+
82
+ Source, contract and tests: [github.com/vaubandev/vauban](https://github.com/vaubandev/vauban). MIT.