Skip to content

Commit 5f73ede

Browse files
authored
fix: append from field to getNonce requests (#254)
1 parent 82a73df commit 5f73ede

File tree

3 files changed

+28
-32
lines changed

3 files changed

+28
-32
lines changed

packages/sdk-4337/src/client/ecdsa/account.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,16 @@ export async function toEcdsaSmartAccount<
6262
},
6363
async getNonce() {
6464
const sender = await this.getAddress();
65-
66-
// Encode the getNonce call
6765
const calldata = encode_get_nonce_call_data(sender, "0") as Hex;
68-
69-
// Viem makes the network call
70-
const result = await client.call({
71-
to: epAddress,
72-
data: calldata,
73-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
74-
} as any);
75-
76-
// Decode the result
77-
const nonceStr = decode_nonce_result(result.data!);
66+
const result = await client.request({
67+
method: "eth_call",
68+
params: [{
69+
from: sender,
70+
to: epAddress,
71+
data: calldata,
72+
}],
73+
});
74+
const nonceStr = decode_nonce_result(result);
7875
return BigInt(nonceStr as string);
7976
},
8077

packages/sdk-4337/src/client/passkey/account.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,17 @@ export async function toPasskeySmartAccount<
6868
},
6969
async getNonce() {
7070
const sender = await this.getAddress();
71-
72-
// Encode the getNonce call
7371
const calldata = encode_get_nonce_call_data(sender, "0") as Hex;
72+
const result = await client.request({
73+
method: "eth_call",
74+
params: [{
75+
from: sender,
76+
to: epAddress,
77+
data: calldata,
78+
}],
79+
});
7480

75-
// Viem makes the network call
76-
const result = await client.call({
77-
to: epAddress,
78-
data: calldata,
79-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
80-
} as any);
81-
82-
// Decode the result
83-
const nonceStr = decode_nonce_result(result.data!);
81+
const nonceStr = decode_nonce_result(result);
8482
return BigInt(nonceStr as string);
8583
},
8684

packages/sdk-4337/src/client/session/account.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,16 @@ export async function toSessionSmartAccount<
8686
// Encode the getNonce call with the session's nonce key
8787
const calldata = encode_get_nonce_call_data(sender, nonceKeyDecimal) as Hex;
8888

89-
// Call EntryPoint
90-
const result = await client.call({
91-
to: epAddress,
92-
data: calldata,
93-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
94-
} as any);
95-
96-
// Decode result
97-
const nonceStr = decode_nonce_result(result.data!);
89+
const result = await client.request({
90+
method: "eth_call",
91+
params: [{
92+
from: sender,
93+
to: epAddress,
94+
data: calldata,
95+
}],
96+
});
97+
98+
const nonceStr = decode_nonce_result(result);
9899
return BigInt(nonceStr as string);
99100
},
100101

0 commit comments

Comments
 (0)