@fangorn-network/sdk 2026.4.7 → 2026.4.15

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 (61) hide show
  1. package/README.md +137 -150
  2. package/lib/cli/cli.js +134 -226
  3. package/lib/cli/index.d.ts +170 -170
  4. package/lib/config.d.ts +260 -257
  5. package/lib/config.js +7 -5
  6. package/lib/fangorn.d.ts +3 -20
  7. package/lib/fangorn.js +15 -52
  8. package/lib/index.d.ts +3 -7
  9. package/lib/index.js +4 -7
  10. package/lib/modules/encryption/aes.d.ts +3 -3
  11. package/lib/modules/encryption/index.d.ts +1 -28
  12. package/lib/modules/encryption/index.js +1 -3
  13. package/lib/modules/encryption/types.d.ts +1 -48
  14. package/lib/providers/storage/index.d.ts +4 -21
  15. package/lib/providers/storage/index.js +3 -2
  16. package/lib/providers/storage/pinata.d.ts +14 -0
  17. package/lib/providers/storage/pinata.js +32 -0
  18. package/lib/providers/storage/types.d.ts +37 -0
  19. package/lib/providers/storage/utils.d.ts +12 -0
  20. package/lib/providers/storage/utils.js +50 -0
  21. package/lib/registries/datasource-registry/abi.d.ts +116 -43
  22. package/lib/registries/datasource-registry/abi.js +190 -12
  23. package/lib/registries/datasource-registry/index.d.ts +12 -6
  24. package/lib/registries/datasource-registry/index.js +96 -20
  25. package/lib/registries/index.js +1 -1
  26. package/lib/registries/schema-registry/abi.d.ts +157 -66
  27. package/lib/registries/schema-registry/abi.js +242 -15
  28. package/lib/registries/schema-registry/index.d.ts +8 -3
  29. package/lib/registries/schema-registry/index.js +82 -17
  30. package/lib/registries/settlement-registry/abi.d.ts +199 -145
  31. package/lib/registries/settlement-registry/abi.js +331 -25
  32. package/lib/registries/settlement-registry/index.d.ts +36 -39
  33. package/lib/registries/settlement-registry/index.js +125 -91
  34. package/lib/registries/settlement-registry/types.d.ts +6 -3
  35. package/lib/roles/consumer/index.d.ts +17 -42
  36. package/lib/roles/consumer/index.js +87 -58
  37. package/lib/roles/consumer/types.d.ts +15 -34
  38. package/lib/roles/publisher/index.d.ts +22 -40
  39. package/lib/roles/publisher/index.js +69 -113
  40. package/lib/roles/publisher/types.d.ts +40 -41
  41. package/lib/roles/schema/index.d.ts +4 -30
  42. package/lib/roles/schema/index.js +7 -60
  43. package/lib/roles/schema/types.d.ts +16 -2
  44. package/lib/test/testbed.d.ts +12 -36
  45. package/lib/test/testbed.js +35 -68
  46. package/lib/types/index.d.ts +14 -57
  47. package/package.json +1 -6
  48. package/lib/modules/encryption/lit.d.ts +0 -21
  49. package/lib/modules/encryption/lit.js +0 -127
  50. package/lib/modules/gadgets/index.d.ts +0 -2
  51. package/lib/modules/gadgets/index.js +0 -1
  52. package/lib/modules/gadgets/settledGadget.d.ts +0 -31
  53. package/lib/modules/gadgets/settledGadget.js +0 -75
  54. package/lib/modules/gadgets/types.d.ts +0 -27
  55. package/lib/providers/storage/pinata/index.d.ts +0 -13
  56. package/lib/providers/storage/pinata/index.js +0 -41
  57. package/lib/providers/storage/storacha/index.d.ts +0 -13
  58. package/lib/providers/storage/storacha/index.js +0 -49
  59. package/lib/providers/storage/storacha/readOnly.d.ts +0 -8
  60. package/lib/providers/storage/storacha/readOnly.js +0 -16
  61. /package/lib/{modules/gadgets → providers/storage}/types.js +0 -0
@@ -1,127 +1,218 @@
1
1
  //#region src/registries/schema-registry/abi.d.ts
2
2
  declare const SCHEMA_REGISTRY_ABI: readonly [{
3
- readonly name: "schemaId";
4
- readonly type: "function";
5
- readonly stateMutability: "view";
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
+ }, {
6
23
  readonly inputs: readonly [{
7
- readonly type: "string";
8
- readonly name: "name";
9
- }];
10
- readonly outputs: readonly [{
24
+ readonly internalType: "bytes32";
25
+ readonly name: "schema_id";
11
26
  readonly type: "bytes32";
27
+ }, {
28
+ readonly internalType: "address";
29
+ readonly name: "publisher";
30
+ readonly type: "address";
12
31
  }];
13
- }, {
14
- readonly name: "registerSchema";
32
+ readonly name: "addPublisher";
33
+ readonly outputs: readonly [];
34
+ readonly stateMutability: "nonpayable";
15
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 [];
16
44
  readonly stateMutability: "nonpayable";
45
+ readonly type: "function";
46
+ }, {
17
47
  readonly inputs: readonly [{
18
- readonly type: "string";
19
- readonly name: "name";
20
- }, {
21
- readonly type: "string";
22
- readonly name: "spec_cid";
23
- }, {
24
- readonly type: "string";
25
- readonly name: "agent_id";
48
+ readonly internalType: "bytes32";
49
+ readonly name: "schema_id";
50
+ readonly type: "bytes32";
26
51
  }];
52
+ readonly name: "getPublisherCount";
27
53
  readonly outputs: readonly [{
28
- readonly type: "bytes32";
54
+ readonly internalType: "uint256";
55
+ readonly name: "";
56
+ readonly type: "uint256";
29
57
  }];
30
- }, {
31
- readonly name: "updateSchema";
58
+ readonly stateMutability: "view";
32
59
  readonly type: "function";
33
- readonly stateMutability: "nonpayable";
60
+ }, {
34
61
  readonly inputs: readonly [{
35
- readonly type: "bytes32";
62
+ readonly internalType: "bytes32";
36
63
  readonly name: "id";
37
- }, {
38
- readonly type: "string";
39
- readonly name: "new_spec_cid";
40
- }, {
64
+ readonly type: "bytes32";
65
+ }];
66
+ readonly name: "getSchemaAgent";
67
+ readonly outputs: readonly [{
68
+ readonly internalType: "string";
69
+ readonly name: "";
41
70
  readonly type: "string";
42
- readonly name: "new_agent_id";
43
71
  }];
44
- readonly outputs: readonly [];
45
- }, {
46
- readonly name: "getSchemaSpec";
47
- readonly type: "function";
48
72
  readonly stateMutability: "view";
73
+ readonly type: "function";
74
+ }, {
49
75
  readonly inputs: readonly [{
50
- readonly type: "bytes32";
76
+ readonly internalType: "bytes32";
51
77
  readonly name: "id";
78
+ readonly type: "bytes32";
52
79
  }];
80
+ readonly name: "getSchemaName";
53
81
  readonly outputs: readonly [{
82
+ readonly internalType: "string";
83
+ readonly name: "";
54
84
  readonly type: "string";
55
85
  }];
56
- }, {
57
- readonly name: "getSchemaAgent";
58
- readonly type: "function";
59
86
  readonly stateMutability: "view";
87
+ readonly type: "function";
88
+ }, {
60
89
  readonly inputs: readonly [{
90
+ readonly internalType: "bytes32";
91
+ readonly name: "id";
61
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";
62
105
  readonly name: "id";
106
+ readonly type: "bytes32";
63
107
  }];
108
+ readonly name: "getSchemaSpec";
64
109
  readonly outputs: readonly [{
110
+ readonly internalType: "string";
111
+ readonly name: "";
65
112
  readonly type: "string";
66
113
  }];
67
- }, {
68
- readonly name: "schemaExists";
69
- readonly type: "function";
70
114
  readonly stateMutability: "view";
115
+ readonly type: "function";
116
+ }, {
71
117
  readonly inputs: readonly [{
118
+ readonly internalType: "bytes32";
119
+ readonly name: "schema_id";
72
120
  readonly type: "bytes32";
73
- readonly name: "id";
74
121
  }];
122
+ readonly name: "hasPublishers";
75
123
  readonly outputs: readonly [{
124
+ readonly internalType: "bool";
125
+ readonly name: "";
76
126
  readonly type: "bool";
77
127
  }];
128
+ readonly stateMutability: "view";
129
+ readonly type: "function";
78
130
  }, {
79
- readonly name: "SchemaRegistered";
80
- readonly type: "event";
81
131
  readonly inputs: readonly [{
132
+ readonly internalType: "bytes32";
133
+ readonly name: "schema_id";
82
134
  readonly type: "bytes32";
83
- readonly name: "id";
84
- readonly indexed: true;
85
135
  }, {
136
+ readonly internalType: "address";
137
+ readonly name: "publisher";
86
138
  readonly type: "address";
87
- readonly name: "owner";
88
- readonly indexed: true;
89
- }, {
90
- readonly type: "string";
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";
91
151
  readonly name: "name";
92
- }, {
93
152
  readonly type: "string";
94
- readonly name: "spec_cid";
95
153
  }, {
154
+ readonly internalType: "string";
155
+ readonly name: "spec_cid";
96
156
  readonly type: "string";
157
+ }, {
158
+ readonly internalType: "string";
97
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";
98
181
  }];
182
+ readonly stateMutability: "view";
183
+ readonly type: "function";
99
184
  }, {
100
- readonly name: "SchemaUpdated";
101
- readonly type: "event";
102
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: "";
103
194
  readonly type: "bytes32";
195
+ }];
196
+ readonly stateMutability: "view";
197
+ readonly type: "function";
198
+ }, {
199
+ readonly inputs: readonly [{
200
+ readonly internalType: "bytes32";
104
201
  readonly name: "id";
105
- readonly indexed: true;
202
+ readonly type: "bytes32";
106
203
  }, {
107
- readonly type: "string";
204
+ readonly internalType: "string";
108
205
  readonly name: "new_spec_cid";
109
- }, {
110
206
  readonly type: "string";
207
+ }, {
208
+ readonly internalType: "string";
111
209
  readonly name: "new_agent_id";
210
+ readonly type: "string";
112
211
  }];
113
- }, {
114
- readonly name: "NotOwner";
115
- readonly type: "error";
116
- readonly inputs: readonly [];
117
- }, {
118
- readonly name: "SchemaNotFound";
119
- readonly type: "error";
120
- readonly inputs: readonly [];
121
- }, {
122
- readonly name: "SchemaAlreadyExists";
123
- readonly type: "error";
124
- readonly inputs: readonly [];
212
+ readonly name: "updateSchema";
213
+ readonly outputs: readonly [];
214
+ readonly stateMutability: "nonpayable";
215
+ readonly type: "function";
125
216
  }];
126
217
  //#endregion
127
218
  export { SCHEMA_REGISTRY_ABI };
@@ -1,19 +1,246 @@
1
- import { parseAbi } from "viem";
2
-
3
1
  //#region src/registries/schema-registry/abi.ts
4
- const SCHEMA_REGISTRY_ABI = parseAbi([
5
- "function schemaId(string calldata name) external view returns (bytes32)",
6
- "function registerSchema(string calldata name, string calldata spec_cid, string calldata agent_id) external returns (bytes32)",
7
- "function updateSchema(bytes32 id, string calldata new_spec_cid, string calldata new_agent_id) external",
8
- "function getSchemaSpec(bytes32 id) external view returns (string memory)",
9
- "function getSchemaAgent(bytes32 id) external view returns (string memory)",
10
- "function schemaExists(bytes32 id) external view returns (bool)",
11
- "event SchemaRegistered(bytes32 indexed id, address indexed owner, string name, string spec_cid, string agent_id)",
12
- "event SchemaUpdated(bytes32 indexed id, string new_spec_cid, string new_agent_id)",
13
- "error NotOwner()",
14
- "error SchemaNotFound()",
15
- "error SchemaAlreadyExists()"
16
- ]);
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
+ ];
17
244
 
18
245
  //#endregion
19
246
  export { SCHEMA_REGISTRY_ABI };
@@ -1,11 +1,12 @@
1
- import * as viem258 from "viem";
1
+ import * as viem171 from "viem";
2
2
  import { Address, Hash, Hex, PublicClient, WalletClient } from "viem";
3
3
 
4
4
  //#region src/registries/schema-registry/index.d.ts
5
5
  interface Schema {
6
6
  name: string;
7
- cid: string;
7
+ specCid: string;
8
8
  agentId: string;
9
+ owner: Address;
9
10
  }
10
11
  declare class SchemaRegistry {
11
12
  private publicClient;
@@ -20,9 +21,13 @@ declare class SchemaRegistry {
20
21
  schemaId: Hex;
21
22
  }>;
22
23
  updateSchema(nameOrId: string, newSpecCid: string, newAgentId: string): Promise<Hash>;
24
+ deleteSchema(nameOrId: string): Promise<Hash>;
23
25
  getSchema(nameOrId: string): Promise<Schema>;
24
26
  schemaExists(nameOrId: string): Promise<boolean>;
25
- waitForTransaction(hash: Hash): Promise<viem258.TransactionReceipt>;
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<viem171.TransactionReceipt>;
26
31
  private resolveId;
27
32
  }
28
33
  //#endregion