@toruslabs/ethereum-controllers 7.0.1 → 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.
Files changed (29) hide show
  1. package/dist/ethereumControllers.cjs.js +57 -31
  2. package/dist/ethereumControllers.esm.js +29 -20
  3. package/dist/ethereumControllers.umd.min.js +1 -1
  4. package/dist/lib.cjs/AccountAbstraction/AccountAbstractionController.js +13 -6
  5. package/dist/lib.cjs/AccountAbstraction/smartAccounts/KernelSmartAccount.js +0 -2
  6. package/dist/lib.cjs/AccountAbstraction/smartAccounts/SafeSmartAccount.js +0 -2
  7. package/dist/lib.cjs/AccountAbstraction/smartAccounts/TrustSmartAccount.js +0 -2
  8. package/dist/lib.cjs/Nfts/NftsController.js +2 -2
  9. package/dist/lib.cjs/Preferences/PreferencesController.js +12 -4
  10. package/dist/lib.cjs/Tokens/TokensController.js +2 -2
  11. package/dist/lib.esm/AccountAbstraction/AccountAbstractionController.js +13 -6
  12. package/dist/lib.esm/AccountAbstraction/smartAccounts/KernelSmartAccount.js +0 -2
  13. package/dist/lib.esm/AccountAbstraction/smartAccounts/SafeSmartAccount.js +0 -2
  14. package/dist/lib.esm/AccountAbstraction/smartAccounts/TrustSmartAccount.js +0 -2
  15. package/dist/lib.esm/Nfts/NftsController.js +2 -2
  16. package/dist/lib.esm/Preferences/PreferencesController.js +12 -4
  17. package/dist/lib.esm/Tokens/TokensController.js +2 -2
  18. package/dist/types/AccountAbstraction/smartAccounts/BiconomySmartAccount.d.ts +1 -3
  19. package/dist/types/AccountAbstraction/smartAccounts/KernelSmartAccount.d.ts +1 -5
  20. package/dist/types/AccountAbstraction/smartAccounts/LightSmartAccount.d.ts +1 -3
  21. package/dist/types/AccountAbstraction/smartAccounts/NexusSmartAccount.d.ts +1 -3
  22. package/dist/types/AccountAbstraction/smartAccounts/SafeSmartAccount.d.ts +1 -5
  23. package/dist/types/AccountAbstraction/smartAccounts/SimpleSmartAccount.d.ts +1 -5
  24. package/dist/types/AccountAbstraction/smartAccounts/TrustSmartAccount.d.ts +1 -5
  25. package/dist/types/Nfts/NftsController.d.ts +1 -1
  26. package/dist/types/Preferences/PreferencesController.d.ts +2 -2
  27. package/dist/types/Tokens/TokensController.d.ts +1 -1
  28. package/dist/types/utils/interfaces.d.ts +14 -2
  29. 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,7 +183,7 @@ 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
189
  let maxFeePerGas = txParams.maxFeePerGas ? BigInt(txParams.maxFeePerGas) : undefined;
@@ -200,18 +200,25 @@ class AccountAbstractionController extends baseControllers.BaseController {
200
200
 
201
201
  // estimate gas: maxFeePerGas and maxPriorityFeePerGas are required
202
202
  const estimateGasParams = {
203
+ account: this.smartAccount,
203
204
  calls,
204
205
  maxFeePerGas,
205
206
  maxPriorityFeePerGas
206
207
  };
207
208
  const result = await this.bundlerClient.estimateUserOperationGas(estimateGasParams);
208
- return {
209
+ const gasData = {
209
210
  callGasLimit: viem.toHex(result.callGasLimit),
210
211
  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)
212
+ verificationGasLimit: viem.toHex(result.verificationGasLimit)
214
213
  };
214
+ // NOTE: paymasterVerificationGasLimit and paymasterPostOpGasLimit are optional don't include it in the object otherwise bundler rpc call will throw error (depend on bundler)
215
+ if (result.paymasterVerificationGasLimit) {
216
+ gasData.paymasterVerificationGasLimit = viem.toHex(result.paymasterVerificationGasLimit);
217
+ }
218
+ if (result.paymasterPostOpGasLimit) {
219
+ gasData.paymasterPostOpGasLimit = viem.toHex(result.paymasterPostOpGasLimit);
220
+ }
221
+ return gasData;
215
222
  }
216
223
  async signMessage(message, address) {
217
224
  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);
@@ -158,7 +158,7 @@ class NftsController extends baseControllers.BaseController {
158
158
  }
159
159
  });
160
160
  }
161
- async refreshNftBalances() {
161
+ async refreshNftBalances(skipCache) {
162
162
  const userAddress = this.userSelectedAddress;
163
163
  if (userAddress === "") return;
164
164
  const oldNfts = [...this.userNfts];
@@ -166,7 +166,7 @@ class NftsController extends baseControllers.BaseController {
166
166
  try {
167
167
  const currentChainId = this.config.chainId;
168
168
  if (constants.SIMPLEHASH_SUPPORTED_CHAINS.includes(currentChainId)) {
169
- const simpleHashBalances = await this.getSimpleHashNfts(userAddress, currentChainId);
169
+ const simpleHashBalances = await this.getSimpleHashNfts(userAddress, currentChainId, skipCache);
170
170
  nonZeroNfts.push(...simpleHashBalances);
171
171
  this.update({
172
172
  nfts: {
@@ -271,14 +271,22 @@ class PreferencesController extends baseControllers.BasePreferencesController {
271
271
  return [];
272
272
  }
273
273
  }
274
- async getEtherScanTokens(address, chainId) {
274
+ async getEtherScanTokens(address, chainId, skipCache) {
275
275
  const selectedAddress = address;
276
- const result = await this.wsApiClient.authGet(`tokens?chainId=${chainId}&address=${selectedAddress}`, this.authCredentials());
276
+ let path = `tokens?chainId=${chainId}&address=${selectedAddress}`;
277
+ if (skipCache) {
278
+ path += `&skipCache=true`;
279
+ }
280
+ const result = await this.wsApiClient.authGet(path, this.authCredentials());
277
281
  return result.data;
278
282
  }
279
- async getSimpleHashNfts(address, chainId) {
283
+ async getSimpleHashNfts(address, chainId, skipCache) {
280
284
  const selectedAddress = address;
281
- const result = await this.wsApiClient.authGet(`nfts?chainId=${chainId}&address=${selectedAddress}`, this.authCredentials());
285
+ let path = `nfts?chainId=${chainId}&address=${selectedAddress}`;
286
+ if (skipCache) {
287
+ path += `&skipCache=true`;
288
+ }
289
+ const result = await this.wsApiClient.authGet(path, this.authCredentials());
282
290
  return result.data;
283
291
  }
284
292
  getCustomTokens(address) {
@@ -176,7 +176,7 @@ class TokensController extends baseControllers.BaseController {
176
176
  }
177
177
  });
178
178
  }
179
- async refreshTokenBalances() {
179
+ async refreshTokenBalances(skipCache) {
180
180
  const userAddress = this.userSelectedAddress;
181
181
  if (userAddress === "") return;
182
182
  const oldTokens = [...this.userTokens];
@@ -185,7 +185,7 @@ class TokensController extends baseControllers.BaseController {
185
185
  try {
186
186
  const currentChainId = this.config.chainId;
187
187
  if (constants.ETHERSCAN_SUPPORTED_CHAINS.includes(currentChainId)) {
188
- const etherscanBalances = await this.getEtherScanTokens(userAddress, currentChainId);
188
+ const etherscanBalances = await this.getEtherScanTokens(userAddress, currentChainId, skipCache);
189
189
  nonZeroTokens.push(...etherscanBalances);
190
190
  }
191
191
  if (tokenAddresses.length > 0) {
@@ -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,7 +181,7 @@ 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
187
  let maxFeePerGas = txParams.maxFeePerGas ? BigInt(txParams.maxFeePerGas) : undefined;
@@ -198,18 +198,25 @@ class AccountAbstractionController extends BaseController {
198
198
 
199
199
  // estimate gas: maxFeePerGas and maxPriorityFeePerGas are required
200
200
  const estimateGasParams = {
201
+ account: this.smartAccount,
201
202
  calls,
202
203
  maxFeePerGas,
203
204
  maxPriorityFeePerGas
204
205
  };
205
206
  const result = await this.bundlerClient.estimateUserOperationGas(estimateGasParams);
206
- return {
207
+ const gasData = {
207
208
  callGasLimit: toHex(result.callGasLimit),
208
209
  preVerificationGas: toHex(result.preVerificationGas),
209
- verificationGasLimit: toHex(result.verificationGasLimit),
210
- paymasterVerificationGasLimit: toHex(result.paymasterVerificationGasLimit || 0),
211
- paymasterPostOpGasLimit: toHex(result.paymasterPostOpGasLimit || 0)
210
+ verificationGasLimit: toHex(result.verificationGasLimit)
212
211
  };
212
+ // NOTE: paymasterVerificationGasLimit and paymasterPostOpGasLimit are optional don't include it in the object otherwise bundler rpc call will throw error (depend on bundler)
213
+ if (result.paymasterVerificationGasLimit) {
214
+ gasData.paymasterVerificationGasLimit = toHex(result.paymasterVerificationGasLimit);
215
+ }
216
+ if (result.paymasterPostOpGasLimit) {
217
+ gasData.paymasterPostOpGasLimit = toHex(result.paymasterPostOpGasLimit);
218
+ }
219
+ return gasData;
213
220
  }
214
221
  async signMessage(message, address) {
215
222
  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);
@@ -156,7 +156,7 @@ class NftsController extends BaseController {
156
156
  }
157
157
  });
158
158
  }
159
- async refreshNftBalances() {
159
+ async refreshNftBalances(skipCache) {
160
160
  const userAddress = this.userSelectedAddress;
161
161
  if (userAddress === "") return;
162
162
  const oldNfts = [...this.userNfts];
@@ -164,7 +164,7 @@ class NftsController extends BaseController {
164
164
  try {
165
165
  const currentChainId = this.config.chainId;
166
166
  if (SIMPLEHASH_SUPPORTED_CHAINS.includes(currentChainId)) {
167
- const simpleHashBalances = await this.getSimpleHashNfts(userAddress, currentChainId);
167
+ const simpleHashBalances = await this.getSimpleHashNfts(userAddress, currentChainId, skipCache);
168
168
  nonZeroNfts.push(...simpleHashBalances);
169
169
  this.update({
170
170
  nfts: {
@@ -269,14 +269,22 @@ class PreferencesController extends BasePreferencesController {
269
269
  return [];
270
270
  }
271
271
  }
272
- async getEtherScanTokens(address, chainId) {
272
+ async getEtherScanTokens(address, chainId, skipCache) {
273
273
  const selectedAddress = address;
274
- const result = await this.wsApiClient.authGet(`tokens?chainId=${chainId}&address=${selectedAddress}`, this.authCredentials());
274
+ let path = `tokens?chainId=${chainId}&address=${selectedAddress}`;
275
+ if (skipCache) {
276
+ path += `&skipCache=true`;
277
+ }
278
+ const result = await this.wsApiClient.authGet(path, this.authCredentials());
275
279
  return result.data;
276
280
  }
277
- async getSimpleHashNfts(address, chainId) {
281
+ async getSimpleHashNfts(address, chainId, skipCache) {
278
282
  const selectedAddress = address;
279
- const result = await this.wsApiClient.authGet(`nfts?chainId=${chainId}&address=${selectedAddress}`, this.authCredentials());
283
+ let path = `nfts?chainId=${chainId}&address=${selectedAddress}`;
284
+ if (skipCache) {
285
+ path += `&skipCache=true`;
286
+ }
287
+ const result = await this.wsApiClient.authGet(path, this.authCredentials());
280
288
  return result.data;
281
289
  }
282
290
  getCustomTokens(address) {
@@ -174,7 +174,7 @@ class TokensController extends BaseController {
174
174
  }
175
175
  });
176
176
  }
177
- async refreshTokenBalances() {
177
+ async refreshTokenBalances(skipCache) {
178
178
  const userAddress = this.userSelectedAddress;
179
179
  if (userAddress === "") return;
180
180
  const oldTokens = [...this.userTokens];
@@ -183,7 +183,7 @@ class TokensController extends BaseController {
183
183
  try {
184
184
  const currentChainId = this.config.chainId;
185
185
  if (ETHERSCAN_SUPPORTED_CHAINS.includes(currentChainId)) {
186
- const etherscanBalances = await this.getEtherScanTokens(userAddress, currentChainId);
186
+ const etherscanBalances = await this.getEtherScanTokens(userAddress, currentChainId, skipCache);
187
187
  nonZeroTokens.push(...etherscanBalances);
188
188
  }
189
189
  if (tokenAddresses.length > 0) {
@@ -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 {};
@@ -32,6 +32,6 @@ export declare class NftsController extends BaseController<NftsControllerConfig,
32
32
  */
33
33
  restartNftDetection(): void;
34
34
  detectNewNfts(): void;
35
- refreshNftBalances(): Promise<void>;
35
+ refreshNftBalances(skipCache?: boolean): Promise<void>;
36
36
  getNftBalancesUsingHandler(customNfts: CustomNftInfo[]): Promise<void>;
37
37
  }
@@ -49,8 +49,8 @@ export declare class PreferencesController extends BasePreferencesController<Ext
49
49
  slippageTolerance?: string;
50
50
  transactionDeadline?: number;
51
51
  }): Promise<T[]>;
52
- getEtherScanTokens(address: string, chainId: string): Promise<CustomTokenInfo[]>;
53
- getSimpleHashNfts(address: string, chainId: string): Promise<CustomNftInfo[]>;
52
+ getEtherScanTokens(address: string, chainId: string, skipCache?: boolean): Promise<CustomTokenInfo[]>;
53
+ getSimpleHashNfts(address: string, chainId: string, skipCache?: boolean): Promise<CustomNftInfo[]>;
54
54
  getCustomTokens(address?: string): CustomToken[];
55
55
  getCustomNfts(address?: string): CustomNft[];
56
56
  isChainIdSupported(address: string, chainId: string): boolean;
@@ -35,6 +35,6 @@ export declare class TokensController extends BaseController<EthereumTokensContr
35
35
  */
36
36
  restartTokenDetection(): void;
37
37
  detectNewTokens(): void;
38
- refreshTokenBalances(): Promise<void>;
38
+ refreshTokenBalances(skipCache?: boolean): Promise<void>;
39
39
  getTokenBalancesUsingHandler(customTokens: CustomTokenInfo[]): Promise<void>;
40
40
  }
@@ -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: string;
516
- paymasterPostOpGasLimit: string;
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.0.1",
3
+ "version": "7.1.1",
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.0.1",
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.21.55"
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": "af077167cffecad664d670b40f32ec267d0c54c2",
66
+ "gitHead": "f1c92c1d399b4a6592518586aa63caf7e9f404ba",
67
67
  "devDependencies": {
68
68
  "@nomicfoundation/hardhat-chai-matchers": "^2.0.8",
69
69
  "@nomicfoundation/hardhat-ethers": "^3.0.8",