@toruslabs/ethereum-controllers 7.1.0 → 7.1.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/dist/ethereumControllers.cjs.js +68 -36
- package/dist/ethereumControllers.esm.js +41 -26
- package/dist/ethereumControllers.umd.min.js +1 -1
- package/dist/lib.cjs/AccountAbstraction/AccountAbstractionController.js +40 -19
- 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 +41 -20
- 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
|
@@ -134,6 +134,7 @@ class AccountAbstractionController extends baseControllers.BaseController {
|
|
|
134
134
|
throw new Error("Invalid address");
|
|
135
135
|
}
|
|
136
136
|
const txParams = tx;
|
|
137
|
+
// @ts-expect-error TODO: viem types are too deep
|
|
137
138
|
const userOperationParams = {
|
|
138
139
|
account: this.smartAccount,
|
|
139
140
|
calls: [{
|
|
@@ -157,7 +158,6 @@ class AccountAbstractionController extends baseControllers.BaseController {
|
|
|
157
158
|
status: baseControllers.TransactionStatus.approved
|
|
158
159
|
};
|
|
159
160
|
this.updateUserOpMeta(id, userOpMeta);
|
|
160
|
-
// @ts-expect-error viem types are too deep
|
|
161
161
|
const userOpHash = await this.bundlerClient.sendUserOperation(userOperationParams);
|
|
162
162
|
this.updateUserOpMeta(id, {
|
|
163
163
|
userOpHash,
|
|
@@ -183,35 +183,56 @@ class AccountAbstractionController extends baseControllers.BaseController {
|
|
|
183
183
|
if (address.toLowerCase() !== this.smartAccount.address.toLowerCase()) throw new Error("Invalid address");
|
|
184
184
|
const calls = [{
|
|
185
185
|
to: txParams.to,
|
|
186
|
-
value: BigInt(txParams.value),
|
|
186
|
+
value: txParams.value ? BigInt(txParams.value) : undefined,
|
|
187
187
|
data: txParams.data
|
|
188
188
|
}];
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
if (!maxFeePerGas || !maxPriorityFeePerGas) {
|
|
192
|
-
// if maxFeePerGas and maxPriorityFeePerGas are not provided, prepareUserOperation will estimate them
|
|
193
|
-
const userOp = await this.bundlerClient.prepareUserOperation({
|
|
194
|
-
account: this.smartAccount,
|
|
195
|
-
calls
|
|
196
|
-
});
|
|
197
|
-
maxFeePerGas = userOp === null || userOp === void 0 ? void 0 : userOp.maxFeePerGas;
|
|
198
|
-
maxPriorityFeePerGas = userOp === null || userOp === void 0 ? void 0 : userOp.maxPriorityFeePerGas;
|
|
199
|
-
}
|
|
189
|
+
const maxFeePerGas = txParams.maxFeePerGas ? BigInt(txParams.maxFeePerGas) : undefined;
|
|
190
|
+
const maxPriorityFeePerGas = txParams.maxPriorityFeePerGas ? BigInt(txParams.maxPriorityFeePerGas) : undefined;
|
|
200
191
|
|
|
201
|
-
// estimate gas: maxFeePerGas and maxPriorityFeePerGas are required
|
|
192
|
+
// estimate gas: maxFeePerGas and maxPriorityFeePerGas are not required
|
|
202
193
|
const estimateGasParams = {
|
|
194
|
+
account: this.smartAccount,
|
|
203
195
|
calls,
|
|
204
196
|
maxFeePerGas,
|
|
205
|
-
maxPriorityFeePerGas
|
|
197
|
+
maxPriorityFeePerGas,
|
|
198
|
+
stateOverride: [
|
|
199
|
+
// override state to estimate gas for an ERC-20 transfer without causing a RPC error due to insufficient funds
|
|
200
|
+
// ref: https://docs.cometh.io/connect-4337/bundler/bundler-api/eth_estimateuseroperationgas#optional-state-override-set
|
|
201
|
+
{
|
|
202
|
+
address: this.smartAccount.address,
|
|
203
|
+
balance: viem.parseEther("1")
|
|
204
|
+
}]
|
|
206
205
|
};
|
|
206
|
+
|
|
207
|
+
// bundler only support factoryArgs for estimate user operation gas in entryPoint v0.7
|
|
208
|
+
let factoryArgs;
|
|
209
|
+
if (this.smartAccount.entryPoint.version !== "0.6") {
|
|
210
|
+
factoryArgs = await this.smartAccount.getFactoryArgs(); // will return undefined if smart account already deployed
|
|
211
|
+
}
|
|
212
|
+
if (factoryArgs) {
|
|
213
|
+
// using object spread here will cause type error because of viem's excessively deep types
|
|
214
|
+
// TODO: currently using single property assignment, check again when viem types are updated
|
|
215
|
+
if (factoryArgs.factory) {
|
|
216
|
+
estimateGasParams.factory = factoryArgs.factory;
|
|
217
|
+
}
|
|
218
|
+
if (factoryArgs.factoryData) {
|
|
219
|
+
estimateGasParams.factoryData = factoryArgs.factoryData;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
207
222
|
const result = await this.bundlerClient.estimateUserOperationGas(estimateGasParams);
|
|
208
|
-
|
|
223
|
+
const gasData = {
|
|
209
224
|
callGasLimit: viem.toHex(result.callGasLimit),
|
|
210
225
|
preVerificationGas: viem.toHex(result.preVerificationGas),
|
|
211
|
-
verificationGasLimit: viem.toHex(result.verificationGasLimit)
|
|
212
|
-
paymasterVerificationGasLimit: viem.toHex(result.paymasterVerificationGasLimit || 0),
|
|
213
|
-
paymasterPostOpGasLimit: viem.toHex(result.paymasterPostOpGasLimit || 0)
|
|
226
|
+
verificationGasLimit: viem.toHex(result.verificationGasLimit)
|
|
214
227
|
};
|
|
228
|
+
// NOTE: paymasterVerificationGasLimit and paymasterPostOpGasLimit are optional don't include it in the object otherwise bundler rpc call will throw error (depend on bundler)
|
|
229
|
+
if (result.paymasterVerificationGasLimit) {
|
|
230
|
+
gasData.paymasterVerificationGasLimit = viem.toHex(result.paymasterVerificationGasLimit);
|
|
231
|
+
}
|
|
232
|
+
if (result.paymasterPostOpGasLimit) {
|
|
233
|
+
gasData.paymasterPostOpGasLimit = viem.toHex(result.paymasterPostOpGasLimit);
|
|
234
|
+
}
|
|
235
|
+
return gasData;
|
|
215
236
|
}
|
|
216
237
|
async signMessage(message, address) {
|
|
217
238
|
if (address.toLowerCase() !== this.smartAccount.address.toLowerCase()) {
|
|
@@ -5,8 +5,6 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
5
5
|
var accounts = require('permissionless/accounts');
|
|
6
6
|
var constants = require('../../utils/constants.js');
|
|
7
7
|
|
|
8
|
-
// use type of function so we don't need to pass in generic to parameter type
|
|
9
|
-
|
|
10
8
|
class KernelSmartAccount {
|
|
11
9
|
constructor(options) {
|
|
12
10
|
_defineProperty(this, "name", constants.SMART_ACCOUNT.KERNEL);
|
|
@@ -6,8 +6,6 @@ var accounts = require('permissionless/accounts');
|
|
|
6
6
|
var accountAbstraction = require('viem/account-abstraction');
|
|
7
7
|
var constants = require('../../utils/constants.js');
|
|
8
8
|
|
|
9
|
-
// use type of function so we don't need to pass in generic to parameter type
|
|
10
|
-
|
|
11
9
|
class SafeSmartAccount {
|
|
12
10
|
constructor(options) {
|
|
13
11
|
_defineProperty(this, "name", constants.SMART_ACCOUNT.SAFE);
|
|
@@ -6,8 +6,6 @@ var accounts = require('permissionless/accounts');
|
|
|
6
6
|
var accountAbstraction = require('viem/account-abstraction');
|
|
7
7
|
var constants = require('../../utils/constants.js');
|
|
8
8
|
|
|
9
|
-
// use type of function so we don't need to pass in generic to parameter type
|
|
10
|
-
|
|
11
9
|
class TrustSmartAccount {
|
|
12
10
|
constructor(options) {
|
|
13
11
|
_defineProperty(this, "name", constants.SMART_ACCOUNT.TRUST);
|
|
@@ -5,7 +5,7 @@ import { BaseController, TransactionStatus } from '@toruslabs/base-controllers';
|
|
|
5
5
|
import { JRPCEngine, providerFromEngine } from '@web3auth/auth';
|
|
6
6
|
import { isHexString } from 'ethers';
|
|
7
7
|
import log from 'loglevel';
|
|
8
|
-
import { defineChain, createPublicClient, http, createWalletClient, toHex } from 'viem';
|
|
8
|
+
import { defineChain, createPublicClient, http, createWalletClient, parseEther, toHex } from 'viem';
|
|
9
9
|
import { createPaymasterClient, createBundlerClient } from 'viem/account-abstraction';
|
|
10
10
|
|
|
11
11
|
const eoaInterceptorMiddleware = eoaAddress => (req, res, next, end) => {
|
|
@@ -132,6 +132,7 @@ class AccountAbstractionController extends BaseController {
|
|
|
132
132
|
throw new Error("Invalid address");
|
|
133
133
|
}
|
|
134
134
|
const txParams = tx;
|
|
135
|
+
// @ts-expect-error TODO: viem types are too deep
|
|
135
136
|
const userOperationParams = {
|
|
136
137
|
account: this.smartAccount,
|
|
137
138
|
calls: [{
|
|
@@ -155,7 +156,6 @@ class AccountAbstractionController extends BaseController {
|
|
|
155
156
|
status: TransactionStatus.approved
|
|
156
157
|
};
|
|
157
158
|
this.updateUserOpMeta(id, userOpMeta);
|
|
158
|
-
// @ts-expect-error viem types are too deep
|
|
159
159
|
const userOpHash = await this.bundlerClient.sendUserOperation(userOperationParams);
|
|
160
160
|
this.updateUserOpMeta(id, {
|
|
161
161
|
userOpHash,
|
|
@@ -181,35 +181,56 @@ class AccountAbstractionController extends BaseController {
|
|
|
181
181
|
if (address.toLowerCase() !== this.smartAccount.address.toLowerCase()) throw new Error("Invalid address");
|
|
182
182
|
const calls = [{
|
|
183
183
|
to: txParams.to,
|
|
184
|
-
value: BigInt(txParams.value),
|
|
184
|
+
value: txParams.value ? BigInt(txParams.value) : undefined,
|
|
185
185
|
data: txParams.data
|
|
186
186
|
}];
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
if (!maxFeePerGas || !maxPriorityFeePerGas) {
|
|
190
|
-
// if maxFeePerGas and maxPriorityFeePerGas are not provided, prepareUserOperation will estimate them
|
|
191
|
-
const userOp = await this.bundlerClient.prepareUserOperation({
|
|
192
|
-
account: this.smartAccount,
|
|
193
|
-
calls
|
|
194
|
-
});
|
|
195
|
-
maxFeePerGas = userOp === null || userOp === void 0 ? void 0 : userOp.maxFeePerGas;
|
|
196
|
-
maxPriorityFeePerGas = userOp === null || userOp === void 0 ? void 0 : userOp.maxPriorityFeePerGas;
|
|
197
|
-
}
|
|
187
|
+
const maxFeePerGas = txParams.maxFeePerGas ? BigInt(txParams.maxFeePerGas) : undefined;
|
|
188
|
+
const maxPriorityFeePerGas = txParams.maxPriorityFeePerGas ? BigInt(txParams.maxPriorityFeePerGas) : undefined;
|
|
198
189
|
|
|
199
|
-
// estimate gas: maxFeePerGas and maxPriorityFeePerGas are required
|
|
190
|
+
// estimate gas: maxFeePerGas and maxPriorityFeePerGas are not required
|
|
200
191
|
const estimateGasParams = {
|
|
192
|
+
account: this.smartAccount,
|
|
201
193
|
calls,
|
|
202
194
|
maxFeePerGas,
|
|
203
|
-
maxPriorityFeePerGas
|
|
195
|
+
maxPriorityFeePerGas,
|
|
196
|
+
stateOverride: [
|
|
197
|
+
// override state to estimate gas for an ERC-20 transfer without causing a RPC error due to insufficient funds
|
|
198
|
+
// ref: https://docs.cometh.io/connect-4337/bundler/bundler-api/eth_estimateuseroperationgas#optional-state-override-set
|
|
199
|
+
{
|
|
200
|
+
address: this.smartAccount.address,
|
|
201
|
+
balance: parseEther("1")
|
|
202
|
+
}]
|
|
204
203
|
};
|
|
204
|
+
|
|
205
|
+
// bundler only support factoryArgs for estimate user operation gas in entryPoint v0.7
|
|
206
|
+
let factoryArgs;
|
|
207
|
+
if (this.smartAccount.entryPoint.version !== "0.6") {
|
|
208
|
+
factoryArgs = await this.smartAccount.getFactoryArgs(); // will return undefined if smart account already deployed
|
|
209
|
+
}
|
|
210
|
+
if (factoryArgs) {
|
|
211
|
+
// using object spread here will cause type error because of viem's excessively deep types
|
|
212
|
+
// TODO: currently using single property assignment, check again when viem types are updated
|
|
213
|
+
if (factoryArgs.factory) {
|
|
214
|
+
estimateGasParams.factory = factoryArgs.factory;
|
|
215
|
+
}
|
|
216
|
+
if (factoryArgs.factoryData) {
|
|
217
|
+
estimateGasParams.factoryData = factoryArgs.factoryData;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
205
220
|
const result = await this.bundlerClient.estimateUserOperationGas(estimateGasParams);
|
|
206
|
-
|
|
221
|
+
const gasData = {
|
|
207
222
|
callGasLimit: toHex(result.callGasLimit),
|
|
208
223
|
preVerificationGas: toHex(result.preVerificationGas),
|
|
209
|
-
verificationGasLimit: toHex(result.verificationGasLimit)
|
|
210
|
-
paymasterVerificationGasLimit: toHex(result.paymasterVerificationGasLimit || 0),
|
|
211
|
-
paymasterPostOpGasLimit: toHex(result.paymasterPostOpGasLimit || 0)
|
|
224
|
+
verificationGasLimit: toHex(result.verificationGasLimit)
|
|
212
225
|
};
|
|
226
|
+
// NOTE: paymasterVerificationGasLimit and paymasterPostOpGasLimit are optional don't include it in the object otherwise bundler rpc call will throw error (depend on bundler)
|
|
227
|
+
if (result.paymasterVerificationGasLimit) {
|
|
228
|
+
gasData.paymasterVerificationGasLimit = toHex(result.paymasterVerificationGasLimit);
|
|
229
|
+
}
|
|
230
|
+
if (result.paymasterPostOpGasLimit) {
|
|
231
|
+
gasData.paymasterPostOpGasLimit = toHex(result.paymasterPostOpGasLimit);
|
|
232
|
+
}
|
|
233
|
+
return gasData;
|
|
213
234
|
}
|
|
214
235
|
async signMessage(message, address) {
|
|
215
236
|
if (address.toLowerCase() !== this.smartAccount.address.toLowerCase()) {
|
|
@@ -3,8 +3,6 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
3
3
|
import { toEcdsaKernelSmartAccount } from 'permissionless/accounts';
|
|
4
4
|
import { SMART_ACCOUNT } from '../../utils/constants.js';
|
|
5
5
|
|
|
6
|
-
// use type of function so we don't need to pass in generic to parameter type
|
|
7
|
-
|
|
8
6
|
class KernelSmartAccount {
|
|
9
7
|
constructor(options) {
|
|
10
8
|
_defineProperty(this, "name", SMART_ACCOUNT.KERNEL);
|
|
@@ -4,8 +4,6 @@ import { toSafeSmartAccount } from 'permissionless/accounts';
|
|
|
4
4
|
import { entryPoint07Address } from 'viem/account-abstraction';
|
|
5
5
|
import { SMART_ACCOUNT } from '../../utils/constants.js';
|
|
6
6
|
|
|
7
|
-
// use type of function so we don't need to pass in generic to parameter type
|
|
8
|
-
|
|
9
7
|
class SafeSmartAccount {
|
|
10
8
|
constructor(options) {
|
|
11
9
|
_defineProperty(this, "name", SMART_ACCOUNT.SAFE);
|
|
@@ -4,8 +4,6 @@ import { toTrustSmartAccount } from 'permissionless/accounts';
|
|
|
4
4
|
import { entryPoint06Address } from 'viem/account-abstraction';
|
|
5
5
|
import { SMART_ACCOUNT } from '../../utils/constants.js';
|
|
6
6
|
|
|
7
|
-
// use type of function so we don't need to pass in generic to parameter type
|
|
8
|
-
|
|
9
7
|
class TrustSmartAccount {
|
|
10
8
|
constructor(options) {
|
|
11
9
|
_defineProperty(this, "name", SMART_ACCOUNT.TRUST);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ToBiconomySmartAccountParameters } from "permissionless/accounts";
|
|
2
2
|
import { Client, EIP1193Provider } from "viem";
|
|
3
3
|
import { SmartAccount } from "viem/account-abstraction";
|
|
4
|
-
import { ISmartAccount } from "../../utils/interfaces";
|
|
5
|
-
type BiconomySmartAccountConfig = Pick<ToBiconomySmartAccountParameters, "entryPoint" | "ecdsaModuleAddress" | "factoryAddress">;
|
|
4
|
+
import { BiconomySmartAccountConfig, ISmartAccount } from "../../utils/interfaces";
|
|
6
5
|
export declare class BiconomySmartAccount implements ISmartAccount {
|
|
7
6
|
readonly name: string;
|
|
8
7
|
private options;
|
|
@@ -12,4 +11,3 @@ export declare class BiconomySmartAccount implements ISmartAccount {
|
|
|
12
11
|
client: Client;
|
|
13
12
|
} & Pick<ToBiconomySmartAccountParameters, "index" | "nonceKey" | "address">): Promise<SmartAccount>;
|
|
14
13
|
}
|
|
15
|
-
export {};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { toEcdsaKernelSmartAccount } from "permissionless/accounts";
|
|
2
1
|
import { Client, EIP1193Provider } from "viem";
|
|
3
2
|
import { SmartAccount } from "viem/account-abstraction";
|
|
4
|
-
import { ISmartAccount } from "../../utils/interfaces";
|
|
5
|
-
type KernelSmartAccountParameters = Parameters<typeof toEcdsaKernelSmartAccount>[0];
|
|
6
|
-
type KernelSmartAccountConfig = Omit<KernelSmartAccountParameters, "owners" | "client" | "address" | "nonceKey" | "index">;
|
|
3
|
+
import { ISmartAccount, KernelSmartAccountConfig, KernelSmartAccountParameters } from "../../utils/interfaces";
|
|
7
4
|
export declare class KernelSmartAccount implements ISmartAccount {
|
|
8
5
|
readonly name: string;
|
|
9
6
|
private options;
|
|
@@ -13,4 +10,3 @@ export declare class KernelSmartAccount implements ISmartAccount {
|
|
|
13
10
|
client: Client;
|
|
14
11
|
} & Pick<KernelSmartAccountParameters, "address" | "nonceKey" | "index">): Promise<SmartAccount>;
|
|
15
12
|
}
|
|
16
|
-
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ToLightSmartAccountParameters } from "permissionless/accounts";
|
|
2
2
|
import { Client, EIP1193Provider } from "viem";
|
|
3
3
|
import { SmartAccount } from "viem/account-abstraction";
|
|
4
|
-
import { ISmartAccount } from "../../utils/interfaces";
|
|
5
|
-
type LightSmartAccountConfig = Omit<ToLightSmartAccountParameters, "owner" | "client" | "index" | "address" | "nonceKey">;
|
|
4
|
+
import { ISmartAccount, LightSmartAccountConfig } from "../../utils/interfaces";
|
|
6
5
|
export declare class LightSmartAccount implements ISmartAccount {
|
|
7
6
|
readonly name: string;
|
|
8
7
|
private options;
|
|
@@ -12,4 +11,3 @@ export declare class LightSmartAccount implements ISmartAccount {
|
|
|
12
11
|
client: Client;
|
|
13
12
|
} & Pick<ToLightSmartAccountParameters, "address" | "index" | "nonceKey">): Promise<SmartAccount>;
|
|
14
13
|
}
|
|
15
|
-
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ToNexusSmartAccountParameters } from "permissionless/accounts";
|
|
2
2
|
import { Client, EIP1193Provider } from "viem";
|
|
3
3
|
import { SmartAccount } from "viem/account-abstraction";
|
|
4
|
-
import { ISmartAccount } from "../../utils/interfaces";
|
|
5
|
-
type NexusSmartAccountConfig = Omit<ToNexusSmartAccountParameters, "owners" | "client" | "index" | "address">;
|
|
4
|
+
import { ISmartAccount, NexusSmartAccountConfig } from "../../utils/interfaces";
|
|
6
5
|
export declare class NexusSmartAccount implements ISmartAccount {
|
|
7
6
|
readonly name: string;
|
|
8
7
|
private options;
|
|
@@ -12,4 +11,3 @@ export declare class NexusSmartAccount implements ISmartAccount {
|
|
|
12
11
|
client: Client;
|
|
13
12
|
} & Pick<ToNexusSmartAccountParameters, "index" | "address">): Promise<SmartAccount>;
|
|
14
13
|
}
|
|
15
|
-
export {};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { toSafeSmartAccount } from "permissionless/accounts";
|
|
2
1
|
import { Client, EIP1193Provider } from "viem";
|
|
3
2
|
import { SmartAccount } from "viem/account-abstraction";
|
|
4
|
-
import { ISmartAccount } from "../../utils/interfaces";
|
|
5
|
-
type SafeSmartAccountParameters = Parameters<typeof toSafeSmartAccount>[0];
|
|
6
|
-
type SafeSmartAccountConfig = Omit<SafeSmartAccountParameters, "owners" | "client" | "address" | "nonceKey" | "saltNonce" | "validUntil" | "validAfter">;
|
|
3
|
+
import { ISmartAccount, SafeSmartAccountConfig, SafeSmartAccountParameters } from "../../utils/interfaces";
|
|
7
4
|
export declare class SafeSmartAccount implements ISmartAccount {
|
|
8
5
|
readonly name: string;
|
|
9
6
|
private options;
|
|
@@ -13,4 +10,3 @@ export declare class SafeSmartAccount implements ISmartAccount {
|
|
|
13
10
|
client: Client;
|
|
14
11
|
} & Pick<SafeSmartAccountParameters, "address" | "nonceKey" | "saltNonce" | "validUntil" | "validAfter">): Promise<SmartAccount>;
|
|
15
12
|
}
|
|
16
|
-
export {};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { toSimpleSmartAccount } from "permissionless/accounts";
|
|
2
1
|
import { Client, EIP1193Provider } from "viem";
|
|
3
2
|
import { SmartAccount } from "viem/account-abstraction";
|
|
4
|
-
import { ISmartAccount } from "../../utils/interfaces";
|
|
5
|
-
type SimpleSmartAccountParameters = Parameters<typeof toSimpleSmartAccount>[0];
|
|
6
|
-
type SimpleSmartAccountConfig = Omit<SimpleSmartAccountParameters, "owner" | "client">;
|
|
3
|
+
import { ISmartAccount, SimpleSmartAccountConfig } from "../../utils/interfaces";
|
|
7
4
|
export declare class SimpleSmartAccount implements ISmartAccount {
|
|
8
5
|
readonly name: string;
|
|
9
6
|
private options;
|
|
@@ -13,4 +10,3 @@ export declare class SimpleSmartAccount implements ISmartAccount {
|
|
|
13
10
|
client: Client;
|
|
14
11
|
}): Promise<SmartAccount>;
|
|
15
12
|
}
|
|
16
|
-
export {};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { toTrustSmartAccount } from "permissionless/accounts";
|
|
2
1
|
import { Client, EIP1193Provider } from "viem";
|
|
3
2
|
import { SmartAccount } from "viem/account-abstraction";
|
|
4
|
-
import { ISmartAccount } from "../../utils/interfaces";
|
|
5
|
-
type TrustSmartAccountParameters = Parameters<typeof toTrustSmartAccount>[0];
|
|
6
|
-
type TrustSmartAccountConfig = Omit<TrustSmartAccountParameters, "owner" | "client" | "address" | "nonceKey" | "index">;
|
|
3
|
+
import { ISmartAccount, TrustSmartAccountConfig, TrustSmartAccountParameters } from "../../utils/interfaces";
|
|
7
4
|
export declare class TrustSmartAccount implements ISmartAccount {
|
|
8
5
|
readonly name: string;
|
|
9
6
|
private options;
|
|
@@ -13,4 +10,3 @@ export declare class TrustSmartAccount implements ISmartAccount {
|
|
|
13
10
|
client: Client;
|
|
14
11
|
} & Pick<TrustSmartAccountParameters, "address" | "nonceKey" | "index">): Promise<SmartAccount>;
|
|
15
12
|
}
|
|
16
|
-
export {};
|
|
@@ -2,6 +2,7 @@ import { AddressPreferences, BASE_TX_EVENT_TYPE, BaseBlockTrackerState, BaseCont
|
|
|
2
2
|
import { JRPCRequest, Json } from "@web3auth/auth";
|
|
3
3
|
import { MutexInterface } from "async-mutex";
|
|
4
4
|
import { AccessList, TypedDataDomain, TypedDataField } from "ethers";
|
|
5
|
+
import { ToBiconomySmartAccountParameters, toEcdsaKernelSmartAccount, ToLightSmartAccountParameters, ToNexusSmartAccountParameters, toSafeSmartAccount, toSimpleSmartAccount, toTrustSmartAccount } from "permissionless/accounts";
|
|
5
6
|
import { Client, EIP1193Provider } from "viem";
|
|
6
7
|
import { createBundlerClient, createPaymasterClient, SmartAccount, UserOperationReceipt } from "viem/account-abstraction";
|
|
7
8
|
import { METHOD_TYPES, SMART_ACCOUNT, TRANSACTION_ENVELOPE_TYPES } from "./constants";
|
|
@@ -501,6 +502,17 @@ export type PaymasterConfig = Omit<Parameters<typeof createPaymasterClient>[0],
|
|
|
501
502
|
url?: string;
|
|
502
503
|
transport: Transport;
|
|
503
504
|
});
|
|
505
|
+
export type BiconomySmartAccountConfig = Pick<ToBiconomySmartAccountParameters, "entryPoint" | "ecdsaModuleAddress" | "factoryAddress">;
|
|
506
|
+
export type KernelSmartAccountParameters = Parameters<typeof toEcdsaKernelSmartAccount>[0];
|
|
507
|
+
export type KernelSmartAccountConfig = Omit<KernelSmartAccountParameters, "owners" | "client" | "address" | "nonceKey" | "index">;
|
|
508
|
+
export type LightSmartAccountConfig = Omit<ToLightSmartAccountParameters, "owner" | "client" | "index" | "address" | "nonceKey">;
|
|
509
|
+
export type NexusSmartAccountConfig = Omit<ToNexusSmartAccountParameters, "owners" | "client" | "index" | "address">;
|
|
510
|
+
export type SafeSmartAccountParameters = Parameters<typeof toSafeSmartAccount>[0];
|
|
511
|
+
export type SafeSmartAccountConfig = Omit<SafeSmartAccountParameters, "owners" | "client" | "address" | "nonceKey" | "saltNonce" | "validUntil" | "validAfter">;
|
|
512
|
+
export type SimpleSmartAccountParameters = Parameters<typeof toSimpleSmartAccount>[0];
|
|
513
|
+
export type SimpleSmartAccountConfig = Omit<SimpleSmartAccountParameters, "owner" | "client">;
|
|
514
|
+
export type TrustSmartAccountParameters = Parameters<typeof toTrustSmartAccount>[0];
|
|
515
|
+
export type TrustSmartAccountConfig = Omit<TrustSmartAccountParameters, "owner" | "client" | "address" | "nonceKey" | "index">;
|
|
504
516
|
export interface ISmartAccount {
|
|
505
517
|
getSmartAccount(params: {
|
|
506
518
|
owner: EIP1193Provider;
|
|
@@ -512,7 +524,7 @@ export interface UserOperationGas {
|
|
|
512
524
|
callGasLimit: string;
|
|
513
525
|
preVerificationGas: string;
|
|
514
526
|
verificationGasLimit: string;
|
|
515
|
-
paymasterVerificationGasLimit
|
|
516
|
-
paymasterPostOpGasLimit
|
|
527
|
+
paymasterVerificationGasLimit?: string;
|
|
528
|
+
paymasterPostOpGasLimit?: string;
|
|
517
529
|
}
|
|
518
530
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toruslabs/ethereum-controllers",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.2",
|
|
4
4
|
"homepage": "https://github.com/torusresearch/controllers#readme",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@ethereumjs/util": "^9.1.0",
|
|
24
|
-
"@toruslabs/base-controllers": "^7.
|
|
24
|
+
"@toruslabs/base-controllers": "^7.1.1",
|
|
25
25
|
"@toruslabs/http-helpers": "^7.0.0",
|
|
26
26
|
"@web3auth/auth": "^9.6.2",
|
|
27
27
|
"async-mutex": "^0.5.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"jsonschema": "^1.4.1",
|
|
35
35
|
"loglevel": "^1.9.2",
|
|
36
36
|
"permissionless": "^0.2.23",
|
|
37
|
-
"viem": "^2.
|
|
37
|
+
"viem": "^2.22.8"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@babel/runtime": "7.x"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "29f28e52b7daf293faa4e88cb81df7ffd879110f",
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@nomicfoundation/hardhat-chai-matchers": "^2.0.8",
|
|
69
69
|
"@nomicfoundation/hardhat-ethers": "^3.0.8",
|