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