@1llet.xyz/erc4337-gasless-sdk 0.1.1 → 0.1.4

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/dist/index.d.ts DELETED
@@ -1,330 +0,0 @@
1
- import { Chain, Address, Hex, Hash } from 'viem';
2
-
3
- interface ChainConfig {
4
- chain: Chain;
5
- rpcUrl?: string;
6
- bundlerUrl: string;
7
- entryPointAddress?: Address;
8
- factoryAddress?: Address;
9
- paymasterAddress?: Address;
10
- usdcAddress?: Address;
11
- }
12
- interface UserOperation {
13
- sender: Address;
14
- nonce: bigint;
15
- initCode: Hex;
16
- callData: Hex;
17
- callGasLimit: bigint;
18
- verificationGasLimit: bigint;
19
- preVerificationGas: bigint;
20
- maxFeePerGas: bigint;
21
- maxPriorityFeePerGas: bigint;
22
- paymasterAndData: Hex;
23
- signature: Hex;
24
- }
25
- interface GasEstimate {
26
- callGasLimit: string;
27
- verificationGasLimit: string;
28
- preVerificationGas: string;
29
- maxFeePerGas: string;
30
- maxPriorityFeePerGas: string;
31
- }
32
- interface UserOpReceipt {
33
- userOpHash: Hash;
34
- sender: Address;
35
- success: boolean;
36
- actualGasCost: string;
37
- receipt: {
38
- transactionHash: Hash;
39
- blockNumber: string;
40
- };
41
- }
42
- interface ApprovalSupportResult {
43
- type: "permit" | "approve" | "none";
44
- gasCost?: string;
45
- fundingNeeded?: string;
46
- fundedAmount?: string;
47
- }
48
-
49
- /**
50
- * ERC-4337 Account Abstraction Client
51
- */
52
- declare class AccountAbstraction {
53
- private owner;
54
- private smartAccountAddress;
55
- private chainConfig;
56
- private publicClient;
57
- private entryPointAddress;
58
- private factoryAddress;
59
- private paymasterAddress?;
60
- private usdcAddress;
61
- constructor(chainConfig: ChainConfig);
62
- /**
63
- * Connect to MetaMask and get the owner address
64
- */
65
- connect(): Promise<{
66
- owner: Address;
67
- smartAccount: Address;
68
- }>;
69
- /**
70
- * Get the Smart Account address for an owner (counterfactual)
71
- */
72
- getSmartAccountAddress(owner: Address): Promise<Address>;
73
- /**
74
- * Check if the Smart Account is deployed
75
- */
76
- isAccountDeployed(): Promise<boolean>;
77
- /**
78
- * Get the USDC balance of the Smart Account
79
- */
80
- getUsdcBalance(): Promise<bigint>;
81
- /**
82
- * Get the EOA's USDC balance
83
- */
84
- getEoaUsdcBalance(): Promise<bigint>;
85
- /**
86
- * Get the allowance of the Smart Account to spend the EOA's USDC
87
- */
88
- getAllowance(): Promise<bigint>;
89
- /**
90
- * Get the nonce for the Smart Account
91
- */
92
- getNonce(): Promise<bigint>;
93
- /**
94
- * Build initCode for account deployment
95
- */
96
- buildInitCode(): Hex;
97
- /**
98
- * Estimate gas for a UserOperation
99
- */
100
- estimateGas(userOp: Partial<UserOperation>): Promise<GasEstimate>;
101
- /**
102
- * Build a UserOperation for Batched Execution (e.g. USDC Transfer + Fee)
103
- */
104
- buildUserOperationBatch(transactions: {
105
- target: Address;
106
- value: bigint;
107
- data: Hex;
108
- }[]): Promise<UserOperation>;
109
- /**
110
- * Build a UserOperation to ONLY deploy the account (empty callData)
111
- */
112
- buildDeployUserOperation(): Promise<UserOperation>;
113
- /**
114
- * Calculate the UserOperation hash
115
- */
116
- getUserOpHash(userOp: UserOperation): Hex;
117
- /**
118
- * Sign a UserOperation with MetaMask
119
- */
120
- signUserOperation(userOp: UserOperation): Promise<UserOperation>;
121
- /**
122
- * Send a signed UserOperation to the bundler
123
- */
124
- sendUserOperation(userOp: UserOperation): Promise<Hash>;
125
- /**
126
- * Wait for a UserOperation to be confirmed
127
- */
128
- waitForUserOperation(userOpHash: Hash, timeout?: number): Promise<UserOpReceipt>;
129
- /**
130
- * Request support for token approval (fund if needed)
131
- */
132
- requestApprovalSupport(token: Address, spender: Address, amount: bigint): Promise<ApprovalSupportResult>;
133
- getOwner(): Address | null;
134
- getSmartAccount(): Address | null;
135
- }
136
- declare global {
137
- interface Window {
138
- ethereum?: {
139
- request: (args: {
140
- method: string;
141
- params?: unknown[];
142
- }) => Promise<unknown>;
143
- on: (event: string, callback: (args: unknown) => void) => void;
144
- removeListener: (event: string, callback: (args: unknown) => void) => void;
145
- };
146
- }
147
- }
148
-
149
- declare const DEFAULT_ENTRYPOINT = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
150
- declare const DEFAULT_FACTORY = "0x9406Cc6185a346906296840746125a0E44976454";
151
- declare const factoryAbi: readonly [{
152
- readonly inputs: readonly [{
153
- readonly name: "owner";
154
- readonly type: "address";
155
- }, {
156
- readonly name: "salt";
157
- readonly type: "uint256";
158
- }];
159
- readonly name: "getAccountAddress";
160
- readonly outputs: readonly [{
161
- readonly name: "";
162
- readonly type: "address";
163
- }];
164
- readonly stateMutability: "view";
165
- readonly type: "function";
166
- }, {
167
- readonly inputs: readonly [{
168
- readonly name: "owner";
169
- readonly type: "address";
170
- }, {
171
- readonly name: "salt";
172
- readonly type: "uint256";
173
- }];
174
- readonly name: "isAccountDeployed";
175
- readonly outputs: readonly [{
176
- readonly name: "";
177
- readonly type: "bool";
178
- }];
179
- readonly stateMutability: "view";
180
- readonly type: "function";
181
- }, {
182
- readonly inputs: readonly [{
183
- readonly name: "owner";
184
- readonly type: "address";
185
- }, {
186
- readonly name: "salt";
187
- readonly type: "uint256";
188
- }];
189
- readonly name: "createAccount";
190
- readonly outputs: readonly [{
191
- readonly name: "account";
192
- readonly type: "address";
193
- }];
194
- readonly stateMutability: "nonpayable";
195
- readonly type: "function";
196
- }];
197
- declare const entryPointAbi: readonly [{
198
- readonly inputs: readonly [{
199
- readonly name: "sender";
200
- readonly type: "address";
201
- }, {
202
- readonly name: "key";
203
- readonly type: "uint192";
204
- }];
205
- readonly name: "getNonce";
206
- readonly outputs: readonly [{
207
- readonly name: "nonce";
208
- readonly type: "uint256";
209
- }];
210
- readonly stateMutability: "view";
211
- readonly type: "function";
212
- }];
213
- declare const smartAccountAbi: readonly [{
214
- readonly inputs: readonly [{
215
- readonly name: "target";
216
- readonly type: "address";
217
- }, {
218
- readonly name: "value";
219
- readonly type: "uint256";
220
- }, {
221
- readonly name: "data";
222
- readonly type: "bytes";
223
- }];
224
- readonly name: "execute";
225
- readonly outputs: readonly [];
226
- readonly stateMutability: "nonpayable";
227
- readonly type: "function";
228
- }, {
229
- readonly inputs: readonly [{
230
- readonly name: "targets";
231
- readonly type: "address[]";
232
- }, {
233
- readonly name: "values";
234
- readonly type: "uint256[]";
235
- }, {
236
- readonly name: "datas";
237
- readonly type: "bytes[]";
238
- }];
239
- readonly name: "executeBatch";
240
- readonly outputs: readonly [];
241
- readonly stateMutability: "nonpayable";
242
- readonly type: "function";
243
- }];
244
- declare const erc20Abi: readonly [{
245
- readonly inputs: readonly [{
246
- readonly name: "account";
247
- readonly type: "address";
248
- }];
249
- readonly name: "balanceOf";
250
- readonly outputs: readonly [{
251
- readonly name: "";
252
- readonly type: "uint256";
253
- }];
254
- readonly stateMutability: "view";
255
- readonly type: "function";
256
- }, {
257
- readonly inputs: readonly [{
258
- readonly name: "to";
259
- readonly type: "address";
260
- }, {
261
- readonly name: "amount";
262
- readonly type: "uint256";
263
- }];
264
- readonly name: "transfer";
265
- readonly outputs: readonly [{
266
- readonly name: "";
267
- readonly type: "bool";
268
- }];
269
- readonly stateMutability: "nonpayable";
270
- readonly type: "function";
271
- }, {
272
- readonly inputs: readonly [{
273
- readonly name: "spender";
274
- readonly type: "address";
275
- }, {
276
- readonly name: "amount";
277
- readonly type: "uint256";
278
- }];
279
- readonly name: "approve";
280
- readonly outputs: readonly [{
281
- readonly name: "";
282
- readonly type: "bool";
283
- }];
284
- readonly stateMutability: "nonpayable";
285
- readonly type: "function";
286
- }, {
287
- readonly inputs: readonly [{
288
- readonly name: "owner";
289
- readonly type: "address";
290
- }, {
291
- readonly name: "spender";
292
- readonly type: "address";
293
- }];
294
- readonly name: "allowance";
295
- readonly outputs: readonly [{
296
- readonly name: "";
297
- readonly type: "uint256";
298
- }];
299
- readonly stateMutability: "view";
300
- readonly type: "function";
301
- }, {
302
- readonly inputs: readonly [{
303
- readonly name: "from";
304
- readonly type: "address";
305
- }, {
306
- readonly name: "to";
307
- readonly type: "address";
308
- }, {
309
- readonly name: "amount";
310
- readonly type: "uint256";
311
- }];
312
- readonly name: "transferFrom";
313
- readonly outputs: readonly [{
314
- readonly name: "";
315
- readonly type: "bool";
316
- }];
317
- readonly stateMutability: "nonpayable";
318
- readonly type: "function";
319
- }, {
320
- readonly inputs: readonly [];
321
- readonly name: "decimals";
322
- readonly outputs: readonly [{
323
- readonly name: "";
324
- readonly type: "uint8";
325
- }];
326
- readonly stateMutability: "view";
327
- readonly type: "function";
328
- }];
329
-
330
- export { AccountAbstraction, type ApprovalSupportResult, type ChainConfig, DEFAULT_ENTRYPOINT, DEFAULT_FACTORY, type GasEstimate, type UserOpReceipt, type UserOperation, entryPointAbi, erc20Abi, factoryAbi, smartAccountAbi };