@aastar/core 0.16.8 → 0.16.11
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/abis/PaymasterV4_2.json +1193 -0
- package/dist/abis/SuperPaymaster.json +1 -1
- package/dist/abis/aPNTs.json +1160 -0
- package/dist/abis/abi.config.json +3 -3
- package/dist/abis/index.d.ts +15 -104
- package/dist/abis/index.js +22 -46
- package/dist/actions/account.d.ts +0 -15
- package/dist/actions/account.js +143 -108
- package/dist/actions/aggregator.d.ts +68 -7
- package/dist/actions/aggregator.js +328 -28
- package/dist/actions/dvt.d.ts +33 -5
- package/dist/actions/dvt.js +238 -38
- package/dist/actions/entryPoint.d.ts +3 -63
- package/dist/actions/entryPoint.js +52 -184
- package/dist/actions/factory.d.ts +48 -115
- package/dist/actions/factory.js +638 -438
- package/dist/actions/faucet.d.ts +23 -27
- package/dist/actions/faucet.js +150 -289
- package/dist/actions/index.d.ts +1 -2
- package/dist/actions/index.js +2 -4
- package/dist/actions/paymaster.d.ts +147 -0
- package/dist/actions/paymaster.js +706 -0
- package/dist/actions/paymasterV4.d.ts +26 -95
- package/dist/actions/paymasterV4.js +28 -121
- package/dist/actions/registry.d.ts +116 -165
- package/dist/actions/registry.js +855 -654
- package/dist/actions/reputation.d.ts +74 -52
- package/dist/actions/reputation.js +548 -242
- package/dist/actions/sbt.d.ts +90 -100
- package/dist/actions/sbt.js +801 -518
- package/dist/actions/staking.d.ts +45 -32
- package/dist/actions/staking.js +431 -260
- package/dist/actions/superPaymaster.d.ts +140 -158
- package/dist/actions/superPaymaster.js +965 -631
- package/dist/actions/tokens.d.ts +130 -108
- package/dist/actions/tokens.js +470 -414
- package/dist/actions/validators.d.ts +0 -73
- package/dist/actions/validators.js +0 -94
- package/dist/clients/BaseClient.d.ts +3 -3
- package/dist/clients/BundlerClient.d.ts +55 -0
- package/dist/clients/BundlerClient.js +92 -0
- package/dist/communities.js +2 -2
- package/dist/constants.js +1 -28
- package/dist/contract-addresses.d.ts +5 -14
- package/dist/contract-addresses.js +3 -9
- package/dist/contract-versions.d.ts +138 -0
- package/dist/contract-versions.js +328 -0
- package/dist/contracts.d.ts +6 -24
- package/dist/contracts.js +2 -2
- package/dist/errors/index.d.ts +57 -0
- package/dist/errors/index.js +123 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/requirementChecker.d.ts +35 -1
- package/dist/requirementChecker.js +39 -1
- package/dist/roles.d.ts +50 -61
- package/dist/roles.js +50 -61
- package/dist/validators/index.d.ts +35 -0
- package/dist/validators/index.js +60 -0
- package/package.json +5 -13
package/dist/actions/dvt.js
CHANGED
|
@@ -1,41 +1,241 @@
|
|
|
1
1
|
import { DVTValidatorABI } from '../abis/index.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
async
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
2
|
+
import { validateAddress, validateRequired } from '../validators/index.js';
|
|
3
|
+
import { AAStarError } from '../errors/index.js';
|
|
4
|
+
export const dvtActions = (address) => (client) => ({
|
|
5
|
+
// Proposal Management
|
|
6
|
+
async createSlashProposal({ operator, level, reason, account }) {
|
|
7
|
+
try {
|
|
8
|
+
validateAddress(operator, 'operator');
|
|
9
|
+
validateRequired(reason, 'reason');
|
|
10
|
+
return await client.writeContract({
|
|
11
|
+
address,
|
|
12
|
+
abi: DVTValidatorABI,
|
|
13
|
+
functionName: 'createProposal',
|
|
14
|
+
args: [operator, level, reason],
|
|
15
|
+
account: account,
|
|
16
|
+
chain: client.chain
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
throw AAStarError.fromViemError(error, 'createSlashProposal');
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
async signSlashProposal({ proposalId, signature, account }) {
|
|
24
|
+
try {
|
|
25
|
+
validateRequired(proposalId, 'proposalId');
|
|
26
|
+
validateRequired(signature, 'signature');
|
|
27
|
+
return await client.writeContract({
|
|
28
|
+
address,
|
|
29
|
+
abi: DVTValidatorABI,
|
|
30
|
+
functionName: 'signSlashProposal',
|
|
31
|
+
args: [proposalId, signature],
|
|
32
|
+
account: account,
|
|
33
|
+
chain: client.chain
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
throw AAStarError.fromViemError(error, 'signSlashProposal');
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
async executeSlashWithProof({ proposalId, repUsers, newScores, epoch, proof, account }) {
|
|
41
|
+
try {
|
|
42
|
+
validateRequired(proposalId, 'proposalId');
|
|
43
|
+
validateRequired(repUsers, 'repUsers');
|
|
44
|
+
validateRequired(newScores, 'newScores');
|
|
45
|
+
validateRequired(epoch, 'epoch');
|
|
46
|
+
validateRequired(proof, 'proof');
|
|
47
|
+
return await client.writeContract({
|
|
48
|
+
address,
|
|
49
|
+
abi: DVTValidatorABI,
|
|
50
|
+
functionName: 'executeWithProof',
|
|
51
|
+
args: [proposalId, repUsers, newScores, epoch, proof],
|
|
52
|
+
account: account,
|
|
53
|
+
chain: client.chain
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
throw AAStarError.fromViemError(error, 'executeSlashWithProof');
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
async markProposalExecuted({ id, account }) {
|
|
61
|
+
try {
|
|
62
|
+
validateRequired(id, 'id');
|
|
63
|
+
return await client.writeContract({
|
|
64
|
+
address,
|
|
65
|
+
abi: DVTValidatorABI,
|
|
66
|
+
functionName: 'markProposalExecuted',
|
|
67
|
+
args: [id],
|
|
68
|
+
account: account,
|
|
69
|
+
chain: client.chain
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
throw AAStarError.fromViemError(error, 'markProposalExecuted');
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
async proposals({ proposalId }) {
|
|
77
|
+
try {
|
|
78
|
+
validateRequired(proposalId, 'proposalId');
|
|
79
|
+
const result = await client.readContract({
|
|
80
|
+
address,
|
|
81
|
+
abi: DVTValidatorABI,
|
|
82
|
+
functionName: 'proposals',
|
|
83
|
+
args: [proposalId]
|
|
84
|
+
});
|
|
85
|
+
return {
|
|
86
|
+
operator: result[0],
|
|
87
|
+
slashLevel: Number(result[1]),
|
|
88
|
+
reason: result[2],
|
|
89
|
+
executed: result[3]
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
throw AAStarError.fromViemError(error, 'proposals');
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
async nextProposalId() {
|
|
97
|
+
try {
|
|
98
|
+
return await client.readContract({
|
|
99
|
+
address,
|
|
100
|
+
abi: DVTValidatorABI,
|
|
101
|
+
functionName: 'nextProposalId',
|
|
102
|
+
args: []
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
throw AAStarError.fromViemError(error, 'nextProposalId');
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
// Validator Management
|
|
110
|
+
async isValidator({ user }) {
|
|
111
|
+
try {
|
|
112
|
+
validateAddress(user, 'user');
|
|
113
|
+
return await client.readContract({
|
|
114
|
+
address,
|
|
115
|
+
abi: DVTValidatorABI,
|
|
116
|
+
functionName: 'isValidator',
|
|
117
|
+
args: [user]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
throw AAStarError.fromViemError(error, 'isValidator');
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
async addValidator({ v, account }) {
|
|
125
|
+
try {
|
|
126
|
+
validateAddress(v, 'v');
|
|
127
|
+
return await client.writeContract({
|
|
128
|
+
address,
|
|
129
|
+
abi: DVTValidatorABI,
|
|
130
|
+
functionName: 'addValidator',
|
|
131
|
+
args: [v],
|
|
132
|
+
account: account,
|
|
133
|
+
chain: client.chain
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
throw AAStarError.fromViemError(error, 'addValidator');
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
// BLS Aggregator Integration
|
|
141
|
+
async setBLSAggregator({ aggregator, account }) {
|
|
142
|
+
try {
|
|
143
|
+
validateAddress(aggregator, 'aggregator');
|
|
144
|
+
return await client.writeContract({
|
|
145
|
+
address,
|
|
146
|
+
abi: DVTValidatorABI,
|
|
147
|
+
functionName: 'setBLSAggregator',
|
|
148
|
+
args: [aggregator],
|
|
149
|
+
account: account,
|
|
150
|
+
chain: client.chain
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
throw AAStarError.fromViemError(error, 'setBLSAggregator');
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
async BLS_AGGREGATOR() {
|
|
158
|
+
try {
|
|
159
|
+
return await client.readContract({
|
|
160
|
+
address,
|
|
161
|
+
abi: DVTValidatorABI,
|
|
162
|
+
functionName: 'BLS_AGGREGATOR',
|
|
163
|
+
args: []
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
throw AAStarError.fromViemError(error, 'BLS_AGGREGATOR');
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
async REGISTRY() {
|
|
171
|
+
try {
|
|
172
|
+
return await client.readContract({
|
|
173
|
+
address,
|
|
174
|
+
abi: DVTValidatorABI,
|
|
175
|
+
functionName: 'REGISTRY',
|
|
176
|
+
args: []
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
throw AAStarError.fromViemError(error, 'REGISTRY');
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
// Ownership
|
|
184
|
+
async owner() {
|
|
185
|
+
try {
|
|
186
|
+
return await client.readContract({
|
|
187
|
+
address,
|
|
188
|
+
abi: DVTValidatorABI,
|
|
189
|
+
functionName: 'owner',
|
|
190
|
+
args: []
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
throw AAStarError.fromViemError(error, 'owner');
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
async transferOwnership({ newOwner, account }) {
|
|
198
|
+
try {
|
|
199
|
+
validateAddress(newOwner, 'newOwner');
|
|
200
|
+
return await client.writeContract({
|
|
201
|
+
address,
|
|
202
|
+
abi: DVTValidatorABI,
|
|
203
|
+
functionName: 'transferOwnership',
|
|
204
|
+
args: [newOwner],
|
|
205
|
+
account: account,
|
|
206
|
+
chain: client.chain
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
throw AAStarError.fromViemError(error, 'transferOwnership');
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
async renounceOwnership({ account }) {
|
|
214
|
+
try {
|
|
215
|
+
return await client.writeContract({
|
|
216
|
+
address,
|
|
217
|
+
abi: DVTValidatorABI,
|
|
218
|
+
functionName: 'renounceOwnership',
|
|
219
|
+
args: [],
|
|
220
|
+
account: account,
|
|
221
|
+
chain: client.chain
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
throw AAStarError.fromViemError(error, 'renounceOwnership');
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
async version() {
|
|
229
|
+
try {
|
|
230
|
+
return await client.readContract({
|
|
231
|
+
address,
|
|
232
|
+
abi: DVTValidatorABI,
|
|
233
|
+
functionName: 'version',
|
|
234
|
+
args: []
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
throw AAStarError.fromViemError(error, 'version');
|
|
239
|
+
}
|
|
40
240
|
}
|
|
41
241
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Address, type PublicClient, type WalletClient, type
|
|
1
|
+
import { type Address, type PublicClient, type WalletClient, type Hash, type Account } from 'viem';
|
|
2
2
|
export declare enum EntryPointVersion {
|
|
3
3
|
V06 = "0.6",
|
|
4
4
|
V07 = "0.7"
|
|
@@ -25,66 +25,6 @@ export type EntryPointActions = {
|
|
|
25
25
|
unstakeDelaySec: number;
|
|
26
26
|
withdrawTime: number;
|
|
27
27
|
}>;
|
|
28
|
-
|
|
29
|
-
unstakeDelaySec: number;
|
|
30
|
-
amount: bigint;
|
|
31
|
-
account?: Account | Address;
|
|
32
|
-
}) => Promise<Hash>;
|
|
33
|
-
unlockStake: (args: {
|
|
34
|
-
account?: Account | Address;
|
|
35
|
-
}) => Promise<Hash>;
|
|
36
|
-
withdrawStake: (args: {
|
|
37
|
-
withdrawAddress: Address;
|
|
38
|
-
account?: Account | Address;
|
|
39
|
-
}) => Promise<Hash>;
|
|
40
|
-
withdrawTo: (args: {
|
|
41
|
-
withdrawAddress: Address;
|
|
42
|
-
amount: bigint;
|
|
43
|
-
account?: Account | Address;
|
|
44
|
-
}) => Promise<Hash>;
|
|
45
|
-
handleOps: (args: {
|
|
46
|
-
ops: any[];
|
|
47
|
-
beneficiary: Address;
|
|
48
|
-
account?: Account | Address;
|
|
49
|
-
}) => Promise<Hash>;
|
|
50
|
-
handleAggregatedOps: (args: {
|
|
51
|
-
opsPerAggregator: any[];
|
|
52
|
-
beneficiary: Address;
|
|
53
|
-
account?: Account | Address;
|
|
54
|
-
}) => Promise<Hash>;
|
|
55
|
-
innerHandleOp: (args: {
|
|
56
|
-
callData: Hex;
|
|
57
|
-
opInfo: any;
|
|
58
|
-
context: Hex;
|
|
59
|
-
account?: Account | Address;
|
|
60
|
-
}) => Promise<Hash>;
|
|
61
|
-
delegateAndRevert: (args: {
|
|
62
|
-
target: Address;
|
|
63
|
-
data: Hex;
|
|
64
|
-
account?: Account | Address;
|
|
65
|
-
}) => Promise<void>;
|
|
66
|
-
getUserOpHash: (args: {
|
|
67
|
-
op: any;
|
|
68
|
-
}) => Promise<Hash>;
|
|
69
|
-
getSenderAddress: (args: {
|
|
70
|
-
initCode: Hex;
|
|
71
|
-
}) => Promise<Address>;
|
|
72
|
-
senderCreator: () => Promise<Address>;
|
|
73
|
-
incrementNonce: (args: {
|
|
74
|
-
key: bigint;
|
|
75
|
-
account?: Account | Address;
|
|
76
|
-
}) => Promise<Hash>;
|
|
77
|
-
nonceSequenceNumber: (args: {
|
|
78
|
-
sender: Address;
|
|
79
|
-
key: bigint;
|
|
80
|
-
}) => Promise<bigint>;
|
|
81
|
-
supportsInterface: (args: {
|
|
82
|
-
interfaceId: Hex;
|
|
83
|
-
}) => Promise<boolean>;
|
|
84
|
-
eip712Domain: () => Promise<any>;
|
|
85
|
-
getCurrentUserOpHash: () => Promise<Hash>;
|
|
86
|
-
getDomainSeparatorV4: () => Promise<Hex>;
|
|
87
|
-
getPackedUserOpTypeHash: () => Promise<Hex>;
|
|
88
|
-
version: EntryPointVersion;
|
|
28
|
+
entryPointAddress: Address;
|
|
89
29
|
};
|
|
90
|
-
export declare const entryPointActions: (address: Address
|
|
30
|
+
export declare const entryPointActions: (address: Address) => (client: PublicClient | WalletClient) => EntryPointActions;
|
|
@@ -1,211 +1,79 @@
|
|
|
1
1
|
import { EntryPointABI } from '../abis/index.js';
|
|
2
|
+
import { validateAddress, validateRequired, validateAmount } from '../validators/index.js';
|
|
3
|
+
import { AAStarError } from '../errors/index.js';
|
|
2
4
|
export var EntryPointVersion;
|
|
3
5
|
(function (EntryPointVersion) {
|
|
4
6
|
EntryPointVersion["V06"] = "0.6";
|
|
5
7
|
EntryPointVersion["V07"] = "0.7";
|
|
6
8
|
})(EntryPointVersion || (EntryPointVersion = {}));
|
|
7
|
-
export const entryPointActions = (address
|
|
8
|
-
|
|
9
|
+
export const entryPointActions = (address) => (client) => ({
|
|
10
|
+
entryPointAddress: address,
|
|
9
11
|
async balanceOf({ account }) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
try {
|
|
13
|
+
validateAddress(account, 'account');
|
|
14
|
+
return await client.readContract({
|
|
15
|
+
address,
|
|
16
|
+
abi: EntryPointABI,
|
|
17
|
+
functionName: 'balanceOf',
|
|
18
|
+
args: [account]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
throw AAStarError.fromViemError(error, 'balanceOf');
|
|
23
|
+
}
|
|
17
24
|
},
|
|
18
25
|
async depositTo({ account, amount, txAccount }) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
functionName: 'depositTo',
|
|
24
|
-
args: [account],
|
|
25
|
-
value: amount,
|
|
26
|
-
account: txAccount,
|
|
27
|
-
chain: client.chain
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
async getNonce({ sender, key }) {
|
|
31
|
-
if (version === EntryPointVersion.V06) {
|
|
32
|
-
// v0.6: getNonce(address, uint192)
|
|
33
|
-
return client.readContract({
|
|
26
|
+
try {
|
|
27
|
+
validateAddress(account, 'account');
|
|
28
|
+
validateAmount(amount, 'amount');
|
|
29
|
+
return await client.writeContract({
|
|
34
30
|
address,
|
|
35
|
-
abi:
|
|
36
|
-
functionName: '
|
|
37
|
-
args: [
|
|
31
|
+
abi: EntryPointABI,
|
|
32
|
+
functionName: 'depositTo',
|
|
33
|
+
args: [account],
|
|
34
|
+
value: amount,
|
|
35
|
+
account: txAccount,
|
|
36
|
+
chain: client.chain
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
catch (error) {
|
|
40
|
+
throw AAStarError.fromViemError(error, 'depositTo');
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
async getNonce({ sender, key }) {
|
|
44
|
+
try {
|
|
45
|
+
validateAddress(sender, 'sender');
|
|
46
|
+
validateRequired(key, 'key');
|
|
47
|
+
return await client.readContract({
|
|
43
48
|
address,
|
|
44
|
-
abi:
|
|
49
|
+
abi: EntryPointABI,
|
|
45
50
|
functionName: 'getNonce',
|
|
46
51
|
args: [sender, key]
|
|
47
52
|
});
|
|
48
53
|
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
throw AAStarError.fromViemError(error, 'getNonce');
|
|
56
|
+
}
|
|
49
57
|
},
|
|
50
58
|
async getDepositInfo({ account }) {
|
|
51
|
-
const result = await client.readContract({
|
|
52
|
-
address,
|
|
53
|
-
abi: [{
|
|
54
|
-
name: 'getDepositInfo',
|
|
55
|
-
type: 'function',
|
|
56
|
-
inputs: [{ type: 'address', name: 'account' }],
|
|
57
|
-
outputs: [
|
|
58
|
-
{ type: 'uint112', name: 'deposit' },
|
|
59
|
-
{ type: 'bool', name: 'staked' },
|
|
60
|
-
{ type: 'uint112', name: 'stake' },
|
|
61
|
-
{ type: 'uint32', name: 'unstakeDelaySec' },
|
|
62
|
-
{ type: 'uint48', name: 'withdrawTime' }
|
|
63
|
-
],
|
|
64
|
-
stateMutability: 'view'
|
|
65
|
-
}],
|
|
66
|
-
functionName: 'getDepositInfo',
|
|
67
|
-
args: [account]
|
|
68
|
-
});
|
|
69
|
-
return {
|
|
70
|
-
deposit: result[0],
|
|
71
|
-
staked: result[1],
|
|
72
|
-
stake: result[2],
|
|
73
|
-
unstakeDelaySec: result[3],
|
|
74
|
-
withdrawTime: result[4]
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
async addStake({ unstakeDelaySec, amount, account }) {
|
|
78
|
-
return client.writeContract({
|
|
79
|
-
address,
|
|
80
|
-
abi: EntryPointABI,
|
|
81
|
-
functionName: 'addStake',
|
|
82
|
-
args: [unstakeDelaySec],
|
|
83
|
-
value: amount,
|
|
84
|
-
account: account,
|
|
85
|
-
chain: client.chain
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
async unlockStake({ account }) {
|
|
89
|
-
return client.writeContract({
|
|
90
|
-
address,
|
|
91
|
-
abi: EntryPointABI,
|
|
92
|
-
functionName: 'unlockStake',
|
|
93
|
-
args: [],
|
|
94
|
-
account: account,
|
|
95
|
-
chain: client.chain
|
|
96
|
-
});
|
|
97
|
-
},
|
|
98
|
-
async withdrawStake({ withdrawAddress, account }) {
|
|
99
|
-
return client.writeContract({
|
|
100
|
-
address,
|
|
101
|
-
abi: EntryPointABI,
|
|
102
|
-
functionName: 'withdrawStake',
|
|
103
|
-
args: [withdrawAddress],
|
|
104
|
-
account: account,
|
|
105
|
-
chain: client.chain
|
|
106
|
-
});
|
|
107
|
-
},
|
|
108
|
-
async withdrawTo({ withdrawAddress, amount, account }) {
|
|
109
|
-
return client.writeContract({
|
|
110
|
-
address,
|
|
111
|
-
abi: EntryPointABI,
|
|
112
|
-
functionName: 'withdrawTo',
|
|
113
|
-
args: [withdrawAddress, amount],
|
|
114
|
-
account: account,
|
|
115
|
-
chain: client.chain
|
|
116
|
-
});
|
|
117
|
-
},
|
|
118
|
-
async handleOps({ ops, beneficiary, account }) {
|
|
119
|
-
return client.writeContract({
|
|
120
|
-
address,
|
|
121
|
-
abi: EntryPointABI,
|
|
122
|
-
functionName: 'handleOps',
|
|
123
|
-
args: [ops, beneficiary],
|
|
124
|
-
account: account,
|
|
125
|
-
chain: client.chain
|
|
126
|
-
});
|
|
127
|
-
},
|
|
128
|
-
async handleAggregatedOps({ opsPerAggregator, beneficiary, account }) {
|
|
129
|
-
return client.writeContract({
|
|
130
|
-
address,
|
|
131
|
-
abi: EntryPointABI,
|
|
132
|
-
functionName: 'handleAggregatedOps',
|
|
133
|
-
args: [opsPerAggregator, beneficiary],
|
|
134
|
-
account: account,
|
|
135
|
-
chain: client.chain
|
|
136
|
-
});
|
|
137
|
-
},
|
|
138
|
-
async innerHandleOp({ callData, opInfo, context, account }) {
|
|
139
|
-
return client.writeContract({
|
|
140
|
-
address,
|
|
141
|
-
abi: EntryPointABI,
|
|
142
|
-
functionName: 'innerHandleOp',
|
|
143
|
-
args: [callData, opInfo, context],
|
|
144
|
-
account: account,
|
|
145
|
-
chain: client.chain
|
|
146
|
-
});
|
|
147
|
-
},
|
|
148
|
-
async delegateAndRevert({ target, data, account }) {
|
|
149
|
-
// This typically reverts, but we act as a writer
|
|
150
|
-
return client.writeContract({
|
|
151
|
-
address,
|
|
152
|
-
abi: EntryPointABI,
|
|
153
|
-
functionName: 'delegateAndRevert',
|
|
154
|
-
args: [target, data],
|
|
155
|
-
account: account,
|
|
156
|
-
chain: client.chain
|
|
157
|
-
});
|
|
158
|
-
},
|
|
159
|
-
async getUserOpHash({ op }) {
|
|
160
|
-
return client.readContract({
|
|
161
|
-
address,
|
|
162
|
-
abi: EntryPointABI,
|
|
163
|
-
functionName: 'getUserOpHash',
|
|
164
|
-
args: [op]
|
|
165
|
-
});
|
|
166
|
-
},
|
|
167
|
-
async getSenderAddress({ initCode }) {
|
|
168
|
-
// getSenderAddress usually reverts with the address. Viem might throw.
|
|
169
|
-
// But let's assume standard call first.
|
|
170
|
-
// Actually in EP v0.7 it might return if called off-chain or revert.
|
|
171
|
-
// We will try readContract.
|
|
172
59
|
try {
|
|
173
|
-
|
|
60
|
+
validateAddress(account, 'account');
|
|
61
|
+
const result = await client.readContract({
|
|
174
62
|
address,
|
|
175
63
|
abi: EntryPointABI,
|
|
176
|
-
functionName: '
|
|
177
|
-
args: [
|
|
64
|
+
functionName: 'getDepositInfo',
|
|
65
|
+
args: [account]
|
|
178
66
|
});
|
|
67
|
+
return {
|
|
68
|
+
deposit: result.deposit,
|
|
69
|
+
staked: result.staked,
|
|
70
|
+
stake: result.stake,
|
|
71
|
+
unstakeDelaySec: result.unstakeDelaySec,
|
|
72
|
+
withdrawTime: result.withdrawTime
|
|
73
|
+
};
|
|
179
74
|
}
|
|
180
|
-
catch (
|
|
181
|
-
|
|
182
|
-
// Usually this method reverts with SenderAddressResult(address)
|
|
183
|
-
throw e;
|
|
75
|
+
catch (error) {
|
|
76
|
+
throw AAStarError.fromViemError(error, 'getDepositInfo');
|
|
184
77
|
}
|
|
185
|
-
},
|
|
186
|
-
async senderCreator() {
|
|
187
|
-
return client.readContract({ address, abi: EntryPointABI, functionName: 'senderCreator', args: [] });
|
|
188
|
-
},
|
|
189
|
-
async incrementNonce({ key, account }) {
|
|
190
|
-
return client.writeContract({ address, abi: EntryPointABI, functionName: 'incrementNonce', args: [key], account: account, chain: client.chain });
|
|
191
|
-
},
|
|
192
|
-
async nonceSequenceNumber({ sender, key }) {
|
|
193
|
-
return client.readContract({ address, abi: EntryPointABI, functionName: 'nonceSequenceNumber', args: [sender, key] });
|
|
194
|
-
},
|
|
195
|
-
async supportsInterface({ interfaceId }) {
|
|
196
|
-
return client.readContract({ address, abi: EntryPointABI, functionName: 'supportsInterface', args: [interfaceId] });
|
|
197
|
-
},
|
|
198
|
-
async eip712Domain() {
|
|
199
|
-
return client.readContract({ address, abi: EntryPointABI, functionName: 'eip712Domain', args: [] });
|
|
200
|
-
},
|
|
201
|
-
async getCurrentUserOpHash() {
|
|
202
|
-
// View that returns 'bytes32'
|
|
203
|
-
return client.readContract({ address, abi: EntryPointABI, functionName: 'getCurrentUserOpHash', args: [] });
|
|
204
|
-
},
|
|
205
|
-
async getDomainSeparatorV4() {
|
|
206
|
-
return client.readContract({ address, abi: EntryPointABI, functionName: 'getDomainSeparatorV4', args: [] });
|
|
207
|
-
},
|
|
208
|
-
async getPackedUserOpTypeHash() {
|
|
209
|
-
return client.readContract({ address, abi: EntryPointABI, functionName: 'getPackedUserOpTypeHash', args: [] });
|
|
210
78
|
}
|
|
211
79
|
});
|