Skip to content

Commit a8803ca

Browse files
committed
Fixed non-normalized yParity on EIP-7702 JSON-RPC responses (#4985).
1 parent ac6022b commit a8803ca

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src.ts/providers/format.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
assert, assertArgument
1010
} from "../utils/index.js";
1111

12+
import type { SignatureLike } from "../crypto/index.js"
1213
import type {
1314
BlockParams, LogParams,
1415
TransactionReceiptParams, TransactionResponseParams,
@@ -215,11 +216,25 @@ export function formatTransactionResponse(value: any): TransactionResponseParams
215216
blobVersionedHashes: allowNull(arrayOf(formatHash, true), null),
216217

217218
authorizationList: allowNull(arrayOf((v: any) => {
219+
let sig: SignatureLike;
220+
if (v.signature) {
221+
sig = v.signature;
222+
223+
} else {
224+
let yParity = v.yParity;
225+
if (yParity === "0x1b") {
226+
yParity = 0;
227+
} else if (yParity === "0x1c") {
228+
yParity = 1;
229+
}
230+
sig = Object.assign({ }, v, { yParity });
231+
}
232+
218233
return {
219234
address: getAddress(v.address),
220235
chainId: getBigInt(v.chainId),
221236
nonce: getBigInt(v.nonce),
222-
signature: Signature.from(v.signature ? v.signature: v)
237+
signature: Signature.from(sig)
223238
};
224239
}, false), null),
225240

0 commit comments

Comments
 (0)