@fangorn-network/sdk 2026.3.11 → 2026.3.28

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.
Files changed (89) hide show
  1. package/README.md +311 -198
  2. package/lib/builders/a2aCardBuilder.js +1 -0
  3. package/lib/cli/cli.d.ts +0 -0
  4. package/lib/cli/cli.js +399 -380
  5. package/lib/cli/index.d.ts +170 -170
  6. package/lib/cli/index.js +1 -4
  7. package/lib/config.d.ts +543 -163
  8. package/lib/config.js +11 -8
  9. package/lib/fangorn.d.ts +31 -43
  10. package/lib/fangorn.js +101 -117
  11. package/lib/index.d.ts +8 -5
  12. package/lib/index.js +8 -7
  13. package/lib/modules/encryption/index.d.ts +4 -3
  14. package/lib/modules/encryption/lit.d.ts +3 -18
  15. package/lib/modules/encryption/lit.js +20 -49
  16. package/lib/modules/encryption/rand.js +2 -2
  17. package/lib/modules/encryption/types.d.ts +23 -8
  18. package/lib/modules/gadgets/settledGadget.d.ts +31 -0
  19. package/lib/modules/gadgets/settledGadget.js +75 -0
  20. package/lib/modules/gadgets/types.d.ts +16 -4
  21. package/lib/providers/storage/index.d.ts +15 -4
  22. package/lib/providers/storage/pinata/index.d.ts +5 -4
  23. package/lib/providers/storage/pinata/index.js +17 -2
  24. package/lib/providers/storage/storacha/index.d.ts +13 -0
  25. package/lib/providers/storage/storacha/index.js +49 -0
  26. package/lib/providers/storage/storacha/readOnly.d.ts +8 -0
  27. package/lib/providers/storage/storacha/readOnly.js +16 -0
  28. package/lib/{interface → registries}/datasource-registry/abi.d.ts +29 -43
  29. package/lib/registries/datasource-registry/abi.js +16 -0
  30. package/lib/registries/datasource-registry/index.d.ts +24 -0
  31. package/lib/{interface/datasource-registry/dataSourceRegistry.js → registries/datasource-registry/index.js} +35 -34
  32. package/lib/registries/index.d.ts +3 -0
  33. package/lib/registries/index.js +4 -0
  34. package/lib/registries/schema-registry/abi.d.ts +127 -0
  35. package/lib/registries/schema-registry/abi.js +19 -0
  36. package/lib/registries/schema-registry/index.d.ts +29 -0
  37. package/lib/registries/schema-registry/index.js +114 -0
  38. package/lib/registries/settlement-registry/abi.d.ts +228 -0
  39. package/lib/registries/settlement-registry/abi.js +29 -0
  40. package/lib/registries/settlement-registry/index.d.ts +72 -0
  41. package/lib/registries/settlement-registry/index.js +316 -0
  42. package/lib/registries/settlement-registry/types.d.ts +51 -0
  43. package/lib/roles/consumer/index.d.ts +64 -0
  44. package/lib/roles/consumer/index.js +114 -0
  45. package/lib/roles/consumer/types.d.ts +66 -0
  46. package/lib/roles/index.js +1 -0
  47. package/lib/roles/publisher/index.d.ts +68 -0
  48. package/lib/roles/publisher/index.js +205 -0
  49. package/lib/roles/publisher/types.d.ts +93 -0
  50. package/lib/roles/publisher/types.js +1 -0
  51. package/lib/roles/schema/index.d.ts +44 -0
  52. package/lib/roles/schema/index.js +137 -0
  53. package/lib/roles/schema/types.d.ts +67 -0
  54. package/lib/roles/schema/types.js +1 -0
  55. package/lib/test/index.d.ts +5 -2
  56. package/lib/test/index.js +5 -3
  57. package/lib/test/testbed.d.ts +52 -32
  58. package/lib/test/testbed.js +138 -137
  59. package/lib/types/index.d.ts +65 -21
  60. package/lib/types/index.js +1 -12
  61. package/lib/utils/index.d.ts +2 -3
  62. package/lib/utils/index.js +4 -18
  63. package/package.json +85 -81
  64. package/lib/cli/registry.d.ts +0 -29
  65. package/lib/cli/registry.js +0 -53
  66. package/lib/deployContract.d.ts +0 -23
  67. package/lib/deployContract.js +0 -78
  68. package/lib/interface/datasource-registry/abi.js +0 -110
  69. package/lib/interface/datasource-registry/dataSourceRegistry.d.ts +0 -24
  70. package/lib/interface/index.d.ts +0 -3
  71. package/lib/interface/index.js +0 -4
  72. package/lib/interface/manifest.d.ts +0 -7
  73. package/lib/interface/manifest.js +0 -10
  74. package/lib/interface/settlement-tracker/abi.d.ts +0 -26
  75. package/lib/interface/settlement-tracker/abi.js +0 -88
  76. package/lib/interface/settlement-tracker/settlementTracker.d.ts +0 -32
  77. package/lib/interface/settlement-tracker/settlementTracker.js +0 -64
  78. package/lib/modules/gadgets/acc/gadgets.d.ts +0 -7
  79. package/lib/modules/gadgets/acc/gadgets.js +0 -10
  80. package/lib/modules/gadgets/acc.d.ts +0 -15
  81. package/lib/modules/gadgets/acc.js +0 -24
  82. package/lib/modules/gadgets/builder.d.ts +0 -1
  83. package/lib/modules/gadgets/payment.d.ts +0 -23
  84. package/lib/modules/gadgets/payment.js +0 -88
  85. package/lib/test/test-gadget.d.ts +0 -7
  86. package/lib/test/test-gadget.js +0 -10
  87. /package/lib/{modules/gadgets/builder.js → registries/settlement-registry/types.js} +0 -0
  88. /package/lib/{providers/storage/s3/index.js → roles/consumer/types.js} +0 -0
  89. /package/lib/{providers/storage/s3 → roles}/index.d.ts +0 -0
package/README.md CHANGED
@@ -1,276 +1,389 @@
1
- # Fangorn
1
+ # Fangorn SDK
2
2
 
3
- Programmable data.
3
+ Intent-bound encrypted data for the agentic web.
4
4
 
5
- ## Overview
6
-
7
- Fangorn is a programmable data framework that lets you **register datasources** and **publish encrypted data** under public conditions, or predicates, such that it can only be decrypted if you meet the condition(s).
5
+ Fangorn lets you publish data encrypted under programmable access conditions — called **gadgets** — so it can only be decrypted by a party that satisfies them. Data is organized by **schemas**, enabling agent-based discovery across any number of publishers.
8
6
 
9
7
  ## Supported Networks
10
8
 
11
- Fangorn can be deployed on any EVM chain that has a brige to Lit protocol. Currently, contracts are deployed to both Arbitrum Sepolia and Base Sepolia. See the [contracts](#contracts) section for more info.
9
+ Arbitrum Sepolia (Base Sepolia in progress).
12
10
 
13
- ## Usage
11
+ ---
14
12
 
15
- Fangorn is a programmable data framework. It provides tools to register data sources that can be accessed based on owner-defined conditions, like payment.
13
+ ## Installation
16
14
 
17
- ## CLI/Quickstart
15
+ ```sh
16
+ npm i @fangorn-network/sdk
17
+ ```
18
18
 
19
- To install the fangorn-sdk from NPM, run:
19
+ ---
20
20
 
21
- ```shell
22
- npm i -g fangorn-sdk
23
- ```
21
+ ## CLI Quickstart
22
+
23
+ Install globally and initialize:
24
24
 
25
- ### Register a Datasource
25
+ ```sh
26
+ npm i -g @fangorn-network/sdk
27
+ fangorn init
28
+ ```
26
29
 
27
- First register a datasource
30
+ - `fangorn init` prompts for a wallet private key, Pinata JWT, Pinata gateway URL, and default chain. Config is written to `~/.fangorn/config.json`.
31
+ - You can also configure via environment variables instead of `fangorn init`:
28
32
 
29
33
  ```sh
30
- fangorn register name-of-your-datasource-agent
34
+ DELEGATOR_ETH_PRIVATE_KEY=0x...
35
+ # if you use pinata over storacha
36
+ PINATA_JWT=...
37
+ PINATA_GATEWAY=https://your-gateway.mypinata.cloud
38
+ # else email for storacha
39
+ STORACHA_EMAIL=...
40
+ CHAIN_NAME=arbitrumSepolia
31
41
  ```
32
42
 
33
- ### Upload Data
43
+ ### Register a Schema
34
44
 
35
- On upload, data is encrypted under a user-specified **gadget**. For now, the CLI only supports the payment gadget, which is used by specifying the argument `-g "Payment(amount)"`. The minimum amount is `0.000001`.
45
+ ```sh
46
+ # Registers an ERC-8004 agent identity and a schema
47
+ fangorn schema register <name>
36
48
 
37
- For `-c`, the CLI supports both arbitrumSepolia and baseSepolia.
49
+ # Skip agent registration
50
+ fangorn schema register <name> --skip-erc
51
+
52
+ # Fetch a registered schema by name
53
+ fangorn schema get schema.name.v1
54
+ ```
55
+
56
+ ### Publish Data
38
57
 
39
58
  ```sh
40
- fangorn upload name-of-your-datasource-agent file-to-upload.ext -c arbitrumSepolia -g "Payment(0.0001)"
59
+ # Encrypt and publish files under a schema, priced at 1 USDC unit
60
+ fangorn publish upload file.ext -s schema.name.v1 -p 1
61
+
62
+ # List your manifest entries for a schema
63
+ fangorn publish list -s schema.name.v1
64
+
65
+ # Inspect a specific entry
66
+ fangorn publish entry track1 -s schema.name.v1
41
67
  ```
42
68
 
43
- ### Decrypt and Download
69
+ > A price of `1` equals the smallest USDC unit (0.000001 USDC).
70
+
71
+ ### Consume Data
72
+
73
+ The consumer flow is three phases: **purchase => claim => decrypt**.
44
74
 
45
75
  ```sh
46
- fangorn decrypt [owner] [datasourceName] [tag] -c arbitrumSepolia
76
+ # Phase 1: pay and join the sempaphore group group
77
+ fangorn consume purchase <owner> <tag> \
78
+ -s schema.name.v1 \
79
+ --burner-key 0x... \
80
+ --amount 1 \
81
+ --usdc 0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d
82
+
83
+ # Save the identity string printed by purchase — required for the next steps.
84
+
85
+ # Phase 2: prove membership and claim access (generates a Groth16 ZK proof)
86
+ fangorn consume claim <owner> <tag> \
87
+ -s schema.name.v1 \
88
+ --identity '<identity-string>' \
89
+ --stealth <stealth-address>
90
+
91
+ # Phase 3: decrypt a specific field
92
+ fangorn consume decrypt <owner> <tag> \
93
+ -s schema.name.v1 \
94
+ -f audio \
95
+ --nullifier <nullifier> \
96
+ --stealth-key 0x... \
97
+ -o output.mp3
98
+
99
+ # List a publisher's manifest
100
+ fangorn consume list -s schema.name.v1 --owner <address>
101
+
102
+ # Inspect a publisher's entry
103
+ fangorn consume entry track1 -s schema.name.v1 --owner <address>
47
104
  ```
48
105
 
49
- ## Full Guide
106
+ ---
50
107
 
51
- ### Build
108
+ ## SDK Usage
52
109
 
53
- `pnpm i`
110
+ ### Initialization
54
111
 
55
- ### Setup
112
+ ```ts
113
+ import { Fangorn, FangornConfig } from "@fangorn-network/sdk";
56
114
 
57
- ```js
58
- // provide the account, rpcurl, and chain externally
59
- // Initalize a wallet client
60
- const walletClient = createWalletClient({
61
- account,
62
- transport: http(rpcUrl),
63
- chain,
115
+ const fangorn = await Fangorn.create({
116
+ privateKey: "0x...",
117
+ storage: { pinata: { jwt: "...", gateway: "https://your-gateway.mypinata.cloud" } },
118
+ encryption: { lit: true },
119
+ config: FangornConfig.ArbitrumSepolia,
120
+ domain: "localhost",
64
121
  });
65
- // For ArbSep, also supports BaseSepolia (wallet client must match)
66
- const config: AppConfig = FangornConfig.ArbitrumSepolia;
67
- // and the encryption service
68
- const encryptionService = new LitEncryptionService(chain);
69
-
70
- // setup the storage client
71
- const pinata = new PinataSDK({
72
- pinataJwt: jwt,
73
- pinataGateway: gateway,
122
+ ```
123
+
124
+ **Storage options:**
125
+
126
+ | Config | Mode |
127
+ |---|---|
128
+ | `{ pinata: { jwt, gateway } }` | Read + write |
129
+ | `{ storacha: { email } }` | Read + write |
130
+ | `{ storacha: { readOnly: true } }` | Read only |
131
+
132
+ ### Schemas
133
+
134
+ A `SchemaDefinition` is a JSON object where each field declares its type. Fields marked `@type: "encrypted"` are automatically encrypted by the SDK at publish time. All other fields are stored in plaintext. The `gadget` hint on an encrypted field tells the SDK which access condition to apply.
135
+
136
+ ```ts
137
+ // Define a schema
138
+ const definition: SchemaDefinition = {
139
+ title: { "@type": "string" },
140
+ artist: { "@type": "string" },
141
+ audio: { "@type": "encrypted", gadget: "settled" }, // field-level encryption
142
+ cover: { "@type": "file" }, // plaintext
143
+ };
144
+
145
+ // Register an ERC-8004 agent identity
146
+ const { agentId } = await fangorn.schema.registerAgent({
147
+ name: "schema.agent.name.v1",
148
+ description: "Music streaming data source agent",
74
149
  });
75
- // we only support pinata right now, more to come
76
- const storage = new PinataStorage(pinata);
77
150
 
78
- // the domain/webserver where Fangorn is used
79
- const domain = "localhost";
151
+ // Register the schema on-chain
152
+ const { schemaId, schemaCid } = await fangorn.schema.register({
153
+ name: "schema.name.v1",
154
+ definition,
155
+ agentId,
156
+ });
80
157
 
81
- const fangorn = await Fangorn.init(
82
- walletClient,
83
- storage,
84
- encryptionService,
85
- domain,
86
- config,
158
+ // Fetch a schema by name
159
+ const schema = await fangorn.schema.get("schema.name.v1");
160
+ ```
161
+
162
+ When a record conforming to this schema is published, Fangorn encrypts each `@type: "encrypted"` field and replaces its value with a ciphertext handle and a gadget descriptor:
163
+
164
+ ```json
165
+ // Input record
166
+ {
167
+ "tag": "track1",
168
+ "fields": {
169
+ "title": "Cassini Division",
170
+ "artist": "Arca",
171
+ "audio": { "data": "<bytes>", "fileType": "audio/mp3" }
172
+ }
173
+ }
174
+
175
+ // Stored manifest entry (audio field encrypted)
176
+ {
177
+ "tag": "track1",
178
+ "fields": {
179
+ "title": "Cassini Division",
180
+ "artist": "Arca",
181
+ "audio": {
182
+ "@type": "encrypted",
183
+ "handle": {
184
+ "cid": "bafkrei...",
185
+ "gateway": "your-gateway.mypinata.cloud"
186
+ },
187
+ "gadgetDescriptor": {
188
+ "type": "settled",
189
+ "description": "Settlement-gated: SettlementRegistry.isSettled(resourceId, caller)",
190
+ "params": {
191
+ "resourceId": "0xce16c0...",
192
+ "settlementRegistryAddress": "0x4536881306ee355c2f18ae81658771c4488139a3",
193
+ "chainName": "arbitrumSepolia"
194
+ }
195
+ }
196
+ }
197
+ }
198
+ }
199
+ ```
200
+
201
+ The `gadgetDescriptor` is human- and agent-readable: it describes exactly what a consumer must do to unlock the field. Plaintext fields (`title`, `artist`) remain directly readable in the manifest without any purchase flow.
202
+
203
+ ### Publishing
204
+
205
+ Each upload encrypts files via the gadget returned by `gadgetFactory`, pins the manifest to IPFS, and commits the new CID on-chain. Subsequent uploads merge with the existing manifest unless `overwrite` is set.
206
+
207
+ ```ts
208
+ import { SettledGadget } from "@fangorn-network/sdk/gadgets";
209
+ import { SettlementRegistry } from "@fangorn-network/sdk/registries";
210
+
211
+ const owner = fangorn.getAddress();
212
+
213
+ await fangorn.publisher.upload(
214
+ {
215
+ records: [
216
+ { tag: "track1", field: "audio", data: audioBytes, extension: ".mp3", fileType: "audio/mpeg" },
217
+ { tag: "track1", field: "cover", data: imageBytes, extension: ".png", fileType: "image/png" },
218
+ ],
219
+ schema: schemaDefinition,
220
+ schemaId,
221
+ gateway: "https://your-gateway.mypinata.cloud",
222
+ gadgetFactory: (tag) =>
223
+ new SettledGadget({
224
+ resourceId: SettlementRegistry.deriveResourceId(owner, schemaId, tag),
225
+ settlementRegistryAddress: FangornConfig.ArbitrumSepolia.settlementRegistryContractAddress,
226
+ chainName: "arbitrumSepolia",
227
+ pinataJwt: "...",
228
+ }),
229
+ },
230
+ 1n, // price in smallest USDC units
87
231
  );
88
232
  ```
89
233
 
90
- ### Datasource Registration
234
+ ### Consuming
91
235
 
92
- Now that you have a Fangorn client, you can create a _datasource_. A datasource is an on-chain asset that stores a commitment to its storage root along with an optional `agentId` field for associating the datasource with an ERC-8004 identity.
236
+ #### Phase 1: Purchase
93
237
 
94
- ```js
95
- const name = "demo";
96
- // id = sha256(name || owner), agentId = ""
97
- const id = await this.delegatorFangorn.registerDataSource(name, "");
98
- ```
238
+ ```ts
239
+ import { Identity } from "@semaphore-protocol/identity";
240
+
241
+ const identity = new Identity();
99
242
 
100
- ### Encryption
101
-
102
- Once a datasource exists, the owner can update its storage root to point it to data. Fangorn leverages Lit protocol for encryption and access control.
103
-
104
- Encryption works by specifying a [gadget](./src/modules/gadgets/README.md), code that represents a logical statement that you want to encrypt under. The gadgets framework is extensible and customizable, allowing for easy custom implementations. For now, we have three gadgets:
105
-
106
- - empty wallet: must have an empty wallet to decrypt
107
- - identity: must have a specific identity to decrypt
108
- - payment: must submit a specific payment to decrypt
109
-
110
- ```js
111
- // configure data using a json array, note that all data in this array will be encrypted under the same condition
112
- // each entry has as (tag, data, extension, fileTpe)
113
- let filedata = [
114
- {
115
- tag: "test0",
116
- data: "content0",
117
- extension: ".txt",
118
- fileType: "text/plain",
119
- },
120
- {
121
- tag: "test1",
122
- data: "content1",
123
- extension: ".png",
124
- fileType: "image/png",
125
- },
126
- ];
127
-
128
- // this encrypts the file under a USDC payment condition, useful for x402
129
- await fangorn.upload(datasourceName, filedata, async (file) => {
130
- const commitment = await computeTagCommitment(
131
- this.delegatorAddress,
132
- datasourceName,
133
- file.tag,
134
- usdcPrice,
135
- );
136
- return new PaymentGadget({
137
- commitment: fieldToHex(commitment),
138
- chainName: this.config.chainName,
139
- settlementTrackerContractAddress,
140
- usdcPrice,
141
- });
243
+ // Sign ERC-3009 authorization with the burner wallet
244
+ const preparedRegister = await fangorn.consumer.prepareRegister({
245
+ burnerPrivateKey: "0x...",
246
+ paymentRecipient: ownerAddress,
247
+ amount: 1n,
248
+ usdcAddress: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
249
+ usdcDomainName: "USD Coin",
250
+ usdcDomainVersion: "2",
142
251
  });
252
+
253
+ // Submit payment and join the Semaphore group
254
+ const { txHash } = await fangorn.consumer.register({
255
+ owner: ownerAddress,
256
+ schemaId,
257
+ tag: "track1",
258
+ identityCommitment: identity.commitment,
259
+ relayerPrivateKey: "0x...",
260
+ preparedRegister,
261
+ });
262
+
263
+ // Save identity.export(). Required for Phase 2 and 3
143
264
  ```
144
265
 
145
- ### Decryption
266
+ #### Phase 2: Claim
146
267
 
147
- Decryption mandates that the caller has met the condition specified by the ciphertext. If unknown, the condition can be decoded by fetching the entry from storage (pinata) in which we store a `gadgetDescriptor`, providing pertinent information about the gadget used to encrypt the plaintext and how to satisfy it.
268
+ ```ts
269
+ // Generate Groth16 ZK proof of group membership
270
+ const preparedSettle = await fangorn.consumer.prepareSettle({
271
+ resourceId: SettlementRegistry.deriveResourceId(ownerAddress, schemaId, "track1"),
272
+ identity,
273
+ stealthAddress: "0x...",
274
+ });
148
275
 
149
- ```js
150
- // the address of the owner of the datasource
151
- const owner = "0xabc123...";
152
- // the name of the datasource
153
- const name = "demo";
154
- // the tag of the data we want to fetch
155
- const tag = "test0";
276
+ // Submit the proof and trigger the hook call (if configured)
277
+ const { txHash, nullifier } = await fangorn.consumer.claim({
278
+ owner: ownerAddress,
279
+ schemaId,
280
+ tag: "track1",
281
+ relayerPrivateKey: "0x...",
282
+ preparedSettle,
283
+ });
156
284
 
157
- const plaintext = await fangorn.decryptFile(owner, name, tag);
158
- const outputAsString = new TextDecoder().decode(output);
159
- console.log("we got the plaintext " + outputAsString);
285
+ // Store nullifier. required for Phase 3.
160
286
  ```
161
287
 
162
- ## Testing
288
+ #### Phase 3: Decrypt
163
289
 
164
- ### Unit Tests
290
+ ```ts
291
+ import { createWalletClient, http } from "viem";
292
+ import { privateKeyToAccount } from "viem/accounts";
293
+ import { arbitrumSepolia } from "viem/chains";
165
294
 
166
- Run the tests with:
295
+ const walletClient = createWalletClient({
296
+ account: privateKeyToAccount(stealthPrivateKey),
297
+ chain: arbitrumSepolia,
298
+ transport: http(rpcUrl),
299
+ });
167
300
 
168
- ```sh
169
- pnpm test
301
+ const plaintext = await fangorn.consumer.decrypt({
302
+ owner: ownerAddress,
303
+ walletClient,
304
+ schemaId,
305
+ nullifierHash: nullifier,
306
+ tag: "track1",
307
+ field: "audio",
308
+ identity,
309
+ });
170
310
  ```
171
311
 
172
- ### E2E tests
312
+ ### Gadgets
173
313
 
174
- #### Setup
314
+ Gadgets define the access control condition baked into encryption. Built-in gadgets:
175
315
 
176
- The e2e test suite requires various environment variables that must be manually configured. In addition, it must be executed on an actual testnet in order to establish comms with Lit protocol.
316
+ | Gadget | Condition |
317
+ |---|---|
318
+ | `SettledGadget` | Caller must complete a USDC payment + ZK claim flow |
177
319
 
178
- Testnet tokens (ETH on Base Sepolia) can be obtained from Coinbase's official faucet https://portal.cdp.coinbase.com/
320
+ More coming soon ;)
179
321
 
180
- 1. `cp .env.example .env`
181
- 2. Fill in the ENVs:
182
- - `DELEGATOR_ETH_PRIVATE_KEY`: The private key of the delegator account
183
- - Needs to have a balance of test ETH to send transactions
184
- - `DELEGATEE_ETH_PRIVATE_KEY`: The private key of the delegatee account
185
- - Needs to have a balance of test ETH to send transactions
322
+ See the [gadgets](./src/modules/gadgets/README.md) docs for details on implementing your own gadgets.
186
323
 
187
- - `PINATA_JWT`: The JWT for Pinata
188
- - Can be obtained from: https://app.pinata.cloud/developers/api-keys
189
- - `PINATA_GATEWAY`: The gateway for Pinata
190
- - Can use your own gateway or the default 'https://gateway.pinata.cloud'
191
- - `CHAIN_NAME`: arbitrumSepolia or baseSepolia
192
- - `CAIP2`: The CAIP-2 identifier for the network.
193
- - 421614 for Arbitrum Sepolia, 84532 for Base Sepolia
194
- - `CHAIN_RPC_URL`: The RPC URL of the chain
195
- - Expected to be Base sepolia testnet: https://base-sepolia-public.nodies.app or Arbitrum Sepolia: https://sepolia-rollup.arbitrum.io/rpc
196
- - `USDC_CONTRACT_ADDRESS`: The address of the deployed USDC contract
197
- - 0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d for Arbitrum Sepolia 0x036CbD53842c5426634e7929541eC2318f3dCF7e for Base Sepolia
198
- - `DS_REGISTRY_ADDR`: The address of the deployed data registry contract
199
- - Can be deployed by the test script, else use 0x5bd547ce3b5964c2fc0325f523679f66de391d6f for Arbitrum Sepolia and 0x6fd0e50073dbd8169bcaf066bb4a4991bfa48eeb on Base Sepolia
200
- - `SETTLEMENT_TRACKER_ADDR`: The address of the deployed settlement tracker contract address. This is only needed if you plan to run tests using the payment gadget.
201
- - Can be deployed by the test script, else use 0x7c6ae9eb3398234eb69b2f3acfae69065505ff69 for Arbitrum Sepolia
324
+ ---
202
325
 
203
- Sample:
326
+ ## Contracts
204
327
 
205
- For Arbitrum Sepolia
328
+ ### Arbitrum Sepolia
206
329
 
207
- ```sh
208
- CHAIN_NAME=arbitrumSepolia
209
- CAIP2=421614
210
- CHAIN_RPC_URL=https://sepolia-rollup.arbitrum.io/rpc
211
- USDC_CONTRACT_ADDRESS=0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d
212
- DS_REGISTRY_ADDR=0x602aedafe1096004d4db591b6537bc39d7ac71a6
213
- SETTLEMENT_TRACKER_ADDR=0x7c6ae9eb3398234eb69b2f3acfae69065505ff69
214
- ```
330
+ | Contract | Address |
331
+ |---|---|
332
+ | DataSource Registry | `0x3941c7d50caa56f7f676554bc4e78d77aaf27ebb` |
333
+ | Schema Registry | `0x49ab3d52b997e63ad56c91178df48263fd80b2dc` |
334
+ | Settlement Registry | `0x4536881306ee355c2f18ae81658771c4488139a3` |
215
335
 
216
- For Base Sepolia
336
+ ---
217
337
 
218
- ```sh
219
- CHAIN_NAME=baseSepolia
220
- CAIP2=84532
221
- CHAIN_RPC_URL=https://base-sepolia-public.nodies.app
222
- USDC_CONTRACT_ADDRESS=0x036CbD53842c5426634e7929541eC2318f3dCF7e
223
- DS_REGISTRY_ADDR=0x6fd0e50073dbd8169bcaf066bb4a4991bfa48eeb
224
- SETTLEMENT_TRACKER_ADDR=0x708751829f5f5f584da4142b62cd5cc9235c8a18
225
- ```
338
+ ## Testing
226
339
 
227
- ### Running the tests
340
+ ### Unit Tests
228
341
 
229
- `pnpm test:e2e`
342
+ ```sh
343
+ pnpm test
344
+ ```
230
345
 
231
- The tests will:
346
+ ### E2E Tests
232
347
 
233
- 1. Build and deploy the solidity verifier to base sepolia (unless it is defined in .env)
234
- 2. Upload the Lit Action to IPFS (unless it is defined in .env)
348
+ Copy the example env and fill in values:
235
349
 
236
- ## Contracts
350
+ ```sh
351
+ cp env.example .env
352
+ pnpm test:e2e
353
+ ```
237
354
 
238
- | | Arbitrum Sepolia | Base Sepolia |
239
- | -------------------------------------- | ------------------------------------------------------------ | -------------------------------------------------------------- |
240
- | Datsource Registry Contract Deployment | 0x602aedafe1096004d4db591b6537bc39d7ac71a6 | 0x6fd0e50073dbd8169bcaf066bb4a4991bfa48eeb |
241
- | Datsource Registry Contract Code | [lib.rs](./contracts/arbitrum/DatasourceRegistry/src/lib.rs) | [DSRegistry.sol](./contracts/src/DSRegistry.sol) |
242
- | Settlement Tracker Contract Deployment | 0x7c6ae9eb3398234eb69b2f3acfae69065505ff69 | 0x708751829f5f5f584da4142b62cd5cc9235c8a18 |
243
- | Settlement Tracker Contract Code | [lib.rs](./contracts/arbitrum/SettlementTracker//src/lib.rs) | [SettlementTracker.sol](./contracts/src/SettlementTracker.sol) |
355
+ Required variables:
244
356
 
245
- ## CLI
357
+ | Variable | Description |
358
+ |---|---|
359
+ | `DELEGATOR_ETH_PRIVATE_KEY` | Publisher private key (needs testnet ETH) |
360
+ | `DELEGATEE_ETH_PRIVATE_KEY` | Consumer private key |
361
+ | `PINATA_JWT` | Pinata API JWT |
362
+ | `PINATA_GATEWAY` | Pinata gateway URL |
363
+ | `CHAIN_NAME` | `arbitrumSepolia` |
364
+ | `CAIP2` | `421614` |
365
+ | `CHAIN_RPC_URL` | RPC endpoint |
366
+ | `USDC_CONTRACT_ADDRESS` | USDC contract address |
367
+ | `DS_REGISTRY_ADDR` | DataSourceRegistry address |
368
+ | `SCHEMA_REGISTRY_ADDR` | SchemaRegistry address |
369
+ | `SETTLEMENT_TRACKER_ADDR` | SettlementTracker address |
246
370
 
247
- To install locally:
371
+ Sample `.env` for Arbitrum Sepolia:
248
372
 
249
373
  ```sh
250
- chmod +x update_cli.sh
251
- ./update_cli.sh
374
+ CHAIN_NAME=arbitrumSepolia
375
+ CAIP2=421614
376
+ CHAIN_RPC_URL=https://sepolia-rollup.arbitrum.io/rpc
377
+ USDC_CONTRACT_ADDRESS=0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d
378
+ DS_REGISTRY_ADDR=0x6fb3579bfd504cce85b923db335dfc096d912478
379
+ SCHEMA_REGISTRY_ADDR=0x49ab3d52b997e63ad56c91178df48263fd80b2dc
380
+ SETTLEMENT_TRACKER_ADDR=0x7c6ae9eb3398234eb69b2f3acfae69065505ff69
252
381
  ```
253
382
 
254
- ```sh
255
- Usage: Fangorn [options] [command]
256
-
257
- CLI for Fangorn
258
-
259
- Options:
260
- -V, --version output the version number
261
- -h, --help display help for command
262
-
263
- Commands:
264
- init Configure your Fangorn credentials
265
- register [options] <name> Register a new datasource as an agent.
266
- upload [options] <name> <files...> Upload file(s) to a data source
267
- list [options] <name> List contents (index) of a data source
268
- info [options] <name> Get data source info from contract
269
- entry [options] <name> <tag> Get info about a specific entry
270
- decrypt [options] <owner> <name> <tag> Decrypt a file from a vault
271
- help [command] display help for command
272
- ```
383
+ E2E tests deploy any contracts not defined in `.env`, register a test schema, publish manifests, and verify the full purchase → claim → decrypt cycle end-to-end.
384
+
385
+ ---
273
386
 
274
387
  ## License
275
388
 
276
- MIT
389
+ MIT
@@ -74,6 +74,7 @@ var AgentCardBuilder = class {
74
74
  tags
75
75
  };
76
76
  if (examples) skill.examples = examples;
77
+ this.card.skills ??= [];
77
78
  this.card.skills.push(skill);
78
79
  return this;
79
80
  }
package/lib/cli/cli.d.ts CHANGED
File without changes