@fangorn-network/sdk 2026.6.16 → 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.
- package/README.md +210 -266
- package/lib/cli/cli.d.ts +0 -0
- package/lib/cli/cli.js +261 -167
- package/lib/cli/index.d.ts +13 -651
- package/lib/config.d.ts +137 -792
- package/lib/config.js +6 -22
- package/lib/contracts/data-registry/abi.d.ts +38 -0
- package/lib/contracts/data-registry/abi.js +237 -0
- package/lib/contracts/data-registry/index.d.ts +81 -0
- package/lib/contracts/data-registry/index.js +184 -0
- package/lib/contracts/index.d.ts +3 -0
- package/lib/contracts/index.js +4 -0
- package/lib/crypto/aes.d.ts +26 -0
- package/lib/crypto/aes.js +58 -0
- package/lib/crypto/encryption.d.ts +53 -0
- package/lib/crypto/encryption.js +82 -0
- package/lib/{modules/encryption → crypto}/rand.d.ts +1 -1
- package/lib/{modules/encryption → crypto}/rand.js +1 -1
- package/lib/{modules/encryption → crypto}/types.d.ts +1 -1
- package/lib/engine/blockstore.d.ts +24 -0
- package/lib/engine/blockstore.js +85 -0
- package/lib/engine/index.d.ts +180 -0
- package/lib/engine/index.js +367 -0
- package/lib/fangorn.d.ts +149 -16
- package/lib/fangorn.js +256 -37
- package/lib/harness/examples/hackmd/build-markdown-graph.js +17 -0
- package/lib/harness/index.d.ts +57 -0
- package/lib/harness/index.js +67 -0
- package/lib/index.d.ts +2 -2
- package/lib/node_modules/.pnpm/@noble_ciphers@1.3.0/node_modules/@noble/ciphers/esm/_polyval.js +218 -0
- package/lib/node_modules/.pnpm/@noble_ciphers@1.3.0/node_modules/@noble/ciphers/esm/aes.js +261 -0
- package/lib/node_modules/.pnpm/@noble_ciphers@1.3.0/node_modules/@noble/ciphers/esm/utils.js +156 -0
- package/lib/node_modules/.pnpm/@noble_curves@1.9.7/node_modules/@noble/curves/esm/abstract/curve.js +299 -0
- package/lib/node_modules/.pnpm/@noble_curves@1.9.7/node_modules/@noble/curves/esm/abstract/edwards.js +532 -0
- package/lib/node_modules/.pnpm/@noble_curves@1.9.7/node_modules/@noble/curves/esm/abstract/modular.js +344 -0
- package/lib/node_modules/.pnpm/@noble_curves@1.9.7/node_modules/@noble/curves/esm/abstract/montgomery.js +137 -0
- package/lib/node_modules/.pnpm/@noble_curves@1.9.7/node_modules/@noble/curves/esm/ed25519.js +262 -0
- package/lib/node_modules/.pnpm/@noble_curves@1.9.7/node_modules/@noble/curves/esm/utils.js +150 -0
- package/lib/providers/storage/car.d.ts +36 -0
- package/lib/providers/storage/car.js +80 -0
- package/lib/providers/storage/pinata.d.ts +29 -1
- package/lib/providers/storage/pinata.js +135 -20
- package/lib/providers/storage/types.d.ts +25 -18
- package/lib/roles/repo/index.d.ts +56 -0
- package/lib/roles/repo/index.js +73 -0
- package/lib/test/car_smoke.d.ts +1 -0
- package/lib/test/car_smoke.js +81 -0
- package/lib/test/cleanup-embeddings-testdata.js +9 -38
- package/lib/test/setup-embeddings-testdata.d.ts +4 -6
- package/lib/test/setup-embeddings-testdata.js +40 -94
- package/lib/test/testbed.d.ts +35 -32
- package/lib/test/testbed.js +48 -138
- package/lib/types/index.d.ts +3 -19
- package/lib/utils/manifest.d.ts +23 -0
- package/lib/utils/manifest.js +77 -0
- package/package.json +99 -81
- package/lib/modules/encryption/actions.d.ts +0 -4
- package/lib/modules/encryption/actions.js +0 -18
- package/lib/modules/encryption/aes.d.ts +0 -10
- package/lib/modules/encryption/aes.js +0 -51
- package/lib/registries/datasource-registry/abi.d.ts +0 -186
- package/lib/registries/datasource-registry/abi.js +0 -229
- package/lib/registries/datasource-registry/index.d.ts +0 -39
- package/lib/registries/datasource-registry/index.js +0 -158
- package/lib/registries/index.d.ts +0 -3
- package/lib/registries/index.js +0 -4
- package/lib/registries/schema-registry/abi.d.ts +0 -218
- package/lib/registries/schema-registry/abi.js +0 -246
- package/lib/registries/schema-registry/index.d.ts +0 -34
- package/lib/registries/schema-registry/index.js +0 -179
- package/lib/registries/settlement-registry/abi.d.ts +0 -218
- package/lib/registries/settlement-registry/abi.js +0 -259
- package/lib/registries/settlement-registry/index.d.ts +0 -63
- package/lib/registries/settlement-registry/index.js +0 -325
- package/lib/registries/settlement-registry/types.d.ts +0 -54
- package/lib/registries/settlement-registry/types.js +0 -1
- package/lib/roles/consumer/index.d.ts +0 -39
- package/lib/roles/consumer/index.js +0 -150
- package/lib/roles/consumer/types.d.ts +0 -47
- package/lib/roles/consumer/types.js +0 -1
- package/lib/roles/publisher/builders/bundle.d.ts +0 -32
- package/lib/roles/publisher/builders/bundle.js +0 -137
- package/lib/roles/publisher/builders/record-set.d.ts +0 -17
- package/lib/roles/publisher/builders/record-set.js +0 -55
- package/lib/roles/publisher/builders/types.d.ts +0 -38
- package/lib/roles/publisher/builders/types.js +0 -1
- package/lib/roles/publisher/builders/utils.d.ts +0 -9
- package/lib/roles/publisher/builders/utils.js +0 -29
- package/lib/roles/publisher/encryption.d.ts +0 -18
- package/lib/roles/publisher/encryption.js +0 -38
- package/lib/roles/publisher/index.d.ts +0 -68
- package/lib/roles/publisher/index.js +0 -179
- package/lib/roles/publisher/types.d.ts +0 -114
- package/lib/roles/publisher/types.js +0 -1
- package/lib/roles/schema/index.d.ts +0 -44
- package/lib/roles/schema/index.js +0 -127
- package/lib/roles/schema/types.d.ts +0 -113
- package/lib/roles/schema/types.js +0 -1
- package/lib/roles/schema/validate.d.ts +0 -9
- package/lib/roles/schema/validate.js +0 -128
- package/lib/test/publish_mb_bundle.js +0 -296
- /package/lib/{modules/encryption/index.d.ts → contracts/data-registry/test.d.ts} +0 -0
- /package/lib/{modules/encryption/index.js → contracts/data-registry/test.js} +0 -0
- /package/lib/{modules/encryption → crypto}/types.js +0 -0
- /package/lib/{test/publish_mb_bundle.d.ts → harness/examples/hackmd/build-markdown-graph.d.ts} +0 -0
|
@@ -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 viem350 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<viem350.TransactionReceipt>;
|
|
31
|
-
private resolveId;
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
export { Schema, SchemaRegistry };
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { SCHEMA_REGISTRY_ABI } from "./abi.js";
|
|
2
|
-
|
|
3
|
-
//#region src/registries/schema-registry/index.ts
|
|
4
|
-
var SchemaRegistry = class {
|
|
5
|
-
publicClient;
|
|
6
|
-
walletClient;
|
|
7
|
-
contractAddress;
|
|
8
|
-
constructor(contractAddress, publicClient, walletClient) {
|
|
9
|
-
this.publicClient = publicClient;
|
|
10
|
-
this.contractAddress = contractAddress;
|
|
11
|
-
this.walletClient = walletClient;
|
|
12
|
-
}
|
|
13
|
-
getWriteConfig() {
|
|
14
|
-
if (!this.walletClient.chain) throw new Error("Chain required");
|
|
15
|
-
if (!this.walletClient.account) throw new Error("Account required");
|
|
16
|
-
return {
|
|
17
|
-
chain: this.walletClient.chain,
|
|
18
|
-
account: this.walletClient.account
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
getContractAddress() {
|
|
22
|
-
return this.contractAddress;
|
|
23
|
-
}
|
|
24
|
-
async schemaId(name) {
|
|
25
|
-
return this.publicClient.readContract({
|
|
26
|
-
address: this.contractAddress,
|
|
27
|
-
abi: SCHEMA_REGISTRY_ABI,
|
|
28
|
-
functionName: "schemaId",
|
|
29
|
-
args: [name]
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
async registerSchema(name, specCid, agentId = "") {
|
|
33
|
-
const { chain, account } = this.getWriteConfig();
|
|
34
|
-
const schemaId = await this.publicClient.simulateContract({
|
|
35
|
-
address: this.contractAddress,
|
|
36
|
-
abi: SCHEMA_REGISTRY_ABI,
|
|
37
|
-
functionName: "registerSchema",
|
|
38
|
-
args: [
|
|
39
|
-
name,
|
|
40
|
-
specCid,
|
|
41
|
-
agentId
|
|
42
|
-
],
|
|
43
|
-
account
|
|
44
|
-
}).then((r) => r.result);
|
|
45
|
-
const hash = await this.walletClient.writeContract({
|
|
46
|
-
address: this.contractAddress,
|
|
47
|
-
abi: SCHEMA_REGISTRY_ABI,
|
|
48
|
-
functionName: "registerSchema",
|
|
49
|
-
args: [
|
|
50
|
-
name,
|
|
51
|
-
specCid,
|
|
52
|
-
agentId
|
|
53
|
-
],
|
|
54
|
-
chain,
|
|
55
|
-
account
|
|
56
|
-
});
|
|
57
|
-
await this.waitForTransaction(hash);
|
|
58
|
-
return {
|
|
59
|
-
hash,
|
|
60
|
-
schemaId
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
async updateSchema(nameOrId, newSpecCid, newAgentId) {
|
|
64
|
-
const { chain, account } = this.getWriteConfig();
|
|
65
|
-
const id = await this.resolveId(nameOrId);
|
|
66
|
-
const hash = await this.walletClient.writeContract({
|
|
67
|
-
address: this.contractAddress,
|
|
68
|
-
abi: SCHEMA_REGISTRY_ABI,
|
|
69
|
-
functionName: "updateSchema",
|
|
70
|
-
args: [
|
|
71
|
-
id,
|
|
72
|
-
newSpecCid,
|
|
73
|
-
newAgentId
|
|
74
|
-
],
|
|
75
|
-
chain,
|
|
76
|
-
account
|
|
77
|
-
});
|
|
78
|
-
await this.waitForTransaction(hash);
|
|
79
|
-
return hash;
|
|
80
|
-
}
|
|
81
|
-
async deleteSchema(nameOrId) {
|
|
82
|
-
const { chain, account } = this.getWriteConfig();
|
|
83
|
-
const id = await this.resolveId(nameOrId);
|
|
84
|
-
const hash = await this.walletClient.writeContract({
|
|
85
|
-
address: this.contractAddress,
|
|
86
|
-
abi: SCHEMA_REGISTRY_ABI,
|
|
87
|
-
functionName: "deleteSchema",
|
|
88
|
-
args: [id],
|
|
89
|
-
chain,
|
|
90
|
-
account
|
|
91
|
-
});
|
|
92
|
-
await this.waitForTransaction(hash);
|
|
93
|
-
return hash;
|
|
94
|
-
}
|
|
95
|
-
async getSchema(nameOrId) {
|
|
96
|
-
const id = await this.resolveId(nameOrId);
|
|
97
|
-
const [specCid, agentId, name, owner] = await Promise.all([
|
|
98
|
-
this.publicClient.readContract({
|
|
99
|
-
address: this.contractAddress,
|
|
100
|
-
abi: SCHEMA_REGISTRY_ABI,
|
|
101
|
-
functionName: "getSchemaSpec",
|
|
102
|
-
args: [id]
|
|
103
|
-
}),
|
|
104
|
-
this.publicClient.readContract({
|
|
105
|
-
address: this.contractAddress,
|
|
106
|
-
abi: SCHEMA_REGISTRY_ABI,
|
|
107
|
-
functionName: "getSchemaAgent",
|
|
108
|
-
args: [id]
|
|
109
|
-
}),
|
|
110
|
-
this.publicClient.readContract({
|
|
111
|
-
address: this.contractAddress,
|
|
112
|
-
abi: SCHEMA_REGISTRY_ABI,
|
|
113
|
-
functionName: "getSchemaName",
|
|
114
|
-
args: [id]
|
|
115
|
-
}),
|
|
116
|
-
this.publicClient.readContract({
|
|
117
|
-
address: this.contractAddress,
|
|
118
|
-
abi: SCHEMA_REGISTRY_ABI,
|
|
119
|
-
functionName: "getSchemaOwner",
|
|
120
|
-
args: [id]
|
|
121
|
-
})
|
|
122
|
-
]);
|
|
123
|
-
return {
|
|
124
|
-
name,
|
|
125
|
-
specCid,
|
|
126
|
-
agentId,
|
|
127
|
-
owner
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
async schemaExists(nameOrId) {
|
|
131
|
-
const id = await this.resolveId(nameOrId);
|
|
132
|
-
return this.publicClient.readContract({
|
|
133
|
-
address: this.contractAddress,
|
|
134
|
-
abi: SCHEMA_REGISTRY_ABI,
|
|
135
|
-
functionName: "schemaExists",
|
|
136
|
-
args: [id]
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
async hasPublishers(nameOrId) {
|
|
140
|
-
const id = await this.resolveId(nameOrId);
|
|
141
|
-
return this.publicClient.readContract({
|
|
142
|
-
address: this.contractAddress,
|
|
143
|
-
abi: SCHEMA_REGISTRY_ABI,
|
|
144
|
-
functionName: "hasPublishers",
|
|
145
|
-
args: [id]
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
async isPublisher(nameOrId, publisher) {
|
|
149
|
-
const id = await this.resolveId(nameOrId);
|
|
150
|
-
return this.publicClient.readContract({
|
|
151
|
-
address: this.contractAddress,
|
|
152
|
-
abi: SCHEMA_REGISTRY_ABI,
|
|
153
|
-
functionName: "isPublisher",
|
|
154
|
-
args: [id, publisher]
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
async getPublisherCount(nameOrId) {
|
|
158
|
-
const id = await this.resolveId(nameOrId);
|
|
159
|
-
return this.publicClient.readContract({
|
|
160
|
-
address: this.contractAddress,
|
|
161
|
-
abi: SCHEMA_REGISTRY_ABI,
|
|
162
|
-
functionName: "getPublisherCount",
|
|
163
|
-
args: [id]
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
async waitForTransaction(hash) {
|
|
167
|
-
return this.publicClient.waitForTransactionReceipt({ hash });
|
|
168
|
-
}
|
|
169
|
-
async resolveId(nameOrId) {
|
|
170
|
-
if (isBytes32Hex(nameOrId)) return nameOrId;
|
|
171
|
-
return this.schemaId(nameOrId);
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
function isBytes32Hex(value) {
|
|
175
|
-
return /^0x[0-9a-fA-F]{64}$/.test(value);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
//#endregion
|
|
179
|
-
export { SchemaRegistry };
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
//#region src/registries/settlement-registry/abi.d.ts
|
|
2
|
-
declare const SETTLEMENT_REGISTRY_ABI: readonly [{
|
|
3
|
-
readonly inputs: readonly [{
|
|
4
|
-
readonly internalType: "uint8";
|
|
5
|
-
readonly name: "";
|
|
6
|
-
readonly type: "uint8";
|
|
7
|
-
}];
|
|
8
|
-
readonly name: "ErrCode";
|
|
9
|
-
readonly type: "error";
|
|
10
|
-
}, {
|
|
11
|
-
readonly inputs: readonly [{
|
|
12
|
-
readonly internalType: "bytes32";
|
|
13
|
-
readonly name: "resource_id";
|
|
14
|
-
readonly type: "bytes32";
|
|
15
|
-
}, {
|
|
16
|
-
readonly internalType: "uint256";
|
|
17
|
-
readonly name: "price";
|
|
18
|
-
readonly type: "uint256";
|
|
19
|
-
}, {
|
|
20
|
-
readonly internalType: "address";
|
|
21
|
-
readonly name: "owner";
|
|
22
|
-
readonly type: "address";
|
|
23
|
-
}];
|
|
24
|
-
readonly name: "createResource";
|
|
25
|
-
readonly outputs: readonly [{
|
|
26
|
-
readonly internalType: "uint256";
|
|
27
|
-
readonly name: "";
|
|
28
|
-
readonly type: "uint256";
|
|
29
|
-
}];
|
|
30
|
-
readonly stateMutability: "nonpayable";
|
|
31
|
-
readonly type: "function";
|
|
32
|
-
}, {
|
|
33
|
-
readonly inputs: readonly [{
|
|
34
|
-
readonly internalType: "bytes32";
|
|
35
|
-
readonly name: "resource_id";
|
|
36
|
-
readonly type: "bytes32";
|
|
37
|
-
}];
|
|
38
|
-
readonly name: "getGroupId";
|
|
39
|
-
readonly outputs: readonly [{
|
|
40
|
-
readonly internalType: "uint256";
|
|
41
|
-
readonly name: "";
|
|
42
|
-
readonly type: "uint256";
|
|
43
|
-
}];
|
|
44
|
-
readonly stateMutability: "view";
|
|
45
|
-
readonly type: "function";
|
|
46
|
-
}, {
|
|
47
|
-
readonly inputs: readonly [{
|
|
48
|
-
readonly internalType: "bytes32";
|
|
49
|
-
readonly name: "resource_id";
|
|
50
|
-
readonly type: "bytes32";
|
|
51
|
-
}];
|
|
52
|
-
readonly name: "getPrice";
|
|
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: "resource_id";
|
|
64
|
-
readonly type: "bytes32";
|
|
65
|
-
}, {
|
|
66
|
-
readonly internalType: "uint256";
|
|
67
|
-
readonly name: "identity_commitment";
|
|
68
|
-
readonly type: "uint256";
|
|
69
|
-
}];
|
|
70
|
-
readonly name: "isRegistered";
|
|
71
|
-
readonly outputs: readonly [{
|
|
72
|
-
readonly internalType: "bool";
|
|
73
|
-
readonly name: "";
|
|
74
|
-
readonly type: "bool";
|
|
75
|
-
}];
|
|
76
|
-
readonly stateMutability: "view";
|
|
77
|
-
readonly type: "function";
|
|
78
|
-
}, {
|
|
79
|
-
readonly inputs: readonly [{
|
|
80
|
-
readonly internalType: "address";
|
|
81
|
-
readonly name: "stealth_address";
|
|
82
|
-
readonly type: "address";
|
|
83
|
-
}, {
|
|
84
|
-
readonly internalType: "bytes32";
|
|
85
|
-
readonly name: "resource_id";
|
|
86
|
-
readonly type: "bytes32";
|
|
87
|
-
}];
|
|
88
|
-
readonly name: "isSettled";
|
|
89
|
-
readonly outputs: readonly [{
|
|
90
|
-
readonly internalType: "bool";
|
|
91
|
-
readonly name: "";
|
|
92
|
-
readonly type: "bool";
|
|
93
|
-
}];
|
|
94
|
-
readonly stateMutability: "view";
|
|
95
|
-
readonly type: "function";
|
|
96
|
-
}, {
|
|
97
|
-
readonly inputs: readonly [{
|
|
98
|
-
readonly internalType: "bytes32";
|
|
99
|
-
readonly name: "resource_id";
|
|
100
|
-
readonly type: "bytes32";
|
|
101
|
-
}, {
|
|
102
|
-
readonly internalType: "uint256";
|
|
103
|
-
readonly name: "identity_commitment";
|
|
104
|
-
readonly type: "uint256";
|
|
105
|
-
}, {
|
|
106
|
-
readonly internalType: "address";
|
|
107
|
-
readonly name: "from";
|
|
108
|
-
readonly type: "address";
|
|
109
|
-
}, {
|
|
110
|
-
readonly internalType: "address";
|
|
111
|
-
readonly name: "to";
|
|
112
|
-
readonly type: "address";
|
|
113
|
-
}, {
|
|
114
|
-
readonly internalType: "uint256";
|
|
115
|
-
readonly name: "amount";
|
|
116
|
-
readonly type: "uint256";
|
|
117
|
-
}, {
|
|
118
|
-
readonly internalType: "uint256";
|
|
119
|
-
readonly name: "valid_after";
|
|
120
|
-
readonly type: "uint256";
|
|
121
|
-
}, {
|
|
122
|
-
readonly internalType: "uint256";
|
|
123
|
-
readonly name: "valid_before";
|
|
124
|
-
readonly type: "uint256";
|
|
125
|
-
}, {
|
|
126
|
-
readonly internalType: "bytes32";
|
|
127
|
-
readonly name: "nonce";
|
|
128
|
-
readonly type: "bytes32";
|
|
129
|
-
}, {
|
|
130
|
-
readonly internalType: "uint8";
|
|
131
|
-
readonly name: "v";
|
|
132
|
-
readonly type: "uint8";
|
|
133
|
-
}, {
|
|
134
|
-
readonly internalType: "bytes32";
|
|
135
|
-
readonly name: "r";
|
|
136
|
-
readonly type: "bytes32";
|
|
137
|
-
}, {
|
|
138
|
-
readonly internalType: "bytes32";
|
|
139
|
-
readonly name: "s";
|
|
140
|
-
readonly type: "bytes32";
|
|
141
|
-
}];
|
|
142
|
-
readonly name: "register";
|
|
143
|
-
readonly outputs: readonly [];
|
|
144
|
-
readonly stateMutability: "payable";
|
|
145
|
-
readonly type: "function";
|
|
146
|
-
}, {
|
|
147
|
-
readonly inputs: readonly [{
|
|
148
|
-
readonly internalType: "address";
|
|
149
|
-
readonly name: "registry";
|
|
150
|
-
readonly type: "address";
|
|
151
|
-
}, {
|
|
152
|
-
readonly internalType: "bool";
|
|
153
|
-
readonly name: "authorized";
|
|
154
|
-
readonly type: "bool";
|
|
155
|
-
}];
|
|
156
|
-
readonly name: "setRegistry";
|
|
157
|
-
readonly outputs: readonly [];
|
|
158
|
-
readonly stateMutability: "nonpayable";
|
|
159
|
-
readonly type: "function";
|
|
160
|
-
}, {
|
|
161
|
-
readonly inputs: readonly [{
|
|
162
|
-
readonly internalType: "bytes32";
|
|
163
|
-
readonly name: "resource_id";
|
|
164
|
-
readonly type: "bytes32";
|
|
165
|
-
}, {
|
|
166
|
-
readonly internalType: "address";
|
|
167
|
-
readonly name: "stealth_address";
|
|
168
|
-
readonly type: "address";
|
|
169
|
-
}, {
|
|
170
|
-
readonly internalType: "uint256";
|
|
171
|
-
readonly name: "merkle_tree_depth";
|
|
172
|
-
readonly type: "uint256";
|
|
173
|
-
}, {
|
|
174
|
-
readonly internalType: "uint256";
|
|
175
|
-
readonly name: "merkle_tree_root";
|
|
176
|
-
readonly type: "uint256";
|
|
177
|
-
}, {
|
|
178
|
-
readonly internalType: "uint256";
|
|
179
|
-
readonly name: "nullifier";
|
|
180
|
-
readonly type: "uint256";
|
|
181
|
-
}, {
|
|
182
|
-
readonly internalType: "uint256";
|
|
183
|
-
readonly name: "message";
|
|
184
|
-
readonly type: "uint256";
|
|
185
|
-
}, {
|
|
186
|
-
readonly internalType: "uint256[8]";
|
|
187
|
-
readonly name: "points";
|
|
188
|
-
readonly type: "uint256[8]";
|
|
189
|
-
}, {
|
|
190
|
-
readonly internalType: "uint8[]";
|
|
191
|
-
readonly name: "hook_data";
|
|
192
|
-
readonly type: "uint8[]";
|
|
193
|
-
}];
|
|
194
|
-
readonly name: "settle";
|
|
195
|
-
readonly outputs: readonly [];
|
|
196
|
-
readonly stateMutability: "nonpayable";
|
|
197
|
-
readonly type: "function";
|
|
198
|
-
}, {
|
|
199
|
-
readonly inputs: readonly [{
|
|
200
|
-
readonly internalType: "bytes32";
|
|
201
|
-
readonly name: "resource_id";
|
|
202
|
-
readonly type: "bytes32";
|
|
203
|
-
}, {
|
|
204
|
-
readonly internalType: "address";
|
|
205
|
-
readonly name: "hook";
|
|
206
|
-
readonly type: "address";
|
|
207
|
-
}, {
|
|
208
|
-
readonly internalType: "uint256";
|
|
209
|
-
readonly name: "price";
|
|
210
|
-
readonly type: "uint256";
|
|
211
|
-
}];
|
|
212
|
-
readonly name: "updateResource";
|
|
213
|
-
readonly outputs: readonly [];
|
|
214
|
-
readonly stateMutability: "nonpayable";
|
|
215
|
-
readonly type: "function";
|
|
216
|
-
}];
|
|
217
|
-
//#endregion
|
|
218
|
-
export { SETTLEMENT_REGISTRY_ABI };
|