@gitmyabi/usdt 1.0.14 → 1.0.16
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 +5 -5
- package/contracts/UERC20_json.d.ts +647 -0
- package/contracts/UERC20_json.js +735 -0
- package/contracts/UERC20_json.ts +867 -0
- package/contracts/index.d.ts +2 -4
- package/contracts/index.js +4 -7
- package/contracts/index.ts +2 -4
- package/package.json +3 -3
- package/contracts/ERC1967Proxy_json.d.ts +0 -169
- package/contracts/ERC1967Proxy_json.js +0 -221
- package/contracts/ERC1967Proxy_json.ts +0 -251
- package/contracts/USDTProxy_json.d.ts +0 -1298
- package/contracts/USDTProxy_json.js +0 -1343
- package/contracts/USDTProxy_json.ts +0 -1728
package/contracts/index.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
3
|
-
export { USDTProxy_jsonAbi, USDTProxy_json } from './USDTProxy_json';
|
|
4
|
-
export type { USDTProxy_jsonAbi as USDTProxy_jsonAbiType, USDTProxy_jsonContract } from './USDTProxy_json';
|
|
1
|
+
export { UERC20_jsonAbi, UERC20_json } from './UERC20_json';
|
|
2
|
+
export type { UERC20_jsonAbi as UERC20_jsonAbiType, UERC20_jsonContract } from './UERC20_json';
|
package/contracts/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.UERC20_json = exports.UERC20_jsonAbi = void 0;
|
|
4
4
|
// Auto-generated exports for all contracts
|
|
5
|
-
var
|
|
6
|
-
Object.defineProperty(exports, "
|
|
7
|
-
Object.defineProperty(exports, "
|
|
8
|
-
var USDTProxy_json_1 = require("./USDTProxy_json");
|
|
9
|
-
Object.defineProperty(exports, "USDTProxy_jsonAbi", { enumerable: true, get: function () { return USDTProxy_json_1.USDTProxy_jsonAbi; } });
|
|
10
|
-
Object.defineProperty(exports, "USDTProxy_json", { enumerable: true, get: function () { return USDTProxy_json_1.USDTProxy_json; } });
|
|
5
|
+
var UERC20_json_1 = require("./UERC20_json");
|
|
6
|
+
Object.defineProperty(exports, "UERC20_jsonAbi", { enumerable: true, get: function () { return UERC20_json_1.UERC20_jsonAbi; } });
|
|
7
|
+
Object.defineProperty(exports, "UERC20_json", { enumerable: true, get: function () { return UERC20_json_1.UERC20_json; } });
|
package/contracts/index.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
// Auto-generated exports for all contracts
|
|
2
|
-
export {
|
|
3
|
-
export type {
|
|
4
|
-
export { USDTProxy_jsonAbi, USDTProxy_json } from './USDTProxy_json';
|
|
5
|
-
export type { USDTProxy_jsonAbi as USDTProxy_jsonAbiType, USDTProxy_jsonContract } from './USDTProxy_json';
|
|
2
|
+
export { UERC20_jsonAbi, UERC20_json } from './UERC20_json';
|
|
3
|
+
export type { UERC20_jsonAbi as UERC20_jsonAbiType, UERC20_jsonContract } from './UERC20_json';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitmyabi/usdt",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Auto-generated TypeScript type bindings for USDT (build etherscan-usdt-
|
|
3
|
+
"version": "1.0.16",
|
|
4
|
+
"description": "Auto-generated TypeScript type bindings for USDT (build etherscan-usdt-8d2021ec-1786097010496, commit 723b7ad, branch etherscan)",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"url": "https://github.com/etherscan/usdt"
|
|
40
40
|
},
|
|
41
41
|
"branch": "etherscan",
|
|
42
|
-
"shortHash": "
|
|
42
|
+
"shortHash": "723b7ad"
|
|
43
43
|
}
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import type { Address, PublicClient, WalletClient } from 'viem';
|
|
2
|
-
/**
|
|
3
|
-
* ERC1967Proxy_json ABI
|
|
4
|
-
*
|
|
5
|
-
* This ABI is typed using viem's type system for full type safety.
|
|
6
|
-
*/
|
|
7
|
-
export declare const ERC1967Proxy_jsonAbi: readonly [{
|
|
8
|
-
readonly inputs: readonly [{
|
|
9
|
-
readonly internalType: "address";
|
|
10
|
-
readonly name: "_logic";
|
|
11
|
-
readonly type: "address";
|
|
12
|
-
}, {
|
|
13
|
-
readonly internalType: "bytes";
|
|
14
|
-
readonly name: "_data";
|
|
15
|
-
readonly type: "bytes";
|
|
16
|
-
}];
|
|
17
|
-
readonly stateMutability: "payable";
|
|
18
|
-
readonly type: "constructor";
|
|
19
|
-
}, {
|
|
20
|
-
readonly anonymous: false;
|
|
21
|
-
readonly inputs: readonly [{
|
|
22
|
-
readonly indexed: false;
|
|
23
|
-
readonly internalType: "address";
|
|
24
|
-
readonly name: "previousAdmin";
|
|
25
|
-
readonly type: "address";
|
|
26
|
-
}, {
|
|
27
|
-
readonly indexed: false;
|
|
28
|
-
readonly internalType: "address";
|
|
29
|
-
readonly name: "newAdmin";
|
|
30
|
-
readonly type: "address";
|
|
31
|
-
}];
|
|
32
|
-
readonly name: "AdminChanged";
|
|
33
|
-
readonly type: "event";
|
|
34
|
-
}, {
|
|
35
|
-
readonly anonymous: false;
|
|
36
|
-
readonly inputs: readonly [{
|
|
37
|
-
readonly indexed: true;
|
|
38
|
-
readonly internalType: "address";
|
|
39
|
-
readonly name: "beacon";
|
|
40
|
-
readonly type: "address";
|
|
41
|
-
}];
|
|
42
|
-
readonly name: "BeaconUpgraded";
|
|
43
|
-
readonly type: "event";
|
|
44
|
-
}, {
|
|
45
|
-
readonly anonymous: false;
|
|
46
|
-
readonly inputs: readonly [{
|
|
47
|
-
readonly indexed: true;
|
|
48
|
-
readonly internalType: "address";
|
|
49
|
-
readonly name: "implementation";
|
|
50
|
-
readonly type: "address";
|
|
51
|
-
}];
|
|
52
|
-
readonly name: "Upgraded";
|
|
53
|
-
readonly type: "event";
|
|
54
|
-
}, {
|
|
55
|
-
readonly stateMutability: "payable";
|
|
56
|
-
readonly type: "fallback";
|
|
57
|
-
}, {
|
|
58
|
-
readonly stateMutability: "payable";
|
|
59
|
-
readonly type: "receive";
|
|
60
|
-
}];
|
|
61
|
-
/**
|
|
62
|
-
* Type-safe ABI for ERC1967Proxy_json
|
|
63
|
-
*/
|
|
64
|
-
export type ERC1967Proxy_jsonAbi = typeof ERC1967Proxy_jsonAbi;
|
|
65
|
-
/**
|
|
66
|
-
* Contract instance type for ERC1967Proxy_json
|
|
67
|
-
*/
|
|
68
|
-
export type ERC1967Proxy_jsonContract = any;
|
|
69
|
-
/**
|
|
70
|
-
* ERC1967Proxy_json Contract Class
|
|
71
|
-
*
|
|
72
|
-
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```typescript
|
|
76
|
-
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
77
|
-
* import { mainnet } from 'viem/chains';
|
|
78
|
-
* import { ERC1967Proxy_json } from 'ERC1967Proxy_json';
|
|
79
|
-
*
|
|
80
|
-
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
81
|
-
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
82
|
-
*
|
|
83
|
-
* const contract = new ERC1967Proxy_json('0x...', { publicClient, walletClient });
|
|
84
|
-
*
|
|
85
|
-
* // Read functions
|
|
86
|
-
* const result = await contract.balanceOf('0x...');
|
|
87
|
-
*
|
|
88
|
-
* // Write functions
|
|
89
|
-
* const hash = await contract.transfer('0x...', 1000n);
|
|
90
|
-
*
|
|
91
|
-
* // Simulate transactions (dry-run)
|
|
92
|
-
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
93
|
-
* console.log('Gas estimate:', simulation.request.gas);
|
|
94
|
-
*
|
|
95
|
-
* // Watch events
|
|
96
|
-
* const unwatch = contract.watch.Transfer((event) => {
|
|
97
|
-
* console.log('Transfer event:', event);
|
|
98
|
-
* });
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
export declare class ERC1967Proxy_json {
|
|
102
|
-
private contract;
|
|
103
|
-
private contractAddress;
|
|
104
|
-
private publicClient;
|
|
105
|
-
constructor(address: Address, clients: {
|
|
106
|
-
publicClient: PublicClient;
|
|
107
|
-
walletClient?: WalletClient;
|
|
108
|
-
});
|
|
109
|
-
/**
|
|
110
|
-
* Get the contract address
|
|
111
|
-
*/
|
|
112
|
-
get address(): Address;
|
|
113
|
-
/**
|
|
114
|
-
* Get the underlying viem contract instance
|
|
115
|
-
*/
|
|
116
|
-
getContract(): ERC1967Proxy_jsonContract;
|
|
117
|
-
/**
|
|
118
|
-
* Simulate contract write operations (dry-run without sending transaction)
|
|
119
|
-
*
|
|
120
|
-
* Note: This contract has no write functions, so simulate returns an empty object.
|
|
121
|
-
*/
|
|
122
|
-
get simulate(): {};
|
|
123
|
-
/**
|
|
124
|
-
* Watch contract events
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* // Watch all Transfer events
|
|
128
|
-
* const unwatch = contract.watch.Transfer((event) => {
|
|
129
|
-
* console.log('Transfer:', event);
|
|
130
|
-
* });
|
|
131
|
-
*
|
|
132
|
-
* // Stop watching
|
|
133
|
-
* unwatch();
|
|
134
|
-
*/
|
|
135
|
-
get watch(): {
|
|
136
|
-
/**
|
|
137
|
-
* Watch AdminChanged events
|
|
138
|
-
* @param callback Function to call when event is emitted
|
|
139
|
-
* @param filter Optional filter for indexed parameters
|
|
140
|
-
* @returns Unwatch function to stop listening
|
|
141
|
-
*/
|
|
142
|
-
AdminChanged: (callback: (event: {
|
|
143
|
-
previousAdmin: `0x${string}`;
|
|
144
|
-
newAdmin: `0x${string}`;
|
|
145
|
-
}) => void) => () => void;
|
|
146
|
-
/**
|
|
147
|
-
* Watch BeaconUpgraded events
|
|
148
|
-
* @param callback Function to call when event is emitted
|
|
149
|
-
* @param filter Optional filter for indexed parameters
|
|
150
|
-
* @returns Unwatch function to stop listening
|
|
151
|
-
*/
|
|
152
|
-
BeaconUpgraded: (callback: (event: {
|
|
153
|
-
beacon: `0x${string}`;
|
|
154
|
-
}) => void, filter?: {
|
|
155
|
-
beacon: `0x${string}`;
|
|
156
|
-
}) => () => void;
|
|
157
|
-
/**
|
|
158
|
-
* Watch Upgraded events
|
|
159
|
-
* @param callback Function to call when event is emitted
|
|
160
|
-
* @param filter Optional filter for indexed parameters
|
|
161
|
-
* @returns Unwatch function to stop listening
|
|
162
|
-
*/
|
|
163
|
-
Upgraded: (callback: (event: {
|
|
164
|
-
implementation: `0x${string}`;
|
|
165
|
-
}) => void, filter?: {
|
|
166
|
-
implementation: `0x${string}`;
|
|
167
|
-
}) => () => void;
|
|
168
|
-
};
|
|
169
|
-
}
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ERC1967Proxy_json = exports.ERC1967Proxy_jsonAbi = void 0;
|
|
4
|
-
const viem_1 = require("viem");
|
|
5
|
-
/**
|
|
6
|
-
* ERC1967Proxy_json ABI
|
|
7
|
-
*
|
|
8
|
-
* This ABI is typed using viem's type system for full type safety.
|
|
9
|
-
*/
|
|
10
|
-
exports.ERC1967Proxy_jsonAbi = [
|
|
11
|
-
{
|
|
12
|
-
"inputs": [
|
|
13
|
-
{
|
|
14
|
-
"internalType": "address",
|
|
15
|
-
"name": "_logic",
|
|
16
|
-
"type": "address"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"internalType": "bytes",
|
|
20
|
-
"name": "_data",
|
|
21
|
-
"type": "bytes"
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"stateMutability": "payable",
|
|
25
|
-
"type": "constructor"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"anonymous": false,
|
|
29
|
-
"inputs": [
|
|
30
|
-
{
|
|
31
|
-
"indexed": false,
|
|
32
|
-
"internalType": "address",
|
|
33
|
-
"name": "previousAdmin",
|
|
34
|
-
"type": "address"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"indexed": false,
|
|
38
|
-
"internalType": "address",
|
|
39
|
-
"name": "newAdmin",
|
|
40
|
-
"type": "address"
|
|
41
|
-
}
|
|
42
|
-
],
|
|
43
|
-
"name": "AdminChanged",
|
|
44
|
-
"type": "event"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"anonymous": false,
|
|
48
|
-
"inputs": [
|
|
49
|
-
{
|
|
50
|
-
"indexed": true,
|
|
51
|
-
"internalType": "address",
|
|
52
|
-
"name": "beacon",
|
|
53
|
-
"type": "address"
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
"name": "BeaconUpgraded",
|
|
57
|
-
"type": "event"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"anonymous": false,
|
|
61
|
-
"inputs": [
|
|
62
|
-
{
|
|
63
|
-
"indexed": true,
|
|
64
|
-
"internalType": "address",
|
|
65
|
-
"name": "implementation",
|
|
66
|
-
"type": "address"
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
"name": "Upgraded",
|
|
70
|
-
"type": "event"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
"stateMutability": "payable",
|
|
74
|
-
"type": "fallback"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"stateMutability": "payable",
|
|
78
|
-
"type": "receive"
|
|
79
|
-
}
|
|
80
|
-
];
|
|
81
|
-
/**
|
|
82
|
-
* ERC1967Proxy_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 { ERC1967Proxy_json } from 'ERC1967Proxy_json';
|
|
91
|
-
*
|
|
92
|
-
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
93
|
-
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
94
|
-
*
|
|
95
|
-
* const contract = new ERC1967Proxy_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
|
-
class ERC1967Proxy_json {
|
|
114
|
-
constructor(address, clients) {
|
|
115
|
-
this.contractAddress = address;
|
|
116
|
-
this.publicClient = clients.publicClient;
|
|
117
|
-
this.contract = (0, viem_1.getContract)({
|
|
118
|
-
address,
|
|
119
|
-
abi: exports.ERC1967Proxy_jsonAbi,
|
|
120
|
-
client: {
|
|
121
|
-
public: clients.publicClient,
|
|
122
|
-
wallet: clients.walletClient,
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Get the contract address
|
|
128
|
-
*/
|
|
129
|
-
get address() {
|
|
130
|
-
return this.contractAddress;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Get the underlying viem contract instance
|
|
134
|
-
*/
|
|
135
|
-
getContract() {
|
|
136
|
-
return this.contract;
|
|
137
|
-
}
|
|
138
|
-
// No read functions
|
|
139
|
-
// No write functions
|
|
140
|
-
/**
|
|
141
|
-
* Simulate contract write operations (dry-run without sending transaction)
|
|
142
|
-
*
|
|
143
|
-
* Note: This contract has no write functions, so simulate returns an empty object.
|
|
144
|
-
*/
|
|
145
|
-
get simulate() {
|
|
146
|
-
return {};
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Watch contract events
|
|
150
|
-
*
|
|
151
|
-
* @example
|
|
152
|
-
* // Watch all Transfer events
|
|
153
|
-
* const unwatch = contract.watch.Transfer((event) => {
|
|
154
|
-
* console.log('Transfer:', event);
|
|
155
|
-
* });
|
|
156
|
-
*
|
|
157
|
-
* // Stop watching
|
|
158
|
-
* unwatch();
|
|
159
|
-
*/
|
|
160
|
-
get watch() {
|
|
161
|
-
return {
|
|
162
|
-
/**
|
|
163
|
-
* Watch AdminChanged events
|
|
164
|
-
* @param callback Function to call when event is emitted
|
|
165
|
-
* @param filter Optional filter for indexed parameters
|
|
166
|
-
* @returns Unwatch function to stop listening
|
|
167
|
-
*/
|
|
168
|
-
AdminChanged: (callback) => {
|
|
169
|
-
return this.publicClient.watchContractEvent({
|
|
170
|
-
address: this.contractAddress,
|
|
171
|
-
abi: exports.ERC1967Proxy_jsonAbi,
|
|
172
|
-
eventName: 'AdminChanged',
|
|
173
|
-
onLogs: (logs) => {
|
|
174
|
-
logs.forEach((log) => {
|
|
175
|
-
callback(log.args);
|
|
176
|
-
});
|
|
177
|
-
},
|
|
178
|
-
});
|
|
179
|
-
},
|
|
180
|
-
/**
|
|
181
|
-
* Watch BeaconUpgraded events
|
|
182
|
-
* @param callback Function to call when event is emitted
|
|
183
|
-
* @param filter Optional filter for indexed parameters
|
|
184
|
-
* @returns Unwatch function to stop listening
|
|
185
|
-
*/
|
|
186
|
-
BeaconUpgraded: (callback, filter) => {
|
|
187
|
-
return this.publicClient.watchContractEvent({
|
|
188
|
-
address: this.contractAddress,
|
|
189
|
-
abi: exports.ERC1967Proxy_jsonAbi,
|
|
190
|
-
eventName: 'BeaconUpgraded',
|
|
191
|
-
args: filter,
|
|
192
|
-
onLogs: (logs) => {
|
|
193
|
-
logs.forEach((log) => {
|
|
194
|
-
callback(log.args);
|
|
195
|
-
});
|
|
196
|
-
},
|
|
197
|
-
});
|
|
198
|
-
},
|
|
199
|
-
/**
|
|
200
|
-
* Watch Upgraded events
|
|
201
|
-
* @param callback Function to call when event is emitted
|
|
202
|
-
* @param filter Optional filter for indexed parameters
|
|
203
|
-
* @returns Unwatch function to stop listening
|
|
204
|
-
*/
|
|
205
|
-
Upgraded: (callback, filter) => {
|
|
206
|
-
return this.publicClient.watchContractEvent({
|
|
207
|
-
address: this.contractAddress,
|
|
208
|
-
abi: exports.ERC1967Proxy_jsonAbi,
|
|
209
|
-
eventName: 'Upgraded',
|
|
210
|
-
args: filter,
|
|
211
|
-
onLogs: (logs) => {
|
|
212
|
-
logs.forEach((log) => {
|
|
213
|
-
callback(log.args);
|
|
214
|
-
});
|
|
215
|
-
},
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
exports.ERC1967Proxy_json = ERC1967Proxy_json;
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
|
|
2
|
-
import { getContract } from 'viem';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* ERC1967Proxy_json ABI
|
|
6
|
-
*
|
|
7
|
-
* This ABI is typed using viem's type system for full type safety.
|
|
8
|
-
*/
|
|
9
|
-
export const ERC1967Proxy_jsonAbi = [
|
|
10
|
-
{
|
|
11
|
-
"inputs": [
|
|
12
|
-
{
|
|
13
|
-
"internalType": "address",
|
|
14
|
-
"name": "_logic",
|
|
15
|
-
"type": "address"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"internalType": "bytes",
|
|
19
|
-
"name": "_data",
|
|
20
|
-
"type": "bytes"
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"stateMutability": "payable",
|
|
24
|
-
"type": "constructor"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"anonymous": false,
|
|
28
|
-
"inputs": [
|
|
29
|
-
{
|
|
30
|
-
"indexed": false,
|
|
31
|
-
"internalType": "address",
|
|
32
|
-
"name": "previousAdmin",
|
|
33
|
-
"type": "address"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"indexed": false,
|
|
37
|
-
"internalType": "address",
|
|
38
|
-
"name": "newAdmin",
|
|
39
|
-
"type": "address"
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
"name": "AdminChanged",
|
|
43
|
-
"type": "event"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"anonymous": false,
|
|
47
|
-
"inputs": [
|
|
48
|
-
{
|
|
49
|
-
"indexed": true,
|
|
50
|
-
"internalType": "address",
|
|
51
|
-
"name": "beacon",
|
|
52
|
-
"type": "address"
|
|
53
|
-
}
|
|
54
|
-
],
|
|
55
|
-
"name": "BeaconUpgraded",
|
|
56
|
-
"type": "event"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"anonymous": false,
|
|
60
|
-
"inputs": [
|
|
61
|
-
{
|
|
62
|
-
"indexed": true,
|
|
63
|
-
"internalType": "address",
|
|
64
|
-
"name": "implementation",
|
|
65
|
-
"type": "address"
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
"name": "Upgraded",
|
|
69
|
-
"type": "event"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"stateMutability": "payable",
|
|
73
|
-
"type": "fallback"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"stateMutability": "payable",
|
|
77
|
-
"type": "receive"
|
|
78
|
-
}
|
|
79
|
-
] as const satisfies Abi;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Type-safe ABI for ERC1967Proxy_json
|
|
83
|
-
*/
|
|
84
|
-
export type ERC1967Proxy_jsonAbi = typeof ERC1967Proxy_jsonAbi;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Contract instance type for ERC1967Proxy_json
|
|
88
|
-
*/
|
|
89
|
-
// Use any for contract type to avoid complex viem type issues
|
|
90
|
-
// The runtime behavior is type-safe through viem's ABI typing
|
|
91
|
-
export type ERC1967Proxy_jsonContract = any;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* ERC1967Proxy_json Contract Class
|
|
95
|
-
*
|
|
96
|
-
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```typescript
|
|
100
|
-
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
101
|
-
* import { mainnet } from 'viem/chains';
|
|
102
|
-
* import { ERC1967Proxy_json } from 'ERC1967Proxy_json';
|
|
103
|
-
*
|
|
104
|
-
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
105
|
-
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
106
|
-
*
|
|
107
|
-
* const contract = new ERC1967Proxy_json('0x...', { publicClient, walletClient });
|
|
108
|
-
*
|
|
109
|
-
* // Read functions
|
|
110
|
-
* const result = await contract.balanceOf('0x...');
|
|
111
|
-
*
|
|
112
|
-
* // Write functions
|
|
113
|
-
* const hash = await contract.transfer('0x...', 1000n);
|
|
114
|
-
*
|
|
115
|
-
* // Simulate transactions (dry-run)
|
|
116
|
-
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
117
|
-
* console.log('Gas estimate:', simulation.request.gas);
|
|
118
|
-
*
|
|
119
|
-
* // Watch events
|
|
120
|
-
* const unwatch = contract.watch.Transfer((event) => {
|
|
121
|
-
* console.log('Transfer event:', event);
|
|
122
|
-
* });
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
125
|
-
export class ERC1967Proxy_json {
|
|
126
|
-
private contract: ERC1967Proxy_jsonContract;
|
|
127
|
-
private contractAddress: Address;
|
|
128
|
-
private publicClient: PublicClient;
|
|
129
|
-
|
|
130
|
-
constructor(
|
|
131
|
-
address: Address,
|
|
132
|
-
clients: {
|
|
133
|
-
publicClient: PublicClient;
|
|
134
|
-
walletClient?: WalletClient;
|
|
135
|
-
}
|
|
136
|
-
) {
|
|
137
|
-
this.contractAddress = address;
|
|
138
|
-
this.publicClient = clients.publicClient;
|
|
139
|
-
this.contract = getContract({
|
|
140
|
-
address,
|
|
141
|
-
abi: ERC1967Proxy_jsonAbi,
|
|
142
|
-
client: {
|
|
143
|
-
public: clients.publicClient,
|
|
144
|
-
wallet: clients.walletClient,
|
|
145
|
-
},
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Get the contract address
|
|
151
|
-
*/
|
|
152
|
-
get address(): Address {
|
|
153
|
-
return this.contractAddress;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Get the underlying viem contract instance
|
|
158
|
-
*/
|
|
159
|
-
getContract(): ERC1967Proxy_jsonContract {
|
|
160
|
-
return this.contract;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// No read functions
|
|
164
|
-
|
|
165
|
-
// No write functions
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Simulate contract write operations (dry-run without sending transaction)
|
|
171
|
-
*
|
|
172
|
-
* Note: This contract has no write functions, so simulate returns an empty object.
|
|
173
|
-
*/
|
|
174
|
-
get simulate() {
|
|
175
|
-
return {};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Watch contract events
|
|
180
|
-
*
|
|
181
|
-
* @example
|
|
182
|
-
* // Watch all Transfer events
|
|
183
|
-
* const unwatch = contract.watch.Transfer((event) => {
|
|
184
|
-
* console.log('Transfer:', event);
|
|
185
|
-
* });
|
|
186
|
-
*
|
|
187
|
-
* // Stop watching
|
|
188
|
-
* unwatch();
|
|
189
|
-
*/
|
|
190
|
-
get watch() {
|
|
191
|
-
return {
|
|
192
|
-
/**
|
|
193
|
-
* Watch AdminChanged events
|
|
194
|
-
* @param callback Function to call when event is emitted
|
|
195
|
-
* @param filter Optional filter for indexed parameters
|
|
196
|
-
* @returns Unwatch function to stop listening
|
|
197
|
-
*/
|
|
198
|
-
AdminChanged: (callback: (event: { previousAdmin: `0x${string}`; newAdmin: `0x${string}` }) => void) => {
|
|
199
|
-
return this.publicClient.watchContractEvent({
|
|
200
|
-
address: this.contractAddress,
|
|
201
|
-
abi: ERC1967Proxy_jsonAbi,
|
|
202
|
-
eventName: 'AdminChanged',
|
|
203
|
-
|
|
204
|
-
onLogs: (logs: any[]) => {
|
|
205
|
-
logs.forEach((log: any) => {
|
|
206
|
-
callback(log.args as any);
|
|
207
|
-
});
|
|
208
|
-
},
|
|
209
|
-
}) as () => void;
|
|
210
|
-
},
|
|
211
|
-
/**
|
|
212
|
-
* Watch BeaconUpgraded events
|
|
213
|
-
* @param callback Function to call when event is emitted
|
|
214
|
-
* @param filter Optional filter for indexed parameters
|
|
215
|
-
* @returns Unwatch function to stop listening
|
|
216
|
-
*/
|
|
217
|
-
BeaconUpgraded: (callback: (event: { beacon: `0x${string}` }) => void, filter?: { beacon: `0x${string}` }) => {
|
|
218
|
-
return this.publicClient.watchContractEvent({
|
|
219
|
-
address: this.contractAddress,
|
|
220
|
-
abi: ERC1967Proxy_jsonAbi,
|
|
221
|
-
eventName: 'BeaconUpgraded',
|
|
222
|
-
args: filter,
|
|
223
|
-
onLogs: (logs: any[]) => {
|
|
224
|
-
logs.forEach((log: any) => {
|
|
225
|
-
callback(log.args as any);
|
|
226
|
-
});
|
|
227
|
-
},
|
|
228
|
-
}) as () => void;
|
|
229
|
-
},
|
|
230
|
-
/**
|
|
231
|
-
* Watch Upgraded events
|
|
232
|
-
* @param callback Function to call when event is emitted
|
|
233
|
-
* @param filter Optional filter for indexed parameters
|
|
234
|
-
* @returns Unwatch function to stop listening
|
|
235
|
-
*/
|
|
236
|
-
Upgraded: (callback: (event: { implementation: `0x${string}` }) => void, filter?: { implementation: `0x${string}` }) => {
|
|
237
|
-
return this.publicClient.watchContractEvent({
|
|
238
|
-
address: this.contractAddress,
|
|
239
|
-
abi: ERC1967Proxy_jsonAbi,
|
|
240
|
-
eventName: 'Upgraded',
|
|
241
|
-
args: filter,
|
|
242
|
-
onLogs: (logs: any[]) => {
|
|
243
|
-
logs.forEach((log: any) => {
|
|
244
|
-
callback(log.args as any);
|
|
245
|
-
});
|
|
246
|
-
},
|
|
247
|
-
}) as () => void;
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
}
|