@gitmyabi/kernel 1.0.3 → 1.0.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.
@@ -1,335 +0,0 @@
1
- import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
- import { getContract } from 'viem';
3
-
4
- /**
5
- * KernelProxy_json ABI
6
- *
7
- * This ABI is typed using viem's type system for full type safety.
8
- */
9
- export const KernelProxy_jsonAbi = [
10
- {
11
- "constant": true,
12
- "inputs": [],
13
- "name": "proxyType",
14
- "outputs": [
15
- {
16
- "name": "proxyTypeId",
17
- "type": "uint256"
18
- }
19
- ],
20
- "payable": false,
21
- "stateMutability": "pure",
22
- "type": "function"
23
- },
24
- {
25
- "constant": true,
26
- "inputs": [
27
- {
28
- "name": "",
29
- "type": "bytes32"
30
- },
31
- {
32
- "name": "",
33
- "type": "bytes32"
34
- }
35
- ],
36
- "name": "apps",
37
- "outputs": [
38
- {
39
- "name": "",
40
- "type": "address"
41
- }
42
- ],
43
- "payable": false,
44
- "stateMutability": "view",
45
- "type": "function"
46
- },
47
- {
48
- "constant": true,
49
- "inputs": [],
50
- "name": "isDepositable",
51
- "outputs": [
52
- {
53
- "name": "",
54
- "type": "bool"
55
- }
56
- ],
57
- "payable": false,
58
- "stateMutability": "view",
59
- "type": "function"
60
- },
61
- {
62
- "constant": true,
63
- "inputs": [],
64
- "name": "implementation",
65
- "outputs": [
66
- {
67
- "name": "",
68
- "type": "address"
69
- }
70
- ],
71
- "payable": false,
72
- "stateMutability": "view",
73
- "type": "function"
74
- },
75
- {
76
- "constant": true,
77
- "inputs": [],
78
- "name": "recoveryVaultAppId",
79
- "outputs": [
80
- {
81
- "name": "",
82
- "type": "bytes32"
83
- }
84
- ],
85
- "payable": false,
86
- "stateMutability": "view",
87
- "type": "function"
88
- },
89
- {
90
- "inputs": [
91
- {
92
- "name": "_kernelImpl",
93
- "type": "address"
94
- }
95
- ],
96
- "payable": false,
97
- "stateMutability": "nonpayable",
98
- "type": "constructor"
99
- },
100
- {
101
- "payable": true,
102
- "stateMutability": "payable",
103
- "type": "fallback"
104
- },
105
- {
106
- "anonymous": false,
107
- "inputs": [
108
- {
109
- "indexed": false,
110
- "name": "sender",
111
- "type": "address"
112
- },
113
- {
114
- "indexed": false,
115
- "name": "value",
116
- "type": "uint256"
117
- }
118
- ],
119
- "name": "ProxyDeposit",
120
- "type": "event"
121
- },
122
- {
123
- "anonymous": false,
124
- "inputs": [
125
- {
126
- "indexed": true,
127
- "name": "namespace",
128
- "type": "bytes32"
129
- },
130
- {
131
- "indexed": true,
132
- "name": "appId",
133
- "type": "bytes32"
134
- },
135
- {
136
- "indexed": false,
137
- "name": "app",
138
- "type": "address"
139
- }
140
- ],
141
- "name": "SetApp",
142
- "type": "event"
143
- }
144
- ] as const satisfies Abi;
145
-
146
- /**
147
- * Type-safe ABI for KernelProxy_json
148
- */
149
- export type KernelProxy_jsonAbi = typeof KernelProxy_jsonAbi;
150
-
151
- /**
152
- * Contract instance type for KernelProxy_json
153
- */
154
- // Use any for contract type to avoid complex viem type issues
155
- // The runtime behavior is type-safe through viem's ABI typing
156
- export type KernelProxy_jsonContract = any;
157
-
158
- /**
159
- * KernelProxy_json Contract Class
160
- *
161
- * Provides a class-based API similar to TypeChain for interacting with the contract.
162
- *
163
- * @example
164
- * ```typescript
165
- * import { createPublicClient, createWalletClient, http } from 'viem';
166
- * import { mainnet } from 'viem/chains';
167
- * import { KernelProxy_json } from 'KernelProxy_json';
168
- *
169
- * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
170
- * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
171
- *
172
- * const contract = new KernelProxy_json('0x...', { publicClient, walletClient });
173
- *
174
- * // Read functions
175
- * const result = await contract.balanceOf('0x...');
176
- *
177
- * // Write functions
178
- * const hash = await contract.transfer('0x...', 1000n);
179
- *
180
- * // Simulate transactions (dry-run)
181
- * const simulation = await contract.simulate.transfer('0x...', 1000n);
182
- * console.log('Gas estimate:', simulation.request.gas);
183
- *
184
- * // Watch events
185
- * const unwatch = contract.watch.Transfer((event) => {
186
- * console.log('Transfer event:', event);
187
- * });
188
- * ```
189
- */
190
- export class KernelProxy_json {
191
- private contract: KernelProxy_jsonContract;
192
- private contractAddress: Address;
193
- private publicClient: PublicClient;
194
-
195
- constructor(
196
- address: Address,
197
- clients: {
198
- publicClient: PublicClient;
199
- walletClient?: WalletClient;
200
- }
201
- ) {
202
- this.contractAddress = address;
203
- this.publicClient = clients.publicClient;
204
- this.contract = getContract({
205
- address,
206
- abi: KernelProxy_jsonAbi,
207
- client: {
208
- public: clients.publicClient,
209
- wallet: clients.walletClient,
210
- },
211
- });
212
- }
213
-
214
- /**
215
- * Get the contract address
216
- */
217
- get address(): Address {
218
- return this.contractAddress;
219
- }
220
-
221
- /**
222
- * Get the underlying viem contract instance
223
- */
224
- getContract(): KernelProxy_jsonContract {
225
- return this.contract;
226
- }
227
-
228
- /**
229
- * proxyType
230
- * pure
231
- */
232
- async proxyType(): Promise<bigint> {
233
- return this.contract.read.proxyType() as Promise<bigint>;
234
- }
235
-
236
- /**
237
- * apps
238
- * view
239
- */
240
- async apps(arg0: `0x${string}`, arg1: `0x${string}`): Promise<`0x${string}`> {
241
- return this.contract.read.apps([arg0, arg1] as const) as Promise<`0x${string}`>;
242
- }
243
-
244
- /**
245
- * isDepositable
246
- * view
247
- */
248
- async isDepositable(): Promise<boolean> {
249
- return this.contract.read.isDepositable() as Promise<boolean>;
250
- }
251
-
252
- /**
253
- * implementation
254
- * view
255
- */
256
- async implementation(): Promise<`0x${string}`> {
257
- return this.contract.read.implementation() as Promise<`0x${string}`>;
258
- }
259
-
260
- /**
261
- * recoveryVaultAppId
262
- * view
263
- */
264
- async recoveryVaultAppId(): Promise<`0x${string}`> {
265
- return this.contract.read.recoveryVaultAppId() as Promise<`0x${string}`>;
266
- }
267
-
268
- // No write functions
269
-
270
-
271
-
272
- /**
273
- * Simulate contract write operations (dry-run without sending transaction)
274
- *
275
- * Note: This contract has no write functions, so simulate returns an empty object.
276
- */
277
- get simulate() {
278
- return {};
279
- }
280
-
281
- /**
282
- * Watch contract events
283
- *
284
- * @example
285
- * // Watch all Transfer events
286
- * const unwatch = contract.watch.Transfer((event) => {
287
- * console.log('Transfer:', event);
288
- * });
289
- *
290
- * // Stop watching
291
- * unwatch();
292
- */
293
- get watch() {
294
- return {
295
- /**
296
- * Watch ProxyDeposit events
297
- * @param callback Function to call when event is emitted
298
- * @param filter Optional filter for indexed parameters
299
- * @returns Unwatch function to stop listening
300
- */
301
- ProxyDeposit: (callback: (event: { sender: `0x${string}`; value: bigint }) => void) => {
302
- return this.publicClient.watchContractEvent({
303
- address: this.contractAddress,
304
- abi: KernelProxy_jsonAbi,
305
- eventName: 'ProxyDeposit',
306
-
307
- onLogs: (logs: any[]) => {
308
- logs.forEach((log: any) => {
309
- callback(log.args as any);
310
- });
311
- },
312
- }) as () => void;
313
- },
314
- /**
315
- * Watch SetApp events
316
- * @param callback Function to call when event is emitted
317
- * @param filter Optional filter for indexed parameters
318
- * @returns Unwatch function to stop listening
319
- */
320
- SetApp: (callback: (event: { namespace: `0x${string}`; appId: `0x${string}`; app: `0x${string}` }) => void, filter?: { namespace: `0x${string}`; appId: `0x${string}` }) => {
321
- return this.publicClient.watchContractEvent({
322
- address: this.contractAddress,
323
- abi: KernelProxy_jsonAbi,
324
- eventName: 'SetApp',
325
- args: filter,
326
- onLogs: (logs: any[]) => {
327
- logs.forEach((log: any) => {
328
- callback(log.args as any);
329
- });
330
- },
331
- }) as () => void;
332
- }
333
- };
334
- }
335
- }