@fangorn-network/sdk 2026.5.11 → 2026.7.1-2.0

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 (101) hide show
  1. package/README.md +219 -225
  2. package/lib/ crypto/constants.d.ts +4 -0
  3. package/lib/ crypto/constants.js +5 -0
  4. package/lib/ crypto/merkle.d.ts +10 -0
  5. package/lib/ crypto/merkle.js +34 -0
  6. package/lib/cli/cli.d.ts +0 -0
  7. package/lib/cli/cli.js +234 -235
  8. package/lib/cli/index.d.ts +13 -650
  9. package/lib/config.d.ts +45 -699
  10. package/lib/config.js +6 -22
  11. package/lib/contracts/data-registry/abi.d.ts +38 -0
  12. package/lib/contracts/data-registry/abi.js +237 -0
  13. package/lib/contracts/data-registry/index.d.ts +81 -0
  14. package/lib/contracts/data-registry/index.js +184 -0
  15. package/lib/contracts/data-registry/test.d.ts +1 -0
  16. package/lib/contracts/index.d.ts +3 -0
  17. package/lib/contracts/index.js +4 -0
  18. package/lib/crypto/aes.d.ts +26 -0
  19. package/lib/crypto/aes.js +58 -0
  20. package/lib/crypto/encryption.d.ts +53 -0
  21. package/lib/crypto/encryption.js +82 -0
  22. package/lib/crypto/rand.d.ts +5 -0
  23. package/lib/{modules/encryption → crypto}/rand.js +1 -1
  24. package/lib/{modules/encryption → crypto}/types.d.ts +1 -1
  25. package/lib/engine/blockstore.d.ts +24 -0
  26. package/lib/engine/blockstore.js +85 -0
  27. package/lib/engine/index.d.ts +180 -0
  28. package/lib/engine/index.js +367 -0
  29. package/lib/fangorn.d.ts +149 -16
  30. package/lib/fangorn.js +256 -37
  31. package/lib/harness/examples/hackmd/build-markdown-graph.d.ts +1 -0
  32. package/lib/harness/examples/hackmd/build-markdown-graph.js +17 -0
  33. package/lib/harness/index.d.ts +57 -0
  34. package/lib/harness/index.js +67 -0
  35. package/lib/index.d.ts +2 -4
  36. package/lib/index.js +1 -3
  37. package/lib/node_modules/.pnpm/@noble_ciphers@1.3.0/node_modules/@noble/ciphers/esm/_polyval.js +218 -0
  38. package/lib/node_modules/.pnpm/@noble_ciphers@1.3.0/node_modules/@noble/ciphers/esm/aes.js +261 -0
  39. package/lib/node_modules/.pnpm/@noble_ciphers@1.3.0/node_modules/@noble/ciphers/esm/utils.js +156 -0
  40. package/lib/node_modules/.pnpm/@noble_curves@1.9.7/node_modules/@noble/curves/esm/abstract/curve.js +299 -0
  41. package/lib/node_modules/.pnpm/@noble_curves@1.9.7/node_modules/@noble/curves/esm/abstract/edwards.js +532 -0
  42. package/lib/node_modules/.pnpm/@noble_curves@1.9.7/node_modules/@noble/curves/esm/abstract/modular.js +344 -0
  43. package/lib/node_modules/.pnpm/@noble_curves@1.9.7/node_modules/@noble/curves/esm/abstract/montgomery.js +137 -0
  44. package/lib/node_modules/.pnpm/@noble_curves@1.9.7/node_modules/@noble/curves/esm/ed25519.js +262 -0
  45. package/lib/node_modules/.pnpm/@noble_curves@1.9.7/node_modules/@noble/curves/esm/utils.js +150 -0
  46. package/lib/providers/storage/car.d.ts +36 -0
  47. package/lib/providers/storage/car.js +80 -0
  48. package/lib/providers/storage/pinata.d.ts +34 -2
  49. package/lib/providers/storage/pinata.js +141 -5
  50. package/lib/providers/storage/types.d.ts +31 -16
  51. package/lib/providers/storage/utils.js +2 -1
  52. package/lib/roles/repo/index.d.ts +56 -0
  53. package/lib/roles/repo/index.js +73 -0
  54. package/lib/test/car_smoke.d.ts +1 -0
  55. package/lib/test/car_smoke.js +81 -0
  56. package/lib/test/cleanup-embeddings-testdata.d.ts +1 -0
  57. package/lib/test/cleanup-embeddings-testdata.js +75 -0
  58. package/lib/test/setup-embeddings-testdata.d.ts +11 -0
  59. package/lib/test/setup-embeddings-testdata.js +155 -0
  60. package/lib/test/testbed.d.ts +39 -30
  61. package/lib/test/testbed.js +43 -129
  62. package/lib/types/index.d.ts +3 -19
  63. package/lib/utils/manifest.d.ts +23 -0
  64. package/lib/utils/manifest.js +77 -0
  65. package/package.json +99 -67
  66. package/lib/modules/encryption/actions.d.ts +0 -4
  67. package/lib/modules/encryption/actions.js +0 -18
  68. package/lib/modules/encryption/aes.d.ts +0 -10
  69. package/lib/modules/encryption/aes.js +0 -51
  70. package/lib/modules/encryption/rand.d.ts +0 -5
  71. package/lib/registries/datasource-registry/abi.d.ts +0 -156
  72. package/lib/registries/datasource-registry/abi.js +0 -194
  73. package/lib/registries/datasource-registry/index.d.ts +0 -30
  74. package/lib/registries/datasource-registry/index.js +0 -158
  75. package/lib/registries/index.d.ts +0 -3
  76. package/lib/registries/index.js +0 -4
  77. package/lib/registries/schema-registry/abi.d.ts +0 -218
  78. package/lib/registries/schema-registry/abi.js +0 -246
  79. package/lib/registries/schema-registry/index.d.ts +0 -34
  80. package/lib/registries/schema-registry/index.js +0 -179
  81. package/lib/registries/settlement-registry/abi.d.ts +0 -218
  82. package/lib/registries/settlement-registry/abi.js +0 -259
  83. package/lib/registries/settlement-registry/index.d.ts +0 -63
  84. package/lib/registries/settlement-registry/index.js +0 -325
  85. package/lib/registries/settlement-registry/types.d.ts +0 -54
  86. package/lib/roles/consumer/index.d.ts +0 -39
  87. package/lib/roles/consumer/index.js +0 -143
  88. package/lib/roles/consumer/types.d.ts +0 -47
  89. package/lib/roles/consumer/types.js +0 -1
  90. package/lib/roles/publisher/index.d.ts +0 -50
  91. package/lib/roles/publisher/index.js +0 -224
  92. package/lib/roles/publisher/types.d.ts +0 -99
  93. package/lib/roles/publisher/types.js +0 -1
  94. package/lib/roles/schema/index.d.ts +0 -18
  95. package/lib/roles/schema/index.js +0 -93
  96. package/lib/roles/schema/types.d.ts +0 -91
  97. package/lib/roles/schema/types.js +0 -1
  98. /package/lib/{modules/encryption/index.d.ts → crypto/utils.d.ts} +0 -0
  99. /package/lib/{modules/encryption/index.js → crypto/utils.js} +0 -0
  100. /package/lib/{modules/encryption/types.js → contracts/data-registry/test.js} +0 -0
  101. /package/lib/{registries/settlement-registry → crypto}/types.js +0 -0
package/package.json CHANGED
@@ -1,69 +1,101 @@
1
1
  {
2
- "name": "@fangorn-network/sdk",
3
- "version": "2026.05.11",
4
- "description": "A zero-knowledge conditional access control framework",
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
- "@types/node": "24.10.1",
25
- "@vitest/coverage-v8": "4.0.15",
26
- "@vitest/eslint-plugin": "1.5.1",
27
- "eslint": "9.39.1",
28
- "husky": "9.1.7",
29
- "lint-staged": "16.2.7",
30
- "prettier": "3.7.3",
31
- "tsdown": "0.16.8",
32
- "tsx": "^4.21.0",
33
- "typescript": "5.8.3",
34
- "typescript-eslint": "8.48.1",
35
- "vitest": "^4.0.18"
36
- },
37
- "engines": {
38
- "node": ">=20.19.0"
39
- },
40
- "dependencies": {
41
- "@a2a-js/sdk": "^0.3.10",
42
- "@clack/prompts": "^1.0.1",
43
- "@semaphore-protocol/group": "^4.14.2",
44
- "@semaphore-protocol/identity": "^4.14.2",
45
- "@semaphore-protocol/proof": "^4.14.2",
46
- "@storacha/client": "^2.1.3",
47
- "agent0-sdk": "^1.5.3",
48
- "commander": "^14.0.3",
49
- "dotenv": "^17.2.3",
50
- "ethers": "^6.16.0",
51
- "pinata": "^2.5.2",
52
- "solc": "^0.8.28",
53
- "viem": "^2.47.1"
54
- },
55
- "overrides": {
56
- "viem": "$viem"
57
- },
58
- "scripts": {
59
- "build": "tsdown",
60
- "format": "prettier . --write",
61
- "lint": "eslint . --max-warnings 0",
62
- "test": "dotenvx run -f .env -- vitest run",
63
- "test:e2e": "dotenvx run -f .env -- vitest run --config vitest.e2e.config.ts",
64
- "tsc": "tsc",
65
- "deploy": "dotenvx run -f .env -- tsx deploy.ts",
66
- "prepare:cli": "npm run build",
67
- "fangorn": "dotenvx run -f .env -- node dist/src/cli/cli.js"
68
- }
2
+ "name": "@fangorn-network/sdk",
3
+ "version": "2026.07.12.0",
4
+ "description": "A zero-knowledge conditional access control framework",
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
+ "@a2a-js/sdk": "^0.3.10",
59
+ "@aztec/bb.js": "^4.3.0",
60
+ "@clack/prompts": "^1.0.1",
61
+ "@ipld/car": "^5.4.6",
62
+ "@ipld/dag-cbor": "^10.0.1",
63
+ "@ipld/unixfs": "^3.0.0",
64
+ "@noble/hashes": "^2.2.0",
65
+ "@noir-lang/noir_js": "1.0.0-beta.22",
66
+ "@semaphore-protocol/group": "^4.14.2",
67
+ "@semaphore-protocol/identity": "^4.14.2",
68
+ "@semaphore-protocol/proof": "^4.14.2",
69
+ "@storacha/client": "^2.1.3",
70
+ "@web3-storage/pail": "^0.6.2",
71
+ "agent0-sdk": "^1.5.3",
72
+ "commander": "^14.0.3",
73
+ "dotenv": "^17.2.3",
74
+ "ethers": "^6.16.0",
75
+ "interface-blockstore": "^7.0.1",
76
+ "interface-store": "^8.0.0",
77
+ "ipfs-car": "^3.1.0",
78
+ "lmdb": "^3.5.5",
79
+ "multiformats": "^14.0.0",
80
+ "pinata": "^2.5.2",
81
+ "poseidon-lite": "^0.3.0",
82
+ "solc": "^0.8.28",
83
+ "stream-json": "^3.4.0",
84
+ "uint8arrays": "^6.1.1",
85
+ "viem": "^2.47.1"
86
+ },
87
+ "overrides": {
88
+ "viem": "$viem"
89
+ },
90
+ "pnpm": {
91
+ "overrides": {
92
+ "write-file-atomic": "7.0.0"
93
+ },
94
+ "peerDependencyRules": {
95
+ "allowedVersions": {
96
+ "viem": ">=2.38.3",
97
+ "ethers": ">=5.7.2"
98
+ }
99
+ }
100
+ }
69
101
  }
@@ -1,4 +0,0 @@
1
- //#region src/modules/encryption/actions.d.ts
2
- declare const createDecryptAction: (chainName: string) => string;
3
- //#endregion
4
- export { createDecryptAction };
@@ -1,18 +0,0 @@
1
- //#region src/modules/encryption/actions.ts
2
- const createDecryptAction = (chainName) => `(async () => {
3
- try {
4
- const decryptedContent = await Lit.Actions.decryptAndCombine({
5
- accessControlConditions: jsParams.accessControlConditions,
6
- ciphertext: jsParams.ciphertext,
7
- dataToEncryptHash: jsParams.dataToEncryptHash,
8
- authSig: jsParams.authSig,
9
- chain: "${chainName}",
10
- });
11
- Lit.Actions.setResponse({ response: decryptedContent, success: true });
12
- } catch (error) {
13
- Lit.Actions.setResponse({ response: error.message, success: false });
14
- }
15
- })();`;
16
-
17
- //#endregion
18
- export { createDecryptAction };
@@ -1,10 +0,0 @@
1
- import { AesEncryptedData } from "./types.js";
2
-
3
- //#region src/modules/encryption/aes.d.ts
4
- declare function encryptData(data: string | Uint8Array): Promise<{
5
- encryptedData: AesEncryptedData;
6
- keyMaterial: Uint8Array<ArrayBuffer>;
7
- }>;
8
- declare function decryptData(encryptedData: AesEncryptedData, keyMaterial: Uint8Array<ArrayBuffer>): Promise<Uint8Array>;
9
- //#endregion
10
- export { decryptData, encryptData };
@@ -1,51 +0,0 @@
1
- import { getRandomValues, getSubtleCrypto } from "./rand.js";
2
-
3
- //#region src/modules/encryption/aes.ts
4
- async function encryptData(data) {
5
- const subtle = getSubtleCrypto();
6
- const salt = getRandomValues(new Uint8Array(16));
7
- const iv = getRandomValues(new Uint8Array(12));
8
- const keyMaterial = getRandomValues(new Uint8Array(32));
9
- const key = await subtle.importKey("raw", keyMaterial, { name: "AES-GCM" }, false, ["encrypt"]);
10
- const encodedData = typeof data === "string" ? new TextEncoder().encode(data) : data;
11
- const encryptedContent = await subtle.encrypt({
12
- name: "AES-GCM",
13
- iv,
14
- tagLength: 128
15
- }, key, encodedData);
16
- const ciphertext = encryptedContent.slice(0, encryptedContent.byteLength - 16);
17
- const authTag = encryptedContent.slice(encryptedContent.byteLength - 16);
18
- return {
19
- encryptedData: {
20
- ciphertext: new Uint8Array(ciphertext),
21
- iv,
22
- authTag: new Uint8Array(authTag),
23
- salt
24
- },
25
- keyMaterial
26
- };
27
- }
28
- async function decryptData(encryptedData, keyMaterial) {
29
- const subtle = getSubtleCrypto();
30
- const ciphertext = toUint8Array(encryptedData.ciphertext);
31
- const iv = toUint8Array(encryptedData.iv);
32
- const authTag = toUint8Array(encryptedData.authTag);
33
- const key = await subtle.importKey("raw", keyMaterial, { name: "AES-GCM" }, false, ["decrypt"]);
34
- const dataWithAuthTag = new Uint8Array(ciphertext.length + authTag.length);
35
- dataWithAuthTag.set(ciphertext, 0);
36
- dataWithAuthTag.set(authTag, ciphertext.length);
37
- const decryptedContent = await subtle.decrypt({
38
- name: "AES-GCM",
39
- iv,
40
- tagLength: 128
41
- }, key, dataWithAuthTag);
42
- return new Uint8Array(decryptedContent);
43
- }
44
- function toUint8Array(data) {
45
- if (data instanceof Uint8Array) return data;
46
- if (Array.isArray(data)) return new Uint8Array(data);
47
- return new Uint8Array(Object.values(data));
48
- }
49
-
50
- //#endregion
51
- export { decryptData, encryptData };
@@ -1,5 +0,0 @@
1
- //#region src/modules/encryption/rand.d.ts
2
- declare function getSubtleCrypto(): SubtleCrypto;
3
- declare function getRandomValues(array: Uint8Array): Uint8Array<ArrayBuffer>;
4
- //#endregion
5
- export { getRandomValues, getSubtleCrypto };
@@ -1,156 +0,0 @@
1
- //#region src/registries/datasource-registry/abi.d.ts
2
- declare const DS_REGISTRY_ABI: readonly [{
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
- }, {
23
- readonly inputs: readonly [{
24
- readonly internalType: "address";
25
- readonly name: "owner";
26
- readonly type: "address";
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";
35
- }];
36
- readonly name: "get";
37
- readonly outputs: readonly [{
38
- readonly internalType: "string";
39
- readonly name: "";
40
- readonly type: "string";
41
- }];
42
- readonly stateMutability: "view";
43
- readonly type: "function";
44
- }, {
45
- readonly inputs: readonly [{
46
- readonly internalType: "address";
47
- readonly name: "owner";
48
- readonly type: "address";
49
- }, {
50
- readonly internalType: "bytes32";
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";
63
- }];
64
- readonly stateMutability: "view";
65
- readonly type: "function";
66
- }, {
67
- readonly inputs: readonly [{
68
- readonly internalType: "address";
69
- readonly name: "owner";
70
- readonly type: "address";
71
- }, {
72
- readonly internalType: "bytes32";
73
- readonly name: "schema_id";
74
- readonly type: "bytes32";
75
- }, {
76
- readonly internalType: "bytes32";
77
- readonly name: "name_hash";
78
- readonly type: "bytes32";
79
- }];
80
- readonly name: "getName";
81
- readonly outputs: readonly [{
82
- readonly internalType: "string";
83
- readonly name: "";
84
- readonly type: "string";
85
- }];
86
- readonly stateMutability: "view";
87
- readonly type: "function";
88
- }, {
89
- readonly inputs: readonly [{
90
- readonly internalType: "address";
91
- readonly name: "owner";
92
- readonly type: "address";
93
- }, {
94
- readonly internalType: "bytes32";
95
- readonly name: "schema_id";
96
- readonly type: "bytes32";
97
- }, {
98
- readonly internalType: "string";
99
- readonly name: "name";
100
- readonly type: "string";
101
- }];
102
- readonly name: "getVersion";
103
- readonly outputs: readonly [{
104
- readonly internalType: "uint64";
105
- readonly name: "";
106
- readonly type: "uint64";
107
- }];
108
- readonly stateMutability: "view";
109
- readonly type: "function";
110
- }, {
111
- readonly inputs: readonly [{
112
- readonly internalType: "string";
113
- readonly name: "manifest_cid";
114
- readonly type: "string";
115
- }, {
116
- readonly internalType: "bytes32";
117
- readonly name: "schema_id";
118
- readonly type: "bytes32";
119
- }, {
120
- readonly internalType: "string";
121
- readonly name: "name";
122
- readonly type: "string";
123
- }, {
124
- readonly internalType: "uint256";
125
- readonly name: "price";
126
- readonly type: "uint256";
127
- }];
128
- readonly name: "publish";
129
- readonly outputs: readonly [];
130
- readonly stateMutability: "nonpayable";
131
- readonly type: "function";
132
- }, {
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";
154
- }];
155
- //#endregion
156
- export { DS_REGISTRY_ABI };
@@ -1,194 +0,0 @@
1
- //#region src/registries/datasource-registry/abi.ts
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
- ];
192
-
193
- //#endregion
194
- export { DS_REGISTRY_ABI };
@@ -1,30 +0,0 @@
1
- import * as viem430 from "viem";
2
- import { Address, Hash, Hex, PublicClient, WalletClient } from "viem";
3
-
4
- //#region src/registries/datasource-registry/index.d.ts
5
- interface DataSource {
6
- manifestCid: string;
7
- name: string;
8
- schemaId: Hex;
9
- version: bigint;
10
- }
11
- declare class DataSourceRegistry {
12
- private publicClient;
13
- private walletClient;
14
- private contractAddress;
15
- constructor(contractAddress: Address, publicClient: PublicClient, walletClient: WalletClient);
16
- private getWriteConfig;
17
- getContractAddress(): `0x${string}`;
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<viem430.TransactionReceipt>;
27
- private estimateGas;
28
- }
29
- //#endregion
30
- export { DataSource, DataSourceRegistry };