@getpara/aa-cdp 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 +1 -1
- package/dist/action.js +12 -14
- package/dist/types.d.ts +1 -1
- package/package.json +3 -3
package/dist/action.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BundlerClient } from 'viem/account-abstraction';
|
|
2
|
-
import type { SmartAccount4337 } from '@getpara/viem-v2-integration';
|
|
2
|
+
import type { SmartAccount4337 } from '@getpara/viem-v2-integration/aa';
|
|
3
3
|
import type { CreateCDPSmartAccountParams } from './types.js';
|
|
4
4
|
export type { CreateCDPSmartAccountParams } from './types.js';
|
|
5
5
|
/**
|
package/dist/action.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SmartAccountError, wrapProviderError, resolveWalletIdentifier } from "@getpara/viem-v2-integration";
|
|
1
|
+
import { isExternalWallet, SmartAccountError, wrapProviderError, resolveSigner, assertAccountAddress } from "@getpara/viem-v2-integration/aa";
|
|
3
2
|
import { createPublicClient, http } from "viem";
|
|
4
3
|
import { toCoinbaseSmartAccount, createBundlerClient } from "viem/account-abstraction";
|
|
5
4
|
const CDP_CHAIN_SLUGS = {
|
|
@@ -12,9 +11,15 @@ async function createCDPSmartAccount(params) {
|
|
|
12
11
|
if (!chainSlug) {
|
|
13
12
|
throw new Error(`CDP smart accounts only support Base (8453) and Base Sepolia (84532). Got chain ID ${chain.id}.`);
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
if (isExternalWallet(params.signer)) {
|
|
15
|
+
throw new SmartAccountError({
|
|
16
|
+
code: "INVALID_CONFIG",
|
|
17
|
+
message: "CDP (Coinbase) smart accounts are not compatible with external wallets. The Coinbase smart wallet contract validates UserOp signatures using raw ecrecover, but external wallets' personal_sign adds an EIP-191 prefix that produces an unrecoverable signature. Use an embedded Para wallet instead.",
|
|
18
|
+
provider: "CDP"
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const viemAccount = resolveSigner(para, params);
|
|
22
|
+
if (!viemAccount) return null;
|
|
18
23
|
const publicClient = createPublicClient({ chain, transport: http(rpcUrl) });
|
|
19
24
|
const coinbaseAccount = await toCoinbaseSmartAccount({
|
|
20
25
|
client: publicClient,
|
|
@@ -28,14 +33,7 @@ async function createCDPSmartAccount(params) {
|
|
|
28
33
|
transport: http(paymasterUrl),
|
|
29
34
|
paymaster: true
|
|
30
35
|
});
|
|
31
|
-
|
|
32
|
-
if (!accountAddress) {
|
|
33
|
-
throw new SmartAccountError({
|
|
34
|
-
code: "MISSING_ACCOUNT_ADDRESS",
|
|
35
|
-
message: "CDP bundler client must have an account address",
|
|
36
|
-
provider: "CDP"
|
|
37
|
-
});
|
|
38
|
-
}
|
|
36
|
+
assertAccountAddress(bundlerClient.account?.address, "CDP bundler client", "CDP");
|
|
39
37
|
const sendBatchTransaction = async (calls) => {
|
|
40
38
|
try {
|
|
41
39
|
const hash = await bundlerClient.sendUserOperation({
|
|
@@ -49,7 +47,7 @@ async function createCDPSmartAccount(params) {
|
|
|
49
47
|
};
|
|
50
48
|
const sendTransaction = async (tx) => sendBatchTransaction([tx]);
|
|
51
49
|
return {
|
|
52
|
-
smartAccountAddress:
|
|
50
|
+
smartAccountAddress: bundlerClient.account.address,
|
|
53
51
|
signer: viemAccount,
|
|
54
52
|
chain,
|
|
55
53
|
mode: "4337",
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChainBasedSmartAccountConfig, CreateSmartAccountParams } from '@getpara/viem-v2-integration';
|
|
1
|
+
import type { ChainBasedSmartAccountConfig, CreateSmartAccountParams } from '@getpara/viem-v2-integration/aa';
|
|
2
2
|
/**
|
|
3
3
|
* Configuration for Coinbase Developer Platform (CDP) smart account.
|
|
4
4
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/aa-cdp",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.0",
|
|
4
4
|
"description": "Coinbase Developer Platform 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.
|
|
25
|
+
"@getpara/viem-v2-integration": "2.17.0",
|
|
26
26
|
"permissionless": "^0.2.12"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "3ed1f835b97ae720f1ac747611296e3b86f61138"
|
|
38
38
|
}
|