@fangorn-network/sdk 2026.4.7-0 → 2026.4.10

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 (39) hide show
  1. package/README.md +30 -26
  2. package/lib/cli/cli.js +115 -153
  3. package/lib/config.d.ts +241 -241
  4. package/lib/config.js +3 -3
  5. package/lib/fangorn.d.ts +5 -0
  6. package/lib/fangorn.js +13 -8
  7. package/lib/index.js +1 -2
  8. package/lib/modules/encryption/lit.d.ts +0 -1
  9. package/lib/modules/encryption/lit.js +1 -7
  10. package/lib/modules/gadgets/settledGadget.d.ts +1 -8
  11. package/lib/modules/gadgets/settledGadget.js +1 -13
  12. package/lib/providers/storage/index.d.ts +1 -1
  13. package/lib/providers/storage/index.js +3 -1
  14. package/lib/providers/storage/pinata.js +1 -1
  15. package/lib/registries/datasource-registry/abi.d.ts +116 -43
  16. package/lib/registries/datasource-registry/abi.js +190 -12
  17. package/lib/registries/datasource-registry/index.d.ts +11 -6
  18. package/lib/registries/datasource-registry/index.js +89 -25
  19. package/lib/registries/index.js +1 -1
  20. package/lib/registries/schema-registry/abi.d.ts +157 -66
  21. package/lib/registries/schema-registry/abi.js +242 -15
  22. package/lib/registries/schema-registry/index.d.ts +8 -3
  23. package/lib/registries/schema-registry/index.js +82 -17
  24. package/lib/registries/settlement-registry/abi.d.ts +199 -145
  25. package/lib/registries/settlement-registry/abi.js +331 -25
  26. package/lib/registries/settlement-registry/index.d.ts +35 -38
  27. package/lib/registries/settlement-registry/index.js +125 -91
  28. package/lib/registries/settlement-registry/types.d.ts +6 -3
  29. package/lib/roles/consumer/index.d.ts +6 -5
  30. package/lib/roles/consumer/index.js +21 -20
  31. package/lib/roles/consumer/types.d.ts +4 -4
  32. package/lib/roles/publisher/index.d.ts +22 -19
  33. package/lib/roles/publisher/index.js +63 -59
  34. package/lib/roles/publisher/types.d.ts +3 -3
  35. package/lib/roles/schema/index.d.ts +1 -7
  36. package/lib/roles/schema/index.js +4 -34
  37. package/lib/test/testbed.d.ts +7 -32
  38. package/lib/test/testbed.js +20 -43
  39. package/package.json +1 -1
package/lib/config.js CHANGED
@@ -26,9 +26,9 @@ function getNetwork(name) {
26
26
  }
27
27
  const FangornConfig = {
28
28
  ArbitrumSepolia: {
29
- dataSourceRegistryContractAddress: "0xddd338e6a200012642a103c6631ea92eea94cabe",
30
- schemaRegistryContractAddress: "0xef6754c29cfd0c8937a080695899f2a9a23c7c70",
31
- settlementRegistryContractAddress: "0x5e918ba3fe33b0bdc68cd46eb6a77db754edef57",
29
+ dataSourceRegistryContractAddress: "0xdb82c131a9d51f6e7695e744bb2bd7774cbb224c",
30
+ schemaRegistryContractAddress: "0x35b67934f9c75bfef6ff3f4d61ff406d81420066",
31
+ settlementRegistryContractAddress: "0x6aff8212e126ed3232958fd228bc58a202b8f590",
32
32
  chainName: "arbitrumSepolia",
33
33
  chain: arbitrumSepolia,
34
34
  rpcUrl: "https://sepolia-rollup.arbitrum.io/rpc",
package/lib/fangorn.d.ts CHANGED
@@ -27,6 +27,11 @@ declare class Fangorn {
27
27
  * Consumer: purchase, claim, and decrypt data.
28
28
  */
29
29
  get consumer(): ConsumerRole;
30
+ /**
31
+ * Create a new Fangorn instance
32
+ * @param options
33
+ * @returns
34
+ */
30
35
  static create(options: FangornCreateOptions): Promise<Fangorn>;
31
36
  getConfig(): AppConfig;
32
37
  getSchemaRegistry(): SchemaRegistry;
package/lib/fangorn.js CHANGED
@@ -4,26 +4,26 @@ import "./modules/encryption/index.js";
4
4
  import { PinataStorage } from "./providers/storage/pinata.js";
5
5
  import "./providers/storage/index.js";
6
6
  import { SchemaRole } from "./roles/schema/index.js";
7
- import { SettlementRegistry } from "./registries/settlement-registry/index.js";
7
+ import { DataSourceRegistry } from "./registries/datasource-registry/index.js";
8
8
  import { PublisherRole } from "./roles/publisher/index.js";
9
9
  import { ConsumerRole } from "./roles/consumer/index.js";
10
10
  import { SchemaRegistry } from "./registries/schema-registry/index.js";
11
- import { DataSourceRegistry } from "./registries/datasource-registry/index.js";
11
+ import { SettlementRegistry } from "./registries/settlement-registry/index.js";
12
12
  import { createPublicClient, createWalletClient, http } from "viem";
13
13
  import { privateKeyToAccount } from "viem/accounts";
14
14
 
15
15
  //#region src/fangorn.ts
16
- const DEFAULT_IPFS_GATEWAY = "https://gateway.pinata.cloud";
16
+ const DEFAULT_IPFS_GATEWAY = "https://ipfs.io";
17
17
  function isEncryptionService(e) {
18
18
  return typeof e.encrypt === "function";
19
19
  }
20
20
  function isPinataConfig(s) {
21
21
  return "pinata" in s;
22
22
  }
23
- async function resolveStorage(storage) {
23
+ function resolveStorage(storage) {
24
24
  if (!storage) return void 0;
25
25
  if (isPinataConfig(storage)) return new PinataStorage(storage.pinata.jwt, storage.pinata.gateway);
26
- throw new Error("Invalid storage config: must be { pinata: { jwt, gateway } }.");
26
+ throw new Error(`Invalid storage config: must be { pinata: { jwt, gateway } }, but was ${JSON.stringify(storage)}`);
27
27
  }
28
28
  var Fangorn = class Fangorn {
29
29
  ctx;
@@ -38,14 +38,14 @@ var Fangorn = class Fangorn {
38
38
  */
39
39
  get schema() {
40
40
  if (!this.ctx.storage) throw new Error("fangorn.schema requires storage. Pass { pinata: { ... } } to Fangorn.create()");
41
- return this._schema ??= new SchemaRole(this.ctx.schemaRegistry, this.ctx.storage, this.ctx.walletClient, this.ctx.ipfsGateway, this.ctx.schemaRoleConfig);
41
+ return this._schema ??= new SchemaRole(this.ctx.schemaRegistry, this.ctx.storage, this.ctx.walletClient, this.ctx.ipfsGateway);
42
42
  }
43
43
  /**
44
44
  * Publisher: encrypt, stage, and commit data under a schema.
45
45
  */
46
46
  get publisher() {
47
47
  if (!this.ctx.storage) throw new Error("fangorn.publisher requires storage. Pass { pinata: { ... } } to Fangorn.create()");
48
- return this._publisher ??= new PublisherRole(this.ctx.dataSourceRegistry, this.ctx.settlementRegistry, this.ctx.schemaRegistry, this.ctx.storage, this.ctx.encryption, this.ctx.walletClient, this.ctx.config);
48
+ return this._publisher ??= new PublisherRole(this.ctx.dataSourceRegistry, this.ctx.schemaRegistry, this.ctx.storage, this.ctx.encryption, this.ctx.walletClient, this.ctx.config);
49
49
  }
50
50
  /**
51
51
  * Consumer: purchase, claim, and decrypt data.
@@ -53,6 +53,11 @@ var Fangorn = class Fangorn {
53
53
  get consumer() {
54
54
  return this._consumer ??= new ConsumerRole(this.ctx.dataSourceRegistry, this.ctx.settlementRegistry, this.ctx.encryption, this.ctx.domain, this.ctx.ipfsGateway);
55
55
  }
56
+ /**
57
+ * Create a new Fangorn instance
58
+ * @param options
59
+ * @returns
60
+ */
56
61
  static async create(options) {
57
62
  if (!options.privateKey && !options.walletClient) throw new Error("Either privateKey or walletClient must be provided");
58
63
  const resolvedConfig = options.config ?? FangornConfig.ArbitrumSepolia;
@@ -61,7 +66,7 @@ var Fangorn = class Fangorn {
61
66
  chain: resolvedConfig.chain,
62
67
  transport: http(resolvedConfig.rpcUrl)
63
68
  });
64
- const storage = await resolveStorage(options.storage);
69
+ const storage = resolveStorage(options.storage);
65
70
  const encryption = isEncryptionService(options.encryption) ? options.encryption : await LitEncryptionService.init(resolvedConfig.chainName);
66
71
  const domain = options.domain ?? new URL(resolvedConfig.rpcUrl).hostname;
67
72
  const ipfsGateway = options.ipfsGateway ?? DEFAULT_IPFS_GATEWAY;
package/lib/index.js CHANGED
@@ -3,10 +3,9 @@ import { LitEncryptionService } from "./modules/encryption/lit.js";
3
3
  import "./modules/encryption/index.js";
4
4
  import { PinataStorage } from "./providers/storage/pinata.js";
5
5
  import { deserialize, retrieveByCid, serialize } from "./providers/storage/index.js";
6
- import { SETTLEMENT_REGISTRY_ABI } from "./registries/settlement-registry/abi.js";
7
6
  import { DS_REGISTRY_ABI } from "./registries/datasource-registry/abi.js";
7
+ import { SETTLEMENT_REGISTRY_ABI } from "./registries/settlement-registry/abi.js";
8
8
  import { Fangorn } from "./fangorn.js";
9
- import "./registries/index.js";
10
9
  import { addressToBytes32Array, computeSchemaId, fieldToHex, hexToBytes32Array, hexToField, stringToBytes32Array } from "./utils/index.js";
11
10
 
12
11
  export { DS_REGISTRY_ABI, Fangorn, FangornConfig, LitEncryptionService, PinataStorage, SETTLEMENT_REGISTRY_ABI, SupportedNetworks, addressToBytes32Array, computeSchemaId, deserialize, fieldToHex, hexToBytes32Array, hexToField, retrieveByCid, serialize, stringToBytes32Array };
@@ -15,7 +15,6 @@ declare class LitEncryptionService implements EncryptionService {
15
15
  decrypt(payload: EncryptedPayload, authContext: AuthContextWrapper): Promise<DecryptedPayload>;
16
16
  createAuthContext(walletClient: WalletClient, domain: string): Promise<AuthContextWrapper>;
17
17
  private createAuthSig;
18
- private parseKeyResponse;
19
18
  }
20
19
  //#endregion
21
20
  export { LitEncryptionService };
@@ -47,7 +47,7 @@ var LitEncryptionService = class LitEncryptionService {
47
47
  }
48
48
  async createAuthContext(walletClient, domain) {
49
49
  const isNode = typeof window === "undefined";
50
- const account = isNode ? walletClient.account : walletClient;
50
+ const account = walletClient.account;
51
51
  if (!account) throw new Error("No account found in wallet client");
52
52
  if (!walletClient.chain) throw new Error("No chain found in wallet client");
53
53
  const sessionContext = await (isNode ? createAuthManager({ storage: storagePlugins.localStorageNode({
@@ -115,12 +115,6 @@ var LitEncryptionService = class LitEncryptionService {
115
115
  address: account.address
116
116
  };
117
117
  }
118
- parseKeyResponse(response) {
119
- return Uint8Array.from(response.replace(/^[^\d]+/, "").split(","), (entry) => {
120
- const val = parseInt(entry.trim(), 10);
121
- return isNaN(val) ? 0 : val;
122
- });
123
- }
124
118
  };
125
119
 
126
120
  //#endregion
@@ -1,4 +1,3 @@
1
- import { AppConfig } from "../../config.js";
2
1
  import { Gadget, GadgetDescriptor } from "./types.js";
3
2
  import { Address, Hex } from "viem";
4
3
  import { UnifiedAccessControlCondition } from "@lit-protocol/access-control-conditions";
@@ -12,12 +11,6 @@ interface SettledGadgetParams {
12
11
  /** "arbitrumSepolia" | "baseSepolia" */
13
12
  chainName: string;
14
13
  }
15
- /**
16
- * Build a new default gadget from the given config
17
- * @param config : AppConfig
18
- * @returns the configured gadget
19
- */
20
- declare function makeSettledGadgetFactory(config: AppConfig): (resourceId: Hex) => SettledGadget;
21
14
  declare class SettledGadget implements Gadget {
22
15
  private readonly params;
23
16
  readonly type = "settled";
@@ -28,4 +21,4 @@ declare class SettledGadget implements Gadget {
28
21
  toDescriptor(): GadgetDescriptor;
29
22
  }
30
23
  //#endregion
31
- export { SettledGadget, SettledGadgetParams, makeSettledGadgetFactory };
24
+ export { SettledGadget, SettledGadgetParams };
@@ -2,18 +2,6 @@ import { zeroAddress } from "viem";
2
2
  import { createAccBuilder } from "@lit-protocol/access-control-conditions";
3
3
 
4
4
  //#region src/modules/gadgets/settledGadget.ts
5
- /**
6
- * Build a new default gadget from the given config
7
- * @param config : AppConfig
8
- * @returns the configured gadget
9
- */
10
- function makeSettledGadgetFactory(config) {
11
- return (resourceId) => new SettledGadget({
12
- resourceId,
13
- settlementRegistryAddress: config.settlementRegistryContractAddress,
14
- chainName: config.chainName
15
- });
16
- }
17
5
  var SettledGadget = class {
18
6
  type = "settled";
19
7
  constructor(params) {
@@ -72,4 +60,4 @@ var SettledGadget = class {
72
60
  };
73
61
 
74
62
  //#endregion
75
- export { SettledGadget, makeSettledGadgetFactory };
63
+ export { SettledGadget };
@@ -11,7 +11,7 @@ interface PinningService {
11
11
  delete(cid: string): Promise<void>;
12
12
  }
13
13
  declare function serialize(data: unknown): string;
14
- declare function deserialize<T>(text: string): T;
14
+ declare function deserialize(text: string): unknown;
15
15
  /**
16
16
  * Fetch any content by CID from a public IPFS gateway.
17
17
  * No auth required — all Fangorn content is public; privacy is cryptographic.
@@ -31,7 +31,9 @@ function deserialize(text) {
31
31
  async function retrieveByCid(cid, gateway = "https://ipfs.io") {
32
32
  const url = `${gateway.replace(/\/$/, "")}/ipfs/${cid}`;
33
33
  const controller = new AbortController();
34
- const timeout = setTimeout(() => controller.abort(), 1e4);
34
+ const timeout = setTimeout(() => {
35
+ controller.abort();
36
+ }, 1e4);
35
37
  try {
36
38
  const res = await fetch(url, { signal: controller.signal });
37
39
  if (!res.ok) throw new Error(`Failed to retrieve ${cid}: ${res.statusText}`);
@@ -12,7 +12,7 @@ var PinataStorage = class {
12
12
  }
13
13
  async store(data, metadata) {
14
14
  const content = serialize(data);
15
- const file = new File([content], metadata?.name ?? "file", { type: "text/plain" });
15
+ const file = new File([content], (metadata ?? { name: "file" }).name, { type: "text/plain" });
16
16
  return (await this.pinata.upload.public.file(file, { metadata })).cid;
17
17
  }
18
18
  async delete(cid) {
@@ -1,83 +1,156 @@
1
1
  //#region src/registries/datasource-registry/abi.d.ts
2
2
  declare const DS_REGISTRY_ABI: readonly [{
3
- readonly name: "initialize";
4
- readonly type: "function";
5
- readonly stateMutability: "nonpayable";
3
+ readonly inputs: readonly [];
4
+ readonly name: "DataSourceNotFound";
5
+ readonly type: "error";
6
+ }, {
7
+ readonly inputs: readonly [];
8
+ readonly name: "NameRequired";
9
+ readonly type: "error";
10
+ }, {
11
+ readonly inputs: readonly [];
12
+ readonly name: "ResourceSetupFailed";
13
+ readonly type: "error";
14
+ }, {
15
+ readonly inputs: readonly [];
16
+ readonly name: "SchemaNotFound";
17
+ readonly type: "error";
18
+ }, {
19
+ readonly inputs: readonly [];
20
+ readonly name: "SchemaRequired";
21
+ readonly type: "error";
22
+ }, {
6
23
  readonly inputs: readonly [{
24
+ readonly internalType: "address";
25
+ readonly name: "owner";
7
26
  readonly type: "address";
8
- readonly name: "schema_registry";
27
+ }, {
28
+ readonly internalType: "bytes32";
29
+ readonly name: "schema_id";
30
+ readonly type: "bytes32";
31
+ }, {
32
+ readonly internalType: "string";
33
+ readonly name: "name";
34
+ readonly type: "string";
9
35
  }];
10
- readonly outputs: readonly [];
11
- }, {
12
- readonly name: "publishManifest";
36
+ readonly name: "get";
37
+ readonly outputs: readonly [{
38
+ readonly internalType: "string";
39
+ readonly name: "";
40
+ readonly type: "string";
41
+ }];
42
+ readonly stateMutability: "view";
13
43
  readonly type: "function";
14
- readonly stateMutability: "nonpayable";
44
+ }, {
15
45
  readonly inputs: readonly [{
16
- readonly type: "string";
17
- readonly name: "manifest_cid";
46
+ readonly internalType: "address";
47
+ readonly name: "owner";
48
+ readonly type: "address";
18
49
  }, {
19
- readonly type: "bytes32";
50
+ readonly internalType: "bytes32";
20
51
  readonly name: "schema_id";
52
+ readonly type: "bytes32";
53
+ }, {
54
+ readonly internalType: "bytes32";
55
+ readonly name: "name_hash";
56
+ readonly type: "bytes32";
57
+ }];
58
+ readonly name: "getByHash";
59
+ readonly outputs: readonly [{
60
+ readonly internalType: "string";
61
+ readonly name: "";
62
+ readonly type: "string";
21
63
  }];
22
- readonly outputs: readonly [];
23
- }, {
24
- readonly name: "getManifest";
25
- readonly type: "function";
26
64
  readonly stateMutability: "view";
65
+ readonly type: "function";
66
+ }, {
27
67
  readonly inputs: readonly [{
28
- readonly type: "address";
68
+ readonly internalType: "address";
29
69
  readonly name: "owner";
70
+ readonly type: "address";
30
71
  }, {
31
- readonly type: "bytes32";
72
+ readonly internalType: "bytes32";
32
73
  readonly name: "schema_id";
74
+ readonly type: "bytes32";
75
+ }, {
76
+ readonly internalType: "bytes32";
77
+ readonly name: "name_hash";
78
+ readonly type: "bytes32";
33
79
  }];
80
+ readonly name: "getName";
34
81
  readonly outputs: readonly [{
82
+ readonly internalType: "string";
83
+ readonly name: "";
35
84
  readonly type: "string";
36
85
  }];
37
- }, {
38
- readonly name: "getVersion";
39
- readonly type: "function";
40
86
  readonly stateMutability: "view";
87
+ readonly type: "function";
88
+ }, {
41
89
  readonly inputs: readonly [{
42
- readonly type: "address";
90
+ readonly internalType: "address";
43
91
  readonly name: "owner";
92
+ readonly type: "address";
44
93
  }, {
45
- readonly type: "bytes32";
94
+ readonly internalType: "bytes32";
46
95
  readonly name: "schema_id";
96
+ readonly type: "bytes32";
97
+ }, {
98
+ readonly internalType: "string";
99
+ readonly name: "name";
100
+ readonly type: "string";
47
101
  }];
102
+ readonly name: "getVersion";
48
103
  readonly outputs: readonly [{
104
+ readonly internalType: "uint64";
105
+ readonly name: "";
49
106
  readonly type: "uint64";
50
107
  }];
108
+ readonly stateMutability: "view";
109
+ readonly type: "function";
51
110
  }, {
52
- readonly name: "ManifestPublished";
53
- readonly type: "event";
54
111
  readonly inputs: readonly [{
55
- readonly type: "address";
56
- readonly name: "owner";
57
- readonly indexed: true;
112
+ readonly internalType: "string";
113
+ readonly name: "manifest_cid";
114
+ readonly type: "string";
58
115
  }, {
59
- readonly type: "bytes32";
116
+ readonly internalType: "bytes32";
60
117
  readonly name: "schema_id";
61
- readonly indexed: true;
118
+ readonly type: "bytes32";
62
119
  }, {
120
+ readonly internalType: "string";
121
+ readonly name: "name";
63
122
  readonly type: "string";
64
- readonly name: "manifest_cid";
65
123
  }, {
66
- readonly type: "uint64";
67
- readonly name: "version";
124
+ readonly internalType: "uint256";
125
+ readonly name: "price";
126
+ readonly type: "uint256";
68
127
  }];
128
+ readonly name: "publish";
129
+ readonly outputs: readonly [];
130
+ readonly stateMutability: "nonpayable";
131
+ readonly type: "function";
69
132
  }, {
70
- readonly name: "DataSourceNotFound";
71
- readonly type: "error";
72
- readonly inputs: readonly [];
73
- }, {
74
- readonly name: "SchemaNotFound";
75
- readonly type: "error";
76
- readonly inputs: readonly [];
77
- }, {
78
- readonly name: "SchemaRequired";
79
- readonly type: "error";
80
- readonly inputs: readonly [];
133
+ readonly inputs: readonly [{
134
+ readonly internalType: "address";
135
+ readonly name: "owner";
136
+ readonly type: "address";
137
+ }, {
138
+ readonly internalType: "bytes32";
139
+ readonly name: "schema_id";
140
+ readonly type: "bytes32";
141
+ }, {
142
+ readonly internalType: "string";
143
+ readonly name: "name";
144
+ readonly type: "string";
145
+ }];
146
+ readonly name: "resourceId";
147
+ readonly outputs: readonly [{
148
+ readonly internalType: "bytes32";
149
+ readonly name: "";
150
+ readonly type: "bytes32";
151
+ }];
152
+ readonly stateMutability: "view";
153
+ readonly type: "function";
81
154
  }];
82
155
  //#endregion
83
156
  export { DS_REGISTRY_ABI };
@@ -1,16 +1,194 @@
1
- import { parseAbi } from "viem";
2
-
3
1
  //#region src/registries/datasource-registry/abi.ts
4
- const DS_REGISTRY_ABI = parseAbi([
5
- "function initialize(address schema_registry) external",
6
- "function publishManifest(string calldata manifest_cid, bytes32 schema_id) external",
7
- "function getManifest(address owner, bytes32 schema_id) external view returns (string memory)",
8
- "function getVersion(address owner, bytes32 schema_id) external view returns (uint64)",
9
- "event ManifestPublished(address indexed owner, bytes32 indexed schema_id, string manifest_cid, uint64 version)",
10
- "error DataSourceNotFound()",
11
- "error SchemaNotFound()",
12
- "error SchemaRequired()"
13
- ]);
2
+ const DS_REGISTRY_ABI = [
3
+ {
4
+ "inputs": [],
5
+ "name": "DataSourceNotFound",
6
+ "type": "error"
7
+ },
8
+ {
9
+ "inputs": [],
10
+ "name": "NameRequired",
11
+ "type": "error"
12
+ },
13
+ {
14
+ "inputs": [],
15
+ "name": "ResourceSetupFailed",
16
+ "type": "error"
17
+ },
18
+ {
19
+ "inputs": [],
20
+ "name": "SchemaNotFound",
21
+ "type": "error"
22
+ },
23
+ {
24
+ "inputs": [],
25
+ "name": "SchemaRequired",
26
+ "type": "error"
27
+ },
28
+ {
29
+ "inputs": [
30
+ {
31
+ "internalType": "address",
32
+ "name": "owner",
33
+ "type": "address"
34
+ },
35
+ {
36
+ "internalType": "bytes32",
37
+ "name": "schema_id",
38
+ "type": "bytes32"
39
+ },
40
+ {
41
+ "internalType": "string",
42
+ "name": "name",
43
+ "type": "string"
44
+ }
45
+ ],
46
+ "name": "get",
47
+ "outputs": [{
48
+ "internalType": "string",
49
+ "name": "",
50
+ "type": "string"
51
+ }],
52
+ "stateMutability": "view",
53
+ "type": "function"
54
+ },
55
+ {
56
+ "inputs": [
57
+ {
58
+ "internalType": "address",
59
+ "name": "owner",
60
+ "type": "address"
61
+ },
62
+ {
63
+ "internalType": "bytes32",
64
+ "name": "schema_id",
65
+ "type": "bytes32"
66
+ },
67
+ {
68
+ "internalType": "bytes32",
69
+ "name": "name_hash",
70
+ "type": "bytes32"
71
+ }
72
+ ],
73
+ "name": "getByHash",
74
+ "outputs": [{
75
+ "internalType": "string",
76
+ "name": "",
77
+ "type": "string"
78
+ }],
79
+ "stateMutability": "view",
80
+ "type": "function"
81
+ },
82
+ {
83
+ "inputs": [
84
+ {
85
+ "internalType": "address",
86
+ "name": "owner",
87
+ "type": "address"
88
+ },
89
+ {
90
+ "internalType": "bytes32",
91
+ "name": "schema_id",
92
+ "type": "bytes32"
93
+ },
94
+ {
95
+ "internalType": "bytes32",
96
+ "name": "name_hash",
97
+ "type": "bytes32"
98
+ }
99
+ ],
100
+ "name": "getName",
101
+ "outputs": [{
102
+ "internalType": "string",
103
+ "name": "",
104
+ "type": "string"
105
+ }],
106
+ "stateMutability": "view",
107
+ "type": "function"
108
+ },
109
+ {
110
+ "inputs": [
111
+ {
112
+ "internalType": "address",
113
+ "name": "owner",
114
+ "type": "address"
115
+ },
116
+ {
117
+ "internalType": "bytes32",
118
+ "name": "schema_id",
119
+ "type": "bytes32"
120
+ },
121
+ {
122
+ "internalType": "string",
123
+ "name": "name",
124
+ "type": "string"
125
+ }
126
+ ],
127
+ "name": "getVersion",
128
+ "outputs": [{
129
+ "internalType": "uint64",
130
+ "name": "",
131
+ "type": "uint64"
132
+ }],
133
+ "stateMutability": "view",
134
+ "type": "function"
135
+ },
136
+ {
137
+ "inputs": [
138
+ {
139
+ "internalType": "string",
140
+ "name": "manifest_cid",
141
+ "type": "string"
142
+ },
143
+ {
144
+ "internalType": "bytes32",
145
+ "name": "schema_id",
146
+ "type": "bytes32"
147
+ },
148
+ {
149
+ "internalType": "string",
150
+ "name": "name",
151
+ "type": "string"
152
+ },
153
+ {
154
+ "internalType": "uint256",
155
+ "name": "price",
156
+ "type": "uint256"
157
+ }
158
+ ],
159
+ "name": "publish",
160
+ "outputs": [],
161
+ "stateMutability": "nonpayable",
162
+ "type": "function"
163
+ },
164
+ {
165
+ "inputs": [
166
+ {
167
+ "internalType": "address",
168
+ "name": "owner",
169
+ "type": "address"
170
+ },
171
+ {
172
+ "internalType": "bytes32",
173
+ "name": "schema_id",
174
+ "type": "bytes32"
175
+ },
176
+ {
177
+ "internalType": "string",
178
+ "name": "name",
179
+ "type": "string"
180
+ }
181
+ ],
182
+ "name": "resourceId",
183
+ "outputs": [{
184
+ "internalType": "bytes32",
185
+ "name": "",
186
+ "type": "bytes32"
187
+ }],
188
+ "stateMutability": "view",
189
+ "type": "function"
190
+ }
191
+ ];
14
192
 
15
193
  //#endregion
16
194
  export { DS_REGISTRY_ABI };
@@ -1,9 +1,10 @@
1
- import * as viem431 from "viem";
1
+ import * as viem0 from "viem";
2
2
  import { Address, Hash, Hex, PublicClient, WalletClient } from "viem";
3
3
 
4
4
  //#region src/registries/datasource-registry/index.d.ts
5
5
  interface DataSource {
6
6
  manifestCid: string;
7
+ name: string;
7
8
  schemaId: Hex;
8
9
  version: bigint;
9
10
  }
@@ -14,11 +15,15 @@ declare class DataSourceRegistry {
14
15
  constructor(contractAddress: Address, publicClient: PublicClient, walletClient: WalletClient);
15
16
  private getWriteConfig;
16
17
  getContractAddress(): `0x${string}`;
17
- initialize(schemaRegistryAddress: Address): Promise<Hash>;
18
- publishManifest(manifestCid: string, schemaId: Hex, gas?: bigint): Promise<Hash>;
19
- getManifest(owner: Address, schemaId: Hex): Promise<DataSource>;
20
- getVersion(owner: Address, schemaId: Hex): Promise<bigint>;
21
- waitForTransaction(hash: Hash): Promise<viem431.TransactionReceipt>;
18
+ publish(manifestCid: string, schemaId: Hex, name: string, price: bigint, gas?: bigint): Promise<Hash>;
19
+ get(owner: Address, schemaId: Hex, name: string): Promise<DataSource>;
20
+ getByHash(owner: Address, schemaId: Hex, nameHash: Hex): Promise<string>;
21
+ getName(owner: Address, schemaId: Hex, nameHash: Hex): Promise<string>;
22
+ getVersion(owner: Address, schemaId: Hex, name: string): Promise<bigint>;
23
+ resourceId(owner: Address, schemaId: Hex, name: string): Promise<Hex>;
24
+ static resourceIdLocal(owner: Address, schemaId: Hex, name: string): Hex;
25
+ hashName(name: string): Hex;
26
+ waitForTransaction(hash: Hash): Promise<viem0.TransactionReceipt>;
22
27
  private estimateGas;
23
28
  }
24
29
  //#endregion