@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
@@ -1,158 +0,0 @@
1
- import { DS_REGISTRY_ABI } from "./abi.js";
2
- import { encodePacked, keccak256 } from "viem";
3
-
4
- //#region src/registries/datasource-registry/index.ts
5
- var DataSourceRegistry = class {
6
- publicClient;
7
- walletClient;
8
- contractAddress;
9
- constructor(contractAddress, publicClient, walletClient) {
10
- this.publicClient = publicClient;
11
- this.contractAddress = contractAddress;
12
- this.walletClient = walletClient;
13
- }
14
- getWriteConfig() {
15
- if (!this.walletClient.chain) throw new Error("Chain required");
16
- if (!this.walletClient.account) throw new Error("Account required");
17
- return {
18
- chain: this.walletClient.chain,
19
- account: this.walletClient.account
20
- };
21
- }
22
- getContractAddress() {
23
- return this.contractAddress;
24
- }
25
- async publish(manifestCid, schemaId, name, price, gas) {
26
- const { chain, account } = this.getWriteConfig();
27
- const gasLimit = await this.estimateGas(() => this.publicClient.estimateContractGas({
28
- address: this.contractAddress,
29
- abi: DS_REGISTRY_ABI,
30
- functionName: "publish",
31
- args: [
32
- manifestCid,
33
- schemaId,
34
- name,
35
- price
36
- ],
37
- account
38
- }), gas);
39
- const fees = await this.publicClient.estimateFeesPerGas();
40
- const hash = await this.walletClient.writeContract({
41
- address: this.contractAddress,
42
- abi: DS_REGISTRY_ABI,
43
- functionName: "publish",
44
- args: [
45
- manifestCid,
46
- schemaId,
47
- name,
48
- price
49
- ],
50
- chain,
51
- account,
52
- gas: gasLimit,
53
- maxFeePerGas: fees.maxFeePerGas * 3n,
54
- maxPriorityFeePerGas: fees.maxPriorityFeePerGas
55
- });
56
- await this.waitForTransaction(hash);
57
- return hash;
58
- }
59
- async get(owner, schemaId, name) {
60
- const [manifestCid, version] = await Promise.all([this.publicClient.readContract({
61
- address: this.contractAddress,
62
- abi: DS_REGISTRY_ABI,
63
- functionName: "get",
64
- args: [
65
- owner,
66
- schemaId,
67
- name
68
- ]
69
- }), this.publicClient.readContract({
70
- address: this.contractAddress,
71
- abi: DS_REGISTRY_ABI,
72
- functionName: "getVersion",
73
- args: [
74
- owner,
75
- schemaId,
76
- name
77
- ]
78
- })]);
79
- return {
80
- manifestCid,
81
- name,
82
- schemaId,
83
- version
84
- };
85
- }
86
- async getByHash(owner, schemaId, nameHash) {
87
- return this.publicClient.readContract({
88
- address: this.contractAddress,
89
- abi: DS_REGISTRY_ABI,
90
- functionName: "getByHash",
91
- args: [
92
- owner,
93
- schemaId,
94
- nameHash
95
- ]
96
- });
97
- }
98
- async getName(owner, schemaId, nameHash) {
99
- return this.publicClient.readContract({
100
- address: this.contractAddress,
101
- abi: DS_REGISTRY_ABI,
102
- functionName: "getName",
103
- args: [
104
- owner,
105
- schemaId,
106
- nameHash
107
- ]
108
- });
109
- }
110
- async getVersion(owner, schemaId, name) {
111
- return this.publicClient.readContract({
112
- address: this.contractAddress,
113
- abi: DS_REGISTRY_ABI,
114
- functionName: "getVersion",
115
- args: [
116
- owner,
117
- schemaId,
118
- name
119
- ]
120
- });
121
- }
122
- async resourceId(owner, schemaId, name) {
123
- return this.publicClient.readContract({
124
- address: this.contractAddress,
125
- abi: DS_REGISTRY_ABI,
126
- functionName: "resourceId",
127
- args: [
128
- owner,
129
- schemaId,
130
- name
131
- ]
132
- });
133
- }
134
- static resourceIdLocal(owner, schemaId, name) {
135
- return keccak256(encodePacked([
136
- "address",
137
- "bytes32",
138
- "bytes32"
139
- ], [
140
- owner,
141
- schemaId,
142
- keccak256(new TextEncoder().encode(name))
143
- ]));
144
- }
145
- hashName(name) {
146
- return keccak256(new TextEncoder().encode(name));
147
- }
148
- async waitForTransaction(hash) {
149
- return this.publicClient.waitForTransactionReceipt({ hash });
150
- }
151
- async estimateGas(fn, override) {
152
- if (override !== void 0) return override;
153
- return await fn() * 130n / 100n;
154
- }
155
- };
156
-
157
- //#endregion
158
- export { DataSourceRegistry };
@@ -1,3 +0,0 @@
1
- import { SETTLEMENT_REGISTRY_ABI } from "./settlement-registry/abi.js";
2
- import { DS_REGISTRY_ABI } from "./datasource-registry/abi.js";
3
- export { DS_REGISTRY_ABI, SETTLEMENT_REGISTRY_ABI };
@@ -1,4 +0,0 @@
1
- import { DS_REGISTRY_ABI } from "./datasource-registry/abi.js";
2
- import { SETTLEMENT_REGISTRY_ABI } from "./settlement-registry/abi.js";
3
-
4
- export { DS_REGISTRY_ABI, SETTLEMENT_REGISTRY_ABI };
@@ -1,218 +0,0 @@
1
- //#region src/registries/schema-registry/abi.d.ts
2
- declare const SCHEMA_REGISTRY_ABI: readonly [{
3
- readonly inputs: readonly [];
4
- readonly name: "NotDataSourceRegistry";
5
- readonly type: "error";
6
- }, {
7
- readonly inputs: readonly [];
8
- readonly name: "NotOwner";
9
- readonly type: "error";
10
- }, {
11
- readonly inputs: readonly [];
12
- readonly name: "SchemaAlreadyExists";
13
- readonly type: "error";
14
- }, {
15
- readonly inputs: readonly [];
16
- readonly name: "SchemaInUse";
17
- readonly type: "error";
18
- }, {
19
- readonly inputs: readonly [];
20
- readonly name: "SchemaNotFound";
21
- readonly type: "error";
22
- }, {
23
- readonly inputs: readonly [{
24
- readonly internalType: "bytes32";
25
- readonly name: "schema_id";
26
- readonly type: "bytes32";
27
- }, {
28
- readonly internalType: "address";
29
- readonly name: "publisher";
30
- readonly type: "address";
31
- }];
32
- readonly name: "addPublisher";
33
- readonly outputs: readonly [];
34
- readonly stateMutability: "nonpayable";
35
- readonly type: "function";
36
- }, {
37
- readonly inputs: readonly [{
38
- readonly internalType: "bytes32";
39
- readonly name: "id";
40
- readonly type: "bytes32";
41
- }];
42
- readonly name: "deleteSchema";
43
- readonly outputs: readonly [];
44
- readonly stateMutability: "nonpayable";
45
- readonly type: "function";
46
- }, {
47
- readonly inputs: readonly [{
48
- readonly internalType: "bytes32";
49
- readonly name: "schema_id";
50
- readonly type: "bytes32";
51
- }];
52
- readonly name: "getPublisherCount";
53
- readonly outputs: readonly [{
54
- readonly internalType: "uint256";
55
- readonly name: "";
56
- readonly type: "uint256";
57
- }];
58
- readonly stateMutability: "view";
59
- readonly type: "function";
60
- }, {
61
- readonly inputs: readonly [{
62
- readonly internalType: "bytes32";
63
- readonly name: "id";
64
- readonly type: "bytes32";
65
- }];
66
- readonly name: "getSchemaAgent";
67
- readonly outputs: readonly [{
68
- readonly internalType: "string";
69
- readonly name: "";
70
- readonly type: "string";
71
- }];
72
- readonly stateMutability: "view";
73
- readonly type: "function";
74
- }, {
75
- readonly inputs: readonly [{
76
- readonly internalType: "bytes32";
77
- readonly name: "id";
78
- readonly type: "bytes32";
79
- }];
80
- readonly name: "getSchemaName";
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: "bytes32";
91
- readonly name: "id";
92
- readonly type: "bytes32";
93
- }];
94
- readonly name: "getSchemaOwner";
95
- readonly outputs: readonly [{
96
- readonly internalType: "address";
97
- readonly name: "";
98
- readonly type: "address";
99
- }];
100
- readonly stateMutability: "view";
101
- readonly type: "function";
102
- }, {
103
- readonly inputs: readonly [{
104
- readonly internalType: "bytes32";
105
- readonly name: "id";
106
- readonly type: "bytes32";
107
- }];
108
- readonly name: "getSchemaSpec";
109
- readonly outputs: readonly [{
110
- readonly internalType: "string";
111
- readonly name: "";
112
- readonly type: "string";
113
- }];
114
- readonly stateMutability: "view";
115
- readonly type: "function";
116
- }, {
117
- readonly inputs: readonly [{
118
- readonly internalType: "bytes32";
119
- readonly name: "schema_id";
120
- readonly type: "bytes32";
121
- }];
122
- readonly name: "hasPublishers";
123
- readonly outputs: readonly [{
124
- readonly internalType: "bool";
125
- readonly name: "";
126
- readonly type: "bool";
127
- }];
128
- readonly stateMutability: "view";
129
- readonly type: "function";
130
- }, {
131
- readonly inputs: readonly [{
132
- readonly internalType: "bytes32";
133
- readonly name: "schema_id";
134
- readonly type: "bytes32";
135
- }, {
136
- readonly internalType: "address";
137
- readonly name: "publisher";
138
- readonly type: "address";
139
- }];
140
- readonly name: "isPublisher";
141
- readonly outputs: readonly [{
142
- readonly internalType: "bool";
143
- readonly name: "";
144
- readonly type: "bool";
145
- }];
146
- readonly stateMutability: "view";
147
- readonly type: "function";
148
- }, {
149
- readonly inputs: readonly [{
150
- readonly internalType: "string";
151
- readonly name: "name";
152
- readonly type: "string";
153
- }, {
154
- readonly internalType: "string";
155
- readonly name: "spec_cid";
156
- readonly type: "string";
157
- }, {
158
- readonly internalType: "string";
159
- readonly name: "agent_id";
160
- readonly type: "string";
161
- }];
162
- readonly name: "registerSchema";
163
- readonly outputs: readonly [{
164
- readonly internalType: "bytes32";
165
- readonly name: "";
166
- readonly type: "bytes32";
167
- }];
168
- readonly stateMutability: "nonpayable";
169
- readonly type: "function";
170
- }, {
171
- readonly inputs: readonly [{
172
- readonly internalType: "bytes32";
173
- readonly name: "id";
174
- readonly type: "bytes32";
175
- }];
176
- readonly name: "schemaExists";
177
- readonly outputs: readonly [{
178
- readonly internalType: "bool";
179
- readonly name: "";
180
- readonly type: "bool";
181
- }];
182
- readonly stateMutability: "view";
183
- readonly type: "function";
184
- }, {
185
- readonly inputs: readonly [{
186
- readonly internalType: "string";
187
- readonly name: "name";
188
- readonly type: "string";
189
- }];
190
- readonly name: "schemaId";
191
- readonly outputs: readonly [{
192
- readonly internalType: "bytes32";
193
- readonly name: "";
194
- readonly type: "bytes32";
195
- }];
196
- readonly stateMutability: "view";
197
- readonly type: "function";
198
- }, {
199
- readonly inputs: readonly [{
200
- readonly internalType: "bytes32";
201
- readonly name: "id";
202
- readonly type: "bytes32";
203
- }, {
204
- readonly internalType: "string";
205
- readonly name: "new_spec_cid";
206
- readonly type: "string";
207
- }, {
208
- readonly internalType: "string";
209
- readonly name: "new_agent_id";
210
- readonly type: "string";
211
- }];
212
- readonly name: "updateSchema";
213
- readonly outputs: readonly [];
214
- readonly stateMutability: "nonpayable";
215
- readonly type: "function";
216
- }];
217
- //#endregion
218
- export { SCHEMA_REGISTRY_ABI };
@@ -1,246 +0,0 @@
1
- //#region src/registries/schema-registry/abi.ts
2
- const SCHEMA_REGISTRY_ABI = [
3
- {
4
- "inputs": [],
5
- "name": "NotDataSourceRegistry",
6
- "type": "error"
7
- },
8
- {
9
- "inputs": [],
10
- "name": "NotOwner",
11
- "type": "error"
12
- },
13
- {
14
- "inputs": [],
15
- "name": "SchemaAlreadyExists",
16
- "type": "error"
17
- },
18
- {
19
- "inputs": [],
20
- "name": "SchemaInUse",
21
- "type": "error"
22
- },
23
- {
24
- "inputs": [],
25
- "name": "SchemaNotFound",
26
- "type": "error"
27
- },
28
- {
29
- "inputs": [{
30
- "internalType": "bytes32",
31
- "name": "schema_id",
32
- "type": "bytes32"
33
- }, {
34
- "internalType": "address",
35
- "name": "publisher",
36
- "type": "address"
37
- }],
38
- "name": "addPublisher",
39
- "outputs": [],
40
- "stateMutability": "nonpayable",
41
- "type": "function"
42
- },
43
- {
44
- "inputs": [{
45
- "internalType": "bytes32",
46
- "name": "id",
47
- "type": "bytes32"
48
- }],
49
- "name": "deleteSchema",
50
- "outputs": [],
51
- "stateMutability": "nonpayable",
52
- "type": "function"
53
- },
54
- {
55
- "inputs": [{
56
- "internalType": "bytes32",
57
- "name": "schema_id",
58
- "type": "bytes32"
59
- }],
60
- "name": "getPublisherCount",
61
- "outputs": [{
62
- "internalType": "uint256",
63
- "name": "",
64
- "type": "uint256"
65
- }],
66
- "stateMutability": "view",
67
- "type": "function"
68
- },
69
- {
70
- "inputs": [{
71
- "internalType": "bytes32",
72
- "name": "id",
73
- "type": "bytes32"
74
- }],
75
- "name": "getSchemaAgent",
76
- "outputs": [{
77
- "internalType": "string",
78
- "name": "",
79
- "type": "string"
80
- }],
81
- "stateMutability": "view",
82
- "type": "function"
83
- },
84
- {
85
- "inputs": [{
86
- "internalType": "bytes32",
87
- "name": "id",
88
- "type": "bytes32"
89
- }],
90
- "name": "getSchemaName",
91
- "outputs": [{
92
- "internalType": "string",
93
- "name": "",
94
- "type": "string"
95
- }],
96
- "stateMutability": "view",
97
- "type": "function"
98
- },
99
- {
100
- "inputs": [{
101
- "internalType": "bytes32",
102
- "name": "id",
103
- "type": "bytes32"
104
- }],
105
- "name": "getSchemaOwner",
106
- "outputs": [{
107
- "internalType": "address",
108
- "name": "",
109
- "type": "address"
110
- }],
111
- "stateMutability": "view",
112
- "type": "function"
113
- },
114
- {
115
- "inputs": [{
116
- "internalType": "bytes32",
117
- "name": "id",
118
- "type": "bytes32"
119
- }],
120
- "name": "getSchemaSpec",
121
- "outputs": [{
122
- "internalType": "string",
123
- "name": "",
124
- "type": "string"
125
- }],
126
- "stateMutability": "view",
127
- "type": "function"
128
- },
129
- {
130
- "inputs": [{
131
- "internalType": "bytes32",
132
- "name": "schema_id",
133
- "type": "bytes32"
134
- }],
135
- "name": "hasPublishers",
136
- "outputs": [{
137
- "internalType": "bool",
138
- "name": "",
139
- "type": "bool"
140
- }],
141
- "stateMutability": "view",
142
- "type": "function"
143
- },
144
- {
145
- "inputs": [{
146
- "internalType": "bytes32",
147
- "name": "schema_id",
148
- "type": "bytes32"
149
- }, {
150
- "internalType": "address",
151
- "name": "publisher",
152
- "type": "address"
153
- }],
154
- "name": "isPublisher",
155
- "outputs": [{
156
- "internalType": "bool",
157
- "name": "",
158
- "type": "bool"
159
- }],
160
- "stateMutability": "view",
161
- "type": "function"
162
- },
163
- {
164
- "inputs": [
165
- {
166
- "internalType": "string",
167
- "name": "name",
168
- "type": "string"
169
- },
170
- {
171
- "internalType": "string",
172
- "name": "spec_cid",
173
- "type": "string"
174
- },
175
- {
176
- "internalType": "string",
177
- "name": "agent_id",
178
- "type": "string"
179
- }
180
- ],
181
- "name": "registerSchema",
182
- "outputs": [{
183
- "internalType": "bytes32",
184
- "name": "",
185
- "type": "bytes32"
186
- }],
187
- "stateMutability": "nonpayable",
188
- "type": "function"
189
- },
190
- {
191
- "inputs": [{
192
- "internalType": "bytes32",
193
- "name": "id",
194
- "type": "bytes32"
195
- }],
196
- "name": "schemaExists",
197
- "outputs": [{
198
- "internalType": "bool",
199
- "name": "",
200
- "type": "bool"
201
- }],
202
- "stateMutability": "view",
203
- "type": "function"
204
- },
205
- {
206
- "inputs": [{
207
- "internalType": "string",
208
- "name": "name",
209
- "type": "string"
210
- }],
211
- "name": "schemaId",
212
- "outputs": [{
213
- "internalType": "bytes32",
214
- "name": "",
215
- "type": "bytes32"
216
- }],
217
- "stateMutability": "view",
218
- "type": "function"
219
- },
220
- {
221
- "inputs": [
222
- {
223
- "internalType": "bytes32",
224
- "name": "id",
225
- "type": "bytes32"
226
- },
227
- {
228
- "internalType": "string",
229
- "name": "new_spec_cid",
230
- "type": "string"
231
- },
232
- {
233
- "internalType": "string",
234
- "name": "new_agent_id",
235
- "type": "string"
236
- }
237
- ],
238
- "name": "updateSchema",
239
- "outputs": [],
240
- "stateMutability": "nonpayable",
241
- "type": "function"
242
- }
243
- ];
244
-
245
- //#endregion
246
- export { SCHEMA_REGISTRY_ABI };
@@ -1,34 +0,0 @@
1
- import * as viem429 from "viem";
2
- import { Address, Hash, Hex, PublicClient, WalletClient } from "viem";
3
-
4
- //#region src/registries/schema-registry/index.d.ts
5
- interface Schema {
6
- name: string;
7
- specCid: string;
8
- agentId: string;
9
- owner: Address;
10
- }
11
- declare class SchemaRegistry {
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
- schemaId(name: string): Promise<Hex>;
19
- registerSchema(name: string, specCid: string, agentId: string): Promise<{
20
- hash: Hash;
21
- schemaId: Hex;
22
- }>;
23
- updateSchema(nameOrId: string, newSpecCid: string, newAgentId: string): Promise<Hash>;
24
- deleteSchema(nameOrId: string): Promise<Hash>;
25
- getSchema(nameOrId: string): Promise<Schema>;
26
- schemaExists(nameOrId: string): Promise<boolean>;
27
- hasPublishers(nameOrId: string): Promise<boolean>;
28
- isPublisher(nameOrId: string, publisher: Address): Promise<boolean>;
29
- getPublisherCount(nameOrId: string): Promise<bigint>;
30
- waitForTransaction(hash: Hash): Promise<viem429.TransactionReceipt>;
31
- private resolveId;
32
- }
33
- //#endregion
34
- export { Schema, SchemaRegistry };