@fangorn-network/sdk 2026.10.20-dev → 2026.10.21-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.
package/lib/config.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import * as viem1 from "viem";
1
+ import * as viem5576 from "viem";
2
2
  import { Chain, Hex } from "viem";
3
3
  import * as viem_chains0 from "viem/chains";
4
- import * as abitype0 from "abitype";
4
+ import * as abitype9 from "abitype";
5
5
 
6
6
  //#region src/config.d.ts
7
7
  /**
@@ -64,17 +64,17 @@ declare const FangornConfig: {
64
64
  testnet: true;
65
65
  custom?: Record<string, unknown> | undefined;
66
66
  extendSchema?: Record<string, unknown> | undefined;
67
- fees?: viem1.ChainFees<undefined> | undefined;
67
+ fees?: viem5576.ChainFees<undefined> | undefined;
68
68
  formatters?: undefined;
69
- prepareTransactionRequest?: ((args: viem1.PrepareTransactionRequestParameters, options: {
69
+ prepareTransactionRequest?: ((args: viem5576.PrepareTransactionRequestParameters, options: {
70
70
  phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
71
- }) => Promise<viem1.PrepareTransactionRequestParameters>) | [fn: ((args: viem1.PrepareTransactionRequestParameters, options: {
71
+ }) => Promise<viem5576.PrepareTransactionRequestParameters>) | [fn: ((args: viem5576.PrepareTransactionRequestParameters, options: {
72
72
  phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
73
- }) => Promise<viem1.PrepareTransactionRequestParameters>) | undefined, options: {
73
+ }) => Promise<viem5576.PrepareTransactionRequestParameters>) | undefined, options: {
74
74
  runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
75
75
  }] | undefined;
76
- serializers?: viem1.ChainSerializers<undefined, viem1.TransactionSerializable> | undefined;
77
- verifyHash?: ((client: viem1.Client, parameters: viem1.VerifyHashActionParameters) => Promise<viem1.VerifyHashActionReturnType>) | undefined;
76
+ serializers?: viem5576.ChainSerializers<undefined, viem5576.TransactionSerializable> | undefined;
77
+ verifyHash?: ((client: viem5576.Client, parameters: viem5576.VerifyHashActionParameters) => Promise<viem5576.VerifyHashActionReturnType>) | undefined;
78
78
  };
79
79
  rpcUrl: string;
80
80
  caip2: number;
@@ -159,7 +159,7 @@ declare const BaseSepoliaConfig: {
159
159
  testnet: true;
160
160
  custom?: Record<string, unknown> | undefined;
161
161
  extendSchema?: Record<string, unknown> | undefined;
162
- fees?: viem1.ChainFees<undefined> | undefined;
162
+ fees?: viem5576.ChainFees<undefined> | undefined;
163
163
  formatters: {
164
164
  readonly block: {
165
165
  exclude: [] | undefined;
@@ -168,28 +168,28 @@ declare const BaseSepoliaConfig: {
168
168
  blobGasUsed: bigint;
169
169
  difficulty: bigint;
170
170
  excessBlobGas: bigint;
171
- extraData: viem1.Hex;
171
+ extraData: viem5576.Hex;
172
172
  gasLimit: bigint;
173
173
  gasUsed: bigint;
174
174
  hash: `0x${string}` | null;
175
175
  logsBloom: `0x${string}` | null;
176
- miner: abitype0.Address;
177
- mixHash: viem1.Hash;
176
+ miner: abitype9.Address;
177
+ mixHash: viem5576.Hash;
178
178
  nonce: `0x${string}` | null;
179
179
  number: bigint | null;
180
180
  parentBeaconBlockRoot?: `0x${string}` | undefined;
181
- parentHash: viem1.Hash;
182
- receiptsRoot: viem1.Hex;
183
- sealFields: viem1.Hex[];
184
- sha3Uncles: viem1.Hash;
181
+ parentHash: viem5576.Hash;
182
+ receiptsRoot: viem5576.Hex;
183
+ sealFields: viem5576.Hex[];
184
+ sha3Uncles: viem5576.Hash;
185
185
  size: bigint;
186
- stateRoot: viem1.Hash;
186
+ stateRoot: viem5576.Hash;
187
187
  timestamp: bigint;
188
188
  totalDifficulty: bigint | null;
189
189
  transactions: `0x${string}`[] | viem_chains0.OpStackTransaction<boolean>[];
190
- transactionsRoot: viem1.Hash;
191
- uncles: viem1.Hash[];
192
- withdrawals?: viem1.Withdrawal[] | undefined | undefined;
190
+ transactionsRoot: viem5576.Hash;
191
+ uncles: viem5576.Hash[];
192
+ withdrawals?: viem5576.Withdrawal[] | undefined | undefined;
193
193
  withdrawalsRoot?: `0x${string}` | undefined;
194
194
  } & {};
195
195
  type: "block";
@@ -199,16 +199,16 @@ declare const BaseSepoliaConfig: {
199
199
  format: (args: viem_chains0.OpStackRpcTransaction, action?: string | undefined) => ({
200
200
  blockHash: `0x${string}` | null;
201
201
  blockNumber: bigint | null;
202
- from: abitype0.Address;
202
+ from: abitype9.Address;
203
203
  gas: bigint;
204
- hash: viem1.Hash;
205
- input: viem1.Hex;
204
+ hash: viem5576.Hash;
205
+ input: viem5576.Hex;
206
206
  nonce: number;
207
- r: viem1.Hex;
208
- s: viem1.Hex;
209
- to: abitype0.Address | null;
207
+ r: viem5576.Hex;
208
+ s: viem5576.Hex;
209
+ to: abitype9.Address | null;
210
210
  transactionIndex: number | null;
211
- typeHex: viem1.Hex | null;
211
+ typeHex: viem5576.Hex | null;
212
212
  v: bigint;
213
213
  value: bigint;
214
214
  yParity: number;
@@ -218,23 +218,23 @@ declare const BaseSepoliaConfig: {
218
218
  maxPriorityFeePerGas: bigint;
219
219
  isSystemTx?: boolean;
220
220
  mint?: bigint | undefined | undefined;
221
- sourceHash: viem1.Hex;
221
+ sourceHash: viem5576.Hex;
222
222
  type: "deposit";
223
223
  } | {
224
- r: viem1.Hex;
225
- s: viem1.Hex;
224
+ r: viem5576.Hex;
225
+ s: viem5576.Hex;
226
226
  v: bigint;
227
- to: abitype0.Address | null;
228
- from: abitype0.Address;
227
+ to: abitype9.Address | null;
228
+ from: abitype9.Address;
229
229
  gas: bigint;
230
230
  nonce: number;
231
231
  value: bigint;
232
232
  blockHash: `0x${string}` | null;
233
233
  blockNumber: bigint | null;
234
- hash: viem1.Hash;
235
- input: viem1.Hex;
234
+ hash: viem5576.Hash;
235
+ input: viem5576.Hex;
236
236
  transactionIndex: number | null;
237
- typeHex: viem1.Hex | null;
237
+ typeHex: viem5576.Hex | null;
238
238
  accessList?: undefined | undefined;
239
239
  authorizationList?: undefined | undefined;
240
240
  blobVersionedHashes?: undefined | undefined;
@@ -251,20 +251,20 @@ declare const BaseSepoliaConfig: {
251
251
  } | {
252
252
  blockHash: `0x${string}` | null;
253
253
  blockNumber: bigint | null;
254
- from: abitype0.Address;
254
+ from: abitype9.Address;
255
255
  gas: bigint;
256
- hash: viem1.Hash;
257
- input: viem1.Hex;
256
+ hash: viem5576.Hash;
257
+ input: viem5576.Hex;
258
258
  nonce: number;
259
- r: viem1.Hex;
260
- s: viem1.Hex;
261
- to: abitype0.Address | null;
259
+ r: viem5576.Hex;
260
+ s: viem5576.Hex;
261
+ to: abitype9.Address | null;
262
262
  transactionIndex: number | null;
263
- typeHex: viem1.Hex | null;
263
+ typeHex: viem5576.Hex | null;
264
264
  v: bigint;
265
265
  value: bigint;
266
266
  yParity: number;
267
- accessList: viem1.AccessList;
267
+ accessList: viem5576.AccessList;
268
268
  authorizationList?: undefined | undefined;
269
269
  blobVersionedHashes?: undefined | undefined;
270
270
  chainId: number;
@@ -279,20 +279,20 @@ declare const BaseSepoliaConfig: {
279
279
  } | {
280
280
  blockHash: `0x${string}` | null;
281
281
  blockNumber: bigint | null;
282
- from: abitype0.Address;
282
+ from: abitype9.Address;
283
283
  gas: bigint;
284
- hash: viem1.Hash;
285
- input: viem1.Hex;
284
+ hash: viem5576.Hash;
285
+ input: viem5576.Hex;
286
286
  nonce: number;
287
- r: viem1.Hex;
288
- s: viem1.Hex;
289
- to: abitype0.Address | null;
287
+ r: viem5576.Hex;
288
+ s: viem5576.Hex;
289
+ to: abitype9.Address | null;
290
290
  transactionIndex: number | null;
291
- typeHex: viem1.Hex | null;
291
+ typeHex: viem5576.Hex | null;
292
292
  v: bigint;
293
293
  value: bigint;
294
294
  yParity: number;
295
- accessList: viem1.AccessList;
295
+ accessList: viem5576.AccessList;
296
296
  authorizationList?: undefined | undefined;
297
297
  blobVersionedHashes?: undefined | undefined;
298
298
  chainId: number;
@@ -307,22 +307,22 @@ declare const BaseSepoliaConfig: {
307
307
  } | {
308
308
  blockHash: `0x${string}` | null;
309
309
  blockNumber: bigint | null;
310
- from: abitype0.Address;
310
+ from: abitype9.Address;
311
311
  gas: bigint;
312
- hash: viem1.Hash;
313
- input: viem1.Hex;
312
+ hash: viem5576.Hash;
313
+ input: viem5576.Hex;
314
314
  nonce: number;
315
- r: viem1.Hex;
316
- s: viem1.Hex;
317
- to: abitype0.Address | null;
315
+ r: viem5576.Hex;
316
+ s: viem5576.Hex;
317
+ to: abitype9.Address | null;
318
318
  transactionIndex: number | null;
319
- typeHex: viem1.Hex | null;
319
+ typeHex: viem5576.Hex | null;
320
320
  v: bigint;
321
321
  value: bigint;
322
322
  yParity: number;
323
- accessList: viem1.AccessList;
323
+ accessList: viem5576.AccessList;
324
324
  authorizationList?: undefined | undefined;
325
- blobVersionedHashes: readonly viem1.Hex[];
325
+ blobVersionedHashes: readonly viem5576.Hex[];
326
326
  chainId: number;
327
327
  type: "eip4844";
328
328
  gasPrice?: undefined | undefined;
@@ -335,21 +335,21 @@ declare const BaseSepoliaConfig: {
335
335
  } | {
336
336
  blockHash: `0x${string}` | null;
337
337
  blockNumber: bigint | null;
338
- from: abitype0.Address;
338
+ from: abitype9.Address;
339
339
  gas: bigint;
340
- hash: viem1.Hash;
341
- input: viem1.Hex;
340
+ hash: viem5576.Hash;
341
+ input: viem5576.Hex;
342
342
  nonce: number;
343
- r: viem1.Hex;
344
- s: viem1.Hex;
345
- to: abitype0.Address | null;
343
+ r: viem5576.Hex;
344
+ s: viem5576.Hex;
345
+ to: abitype9.Address | null;
346
346
  transactionIndex: number | null;
347
- typeHex: viem1.Hex | null;
347
+ typeHex: viem5576.Hex | null;
348
348
  v: bigint;
349
349
  value: bigint;
350
350
  yParity: number;
351
- accessList: viem1.AccessList;
352
- authorizationList: viem1.SignedAuthorizationList;
351
+ accessList: viem5576.AccessList;
352
+ authorizationList: viem5576.SignedAuthorizationList;
353
353
  blobVersionedHashes?: undefined | undefined;
354
354
  chainId: number;
355
355
  type: "eip7702";
@@ -368,22 +368,22 @@ declare const BaseSepoliaConfig: {
368
368
  format: (args: viem_chains0.OpStackRpcTransactionReceipt, action?: string | undefined) => {
369
369
  blobGasPrice?: bigint | undefined;
370
370
  blobGasUsed?: bigint | undefined;
371
- blockHash: viem1.Hash;
371
+ blockHash: viem5576.Hash;
372
372
  blockNumber: bigint;
373
373
  blockTimestamp?: bigint | undefined;
374
- contractAddress: abitype0.Address | null | undefined;
374
+ contractAddress: abitype9.Address | null | undefined;
375
375
  cumulativeGasUsed: bigint;
376
376
  effectiveGasPrice: bigint;
377
- from: abitype0.Address;
377
+ from: abitype9.Address;
378
378
  gasUsed: bigint;
379
- logs: viem1.Log<bigint, number, false>[];
380
- logsBloom: viem1.Hex;
379
+ logs: viem5576.Log<bigint, number, false>[];
380
+ logsBloom: viem5576.Hex;
381
381
  root?: `0x${string}` | undefined;
382
382
  status: "success" | "reverted";
383
- to: abitype0.Address | null;
384
- transactionHash: viem1.Hash;
383
+ to: abitype9.Address | null;
384
+ transactionHash: viem5576.Hash;
385
385
  transactionIndex: number;
386
- type: viem1.TransactionType;
386
+ type: viem5576.TransactionType;
387
387
  l1GasPrice: bigint | null;
388
388
  l1GasUsed: bigint | null;
389
389
  l1Fee: bigint | null;
@@ -392,17 +392,17 @@ declare const BaseSepoliaConfig: {
392
392
  type: "transactionReceipt";
393
393
  };
394
394
  };
395
- prepareTransactionRequest?: ((args: viem1.PrepareTransactionRequestParameters, options: {
395
+ prepareTransactionRequest?: ((args: viem5576.PrepareTransactionRequestParameters, options: {
396
396
  phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
397
- }) => Promise<viem1.PrepareTransactionRequestParameters>) | [fn: ((args: viem1.PrepareTransactionRequestParameters, options: {
397
+ }) => Promise<viem5576.PrepareTransactionRequestParameters>) | [fn: ((args: viem5576.PrepareTransactionRequestParameters, options: {
398
398
  phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
399
- }) => Promise<viem1.PrepareTransactionRequestParameters>) | undefined, options: {
399
+ }) => Promise<viem5576.PrepareTransactionRequestParameters>) | undefined, options: {
400
400
  runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
401
401
  }] | undefined;
402
402
  serializers: {
403
403
  readonly transaction: typeof viem_chains0.serializeTransactionOpStack;
404
404
  };
405
- verifyHash?: ((client: viem1.Client, parameters: viem1.VerifyHashActionParameters) => Promise<viem1.VerifyHashActionReturnType>) | undefined;
405
+ verifyHash?: ((client: viem5576.Client, parameters: viem5576.VerifyHashActionParameters) => Promise<viem5576.VerifyHashActionReturnType>) | undefined;
406
406
  readonly network: "base-sepolia";
407
407
  };
408
408
  rpcUrl: string;
@@ -20,10 +20,6 @@ interface StoredRecord {
20
20
  type: RecordType;
21
21
  payload: Record<string, unknown>;
22
22
  }
23
- interface RecordSchema {
24
- type: RecordType;
25
- requiredFields: string[];
26
- }
27
23
  /** A decoded commit, γ = (e, parent, root) plus its repo name, message and CAR (see CommitBlock). */
28
24
  type CommitObject = CommitBlock;
29
25
  interface RepoContents {
@@ -36,15 +32,6 @@ interface RepoDiff {
36
32
  /** Ids of records that are gone. */
37
33
  deletes: string[];
38
34
  }
39
- /**
40
- * Per-repo record schemas. Types without a registered schema are
41
- * accepted as-is (permissive by default); register one to require fields.
42
- */
43
- declare class SchemaRegistry {
44
- private schemas;
45
- register(repo: RepoName, schema: RecordSchema): void;
46
- validate(repo: RepoName, type: RecordType, payload: Record<string, unknown>): boolean;
47
- }
48
35
  /**
49
36
  * Upper bound on a repo name's length. The name is stored in every commit
50
37
  * block, so this is just a sanity bound keeping that block small and
@@ -90,7 +77,6 @@ interface CreateCommitOptions {
90
77
  }
91
78
  declare class FangornEngine {
92
79
  private storage;
93
- private schemas;
94
80
  private registry;
95
81
  /**
96
82
  * Local block cache. Written blocks land here immediately; remote blocks
@@ -100,7 +86,7 @@ declare class FangornEngine {
100
86
  private cache;
101
87
  /** Commits whose CAR has already been loaded into the cache. */
102
88
  private loadedCars;
103
- constructor(storage: MetadataStorage, schemas: SchemaRegistry, registry: Registry);
89
+ constructor(storage: MetadataStorage, registry: Registry);
104
90
  /**
105
91
  * Reconstructs the CID a commit's raw digest hex refers to. The contract only
106
92
  * stores the bare 32-byte sha256 digest (see commitStateRoot), so rebuilding
@@ -198,4 +184,4 @@ declare class FangornEngine {
198
184
  readRecord(publisher: Address, repo: RepoName, id: string): Promise<StoredRecord | null>;
199
185
  }
200
186
  //#endregion
201
- export { CommitDiff, CommitObject, CreateCommitOptions, FangornEngine, MAX_REPO_NAME_LENGTH, RecordInput, RecordSchema, RecordType, type Ref, RepoContents, RepoDiff, RepoName, SchemaRegistry, StoredRecord, assertValidRepoName, rootHexFromCid };
187
+ export { CommitDiff, CommitObject, CreateCommitOptions, FangornEngine, MAX_REPO_NAME_LENGTH, RecordInput, RecordType, type Ref, RepoContents, RepoDiff, RepoName, StoredRecord, assertValidRepoName, rootHexFromCid };
@@ -7,20 +7,6 @@ import { sha256 } from "multiformats/hashes/sha2";
7
7
  import * as Digest from "multiformats/hashes/digest";
8
8
 
9
9
  //#region src/engine/index.ts
10
- /**
11
- * Per-repo record schemas. Types without a registered schema are
12
- * accepted as-is (permissive by default); register one to require fields.
13
- */
14
- var SchemaRegistry = class {
15
- schemas = /* @__PURE__ */ new Map();
16
- register(repo, schema) {
17
- this.schemas.set(`${repo}|${schema.type}`, schema);
18
- }
19
- validate(repo, type, payload) {
20
- const schema = this.schemas.get(`${repo}|${type}`);
21
- return !schema || schema.requiredFields.every((field) => field in payload);
22
- }
23
- };
24
10
  const ZERO_BYTES32 = ZERO_HEAD;
25
11
  /**
26
12
  * Upper bound on a repo name's length. The name is stored in every commit
@@ -52,9 +38,8 @@ var FangornEngine = class {
52
38
  cache = /* @__PURE__ */ new Map();
53
39
  /** Commits whose CAR has already been loaded into the cache. */
54
40
  loadedCars = /* @__PURE__ */ new Set();
55
- constructor(storage, schemas, registry) {
41
+ constructor(storage, registry) {
56
42
  this.storage = storage;
57
- this.schemas = schemas;
58
43
  this.registry = registry;
59
44
  }
60
45
  /**
@@ -165,7 +150,6 @@ var FangornEngine = class {
165
150
  const id = r.id ?? randomUUID();
166
151
  assertValidRecordId(id);
167
152
  if (id in recordCids) throw new Error(`record id ${id} staged twice`);
168
- if (!this.schemas.validate(repo, r.type, r.payload)) throw new Error(`Schema violation for record type [${r.type}] in repo [${repo}]`);
169
153
  const block = await encodeBlock({
170
154
  id,
171
155
  type: r.type,
@@ -333,4 +317,4 @@ var FangornEngine = class {
333
317
  };
334
318
 
335
319
  //#endregion
336
- export { FangornEngine, MAX_REPO_NAME_LENGTH, SchemaRegistry, assertValidRepoName, rootHexFromCid };
320
+ export { FangornEngine, MAX_REPO_NAME_LENGTH, assertValidRepoName, rootHexFromCid };
package/lib/fangorn.d.ts CHANGED
@@ -5,10 +5,10 @@ import { MembershipRegistryClient } from "./contracts/membership-registry/index.
5
5
  import "./contracts/index.js";
6
6
  import { Registry } from "./registry.js";
7
7
  import { MetadataStorage } from "./providers/storage/types.js";
8
- import { CommitDiff, FangornEngine, RecordInput, RepoContents, RepoDiff, SchemaRegistry } from "./engine/index.js";
8
+ import { CommitDiff, FangornEngine, RecordInput, RepoContents, RepoDiff } from "./engine/index.js";
9
9
  import { FangornCreateOptions, StorageConfig } from "./types/index.js";
10
10
  import { AppFeed } from "./feed.js";
11
- import * as viem0 from "viem";
11
+ import * as viem5646 from "viem";
12
12
  import { Hex, WalletClient } from "viem";
13
13
  import { CID } from "multiformats/cid";
14
14
 
@@ -61,7 +61,6 @@ interface AgentCard {
61
61
  declare class Fangorn {
62
62
  private readonly ctx;
63
63
  private _engine;
64
- private readonly _schemas;
65
64
  private _feed;
66
65
  private _apps;
67
66
  private _membership;
@@ -72,8 +71,6 @@ declare class Fangorn {
72
71
  private readonly nsCache;
73
72
  private constructor();
74
73
  get engine(): FangornEngine;
75
- /** Per-repo record schemas. Unregistered types are accepted as-is. */
76
- get schemas(): SchemaRegistry;
77
74
  /**
78
75
  * Static creation of a new Fangorn client
79
76
  *
@@ -87,7 +84,7 @@ declare class Fangorn {
87
84
  * head still names them as history.
88
85
  */
89
86
  reset(repo: string): Promise<{
90
- txHash: viem0.Hash;
87
+ txHash: viem5646.Hash;
91
88
  onChainTip: CID;
92
89
  }>;
93
90
  /** Stage records into one commit on top of `base`. */
package/lib/fangorn.js CHANGED
@@ -5,7 +5,7 @@ import { AppRegistryClient } from "./contracts/app-registry/index.js";
5
5
  import { MembershipRegistryClient } from "./contracts/membership-registry/index.js";
6
6
  import "./contracts/index.js";
7
7
  import { ChainRegistry, ZERO_HEAD, repoExcluded } from "./registry.js";
8
- import { FangornEngine, SchemaRegistry, assertValidRepoName, rootHexFromCid } from "./engine/index.js";
8
+ import { FangornEngine, assertValidRepoName, rootHexFromCid } from "./engine/index.js";
9
9
  import { AppFeed } from "./feed.js";
10
10
  import { createPublicClient, createWalletClient, http } from "viem";
11
11
  import { privateKeyToAccount } from "viem/accounts";
@@ -37,7 +37,6 @@ const FANGORN_APP_EXTENSION = "https://fangorn.network/a2a/app/v1";
37
37
  var Fangorn = class Fangorn {
38
38
  ctx;
39
39
  _engine = null;
40
- _schemas = new SchemaRegistry();
41
40
  _feed = null;
42
41
  _apps = null;
43
42
  _membership = null;
@@ -51,13 +50,9 @@ var Fangorn = class Fangorn {
51
50
  }
52
51
  get engine() {
53
52
  if (!this.ctx.metadataStorage) throw new Error("fangorn.engine requires storage configurations. Pass { pinata: { ... } } to Fangorn.create()");
54
- this._engine ??= new FangornEngine(this.ctx.metadataStorage, this._schemas, this.ctx.registry);
53
+ this._engine ??= new FangornEngine(this.ctx.metadataStorage, this.ctx.registry);
55
54
  return this._engine;
56
55
  }
57
- /** Per-repo record schemas. Unregistered types are accepted as-is. */
58
- get schemas() {
59
- return this._schemas;
60
- }
61
56
  /**
62
57
  * Static creation of a new Fangorn client
63
58
  *