@gitmyabi/wf-quiz 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.
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # @gitmyabi/wf-quiz
2
+
3
+ Auto-generated TypeScript type bindings for **wf_quiz**
4
+
5
+ - **Build ID**: `etherscan-wf-quiz-4f8abea0-1787033347607`
6
+ - **Build Number**: 1
7
+ - **Commit**: `0925afd`
8
+ - **Branch**: `etherscan`
9
+ - **Target**: `ethers-v6`
10
+ - **Contracts**: 1
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @gitmyabi/wf-quiz@1.0.0
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ### Class-based API (TypeChain-like)
21
+
22
+ ```typescript
23
+ import { createPublicClient, createWalletClient, http } from 'viem';
24
+ import { mainnet } from 'viem/chains';
25
+ import { YourContract } from '@gitmyabi/wf-quiz';
26
+
27
+ const publicClient = createPublicClient({ chain: mainnet, transport: http() });
28
+ const walletClient = createWalletClient({ chain: mainnet, transport: http() });
29
+
30
+ // Create contract instance
31
+ const contract = new YourContract('0x...', { publicClient, walletClient });
32
+
33
+ // Read functions - call directly like TypeChain!
34
+ const result = await contract.yourMethod(param1, param2);
35
+
36
+ // Write functions - also call directly!
37
+ const hash = await contract.transfer('0x...', 1000n);
38
+ ```
39
+
40
+ ### With viem directly
41
+
42
+ ```typescript
43
+ import { createPublicClient, http } from 'viem';
44
+ import { mainnet } from 'viem/chains';
45
+ import { YourContractAbi } from '@gitmyabi/wf-quiz';
46
+
47
+ const client = createPublicClient({
48
+ chain: mainnet,
49
+ transport: http(),
50
+ });
51
+
52
+ // Fully typed contract read
53
+ const result = await client.readContract({
54
+ address: '0x...',
55
+ abi: YourContractAbi,
56
+ functionName: 'yourMethod',
57
+ args: [param1, param2],
58
+ });
59
+
60
+ // Fully typed contract write
61
+ const hash = await client.writeContract({
62
+ address: '0x...',
63
+ abi: YourContractAbi,
64
+ functionName: 'yourMethod',
65
+ args: [param1, param2],
66
+ });
67
+ ```
68
+
69
+ ### With wagmi
70
+
71
+ ```typescript
72
+ import { useReadContract, useWriteContract } from 'wagmi';
73
+ import { YourContractAbi } from '@gitmyabi/wf-quiz';
74
+
75
+ function MyComponent() {
76
+ const { data } = useReadContract({
77
+ address: '0x...',
78
+ abi: YourContractAbi,
79
+ functionName: 'yourMethod',
80
+ args: [param1, param2],
81
+ });
82
+
83
+ const { writeContract } = useWriteContract();
84
+
85
+ const handleWrite = () => {
86
+ writeContract({
87
+ address: '0x...',
88
+ abi: YourContractAbi,
89
+ functionName: 'yourMethod',
90
+ args: [param1, param2],
91
+ });
92
+ };
93
+
94
+ return <button onClick={handleWrite}>Call Contract</button>;
95
+ }
96
+ ```
97
+
98
+ ## Type Safety
99
+
100
+ This package provides full TypeScript type safety for all contract methods, events, and parameters using viem's type system. All ABIs are exported as `const` assertions for maximum type inference.
101
+
102
+ ## Generated Contracts
103
+
104
+ This package includes type bindings for 1 contract(s) generated from ABI artifacts.
105
+
106
+ ## License
107
+
108
+ MIT
@@ -0,0 +1,2 @@
1
+ export { wf_quiz_jsonAbi, wf_quiz_json } from './wf_quiz_json';
2
+ export type { wf_quiz_jsonAbi as wf_quiz_jsonAbiType, wf_quiz_jsonContract } from './wf_quiz_json';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wf_quiz_json = exports.wf_quiz_jsonAbi = void 0;
4
+ // Auto-generated exports for all contracts
5
+ var wf_quiz_json_1 = require("./wf_quiz_json");
6
+ Object.defineProperty(exports, "wf_quiz_jsonAbi", { enumerable: true, get: function () { return wf_quiz_json_1.wf_quiz_jsonAbi; } });
7
+ Object.defineProperty(exports, "wf_quiz_json", { enumerable: true, get: function () { return wf_quiz_json_1.wf_quiz_json; } });
@@ -0,0 +1,3 @@
1
+ // Auto-generated exports for all contracts
2
+ export { wf_quiz_jsonAbi, wf_quiz_json } from './wf_quiz_json';
3
+ export type { wf_quiz_jsonAbi as wf_quiz_jsonAbiType, wf_quiz_jsonContract } from './wf_quiz_json';
@@ -0,0 +1,286 @@
1
+ import type { Address, PublicClient, WalletClient } from 'viem';
2
+ /**
3
+ * wf_quiz_json ABI
4
+ *
5
+ * This ABI is typed using viem's type system for full type safety.
6
+ */
7
+ export declare const wf_quiz_jsonAbi: readonly [{
8
+ readonly inputs: readonly [{
9
+ readonly internalType: "bytes32[]";
10
+ readonly name: "admins";
11
+ readonly type: "bytes32[]";
12
+ }];
13
+ readonly stateMutability: "nonpayable";
14
+ readonly type: "constructor";
15
+ }, {
16
+ readonly stateMutability: "nonpayable";
17
+ readonly type: "fallback";
18
+ }, {
19
+ readonly inputs: readonly [{
20
+ readonly internalType: "string";
21
+ readonly name: "_question";
22
+ readonly type: "string";
23
+ }, {
24
+ readonly internalType: "bytes32";
25
+ readonly name: "_responseHash";
26
+ readonly type: "bytes32";
27
+ }];
28
+ readonly name: "New";
29
+ readonly outputs: readonly [];
30
+ readonly stateMutability: "payable";
31
+ readonly type: "function";
32
+ }, {
33
+ readonly inputs: readonly [{
34
+ readonly internalType: "string";
35
+ readonly name: "_question";
36
+ readonly type: "string";
37
+ }, {
38
+ readonly internalType: "string";
39
+ readonly name: "_response";
40
+ readonly type: "string";
41
+ }];
42
+ readonly name: "Start";
43
+ readonly outputs: readonly [];
44
+ readonly stateMutability: "payable";
45
+ readonly type: "function";
46
+ }, {
47
+ readonly inputs: readonly [];
48
+ readonly name: "Stop";
49
+ readonly outputs: readonly [];
50
+ readonly stateMutability: "payable";
51
+ readonly type: "function";
52
+ }, {
53
+ readonly inputs: readonly [{
54
+ readonly internalType: "string";
55
+ readonly name: "_response";
56
+ readonly type: "string";
57
+ }];
58
+ readonly name: "Try";
59
+ readonly outputs: readonly [];
60
+ readonly stateMutability: "payable";
61
+ readonly type: "function";
62
+ }, {
63
+ readonly inputs: readonly [];
64
+ readonly name: "question";
65
+ readonly outputs: readonly [{
66
+ readonly internalType: "string";
67
+ readonly name: "";
68
+ readonly type: "string";
69
+ }];
70
+ readonly stateMutability: "view";
71
+ readonly type: "function";
72
+ }];
73
+ /**
74
+ * Type-safe ABI for wf_quiz_json
75
+ */
76
+ export type wf_quiz_jsonAbi = typeof wf_quiz_jsonAbi;
77
+ /**
78
+ * Contract instance type for wf_quiz_json
79
+ */
80
+ export type wf_quiz_jsonContract = any;
81
+ /**
82
+ * wf_quiz_json Contract Class
83
+ *
84
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * import { createPublicClient, createWalletClient, http } from 'viem';
89
+ * import { mainnet } from 'viem/chains';
90
+ * import { wf_quiz_json } from 'wf_quiz_json';
91
+ *
92
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
93
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
94
+ *
95
+ * const contract = new wf_quiz_json('0x...', { publicClient, walletClient });
96
+ *
97
+ * // Read functions
98
+ * const result = await contract.balanceOf('0x...');
99
+ *
100
+ * // Write functions
101
+ * const hash = await contract.transfer('0x...', 1000n);
102
+ *
103
+ * // Simulate transactions (dry-run)
104
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
105
+ * console.log('Gas estimate:', simulation.request.gas);
106
+ *
107
+ * // Watch events
108
+ * const unwatch = contract.watch.Transfer((event) => {
109
+ * console.log('Transfer event:', event);
110
+ * });
111
+ * ```
112
+ */
113
+ export declare class wf_quiz_json {
114
+ private contract;
115
+ private contractAddress;
116
+ private publicClient;
117
+ constructor(address: Address, clients: {
118
+ publicClient: PublicClient;
119
+ walletClient?: WalletClient;
120
+ });
121
+ /**
122
+ * Get the contract address
123
+ */
124
+ get address(): Address;
125
+ /**
126
+ * Get the underlying viem contract instance
127
+ */
128
+ getContract(): wf_quiz_jsonContract;
129
+ /**
130
+ * question
131
+ * view
132
+ */
133
+ question(): Promise<string>;
134
+ /**
135
+ * New
136
+ * payable
137
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
138
+ */
139
+ New(_question: string, _responseHash: `0x${string}`, options?: {
140
+ accessList?: import('viem').AccessList;
141
+ authorizationList?: import('viem').AuthorizationList;
142
+ chain?: import('viem').Chain | null;
143
+ dataSuffix?: `0x${string}`;
144
+ gas?: bigint;
145
+ gasPrice?: bigint;
146
+ maxFeePerGas?: bigint;
147
+ maxPriorityFeePerGas?: bigint;
148
+ nonce?: number;
149
+ value?: bigint;
150
+ }): Promise<`0x${string}`>;
151
+ /**
152
+ * Start
153
+ * payable
154
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
155
+ */
156
+ Start(_question: string, _response: string, options?: {
157
+ accessList?: import('viem').AccessList;
158
+ authorizationList?: import('viem').AuthorizationList;
159
+ chain?: import('viem').Chain | null;
160
+ dataSuffix?: `0x${string}`;
161
+ gas?: bigint;
162
+ gasPrice?: bigint;
163
+ maxFeePerGas?: bigint;
164
+ maxPriorityFeePerGas?: bigint;
165
+ nonce?: number;
166
+ value?: bigint;
167
+ }): Promise<`0x${string}`>;
168
+ /**
169
+ * Stop
170
+ * payable
171
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
172
+ */
173
+ Stop(options?: {
174
+ accessList?: import('viem').AccessList;
175
+ authorizationList?: import('viem').AuthorizationList;
176
+ chain?: import('viem').Chain | null;
177
+ dataSuffix?: `0x${string}`;
178
+ gas?: bigint;
179
+ gasPrice?: bigint;
180
+ maxFeePerGas?: bigint;
181
+ maxPriorityFeePerGas?: bigint;
182
+ nonce?: number;
183
+ value?: bigint;
184
+ }): Promise<`0x${string}`>;
185
+ /**
186
+ * Try
187
+ * payable
188
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
189
+ */
190
+ Try(_response: string, options?: {
191
+ accessList?: import('viem').AccessList;
192
+ authorizationList?: import('viem').AuthorizationList;
193
+ chain?: import('viem').Chain | null;
194
+ dataSuffix?: `0x${string}`;
195
+ gas?: bigint;
196
+ gasPrice?: bigint;
197
+ maxFeePerGas?: bigint;
198
+ maxPriorityFeePerGas?: bigint;
199
+ nonce?: number;
200
+ value?: bigint;
201
+ }): Promise<`0x${string}`>;
202
+ /**
203
+ * Simulate contract write operations (dry-run without sending transaction)
204
+ *
205
+ * @example
206
+ * const result = await contract.simulate.transfer('0x...', 1000n);
207
+ * console.log('Gas estimate:', result.request.gas);
208
+ * console.log('Would succeed:', result.result);
209
+ */
210
+ get simulate(): {
211
+ /**
212
+ * Simulate New
213
+ * Returns gas estimate and result without sending transaction
214
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
215
+ */
216
+ New(_question: string, _responseHash: `0x${string}`, options?: {
217
+ accessList?: import("viem").AccessList;
218
+ authorizationList?: import("viem").AuthorizationList;
219
+ chain?: import("viem").Chain | null;
220
+ dataSuffix?: `0x${string}`;
221
+ gas?: bigint;
222
+ gasPrice?: bigint;
223
+ maxFeePerGas?: bigint;
224
+ maxPriorityFeePerGas?: bigint;
225
+ nonce?: number;
226
+ value?: bigint;
227
+ }): Promise<void>;
228
+ /**
229
+ * Simulate Start
230
+ * Returns gas estimate and result without sending transaction
231
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
232
+ */
233
+ Start(_question: string, _response: string, options?: {
234
+ accessList?: import("viem").AccessList;
235
+ authorizationList?: import("viem").AuthorizationList;
236
+ chain?: import("viem").Chain | null;
237
+ dataSuffix?: `0x${string}`;
238
+ gas?: bigint;
239
+ gasPrice?: bigint;
240
+ maxFeePerGas?: bigint;
241
+ maxPriorityFeePerGas?: bigint;
242
+ nonce?: number;
243
+ value?: bigint;
244
+ }): Promise<void>;
245
+ /**
246
+ * Simulate Stop
247
+ * Returns gas estimate and result without sending transaction
248
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
249
+ */
250
+ Stop(options?: {
251
+ accessList?: import("viem").AccessList;
252
+ authorizationList?: import("viem").AuthorizationList;
253
+ chain?: import("viem").Chain | null;
254
+ dataSuffix?: `0x${string}`;
255
+ gas?: bigint;
256
+ gasPrice?: bigint;
257
+ maxFeePerGas?: bigint;
258
+ maxPriorityFeePerGas?: bigint;
259
+ nonce?: number;
260
+ value?: bigint;
261
+ }): Promise<void>;
262
+ /**
263
+ * Simulate Try
264
+ * Returns gas estimate and result without sending transaction
265
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
266
+ */
267
+ Try(_response: string, options?: {
268
+ accessList?: import("viem").AccessList;
269
+ authorizationList?: import("viem").AuthorizationList;
270
+ chain?: import("viem").Chain | null;
271
+ dataSuffix?: `0x${string}`;
272
+ gas?: bigint;
273
+ gasPrice?: bigint;
274
+ maxFeePerGas?: bigint;
275
+ maxPriorityFeePerGas?: bigint;
276
+ nonce?: number;
277
+ value?: bigint;
278
+ }): Promise<void>;
279
+ };
280
+ /**
281
+ * Watch contract events
282
+ *
283
+ * Note: This contract has no events, so watch returns an empty object.
284
+ */
285
+ get watch(): {};
286
+ }
@@ -0,0 +1,261 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wf_quiz_json = exports.wf_quiz_jsonAbi = void 0;
4
+ const viem_1 = require("viem");
5
+ /**
6
+ * wf_quiz_json ABI
7
+ *
8
+ * This ABI is typed using viem's type system for full type safety.
9
+ */
10
+ exports.wf_quiz_jsonAbi = [
11
+ {
12
+ "inputs": [
13
+ {
14
+ "internalType": "bytes32[]",
15
+ "name": "admins",
16
+ "type": "bytes32[]"
17
+ }
18
+ ],
19
+ "stateMutability": "nonpayable",
20
+ "type": "constructor"
21
+ },
22
+ {
23
+ "stateMutability": "nonpayable",
24
+ "type": "fallback"
25
+ },
26
+ {
27
+ "inputs": [
28
+ {
29
+ "internalType": "string",
30
+ "name": "_question",
31
+ "type": "string"
32
+ },
33
+ {
34
+ "internalType": "bytes32",
35
+ "name": "_responseHash",
36
+ "type": "bytes32"
37
+ }
38
+ ],
39
+ "name": "New",
40
+ "outputs": [],
41
+ "stateMutability": "payable",
42
+ "type": "function"
43
+ },
44
+ {
45
+ "inputs": [
46
+ {
47
+ "internalType": "string",
48
+ "name": "_question",
49
+ "type": "string"
50
+ },
51
+ {
52
+ "internalType": "string",
53
+ "name": "_response",
54
+ "type": "string"
55
+ }
56
+ ],
57
+ "name": "Start",
58
+ "outputs": [],
59
+ "stateMutability": "payable",
60
+ "type": "function"
61
+ },
62
+ {
63
+ "inputs": [],
64
+ "name": "Stop",
65
+ "outputs": [],
66
+ "stateMutability": "payable",
67
+ "type": "function"
68
+ },
69
+ {
70
+ "inputs": [
71
+ {
72
+ "internalType": "string",
73
+ "name": "_response",
74
+ "type": "string"
75
+ }
76
+ ],
77
+ "name": "Try",
78
+ "outputs": [],
79
+ "stateMutability": "payable",
80
+ "type": "function"
81
+ },
82
+ {
83
+ "inputs": [],
84
+ "name": "question",
85
+ "outputs": [
86
+ {
87
+ "internalType": "string",
88
+ "name": "",
89
+ "type": "string"
90
+ }
91
+ ],
92
+ "stateMutability": "view",
93
+ "type": "function"
94
+ }
95
+ ];
96
+ /**
97
+ * wf_quiz_json Contract Class
98
+ *
99
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * import { createPublicClient, createWalletClient, http } from 'viem';
104
+ * import { mainnet } from 'viem/chains';
105
+ * import { wf_quiz_json } from 'wf_quiz_json';
106
+ *
107
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
108
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
109
+ *
110
+ * const contract = new wf_quiz_json('0x...', { publicClient, walletClient });
111
+ *
112
+ * // Read functions
113
+ * const result = await contract.balanceOf('0x...');
114
+ *
115
+ * // Write functions
116
+ * const hash = await contract.transfer('0x...', 1000n);
117
+ *
118
+ * // Simulate transactions (dry-run)
119
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
120
+ * console.log('Gas estimate:', simulation.request.gas);
121
+ *
122
+ * // Watch events
123
+ * const unwatch = contract.watch.Transfer((event) => {
124
+ * console.log('Transfer event:', event);
125
+ * });
126
+ * ```
127
+ */
128
+ class wf_quiz_json {
129
+ constructor(address, clients) {
130
+ this.contractAddress = address;
131
+ this.publicClient = clients.publicClient;
132
+ this.contract = (0, viem_1.getContract)({
133
+ address,
134
+ abi: exports.wf_quiz_jsonAbi,
135
+ client: {
136
+ public: clients.publicClient,
137
+ wallet: clients.walletClient,
138
+ },
139
+ });
140
+ }
141
+ /**
142
+ * Get the contract address
143
+ */
144
+ get address() {
145
+ return this.contractAddress;
146
+ }
147
+ /**
148
+ * Get the underlying viem contract instance
149
+ */
150
+ getContract() {
151
+ return this.contract;
152
+ }
153
+ /**
154
+ * question
155
+ * view
156
+ */
157
+ async question() {
158
+ return this.contract.read.question();
159
+ }
160
+ /**
161
+ * New
162
+ * payable
163
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
164
+ */
165
+ async New(_question, _responseHash, options) {
166
+ if (!this.contract.write) {
167
+ throw new Error('Wallet client is required for write operations');
168
+ }
169
+ return this.contract.write.New([_question, _responseHash], options);
170
+ }
171
+ /**
172
+ * Start
173
+ * payable
174
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
175
+ */
176
+ async Start(_question, _response, options) {
177
+ if (!this.contract.write) {
178
+ throw new Error('Wallet client is required for write operations');
179
+ }
180
+ return this.contract.write.Start([_question, _response], options);
181
+ }
182
+ /**
183
+ * Stop
184
+ * payable
185
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
186
+ */
187
+ async Stop(options) {
188
+ if (!this.contract.write) {
189
+ throw new Error('Wallet client is required for write operations');
190
+ }
191
+ return this.contract.write.Stop(options);
192
+ }
193
+ /**
194
+ * Try
195
+ * payable
196
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
197
+ */
198
+ async Try(_response, options) {
199
+ if (!this.contract.write) {
200
+ throw new Error('Wallet client is required for write operations');
201
+ }
202
+ return this.contract.write.Try([_response], options);
203
+ }
204
+ /**
205
+ * Simulate contract write operations (dry-run without sending transaction)
206
+ *
207
+ * @example
208
+ * const result = await contract.simulate.transfer('0x...', 1000n);
209
+ * console.log('Gas estimate:', result.request.gas);
210
+ * console.log('Would succeed:', result.result);
211
+ */
212
+ get simulate() {
213
+ const contract = this.contract;
214
+ if (!contract.simulate) {
215
+ throw new Error('Public client is required for simulation');
216
+ }
217
+ return {
218
+ /**
219
+ * Simulate New
220
+ * Returns gas estimate and result without sending transaction
221
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
222
+ */
223
+ async New(_question, _responseHash, options) {
224
+ return contract.simulate.New([_question, _responseHash], options);
225
+ },
226
+ /**
227
+ * Simulate Start
228
+ * Returns gas estimate and result without sending transaction
229
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
230
+ */
231
+ async Start(_question, _response, options) {
232
+ return contract.simulate.Start([_question, _response], options);
233
+ },
234
+ /**
235
+ * Simulate Stop
236
+ * Returns gas estimate and result without sending transaction
237
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
238
+ */
239
+ async Stop(options) {
240
+ return contract.simulate.Stop(options);
241
+ },
242
+ /**
243
+ * Simulate Try
244
+ * Returns gas estimate and result without sending transaction
245
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
246
+ */
247
+ async Try(_response, options) {
248
+ return contract.simulate.Try([_response], options);
249
+ }
250
+ };
251
+ }
252
+ /**
253
+ * Watch contract events
254
+ *
255
+ * Note: This contract has no events, so watch returns an empty object.
256
+ */
257
+ get watch() {
258
+ return {};
259
+ }
260
+ }
261
+ exports.wf_quiz_json = wf_quiz_json;
@@ -0,0 +1,381 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+ /**
5
+ * wf_quiz_json ABI
6
+ *
7
+ * This ABI is typed using viem's type system for full type safety.
8
+ */
9
+ export const wf_quiz_jsonAbi = [
10
+ {
11
+ "inputs": [
12
+ {
13
+ "internalType": "bytes32[]",
14
+ "name": "admins",
15
+ "type": "bytes32[]"
16
+ }
17
+ ],
18
+ "stateMutability": "nonpayable",
19
+ "type": "constructor"
20
+ },
21
+ {
22
+ "stateMutability": "nonpayable",
23
+ "type": "fallback"
24
+ },
25
+ {
26
+ "inputs": [
27
+ {
28
+ "internalType": "string",
29
+ "name": "_question",
30
+ "type": "string"
31
+ },
32
+ {
33
+ "internalType": "bytes32",
34
+ "name": "_responseHash",
35
+ "type": "bytes32"
36
+ }
37
+ ],
38
+ "name": "New",
39
+ "outputs": [],
40
+ "stateMutability": "payable",
41
+ "type": "function"
42
+ },
43
+ {
44
+ "inputs": [
45
+ {
46
+ "internalType": "string",
47
+ "name": "_question",
48
+ "type": "string"
49
+ },
50
+ {
51
+ "internalType": "string",
52
+ "name": "_response",
53
+ "type": "string"
54
+ }
55
+ ],
56
+ "name": "Start",
57
+ "outputs": [],
58
+ "stateMutability": "payable",
59
+ "type": "function"
60
+ },
61
+ {
62
+ "inputs": [],
63
+ "name": "Stop",
64
+ "outputs": [],
65
+ "stateMutability": "payable",
66
+ "type": "function"
67
+ },
68
+ {
69
+ "inputs": [
70
+ {
71
+ "internalType": "string",
72
+ "name": "_response",
73
+ "type": "string"
74
+ }
75
+ ],
76
+ "name": "Try",
77
+ "outputs": [],
78
+ "stateMutability": "payable",
79
+ "type": "function"
80
+ },
81
+ {
82
+ "inputs": [],
83
+ "name": "question",
84
+ "outputs": [
85
+ {
86
+ "internalType": "string",
87
+ "name": "",
88
+ "type": "string"
89
+ }
90
+ ],
91
+ "stateMutability": "view",
92
+ "type": "function"
93
+ }
94
+ ] as const satisfies Abi;
95
+
96
+ /**
97
+ * Type-safe ABI for wf_quiz_json
98
+ */
99
+ export type wf_quiz_jsonAbi = typeof wf_quiz_jsonAbi;
100
+
101
+ /**
102
+ * Contract instance type for wf_quiz_json
103
+ */
104
+ // Use any for contract type to avoid complex viem type issues
105
+ // The runtime behavior is type-safe through viem's ABI typing
106
+ export type wf_quiz_jsonContract = any;
107
+
108
+ /**
109
+ * wf_quiz_json Contract Class
110
+ *
111
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * import { createPublicClient, createWalletClient, http } from 'viem';
116
+ * import { mainnet } from 'viem/chains';
117
+ * import { wf_quiz_json } from 'wf_quiz_json';
118
+ *
119
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
120
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
121
+ *
122
+ * const contract = new wf_quiz_json('0x...', { publicClient, walletClient });
123
+ *
124
+ * // Read functions
125
+ * const result = await contract.balanceOf('0x...');
126
+ *
127
+ * // Write functions
128
+ * const hash = await contract.transfer('0x...', 1000n);
129
+ *
130
+ * // Simulate transactions (dry-run)
131
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
132
+ * console.log('Gas estimate:', simulation.request.gas);
133
+ *
134
+ * // Watch events
135
+ * const unwatch = contract.watch.Transfer((event) => {
136
+ * console.log('Transfer event:', event);
137
+ * });
138
+ * ```
139
+ */
140
+ export class wf_quiz_json {
141
+ private contract: wf_quiz_jsonContract;
142
+ private contractAddress: Address;
143
+ private publicClient: PublicClient;
144
+
145
+ constructor(
146
+ address: Address,
147
+ clients: {
148
+ publicClient: PublicClient;
149
+ walletClient?: WalletClient;
150
+ }
151
+ ) {
152
+ this.contractAddress = address;
153
+ this.publicClient = clients.publicClient;
154
+ this.contract = getContract({
155
+ address,
156
+ abi: wf_quiz_jsonAbi,
157
+ client: {
158
+ public: clients.publicClient,
159
+ wallet: clients.walletClient,
160
+ },
161
+ });
162
+ }
163
+
164
+ /**
165
+ * Get the contract address
166
+ */
167
+ get address(): Address {
168
+ return this.contractAddress;
169
+ }
170
+
171
+ /**
172
+ * Get the underlying viem contract instance
173
+ */
174
+ getContract(): wf_quiz_jsonContract {
175
+ return this.contract;
176
+ }
177
+
178
+ /**
179
+ * question
180
+ * view
181
+ */
182
+ async question(): Promise<string> {
183
+ return this.contract.read.question() as Promise<string>;
184
+ }
185
+
186
+ /**
187
+ * New
188
+ * payable
189
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
190
+ */
191
+ async New(_question: string, _responseHash: `0x${string}`, options?: {
192
+ accessList?: import('viem').AccessList;
193
+ authorizationList?: import('viem').AuthorizationList;
194
+ chain?: import('viem').Chain | null;
195
+ dataSuffix?: `0x${string}`;
196
+ gas?: bigint;
197
+ gasPrice?: bigint;
198
+ maxFeePerGas?: bigint;
199
+ maxPriorityFeePerGas?: bigint;
200
+ nonce?: number;
201
+ value?: bigint;
202
+ }): Promise<`0x${string}`> {
203
+ if (!this.contract.write) {
204
+ throw new Error('Wallet client is required for write operations');
205
+ }
206
+ return this.contract.write.New([_question, _responseHash] as const, options) as Promise<`0x${string}`>;
207
+ }
208
+
209
+ /**
210
+ * Start
211
+ * payable
212
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
213
+ */
214
+ async Start(_question: string, _response: string, options?: {
215
+ accessList?: import('viem').AccessList;
216
+ authorizationList?: import('viem').AuthorizationList;
217
+ chain?: import('viem').Chain | null;
218
+ dataSuffix?: `0x${string}`;
219
+ gas?: bigint;
220
+ gasPrice?: bigint;
221
+ maxFeePerGas?: bigint;
222
+ maxPriorityFeePerGas?: bigint;
223
+ nonce?: number;
224
+ value?: bigint;
225
+ }): Promise<`0x${string}`> {
226
+ if (!this.contract.write) {
227
+ throw new Error('Wallet client is required for write operations');
228
+ }
229
+ return this.contract.write.Start([_question, _response] as const, options) as Promise<`0x${string}`>;
230
+ }
231
+
232
+ /**
233
+ * Stop
234
+ * payable
235
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
236
+ */
237
+ async Stop(options?: {
238
+ accessList?: import('viem').AccessList;
239
+ authorizationList?: import('viem').AuthorizationList;
240
+ chain?: import('viem').Chain | null;
241
+ dataSuffix?: `0x${string}`;
242
+ gas?: bigint;
243
+ gasPrice?: bigint;
244
+ maxFeePerGas?: bigint;
245
+ maxPriorityFeePerGas?: bigint;
246
+ nonce?: number;
247
+ value?: bigint;
248
+ }): Promise<`0x${string}`> {
249
+ if (!this.contract.write) {
250
+ throw new Error('Wallet client is required for write operations');
251
+ }
252
+ return this.contract.write.Stop(options) as Promise<`0x${string}`>;
253
+ }
254
+
255
+ /**
256
+ * Try
257
+ * payable
258
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
259
+ */
260
+ async Try(_response: string, options?: {
261
+ accessList?: import('viem').AccessList;
262
+ authorizationList?: import('viem').AuthorizationList;
263
+ chain?: import('viem').Chain | null;
264
+ dataSuffix?: `0x${string}`;
265
+ gas?: bigint;
266
+ gasPrice?: bigint;
267
+ maxFeePerGas?: bigint;
268
+ maxPriorityFeePerGas?: bigint;
269
+ nonce?: number;
270
+ value?: bigint;
271
+ }): Promise<`0x${string}`> {
272
+ if (!this.contract.write) {
273
+ throw new Error('Wallet client is required for write operations');
274
+ }
275
+ return this.contract.write.Try([_response] as const, options) as Promise<`0x${string}`>;
276
+ }
277
+
278
+
279
+
280
+ /**
281
+ * Simulate contract write operations (dry-run without sending transaction)
282
+ *
283
+ * @example
284
+ * const result = await contract.simulate.transfer('0x...', 1000n);
285
+ * console.log('Gas estimate:', result.request.gas);
286
+ * console.log('Would succeed:', result.result);
287
+ */
288
+ get simulate() {
289
+ const contract = this.contract;
290
+ if (!contract.simulate) {
291
+ throw new Error('Public client is required for simulation');
292
+ }
293
+ return {
294
+ /**
295
+ * Simulate New
296
+ * Returns gas estimate and result without sending transaction
297
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
298
+ */
299
+ async New(_question: string, _responseHash: `0x${string}`, options?: {
300
+ accessList?: import('viem').AccessList;
301
+ authorizationList?: import('viem').AuthorizationList;
302
+ chain?: import('viem').Chain | null;
303
+ dataSuffix?: `0x${string}`;
304
+ gas?: bigint;
305
+ gasPrice?: bigint;
306
+ maxFeePerGas?: bigint;
307
+ maxPriorityFeePerGas?: bigint;
308
+ nonce?: number;
309
+ value?: bigint;
310
+ }): Promise<void> {
311
+ return contract.simulate.New([_question, _responseHash] as const, options) as Promise<void>;
312
+ },
313
+ /**
314
+ * Simulate Start
315
+ * Returns gas estimate and result without sending transaction
316
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
317
+ */
318
+ async Start(_question: string, _response: string, options?: {
319
+ accessList?: import('viem').AccessList;
320
+ authorizationList?: import('viem').AuthorizationList;
321
+ chain?: import('viem').Chain | null;
322
+ dataSuffix?: `0x${string}`;
323
+ gas?: bigint;
324
+ gasPrice?: bigint;
325
+ maxFeePerGas?: bigint;
326
+ maxPriorityFeePerGas?: bigint;
327
+ nonce?: number;
328
+ value?: bigint;
329
+ }): Promise<void> {
330
+ return contract.simulate.Start([_question, _response] as const, options) as Promise<void>;
331
+ },
332
+ /**
333
+ * Simulate Stop
334
+ * Returns gas estimate and result without sending transaction
335
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
336
+ */
337
+ async Stop(options?: {
338
+ accessList?: import('viem').AccessList;
339
+ authorizationList?: import('viem').AuthorizationList;
340
+ chain?: import('viem').Chain | null;
341
+ dataSuffix?: `0x${string}`;
342
+ gas?: bigint;
343
+ gasPrice?: bigint;
344
+ maxFeePerGas?: bigint;
345
+ maxPriorityFeePerGas?: bigint;
346
+ nonce?: number;
347
+ value?: bigint;
348
+ }): Promise<void> {
349
+ return contract.simulate.Stop(options) as Promise<void>;
350
+ },
351
+ /**
352
+ * Simulate Try
353
+ * Returns gas estimate and result without sending transaction
354
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
355
+ */
356
+ async Try(_response: string, options?: {
357
+ accessList?: import('viem').AccessList;
358
+ authorizationList?: import('viem').AuthorizationList;
359
+ chain?: import('viem').Chain | null;
360
+ dataSuffix?: `0x${string}`;
361
+ gas?: bigint;
362
+ gasPrice?: bigint;
363
+ maxFeePerGas?: bigint;
364
+ maxPriorityFeePerGas?: bigint;
365
+ nonce?: number;
366
+ value?: bigint;
367
+ }): Promise<void> {
368
+ return contract.simulate.Try([_response] as const, options) as Promise<void>;
369
+ }
370
+ };
371
+ }
372
+
373
+ /**
374
+ * Watch contract events
375
+ *
376
+ * Note: This contract has no events, so watch returns an empty object.
377
+ */
378
+ get watch() {
379
+ return {};
380
+ }
381
+ }
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './contracts';
package/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ // Auto-generated TypeScript type bindings
3
+ // This file exports all generated contract types
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ __exportStar(require("./contracts"), exports);
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@gitmyabi/wf-quiz",
3
+ "version": "1.0.0",
4
+ "description": "Auto-generated TypeScript type bindings for wf_quiz (build etherscan-wf-quiz-4f8abea0-1787033347607, commit 0925afd, branch etherscan)",
5
+ "main": "./index.js",
6
+ "types": "./index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./index.js",
10
+ "require": "./index.js",
11
+ "types": "./index.d.ts"
12
+ },
13
+ "./contracts": {
14
+ "import": "./contracts/index.js",
15
+ "require": "./contracts/index.js",
16
+ "types": "./contracts/index.d.ts"
17
+ }
18
+ },
19
+ "files": [
20
+ "index.js",
21
+ "index.d.ts",
22
+ "contracts"
23
+ ],
24
+ "keywords": [
25
+ "ethereum",
26
+ "smart-contracts",
27
+ "viem",
28
+ "wagmi",
29
+ "typescript",
30
+ "abi",
31
+ "ethers-v6"
32
+ ],
33
+ "license": "MIT",
34
+ "dependencies": {
35
+ "viem": "^2.0.0"
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/etherscan/wf-quiz"
40
+ },
41
+ "branch": "etherscan",
42
+ "shortHash": "0925afd"
43
+ }