Skip to content

Commit

Permalink
Hotfix: Remove Payload Reversal (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith authored Jul 29, 2024
1 parent ee8c098 commit 0f719ae
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/chains/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export class NearEthAdapter {

const signature = await this.mpcContract.requestSignature({
path: this.derivationPath,
payload: Array.from(hashToSign.reverse()),
payload: Array.from(hashToSign),
key_version: 0,
});
return serializeSignature(signature);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function toPayload(hexString: Hex): number[] {
if (hexString.slice(2).length !== 32 * 2) {
throw new Error(`Payload Hex must have 32 bytes: ${hexString}`);
}
return Array.from(toBytes(hexString).reverse());
return Array.from(toBytes(hexString));
}

export function buildTxPayload(unsignedTxHash: `0x${string}`): number[] {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/utils.transaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ describe("Transaction Builder Functions", () => {
"0x02e783aa36a7808309e8bb84773f7cbb8094deadbeef0000000000000000000000000b00b1e50180c0";
const payload = buildTxPayload(txHash);
expect(payload).toEqual([
178, 243, 90, 239, 203, 210, 59, 212, 215, 225, 70, 217, 13, 214, 94, 37,
36, 9, 101, 199, 230, 132, 140, 98, 211, 7, 68, 130, 233, 88, 145, 179,
179, 145, 88, 233, 130, 68, 7, 211, 98, 140, 132, 230, 199, 101, 9, 36,
37, 94, 214, 13, 217, 70, 225, 215, 212, 59, 210, 203, 239, 90, 243, 178,
]);
});

Expand Down
24 changes: 12 additions & 12 deletions tests/unit/wc.handlers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ describe("Wallet Connect", () => {
);
expect(evmMessage).toEqual(messageString);
expect(payload).toEqual([
140, 57, 188, 66, 128, 51, 12, 191, 241, 190, 96, 50, 8, 251, 249, 208,
157, 27, 241, 60, 23, 124, 29, 153, 245, 135, 109, 181, 125, 67, 182,
82,
82, 182, 67, 125, 181, 109, 135, 245, 153, 29, 124, 23, 60, 241, 27,
157, 208, 249, 251, 8, 50, 96, 190, 241, 191, 12, 51, 128, 66, 188, 57,
140,
]);
});

Expand Down Expand Up @@ -71,9 +71,9 @@ Nonce:
2971c711-b798-4434-a631-1c3f13efe53e`
);
expect(payload).toEqual([
219, 231, 195, 249, 2, 161, 186, 203, 13, 63, 169, 203, 233, 111, 203,
91, 4, 166, 92, 92, 217, 141, 180, 168, 176, 123, 102, 85, 38, 115, 1,
71,
71, 1, 115, 38, 85, 102, 123, 176, 168, 180, 141, 217, 92, 92, 166, 4,
91, 203, 111, 233, 203, 169, 63, 13, 203, 186, 161, 2, 249, 195, 231,
219,
]);
});

Expand All @@ -97,9 +97,9 @@ Nonce:
Challenge: 4113fc3ab2cc60f5d595b2e55349f1eec56fd0c70d4287081fe7156848263626`
);
expect(payload).toEqual([
211, 164, 197, 156, 45, 221, 33, 214, 110, 59, 107, 27, 229, 254, 102,
73, 86, 215, 129, 196, 48, 209, 241, 41, 108, 165, 177, 200, 81, 31, 1,
104,
104, 1, 31, 81, 200, 177, 165, 108, 41, 241, 209, 48, 196, 129, 215, 86,
73, 102, 254, 229, 27, 107, 59, 110, 214, 33, 221, 45, 156, 197, 164,
211,
]);
});
});
Expand Down Expand Up @@ -255,9 +255,9 @@ Challenge: 4113fc3ab2cc60f5d595b2e55349f1eec56fd0c70d4287081fe7156848263626`
);
expect(evmMessage).toEqual(request.params[1]);
expect(payload).toEqual([
154, 201, 197, 176, 122, 212, 161, 42, 56, 12, 218, 93, 39, 197, 249,
144, 53, 126, 250, 19, 85, 168, 82, 131, 104, 184, 46, 112, 237, 228,
48, 12,
12, 48, 228, 237, 112, 46, 184, 104, 131, 82, 168, 85, 19, 250, 126, 53,
144, 249, 197, 39, 93, 218, 12, 56, 42, 161, 212, 122, 176, 197, 201,
154,
]);
});
});
Expand Down

0 comments on commit 0f719ae

Please sign in to comment.