@toruslabs/ethereum-controllers 7.1.0 → 7.1.1
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/ethereumControllers.cjs.js +41 -23
- package/dist/ethereumControllers.esm.js +13 -12
- package/dist/ethereumControllers.umd.min.js +1 -1
- package/dist/lib.cjs/AccountAbstraction/AccountAbstractionController.js +13 -6
- package/dist/lib.cjs/AccountAbstraction/smartAccounts/KernelSmartAccount.js +0 -2
- package/dist/lib.cjs/AccountAbstraction/smartAccounts/SafeSmartAccount.js +0 -2
- package/dist/lib.cjs/AccountAbstraction/smartAccounts/TrustSmartAccount.js +0 -2
- package/dist/lib.esm/AccountAbstraction/AccountAbstractionController.js +13 -6
- package/dist/lib.esm/AccountAbstraction/smartAccounts/KernelSmartAccount.js +0 -2
- package/dist/lib.esm/AccountAbstraction/smartAccounts/SafeSmartAccount.js +0 -2
- package/dist/lib.esm/AccountAbstraction/smartAccounts/TrustSmartAccount.js +0 -2
- package/dist/types/AccountAbstraction/smartAccounts/BiconomySmartAccount.d.ts +1 -3
- package/dist/types/AccountAbstraction/smartAccounts/KernelSmartAccount.d.ts +1 -5
- package/dist/types/AccountAbstraction/smartAccounts/LightSmartAccount.d.ts +1 -3
- package/dist/types/AccountAbstraction/smartAccounts/NexusSmartAccount.d.ts +1 -3
- package/dist/types/AccountAbstraction/smartAccounts/SafeSmartAccount.d.ts +1 -5
- package/dist/types/AccountAbstraction/smartAccounts/SimpleSmartAccount.d.ts +1 -5
- package/dist/types/AccountAbstraction/smartAccounts/TrustSmartAccount.d.ts +1 -5
- package/dist/types/utils/interfaces.d.ts +14 -2
- package/package.json +4 -4
|
@@ -3655,7 +3655,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
3655
3655
|
// UNUSED EXPORTS: setErrorConfig
|
|
3656
3656
|
|
|
3657
3657
|
;// ../../node_modules/viem/_esm/errors/version.js
|
|
3658
|
-
const version = '2.
|
|
3658
|
+
const version = '2.22.8';
|
|
3659
3659
|
//# sourceMappingURL=version.js.map
|
|
3660
3660
|
;// ../../node_modules/viem/_esm/errors/base.js
|
|
3661
3661
|
|
|
@@ -4237,7 +4237,14 @@ class RpcRequestError extends _base_js__WEBPACK_IMPORTED_MODULE_0__/* .BaseError
|
|
|
4237
4237
|
writable: true,
|
|
4238
4238
|
value: void 0
|
|
4239
4239
|
});
|
|
4240
|
+
Object.defineProperty(this, "data", {
|
|
4241
|
+
enumerable: true,
|
|
4242
|
+
configurable: true,
|
|
4243
|
+
writable: true,
|
|
4244
|
+
value: void 0
|
|
4245
|
+
});
|
|
4240
4246
|
this.code = error.code;
|
|
4247
|
+
this.data = error.data;
|
|
4241
4248
|
}
|
|
4242
4249
|
}
|
|
4243
4250
|
class SocketClosedError extends _base_js__WEBPACK_IMPORTED_MODULE_0__/* .BaseError */ .C {
|
|
@@ -9434,7 +9441,7 @@ Object.defineProperty(src_AccountNotDeployedError, "message", {
|
|
|
9434
9441
|
value: /aa20/
|
|
9435
9442
|
});
|
|
9436
9443
|
class src_ExecutionRevertedError extends src_base/* BaseError */.C {
|
|
9437
|
-
constructor({ cause, message, } = {}) {
|
|
9444
|
+
constructor({ cause, data, message, } = {}) {
|
|
9438
9445
|
const reason = message
|
|
9439
9446
|
?.replace('execution reverted: ', '')
|
|
9440
9447
|
?.replace('execution reverted', '');
|
|
@@ -9442,6 +9449,13 @@ class src_ExecutionRevertedError extends src_base/* BaseError */.C {
|
|
|
9442
9449
|
cause,
|
|
9443
9450
|
name: 'ExecutionRevertedError',
|
|
9444
9451
|
});
|
|
9452
|
+
Object.defineProperty(this, "data", {
|
|
9453
|
+
enumerable: true,
|
|
9454
|
+
configurable: true,
|
|
9455
|
+
writable: true,
|
|
9456
|
+
value: void 0
|
|
9457
|
+
});
|
|
9458
|
+
this.data = data;
|
|
9445
9459
|
}
|
|
9446
9460
|
}
|
|
9447
9461
|
Object.defineProperty(src_ExecutionRevertedError, "code", {
|
|
@@ -10211,6 +10225,7 @@ function src_getBundlerError(err, args) {
|
|
|
10211
10225
|
if (error.code === src_ExecutionRevertedError.code)
|
|
10212
10226
|
return new src_ExecutionRevertedError({
|
|
10213
10227
|
cause: err,
|
|
10228
|
+
data: error.data,
|
|
10214
10229
|
message: error.details,
|
|
10215
10230
|
});
|
|
10216
10231
|
if (error.code === src_InvalidFieldsError.code)
|
|
@@ -10271,7 +10286,7 @@ function src_getUserOperationError(err, { calls, docsPath, ...args }) {
|
|
|
10271
10286
|
const cause = src_getBundlerError(err, args);
|
|
10272
10287
|
if (calls && cause instanceof src_ExecutionRevertedError) {
|
|
10273
10288
|
const revertData = src_getRevertData(cause);
|
|
10274
|
-
const contractCalls = calls?.filter((call) => call.abi
|
|
10289
|
+
const contractCalls = calls?.filter((call) => call.abi);
|
|
10275
10290
|
if (revertData && contractCalls.length > 0)
|
|
10276
10291
|
return src_getContractError({ calls: contractCalls, revertData });
|
|
10277
10292
|
}
|
|
@@ -10949,7 +10964,7 @@ async function src_prepareUserOperation(client, parameters_) {
|
|
|
10949
10964
|
if (parameters.calls)
|
|
10950
10965
|
return account.encodeCalls(parameters.calls.map((call_) => {
|
|
10951
10966
|
const call = call_;
|
|
10952
|
-
if (
|
|
10967
|
+
if (call.abi)
|
|
10953
10968
|
return {
|
|
10954
10969
|
data: (0,src_abi_encodeFunctionData/* encodeFunctionData */.p)(call),
|
|
10955
10970
|
to: call.to,
|
|
@@ -11845,6 +11860,7 @@ class src_AccountAbstractionController extends src_base_controllers_namespaceObj
|
|
|
11845
11860
|
throw new Error("Invalid address");
|
|
11846
11861
|
}
|
|
11847
11862
|
const txParams = tx;
|
|
11863
|
+
// @ts-expect-error TODO: viem types are too deep
|
|
11848
11864
|
const userOperationParams = {
|
|
11849
11865
|
account: this.smartAccount,
|
|
11850
11866
|
calls: [{
|
|
@@ -11868,7 +11884,6 @@ class src_AccountAbstractionController extends src_base_controllers_namespaceObj
|
|
|
11868
11884
|
status: src_base_controllers_namespaceObject.TransactionStatus.approved
|
|
11869
11885
|
};
|
|
11870
11886
|
this.updateUserOpMeta(id, userOpMeta);
|
|
11871
|
-
// @ts-expect-error viem types are too deep
|
|
11872
11887
|
const userOpHash = await this.bundlerClient.sendUserOperation(userOperationParams);
|
|
11873
11888
|
this.updateUserOpMeta(id, {
|
|
11874
11889
|
userOpHash,
|
|
@@ -11894,7 +11909,7 @@ class src_AccountAbstractionController extends src_base_controllers_namespaceObj
|
|
|
11894
11909
|
if (address.toLowerCase() !== this.smartAccount.address.toLowerCase()) throw new Error("Invalid address");
|
|
11895
11910
|
const calls = [{
|
|
11896
11911
|
to: txParams.to,
|
|
11897
|
-
value: BigInt(txParams.value),
|
|
11912
|
+
value: txParams.value ? BigInt(txParams.value) : undefined,
|
|
11898
11913
|
data: txParams.data
|
|
11899
11914
|
}];
|
|
11900
11915
|
let maxFeePerGas = txParams.maxFeePerGas ? BigInt(txParams.maxFeePerGas) : undefined;
|
|
@@ -11911,18 +11926,25 @@ class src_AccountAbstractionController extends src_base_controllers_namespaceObj
|
|
|
11911
11926
|
|
|
11912
11927
|
// estimate gas: maxFeePerGas and maxPriorityFeePerGas are required
|
|
11913
11928
|
const estimateGasParams = {
|
|
11929
|
+
account: this.smartAccount,
|
|
11914
11930
|
calls,
|
|
11915
11931
|
maxFeePerGas,
|
|
11916
11932
|
maxPriorityFeePerGas
|
|
11917
11933
|
};
|
|
11918
11934
|
const result = await this.bundlerClient.estimateUserOperationGas(estimateGasParams);
|
|
11919
|
-
|
|
11935
|
+
const gasData = {
|
|
11920
11936
|
callGasLimit: (0,src_external_viem_namespaceObject.toHex)(result.callGasLimit),
|
|
11921
11937
|
preVerificationGas: (0,src_external_viem_namespaceObject.toHex)(result.preVerificationGas),
|
|
11922
|
-
verificationGasLimit: (0,src_external_viem_namespaceObject.toHex)(result.verificationGasLimit)
|
|
11923
|
-
paymasterVerificationGasLimit: (0,src_external_viem_namespaceObject.toHex)(result.paymasterVerificationGasLimit || 0),
|
|
11924
|
-
paymasterPostOpGasLimit: (0,src_external_viem_namespaceObject.toHex)(result.paymasterPostOpGasLimit || 0)
|
|
11938
|
+
verificationGasLimit: (0,src_external_viem_namespaceObject.toHex)(result.verificationGasLimit)
|
|
11925
11939
|
};
|
|
11940
|
+
// NOTE: paymasterVerificationGasLimit and paymasterPostOpGasLimit are optional don't include it in the object otherwise bundler rpc call will throw error (depend on bundler)
|
|
11941
|
+
if (result.paymasterVerificationGasLimit) {
|
|
11942
|
+
gasData.paymasterVerificationGasLimit = (0,src_external_viem_namespaceObject.toHex)(result.paymasterVerificationGasLimit);
|
|
11943
|
+
}
|
|
11944
|
+
if (result.paymasterPostOpGasLimit) {
|
|
11945
|
+
gasData.paymasterPostOpGasLimit = (0,src_external_viem_namespaceObject.toHex)(result.paymasterPostOpGasLimit);
|
|
11946
|
+
}
|
|
11947
|
+
return gasData;
|
|
11926
11948
|
}
|
|
11927
11949
|
async signMessage(message, address) {
|
|
11928
11950
|
if (address.toLowerCase() !== this.smartAccount.address.toLowerCase()) {
|
|
@@ -13664,23 +13686,27 @@ class src_UnknownRpcError extends src_RpcError {
|
|
|
13664
13686
|
|
|
13665
13687
|
|
|
13666
13688
|
|
|
13689
|
+
|
|
13667
13690
|
const src_EXECUTION_REVERTED_ERROR_CODE = 3;
|
|
13668
13691
|
function src_getContractError_getContractError(err, { abi, address, args, docsPath, functionName, sender, }) {
|
|
13669
|
-
const
|
|
13692
|
+
const error = (err instanceof src_contract/* RawContractError */.$S
|
|
13670
13693
|
? err
|
|
13671
13694
|
: err instanceof src_base/* BaseError */.C
|
|
13672
13695
|
? err.walk((err) => 'data' in err) || err.walk()
|
|
13673
13696
|
: {});
|
|
13697
|
+
const { code, data, details, message, shortMessage } = error;
|
|
13674
13698
|
const cause = (() => {
|
|
13675
13699
|
if (err instanceof src_errors_abi/* AbiDecodingZeroDataError */.O)
|
|
13676
13700
|
return new src_contract/* ContractFunctionZeroDataError */.rR({ functionName });
|
|
13677
13701
|
if ([src_EXECUTION_REVERTED_ERROR_CODE, src_InternalRpcError.code].includes(code) &&
|
|
13678
|
-
(data || message || shortMessage)) {
|
|
13702
|
+
(data || details || message || shortMessage)) {
|
|
13679
13703
|
return new src_contract/* ContractFunctionRevertedError */.M({
|
|
13680
13704
|
abi,
|
|
13681
13705
|
data: typeof data === 'object' ? data.data : data,
|
|
13682
13706
|
functionName,
|
|
13683
|
-
message:
|
|
13707
|
+
message: error instanceof src_request/* RpcRequestError */.J8
|
|
13708
|
+
? details
|
|
13709
|
+
: (shortMessage ?? message),
|
|
13684
13710
|
});
|
|
13685
13711
|
}
|
|
13686
13712
|
return err;
|
|
@@ -14406,7 +14432,8 @@ function src_getTypesForEIP712Domain({ domain, }) {
|
|
|
14406
14432
|
return [
|
|
14407
14433
|
typeof domain?.name === 'string' && { name: 'name', type: 'string' },
|
|
14408
14434
|
domain?.version && { name: 'version', type: 'string' },
|
|
14409
|
-
typeof domain?.chainId === 'number'
|
|
14435
|
+
(typeof domain?.chainId === 'number' ||
|
|
14436
|
+
typeof domain?.chainId === 'bigint') && {
|
|
14410
14437
|
name: 'chainId',
|
|
14411
14438
|
type: 'uint256',
|
|
14412
14439
|
},
|
|
@@ -17227,9 +17254,6 @@ async function src_toEcdsaKernelSmartAccount(parameters) {
|
|
|
17227
17254
|
|
|
17228
17255
|
|
|
17229
17256
|
|
|
17230
|
-
|
|
17231
|
-
// use type of function so we don't need to pass in generic to parameter type
|
|
17232
|
-
|
|
17233
17257
|
class src_KernelSmartAccount {
|
|
17234
17258
|
constructor(options) {
|
|
17235
17259
|
src_defineProperty_default()(this, "name", src_SMART_ACCOUNT.KERNEL);
|
|
@@ -18485,9 +18509,6 @@ async function src_toSafeSmartAccount(parameters) {
|
|
|
18485
18509
|
|
|
18486
18510
|
|
|
18487
18511
|
|
|
18488
|
-
|
|
18489
|
-
// use type of function so we don't need to pass in generic to parameter type
|
|
18490
|
-
|
|
18491
18512
|
class src_SafeSmartAccount {
|
|
18492
18513
|
constructor(options) {
|
|
18493
18514
|
src_defineProperty_default()(this, "name", src_SMART_ACCOUNT.SAFE);
|
|
@@ -18757,9 +18778,6 @@ async function src_toTrustSmartAccount(parameters) {
|
|
|
18757
18778
|
|
|
18758
18779
|
|
|
18759
18780
|
|
|
18760
|
-
|
|
18761
|
-
// use type of function so we don't need to pass in generic to parameter type
|
|
18762
|
-
|
|
18763
18781
|
class src_TrustSmartAccount {
|
|
18764
18782
|
constructor(options) {
|
|
18765
18783
|
src_defineProperty_default()(this, "name", src_SMART_ACCOUNT.TRUST);
|
|
@@ -1125,6 +1125,7 @@ class AccountAbstractionController extends BaseController {
|
|
|
1125
1125
|
throw new Error("Invalid address");
|
|
1126
1126
|
}
|
|
1127
1127
|
const txParams = tx;
|
|
1128
|
+
// @ts-expect-error TODO: viem types are too deep
|
|
1128
1129
|
const userOperationParams = {
|
|
1129
1130
|
account: this.smartAccount,
|
|
1130
1131
|
calls: [{
|
|
@@ -1148,7 +1149,6 @@ class AccountAbstractionController extends BaseController {
|
|
|
1148
1149
|
status: TransactionStatus.approved
|
|
1149
1150
|
};
|
|
1150
1151
|
this.updateUserOpMeta(id, userOpMeta);
|
|
1151
|
-
// @ts-expect-error viem types are too deep
|
|
1152
1152
|
const userOpHash = await this.bundlerClient.sendUserOperation(userOperationParams);
|
|
1153
1153
|
this.updateUserOpMeta(id, {
|
|
1154
1154
|
userOpHash,
|
|
@@ -1174,7 +1174,7 @@ class AccountAbstractionController extends BaseController {
|
|
|
1174
1174
|
if (address.toLowerCase() !== this.smartAccount.address.toLowerCase()) throw new Error("Invalid address");
|
|
1175
1175
|
const calls = [{
|
|
1176
1176
|
to: txParams.to,
|
|
1177
|
-
value: BigInt(txParams.value),
|
|
1177
|
+
value: txParams.value ? BigInt(txParams.value) : undefined,
|
|
1178
1178
|
data: txParams.data
|
|
1179
1179
|
}];
|
|
1180
1180
|
let maxFeePerGas = txParams.maxFeePerGas ? BigInt(txParams.maxFeePerGas) : undefined;
|
|
@@ -1191,18 +1191,25 @@ class AccountAbstractionController extends BaseController {
|
|
|
1191
1191
|
|
|
1192
1192
|
// estimate gas: maxFeePerGas and maxPriorityFeePerGas are required
|
|
1193
1193
|
const estimateGasParams = {
|
|
1194
|
+
account: this.smartAccount,
|
|
1194
1195
|
calls,
|
|
1195
1196
|
maxFeePerGas,
|
|
1196
1197
|
maxPriorityFeePerGas
|
|
1197
1198
|
};
|
|
1198
1199
|
const result = await this.bundlerClient.estimateUserOperationGas(estimateGasParams);
|
|
1199
|
-
|
|
1200
|
+
const gasData = {
|
|
1200
1201
|
callGasLimit: toHex(result.callGasLimit),
|
|
1201
1202
|
preVerificationGas: toHex(result.preVerificationGas),
|
|
1202
|
-
verificationGasLimit: toHex(result.verificationGasLimit)
|
|
1203
|
-
paymasterVerificationGasLimit: toHex(result.paymasterVerificationGasLimit || 0),
|
|
1204
|
-
paymasterPostOpGasLimit: toHex(result.paymasterPostOpGasLimit || 0)
|
|
1203
|
+
verificationGasLimit: toHex(result.verificationGasLimit)
|
|
1205
1204
|
};
|
|
1205
|
+
// NOTE: paymasterVerificationGasLimit and paymasterPostOpGasLimit are optional don't include it in the object otherwise bundler rpc call will throw error (depend on bundler)
|
|
1206
|
+
if (result.paymasterVerificationGasLimit) {
|
|
1207
|
+
gasData.paymasterVerificationGasLimit = toHex(result.paymasterVerificationGasLimit);
|
|
1208
|
+
}
|
|
1209
|
+
if (result.paymasterPostOpGasLimit) {
|
|
1210
|
+
gasData.paymasterPostOpGasLimit = toHex(result.paymasterPostOpGasLimit);
|
|
1211
|
+
}
|
|
1212
|
+
return gasData;
|
|
1206
1213
|
}
|
|
1207
1214
|
async signMessage(message, address) {
|
|
1208
1215
|
if (address.toLowerCase() !== this.smartAccount.address.toLowerCase()) {
|
|
@@ -1271,8 +1278,6 @@ class BiconomySmartAccount {
|
|
|
1271
1278
|
}
|
|
1272
1279
|
}
|
|
1273
1280
|
|
|
1274
|
-
// use type of function so we don't need to pass in generic to parameter type
|
|
1275
|
-
|
|
1276
1281
|
class KernelSmartAccount {
|
|
1277
1282
|
constructor(options) {
|
|
1278
1283
|
_defineProperty(this, "name", SMART_ACCOUNT.KERNEL);
|
|
@@ -1308,8 +1313,6 @@ class NexusSmartAccount {
|
|
|
1308
1313
|
}
|
|
1309
1314
|
}
|
|
1310
1315
|
|
|
1311
|
-
// use type of function so we don't need to pass in generic to parameter type
|
|
1312
|
-
|
|
1313
1316
|
class SafeSmartAccount {
|
|
1314
1317
|
constructor(options) {
|
|
1315
1318
|
_defineProperty(this, "name", SMART_ACCOUNT.SAFE);
|
|
@@ -1331,8 +1334,6 @@ class SafeSmartAccount {
|
|
|
1331
1334
|
}
|
|
1332
1335
|
}
|
|
1333
1336
|
|
|
1334
|
-
// use type of function so we don't need to pass in generic to parameter type
|
|
1335
|
-
|
|
1336
1337
|
class TrustSmartAccount {
|
|
1337
1338
|
constructor(options) {
|
|
1338
1339
|
_defineProperty(this, "name", SMART_ACCOUNT.TRUST);
|