@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.
- package/README.md +108 -0
- package/contracts/AudiusAdminUpgradeabilityProxy_json.d.ts +256 -0
- package/contracts/AudiusAdminUpgradeabilityProxy_json.js +273 -0
- package/contracts/AudiusAdminUpgradeabilityProxy_json.ts +348 -0
- package/contracts/AudiusToken_json.d.ts +1371 -0
- package/contracts/AudiusToken_json.js +1355 -0
- package/contracts/AudiusToken_json.ts +1790 -0
- package/contracts/index.d.ts +4 -0
- package/contracts/index.js +10 -0
- package/contracts/index.ts +5 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# @gitmyabi/audio
|
|
2
|
+
|
|
3
|
+
Auto-generated TypeScript type bindings for **AUDIO**
|
|
4
|
+
|
|
5
|
+
- **Build ID**: `etherscan-audio-18aaa711-1785593892819`
|
|
6
|
+
- **Build Number**: 1
|
|
7
|
+
- **Commit**: `0def6a5`
|
|
8
|
+
- **Branch**: `etherscan`
|
|
9
|
+
- **Target**: `ethers-v6`
|
|
10
|
+
- **Contracts**: 2
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @gitmyabi/audio@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/audio';
|
|
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/audio';
|
|
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/audio';
|
|
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 2 contract(s) generated from ABI artifacts.
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import type { Address, PublicClient, WalletClient } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* AudiusAdminUpgradeabilityProxy_json ABI
|
|
4
|
+
*
|
|
5
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
6
|
+
*/
|
|
7
|
+
export declare const AudiusAdminUpgradeabilityProxy_jsonAbi: readonly [{
|
|
8
|
+
readonly inputs: readonly [{
|
|
9
|
+
readonly internalType: "address";
|
|
10
|
+
readonly name: "_logic";
|
|
11
|
+
readonly type: "address";
|
|
12
|
+
}, {
|
|
13
|
+
readonly internalType: "address";
|
|
14
|
+
readonly name: "_proxyAdmin";
|
|
15
|
+
readonly type: "address";
|
|
16
|
+
}, {
|
|
17
|
+
readonly internalType: "bytes";
|
|
18
|
+
readonly name: "_data";
|
|
19
|
+
readonly type: "bytes";
|
|
20
|
+
}];
|
|
21
|
+
readonly payable: true;
|
|
22
|
+
readonly stateMutability: "payable";
|
|
23
|
+
readonly type: "constructor";
|
|
24
|
+
}, {
|
|
25
|
+
readonly anonymous: false;
|
|
26
|
+
readonly inputs: readonly [{
|
|
27
|
+
readonly indexed: true;
|
|
28
|
+
readonly internalType: "address";
|
|
29
|
+
readonly name: "implementation";
|
|
30
|
+
readonly type: "address";
|
|
31
|
+
}];
|
|
32
|
+
readonly name: "Upgraded";
|
|
33
|
+
readonly type: "event";
|
|
34
|
+
}, {
|
|
35
|
+
readonly payable: true;
|
|
36
|
+
readonly stateMutability: "payable";
|
|
37
|
+
readonly type: "fallback";
|
|
38
|
+
}, {
|
|
39
|
+
readonly constant: true;
|
|
40
|
+
readonly inputs: readonly [];
|
|
41
|
+
readonly name: "getAudiusProxyAdminAddress";
|
|
42
|
+
readonly outputs: readonly [{
|
|
43
|
+
readonly internalType: "address";
|
|
44
|
+
readonly name: "";
|
|
45
|
+
readonly type: "address";
|
|
46
|
+
}];
|
|
47
|
+
readonly payable: false;
|
|
48
|
+
readonly stateMutability: "view";
|
|
49
|
+
readonly type: "function";
|
|
50
|
+
}, {
|
|
51
|
+
readonly constant: true;
|
|
52
|
+
readonly inputs: readonly [];
|
|
53
|
+
readonly name: "implementation";
|
|
54
|
+
readonly outputs: readonly [{
|
|
55
|
+
readonly internalType: "address";
|
|
56
|
+
readonly name: "";
|
|
57
|
+
readonly type: "address";
|
|
58
|
+
}];
|
|
59
|
+
readonly payable: false;
|
|
60
|
+
readonly stateMutability: "view";
|
|
61
|
+
readonly type: "function";
|
|
62
|
+
}, {
|
|
63
|
+
readonly constant: false;
|
|
64
|
+
readonly inputs: readonly [{
|
|
65
|
+
readonly internalType: "address";
|
|
66
|
+
readonly name: "_adminAddress";
|
|
67
|
+
readonly type: "address";
|
|
68
|
+
}];
|
|
69
|
+
readonly name: "setAudiusProxyAdminAddress";
|
|
70
|
+
readonly outputs: readonly [];
|
|
71
|
+
readonly payable: false;
|
|
72
|
+
readonly stateMutability: "nonpayable";
|
|
73
|
+
readonly type: "function";
|
|
74
|
+
}, {
|
|
75
|
+
readonly constant: false;
|
|
76
|
+
readonly inputs: readonly [{
|
|
77
|
+
readonly internalType: "address";
|
|
78
|
+
readonly name: "_newImplementation";
|
|
79
|
+
readonly type: "address";
|
|
80
|
+
}];
|
|
81
|
+
readonly name: "upgradeTo";
|
|
82
|
+
readonly outputs: readonly [];
|
|
83
|
+
readonly payable: false;
|
|
84
|
+
readonly stateMutability: "nonpayable";
|
|
85
|
+
readonly type: "function";
|
|
86
|
+
}];
|
|
87
|
+
/**
|
|
88
|
+
* Type-safe ABI for AudiusAdminUpgradeabilityProxy_json
|
|
89
|
+
*/
|
|
90
|
+
export type AudiusAdminUpgradeabilityProxy_jsonAbi = typeof AudiusAdminUpgradeabilityProxy_jsonAbi;
|
|
91
|
+
/**
|
|
92
|
+
* Contract instance type for AudiusAdminUpgradeabilityProxy_json
|
|
93
|
+
*/
|
|
94
|
+
export type AudiusAdminUpgradeabilityProxy_jsonContract = any;
|
|
95
|
+
/**
|
|
96
|
+
* AudiusAdminUpgradeabilityProxy_json Contract Class
|
|
97
|
+
*
|
|
98
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
103
|
+
* import { mainnet } from 'viem/chains';
|
|
104
|
+
* import { AudiusAdminUpgradeabilityProxy_json } from 'AudiusAdminUpgradeabilityProxy_json';
|
|
105
|
+
*
|
|
106
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
107
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
108
|
+
*
|
|
109
|
+
* const contract = new AudiusAdminUpgradeabilityProxy_json('0x...', { publicClient, walletClient });
|
|
110
|
+
*
|
|
111
|
+
* // Read functions
|
|
112
|
+
* const result = await contract.balanceOf('0x...');
|
|
113
|
+
*
|
|
114
|
+
* // Write functions
|
|
115
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
116
|
+
*
|
|
117
|
+
* // Simulate transactions (dry-run)
|
|
118
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
119
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
120
|
+
*
|
|
121
|
+
* // Watch events
|
|
122
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
123
|
+
* console.log('Transfer event:', event);
|
|
124
|
+
* });
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare class AudiusAdminUpgradeabilityProxy_json {
|
|
128
|
+
private contract;
|
|
129
|
+
private contractAddress;
|
|
130
|
+
private publicClient;
|
|
131
|
+
constructor(address: Address, clients: {
|
|
132
|
+
publicClient: PublicClient;
|
|
133
|
+
walletClient?: WalletClient;
|
|
134
|
+
});
|
|
135
|
+
/**
|
|
136
|
+
* Get the contract address
|
|
137
|
+
*/
|
|
138
|
+
get address(): Address;
|
|
139
|
+
/**
|
|
140
|
+
* Get the underlying viem contract instance
|
|
141
|
+
*/
|
|
142
|
+
getContract(): AudiusAdminUpgradeabilityProxy_jsonContract;
|
|
143
|
+
/**
|
|
144
|
+
* getAudiusProxyAdminAddress
|
|
145
|
+
* view
|
|
146
|
+
*/
|
|
147
|
+
getAudiusProxyAdminAddress(): Promise<`0x${string}`>;
|
|
148
|
+
/**
|
|
149
|
+
* implementation
|
|
150
|
+
* view
|
|
151
|
+
*/
|
|
152
|
+
implementation(): Promise<`0x${string}`>;
|
|
153
|
+
/**
|
|
154
|
+
* setAudiusProxyAdminAddress
|
|
155
|
+
* nonpayable
|
|
156
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
157
|
+
*/
|
|
158
|
+
setAudiusProxyAdminAddress(_adminAddress: `0x${string}`, options?: {
|
|
159
|
+
accessList?: import('viem').AccessList;
|
|
160
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
161
|
+
chain?: import('viem').Chain | null;
|
|
162
|
+
dataSuffix?: `0x${string}`;
|
|
163
|
+
gas?: bigint;
|
|
164
|
+
gasPrice?: bigint;
|
|
165
|
+
maxFeePerGas?: bigint;
|
|
166
|
+
maxPriorityFeePerGas?: bigint;
|
|
167
|
+
nonce?: number;
|
|
168
|
+
value?: bigint;
|
|
169
|
+
}): Promise<`0x${string}`>;
|
|
170
|
+
/**
|
|
171
|
+
* upgradeTo
|
|
172
|
+
* nonpayable
|
|
173
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
174
|
+
*/
|
|
175
|
+
upgradeTo(_newImplementation: `0x${string}`, options?: {
|
|
176
|
+
accessList?: import('viem').AccessList;
|
|
177
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
178
|
+
chain?: import('viem').Chain | null;
|
|
179
|
+
dataSuffix?: `0x${string}`;
|
|
180
|
+
gas?: bigint;
|
|
181
|
+
gasPrice?: bigint;
|
|
182
|
+
maxFeePerGas?: bigint;
|
|
183
|
+
maxPriorityFeePerGas?: bigint;
|
|
184
|
+
nonce?: number;
|
|
185
|
+
value?: bigint;
|
|
186
|
+
}): Promise<`0x${string}`>;
|
|
187
|
+
/**
|
|
188
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
192
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
193
|
+
* console.log('Would succeed:', result.result);
|
|
194
|
+
*/
|
|
195
|
+
get simulate(): {
|
|
196
|
+
/**
|
|
197
|
+
* Simulate setAudiusProxyAdminAddress
|
|
198
|
+
* Returns gas estimate and result without sending transaction
|
|
199
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
200
|
+
*/
|
|
201
|
+
setAudiusProxyAdminAddress(_adminAddress: `0x${string}`, options?: {
|
|
202
|
+
accessList?: import("viem").AccessList;
|
|
203
|
+
authorizationList?: import("viem").AuthorizationList;
|
|
204
|
+
chain?: import("viem").Chain | null;
|
|
205
|
+
dataSuffix?: `0x${string}`;
|
|
206
|
+
gas?: bigint;
|
|
207
|
+
gasPrice?: bigint;
|
|
208
|
+
maxFeePerGas?: bigint;
|
|
209
|
+
maxPriorityFeePerGas?: bigint;
|
|
210
|
+
nonce?: number;
|
|
211
|
+
value?: bigint;
|
|
212
|
+
}): Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* Simulate upgradeTo
|
|
215
|
+
* Returns gas estimate and result without sending transaction
|
|
216
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
217
|
+
*/
|
|
218
|
+
upgradeTo(_newImplementation: `0x${string}`, options?: {
|
|
219
|
+
accessList?: import("viem").AccessList;
|
|
220
|
+
authorizationList?: import("viem").AuthorizationList;
|
|
221
|
+
chain?: import("viem").Chain | null;
|
|
222
|
+
dataSuffix?: `0x${string}`;
|
|
223
|
+
gas?: bigint;
|
|
224
|
+
gasPrice?: bigint;
|
|
225
|
+
maxFeePerGas?: bigint;
|
|
226
|
+
maxPriorityFeePerGas?: bigint;
|
|
227
|
+
nonce?: number;
|
|
228
|
+
value?: bigint;
|
|
229
|
+
}): Promise<void>;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* Watch contract events
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* // Watch all Transfer events
|
|
236
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
237
|
+
* console.log('Transfer:', event);
|
|
238
|
+
* });
|
|
239
|
+
*
|
|
240
|
+
* // Stop watching
|
|
241
|
+
* unwatch();
|
|
242
|
+
*/
|
|
243
|
+
get watch(): {
|
|
244
|
+
/**
|
|
245
|
+
* Watch Upgraded events
|
|
246
|
+
* @param callback Function to call when event is emitted
|
|
247
|
+
* @param filter Optional filter for indexed parameters
|
|
248
|
+
* @returns Unwatch function to stop listening
|
|
249
|
+
*/
|
|
250
|
+
Upgraded: (callback: (event: {
|
|
251
|
+
implementation: `0x${string}`;
|
|
252
|
+
}) => void, filter?: {
|
|
253
|
+
implementation: `0x${string}`;
|
|
254
|
+
}) => () => void;
|
|
255
|
+
};
|
|
256
|
+
}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AudiusAdminUpgradeabilityProxy_json = exports.AudiusAdminUpgradeabilityProxy_jsonAbi = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* AudiusAdminUpgradeabilityProxy_json ABI
|
|
7
|
+
*
|
|
8
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
+
*/
|
|
10
|
+
exports.AudiusAdminUpgradeabilityProxy_jsonAbi = [
|
|
11
|
+
{
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"internalType": "address",
|
|
15
|
+
"name": "_logic",
|
|
16
|
+
"type": "address"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"internalType": "address",
|
|
20
|
+
"name": "_proxyAdmin",
|
|
21
|
+
"type": "address"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"internalType": "bytes",
|
|
25
|
+
"name": "_data",
|
|
26
|
+
"type": "bytes"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"payable": true,
|
|
30
|
+
"stateMutability": "payable",
|
|
31
|
+
"type": "constructor"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"anonymous": false,
|
|
35
|
+
"inputs": [
|
|
36
|
+
{
|
|
37
|
+
"indexed": true,
|
|
38
|
+
"internalType": "address",
|
|
39
|
+
"name": "implementation",
|
|
40
|
+
"type": "address"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"name": "Upgraded",
|
|
44
|
+
"type": "event"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"payable": true,
|
|
48
|
+
"stateMutability": "payable",
|
|
49
|
+
"type": "fallback"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"constant": true,
|
|
53
|
+
"inputs": [],
|
|
54
|
+
"name": "getAudiusProxyAdminAddress",
|
|
55
|
+
"outputs": [
|
|
56
|
+
{
|
|
57
|
+
"internalType": "address",
|
|
58
|
+
"name": "",
|
|
59
|
+
"type": "address"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"payable": false,
|
|
63
|
+
"stateMutability": "view",
|
|
64
|
+
"type": "function"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"constant": true,
|
|
68
|
+
"inputs": [],
|
|
69
|
+
"name": "implementation",
|
|
70
|
+
"outputs": [
|
|
71
|
+
{
|
|
72
|
+
"internalType": "address",
|
|
73
|
+
"name": "",
|
|
74
|
+
"type": "address"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"payable": false,
|
|
78
|
+
"stateMutability": "view",
|
|
79
|
+
"type": "function"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"constant": false,
|
|
83
|
+
"inputs": [
|
|
84
|
+
{
|
|
85
|
+
"internalType": "address",
|
|
86
|
+
"name": "_adminAddress",
|
|
87
|
+
"type": "address"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"name": "setAudiusProxyAdminAddress",
|
|
91
|
+
"outputs": [],
|
|
92
|
+
"payable": false,
|
|
93
|
+
"stateMutability": "nonpayable",
|
|
94
|
+
"type": "function"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"constant": false,
|
|
98
|
+
"inputs": [
|
|
99
|
+
{
|
|
100
|
+
"internalType": "address",
|
|
101
|
+
"name": "_newImplementation",
|
|
102
|
+
"type": "address"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"name": "upgradeTo",
|
|
106
|
+
"outputs": [],
|
|
107
|
+
"payable": false,
|
|
108
|
+
"stateMutability": "nonpayable",
|
|
109
|
+
"type": "function"
|
|
110
|
+
}
|
|
111
|
+
];
|
|
112
|
+
/**
|
|
113
|
+
* AudiusAdminUpgradeabilityProxy_json Contract Class
|
|
114
|
+
*
|
|
115
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
120
|
+
* import { mainnet } from 'viem/chains';
|
|
121
|
+
* import { AudiusAdminUpgradeabilityProxy_json } from 'AudiusAdminUpgradeabilityProxy_json';
|
|
122
|
+
*
|
|
123
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
124
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
125
|
+
*
|
|
126
|
+
* const contract = new AudiusAdminUpgradeabilityProxy_json('0x...', { publicClient, walletClient });
|
|
127
|
+
*
|
|
128
|
+
* // Read functions
|
|
129
|
+
* const result = await contract.balanceOf('0x...');
|
|
130
|
+
*
|
|
131
|
+
* // Write functions
|
|
132
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
133
|
+
*
|
|
134
|
+
* // Simulate transactions (dry-run)
|
|
135
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
136
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
137
|
+
*
|
|
138
|
+
* // Watch events
|
|
139
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
140
|
+
* console.log('Transfer event:', event);
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
class AudiusAdminUpgradeabilityProxy_json {
|
|
145
|
+
constructor(address, clients) {
|
|
146
|
+
this.contractAddress = address;
|
|
147
|
+
this.publicClient = clients.publicClient;
|
|
148
|
+
this.contract = (0, viem_1.getContract)({
|
|
149
|
+
address,
|
|
150
|
+
abi: exports.AudiusAdminUpgradeabilityProxy_jsonAbi,
|
|
151
|
+
client: {
|
|
152
|
+
public: clients.publicClient,
|
|
153
|
+
wallet: clients.walletClient,
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Get the contract address
|
|
159
|
+
*/
|
|
160
|
+
get address() {
|
|
161
|
+
return this.contractAddress;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get the underlying viem contract instance
|
|
165
|
+
*/
|
|
166
|
+
getContract() {
|
|
167
|
+
return this.contract;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* getAudiusProxyAdminAddress
|
|
171
|
+
* view
|
|
172
|
+
*/
|
|
173
|
+
async getAudiusProxyAdminAddress() {
|
|
174
|
+
return this.contract.read.getAudiusProxyAdminAddress();
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* implementation
|
|
178
|
+
* view
|
|
179
|
+
*/
|
|
180
|
+
async implementation() {
|
|
181
|
+
return this.contract.read.implementation();
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* setAudiusProxyAdminAddress
|
|
185
|
+
* nonpayable
|
|
186
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
187
|
+
*/
|
|
188
|
+
async setAudiusProxyAdminAddress(_adminAddress, options) {
|
|
189
|
+
if (!this.contract.write) {
|
|
190
|
+
throw new Error('Wallet client is required for write operations');
|
|
191
|
+
}
|
|
192
|
+
return this.contract.write.setAudiusProxyAdminAddress([_adminAddress], options);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* upgradeTo
|
|
196
|
+
* nonpayable
|
|
197
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
198
|
+
*/
|
|
199
|
+
async upgradeTo(_newImplementation, options) {
|
|
200
|
+
if (!this.contract.write) {
|
|
201
|
+
throw new Error('Wallet client is required for write operations');
|
|
202
|
+
}
|
|
203
|
+
return this.contract.write.upgradeTo([_newImplementation], options);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
210
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
211
|
+
* console.log('Would succeed:', result.result);
|
|
212
|
+
*/
|
|
213
|
+
get simulate() {
|
|
214
|
+
const contract = this.contract;
|
|
215
|
+
if (!contract.simulate) {
|
|
216
|
+
throw new Error('Public client is required for simulation');
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
/**
|
|
220
|
+
* Simulate setAudiusProxyAdminAddress
|
|
221
|
+
* Returns gas estimate and result without sending transaction
|
|
222
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
223
|
+
*/
|
|
224
|
+
async setAudiusProxyAdminAddress(_adminAddress, options) {
|
|
225
|
+
return contract.simulate.setAudiusProxyAdminAddress([_adminAddress], options);
|
|
226
|
+
},
|
|
227
|
+
/**
|
|
228
|
+
* Simulate upgradeTo
|
|
229
|
+
* Returns gas estimate and result without sending transaction
|
|
230
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
231
|
+
*/
|
|
232
|
+
async upgradeTo(_newImplementation, options) {
|
|
233
|
+
return contract.simulate.upgradeTo([_newImplementation], options);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Watch contract events
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* // Watch all Transfer events
|
|
242
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
243
|
+
* console.log('Transfer:', event);
|
|
244
|
+
* });
|
|
245
|
+
*
|
|
246
|
+
* // Stop watching
|
|
247
|
+
* unwatch();
|
|
248
|
+
*/
|
|
249
|
+
get watch() {
|
|
250
|
+
return {
|
|
251
|
+
/**
|
|
252
|
+
* Watch Upgraded events
|
|
253
|
+
* @param callback Function to call when event is emitted
|
|
254
|
+
* @param filter Optional filter for indexed parameters
|
|
255
|
+
* @returns Unwatch function to stop listening
|
|
256
|
+
*/
|
|
257
|
+
Upgraded: (callback, filter) => {
|
|
258
|
+
return this.publicClient.watchContractEvent({
|
|
259
|
+
address: this.contractAddress,
|
|
260
|
+
abi: exports.AudiusAdminUpgradeabilityProxy_jsonAbi,
|
|
261
|
+
eventName: 'Upgraded',
|
|
262
|
+
args: filter,
|
|
263
|
+
onLogs: (logs) => {
|
|
264
|
+
logs.forEach((log) => {
|
|
265
|
+
callback(log.args);
|
|
266
|
+
});
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
exports.AudiusAdminUpgradeabilityProxy_json = AudiusAdminUpgradeabilityProxy_json;
|