Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions packages/sdk-4337/src/client/ecdsa/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,16 @@ export async function toEcdsaSmartAccount<
},
async getNonce() {
const sender = await this.getAddress();

// Encode the getNonce call
const calldata = encode_get_nonce_call_data(sender, "0") as Hex;

// Viem makes the network call
const result = await client.call({
to: epAddress,
data: calldata,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any);

// Decode the result
const nonceStr = decode_nonce_result(result.data!);
const result = await client.request({
method: "eth_call",
params: [{
from: sender,
to: epAddress,
data: calldata,
}],
});
const nonceStr = decode_nonce_result(result);
return BigInt(nonceStr as string);
},

Expand Down
20 changes: 9 additions & 11 deletions packages/sdk-4337/src/client/passkey/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,17 @@ export async function toPasskeySmartAccount<
},
async getNonce() {
const sender = await this.getAddress();

// Encode the getNonce call
const calldata = encode_get_nonce_call_data(sender, "0") as Hex;
const result = await client.request({
method: "eth_call",
params: [{
from: sender,
to: epAddress,
data: calldata,
}],
});

// Viem makes the network call
const result = await client.call({
to: epAddress,
data: calldata,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any);

// Decode the result
const nonceStr = decode_nonce_result(result.data!);
const nonceStr = decode_nonce_result(result);
return BigInt(nonceStr as string);
},

Expand Down
19 changes: 10 additions & 9 deletions packages/sdk-4337/src/client/session/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,16 @@ export async function toSessionSmartAccount<
// Encode the getNonce call with the session's nonce key
const calldata = encode_get_nonce_call_data(sender, nonceKeyDecimal) as Hex;

// Call EntryPoint
const result = await client.call({
to: epAddress,
data: calldata,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any);

// Decode result
const nonceStr = decode_nonce_result(result.data!);
const result = await client.request({
method: "eth_call",
params: [{
from: sender,
to: epAddress,
data: calldata,
}],
});

const nonceStr = decode_nonce_result(result);
return BigInt(nonceStr as string);
},

Expand Down
Loading