@gitmyabi/trustedexecutionrouterhorizonkeystonevantage 1.0.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.
@@ -0,0 +1,603 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TrustedExecutionRouterHorizonKeystoneVantage_json = exports.TrustedExecutionRouterHorizonKeystoneVantage_jsonAbi = void 0;
4
+ const viem_1 = require("viem");
5
+ /**
6
+ * TrustedExecutionRouterHorizonKeystoneVantage_json ABI
7
+ *
8
+ * This ABI is typed using viem's type system for full type safety.
9
+ */
10
+ exports.TrustedExecutionRouterHorizonKeystoneVantage_jsonAbi = [
11
+ {
12
+ "anonymous": false,
13
+ "inputs": [
14
+ {
15
+ "indexed": true,
16
+ "internalType": "address",
17
+ "name": "caller",
18
+ "type": "address"
19
+ },
20
+ {
21
+ "indexed": false,
22
+ "internalType": "bool",
23
+ "name": "isAllowed",
24
+ "type": "bool"
25
+ }
26
+ ],
27
+ "name": "AllowedCallerChanged",
28
+ "type": "event"
29
+ },
30
+ {
31
+ "anonymous": false,
32
+ "inputs": [
33
+ {
34
+ "indexed": true,
35
+ "internalType": "address",
36
+ "name": "previousOwner",
37
+ "type": "address"
38
+ },
39
+ {
40
+ "indexed": true,
41
+ "internalType": "address",
42
+ "name": "newOwner",
43
+ "type": "address"
44
+ }
45
+ ],
46
+ "name": "OwnershipTransferred",
47
+ "type": "event"
48
+ },
49
+ {
50
+ "inputs": [
51
+ {
52
+ "internalType": "address",
53
+ "name": "caller",
54
+ "type": "address"
55
+ }
56
+ ],
57
+ "name": "addAllowedCaller",
58
+ "outputs": [],
59
+ "stateMutability": "nonpayable",
60
+ "type": "function"
61
+ },
62
+ {
63
+ "inputs": [
64
+ {
65
+ "internalType": "uint256",
66
+ "name": "blockNumber",
67
+ "type": "uint256"
68
+ }
69
+ ],
70
+ "name": "getBlockHash",
71
+ "outputs": [
72
+ {
73
+ "internalType": "bytes32",
74
+ "name": "blockHash",
75
+ "type": "bytes32"
76
+ }
77
+ ],
78
+ "stateMutability": "view",
79
+ "type": "function"
80
+ },
81
+ {
82
+ "inputs": [],
83
+ "name": "getBlockNumber",
84
+ "outputs": [
85
+ {
86
+ "internalType": "uint256",
87
+ "name": "blockNumber",
88
+ "type": "uint256"
89
+ }
90
+ ],
91
+ "stateMutability": "view",
92
+ "type": "function"
93
+ },
94
+ {
95
+ "inputs": [],
96
+ "name": "getChainId",
97
+ "outputs": [
98
+ {
99
+ "internalType": "uint256",
100
+ "name": "chainid",
101
+ "type": "uint256"
102
+ }
103
+ ],
104
+ "stateMutability": "view",
105
+ "type": "function"
106
+ },
107
+ {
108
+ "inputs": [],
109
+ "name": "getCurrentBlockTimestamp",
110
+ "outputs": [
111
+ {
112
+ "internalType": "uint256",
113
+ "name": "timestamp",
114
+ "type": "uint256"
115
+ }
116
+ ],
117
+ "stateMutability": "view",
118
+ "type": "function"
119
+ },
120
+ {
121
+ "inputs": [
122
+ {
123
+ "internalType": "address",
124
+ "name": "addr",
125
+ "type": "address"
126
+ }
127
+ ],
128
+ "name": "getEthBalance",
129
+ "outputs": [
130
+ {
131
+ "internalType": "uint256",
132
+ "name": "balance",
133
+ "type": "uint256"
134
+ }
135
+ ],
136
+ "stateMutability": "view",
137
+ "type": "function"
138
+ },
139
+ {
140
+ "inputs": [
141
+ {
142
+ "internalType": "address",
143
+ "name": "caller",
144
+ "type": "address"
145
+ }
146
+ ],
147
+ "name": "isAllowed",
148
+ "outputs": [
149
+ {
150
+ "internalType": "bool",
151
+ "name": "",
152
+ "type": "bool"
153
+ }
154
+ ],
155
+ "stateMutability": "view",
156
+ "type": "function"
157
+ },
158
+ {
159
+ "inputs": [
160
+ {
161
+ "components": [
162
+ {
163
+ "internalType": "address",
164
+ "name": "target",
165
+ "type": "address"
166
+ },
167
+ {
168
+ "internalType": "bool",
169
+ "name": "allowFailure",
170
+ "type": "bool"
171
+ },
172
+ {
173
+ "internalType": "bytes",
174
+ "name": "callData",
175
+ "type": "bytes"
176
+ }
177
+ ],
178
+ "internalType": "struct TrustedExecutionRouterHorizonKeystoneVantage.Call[]",
179
+ "name": "calls",
180
+ "type": "tuple[]"
181
+ }
182
+ ],
183
+ "name": "multicall",
184
+ "outputs": [
185
+ {
186
+ "components": [
187
+ {
188
+ "internalType": "bool",
189
+ "name": "success",
190
+ "type": "bool"
191
+ },
192
+ {
193
+ "internalType": "bytes",
194
+ "name": "returnData",
195
+ "type": "bytes"
196
+ }
197
+ ],
198
+ "internalType": "struct TrustedExecutionRouterHorizonKeystoneVantage.Result[]",
199
+ "name": "returnData",
200
+ "type": "tuple[]"
201
+ }
202
+ ],
203
+ "stateMutability": "payable",
204
+ "type": "function"
205
+ },
206
+ {
207
+ "inputs": [],
208
+ "name": "owner",
209
+ "outputs": [
210
+ {
211
+ "internalType": "address",
212
+ "name": "",
213
+ "type": "address"
214
+ }
215
+ ],
216
+ "stateMutability": "view",
217
+ "type": "function"
218
+ },
219
+ {
220
+ "inputs": [],
221
+ "name": "relayContextHorizonKeystoneVantage",
222
+ "outputs": [
223
+ {
224
+ "internalType": "bytes32",
225
+ "name": "profile",
226
+ "type": "bytes32"
227
+ }
228
+ ],
229
+ "stateMutability": "pure",
230
+ "type": "function"
231
+ },
232
+ {
233
+ "inputs": [
234
+ {
235
+ "internalType": "address",
236
+ "name": "caller",
237
+ "type": "address"
238
+ }
239
+ ],
240
+ "name": "removeAllowedCaller",
241
+ "outputs": [],
242
+ "stateMutability": "nonpayable",
243
+ "type": "function"
244
+ },
245
+ {
246
+ "inputs": [],
247
+ "name": "renounceOwnership",
248
+ "outputs": [],
249
+ "stateMutability": "nonpayable",
250
+ "type": "function"
251
+ },
252
+ {
253
+ "inputs": [
254
+ {
255
+ "internalType": "address",
256
+ "name": "newOwner",
257
+ "type": "address"
258
+ }
259
+ ],
260
+ "name": "transferOwnership",
261
+ "outputs": [],
262
+ "stateMutability": "nonpayable",
263
+ "type": "function"
264
+ },
265
+ {
266
+ "inputs": [],
267
+ "name": "withdrawETH",
268
+ "outputs": [],
269
+ "stateMutability": "nonpayable",
270
+ "type": "function"
271
+ },
272
+ {
273
+ "inputs": [
274
+ {
275
+ "internalType": "address",
276
+ "name": "tokenAddress",
277
+ "type": "address"
278
+ }
279
+ ],
280
+ "name": "withdrawTokens",
281
+ "outputs": [],
282
+ "stateMutability": "nonpayable",
283
+ "type": "function"
284
+ }
285
+ ];
286
+ /**
287
+ * TrustedExecutionRouterHorizonKeystoneVantage_json Contract Class
288
+ *
289
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
290
+ *
291
+ * @example
292
+ * ```typescript
293
+ * import { createPublicClient, createWalletClient, http } from 'viem';
294
+ * import { mainnet } from 'viem/chains';
295
+ * import { TrustedExecutionRouterHorizonKeystoneVantage_json } from 'TrustedExecutionRouterHorizonKeystoneVantage_json';
296
+ *
297
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
298
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
299
+ *
300
+ * const contract = new TrustedExecutionRouterHorizonKeystoneVantage_json('0x...', { publicClient, walletClient });
301
+ *
302
+ * // Read functions
303
+ * const result = await contract.balanceOf('0x...');
304
+ *
305
+ * // Write functions
306
+ * const hash = await contract.transfer('0x...', 1000n);
307
+ *
308
+ * // Simulate transactions (dry-run)
309
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
310
+ * console.log('Gas estimate:', simulation.request.gas);
311
+ *
312
+ * // Watch events
313
+ * const unwatch = contract.watch.Transfer((event) => {
314
+ * console.log('Transfer event:', event);
315
+ * });
316
+ * ```
317
+ */
318
+ class TrustedExecutionRouterHorizonKeystoneVantage_json {
319
+ constructor(address, clients) {
320
+ this.contractAddress = address;
321
+ this.publicClient = clients.publicClient;
322
+ this.contract = (0, viem_1.getContract)({
323
+ address,
324
+ abi: exports.TrustedExecutionRouterHorizonKeystoneVantage_jsonAbi,
325
+ client: {
326
+ public: clients.publicClient,
327
+ wallet: clients.walletClient,
328
+ },
329
+ });
330
+ }
331
+ /**
332
+ * Get the contract address
333
+ */
334
+ get address() {
335
+ return this.contractAddress;
336
+ }
337
+ /**
338
+ * Get the underlying viem contract instance
339
+ */
340
+ getContract() {
341
+ return this.contract;
342
+ }
343
+ /**
344
+ * getBlockHash
345
+ * view
346
+ */
347
+ async getBlockHash(blockNumber) {
348
+ return this.contract.read.getBlockHash([blockNumber]);
349
+ }
350
+ /**
351
+ * getBlockNumber
352
+ * view
353
+ */
354
+ async getBlockNumber() {
355
+ return this.contract.read.getBlockNumber();
356
+ }
357
+ /**
358
+ * getChainId
359
+ * view
360
+ */
361
+ async getChainId() {
362
+ return this.contract.read.getChainId();
363
+ }
364
+ /**
365
+ * getCurrentBlockTimestamp
366
+ * view
367
+ */
368
+ async getCurrentBlockTimestamp() {
369
+ return this.contract.read.getCurrentBlockTimestamp();
370
+ }
371
+ /**
372
+ * getEthBalance
373
+ * view
374
+ */
375
+ async getEthBalance(addr) {
376
+ return this.contract.read.getEthBalance([addr]);
377
+ }
378
+ /**
379
+ * isAllowed
380
+ * view
381
+ */
382
+ async isAllowed(caller) {
383
+ return this.contract.read.isAllowed([caller]);
384
+ }
385
+ /**
386
+ * owner
387
+ * view
388
+ */
389
+ async owner() {
390
+ return this.contract.read.owner();
391
+ }
392
+ /**
393
+ * relayContextHorizonKeystoneVantage
394
+ * pure
395
+ */
396
+ async relayContextHorizonKeystoneVantage() {
397
+ return this.contract.read.relayContextHorizonKeystoneVantage();
398
+ }
399
+ /**
400
+ * addAllowedCaller
401
+ * nonpayable
402
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
403
+ */
404
+ async addAllowedCaller(caller, options) {
405
+ if (!this.contract.write) {
406
+ throw new Error('Wallet client is required for write operations');
407
+ }
408
+ return this.contract.write.addAllowedCaller([caller], options);
409
+ }
410
+ /**
411
+ * multicall
412
+ * payable
413
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
414
+ */
415
+ async multicall(calls, options) {
416
+ if (!this.contract.write) {
417
+ throw new Error('Wallet client is required for write operations');
418
+ }
419
+ return this.contract.write.multicall([calls], options);
420
+ }
421
+ /**
422
+ * removeAllowedCaller
423
+ * nonpayable
424
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
425
+ */
426
+ async removeAllowedCaller(caller, options) {
427
+ if (!this.contract.write) {
428
+ throw new Error('Wallet client is required for write operations');
429
+ }
430
+ return this.contract.write.removeAllowedCaller([caller], options);
431
+ }
432
+ /**
433
+ * renounceOwnership
434
+ * nonpayable
435
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
436
+ */
437
+ async renounceOwnership(options) {
438
+ if (!this.contract.write) {
439
+ throw new Error('Wallet client is required for write operations');
440
+ }
441
+ return this.contract.write.renounceOwnership(options);
442
+ }
443
+ /**
444
+ * transferOwnership
445
+ * nonpayable
446
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
447
+ */
448
+ async transferOwnership(newOwner, options) {
449
+ if (!this.contract.write) {
450
+ throw new Error('Wallet client is required for write operations');
451
+ }
452
+ return this.contract.write.transferOwnership([newOwner], options);
453
+ }
454
+ /**
455
+ * withdrawETH
456
+ * nonpayable
457
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
458
+ */
459
+ async withdrawETH(options) {
460
+ if (!this.contract.write) {
461
+ throw new Error('Wallet client is required for write operations');
462
+ }
463
+ return this.contract.write.withdrawETH(options);
464
+ }
465
+ /**
466
+ * withdrawTokens
467
+ * nonpayable
468
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
469
+ */
470
+ async withdrawTokens(tokenAddress, options) {
471
+ if (!this.contract.write) {
472
+ throw new Error('Wallet client is required for write operations');
473
+ }
474
+ return this.contract.write.withdrawTokens([tokenAddress], options);
475
+ }
476
+ /**
477
+ * Simulate contract write operations (dry-run without sending transaction)
478
+ *
479
+ * @example
480
+ * const result = await contract.simulate.transfer('0x...', 1000n);
481
+ * console.log('Gas estimate:', result.request.gas);
482
+ * console.log('Would succeed:', result.result);
483
+ */
484
+ get simulate() {
485
+ const contract = this.contract;
486
+ if (!contract.simulate) {
487
+ throw new Error('Public client is required for simulation');
488
+ }
489
+ return {
490
+ /**
491
+ * Simulate addAllowedCaller
492
+ * Returns gas estimate and result without sending transaction
493
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
494
+ */
495
+ async addAllowedCaller(caller, options) {
496
+ return contract.simulate.addAllowedCaller([caller], options);
497
+ },
498
+ /**
499
+ * Simulate multicall
500
+ * Returns gas estimate and result without sending transaction
501
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
502
+ */
503
+ async multicall(calls, options) {
504
+ return contract.simulate.multicall([calls], options);
505
+ },
506
+ /**
507
+ * Simulate removeAllowedCaller
508
+ * Returns gas estimate and result without sending transaction
509
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
510
+ */
511
+ async removeAllowedCaller(caller, options) {
512
+ return contract.simulate.removeAllowedCaller([caller], options);
513
+ },
514
+ /**
515
+ * Simulate renounceOwnership
516
+ * Returns gas estimate and result without sending transaction
517
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
518
+ */
519
+ async renounceOwnership(options) {
520
+ return contract.simulate.renounceOwnership(options);
521
+ },
522
+ /**
523
+ * Simulate transferOwnership
524
+ * Returns gas estimate and result without sending transaction
525
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
526
+ */
527
+ async transferOwnership(newOwner, options) {
528
+ return contract.simulate.transferOwnership([newOwner], options);
529
+ },
530
+ /**
531
+ * Simulate withdrawETH
532
+ * Returns gas estimate and result without sending transaction
533
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
534
+ */
535
+ async withdrawETH(options) {
536
+ return contract.simulate.withdrawETH(options);
537
+ },
538
+ /**
539
+ * Simulate withdrawTokens
540
+ * Returns gas estimate and result without sending transaction
541
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
542
+ */
543
+ async withdrawTokens(tokenAddress, options) {
544
+ return contract.simulate.withdrawTokens([tokenAddress], options);
545
+ }
546
+ };
547
+ }
548
+ /**
549
+ * Watch contract events
550
+ *
551
+ * @example
552
+ * // Watch all Transfer events
553
+ * const unwatch = contract.watch.Transfer((event) => {
554
+ * console.log('Transfer:', event);
555
+ * });
556
+ *
557
+ * // Stop watching
558
+ * unwatch();
559
+ */
560
+ get watch() {
561
+ return {
562
+ /**
563
+ * Watch AllowedCallerChanged events
564
+ * @param callback Function to call when event is emitted
565
+ * @param filter Optional filter for indexed parameters
566
+ * @returns Unwatch function to stop listening
567
+ */
568
+ AllowedCallerChanged: (callback, filter) => {
569
+ return this.publicClient.watchContractEvent({
570
+ address: this.contractAddress,
571
+ abi: exports.TrustedExecutionRouterHorizonKeystoneVantage_jsonAbi,
572
+ eventName: 'AllowedCallerChanged',
573
+ args: filter,
574
+ onLogs: (logs) => {
575
+ logs.forEach((log) => {
576
+ callback(log.args);
577
+ });
578
+ },
579
+ });
580
+ },
581
+ /**
582
+ * Watch OwnershipTransferred events
583
+ * @param callback Function to call when event is emitted
584
+ * @param filter Optional filter for indexed parameters
585
+ * @returns Unwatch function to stop listening
586
+ */
587
+ OwnershipTransferred: (callback, filter) => {
588
+ return this.publicClient.watchContractEvent({
589
+ address: this.contractAddress,
590
+ abi: exports.TrustedExecutionRouterHorizonKeystoneVantage_jsonAbi,
591
+ eventName: 'OwnershipTransferred',
592
+ args: filter,
593
+ onLogs: (logs) => {
594
+ logs.forEach((log) => {
595
+ callback(log.args);
596
+ });
597
+ },
598
+ });
599
+ }
600
+ };
601
+ }
602
+ }
603
+ exports.TrustedExecutionRouterHorizonKeystoneVantage_json = TrustedExecutionRouterHorizonKeystoneVantage_json;