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