@shodai-network/agreements-protocol-evm 0.1.4

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 (110) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +6 -0
  3. package/README.md +102 -0
  4. package/dist/cjs/AgreementEngine.d.ts +219 -0
  5. package/dist/cjs/AgreementEngine.d.ts.map +1 -0
  6. package/dist/cjs/AgreementEngine.js +454 -0
  7. package/dist/cjs/AgreementEngine.js.map +1 -0
  8. package/dist/cjs/AgreementFactory.d.ts +186 -0
  9. package/dist/cjs/AgreementFactory.d.ts.map +1 -0
  10. package/dist/cjs/AgreementFactory.js +541 -0
  11. package/dist/cjs/AgreementFactory.js.map +1 -0
  12. package/dist/cjs/deployments.d.ts +37 -0
  13. package/dist/cjs/deployments.d.ts.map +1 -0
  14. package/dist/cjs/deployments.js +90 -0
  15. package/dist/cjs/deployments.js.map +1 -0
  16. package/dist/cjs/generated/AgreementEngineAbi.d.ts +651 -0
  17. package/dist/cjs/generated/AgreementEngineAbi.d.ts.map +1 -0
  18. package/dist/cjs/generated/AgreementEngineAbi.js +842 -0
  19. package/dist/cjs/generated/AgreementEngineAbi.js.map +1 -0
  20. package/dist/cjs/generated/AgreementFactoryAbi.d.ts +861 -0
  21. package/dist/cjs/generated/AgreementFactoryAbi.d.ts.map +1 -0
  22. package/dist/cjs/generated/AgreementFactoryAbi.js +1117 -0
  23. package/dist/cjs/generated/AgreementFactoryAbi.js.map +1 -0
  24. package/dist/cjs/generated/DeploymentsRegistry.d.ts +50 -0
  25. package/dist/cjs/generated/DeploymentsRegistry.d.ts.map +1 -0
  26. package/dist/cjs/generated/DeploymentsRegistry.js +54 -0
  27. package/dist/cjs/generated/DeploymentsRegistry.js.map +1 -0
  28. package/dist/cjs/index.d.ts +15 -0
  29. package/dist/cjs/index.d.ts.map +1 -0
  30. package/dist/cjs/index.js +32 -0
  31. package/dist/cjs/index.js.map +1 -0
  32. package/dist/cjs/package.json +3 -0
  33. package/dist/cjs/payload-builder.d.ts +122 -0
  34. package/dist/cjs/payload-builder.d.ts.map +1 -0
  35. package/dist/cjs/payload-builder.js +186 -0
  36. package/dist/cjs/payload-builder.js.map +1 -0
  37. package/dist/cjs/rpc-transport.d.ts +3 -0
  38. package/dist/cjs/rpc-transport.d.ts.map +1 -0
  39. package/dist/cjs/rpc-transport.js +87 -0
  40. package/dist/cjs/rpc-transport.js.map +1 -0
  41. package/dist/cjs/telemetry.d.ts +5 -0
  42. package/dist/cjs/telemetry.d.ts.map +1 -0
  43. package/dist/cjs/telemetry.js +54 -0
  44. package/dist/cjs/telemetry.js.map +1 -0
  45. package/dist/cjs/transactions.d.ts +25 -0
  46. package/dist/cjs/transactions.d.ts.map +1 -0
  47. package/dist/cjs/transactions.js +40 -0
  48. package/dist/cjs/transactions.js.map +1 -0
  49. package/dist/cjs/transformer.d.ts +112 -0
  50. package/dist/cjs/transformer.d.ts.map +1 -0
  51. package/dist/cjs/transformer.js +498 -0
  52. package/dist/cjs/transformer.js.map +1 -0
  53. package/dist/cjs/types.d.ts +311 -0
  54. package/dist/cjs/types.d.ts.map +1 -0
  55. package/dist/cjs/types.js +48 -0
  56. package/dist/cjs/types.js.map +1 -0
  57. package/dist/esm/AgreementEngine.d.ts +219 -0
  58. package/dist/esm/AgreementEngine.d.ts.map +1 -0
  59. package/dist/esm/AgreementEngine.js +450 -0
  60. package/dist/esm/AgreementEngine.js.map +1 -0
  61. package/dist/esm/AgreementFactory.d.ts +186 -0
  62. package/dist/esm/AgreementFactory.d.ts.map +1 -0
  63. package/dist/esm/AgreementFactory.js +537 -0
  64. package/dist/esm/AgreementFactory.js.map +1 -0
  65. package/dist/esm/deployments.d.ts +37 -0
  66. package/dist/esm/deployments.d.ts.map +1 -0
  67. package/dist/esm/deployments.js +82 -0
  68. package/dist/esm/deployments.js.map +1 -0
  69. package/dist/esm/generated/AgreementEngineAbi.d.ts +651 -0
  70. package/dist/esm/generated/AgreementEngineAbi.d.ts.map +1 -0
  71. package/dist/esm/generated/AgreementEngineAbi.js +839 -0
  72. package/dist/esm/generated/AgreementEngineAbi.js.map +1 -0
  73. package/dist/esm/generated/AgreementFactoryAbi.d.ts +861 -0
  74. package/dist/esm/generated/AgreementFactoryAbi.d.ts.map +1 -0
  75. package/dist/esm/generated/AgreementFactoryAbi.js +1114 -0
  76. package/dist/esm/generated/AgreementFactoryAbi.js.map +1 -0
  77. package/dist/esm/generated/DeploymentsRegistry.d.ts +50 -0
  78. package/dist/esm/generated/DeploymentsRegistry.d.ts.map +1 -0
  79. package/dist/esm/generated/DeploymentsRegistry.js +51 -0
  80. package/dist/esm/generated/DeploymentsRegistry.js.map +1 -0
  81. package/dist/esm/index.d.ts +15 -0
  82. package/dist/esm/index.d.ts.map +1 -0
  83. package/dist/esm/index.js +16 -0
  84. package/dist/esm/index.js.map +1 -0
  85. package/dist/esm/package.json +3 -0
  86. package/dist/esm/payload-builder.d.ts +122 -0
  87. package/dist/esm/payload-builder.d.ts.map +1 -0
  88. package/dist/esm/payload-builder.js +173 -0
  89. package/dist/esm/payload-builder.js.map +1 -0
  90. package/dist/esm/rpc-transport.d.ts +3 -0
  91. package/dist/esm/rpc-transport.d.ts.map +1 -0
  92. package/dist/esm/rpc-transport.js +84 -0
  93. package/dist/esm/rpc-transport.js.map +1 -0
  94. package/dist/esm/telemetry.d.ts +5 -0
  95. package/dist/esm/telemetry.d.ts.map +1 -0
  96. package/dist/esm/telemetry.js +51 -0
  97. package/dist/esm/telemetry.js.map +1 -0
  98. package/dist/esm/transactions.d.ts +25 -0
  99. package/dist/esm/transactions.d.ts.map +1 -0
  100. package/dist/esm/transactions.js +36 -0
  101. package/dist/esm/transactions.js.map +1 -0
  102. package/dist/esm/transformer.d.ts +112 -0
  103. package/dist/esm/transformer.d.ts.map +1 -0
  104. package/dist/esm/transformer.js +480 -0
  105. package/dist/esm/transformer.js.map +1 -0
  106. package/dist/esm/types.d.ts +311 -0
  107. package/dist/esm/types.d.ts.map +1 -0
  108. package/dist/esm/types.js +45 -0
  109. package/dist/esm/types.js.map +1 -0
  110. package/package.json +56 -0
@@ -0,0 +1,450 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { readContractResult, executeTransaction } from "./transactions.js";
3
+ import { buildInputPayload, inputToBytes32 } from "./payload-builder.js";
4
+ import { stateToBytes32 } from "./transformer.js";
5
+ import { withSdkSpan } from "./telemetry.js";
6
+ import { AgreementEngineABI } from "./generated/AgreementEngineAbi.js";
7
+ // Use inlined ABI data (works in both Node.js and browser)
8
+ // ABI is extracted directly from contract artifacts as an array
9
+ const engineAbi = AgreementEngineABI;
10
+ /**
11
+ * Agreement instance for interacting with a specific on-chain agreement
12
+ *
13
+ * Each agreement is a separate clone contract. This class provides
14
+ * methods to interact with a specific agreement instance.
15
+ */
16
+ export class AgreementEngine {
17
+ /**
18
+ * Create a new Agreement instance
19
+ *
20
+ * @param address - The agreement contract address (clone address)
21
+ * @param publicClient - viem PublicClient for read-only operations
22
+ * @param walletClient - Optional viem WalletClient for submitting inputs
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * // Read-only agreement
27
+ * const agreement = new Agreement("0x...", provider);
28
+ * const state = await agreement.getCurrentState();
29
+ *
30
+ * // Agreement with signer (can submit inputs)
31
+ * const agreement = new Agreement("0x...", signer);
32
+ * await agreement.submitInput(agreementJson, "grantorData", { ... });
33
+ * ```
34
+ */
35
+ constructor(address, publicClient, walletClient) {
36
+ this.address = address;
37
+ this.publicClient = publicClient;
38
+ this.walletClient = walletClient;
39
+ }
40
+ /**
41
+ * Get all on-chain agreement data
42
+ *
43
+ * @returns Complete on-chain agreement information
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * const agreement = new Agreement("0x...", provider);
48
+ * const data = await agreement.getData();
49
+ * console.log(`Current state: ${data.currentState}`);
50
+ * console.log(`Owner: ${data.owner}`);
51
+ * ```
52
+ */
53
+ async getData() {
54
+ return await withSdkSpan("agreement_engine.get_data", {
55
+ "blockchain.chain_id": this.publicClient.chain?.id,
56
+ "agreement.address": this.address,
57
+ }, async () => {
58
+ const [docUri, docHash, initialState, currentState, owner] = await Promise.all([
59
+ readContractResult(this.publicClient, {
60
+ address: this.address,
61
+ abi: engineAbi,
62
+ functionName: 'docUri',
63
+ args: [],
64
+ }),
65
+ readContractResult(this.publicClient, {
66
+ address: this.address,
67
+ abi: engineAbi,
68
+ functionName: 'docHash',
69
+ args: [],
70
+ }),
71
+ readContractResult(this.publicClient, {
72
+ address: this.address,
73
+ abi: engineAbi,
74
+ functionName: 'initialState',
75
+ args: [],
76
+ }),
77
+ readContractResult(this.publicClient, {
78
+ address: this.address,
79
+ abi: engineAbi,
80
+ functionName: 'currentState',
81
+ args: [],
82
+ }),
83
+ readContractResult(this.publicClient, {
84
+ address: this.address,
85
+ abi: engineAbi,
86
+ functionName: 'owner',
87
+ args: [],
88
+ }),
89
+ ]);
90
+ return {
91
+ address: this.address,
92
+ docUri,
93
+ docHash: docHash,
94
+ initialState: initialState,
95
+ currentState: currentState,
96
+ owner: owner,
97
+ };
98
+ });
99
+ }
100
+ /**
101
+ * Get the current state of the agreement
102
+ *
103
+ * @param agreementJson - Optional agreement JSON. If provided, returns the state name string instead of bytes32
104
+ * @returns The current state as bytes32, or state name string if agreementJson is provided
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * // Get bytes32 state
109
+ * const agreement = new Agreement("0x...", provider);
110
+ * const stateBytes32 = await agreement.getCurrentState();
111
+ *
112
+ * // Get state name string
113
+ * const stateName = await agreement.getCurrentState(agreementJson);
114
+ * ```
115
+ */
116
+ async getCurrentState(agreementJson) {
117
+ return await withSdkSpan("agreement_engine.get_current_state", {
118
+ "blockchain.chain_id": this.publicClient.chain?.id,
119
+ "agreement.address": this.address,
120
+ }, async () => {
121
+ const state = await readContractResult(this.publicClient, {
122
+ address: this.address,
123
+ abi: engineAbi,
124
+ functionName: 'currentState',
125
+ args: [],
126
+ });
127
+ const stateHex = state;
128
+ if (agreementJson) {
129
+ // Look up state name by comparing bytes32 values
130
+ const states = Object.keys(agreementJson.execution.states);
131
+ for (const stateName of states) {
132
+ if (stateToBytes32(stateName).toLowerCase() === stateHex.toLowerCase()) {
133
+ return stateName;
134
+ }
135
+ }
136
+ throw new Error(`State ${stateHex} not found in agreement states`);
137
+ }
138
+ return stateHex;
139
+ });
140
+ }
141
+ /**
142
+ * Get the initial state of the agreement
143
+ *
144
+ * @returns The initial state as bytes32
145
+ */
146
+ async getInitialState() {
147
+ const state = await readContractResult(this.publicClient, {
148
+ address: this.address,
149
+ abi: engineAbi,
150
+ functionName: 'initialState',
151
+ args: [],
152
+ });
153
+ return state;
154
+ }
155
+ /**
156
+ * Get the document URI
157
+ *
158
+ * @returns The document URI string
159
+ */
160
+ async getDocUri() {
161
+ return await readContractResult(this.publicClient, {
162
+ address: this.address,
163
+ abi: engineAbi,
164
+ functionName: 'docUri',
165
+ args: [],
166
+ });
167
+ }
168
+ /**
169
+ * Get the document hash
170
+ *
171
+ * @returns The document hash as bytes32
172
+ */
173
+ async getDocHash() {
174
+ const hash = await readContractResult(this.publicClient, {
175
+ address: this.address,
176
+ abi: engineAbi,
177
+ functionName: 'docHash',
178
+ args: [],
179
+ });
180
+ return hash;
181
+ }
182
+ /**
183
+ * Get the owner of the agreement
184
+ *
185
+ * @returns The owner address
186
+ */
187
+ async getOwner() {
188
+ const owner = await readContractResult(this.publicClient, {
189
+ address: this.address,
190
+ abi: engineAbi,
191
+ functionName: 'owner',
192
+ args: [],
193
+ });
194
+ return owner;
195
+ }
196
+ /**
197
+ * Submit an input to progress the agreement's state machine
198
+ *
199
+ * @param agreement - The agreement JSON definition (for field type resolution)
200
+ * @param inputId - The input identifier (e.g., "grantorData")
201
+ * @param data - Plain object with field values
202
+ * @param waitForConfirmation - Whether to wait for transaction confirmation (default: false)
203
+ * @returns Transaction hash, or receipt if waitForConfirmation is true
204
+ *
205
+ * @example
206
+ * ```typescript
207
+ * const agreement = new Agreement("0x...", signer);
208
+ *
209
+ * // Fire and forget
210
+ * const txHash = await agreement.submitInput(
211
+ * agreementJson,
212
+ * "grantorData",
213
+ * { grantorName: "Alice", scope: "Development of Web3 tooling" }
214
+ * );
215
+ *
216
+ * // Wait for confirmation
217
+ * const receipt = await agreement.submitInput(
218
+ * agreementJson,
219
+ * "grantorData",
220
+ * { grantorName: "Alice", scope: "Development of Web3 tooling" },
221
+ * true
222
+ * );
223
+ * console.log(`Transaction confirmed in block ${receipt.blockNumber}`);
224
+ * ```
225
+ */
226
+ async submitInput(agreement, inputId, data, waitForConfirmation = false) {
227
+ return await withSdkSpan("agreement_engine.submit_input", {
228
+ "blockchain.chain_id": this.publicClient.chain?.id,
229
+ "agreement.address": this.address,
230
+ "agreement.input_id": inputId,
231
+ }, async () => {
232
+ if (!this.walletClient) {
233
+ throw new Error("WalletClient required for submitting inputs. Pass a walletClient to the constructor.");
234
+ }
235
+ // Build payload using payload-builder
236
+ const payload = buildInputPayload(agreement, inputId, data);
237
+ const inputIdBytes32 = inputToBytes32(inputId);
238
+ // Build the write contract request
239
+ const request = {
240
+ chain: null,
241
+ account: this.walletClient.account,
242
+ address: this.address,
243
+ abi: engineAbi,
244
+ functionName: 'submitInput',
245
+ args: [inputIdBytes32, payload],
246
+ };
247
+ // Use executeTransaction utility for optional waiting
248
+ const result = await executeTransaction(request, this.publicClient, this.walletClient, waitForConfirmation);
249
+ // Return hash if not waiting, full receipt if waiting
250
+ if (waitForConfirmation) {
251
+ return result;
252
+ }
253
+ return result.transactionHash;
254
+ });
255
+ }
256
+ /**
257
+ * Get the verifier address for a given key
258
+ *
259
+ * @param key - Verifier key
260
+ * @returns The verifier contract address, or zero address if not registered
261
+ */
262
+ async getVerifier(key) {
263
+ const verifier = await readContractResult(this.publicClient, {
264
+ address: this.address,
265
+ abi: engineAbi,
266
+ functionName: 'verifierRegistry',
267
+ args: [key],
268
+ });
269
+ return verifier;
270
+ }
271
+ /**
272
+ * Get the current nonce for a signer address
273
+ *
274
+ * @param signer - The signer address to get the nonce for
275
+ * @returns The current nonce value
276
+ */
277
+ async getNonce(signer) {
278
+ const nonce = await readContractResult(this.publicClient, {
279
+ address: this.address,
280
+ abi: engineAbi,
281
+ functionName: 'nonces',
282
+ args: [signer],
283
+ });
284
+ return nonce;
285
+ }
286
+ /**
287
+ * Create an EIP-712 permit signature for submitting an input
288
+ *
289
+ * @param signer - The signer that will create the signature (must be a Signer, not Provider)
290
+ * @param agreement - The agreement JSON definition
291
+ * @param inputId - The input identifier (e.g., "grantorData")
292
+ * @param data - Plain object with field values
293
+ * @param deadline - Unix timestamp when the permit expires
294
+ * @returns The signature components (v, r, s) and the signer address
295
+ *
296
+ * @example
297
+ * ```typescript
298
+ * const agreement = new AgreementEngine("0x...", provider);
299
+ * const deadline = Math.floor(Date.now() / 1000) + 3600; // 1 hour from now
300
+ *
301
+ * const { signature, signerAddress } = await agreement.createPermitSignature(
302
+ * signer,
303
+ * agreementJson,
304
+ * "grantorData",
305
+ * { grantorName: "Alice" },
306
+ * deadline
307
+ * );
308
+ * ```
309
+ */
310
+ async createPermitSignature(walletClient, agreement, inputId, data, deadline) {
311
+ // Get current nonce for the signer
312
+ const account = walletClient.account;
313
+ if (!account) {
314
+ throw new Error("WalletClient must be connected to an account to sign typed data");
315
+ }
316
+ const signerAddress = account.address;
317
+ const nonce = await this.getNonce(signerAddress);
318
+ // Build the payload
319
+ const payload = buildInputPayload(agreement, inputId, data);
320
+ const inputIdBytes32 = inputToBytes32(inputId);
321
+ // Get chain ID
322
+ const chainId = await this.publicClient.getChainId();
323
+ // EIP-712 domain & types (kept structurally identical to previous ethers version)
324
+ const domain = {
325
+ name: "AgreementEngine",
326
+ version: "1",
327
+ chainId,
328
+ verifyingContract: this.address,
329
+ };
330
+ const types = {
331
+ PermitInput: [
332
+ { name: "inputId", type: "bytes32" },
333
+ { name: "payload", type: "bytes" },
334
+ { name: "nonce", type: "uint256" },
335
+ { name: "deadline", type: "uint256" },
336
+ ],
337
+ };
338
+ const message = {
339
+ inputId: inputIdBytes32,
340
+ payload: payload,
341
+ nonce: nonce,
342
+ deadline: BigInt(deadline),
343
+ };
344
+ // Sign using viem WalletClient
345
+ const signature = await walletClient.signTypedData({
346
+ account,
347
+ domain,
348
+ types,
349
+ primaryType: "PermitInput",
350
+ message,
351
+ });
352
+ // Split signature into v, r, s
353
+ const r = `0x${signature.slice(2, 66)}`;
354
+ const s = `0x${signature.slice(66, 130)}`;
355
+ const v = parseInt(signature.slice(130, 132), 16);
356
+ return {
357
+ signature: { v, r, s },
358
+ signerAddress,
359
+ };
360
+ }
361
+ /**
362
+ * Submit an input using a permit signature, allowing someone else to submit on behalf of the signer
363
+ *
364
+ * @param signer - The address that signed the permit
365
+ * @param agreement - The agreement JSON definition
366
+ * @param inputId - The input identifier
367
+ * @param data - Plain object with field values
368
+ * @param deadline - Unix timestamp when the permit expires
369
+ * @param signature - The permit signature (v, r, s components)
370
+ * @param waitForConfirmation - Whether to wait for transaction confirmation (default: false)
371
+ * @returns Transaction hash, or receipt if waitForConfirmation is true
372
+ *
373
+ * @example
374
+ * ```typescript
375
+ * // Signer creates permit off-chain
376
+ * const { signature, signerAddress } = await agreement.createPermitSignature(
377
+ * signer,
378
+ * agreementJson,
379
+ * "grantorData",
380
+ * { grantorName: "Alice" },
381
+ * deadline
382
+ * );
383
+ *
384
+ * // Anyone can submit using the permit
385
+ * const agreementWithSubmitter = new AgreementEngine(agreementAddress, submitterSigner);
386
+ *
387
+ * // Fire and forget
388
+ * const txHash = await agreementWithSubmitter.submitInputWithPermit(
389
+ * signerAddress,
390
+ * agreementJson,
391
+ * "grantorData",
392
+ * { grantorName: "Alice" },
393
+ * deadline,
394
+ * signature
395
+ * );
396
+ *
397
+ * // Wait for confirmation
398
+ * const receipt = await agreementWithSubmitter.submitInputWithPermit(
399
+ * signerAddress,
400
+ * agreementJson,
401
+ * "grantorData",
402
+ * { grantorName: "Alice" },
403
+ * deadline,
404
+ * signature,
405
+ * true
406
+ * );
407
+ * console.log(`Transaction confirmed in block ${receipt.blockNumber}`);
408
+ * ```
409
+ */
410
+ async submitInputWithPermit(signer, agreement, inputId, data, deadline, signature, waitForConfirmation = false) {
411
+ return await withSdkSpan("agreement_engine.submit_input_with_permit", {
412
+ "blockchain.chain_id": this.publicClient.chain?.id,
413
+ "agreement.address": this.address,
414
+ "agreement.input_id": inputId,
415
+ "wallet.signer": signer,
416
+ }, async () => {
417
+ if (!this.walletClient) {
418
+ throw new Error("WalletClient required for submitting inputs. Pass a walletClient to the constructor.");
419
+ }
420
+ // Build payload (must match what was signed)
421
+ const payload = buildInputPayload(agreement, inputId, data);
422
+ const inputIdBytes32 = inputToBytes32(inputId);
423
+ // Build the write contract request
424
+ const request = {
425
+ chain: null,
426
+ account: this.walletClient.account,
427
+ address: this.address,
428
+ abi: engineAbi,
429
+ functionName: 'submitInputWithPermit',
430
+ args: [
431
+ signer,
432
+ inputIdBytes32,
433
+ payload,
434
+ BigInt(deadline),
435
+ signature.v,
436
+ signature.r,
437
+ signature.s,
438
+ ],
439
+ };
440
+ // Use executeTransaction utility for optional waiting
441
+ const result = await executeTransaction(request, this.publicClient, this.walletClient, waitForConfirmation);
442
+ // Return hash if not waiting, full receipt if waiting
443
+ if (waitForConfirmation) {
444
+ return result;
445
+ }
446
+ return result.transactionHash;
447
+ });
448
+ }
449
+ }
450
+ //# sourceMappingURL=AgreementEngine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgreementEngine.js","sourceRoot":"","sources":["../../src/AgreementEngine.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAWtC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE3E,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC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C;IACJ,CAAC;CACF"}
@@ -0,0 +1,186 @@
1
+ import { type Hex, type PublicClient, type WalletClient, type WriteContractParameters } from 'viem';
2
+ import { AgreementJson, FactoryConfig, VerifierInit } from "./types.js";
3
+ import { InitValue } from "./transformer.js";
4
+ export type CreateAgreementOptions = {
5
+ docUri?: string;
6
+ initValues?: Record<string, InitValue>;
7
+ verifiers?: VerifierInit[];
8
+ };
9
+ export type CreateAgreementPermitSignature = {
10
+ v: number;
11
+ r: Hex;
12
+ s: Hex;
13
+ };
14
+ interface FactoryClients {
15
+ walletClient: WalletClient;
16
+ publicClient: PublicClient;
17
+ }
18
+ /**
19
+ * Factory for creating new Agreement instances
20
+ *
21
+ * The factory uses EIP-1167 minimal proxy clones where each agreement
22
+ * is deployed as a separate contract. The factory creates clones that
23
+ * point to a shared implementation.
24
+ */
25
+ export declare class AgreementFactory {
26
+ private readonly clients;
27
+ private config;
28
+ private chainId?;
29
+ /**
30
+ * Create a new AgreementFactory instance
31
+ *
32
+ * @param config - Factory configuration
33
+ * @param config.factoryAddress - The AgreementFactory contract address (required)
34
+ * @param config.chainId - Optional chain ID for reference (can be fetched via getChainId())
35
+ * @param clients.walletClient - Wallet client for creating agreements (must be connected to an account)
36
+ * @param clients.publicClient - Public client for reading receipts / logs
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * const factory = new AgreementFactory(
41
+ * { factoryAddress: "0x..." },
42
+ * { publicClient, walletClient }
43
+ * );
44
+ * ```
45
+ */
46
+ constructor(config: FactoryConfig, clients: FactoryClients);
47
+ /**
48
+ * Get the current chain ID from the signer's provider
49
+ *
50
+ * @returns The chain ID as a number
51
+ */
52
+ getChainId(): Promise<number>;
53
+ /**
54
+ * Internal helper: simulate a contract call, and if the RPC complains about
55
+ * gas price being below the configured minimum, bump gas values and re-simulate.
56
+ */
57
+ private simulate;
58
+ private parseAgreementDeployedAddress;
59
+ private hashInputDefs;
60
+ private hashTransitions;
61
+ private hashInitVars;
62
+ private hashVerifiers;
63
+ private hashActions;
64
+ /**
65
+ * Create a new agreement from an AgreementJson definition
66
+ *
67
+ * @param agreement - The agreement JSON definition
68
+ * @param options - Optional configuration
69
+ * @param options.docUri - Custom document URI (defaults to ipfs://agreement/{id})
70
+ * @param options.initValues - Initialization values for variables referenced in initialize.data
71
+ * @returns The deployed agreement contract address and transaction response
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const factory = new AgreementFactory(
76
+ * { factoryAddress: "0x..." },
77
+ * { publicClient, walletClient }
78
+ * );
79
+ *
80
+ * const { address, receipt } = await factory.createAgreement(agreementJson, {
81
+ * initValues: {
82
+ * grantorEthAddress: "0x123...",
83
+ * recipientEthAddress: "0x456..."
84
+ * }
85
+ * });
86
+ * ```
87
+ */
88
+ createAgreement(agreement: AgreementJson, options?: CreateAgreementOptions): Promise<{
89
+ address: Hex;
90
+ request: WriteContractParameters;
91
+ receipt: Awaited<ReturnType<PublicClient["waitForTransactionReceipt"]>>;
92
+ }>;
93
+ /**
94
+ * Read the current permit nonce for a signer address.
95
+ */
96
+ getNonce(signer: Hex): Promise<bigint>;
97
+ /**
98
+ * Create an EIP-712 permit signature for creating an agreement via the factory.
99
+ *
100
+ * The permit binds the full agreement creation parameters (docUri/docHash/initialState
101
+ * and hashes of inputDefs/transitions/initVars/verifiers/actions) plus the signer's current nonce + deadline.
102
+ *
103
+ * @param walletClient - viem WalletClient to sign typed data (must be connected to an account)
104
+ * @param agreement - The agreement JSON definition
105
+ * @param deadline - Unix timestamp when the permit expires
106
+ * @param options - Optional configuration (docUri + initValues)
107
+ */
108
+ createPermitSignature(walletClient: WalletClient, agreement: AgreementJson, deadline: number, options?: CreateAgreementOptions): Promise<{
109
+ signature: CreateAgreementPermitSignature;
110
+ signerAddress: Hex;
111
+ }>;
112
+ /**
113
+ * Create a new agreement using a permit signature, allowing a submitter to create
114
+ * on behalf of the signer (the signer becomes the agreement owner).
115
+ */
116
+ createAgreementWithPermit(signer: Hex, agreement: AgreementJson, deadline: number, signature: CreateAgreementPermitSignature, options?: CreateAgreementOptions): Promise<{
117
+ address: Hex;
118
+ request: WriteContractParameters;
119
+ receipt: Awaited<ReturnType<PublicClient["waitForTransactionReceipt"]>>;
120
+ }>;
121
+ /**
122
+ * Create a new agreement at a deterministic address
123
+ *
124
+ * @param agreement - The agreement JSON definition
125
+ * @param salt - Salt for deterministic address derivation
126
+ * @param options - Optional configuration
127
+ * @param options.docUri - Custom document URI (defaults to ipfs://agreement/{id})
128
+ * @param options.initValues - Initialization values for variables referenced in initialize.data
129
+ * @returns The deployed agreement contract address and transaction response
130
+ *
131
+ * @example
132
+ * ```typescript
133
+ * const factory = new AgreementFactory(
134
+ * { factoryAddress: "0x..." },
135
+ * { publicClient, walletClient }
136
+ * );
137
+ * const salt = "0x1234...";
138
+ *
139
+ * const { address, receipt } = await factory.createAgreementDeterministic(
140
+ * agreementJson,
141
+ * salt,
142
+ * { initValues: { ... } }
143
+ * );
144
+ * ```
145
+ */
146
+ createAgreementDeterministic(agreement: AgreementJson, salt: Hex, options?: CreateAgreementOptions): Promise<{
147
+ address: Hex;
148
+ request: WriteContractParameters;
149
+ receipt: Awaited<ReturnType<PublicClient["waitForTransactionReceipt"]>>;
150
+ }>;
151
+ /**
152
+ * Create a new deterministic agreement using a permit signature.
153
+ * Note: The on-chain permit does NOT bind the salt; the signature authorizes the agreement params.
154
+ */
155
+ createAgreementDeterministicWithPermit(signer: Hex, salt: Hex, agreement: AgreementJson, deadline: number, signature: CreateAgreementPermitSignature, options?: CreateAgreementOptions): Promise<{
156
+ address: Hex;
157
+ request: WriteContractParameters;
158
+ receipt: Awaited<ReturnType<PublicClient["waitForTransactionReceipt"]>>;
159
+ }>;
160
+ /**
161
+ * Predict the address of a deterministic agreement before deployment
162
+ *
163
+ * @param salt The salt that will be used for deployment
164
+ * @returns The predicted agreement address
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * const factory = new AgreementFactory(
169
+ * { factoryAddress: "0x..." },
170
+ * { publicClient, walletClient }
171
+ * );
172
+ * const predictedAddress = await factory.predictAddress("0x1234...");
173
+ * ```
174
+ */
175
+ predictAddress(salt: Hex): Promise<Hex>;
176
+ /**
177
+ * Get the factory contract address
178
+ */
179
+ getAddress(): Hex;
180
+ /**
181
+ * Get the implementation address that clones point to
182
+ */
183
+ getImplementationAddress(): Promise<Hex>;
184
+ }
185
+ export {};
186
+ //# sourceMappingURL=AgreementFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgreementFactory.d.ts","sourceRoot":"","sources":["../../src/AgreementFactory.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAK7B,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,aAAa,EAAE,aAAa,EAAmC,YAAY,EAAc,MAAM,YAAY,CAAC;AACrH,OAAO,EAAqC,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAWhF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,GAAG,CAAC;IACP,CAAC,EAAE,GAAG,CAAC;CACR,CAAC;AAEF,UAAU,cAAc;IACtB,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,OAAO,CAAC,CAAS;IAEzB;;;;;;;;;;;;;;;;OAgBG;gBACS,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc;IAK1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