viem 2.27.1 → 2.27.2
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/CHANGELOG.md +1 -1
- package/_cjs/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.js.map +1 -1
- package/_cjs/account-abstraction/accounts/implementations/toSoladySmartAccount.js.map +1 -1
- package/_cjs/account-abstraction/accounts/toSmartAccount.js +2 -2
- package/_cjs/account-abstraction/accounts/toSmartAccount.js.map +1 -1
- package/_cjs/account-abstraction/actions/bundler/estimateUserOperationGas.js +1 -7
- package/_cjs/account-abstraction/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_cjs/account-abstraction/actions/bundler/prepareUserOperation.js +1 -21
- package/_cjs/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
- package/_cjs/account-abstraction/actions/bundler/sendUserOperation.js +2 -2
- package/_cjs/account-abstraction/actions/bundler/sendUserOperation.js.map +1 -1
- package/_cjs/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
- package/_cjs/account-abstraction/constants/abis.js +1 -691
- package/_cjs/account-abstraction/constants/abis.js.map +1 -1
- package/_cjs/account-abstraction/constants/address.js +1 -2
- package/_cjs/account-abstraction/constants/address.js.map +1 -1
- package/_cjs/account-abstraction/index.js +2 -6
- package/_cjs/account-abstraction/index.js.map +1 -1
- package/_cjs/account-abstraction/utils/formatters/userOperationRequest.js +0 -19
- package/_cjs/account-abstraction/utils/formatters/userOperationRequest.js.map +1 -1
- package/_cjs/account-abstraction/utils/userOperation/getUserOperationHash.js +0 -70
- package/_cjs/account-abstraction/utils/userOperation/getUserOperationHash.js.map +1 -1
- package/_cjs/constants/address.js +1 -2
- package/_cjs/constants/address.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_esm/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.js.map +1 -1
- package/_esm/account-abstraction/accounts/implementations/toSoladySmartAccount.js.map +1 -1
- package/_esm/account-abstraction/accounts/toSmartAccount.js +2 -2
- package/_esm/account-abstraction/accounts/toSmartAccount.js.map +1 -1
- package/_esm/account-abstraction/actions/bundler/estimateUserOperationGas.js +1 -7
- package/_esm/account-abstraction/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js +1 -21
- package/_esm/account-abstraction/actions/bundler/prepareUserOperation.js.map +1 -1
- package/_esm/account-abstraction/actions/bundler/sendUserOperation.js +2 -2
- package/_esm/account-abstraction/actions/bundler/sendUserOperation.js.map +1 -1
- package/_esm/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
- package/_esm/account-abstraction/constants/abis.js +0 -690
- package/_esm/account-abstraction/constants/abis.js.map +1 -1
- package/_esm/account-abstraction/constants/address.js +0 -1
- package/_esm/account-abstraction/constants/address.js.map +1 -1
- package/_esm/account-abstraction/index.js +2 -3
- package/_esm/account-abstraction/index.js.map +1 -1
- package/_esm/account-abstraction/utils/formatters/userOperationRequest.js +0 -19
- package/_esm/account-abstraction/utils/formatters/userOperationRequest.js.map +1 -1
- package/_esm/account-abstraction/utils/userOperation/getUserOperationHash.js +0 -70
- package/_esm/account-abstraction/utils/userOperation/getUserOperationHash.js.map +1 -1
- package/_esm/constants/address.js +0 -1
- package/_esm/constants/address.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_types/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.d.ts +2 -1
- package/_types/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.d.ts.map +1 -1
- package/_types/account-abstraction/accounts/implementations/toSoladySmartAccount.d.ts +2 -1
- package/_types/account-abstraction/accounts/implementations/toSoladySmartAccount.d.ts.map +1 -1
- package/_types/account-abstraction/accounts/types.d.ts +3 -16
- package/_types/account-abstraction/accounts/types.d.ts.map +1 -1
- package/_types/account-abstraction/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
- package/_types/account-abstraction/actions/bundler/prepareUserOperation.d.ts +6 -23
- package/_types/account-abstraction/actions/bundler/prepareUserOperation.d.ts.map +1 -1
- package/_types/account-abstraction/actions/paymaster/getPaymasterData.d.ts +1 -1
- package/_types/account-abstraction/actions/paymaster/getPaymasterData.d.ts.map +1 -1
- package/_types/account-abstraction/constants/abis.d.ts +0 -830
- package/_types/account-abstraction/constants/abis.d.ts.map +1 -1
- package/_types/account-abstraction/constants/address.d.ts +0 -1
- package/_types/account-abstraction/constants/address.d.ts.map +1 -1
- package/_types/account-abstraction/index.d.ts +2 -3
- package/_types/account-abstraction/index.d.ts.map +1 -1
- package/_types/account-abstraction/types/entryPointVersion.d.ts +1 -1
- package/_types/account-abstraction/types/entryPointVersion.d.ts.map +1 -1
- package/_types/account-abstraction/types/rpc.d.ts +3 -6
- package/_types/account-abstraction/types/rpc.d.ts.map +1 -1
- package/_types/account-abstraction/types/userOperation.d.ts +5 -49
- package/_types/account-abstraction/types/userOperation.d.ts.map +1 -1
- package/_types/account-abstraction/utils/formatters/userOperationRequest.d.ts.map +1 -1
- package/_types/account-abstraction/utils/userOperation/getUserOperationHash.d.ts.map +1 -1
- package/_types/celo/chainConfig.d.ts +14 -14
- package/_types/celo/formatters.d.ts +7 -7
- package/_types/chains/definitions/abstract.d.ts +3 -3
- package/_types/chains/definitions/abstractTestnet.d.ts +3 -3
- package/_types/chains/definitions/celo.d.ts +14 -14
- package/_types/chains/definitions/celoAlfajores.d.ts +14 -14
- package/_types/chains/definitions/playfiAlbireo.d.ts +3 -3
- package/_types/chains/definitions/sophon.d.ts +3 -3
- package/_types/chains/definitions/sophonTestnet.d.ts +3 -3
- package/_types/chains/definitions/treasure.d.ts +3 -3
- package/_types/chains/definitions/treasureTopaz.d.ts +3 -3
- package/_types/chains/definitions/zksync.d.ts +3 -3
- package/_types/chains/definitions/zksyncInMemoryNode.d.ts +3 -3
- package/_types/chains/definitions/zksyncLocalCustomHyperchain.d.ts +3 -3
- package/_types/chains/definitions/zksyncLocalHyperchain.d.ts +3 -3
- package/_types/chains/definitions/zksyncLocalNode.d.ts +3 -3
- package/_types/chains/definitions/zksyncSepoliaTestnet.d.ts +3 -3
- package/_types/constants/address.d.ts +0 -1
- package/_types/constants/address.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/types/authorization.d.ts +1 -1
- package/_types/types/authorization.d.ts.map +1 -1
- package/_types/types/misc.d.ts +7 -7
- package/_types/types/misc.d.ts.map +1 -1
- package/_types/utils/formatters/transaction.d.ts +1 -1
- package/_types/utils/formatters/transactionRequest.d.ts +1 -1
- package/_types/zksync/chainConfig.d.ts +3 -3
- package/_types/zksync/formatters.d.ts +3 -3
- package/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.ts +2 -1
- package/account-abstraction/accounts/implementations/toSoladySmartAccount.ts +2 -1
- package/account-abstraction/accounts/toSmartAccount.ts +2 -2
- package/account-abstraction/accounts/types.ts +2 -26
- package/account-abstraction/actions/bundler/estimateUserOperationGas.ts +1 -8
- package/account-abstraction/actions/bundler/prepareUserOperation.ts +2 -56
- package/account-abstraction/actions/bundler/sendUserOperation.ts +2 -2
- package/account-abstraction/actions/paymaster/getPaymasterData.ts +0 -24
- package/account-abstraction/constants/abis.ts +0 -691
- package/account-abstraction/constants/address.ts +0 -2
- package/account-abstraction/index.ts +1 -12
- package/account-abstraction/types/entryPointVersion.ts +1 -1
- package/account-abstraction/types/rpc.ts +3 -6
- package/account-abstraction/types/userOperation.ts +3 -69
- package/account-abstraction/utils/formatters/userOperationRequest.ts +0 -21
- package/account-abstraction/utils/userOperation/getUserOperationHash.ts +0 -79
- package/constants/address.ts +0 -2
- package/errors/version.ts +1 -1
- package/package.json +1 -1
- package/types/authorization.ts +1 -1
- package/types/misc.ts +7 -7
- package/_cjs/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js +0 -313
- package/_cjs/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js.map +0 -1
- package/_esm/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js +0 -327
- package/_esm/account-abstraction/accounts/implementations/toSimple7702SmartAccount.js.map +0 -1
- package/_types/account-abstraction/accounts/implementations/toSimple7702SmartAccount.d.ts +0 -311
- package/_types/account-abstraction/accounts/implementations/toSimple7702SmartAccount.d.ts.map +0 -1
- package/account-abstraction/accounts/implementations/toSimple7702SmartAccount.ts +0 -382
@@ -1,313 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.toSimple7702SmartAccount = toSimple7702SmartAccount;
|
4
|
-
const address_js_1 = require("../../../constants/address.js");
|
5
|
-
const base_js_1 = require("../../../errors/base.js");
|
6
|
-
const decodeFunctionData_js_1 = require("../../../utils/abi/decodeFunctionData.js");
|
7
|
-
const encodeFunctionData_js_1 = require("../../../utils/abi/encodeFunctionData.js");
|
8
|
-
const index_js_1 = require("../../../utils/index.js");
|
9
|
-
const abis_js_1 = require("../../constants/abis.js");
|
10
|
-
const toSmartAccount_js_1 = require("../toSmartAccount.js");
|
11
|
-
async function toSimple7702SmartAccount(parameters) {
|
12
|
-
const { client, implementation = '0xe6Cae83BdE06E4c305530e199D7217f42808555B', getNonce, owner, } = parameters;
|
13
|
-
const entryPoint = {
|
14
|
-
abi: abis_js_1.entryPoint08Abi,
|
15
|
-
address: address_js_1.entryPoint08Address,
|
16
|
-
version: '0.8',
|
17
|
-
};
|
18
|
-
return (0, toSmartAccount_js_1.toSmartAccount)({
|
19
|
-
authorization: { account: owner, address: implementation },
|
20
|
-
abi,
|
21
|
-
client,
|
22
|
-
extend: { abi, owner },
|
23
|
-
entryPoint,
|
24
|
-
getNonce,
|
25
|
-
async decodeCalls(data) {
|
26
|
-
const result = (0, decodeFunctionData_js_1.decodeFunctionData)({
|
27
|
-
abi,
|
28
|
-
data,
|
29
|
-
});
|
30
|
-
if (result.functionName === 'execute')
|
31
|
-
return [
|
32
|
-
{ to: result.args[0], value: result.args[1], data: result.args[2] },
|
33
|
-
];
|
34
|
-
if (result.functionName === 'executeBatch')
|
35
|
-
return result.args[0].map((arg) => ({
|
36
|
-
to: arg.target,
|
37
|
-
value: arg.value,
|
38
|
-
data: arg.data,
|
39
|
-
}));
|
40
|
-
throw new base_js_1.BaseError(`unable to decode calls for "${result.functionName}"`);
|
41
|
-
},
|
42
|
-
async encodeCalls(calls) {
|
43
|
-
if (calls.length === 1)
|
44
|
-
return (0, encodeFunctionData_js_1.encodeFunctionData)({
|
45
|
-
abi,
|
46
|
-
functionName: 'execute',
|
47
|
-
args: [calls[0].to, calls[0].value ?? 0n, calls[0].data ?? '0x'],
|
48
|
-
});
|
49
|
-
return (0, encodeFunctionData_js_1.encodeFunctionData)({
|
50
|
-
abi,
|
51
|
-
functionName: 'executeBatch',
|
52
|
-
args: [
|
53
|
-
calls.map((call) => ({
|
54
|
-
data: call.data ?? '0x',
|
55
|
-
target: call.to,
|
56
|
-
value: call.value ?? 0n,
|
57
|
-
})),
|
58
|
-
],
|
59
|
-
});
|
60
|
-
},
|
61
|
-
async getAddress() {
|
62
|
-
return owner.address;
|
63
|
-
},
|
64
|
-
async getFactoryArgs() {
|
65
|
-
return { factory: '0x7702', factoryData: '0x' };
|
66
|
-
},
|
67
|
-
async getStubSignature() {
|
68
|
-
return '0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c';
|
69
|
-
},
|
70
|
-
async signMessage(parameters) {
|
71
|
-
const { message } = parameters;
|
72
|
-
return await owner.signMessage({ message });
|
73
|
-
},
|
74
|
-
async signTypedData(parameters) {
|
75
|
-
const { domain, types, primaryType, message } = parameters;
|
76
|
-
return await owner.signTypedData({
|
77
|
-
domain,
|
78
|
-
message,
|
79
|
-
primaryType,
|
80
|
-
types,
|
81
|
-
});
|
82
|
-
},
|
83
|
-
async signUserOperation(parameters) {
|
84
|
-
const { chainId = client.chain.id, ...userOperation } = parameters;
|
85
|
-
const address = await this.getAddress();
|
86
|
-
const isEip7702 = userOperation.factory &&
|
87
|
-
userOperation.factory === '0x7702' &&
|
88
|
-
userOperation.authorization;
|
89
|
-
const delegation = isEip7702
|
90
|
-
? userOperation.authorization?.address
|
91
|
-
: undefined;
|
92
|
-
const initCode = delegation
|
93
|
-
? userOperation.factoryData
|
94
|
-
? (0, index_js_1.encodePacked)(['address', 'bytes'], [delegation, userOperation.factoryData])
|
95
|
-
: (0, index_js_1.encodePacked)(['address'], [delegation])
|
96
|
-
: userOperation.factory && userOperation.factoryData
|
97
|
-
? (0, index_js_1.concat)([userOperation.factory, userOperation.factoryData])
|
98
|
-
: '0x';
|
99
|
-
const accountGasLimits = (0, index_js_1.concat)([
|
100
|
-
(0, index_js_1.pad)((0, index_js_1.numberToHex)(userOperation.verificationGasLimit), { size: 16 }),
|
101
|
-
(0, index_js_1.pad)((0, index_js_1.numberToHex)(userOperation.callGasLimit), { size: 16 }),
|
102
|
-
]);
|
103
|
-
const gasFees = (0, index_js_1.concat)([
|
104
|
-
(0, index_js_1.pad)((0, index_js_1.numberToHex)(userOperation.maxPriorityFeePerGas), { size: 16 }),
|
105
|
-
(0, index_js_1.pad)((0, index_js_1.numberToHex)(userOperation.maxFeePerGas), { size: 16 }),
|
106
|
-
]);
|
107
|
-
const paymasterAndData = userOperation.paymaster
|
108
|
-
? (0, index_js_1.concat)([
|
109
|
-
userOperation.paymaster,
|
110
|
-
(0, index_js_1.pad)((0, index_js_1.numberToHex)(userOperation.paymasterVerificationGasLimit || 0), {
|
111
|
-
size: 16,
|
112
|
-
}),
|
113
|
-
(0, index_js_1.pad)((0, index_js_1.numberToHex)(userOperation.paymasterPostOpGasLimit || 0), {
|
114
|
-
size: 16,
|
115
|
-
}),
|
116
|
-
userOperation.paymasterData || '0x',
|
117
|
-
])
|
118
|
-
: '0x';
|
119
|
-
const signature = await owner.signTypedData({
|
120
|
-
types: {
|
121
|
-
PackedUserOperation: [
|
122
|
-
{ type: 'address', name: 'sender' },
|
123
|
-
{ type: 'uint256', name: 'nonce' },
|
124
|
-
{ type: 'bytes', name: 'initCode' },
|
125
|
-
{ type: 'bytes', name: 'callData' },
|
126
|
-
{ type: 'bytes32', name: 'accountGasLimits' },
|
127
|
-
{ type: 'uint256', name: 'preVerificationGas' },
|
128
|
-
{ type: 'bytes32', name: 'gasFees' },
|
129
|
-
{ type: 'bytes', name: 'paymasterAndData' },
|
130
|
-
],
|
131
|
-
},
|
132
|
-
primaryType: 'PackedUserOperation',
|
133
|
-
domain: {
|
134
|
-
name: 'ERC4337',
|
135
|
-
version: '1',
|
136
|
-
chainId,
|
137
|
-
verifyingContract: entryPoint.address,
|
138
|
-
},
|
139
|
-
message: {
|
140
|
-
sender: address,
|
141
|
-
nonce: userOperation.nonce,
|
142
|
-
initCode,
|
143
|
-
callData: userOperation.callData,
|
144
|
-
accountGasLimits,
|
145
|
-
preVerificationGas: userOperation.preVerificationGas,
|
146
|
-
gasFees,
|
147
|
-
paymasterAndData,
|
148
|
-
},
|
149
|
-
});
|
150
|
-
return signature;
|
151
|
-
},
|
152
|
-
});
|
153
|
-
}
|
154
|
-
const abi = [
|
155
|
-
{ inputs: [], name: 'ECDSAInvalidSignature', type: 'error' },
|
156
|
-
{
|
157
|
-
inputs: [{ internalType: 'uint256', name: 'length', type: 'uint256' }],
|
158
|
-
name: 'ECDSAInvalidSignatureLength',
|
159
|
-
type: 'error',
|
160
|
-
},
|
161
|
-
{
|
162
|
-
inputs: [{ internalType: 'bytes32', name: 's', type: 'bytes32' }],
|
163
|
-
name: 'ECDSAInvalidSignatureS',
|
164
|
-
type: 'error',
|
165
|
-
},
|
166
|
-
{
|
167
|
-
inputs: [
|
168
|
-
{ internalType: 'uint256', name: 'index', type: 'uint256' },
|
169
|
-
{ internalType: 'bytes', name: 'error', type: 'bytes' },
|
170
|
-
],
|
171
|
-
name: 'ExecuteError',
|
172
|
-
type: 'error',
|
173
|
-
},
|
174
|
-
{ stateMutability: 'payable', type: 'fallback' },
|
175
|
-
{
|
176
|
-
inputs: [],
|
177
|
-
name: 'entryPoint',
|
178
|
-
outputs: [
|
179
|
-
{ internalType: 'contract IEntryPoint', name: '', type: 'address' },
|
180
|
-
],
|
181
|
-
stateMutability: 'pure',
|
182
|
-
type: 'function',
|
183
|
-
},
|
184
|
-
{
|
185
|
-
inputs: [
|
186
|
-
{ internalType: 'address', name: 'target', type: 'address' },
|
187
|
-
{ internalType: 'uint256', name: 'value', type: 'uint256' },
|
188
|
-
{ internalType: 'bytes', name: 'data', type: 'bytes' },
|
189
|
-
],
|
190
|
-
name: 'execute',
|
191
|
-
outputs: [],
|
192
|
-
stateMutability: 'nonpayable',
|
193
|
-
type: 'function',
|
194
|
-
},
|
195
|
-
{
|
196
|
-
inputs: [
|
197
|
-
{
|
198
|
-
components: [
|
199
|
-
{ internalType: 'address', name: 'target', type: 'address' },
|
200
|
-
{ internalType: 'uint256', name: 'value', type: 'uint256' },
|
201
|
-
{ internalType: 'bytes', name: 'data', type: 'bytes' },
|
202
|
-
],
|
203
|
-
internalType: 'struct BaseAccount.Call[]',
|
204
|
-
name: 'calls',
|
205
|
-
type: 'tuple[]',
|
206
|
-
},
|
207
|
-
],
|
208
|
-
name: 'executeBatch',
|
209
|
-
outputs: [],
|
210
|
-
stateMutability: 'nonpayable',
|
211
|
-
type: 'function',
|
212
|
-
},
|
213
|
-
{
|
214
|
-
inputs: [],
|
215
|
-
name: 'getNonce',
|
216
|
-
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
217
|
-
stateMutability: 'view',
|
218
|
-
type: 'function',
|
219
|
-
},
|
220
|
-
{
|
221
|
-
inputs: [
|
222
|
-
{ internalType: 'bytes32', name: 'hash', type: 'bytes32' },
|
223
|
-
{ internalType: 'bytes', name: 'signature', type: 'bytes' },
|
224
|
-
],
|
225
|
-
name: 'isValidSignature',
|
226
|
-
outputs: [{ internalType: 'bytes4', name: 'magicValue', type: 'bytes4' }],
|
227
|
-
stateMutability: 'view',
|
228
|
-
type: 'function',
|
229
|
-
},
|
230
|
-
{
|
231
|
-
inputs: [
|
232
|
-
{ internalType: 'address', name: '', type: 'address' },
|
233
|
-
{ internalType: 'address', name: '', type: 'address' },
|
234
|
-
{ internalType: 'uint256[]', name: '', type: 'uint256[]' },
|
235
|
-
{ internalType: 'uint256[]', name: '', type: 'uint256[]' },
|
236
|
-
{ internalType: 'bytes', name: '', type: 'bytes' },
|
237
|
-
],
|
238
|
-
name: 'onERC1155BatchReceived',
|
239
|
-
outputs: [{ internalType: 'bytes4', name: '', type: 'bytes4' }],
|
240
|
-
stateMutability: 'nonpayable',
|
241
|
-
type: 'function',
|
242
|
-
},
|
243
|
-
{
|
244
|
-
inputs: [
|
245
|
-
{ internalType: 'address', name: '', type: 'address' },
|
246
|
-
{ internalType: 'address', name: '', type: 'address' },
|
247
|
-
{ internalType: 'uint256', name: '', type: 'uint256' },
|
248
|
-
{ internalType: 'uint256', name: '', type: 'uint256' },
|
249
|
-
{ internalType: 'bytes', name: '', type: 'bytes' },
|
250
|
-
],
|
251
|
-
name: 'onERC1155Received',
|
252
|
-
outputs: [{ internalType: 'bytes4', name: '', type: 'bytes4' }],
|
253
|
-
stateMutability: 'nonpayable',
|
254
|
-
type: 'function',
|
255
|
-
},
|
256
|
-
{
|
257
|
-
inputs: [
|
258
|
-
{ internalType: 'address', name: '', type: 'address' },
|
259
|
-
{ internalType: 'address', name: '', type: 'address' },
|
260
|
-
{ internalType: 'uint256', name: '', type: 'uint256' },
|
261
|
-
{ internalType: 'bytes', name: '', type: 'bytes' },
|
262
|
-
],
|
263
|
-
name: 'onERC721Received',
|
264
|
-
outputs: [{ internalType: 'bytes4', name: '', type: 'bytes4' }],
|
265
|
-
stateMutability: 'nonpayable',
|
266
|
-
type: 'function',
|
267
|
-
},
|
268
|
-
{
|
269
|
-
inputs: [{ internalType: 'bytes4', name: 'id', type: 'bytes4' }],
|
270
|
-
name: 'supportsInterface',
|
271
|
-
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
|
272
|
-
stateMutability: 'pure',
|
273
|
-
type: 'function',
|
274
|
-
},
|
275
|
-
{
|
276
|
-
inputs: [
|
277
|
-
{
|
278
|
-
components: [
|
279
|
-
{ internalType: 'address', name: 'sender', type: 'address' },
|
280
|
-
{ internalType: 'uint256', name: 'nonce', type: 'uint256' },
|
281
|
-
{ internalType: 'bytes', name: 'initCode', type: 'bytes' },
|
282
|
-
{ internalType: 'bytes', name: 'callData', type: 'bytes' },
|
283
|
-
{
|
284
|
-
internalType: 'bytes32',
|
285
|
-
name: 'accountGasLimits',
|
286
|
-
type: 'bytes32',
|
287
|
-
},
|
288
|
-
{
|
289
|
-
internalType: 'uint256',
|
290
|
-
name: 'preVerificationGas',
|
291
|
-
type: 'uint256',
|
292
|
-
},
|
293
|
-
{ internalType: 'bytes32', name: 'gasFees', type: 'bytes32' },
|
294
|
-
{ internalType: 'bytes', name: 'paymasterAndData', type: 'bytes' },
|
295
|
-
{ internalType: 'bytes', name: 'signature', type: 'bytes' },
|
296
|
-
],
|
297
|
-
internalType: 'struct PackedUserOperation',
|
298
|
-
name: 'userOp',
|
299
|
-
type: 'tuple',
|
300
|
-
},
|
301
|
-
{ internalType: 'bytes32', name: 'userOpHash', type: 'bytes32' },
|
302
|
-
{ internalType: 'uint256', name: 'missingAccountFunds', type: 'uint256' },
|
303
|
-
],
|
304
|
-
name: 'validateUserOp',
|
305
|
-
outputs: [
|
306
|
-
{ internalType: 'uint256', name: 'validationData', type: 'uint256' },
|
307
|
-
],
|
308
|
-
stateMutability: 'nonpayable',
|
309
|
-
type: 'function',
|
310
|
-
},
|
311
|
-
{ stateMutability: 'payable', type: 'receive' },
|
312
|
-
];
|
313
|
-
//# sourceMappingURL=toSimple7702SmartAccount.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"toSimple7702SmartAccount.js","sourceRoot":"","sources":["../../../../account-abstraction/accounts/implementations/toSimple7702SmartAccount.ts"],"names":[],"mappings":";;AA+CA,4DA2KC;AAvND,8DAAmE;AACnE,qDAAmD;AAGnD,oFAA6E;AAC7E,oFAA6E;A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Y,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE;YAChE,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,SAAS,EAAE;SAC1E;QACD,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE;YACP,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE;SACrE;QACD,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;IACD,EAAE,eAAe,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;CACvC,CAAA"}
|
@@ -1,327 +0,0 @@
|
|
1
|
-
import { entryPoint08Address } from '../../../constants/address.js';
|
2
|
-
import { BaseError } from '../../../errors/base.js';
|
3
|
-
import { decodeFunctionData } from '../../../utils/abi/decodeFunctionData.js';
|
4
|
-
import { encodeFunctionData } from '../../../utils/abi/encodeFunctionData.js';
|
5
|
-
import { concat, encodePacked, numberToHex, pad } from '../../../utils/index.js';
|
6
|
-
import { entryPoint08Abi } from '../../constants/abis.js';
|
7
|
-
import { toSmartAccount } from '../toSmartAccount.js';
|
8
|
-
/**
|
9
|
-
* @description Create a Simple7702 Smart Account.
|
10
|
-
*
|
11
|
-
* @param parameters - {@link ToSimple7702SmartAccountParameters}
|
12
|
-
* @returns Simple7702 Smart Account. {@link ToSimple7702SmartAccountReturnType}
|
13
|
-
*
|
14
|
-
* @example
|
15
|
-
* import { toSimple7702SmartAccount } from 'viem/account-abstraction'
|
16
|
-
* import { client } from './client.js'
|
17
|
-
*
|
18
|
-
* const implementation = toSimple7702SmartAccount({
|
19
|
-
* client,
|
20
|
-
* owner: '0x...',
|
21
|
-
* })
|
22
|
-
*/
|
23
|
-
export async function toSimple7702SmartAccount(parameters) {
|
24
|
-
const { client, implementation = '0xe6Cae83BdE06E4c305530e199D7217f42808555B', getNonce, owner, } = parameters;
|
25
|
-
const entryPoint = {
|
26
|
-
abi: entryPoint08Abi,
|
27
|
-
address: entryPoint08Address,
|
28
|
-
version: '0.8',
|
29
|
-
};
|
30
|
-
return toSmartAccount({
|
31
|
-
authorization: { account: owner, address: implementation },
|
32
|
-
abi,
|
33
|
-
client,
|
34
|
-
extend: { abi, owner }, // not removing abi from here as this will be a breaking change
|
35
|
-
entryPoint,
|
36
|
-
getNonce,
|
37
|
-
async decodeCalls(data) {
|
38
|
-
const result = decodeFunctionData({
|
39
|
-
abi,
|
40
|
-
data,
|
41
|
-
});
|
42
|
-
if (result.functionName === 'execute')
|
43
|
-
return [
|
44
|
-
{ to: result.args[0], value: result.args[1], data: result.args[2] },
|
45
|
-
];
|
46
|
-
if (result.functionName === 'executeBatch')
|
47
|
-
return result.args[0].map((arg) => ({
|
48
|
-
to: arg.target,
|
49
|
-
value: arg.value,
|
50
|
-
data: arg.data,
|
51
|
-
}));
|
52
|
-
throw new BaseError(`unable to decode calls for "${result.functionName}"`);
|
53
|
-
},
|
54
|
-
async encodeCalls(calls) {
|
55
|
-
if (calls.length === 1)
|
56
|
-
return encodeFunctionData({
|
57
|
-
abi,
|
58
|
-
functionName: 'execute',
|
59
|
-
args: [calls[0].to, calls[0].value ?? 0n, calls[0].data ?? '0x'],
|
60
|
-
});
|
61
|
-
return encodeFunctionData({
|
62
|
-
abi,
|
63
|
-
functionName: 'executeBatch',
|
64
|
-
args: [
|
65
|
-
calls.map((call) => ({
|
66
|
-
data: call.data ?? '0x',
|
67
|
-
target: call.to,
|
68
|
-
value: call.value ?? 0n,
|
69
|
-
})),
|
70
|
-
],
|
71
|
-
});
|
72
|
-
},
|
73
|
-
async getAddress() {
|
74
|
-
return owner.address;
|
75
|
-
},
|
76
|
-
async getFactoryArgs() {
|
77
|
-
return { factory: '0x7702', factoryData: '0x' };
|
78
|
-
},
|
79
|
-
async getStubSignature() {
|
80
|
-
return '0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c';
|
81
|
-
},
|
82
|
-
async signMessage(parameters) {
|
83
|
-
const { message } = parameters;
|
84
|
-
return await owner.signMessage({ message });
|
85
|
-
},
|
86
|
-
async signTypedData(parameters) {
|
87
|
-
const { domain, types, primaryType, message } = parameters;
|
88
|
-
return await owner.signTypedData({
|
89
|
-
domain,
|
90
|
-
message,
|
91
|
-
primaryType,
|
92
|
-
types,
|
93
|
-
});
|
94
|
-
},
|
95
|
-
async signUserOperation(parameters) {
|
96
|
-
const { chainId = client.chain.id, ...userOperation } = parameters;
|
97
|
-
const address = await this.getAddress();
|
98
|
-
const isEip7702 = userOperation.factory &&
|
99
|
-
userOperation.factory === '0x7702' &&
|
100
|
-
userOperation.authorization;
|
101
|
-
const delegation = isEip7702
|
102
|
-
? userOperation.authorization?.address
|
103
|
-
: undefined;
|
104
|
-
const initCode = delegation
|
105
|
-
? userOperation.factoryData
|
106
|
-
? encodePacked(['address', 'bytes'], [delegation, userOperation.factoryData])
|
107
|
-
: encodePacked(['address'], [delegation])
|
108
|
-
: userOperation.factory && userOperation.factoryData
|
109
|
-
? concat([userOperation.factory, userOperation.factoryData])
|
110
|
-
: '0x';
|
111
|
-
const accountGasLimits = concat([
|
112
|
-
pad(numberToHex(userOperation.verificationGasLimit), { size: 16 }),
|
113
|
-
pad(numberToHex(userOperation.callGasLimit), { size: 16 }),
|
114
|
-
]);
|
115
|
-
const gasFees = concat([
|
116
|
-
pad(numberToHex(userOperation.maxPriorityFeePerGas), { size: 16 }),
|
117
|
-
pad(numberToHex(userOperation.maxFeePerGas), { size: 16 }),
|
118
|
-
]);
|
119
|
-
const paymasterAndData = userOperation.paymaster
|
120
|
-
? concat([
|
121
|
-
userOperation.paymaster,
|
122
|
-
pad(numberToHex(userOperation.paymasterVerificationGasLimit || 0), {
|
123
|
-
size: 16,
|
124
|
-
}),
|
125
|
-
pad(numberToHex(userOperation.paymasterPostOpGasLimit || 0), {
|
126
|
-
size: 16,
|
127
|
-
}),
|
128
|
-
userOperation.paymasterData || '0x',
|
129
|
-
])
|
130
|
-
: '0x';
|
131
|
-
const signature = await owner.signTypedData({
|
132
|
-
types: {
|
133
|
-
PackedUserOperation: [
|
134
|
-
{ type: 'address', name: 'sender' },
|
135
|
-
{ type: 'uint256', name: 'nonce' },
|
136
|
-
{ type: 'bytes', name: 'initCode' },
|
137
|
-
{ type: 'bytes', name: 'callData' },
|
138
|
-
{ type: 'bytes32', name: 'accountGasLimits' },
|
139
|
-
{ type: 'uint256', name: 'preVerificationGas' },
|
140
|
-
{ type: 'bytes32', name: 'gasFees' },
|
141
|
-
{ type: 'bytes', name: 'paymasterAndData' },
|
142
|
-
],
|
143
|
-
},
|
144
|
-
primaryType: 'PackedUserOperation',
|
145
|
-
domain: {
|
146
|
-
name: 'ERC4337',
|
147
|
-
version: '1',
|
148
|
-
chainId,
|
149
|
-
verifyingContract: entryPoint.address,
|
150
|
-
},
|
151
|
-
message: {
|
152
|
-
sender: address,
|
153
|
-
nonce: userOperation.nonce,
|
154
|
-
initCode,
|
155
|
-
callData: userOperation.callData,
|
156
|
-
accountGasLimits,
|
157
|
-
preVerificationGas: userOperation.preVerificationGas,
|
158
|
-
gasFees,
|
159
|
-
paymasterAndData,
|
160
|
-
},
|
161
|
-
});
|
162
|
-
return signature;
|
163
|
-
},
|
164
|
-
});
|
165
|
-
}
|
166
|
-
/////////////////////////////////////////////////////////////////////////////////////////////
|
167
|
-
// Constants
|
168
|
-
const abi = [
|
169
|
-
{ inputs: [], name: 'ECDSAInvalidSignature', type: 'error' },
|
170
|
-
{
|
171
|
-
inputs: [{ internalType: 'uint256', name: 'length', type: 'uint256' }],
|
172
|
-
name: 'ECDSAInvalidSignatureLength',
|
173
|
-
type: 'error',
|
174
|
-
},
|
175
|
-
{
|
176
|
-
inputs: [{ internalType: 'bytes32', name: 's', type: 'bytes32' }],
|
177
|
-
name: 'ECDSAInvalidSignatureS',
|
178
|
-
type: 'error',
|
179
|
-
},
|
180
|
-
{
|
181
|
-
inputs: [
|
182
|
-
{ internalType: 'uint256', name: 'index', type: 'uint256' },
|
183
|
-
{ internalType: 'bytes', name: 'error', type: 'bytes' },
|
184
|
-
],
|
185
|
-
name: 'ExecuteError',
|
186
|
-
type: 'error',
|
187
|
-
},
|
188
|
-
{ stateMutability: 'payable', type: 'fallback' },
|
189
|
-
{
|
190
|
-
inputs: [],
|
191
|
-
name: 'entryPoint',
|
192
|
-
outputs: [
|
193
|
-
{ internalType: 'contract IEntryPoint', name: '', type: 'address' },
|
194
|
-
],
|
195
|
-
stateMutability: 'pure',
|
196
|
-
type: 'function',
|
197
|
-
},
|
198
|
-
{
|
199
|
-
inputs: [
|
200
|
-
{ internalType: 'address', name: 'target', type: 'address' },
|
201
|
-
{ internalType: 'uint256', name: 'value', type: 'uint256' },
|
202
|
-
{ internalType: 'bytes', name: 'data', type: 'bytes' },
|
203
|
-
],
|
204
|
-
name: 'execute',
|
205
|
-
outputs: [],
|
206
|
-
stateMutability: 'nonpayable',
|
207
|
-
type: 'function',
|
208
|
-
},
|
209
|
-
{
|
210
|
-
inputs: [
|
211
|
-
{
|
212
|
-
components: [
|
213
|
-
{ internalType: 'address', name: 'target', type: 'address' },
|
214
|
-
{ internalType: 'uint256', name: 'value', type: 'uint256' },
|
215
|
-
{ internalType: 'bytes', name: 'data', type: 'bytes' },
|
216
|
-
],
|
217
|
-
internalType: 'struct BaseAccount.Call[]',
|
218
|
-
name: 'calls',
|
219
|
-
type: 'tuple[]',
|
220
|
-
},
|
221
|
-
],
|
222
|
-
name: 'executeBatch',
|
223
|
-
outputs: [],
|
224
|
-
stateMutability: 'nonpayable',
|
225
|
-
type: 'function',
|
226
|
-
},
|
227
|
-
{
|
228
|
-
inputs: [],
|
229
|
-
name: 'getNonce',
|
230
|
-
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
231
|
-
stateMutability: 'view',
|
232
|
-
type: 'function',
|
233
|
-
},
|
234
|
-
{
|
235
|
-
inputs: [
|
236
|
-
{ internalType: 'bytes32', name: 'hash', type: 'bytes32' },
|
237
|
-
{ internalType: 'bytes', name: 'signature', type: 'bytes' },
|
238
|
-
],
|
239
|
-
name: 'isValidSignature',
|
240
|
-
outputs: [{ internalType: 'bytes4', name: 'magicValue', type: 'bytes4' }],
|
241
|
-
stateMutability: 'view',
|
242
|
-
type: 'function',
|
243
|
-
},
|
244
|
-
{
|
245
|
-
inputs: [
|
246
|
-
{ internalType: 'address', name: '', type: 'address' },
|
247
|
-
{ internalType: 'address', name: '', type: 'address' },
|
248
|
-
{ internalType: 'uint256[]', name: '', type: 'uint256[]' },
|
249
|
-
{ internalType: 'uint256[]', name: '', type: 'uint256[]' },
|
250
|
-
{ internalType: 'bytes', name: '', type: 'bytes' },
|
251
|
-
],
|
252
|
-
name: 'onERC1155BatchReceived',
|
253
|
-
outputs: [{ internalType: 'bytes4', name: '', type: 'bytes4' }],
|
254
|
-
stateMutability: 'nonpayable',
|
255
|
-
type: 'function',
|
256
|
-
},
|
257
|
-
{
|
258
|
-
inputs: [
|
259
|
-
{ internalType: 'address', name: '', type: 'address' },
|
260
|
-
{ internalType: 'address', name: '', type: 'address' },
|
261
|
-
{ internalType: 'uint256', name: '', type: 'uint256' },
|
262
|
-
{ internalType: 'uint256', name: '', type: 'uint256' },
|
263
|
-
{ internalType: 'bytes', name: '', type: 'bytes' },
|
264
|
-
],
|
265
|
-
name: 'onERC1155Received',
|
266
|
-
outputs: [{ internalType: 'bytes4', name: '', type: 'bytes4' }],
|
267
|
-
stateMutability: 'nonpayable',
|
268
|
-
type: 'function',
|
269
|
-
},
|
270
|
-
{
|
271
|
-
inputs: [
|
272
|
-
{ internalType: 'address', name: '', type: 'address' },
|
273
|
-
{ internalType: 'address', name: '', type: 'address' },
|
274
|
-
{ internalType: 'uint256', name: '', type: 'uint256' },
|
275
|
-
{ internalType: 'bytes', name: '', type: 'bytes' },
|
276
|
-
],
|
277
|
-
name: 'onERC721Received',
|
278
|
-
outputs: [{ internalType: 'bytes4', name: '', type: 'bytes4' }],
|
279
|
-
stateMutability: 'nonpayable',
|
280
|
-
type: 'function',
|
281
|
-
},
|
282
|
-
{
|
283
|
-
inputs: [{ internalType: 'bytes4', name: 'id', type: 'bytes4' }],
|
284
|
-
name: 'supportsInterface',
|
285
|
-
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
|
286
|
-
stateMutability: 'pure',
|
287
|
-
type: 'function',
|
288
|
-
},
|
289
|
-
{
|
290
|
-
inputs: [
|
291
|
-
{
|
292
|
-
components: [
|
293
|
-
{ internalType: 'address', name: 'sender', type: 'address' },
|
294
|
-
{ internalType: 'uint256', name: 'nonce', type: 'uint256' },
|
295
|
-
{ internalType: 'bytes', name: 'initCode', type: 'bytes' },
|
296
|
-
{ internalType: 'bytes', name: 'callData', type: 'bytes' },
|
297
|
-
{
|
298
|
-
internalType: 'bytes32',
|
299
|
-
name: 'accountGasLimits',
|
300
|
-
type: 'bytes32',
|
301
|
-
},
|
302
|
-
{
|
303
|
-
internalType: 'uint256',
|
304
|
-
name: 'preVerificationGas',
|
305
|
-
type: 'uint256',
|
306
|
-
},
|
307
|
-
{ internalType: 'bytes32', name: 'gasFees', type: 'bytes32' },
|
308
|
-
{ internalType: 'bytes', name: 'paymasterAndData', type: 'bytes' },
|
309
|
-
{ internalType: 'bytes', name: 'signature', type: 'bytes' },
|
310
|
-
],
|
311
|
-
internalType: 'struct PackedUserOperation',
|
312
|
-
name: 'userOp',
|
313
|
-
type: 'tuple',
|
314
|
-
},
|
315
|
-
{ internalType: 'bytes32', name: 'userOpHash', type: 'bytes32' },
|
316
|
-
{ internalType: 'uint256', name: 'missingAccountFunds', type: 'uint256' },
|
317
|
-
],
|
318
|
-
name: 'validateUserOp',
|
319
|
-
outputs: [
|
320
|
-
{ internalType: 'uint256', name: 'validationData', type: 'uint256' },
|
321
|
-
],
|
322
|
-
stateMutability: 'nonpayable',
|
323
|
-
type: 'function',
|
324
|
-
},
|
325
|
-
{ stateMutability: 'payable', type: 'receive' },
|
326
|
-
];
|
327
|
-
//# sourceMappingURL=toSimple7702SmartAccount.js.map
|