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