@fangorn-network/sdk 2026.8.12-dev → 2026.8.18-dev

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 (37) hide show
  1. package/README.md +175 -62
  2. package/lib/cli/cli.d.ts +0 -0
  3. package/lib/cli/cli.js +290 -17
  4. package/lib/config.d.ts +9 -8
  5. package/lib/config.js +6 -8
  6. package/lib/contracts/app-registry/abi.d.ts +466 -0
  7. package/lib/contracts/app-registry/abi.js +529 -0
  8. package/lib/contracts/app-registry/index.d.ts +139 -0
  9. package/lib/contracts/app-registry/index.js +271 -0
  10. package/lib/contracts/data-registry/abi.d.ts +124 -125
  11. package/lib/contracts/data-registry/abi.js +145 -142
  12. package/lib/contracts/data-registry/index.d.ts +16 -14
  13. package/lib/contracts/data-registry/index.js +19 -50
  14. package/lib/contracts/index.d.ts +8 -3
  15. package/lib/contracts/index.js +8 -3
  16. package/lib/contracts/settlement-registry/abi.d.ts +430 -11
  17. package/lib/contracts/settlement-registry/abi.js +528 -41
  18. package/lib/contracts/settlement-registry/index.d.ts +148 -10
  19. package/lib/contracts/settlement-registry/index.js +233 -9
  20. package/lib/contracts/subscription-registry/abi.d.ts +179 -0
  21. package/lib/contracts/subscription-registry/abi.js +195 -0
  22. package/lib/contracts/subscription-registry/index.d.ts +59 -0
  23. package/lib/contracts/subscription-registry/index.js +116 -0
  24. package/lib/contracts/types.d.ts +8 -0
  25. package/lib/contracts/types.js +10 -0
  26. package/lib/contracts/write.d.ts +27 -0
  27. package/lib/contracts/write.js +55 -0
  28. package/lib/crypto/encryption.js +4 -4
  29. package/lib/engine/index.d.ts +14 -12
  30. package/lib/engine/index.js +13 -7
  31. package/lib/fangorn.d.ts +35 -5
  32. package/lib/fangorn.js +49 -6
  33. package/lib/index.d.ts +8 -3
  34. package/lib/index.js +8 -3
  35. package/lib/test/testbed.js +9 -3
  36. package/lib/types/index.d.ts +6 -0
  37. package/package.json +72 -85
package/lib/fangorn.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { AppConfig } from "./config.js";
2
2
  import { DataRegistryClient, PreparedTx } from "./contracts/data-registry/index.js";
3
+ import { AppRegistryClient } from "./contracts/app-registry/index.js";
4
+ import { SettlementRegistryClient } from "./contracts/settlement-registry/index.js";
5
+ import { SubscriptionRegistryClient } from "./contracts/subscription-registry/index.js";
3
6
  import "./contracts/index.js";
4
7
  import { MetadataStorage } from "./providers/storage/types.js";
5
8
  import { CommitDiff, FangornEngine, MetagraphRegistry, NamespaceContents, NamespaceDiff } from "./engine/index.js";
@@ -8,16 +11,12 @@ import { AppFeed } from "./feed.js";
8
11
  import { Hex, WalletClient } from "viem";
9
12
 
10
13
  //#region src/fangorn.d.ts
11
- /** One namespace-scoped update surfaced by `subscribe`. */
12
14
  interface NamespaceChange extends NamespaceDiff {
13
15
  namespace: string;
14
16
  owner: Hex;
15
- /** The commit CID (string) this update settled to — the new on-chain tip. */
16
17
  commitCid: string;
17
- /** Raw on-chain roots this delta spans (`oldRoot` → `newRoot`). */
18
18
  oldRoot: Hex;
19
19
  newRoot: Hex;
20
- /** Block the `StateCommitted` event landed in — persist as the resume cursor. */
21
20
  blockNumber: bigint;
22
21
  }
23
22
  interface SubscribeOptions {
@@ -42,12 +41,18 @@ declare class Fangorn {
42
41
  private _feed;
43
42
  /**
44
43
  * The namespace cache
45
- * Insertion order = LRU order; see `readNamespace`.
44
+ * Insertion order = LRU order
46
45
  */
47
46
  private readonly nsCache;
48
47
  private constructor();
49
48
  get engine(): FangornEngine;
50
49
  get metagraph(): MetagraphRegistry;
50
+ /**
51
+ * Static creation of a new Fangorn client
52
+ *
53
+ * @param options
54
+ * @returns the client
55
+ */
51
56
  static create(options: FangornCreateOptions): Fangorn;
52
57
  /**
53
58
  * Resets a namespace's onchain state root to zero.
@@ -56,6 +61,13 @@ declare class Fangorn {
56
61
  */
57
62
  reset(namespace: string): Promise<void>;
58
63
  /**
64
+ * TODO: this isn't really needed here, it's cosmetic
65
+ * instead, what if we moved this to a new paradigm where...
66
+ *
67
+ * each app registers as an ERC-8004 agent with the validation registry
68
+ * pointing to these rules essentially?
69
+ *
70
+ *
59
71
  * Register permissive (no required fields) schemas for every tag/relation a
60
72
  * staged graph uses, unless the caller has already registered stricter rules
61
73
  * via `this.metagraph` directly — schema ids are free-form tags by default.
@@ -283,6 +295,24 @@ declare class Fangorn {
283
295
  private toNamespaceChange;
284
296
  getConfig(): AppConfig;
285
297
  getDataRegistry(): DataRegistryClient;
298
+ /**
299
+ * Apps, their publisher terms, and per-app membership.
300
+ *
301
+ * `commitStateRoot` cross-calls this contract, so joining the app here is a
302
+ * precondition for publishing under it — `registerForApp()` before
303
+ * `commit()`, or the commit reverts `NotRegisteredForApp`.
304
+ */
305
+ getAppRegistry(): AppRegistryClient;
306
+ /**
307
+ * The publisher-side storage paywall. Per-wallet, not per-app: one
308
+ * subscription covers everything this publisher writes, under every app.
309
+ */
310
+ getSubscriptionRegistry(): SubscriptionRegistryClient;
311
+ /**
312
+ * The consumer-side pay-then-read rail. Resources are keyed by owner+uid, so
313
+ * this client is app-agnostic too.
314
+ */
315
+ getSettlementRegistry(): SettlementRegistryClient;
286
316
  /** The app (global namespace) this client publishes and reads under. */
287
317
  getAppId(): Hex;
288
318
  /**
package/lib/fangorn.js CHANGED
@@ -2,7 +2,10 @@ import { DEFAULT_APP, FangornConfig, toAppId } from "./config.js";
2
2
  import { SignedUrlBackend } from "./providers/storage/signed-url.js";
3
3
  import { PinataBackend } from "./providers/storage/pinata.js";
4
4
  import { FangornEngine, MetagraphRegistry, assertValidNamespace, rootHexFromCid } from "./engine/index.js";
5
+ import { AppRegistryClient } from "./contracts/app-registry/index.js";
5
6
  import { DataRegistryClient, subspaceId } from "./contracts/data-registry/index.js";
7
+ import { SettlementRegistryClient } from "./contracts/settlement-registry/index.js";
8
+ import { SubscriptionRegistryClient } from "./contracts/subscription-registry/index.js";
6
9
  import "./contracts/index.js";
7
10
  import { AppFeed } from "./feed.js";
8
11
  import { createPublicClient, createWalletClient, http } from "viem";
@@ -11,10 +14,7 @@ import { CID } from "multiformats/cid";
11
14
 
12
15
  //#region src/fangorn.ts
13
16
  const ZERO_BYTES32 = "0x0000000000000000000000000000000000000000000000000000000000000000";
14
- /** Max namespaces held in TODO
15
- * `readNamespace`'s tip-keyed cache. */
16
17
  const NS_CACHE_MAX = 256;
17
- /** Build a signer for the access worker's ownership handshake from a wallet. */
18
18
  function walletSigner(walletClient) {
19
19
  const account = walletClient.account;
20
20
  if (!account) throw new Error("Signed-url storage requires a wallet account to sign the access worker's challenge.");
@@ -39,7 +39,7 @@ var Fangorn = class Fangorn {
39
39
  _feed = null;
40
40
  /**
41
41
  * The namespace cache
42
- * Insertion order = LRU order; see `readNamespace`.
42
+ * Insertion order = LRU order
43
43
  */
44
44
  nsCache = /* @__PURE__ */ new Map();
45
45
  constructor(ctx) {
@@ -53,6 +53,12 @@ var Fangorn = class Fangorn {
53
53
  get metagraph() {
54
54
  return this._metagraph;
55
55
  }
56
+ /**
57
+ * Static creation of a new Fangorn client
58
+ *
59
+ * @param options
60
+ * @returns the client
61
+ */
56
62
  static create(options) {
57
63
  if (!options.privateKey && !options.walletClient) throw new Error("Either privateKey or walletClient must be provided");
58
64
  const resolvedConfig = options.config ?? FangornConfig;
@@ -64,11 +70,15 @@ var Fangorn = class Fangorn {
64
70
  const metadataStorage = resolveStorage(options.storage, walletClient, resolvedConfig);
65
71
  const domain = options.domain ?? new URL(resolvedConfig.rpcUrl).hostname;
66
72
  const publicClient = createPublicClient({ transport: http(resolvedConfig.rpcUrl) });
73
+ const appId = toAppId(options.appId ?? DEFAULT_APP);
67
74
  return new Fangorn({
68
75
  walletClient,
69
76
  metadataStorage,
70
77
  domain,
71
- dataRegistry: new DataRegistryClient(resolvedConfig.dataRegistryContractAddress, toAppId(options.appId ?? DEFAULT_APP), publicClient, walletClient),
78
+ dataRegistry: new DataRegistryClient(resolvedConfig.dataRegistryContractAddress, appId, publicClient, walletClient),
79
+ appRegistry: new AppRegistryClient(resolvedConfig.appRegistryContractAddress, appId, publicClient, walletClient),
80
+ subscriptionRegistry: new SubscriptionRegistryClient(resolvedConfig.subscriptionRegistryContractAddress, publicClient, walletClient),
81
+ settlementRegistry: new SettlementRegistryClient(resolvedConfig.settlementRegistryContractAddress, publicClient, walletClient),
72
82
  config: resolvedConfig
73
83
  });
74
84
  }
@@ -83,6 +93,13 @@ var Fangorn = class Fangorn {
83
93
  await registry.commitStateRoot(namespace, currentRoot, ZERO_BYTES32);
84
94
  }
85
95
  /**
96
+ * TODO: this isn't really needed here, it's cosmetic
97
+ * instead, what if we moved this to a new paradigm where...
98
+ *
99
+ * each app registers as an ERC-8004 agent with the validation registry
100
+ * pointing to these rules essentially?
101
+ *
102
+ *
86
103
  * Register permissive (no required fields) schemas for every tag/relation a
87
104
  * staged graph uses, unless the caller has already registered stricter rules
88
105
  * via `this.metagraph` directly — schema ids are free-form tags by default.
@@ -494,6 +511,30 @@ var Fangorn = class Fangorn {
494
511
  getDataRegistry() {
495
512
  return this.ctx.dataRegistry;
496
513
  }
514
+ /**
515
+ * Apps, their publisher terms, and per-app membership.
516
+ *
517
+ * `commitStateRoot` cross-calls this contract, so joining the app here is a
518
+ * precondition for publishing under it — `registerForApp()` before
519
+ * `commit()`, or the commit reverts `NotRegisteredForApp`.
520
+ */
521
+ getAppRegistry() {
522
+ return this.ctx.appRegistry;
523
+ }
524
+ /**
525
+ * The publisher-side storage paywall. Per-wallet, not per-app: one
526
+ * subscription covers everything this publisher writes, under every app.
527
+ */
528
+ getSubscriptionRegistry() {
529
+ return this.ctx.subscriptionRegistry;
530
+ }
531
+ /**
532
+ * The consumer-side pay-then-read rail. Resources are keyed by owner+uid, so
533
+ * this client is app-agnostic too.
534
+ */
535
+ getSettlementRegistry() {
536
+ return this.ctx.settlementRegistry;
537
+ }
497
538
  /** The app (global namespace) this client publishes and reads under. */
498
539
  getAppId() {
499
540
  return this.ctx.dataRegistry.getAppId();
@@ -509,7 +550,9 @@ var Fangorn = class Fangorn {
509
550
  * from `subscribe`/`subscribeApp` keep their original filter until aborted.
510
551
  */
511
552
  setAppId(nameOrId) {
512
- this.ctx.dataRegistry.setAppId(toAppId(nameOrId));
553
+ const appId = toAppId(nameOrId);
554
+ this.ctx.dataRegistry.setAppId(appId);
555
+ this.ctx.appRegistry.setAppId(appId);
513
556
  this.nsCache.clear();
514
557
  this._feed = null;
515
558
  }
package/lib/index.d.ts CHANGED
@@ -1,8 +1,13 @@
1
1
  import { AppConfig, DEFAULT_APP, FangornConfig, SupportedNetworks, appId, toAppId } from "./config.js";
2
+ import { APP_REGISTRY_ABI } from "./contracts/app-registry/abi.js";
3
+ import { PublisherStatus } from "./contracts/types.js";
4
+ import { CommitFilter, DataRegistryClient, PreparedTx, StateCommittedLog, namespaceKey, subspaceId } from "./contracts/data-registry/index.js";
5
+ import { AppJoinInfo, AppRegistryClient, needsReacceptance } from "./contracts/app-registry/index.js";
2
6
  import { DATA_REGISTRY_ABI } from "./contracts/data-registry/abi.js";
3
- import { CommitFilter, DataRegistryClient, PreparedTx, PublisherStatus, StateCommittedLog, namespaceKey, subspaceId } from "./contracts/data-registry/index.js";
4
- import { SettlementRegistryClient } from "./contracts/settlement-registry/index.js";
7
+ import { Resource, SemaphoreProof, SettlementRegistryClient, TransferAuthorization, packResourceUri, resourceIdOf } from "./contracts/settlement-registry/index.js";
5
8
  import { SETTLEMENT_REGISTRY_ABI } from "./contracts/settlement-registry/abi.js";
9
+ import { SubscriptionAccess, SubscriptionRegistryClient } from "./contracts/subscription-registry/index.js";
10
+ import { SUBSCRIPTION_REGISTRY_ABI } from "./contracts/subscription-registry/abi.js";
6
11
  import "./contracts/index.js";
7
12
  import { AccessRequest, AccessSigner, DecryptHandleParams, EncryptAndUploadParams, GADGET_SELF_HKDF_V1, GADGET_WORKER_USDC_V1, Gadget, HandleFieldInput, X25519_PUBKEY_LENGTH, accessMessageHash, buildAccessRequest, decryptHandle, encryptAndUpload, seal, sealSelf, sha256Hex, unseal, unsealSelf } from "./crypto/encryption.js";
8
13
  import { FangornContext, FangornCreateOptions, StorageConfig } from "./types/index.js";
@@ -12,4 +17,4 @@ import { AssetProcessor, BuildAssetGraphOptions, CommitFileGraph, Edge, FileFaca
12
17
  import { PinataBackend } from "./providers/storage/pinata.js";
13
18
  import { DEFAULT_SIGNED_URL_WORKER, SignedUrlBackend, SignedUrlSigner } from "./providers/storage/signed-url.js";
14
19
  import { MAX_UPLOAD_ATTEMPTS, deserialize, fetchRawByCid, isTransientUpload, retrieveByCid, serialize, withUploadRetry } from "./providers/storage/utils.js";
15
- export { AccessRequest, AccessSigner, AppConfig, AppFeed, AssetProcessor, BuildAssetGraphOptions, CommitFileGraph, CommitFilter, DATA_REGISTRY_ABI, DEFAULT_APP, DEFAULT_SIGNED_URL_WORKER, DataRegistryClient, DecryptHandleParams, Edge, EncryptAndUploadParams, Fangorn, FangornConfig, FangornContext, FangornCreateOptions, FileFacade, GADGET_SELF_HKDF_V1, GADGET_WORKER_USDC_V1, Gadget, HandleFieldInput, MAX_UPLOAD_ATTEMPTS, NamespaceChange, PinataBackend, PreparedTx, ProcessorResult, PublisherStatus, SETTLEMENT_REGISTRY_ABI, SettlementRegistryClient, SignedUrlBackend, SignedUrlSigner, StateCommittedLog, StorageConfig, SubscribeOptions, SupportedNetworks, Vertex, X25519_PUBKEY_LENGTH, accessMessageHash, appId, buildAccessRequest, buildAssetGraph, buildMarkdownGraph, decryptHandle, deserialize, encryptAndUpload, extractMarkdownLinks, fetchRawByCid, isTransientUpload, namespaceKey, retrieveByCid, seal, sealSelf, serialize, sha256Hex, subspaceId, toAppId, unseal, unsealSelf, withUploadRetry };
20
+ export { APP_REGISTRY_ABI, AccessRequest, AccessSigner, AppConfig, AppFeed, AppJoinInfo, AppRegistryClient, AssetProcessor, BuildAssetGraphOptions, CommitFileGraph, CommitFilter, DATA_REGISTRY_ABI, DEFAULT_APP, DEFAULT_SIGNED_URL_WORKER, DataRegistryClient, DecryptHandleParams, Edge, EncryptAndUploadParams, Fangorn, FangornConfig, FangornContext, FangornCreateOptions, FileFacade, GADGET_SELF_HKDF_V1, GADGET_WORKER_USDC_V1, Gadget, HandleFieldInput, MAX_UPLOAD_ATTEMPTS, NamespaceChange, PinataBackend, PreparedTx, ProcessorResult, PublisherStatus, Resource, SETTLEMENT_REGISTRY_ABI, SUBSCRIPTION_REGISTRY_ABI, SemaphoreProof, SettlementRegistryClient, SignedUrlBackend, SignedUrlSigner, StateCommittedLog, StorageConfig, SubscribeOptions, SubscriptionAccess, SubscriptionRegistryClient, SupportedNetworks, TransferAuthorization, Vertex, X25519_PUBKEY_LENGTH, accessMessageHash, appId, buildAccessRequest, buildAssetGraph, buildMarkdownGraph, decryptHandle, deserialize, encryptAndUpload, extractMarkdownLinks, fetchRawByCid, isTransientUpload, namespaceKey, needsReacceptance, packResourceUri, resourceIdOf, retrieveByCid, seal, sealSelf, serialize, sha256Hex, subspaceId, toAppId, unseal, unsealSelf, withUploadRetry };
package/lib/index.js CHANGED
@@ -2,14 +2,19 @@ import { DEFAULT_APP, FangornConfig, SupportedNetworks, appId, toAppId } from ".
2
2
  import { DEFAULT_SIGNED_URL_WORKER, SignedUrlBackend } from "./providers/storage/signed-url.js";
3
3
  import { MAX_UPLOAD_ATTEMPTS, deserialize, fetchRawByCid, isTransientUpload, retrieveByCid, serialize, withUploadRetry } from "./providers/storage/utils.js";
4
4
  import { PinataBackend } from "./providers/storage/pinata.js";
5
+ import { APP_REGISTRY_ABI } from "./contracts/app-registry/abi.js";
6
+ import { PublisherStatus } from "./contracts/types.js";
7
+ import { AppRegistryClient, needsReacceptance } from "./contracts/app-registry/index.js";
5
8
  import { DATA_REGISTRY_ABI } from "./contracts/data-registry/abi.js";
6
- import { DataRegistryClient, PublisherStatus, namespaceKey, subspaceId } from "./contracts/data-registry/index.js";
9
+ import { DataRegistryClient, namespaceKey, subspaceId } from "./contracts/data-registry/index.js";
7
10
  import { SETTLEMENT_REGISTRY_ABI } from "./contracts/settlement-registry/abi.js";
8
- import { SettlementRegistryClient } from "./contracts/settlement-registry/index.js";
11
+ import { SettlementRegistryClient, packResourceUri, resourceIdOf } from "./contracts/settlement-registry/index.js";
12
+ import { SUBSCRIPTION_REGISTRY_ABI } from "./contracts/subscription-registry/abi.js";
13
+ import { SubscriptionRegistryClient } from "./contracts/subscription-registry/index.js";
9
14
  import "./contracts/index.js";
10
15
  import { AppFeed } from "./feed.js";
11
16
  import { Fangorn } from "./fangorn.js";
12
17
  import { buildAssetGraph, buildMarkdownGraph, extractMarkdownLinks } from "./harness/index.js";
13
18
  import { GADGET_SELF_HKDF_V1, GADGET_WORKER_USDC_V1, X25519_PUBKEY_LENGTH, accessMessageHash, buildAccessRequest, decryptHandle, encryptAndUpload, seal, sealSelf, sha256Hex, unseal, unsealSelf } from "./crypto/encryption.js";
14
19
 
15
- export { AppFeed, DATA_REGISTRY_ABI, DEFAULT_APP, DEFAULT_SIGNED_URL_WORKER, DataRegistryClient, Fangorn, FangornConfig, GADGET_SELF_HKDF_V1, GADGET_WORKER_USDC_V1, MAX_UPLOAD_ATTEMPTS, PinataBackend, PublisherStatus, SETTLEMENT_REGISTRY_ABI, SettlementRegistryClient, SignedUrlBackend, SupportedNetworks, X25519_PUBKEY_LENGTH, accessMessageHash, appId, buildAccessRequest, buildAssetGraph, buildMarkdownGraph, decryptHandle, deserialize, encryptAndUpload, extractMarkdownLinks, fetchRawByCid, isTransientUpload, namespaceKey, retrieveByCid, seal, sealSelf, serialize, sha256Hex, subspaceId, toAppId, unseal, unsealSelf, withUploadRetry };
20
+ export { APP_REGISTRY_ABI, AppFeed, AppRegistryClient, DATA_REGISTRY_ABI, DEFAULT_APP, DEFAULT_SIGNED_URL_WORKER, DataRegistryClient, Fangorn, FangornConfig, GADGET_SELF_HKDF_V1, GADGET_WORKER_USDC_V1, MAX_UPLOAD_ATTEMPTS, PinataBackend, PublisherStatus, SETTLEMENT_REGISTRY_ABI, SUBSCRIPTION_REGISTRY_ABI, SettlementRegistryClient, SignedUrlBackend, SubscriptionRegistryClient, SupportedNetworks, X25519_PUBKEY_LENGTH, accessMessageHash, appId, buildAccessRequest, buildAssetGraph, buildMarkdownGraph, decryptHandle, deserialize, encryptAndUpload, extractMarkdownLinks, fetchRawByCid, isTransientUpload, namespaceKey, needsReacceptance, packResourceUri, resourceIdOf, retrieveByCid, seal, sealSelf, serialize, sha256Hex, subspaceId, toAppId, unseal, unsealSelf, withUploadRetry };
@@ -2,6 +2,7 @@ import { FangornConfig } from "../config.js";
2
2
  import { Fangorn } from "../fangorn.js";
3
3
 
4
4
  //#region src/test/testbed.ts
5
+ const TESTBED_APP_TERMS = "0x0000000000000000000000000000000000000000000000000000000000000002";
5
6
  var TestBed = class TestBed {
6
7
  constructor(f_list) {
7
8
  this.f_list = f_list;
@@ -40,10 +41,15 @@ var TestBed = class TestBed {
40
41
  * else already owns it: apps are shared, not per-test.
41
42
  */
42
43
  async registerApp(index) {
43
- const registry = this.getFangorn(index).getDataRegistry();
44
+ const registry = this.getFangorn(index).getAppRegistry();
44
45
  if (await registry.getAppOwner() === "0x0000000000000000000000000000000000000000") {
45
46
  console.log(`Registering app ${registry.getAppId()} on-chain...`);
46
- await registry.registerApp();
47
+ await registry.registerApp(TESTBED_APP_TERMS, "https://example.test/terms", 0n);
48
+ }
49
+ const self = this.getFangorn(index).getAddress();
50
+ if (!await registry.isRegisteredForApp(self)) {
51
+ console.log(`Joining app ${registry.getAppId()} as ${self}...`);
52
+ await registry.registerForApp();
47
53
  }
48
54
  }
49
55
  async register(index) {
@@ -70,7 +76,7 @@ var TestBed = class TestBed {
70
76
  }
71
77
  /** Owner of the configured app namespace, or the zero address if unclaimed. */
72
78
  async appOwner(index) {
73
- return this.getFangorn(index).getDataRegistry().getAppOwner();
79
+ return this.getFangorn(index).getAppRegistry().getAppOwner();
74
80
  }
75
81
  /** The raw on-chain head of one namespace — the slot the CAS actually guards. */
76
82
  async head(index, namespace) {
@@ -1,5 +1,8 @@
1
1
  import { AppConfig } from "../config.js";
2
2
  import { DataRegistryClient } from "../contracts/data-registry/index.js";
3
+ import { AppRegistryClient } from "../contracts/app-registry/index.js";
4
+ import { SettlementRegistryClient } from "../contracts/settlement-registry/index.js";
5
+ import { SubscriptionRegistryClient } from "../contracts/subscription-registry/index.js";
3
6
  import { MetadataStorage } from "../providers/storage/types.js";
4
7
  import { Hex, WalletClient } from "viem";
5
8
 
@@ -10,6 +13,9 @@ interface FangornContext {
10
13
  metadataStorage: MetadataStorage | undefined;
11
14
  domain: string;
12
15
  dataRegistry: DataRegistryClient;
16
+ appRegistry: AppRegistryClient;
17
+ subscriptionRegistry: SubscriptionRegistryClient;
18
+ settlementRegistry: SettlementRegistryClient;
13
19
  }
14
20
  type StorageConfig = {
15
21
  pinata: {
package/package.json CHANGED
@@ -1,86 +1,73 @@
1
1
  {
2
- "name": "@fangorn-network/sdk",
3
- "version": "2026.08.12-dev",
4
- "description": "Git for knowledge graphs",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/fangorn-network/fangorn.git"
8
- },
9
- "bin": {
10
- "fangorn": "lib/cli/cli.js"
11
- },
12
- "license": "MIT",
13
- "type": "module",
14
- "main": "lib/index.js",
15
- "files": [
16
- "lib/"
17
- ],
18
- "scripts": {
19
- "build": "tsdown",
20
- "format": "prettier . --write",
21
- "lint": "eslint . --max-warnings 0",
22
- "prepare": "husky",
23
- "test": "dotenvx run -f .env -- vitest run",
24
- "test:e2e": "dotenvx run -f .env -- vitest run --config vitest.e2e.config.ts",
25
- "tsc": "tsc",
26
- "deploy": "dotenvx run -f .env -- tsx deploy.ts",
27
- "setup:embeddings": "dotenvx run -f .env -- tsx src/test/setup-embeddings-testdata.ts",
28
- "cleanup:embeddings": "dotenvx run -f .env -- tsx src/test/cleanup-embeddings-testdata.ts",
29
- "prepare:cli": "npm run build",
30
- "fangorn": "dotenvx run -f .env -- node dist/src/cli/cli.js"
31
- },
32
- "lint-staged": {
33
- "*": "prettier --ignore-unknown --write"
34
- },
35
- "devDependencies": {
36
- "@dotenvx/dotenvx": "^1.51.1",
37
- "@eslint/js": "9.39.1",
38
- "@noble/ciphers": "^1.3.0",
39
- "@noble/curves": "^1.2.0",
40
- "@types/node": "24.10.1",
41
- "@vitest/coverage-v8": "4.0.15",
42
- "@vitest/eslint-plugin": "1.5.1",
43
- "eslint": "9.39.1",
44
- "husky": "9.1.7",
45
- "lint-staged": "16.2.7",
46
- "prettier": "3.7.3",
47
- "tsdown": "0.16.8",
48
- "tsx": "^4.21.0",
49
- "typescript": "5.8.3",
50
- "typescript-eslint": "8.48.1",
51
- "vitest": "^4.0.18"
52
- },
53
- "packageManager": "pnpm@10.4.0",
54
- "engines": {
55
- "node": ">=20.19.0"
56
- },
57
- "dependencies": {
58
- "@clack/prompts": "^1.0.1",
59
- "@ipld/car": "^5.4.6",
60
- "@ipld/dag-cbor": "^10.0.1",
61
- "@ipld/unixfs": "^3.0.0",
62
- "@noble/ciphers": "^1.3.0",
63
- "@noble/curves": "^1.9.7",
64
- "@noble/hashes": "^2.2.0",
65
- "commander": "^14.0.3",
66
- "dotenv": "^17.2.3",
67
- "multiformats": "^14.0.0",
68
- "pinata": "^2.5.2",
69
- "solc": "^0.8.28",
70
- "viem": "^2.47.1"
71
- },
72
- "overrides": {
73
- "viem": "$viem"
74
- },
75
- "pnpm": {
76
- "overrides": {
77
- "write-file-atomic": "7.0.0"
78
- },
79
- "peerDependencyRules": {
80
- "allowedVersions": {
81
- "viem": ">=2.38.3",
82
- "ethers": ">=5.7.2"
83
- }
84
- }
85
- }
86
- }
2
+ "name": "@fangorn-network/sdk",
3
+ "version": "2026.08.18-dev",
4
+ "description": "Git for knowledge graphs",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/fangorn-network/fangorn.git"
8
+ },
9
+ "bin": {
10
+ "fangorn": "lib/cli/cli.js"
11
+ },
12
+ "license": "MIT",
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "files": [
16
+ "lib/"
17
+ ],
18
+ "lint-staged": {
19
+ "*": "prettier --ignore-unknown --write"
20
+ },
21
+ "devDependencies": {
22
+ "@dotenvx/dotenvx": "^1.51.1",
23
+ "@eslint/js": "9.39.1",
24
+ "@noble/ciphers": "^1.3.0",
25
+ "@noble/curves": "^1.2.0",
26
+ "@types/node": "24.10.1",
27
+ "@vitest/coverage-v8": "4.0.15",
28
+ "@vitest/eslint-plugin": "1.5.1",
29
+ "eslint": "9.39.1",
30
+ "husky": "9.1.7",
31
+ "lint-staged": "16.2.7",
32
+ "prettier": "3.7.3",
33
+ "tsdown": "0.16.8",
34
+ "tsx": "^4.21.0",
35
+ "typescript": "5.8.3",
36
+ "typescript-eslint": "8.48.1",
37
+ "vitest": "^4.0.18"
38
+ },
39
+ "engines": {
40
+ "node": ">=20.19.0"
41
+ },
42
+ "dependencies": {
43
+ "@clack/prompts": "^1.0.1",
44
+ "@ipld/car": "^5.4.6",
45
+ "@ipld/dag-cbor": "^10.0.1",
46
+ "@ipld/unixfs": "^3.0.0",
47
+ "@noble/ciphers": "^1.3.0",
48
+ "@noble/curves": "^1.9.7",
49
+ "@noble/hashes": "^2.2.0",
50
+ "commander": "^14.0.3",
51
+ "dotenv": "^17.2.3",
52
+ "multiformats": "^14.0.0",
53
+ "pinata": "^2.5.2",
54
+ "solc": "^0.8.28",
55
+ "viem": "^2.47.1"
56
+ },
57
+ "overrides": {
58
+ "viem": "$viem"
59
+ },
60
+ "scripts": {
61
+ "build": "tsdown",
62
+ "format": "prettier . --write",
63
+ "lint": "eslint . --max-warnings 0",
64
+ "test": "dotenvx run -f .env -- vitest run",
65
+ "test:e2e": "dotenvx run -f .env -- vitest run --config vitest.e2e.config.ts",
66
+ "tsc": "tsc",
67
+ "deploy": "dotenvx run -f .env -- tsx deploy.ts",
68
+ "setup:embeddings": "dotenvx run -f .env -- tsx src/test/setup-embeddings-testdata.ts",
69
+ "cleanup:embeddings": "dotenvx run -f .env -- tsx src/test/cleanup-embeddings-testdata.ts",
70
+ "prepare:cli": "npm run build",
71
+ "fangorn": "dotenvx run -f .env -- node dist/src/cli/cli.js"
72
+ }
73
+ }