Skip to content

Commit

Permalink
Omit hash2sign (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith authored Oct 28, 2024
1 parent f2734d0 commit b0375da
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/decode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { DecodedTxData, SafeEncodedSignRequest, UserOperation } from "./types";
export function decodeTxData({
evmMessage,
chainId,
}: SafeEncodedSignRequest): DecodedTxData {
}: Omit<SafeEncodedSignRequest, "hashToSign">): DecodedTxData {
const data = evmMessage;
if (isRlpHex(evmMessage)) {
decodeRlpHex(chainId, evmMessage);
Expand Down
20 changes: 18 additions & 2 deletions tests/unit/decode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ describe("decoding functions", () => {
it("decodeRlpHex", () => {
const evmMessage =
"0x02f9027083aa36a72a830f4d5b844f32d7b98301ad80947fa8e8264985c7525fc50f98ac1a9b376540548980b902446a7612020000000000000000000000007fa8e8264985c7525fc50f98ac1a9b37654054890000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000440d582f130000000000000000000000007f01d9b227593e033bf8d6fc86e634d27aa855680000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000000000000000000000000102543f7e6b5786a444cc89ff73012825d13000d00000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c0";
const decoded = decodeRlpHex(chainId, evmMessage);
expect(decoded).toStrictEqual({
expect(decodeRlpHex(chainId, evmMessage)).toStrictEqual({
chainId: 11155111,
costEstimate: "0.000146207015243264",
transactions: [
Expand All @@ -65,6 +64,23 @@ describe("decoding functions", () => {
},
],
});

expect(
decodeRlpHex(
11155111,
"0x02ef83aa36a780830f4d5b84350f1b6a82520894d8b91431c9fa6dcf3a8cdc2dda68904524a65726865af3107a400080c0"
)
).toStrictEqual({
chainId: 11155111,
costEstimate: "0.000018714892329",
transactions: [
{
to: "0xd8b91431c9fa6dcf3a8cdc2dda68904524a65726",
value: "100000000000000",
data: "0x",
},
],
});
});

it("decodeTransactionSerializable", () => {
Expand Down

0 comments on commit b0375da

Please sign in to comment.