@getpara/aa-zerodev 2.16.0 → 2.17.0

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/action.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type KernelAccountClient } from '@zerodev/sdk';
2
- import type { SmartAccount4337, SmartAccount7702 } from '@getpara/viem-v2-integration';
2
+ import type { SmartAccount4337, SmartAccount7702 } from '@getpara/viem-v2-integration/aa';
3
3
  import type { CreateZeroDevSmartAccountParams } from './types.js';
4
4
  export type { CreateZeroDevSmartAccountParams, ZeroDevTransactionOptions } from './types.js';
5
5
  /**
package/dist/action.js CHANGED
@@ -5,8 +5,14 @@ import {
5
5
  } from "@zerodev/sdk";
6
6
  import { KERNEL_V3_1, KERNEL_V3_3, KERNEL_7702_DELEGATION_ADDRESS } from "@zerodev/sdk/constants";
7
7
  import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator";
8
- import { createParaAccount } from "@getpara/viem-v2-integration";
9
- import { SmartAccountError, wrapProviderError, resolveWalletIdentifier } from "@getpara/viem-v2-integration";
8
+ import {
9
+ SmartAccountError,
10
+ wrapProviderError,
11
+ ensureExternalWalletChain,
12
+ resolveSigner,
13
+ rejectExternalWallet7702,
14
+ assertAccountAddress
15
+ } from "@getpara/viem-v2-integration/aa";
10
16
  import { createPublicClient, http } from "viem";
11
17
  function getZeroDevRpcUrl(projectId, chainId) {
12
18
  return `https://rpc.zerodev.app/api/v3/${projectId}/chain/${chainId}`;
@@ -16,10 +22,11 @@ const ENTRYPOINT_V07 = {
16
22
  version: "0.7"
17
23
  };
18
24
  async function createZeroDevSmartAccount(params) {
19
- const { para, projectId, chain, rpcUrl, bundlerUrl, paymasterUrl, mode } = params;
20
- const walletAddress = resolveWalletIdentifier(para, params);
21
- if (!walletAddress) return null;
22
- const viemAccount = createParaAccount(para, walletAddress);
25
+ const { para, projectId, chain, rpcUrl, bundlerUrl, paymasterUrl, mode: rawMode = "4337" } = params;
26
+ const mode = rawMode;
27
+ if (mode === "7702") rejectExternalWallet7702(params.signer, "ZERODEV");
28
+ const viemAccount = resolveSigner(para, params);
29
+ if (!viemAccount) return null;
23
30
  const _rpcUrl = rpcUrl || getZeroDevRpcUrl(projectId, chain.id);
24
31
  const publicClient = createPublicClient({ chain, transport: http(_rpcUrl) });
25
32
  const ecdsaValidator = await signerToEcdsaValidator(publicClient, {
@@ -55,15 +62,10 @@ async function createZeroDevSmartAccount(params) {
55
62
  }
56
63
  }
57
64
  });
58
- if (!kernelClient.account?.address) {
59
- throw new SmartAccountError({
60
- code: "MISSING_ACCOUNT_ADDRESS",
61
- message: "ZeroDev client must have an account address",
62
- provider: "ZERODEV"
63
- });
64
- }
65
+ assertAccountAddress(kernelClient.account?.address, "ZeroDev client", "ZERODEV");
65
66
  const accountAddress = kernelClient.account.address;
66
67
  const doSendAndWait = async (calls) => {
68
+ await ensureExternalWalletChain(params.signer, chain, "ZERODEV");
67
69
  if (!("sendUserOperation" in kernelClient && typeof kernelClient.sendUserOperation === "function")) {
68
70
  throw new SmartAccountError({
69
71
  code: "INVALID_CONFIG",
@@ -86,7 +88,7 @@ async function createZeroDevSmartAccount(params) {
86
88
  smartAccountAddress: accountAddress,
87
89
  signer: viemAccount,
88
90
  chain,
89
- mode: mode || "4337",
91
+ mode,
90
92
  provider: "ZERODEV",
91
93
  ...mode === "7702" && { delegationAddress: KERNEL_7702_DELEGATION_ADDRESS },
92
94
  async sendTransaction({ to, value, data }) {
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { PaymasterSmartAccountConfig, CreateSmartAccountParams, SmartAccountModeParam } from '@getpara/viem-v2-integration';
1
+ import type { PaymasterSmartAccountConfig, CreateSmartAccountParams, SmartAccountModeParam } from '@getpara/viem-v2-integration/aa';
2
2
  /**
3
3
  * Configuration for ZeroDev smart account.
4
4
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/aa-zerodev",
3
- "version": "2.16.0",
3
+ "version": "2.17.0",
4
4
  "description": "ZeroDev smart account integration for Para",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "test": "vitest run --coverage"
23
23
  },
24
24
  "dependencies": {
25
- "@getpara/viem-v2-integration": "2.16.0",
25
+ "@getpara/viem-v2-integration": "2.17.0",
26
26
  "@zerodev/ecdsa-validator": "^5.4.3",
27
27
  "@zerodev/sdk": "^5.4.3"
28
28
  },
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "fbe96a062b308d04105213378c12c38ee973c798"
38
+ "gitHead": "3ed1f835b97ae720f1ac747611296e3b86f61138"
39
39
  }