@gitmyabi/lockedgoldoracle 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/LockedGoldOracle_json.d.ts +448 -0
- package/contracts/LockedGoldOracle_json.js +454 -0
- package/contracts/LockedGoldOracle_json.ts +602 -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 +43 -0
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
|
|
2
|
+
import { getContract } from 'viem';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* LockedGoldOracle_json ABI
|
|
6
|
+
*
|
|
7
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
8
|
+
*/
|
|
9
|
+
export const LockedGoldOracle_jsonAbi = [
|
|
10
|
+
{
|
|
11
|
+
"anonymous": false,
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"indexed": false,
|
|
15
|
+
"internalType": "uint256",
|
|
16
|
+
"name": "amount",
|
|
17
|
+
"type": "uint256"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"name": "LockEvent",
|
|
21
|
+
"type": "event"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"anonymous": false,
|
|
25
|
+
"inputs": [
|
|
26
|
+
{
|
|
27
|
+
"indexed": true,
|
|
28
|
+
"internalType": "address",
|
|
29
|
+
"name": "previousOwner",
|
|
30
|
+
"type": "address"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"indexed": true,
|
|
34
|
+
"internalType": "address",
|
|
35
|
+
"name": "newOwner",
|
|
36
|
+
"type": "address"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"name": "OwnershipTransferred",
|
|
40
|
+
"type": "event"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"anonymous": false,
|
|
44
|
+
"inputs": [
|
|
45
|
+
{
|
|
46
|
+
"indexed": false,
|
|
47
|
+
"internalType": "uint256",
|
|
48
|
+
"name": "amount",
|
|
49
|
+
"type": "uint256"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"name": "UnlockEvent",
|
|
53
|
+
"type": "event"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"constant": true,
|
|
57
|
+
"inputs": [],
|
|
58
|
+
"name": "cacheContract",
|
|
59
|
+
"outputs": [
|
|
60
|
+
{
|
|
61
|
+
"internalType": "address",
|
|
62
|
+
"name": "",
|
|
63
|
+
"type": "address"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"payable": false,
|
|
67
|
+
"stateMutability": "view",
|
|
68
|
+
"type": "function"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"constant": true,
|
|
72
|
+
"inputs": [],
|
|
73
|
+
"name": "isOwner",
|
|
74
|
+
"outputs": [
|
|
75
|
+
{
|
|
76
|
+
"internalType": "bool",
|
|
77
|
+
"name": "",
|
|
78
|
+
"type": "bool"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"payable": false,
|
|
82
|
+
"stateMutability": "view",
|
|
83
|
+
"type": "function"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"constant": false,
|
|
87
|
+
"inputs": [
|
|
88
|
+
{
|
|
89
|
+
"internalType": "uint256",
|
|
90
|
+
"name": "amountGrams",
|
|
91
|
+
"type": "uint256"
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"name": "lockAmount",
|
|
95
|
+
"outputs": [],
|
|
96
|
+
"payable": false,
|
|
97
|
+
"stateMutability": "nonpayable",
|
|
98
|
+
"type": "function"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"constant": true,
|
|
102
|
+
"inputs": [],
|
|
103
|
+
"name": "lockedGold",
|
|
104
|
+
"outputs": [
|
|
105
|
+
{
|
|
106
|
+
"internalType": "uint256",
|
|
107
|
+
"name": "",
|
|
108
|
+
"type": "uint256"
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
"payable": false,
|
|
112
|
+
"stateMutability": "view",
|
|
113
|
+
"type": "function"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"constant": true,
|
|
117
|
+
"inputs": [],
|
|
118
|
+
"name": "owner",
|
|
119
|
+
"outputs": [
|
|
120
|
+
{
|
|
121
|
+
"internalType": "address",
|
|
122
|
+
"name": "",
|
|
123
|
+
"type": "address"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"payable": false,
|
|
127
|
+
"stateMutability": "view",
|
|
128
|
+
"type": "function"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"constant": false,
|
|
132
|
+
"inputs": [],
|
|
133
|
+
"name": "renounceOwnership",
|
|
134
|
+
"outputs": [],
|
|
135
|
+
"payable": false,
|
|
136
|
+
"stateMutability": "nonpayable",
|
|
137
|
+
"type": "function"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"constant": false,
|
|
141
|
+
"inputs": [
|
|
142
|
+
{
|
|
143
|
+
"internalType": "address",
|
|
144
|
+
"name": "cacheContract",
|
|
145
|
+
"type": "address"
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
"name": "setCacheContract",
|
|
149
|
+
"outputs": [],
|
|
150
|
+
"payable": false,
|
|
151
|
+
"stateMutability": "nonpayable",
|
|
152
|
+
"type": "function"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"constant": false,
|
|
156
|
+
"inputs": [
|
|
157
|
+
{
|
|
158
|
+
"internalType": "address",
|
|
159
|
+
"name": "newOwner",
|
|
160
|
+
"type": "address"
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"name": "transferOwnership",
|
|
164
|
+
"outputs": [],
|
|
165
|
+
"payable": false,
|
|
166
|
+
"stateMutability": "nonpayable",
|
|
167
|
+
"type": "function"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"constant": false,
|
|
171
|
+
"inputs": [
|
|
172
|
+
{
|
|
173
|
+
"internalType": "uint256",
|
|
174
|
+
"name": "amountGrams",
|
|
175
|
+
"type": "uint256"
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"name": "unlockAmount",
|
|
179
|
+
"outputs": [],
|
|
180
|
+
"payable": false,
|
|
181
|
+
"stateMutability": "nonpayable",
|
|
182
|
+
"type": "function"
|
|
183
|
+
}
|
|
184
|
+
] as const satisfies Abi;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Type-safe ABI for LockedGoldOracle_json
|
|
188
|
+
*/
|
|
189
|
+
export type LockedGoldOracle_jsonAbi = typeof LockedGoldOracle_jsonAbi;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Contract instance type for LockedGoldOracle_json
|
|
193
|
+
*/
|
|
194
|
+
// Use any for contract type to avoid complex viem type issues
|
|
195
|
+
// The runtime behavior is type-safe through viem's ABI typing
|
|
196
|
+
export type LockedGoldOracle_jsonContract = any;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* LockedGoldOracle_json Contract Class
|
|
200
|
+
*
|
|
201
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```typescript
|
|
205
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
206
|
+
* import { mainnet } from 'viem/chains';
|
|
207
|
+
* import { LockedGoldOracle_json } from 'LockedGoldOracle_json';
|
|
208
|
+
*
|
|
209
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
210
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
211
|
+
*
|
|
212
|
+
* const contract = new LockedGoldOracle_json('0x...', { publicClient, walletClient });
|
|
213
|
+
*
|
|
214
|
+
* // Read functions
|
|
215
|
+
* const result = await contract.balanceOf('0x...');
|
|
216
|
+
*
|
|
217
|
+
* // Write functions
|
|
218
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
219
|
+
*
|
|
220
|
+
* // Simulate transactions (dry-run)
|
|
221
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
222
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
223
|
+
*
|
|
224
|
+
* // Watch events
|
|
225
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
226
|
+
* console.log('Transfer event:', event);
|
|
227
|
+
* });
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
export class LockedGoldOracle_json {
|
|
231
|
+
private contract: LockedGoldOracle_jsonContract;
|
|
232
|
+
private contractAddress: Address;
|
|
233
|
+
private publicClient: PublicClient;
|
|
234
|
+
|
|
235
|
+
constructor(
|
|
236
|
+
address: Address,
|
|
237
|
+
clients: {
|
|
238
|
+
publicClient: PublicClient;
|
|
239
|
+
walletClient?: WalletClient;
|
|
240
|
+
}
|
|
241
|
+
) {
|
|
242
|
+
this.contractAddress = address;
|
|
243
|
+
this.publicClient = clients.publicClient;
|
|
244
|
+
this.contract = getContract({
|
|
245
|
+
address,
|
|
246
|
+
abi: LockedGoldOracle_jsonAbi,
|
|
247
|
+
client: {
|
|
248
|
+
public: clients.publicClient,
|
|
249
|
+
wallet: clients.walletClient,
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Get the contract address
|
|
256
|
+
*/
|
|
257
|
+
get address(): Address {
|
|
258
|
+
return this.contractAddress;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Get the underlying viem contract instance
|
|
263
|
+
*/
|
|
264
|
+
getContract(): LockedGoldOracle_jsonContract {
|
|
265
|
+
return this.contract;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* cacheContract
|
|
270
|
+
* view
|
|
271
|
+
*/
|
|
272
|
+
async cacheContract(): Promise<`0x${string}`> {
|
|
273
|
+
return this.contract.read.cacheContract() as Promise<`0x${string}`>;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* isOwner
|
|
278
|
+
* view
|
|
279
|
+
*/
|
|
280
|
+
async isOwner(): Promise<boolean> {
|
|
281
|
+
return this.contract.read.isOwner() as Promise<boolean>;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* lockedGold
|
|
286
|
+
* view
|
|
287
|
+
*/
|
|
288
|
+
async lockedGold(): Promise<bigint> {
|
|
289
|
+
return this.contract.read.lockedGold() as Promise<bigint>;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* owner
|
|
294
|
+
* view
|
|
295
|
+
*/
|
|
296
|
+
async owner(): Promise<`0x${string}`> {
|
|
297
|
+
return this.contract.read.owner() as Promise<`0x${string}`>;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* lockAmount
|
|
302
|
+
* nonpayable
|
|
303
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
304
|
+
*/
|
|
305
|
+
async lockAmount(amountGrams: bigint, options?: {
|
|
306
|
+
accessList?: import('viem').AccessList;
|
|
307
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
308
|
+
chain?: import('viem').Chain | null;
|
|
309
|
+
dataSuffix?: `0x${string}`;
|
|
310
|
+
gas?: bigint;
|
|
311
|
+
gasPrice?: bigint;
|
|
312
|
+
maxFeePerGas?: bigint;
|
|
313
|
+
maxPriorityFeePerGas?: bigint;
|
|
314
|
+
nonce?: number;
|
|
315
|
+
value?: bigint;
|
|
316
|
+
}): Promise<`0x${string}`> {
|
|
317
|
+
if (!this.contract.write) {
|
|
318
|
+
throw new Error('Wallet client is required for write operations');
|
|
319
|
+
}
|
|
320
|
+
return this.contract.write.lockAmount([amountGrams] as const, options) as Promise<`0x${string}`>;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* renounceOwnership
|
|
325
|
+
* nonpayable
|
|
326
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
327
|
+
*/
|
|
328
|
+
async renounceOwnership(options?: {
|
|
329
|
+
accessList?: import('viem').AccessList;
|
|
330
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
331
|
+
chain?: import('viem').Chain | null;
|
|
332
|
+
dataSuffix?: `0x${string}`;
|
|
333
|
+
gas?: bigint;
|
|
334
|
+
gasPrice?: bigint;
|
|
335
|
+
maxFeePerGas?: bigint;
|
|
336
|
+
maxPriorityFeePerGas?: bigint;
|
|
337
|
+
nonce?: number;
|
|
338
|
+
value?: bigint;
|
|
339
|
+
}): Promise<`0x${string}`> {
|
|
340
|
+
if (!this.contract.write) {
|
|
341
|
+
throw new Error('Wallet client is required for write operations');
|
|
342
|
+
}
|
|
343
|
+
return this.contract.write.renounceOwnership(options) as Promise<`0x${string}`>;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* setCacheContract
|
|
348
|
+
* nonpayable
|
|
349
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
350
|
+
*/
|
|
351
|
+
async setCacheContract(cacheContract: `0x${string}`, options?: {
|
|
352
|
+
accessList?: import('viem').AccessList;
|
|
353
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
354
|
+
chain?: import('viem').Chain | null;
|
|
355
|
+
dataSuffix?: `0x${string}`;
|
|
356
|
+
gas?: bigint;
|
|
357
|
+
gasPrice?: bigint;
|
|
358
|
+
maxFeePerGas?: bigint;
|
|
359
|
+
maxPriorityFeePerGas?: bigint;
|
|
360
|
+
nonce?: number;
|
|
361
|
+
value?: bigint;
|
|
362
|
+
}): Promise<`0x${string}`> {
|
|
363
|
+
if (!this.contract.write) {
|
|
364
|
+
throw new Error('Wallet client is required for write operations');
|
|
365
|
+
}
|
|
366
|
+
return this.contract.write.setCacheContract([cacheContract] as const, options) as Promise<`0x${string}`>;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* transferOwnership
|
|
371
|
+
* nonpayable
|
|
372
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
373
|
+
*/
|
|
374
|
+
async transferOwnership(newOwner: `0x${string}`, options?: {
|
|
375
|
+
accessList?: import('viem').AccessList;
|
|
376
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
377
|
+
chain?: import('viem').Chain | null;
|
|
378
|
+
dataSuffix?: `0x${string}`;
|
|
379
|
+
gas?: bigint;
|
|
380
|
+
gasPrice?: bigint;
|
|
381
|
+
maxFeePerGas?: bigint;
|
|
382
|
+
maxPriorityFeePerGas?: bigint;
|
|
383
|
+
nonce?: number;
|
|
384
|
+
value?: bigint;
|
|
385
|
+
}): Promise<`0x${string}`> {
|
|
386
|
+
if (!this.contract.write) {
|
|
387
|
+
throw new Error('Wallet client is required for write operations');
|
|
388
|
+
}
|
|
389
|
+
return this.contract.write.transferOwnership([newOwner] as const, options) as Promise<`0x${string}`>;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* unlockAmount
|
|
394
|
+
* nonpayable
|
|
395
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
396
|
+
*/
|
|
397
|
+
async unlockAmount(amountGrams: bigint, options?: {
|
|
398
|
+
accessList?: import('viem').AccessList;
|
|
399
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
400
|
+
chain?: import('viem').Chain | null;
|
|
401
|
+
dataSuffix?: `0x${string}`;
|
|
402
|
+
gas?: bigint;
|
|
403
|
+
gasPrice?: bigint;
|
|
404
|
+
maxFeePerGas?: bigint;
|
|
405
|
+
maxPriorityFeePerGas?: bigint;
|
|
406
|
+
nonce?: number;
|
|
407
|
+
value?: bigint;
|
|
408
|
+
}): Promise<`0x${string}`> {
|
|
409
|
+
if (!this.contract.write) {
|
|
410
|
+
throw new Error('Wallet client is required for write operations');
|
|
411
|
+
}
|
|
412
|
+
return this.contract.write.unlockAmount([amountGrams] as const, options) as Promise<`0x${string}`>;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
422
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
423
|
+
* console.log('Would succeed:', result.result);
|
|
424
|
+
*/
|
|
425
|
+
get simulate() {
|
|
426
|
+
const contract = this.contract;
|
|
427
|
+
if (!contract.simulate) {
|
|
428
|
+
throw new Error('Public client is required for simulation');
|
|
429
|
+
}
|
|
430
|
+
return {
|
|
431
|
+
/**
|
|
432
|
+
* Simulate lockAmount
|
|
433
|
+
* Returns gas estimate and result without sending transaction
|
|
434
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
435
|
+
*/
|
|
436
|
+
async lockAmount(amountGrams: bigint, options?: {
|
|
437
|
+
accessList?: import('viem').AccessList;
|
|
438
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
439
|
+
chain?: import('viem').Chain | null;
|
|
440
|
+
dataSuffix?: `0x${string}`;
|
|
441
|
+
gas?: bigint;
|
|
442
|
+
gasPrice?: bigint;
|
|
443
|
+
maxFeePerGas?: bigint;
|
|
444
|
+
maxPriorityFeePerGas?: bigint;
|
|
445
|
+
nonce?: number;
|
|
446
|
+
value?: bigint;
|
|
447
|
+
}): Promise<void> {
|
|
448
|
+
return contract.simulate.lockAmount([amountGrams] as const, options) as Promise<void>;
|
|
449
|
+
},
|
|
450
|
+
/**
|
|
451
|
+
* Simulate renounceOwnership
|
|
452
|
+
* Returns gas estimate and result without sending transaction
|
|
453
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
454
|
+
*/
|
|
455
|
+
async renounceOwnership(options?: {
|
|
456
|
+
accessList?: import('viem').AccessList;
|
|
457
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
458
|
+
chain?: import('viem').Chain | null;
|
|
459
|
+
dataSuffix?: `0x${string}`;
|
|
460
|
+
gas?: bigint;
|
|
461
|
+
gasPrice?: bigint;
|
|
462
|
+
maxFeePerGas?: bigint;
|
|
463
|
+
maxPriorityFeePerGas?: bigint;
|
|
464
|
+
nonce?: number;
|
|
465
|
+
value?: bigint;
|
|
466
|
+
}): Promise<void> {
|
|
467
|
+
return contract.simulate.renounceOwnership(options) as Promise<void>;
|
|
468
|
+
},
|
|
469
|
+
/**
|
|
470
|
+
* Simulate setCacheContract
|
|
471
|
+
* Returns gas estimate and result without sending transaction
|
|
472
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
473
|
+
*/
|
|
474
|
+
async setCacheContract(cacheContract: `0x${string}`, options?: {
|
|
475
|
+
accessList?: import('viem').AccessList;
|
|
476
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
477
|
+
chain?: import('viem').Chain | null;
|
|
478
|
+
dataSuffix?: `0x${string}`;
|
|
479
|
+
gas?: bigint;
|
|
480
|
+
gasPrice?: bigint;
|
|
481
|
+
maxFeePerGas?: bigint;
|
|
482
|
+
maxPriorityFeePerGas?: bigint;
|
|
483
|
+
nonce?: number;
|
|
484
|
+
value?: bigint;
|
|
485
|
+
}): Promise<void> {
|
|
486
|
+
return contract.simulate.setCacheContract([cacheContract] as const, options) as Promise<void>;
|
|
487
|
+
},
|
|
488
|
+
/**
|
|
489
|
+
* Simulate transferOwnership
|
|
490
|
+
* Returns gas estimate and result without sending transaction
|
|
491
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
492
|
+
*/
|
|
493
|
+
async transferOwnership(newOwner: `0x${string}`, options?: {
|
|
494
|
+
accessList?: import('viem').AccessList;
|
|
495
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
496
|
+
chain?: import('viem').Chain | null;
|
|
497
|
+
dataSuffix?: `0x${string}`;
|
|
498
|
+
gas?: bigint;
|
|
499
|
+
gasPrice?: bigint;
|
|
500
|
+
maxFeePerGas?: bigint;
|
|
501
|
+
maxPriorityFeePerGas?: bigint;
|
|
502
|
+
nonce?: number;
|
|
503
|
+
value?: bigint;
|
|
504
|
+
}): Promise<void> {
|
|
505
|
+
return contract.simulate.transferOwnership([newOwner] as const, options) as Promise<void>;
|
|
506
|
+
},
|
|
507
|
+
/**
|
|
508
|
+
* Simulate unlockAmount
|
|
509
|
+
* Returns gas estimate and result without sending transaction
|
|
510
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
511
|
+
*/
|
|
512
|
+
async unlockAmount(amountGrams: bigint, options?: {
|
|
513
|
+
accessList?: import('viem').AccessList;
|
|
514
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
515
|
+
chain?: import('viem').Chain | null;
|
|
516
|
+
dataSuffix?: `0x${string}`;
|
|
517
|
+
gas?: bigint;
|
|
518
|
+
gasPrice?: bigint;
|
|
519
|
+
maxFeePerGas?: bigint;
|
|
520
|
+
maxPriorityFeePerGas?: bigint;
|
|
521
|
+
nonce?: number;
|
|
522
|
+
value?: bigint;
|
|
523
|
+
}): Promise<void> {
|
|
524
|
+
return contract.simulate.unlockAmount([amountGrams] as const, options) as Promise<void>;
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Watch contract events
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* // Watch all Transfer events
|
|
534
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
535
|
+
* console.log('Transfer:', event);
|
|
536
|
+
* });
|
|
537
|
+
*
|
|
538
|
+
* // Stop watching
|
|
539
|
+
* unwatch();
|
|
540
|
+
*/
|
|
541
|
+
get watch() {
|
|
542
|
+
return {
|
|
543
|
+
/**
|
|
544
|
+
* Watch LockEvent events
|
|
545
|
+
* @param callback Function to call when event is emitted
|
|
546
|
+
* @param filter Optional filter for indexed parameters
|
|
547
|
+
* @returns Unwatch function to stop listening
|
|
548
|
+
*/
|
|
549
|
+
LockEvent: (callback: (event: { amount: bigint }) => void) => {
|
|
550
|
+
return this.publicClient.watchContractEvent({
|
|
551
|
+
address: this.contractAddress,
|
|
552
|
+
abi: LockedGoldOracle_jsonAbi,
|
|
553
|
+
eventName: 'LockEvent',
|
|
554
|
+
|
|
555
|
+
onLogs: (logs: any[]) => {
|
|
556
|
+
logs.forEach((log: any) => {
|
|
557
|
+
callback(log.args as any);
|
|
558
|
+
});
|
|
559
|
+
},
|
|
560
|
+
}) as () => void;
|
|
561
|
+
},
|
|
562
|
+
/**
|
|
563
|
+
* Watch OwnershipTransferred events
|
|
564
|
+
* @param callback Function to call when event is emitted
|
|
565
|
+
* @param filter Optional filter for indexed parameters
|
|
566
|
+
* @returns Unwatch function to stop listening
|
|
567
|
+
*/
|
|
568
|
+
OwnershipTransferred: (callback: (event: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => void, filter?: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => {
|
|
569
|
+
return this.publicClient.watchContractEvent({
|
|
570
|
+
address: this.contractAddress,
|
|
571
|
+
abi: LockedGoldOracle_jsonAbi,
|
|
572
|
+
eventName: 'OwnershipTransferred',
|
|
573
|
+
args: filter,
|
|
574
|
+
onLogs: (logs: any[]) => {
|
|
575
|
+
logs.forEach((log: any) => {
|
|
576
|
+
callback(log.args as any);
|
|
577
|
+
});
|
|
578
|
+
},
|
|
579
|
+
}) as () => void;
|
|
580
|
+
},
|
|
581
|
+
/**
|
|
582
|
+
* Watch UnlockEvent events
|
|
583
|
+
* @param callback Function to call when event is emitted
|
|
584
|
+
* @param filter Optional filter for indexed parameters
|
|
585
|
+
* @returns Unwatch function to stop listening
|
|
586
|
+
*/
|
|
587
|
+
UnlockEvent: (callback: (event: { amount: bigint }) => void) => {
|
|
588
|
+
return this.publicClient.watchContractEvent({
|
|
589
|
+
address: this.contractAddress,
|
|
590
|
+
abi: LockedGoldOracle_jsonAbi,
|
|
591
|
+
eventName: 'UnlockEvent',
|
|
592
|
+
|
|
593
|
+
onLogs: (logs: any[]) => {
|
|
594
|
+
logs.forEach((log: any) => {
|
|
595
|
+
callback(log.args as any);
|
|
596
|
+
});
|
|
597
|
+
},
|
|
598
|
+
}) as () => void;
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LockedGoldOracle_json = exports.LockedGoldOracle_jsonAbi = void 0;
|
|
4
|
+
// Auto-generated exports for all contracts
|
|
5
|
+
var LockedGoldOracle_json_1 = require("./LockedGoldOracle_json");
|
|
6
|
+
Object.defineProperty(exports, "LockedGoldOracle_jsonAbi", { enumerable: true, get: function () { return LockedGoldOracle_json_1.LockedGoldOracle_jsonAbi; } });
|
|
7
|
+
Object.defineProperty(exports, "LockedGoldOracle_json", { enumerable: true, get: function () { return LockedGoldOracle_json_1.LockedGoldOracle_json; } });
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './contracts';
|
package/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Auto-generated TypeScript type bindings
|
|
3
|
+
// This file exports all generated contract types
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
__exportStar(require("./contracts"), exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gitmyabi/lockedgoldoracle",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Auto-generated TypeScript type bindings for LockedGoldOracle (build etherscan-lockedgoldoracle-5b7820e6-1789238735618, commit 8566426, branch etherscan)",
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"types": "./index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./index.js",
|
|
10
|
+
"require": "./index.js",
|
|
11
|
+
"types": "./index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./contracts": {
|
|
14
|
+
"import": "./contracts/index.js",
|
|
15
|
+
"require": "./contracts/index.js",
|
|
16
|
+
"types": "./contracts/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"index.js",
|
|
21
|
+
"index.d.ts",
|
|
22
|
+
"contracts"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"ethereum",
|
|
26
|
+
"smart-contracts",
|
|
27
|
+
"viem",
|
|
28
|
+
"wagmi",
|
|
29
|
+
"typescript",
|
|
30
|
+
"abi",
|
|
31
|
+
"ethers-v6"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"viem": "^2.0.0"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/etherscan/lockedgoldoracle"
|
|
40
|
+
},
|
|
41
|
+
"branch": "etherscan",
|
|
42
|
+
"shortHash": "8566426"
|
|
43
|
+
}
|