@fidesbuild/sub 0.0.0-stage → 0.2.1

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 CHANGED
@@ -1,3 +1,49 @@
1
- # Temporary Holding Version
1
+ # @fidesbuild/sub
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
+ FIDES is a Transaction Builder for autonomous agents. SUB-FIDES is scoped agent-to-agent delegation: an agent working under a FIDES hands part of its authority to another agent, and the contract makes sure the child can never exceed the parent.
4
+
5
+ ## Get started
6
+
7
+ The fastest way to try it is the guided tour, which includes SUB-FIDES:
8
+
9
+ ```bash
10
+ npm install @fidesbuild/sdk viem
11
+ npx @fidesbuild/sdk init
12
+ npm run delegate
13
+ ```
14
+
15
+ `npx @fidesbuild/sub` prints this guide. In your own code:
16
+
17
+ ```bash
18
+ npm install @fidesbuild/sub @fidesbuild/sdk viem
19
+ ```
20
+
21
+ ```ts
22
+ import { createSubClient, SubFidesKit, SubAgent } from "@fidesbuild/sub"
23
+ import { Fides, deployAccount } from "@fidesbuild/sdk"
24
+
25
+ const client = createSubClient({ chainId: 4663, rpc }) // V2 FIDES Accounts, which can delegate
26
+
27
+ // the owner signs a FIDES for agent A, on a V2 account
28
+ await deployAccount(client, owner, owner.address)
29
+ const parent = await (await Fides.create(client, { owner: owner.address, agent: agentA.address, expiry, limits, targets })).sign(owner)
30
+
31
+ // agent A hands agent B a slice: its own budget, contracts and expiry, inside A's
32
+ const sub = await SubFidesKit.sign(SubFidesKit.create(parent, { agent: agentB.address, spend: [{ asset: USDG, amount: 20_000000n }] }), agentA, client, parent)
33
+
34
+ // agent B acts on its own key, inside its slice
35
+ const b = new SubAgent({ client, parent, sub, agent: agentB, relayer })
36
+ await b.execute(await b.plan(actions))
37
+ ```
38
+
39
+ - A slice bigger than the parent, a contract or function the parent does not allow, or an expiry past the parent's is refused when the SUB-FIDES is made, and again by the contract.
40
+ - Everything a child spends also counts against the parent, so no set of children can exceed what the owner signed.
41
+ - The owner or the parent agent can revoke a child; revoking the parent stops every child.
42
+ - The child has its own nonces, and every action it takes traces back to the owner's signature.
43
+
44
+ ## Links
45
+
46
+ - Docs: https://fidesbuilder.xyz/docs
47
+ - App: https://fidesbuilder.xyz/app
48
+
49
+ MIT licensed.