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