@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,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 };
@@ -1,259 +0,0 @@
1
- //#region src/registries/settlement-registry/abi.ts
2
- const SETTLEMENT_REGISTRY_ABI = [
3
- {
4
- "inputs": [{
5
- "internalType": "uint8",
6
- "name": "",
7
- "type": "uint8"
8
- }],
9
- "name": "ErrCode",
10
- "type": "error"
11
- },
12
- {
13
- "inputs": [
14
- {
15
- "internalType": "bytes32",
16
- "name": "resource_id",
17
- "type": "bytes32"
18
- },
19
- {
20
- "internalType": "uint256",
21
- "name": "price",
22
- "type": "uint256"
23
- },
24
- {
25
- "internalType": "address",
26
- "name": "owner",
27
- "type": "address"
28
- }
29
- ],
30
- "name": "createResource",
31
- "outputs": [{
32
- "internalType": "uint256",
33
- "name": "",
34
- "type": "uint256"
35
- }],
36
- "stateMutability": "nonpayable",
37
- "type": "function"
38
- },
39
- {
40
- "inputs": [{
41
- "internalType": "bytes32",
42
- "name": "resource_id",
43
- "type": "bytes32"
44
- }],
45
- "name": "getGroupId",
46
- "outputs": [{
47
- "internalType": "uint256",
48
- "name": "",
49
- "type": "uint256"
50
- }],
51
- "stateMutability": "view",
52
- "type": "function"
53
- },
54
- {
55
- "inputs": [{
56
- "internalType": "bytes32",
57
- "name": "resource_id",
58
- "type": "bytes32"
59
- }],
60
- "name": "getPrice",
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": "resource_id",
73
- "type": "bytes32"
74
- }, {
75
- "internalType": "uint256",
76
- "name": "identity_commitment",
77
- "type": "uint256"
78
- }],
79
- "name": "isRegistered",
80
- "outputs": [{
81
- "internalType": "bool",
82
- "name": "",
83
- "type": "bool"
84
- }],
85
- "stateMutability": "view",
86
- "type": "function"
87
- },
88
- {
89
- "inputs": [{
90
- "internalType": "address",
91
- "name": "stealth_address",
92
- "type": "address"
93
- }, {
94
- "internalType": "bytes32",
95
- "name": "resource_id",
96
- "type": "bytes32"
97
- }],
98
- "name": "isSettled",
99
- "outputs": [{
100
- "internalType": "bool",
101
- "name": "",
102
- "type": "bool"
103
- }],
104
- "stateMutability": "view",
105
- "type": "function"
106
- },
107
- {
108
- "inputs": [
109
- {
110
- "internalType": "bytes32",
111
- "name": "resource_id",
112
- "type": "bytes32"
113
- },
114
- {
115
- "internalType": "uint256",
116
- "name": "identity_commitment",
117
- "type": "uint256"
118
- },
119
- {
120
- "internalType": "address",
121
- "name": "from",
122
- "type": "address"
123
- },
124
- {
125
- "internalType": "address",
126
- "name": "to",
127
- "type": "address"
128
- },
129
- {
130
- "internalType": "uint256",
131
- "name": "amount",
132
- "type": "uint256"
133
- },
134
- {
135
- "internalType": "uint256",
136
- "name": "valid_after",
137
- "type": "uint256"
138
- },
139
- {
140
- "internalType": "uint256",
141
- "name": "valid_before",
142
- "type": "uint256"
143
- },
144
- {
145
- "internalType": "bytes32",
146
- "name": "nonce",
147
- "type": "bytes32"
148
- },
149
- {
150
- "internalType": "uint8",
151
- "name": "v",
152
- "type": "uint8"
153
- },
154
- {
155
- "internalType": "bytes32",
156
- "name": "r",
157
- "type": "bytes32"
158
- },
159
- {
160
- "internalType": "bytes32",
161
- "name": "s",
162
- "type": "bytes32"
163
- }
164
- ],
165
- "name": "register",
166
- "outputs": [],
167
- "stateMutability": "payable",
168
- "type": "function"
169
- },
170
- {
171
- "inputs": [{
172
- "internalType": "address",
173
- "name": "registry",
174
- "type": "address"
175
- }, {
176
- "internalType": "bool",
177
- "name": "authorized",
178
- "type": "bool"
179
- }],
180
- "name": "setRegistry",
181
- "outputs": [],
182
- "stateMutability": "nonpayable",
183
- "type": "function"
184
- },
185
- {
186
- "inputs": [
187
- {
188
- "internalType": "bytes32",
189
- "name": "resource_id",
190
- "type": "bytes32"
191
- },
192
- {
193
- "internalType": "address",
194
- "name": "stealth_address",
195
- "type": "address"
196
- },
197
- {
198
- "internalType": "uint256",
199
- "name": "merkle_tree_depth",
200
- "type": "uint256"
201
- },
202
- {
203
- "internalType": "uint256",
204
- "name": "merkle_tree_root",
205
- "type": "uint256"
206
- },
207
- {
208
- "internalType": "uint256",
209
- "name": "nullifier",
210
- "type": "uint256"
211
- },
212
- {
213
- "internalType": "uint256",
214
- "name": "message",
215
- "type": "uint256"
216
- },
217
- {
218
- "internalType": "uint256[8]",
219
- "name": "points",
220
- "type": "uint256[8]"
221
- },
222
- {
223
- "internalType": "uint8[]",
224
- "name": "hook_data",
225
- "type": "uint8[]"
226
- }
227
- ],
228
- "name": "settle",
229
- "outputs": [],
230
- "stateMutability": "nonpayable",
231
- "type": "function"
232
- },
233
- {
234
- "inputs": [
235
- {
236
- "internalType": "bytes32",
237
- "name": "resource_id",
238
- "type": "bytes32"
239
- },
240
- {
241
- "internalType": "address",
242
- "name": "hook",
243
- "type": "address"
244
- },
245
- {
246
- "internalType": "uint256",
247
- "name": "price",
248
- "type": "uint256"
249
- }
250
- ],
251
- "name": "updateResource",
252
- "outputs": [],
253
- "stateMutability": "nonpayable",
254
- "type": "function"
255
- }
256
- ];
257
-
258
- //#endregion
259
- export { SETTLEMENT_REGISTRY_ABI };
@@ -1,63 +0,0 @@
1
- import { PrepareSettleParams, PrepareSettleResult, RegisterParams, SettleParams, TransferWithAuthParams, TransferWithAuthPayload } from "./types.js";
2
- import * as viem431 from "viem";
3
- import { Address, Hex, PublicClient, WalletClient } from "viem";
4
-
5
- //#region src/registries/settlement-registry/index.d.ts
6
- declare class SettlementRegistry {
7
- readonly contractAddress: Address;
8
- private readonly publicClient;
9
- private readonly walletClient;
10
- constructor(contractAddress: Address, publicClient: PublicClient, walletClient: WalletClient);
11
- private getAccount;
12
- private getChain;
13
- /**
14
- * Authorize or revoke a DataSourceRegistry contract.
15
- * Only callable by the contract admin.
16
- */
17
- setRegistry(registry: Address, authorized: boolean): Promise<Hex>;
18
- /**
19
- * Create a Semaphore group for a resource.
20
- * In production this is called by the DataSourceRegistry, which passes
21
- * the publisher wallet as `owner`. Direct calls require the caller to
22
- * be an authorized registry.
23
- */
24
- createResource(resourceId: Hex, price: bigint, owner: Address): Promise<Hex>;
25
- /**
26
- * Update the price for a resource.
27
- * In production this is called by the DataSourceRegistry.
28
- */
29
- updatePrice(resourceId: Hex, hook: Address, price: bigint): Promise<Hex>;
30
- /**
31
- * Prepare the EIP-3009 transferWithAuthorization signature.
32
- */
33
- prepareTransferWithAuth(params: TransferWithAuthParams): Promise<TransferWithAuthPayload>;
34
- /**
35
- * Phase 1 — submit payment and join the Semaphore group.
36
- * Submitted via a relayer so the buyer's burner wallet is never linked
37
- * to their identity commitment on-chain.
38
- */
39
- register(params: RegisterParams): Promise<Hex>;
40
- /**
41
- * Build the Semaphore proof for Phase 2.
42
- */
43
- prepareSettle(params: PrepareSettleParams): Promise<PrepareSettleResult>;
44
- /**
45
- * Phase 2 — prove group membership and claim access.
46
- * Submitted via a relayer for unlinkability.
47
- */
48
- settle(params: SettleParams): Promise<{
49
- hash: Hex;
50
- nullifier: bigint;
51
- }>;
52
- isSettled(stealthAddress: Address, resourceId: Hex): Promise<boolean>;
53
- isRegistered(resourceId: Hex, identityCommitment: bigint): Promise<boolean>;
54
- getGroupId(resourceId: Hex): Promise<bigint>;
55
- getPrice(resourceId: Hex): Promise<bigint>;
56
- waitForTransaction(hash: Hex): Promise<viem431.TransactionReceipt>;
57
- /**
58
- * Reconstruct the Semaphore group from MemberRegistered events.
59
- */
60
- private fetchGroup;
61
- }
62
- //#endregion
63
- export { SettlementRegistry };