@@ -3,11 +3,12 @@ import type { InnerWalletApiClient } from "../../types.js";
3
3
import { prepareCalls , type PrepareCallsParams } from "./prepareCalls.js" ;
4
4
import { metrics } from "../../metrics.js" ;
5
5
import { signPreparedCalls } from "./signPreparedCalls.js" ;
6
- import type { SmartAccountSigner } from "@aa-sdk/core" ;
6
+ import { type SmartAccountSigner } from "@aa-sdk/core" ;
7
7
import {
8
8
sendPreparedCalls ,
9
9
type SendPreparedCallsResult ,
10
10
} from "./sendPreparedCalls.js" ;
11
+ import { signSignatureRequest } from "./signSignatureRequest.js" ;
11
12
12
13
export type SendCallsParams <
13
14
TAccount extends Address | undefined = Address | undefined ,
@@ -18,6 +19,11 @@ export type SendCallsResult = SendPreparedCallsResult;
18
19
/**
19
20
* Prepares, signs, and submits calls. This function internally calls `prepareCalls`, `signPreparedCalls`, and `sendPreparedCalls`.
20
21
*
22
+ * <Note>
23
+ * If using this action with an ERC20 paymaster in pre-operation mode with `autoPermit`, the contents of the permit will be hidden
24
+ * from the user. It is recommended to use the `prepareCalls` action instead to manually handle the permit signature.
25
+ * </Note>
26
+ *
21
27
* @param {InnerWalletApiClient } client - The wallet API client to use for the request
22
28
* @param {SmartAccountSigner } signer - The signer to use
23
29
* @param {PrepareCallsParams<TAccount> } params - Parameters for sending calls
@@ -54,7 +60,23 @@ export async function sendCalls<
54
60
name : "send_calls" ,
55
61
} ) ;
56
62
57
- const calls = await prepareCalls ( client , params ) ;
63
+ let calls = await prepareCalls ( client , params ) ;
64
+
65
+ if ( calls . type === "paymaster-permit" ) {
66
+ const signature = await signSignatureRequest (
67
+ signer ,
68
+ calls . signatureRequest ,
69
+ ) ;
70
+
71
+ const secondCallParams = {
72
+ from : calls . modifiedRequest . from ,
73
+ calls : calls . modifiedRequest . calls ,
74
+ capabilities : calls . modifiedRequest . capabilities ,
75
+ paymasterPermitSignature : signature ,
76
+ } ;
77
+
78
+ calls = await prepareCalls ( client , secondCallParams ) ;
79
+ }
58
80
59
81
const signedCalls = await signPreparedCalls ( signer , calls ) ;
60
82
0 commit comments