Skip to content
This repository has been archived by the owner on Jun 27, 2022. It is now read-only.

fixes to allow same contractAddress on diff chainId/blockchains #647

Merged
merged 7 commits into from
Aug 16, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add a real world test with a paraswap of 1INCH & fixed sig
gre committed Aug 16, 2021

Verified

This commit was signed with the committer’s verified signature.
gre @greweb
commit 96681164c7572ec98e78b1876f72ca36d842f7fb
58 changes: 16 additions & 42 deletions packages/hw-app-eth/tests/Eth.test.ts
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ import Eth from "../src/Eth";
import { TokenInfo } from "../src/erc20";
import { BigNumber } from "bignumber.js";
import { byContractAddressAndChainId } from "../src/erc20";
import { listen, log } from "@ledgerhq/logs";

test("getAppConfiguration", async () => {
const transport = await openTransportReplayer(
@@ -103,66 +104,39 @@ test("signTransaction supports EIP2930", async () => {
});
});

test.skip("signTransaction testing provideERC20Informations + setExternalPlugin", async () => {
test("paraswap", async () => {
const transport = await openTransportReplayer(
RecordStore.fromString(
`
=> e0120000680850617261737761701bd435f3c054b6e901b7b108a0ab7617c808677bec1d21dd3045022100ee2b33270cf910f481e64b7781c4693e7bc86e338476d65c30c9f3d41fa4924e022079fc72cc69954f5ab1949e7d2f3023948f10dc94c9455999eb2ef38ac25fe33d
=> e0120000670850617261737761701bd435f3c054b6e901b7b108a0ab7617c808677bcfc0afeb304402201c0cbe69aac517825b3a6eb5e7251e8fd57ff93a43bd3df52c7a841818eda81b022001a10cc326efaee2463fc96e7c29739c308fb8179bd2ac37303662bae4f7705c
<= 9000
=> e00a0000670354454c467bccd9d29f223bce8043b84e8c8b282827790f00000002000000013045022100ebe6667ee0d706d1fde8a81e9a0e2e2ea334e8cb5fbfd7d1332ad746bcf0dbd502206a8094623414077283b89498b467488ca406f2c18486c50f0933bf11401c9a93
=> e00a0000680531494e4348111111111117dc0aa78b770fa6a738034120c3020000001200000001304402204623e5f1375c54a446157ae8a739204284cf053634b7abd083dc5f5d2675c4e702206ff94b4c84ba9e93f44065c38d7c92506621fa69ba04f767aa58221de8afbf17
<= 9000
=> e004000096058000002c8000003c800000008000000000000000f90b95820a13850c92a69c008309fb5e941bd435f3c054b6e901b7b108a0ab7617c808677b888ac7230489e80000b90b24ec1d21dd0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000
=> e004000096058000002c8000003c800000000000000000000000f903cd82043d8509c765240083042e73941bd435f3c054b6e901b7b108a0ab7617c808677b80b903a4cfc0afeb000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000
<= 9000
=> E0048000960000000000000000000000008AC7230489E8000000000000000000000000000000000000000000000000000000000000059012BB00000000000000000000000000000000000000000000000000000000059E752F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000
=> e0048000960000000af10f7eb24f506cfd00000000000000000000000000000000000000000000000002a5b905b3c9fa4c00000000000000000000000000000000000000000000000002baaee8d905020a000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000
<= 9000
=> E0048000960000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000B70617261737761702E696F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
=> e004800096000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000000
<= 9000
=> E00480009600000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000020D000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000
=> e004800096000000000000000000000000000000000000000000000000000000000000000100000000000000000000000086d3579b043585a97532514016dcf0c2d6c4b6a100000000000000000000000000000000000000000000000000000000000000c499585aac00000000000000000000000000000000000000000000000af10f7eb24f506cfd000000000000000000000000000000000000
<= 9000
=> E0048000960000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000467BCCD9D29F223BCE8043B84E8C8B282827790F0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000
=> e004800096000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000
<= 9000
=> E00480009600000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001A0000000000000000000000000695725627E04898EF4A126AE71FC30AA935C5FB600000000000000000000000086D3579B043585A97532514016DC
=> e00480009600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000010000
<= 9000
=> E004800096F0C2D6C4B6A100000000000000000000000000000000000000000000000000000000000011AC00000000000000000000000000000000000000000000000000000000000000A0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000A000000000000000000000000000000000
<= 9000
=> E0048000960000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE000000000000000000000000467BCCD9D29F223BCE8043B84E8C8B282827790F000000000000
<= 9000
=> E00480009600000000000017312CBD32DF845A3941F1BC80F33AD8F59C84260000000000000000000000006317C5E82A06E1D8BF200D21F4510AC2C038AC81000000000000000000000000000000000000000000000000000000000000156400000000000000000000000000000000000000000000000000000000000000A000000000000000000000000000000000000000000000000000000000
<= 9000
=> E0048000960000000000000000000000000000000000000000000000000000000000000000000000E00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000006CB5C5CB789F
<= 9000
=> E004800096AE62CE5CE280E1FBC5DD3BBDAD810000000000000000000000000000000000000000000000003FD67BA0CECC00000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000000000000000000000000000000006400000000000000000
<= 9000
=> E004800096000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000280000000000000000000000000BA100000625A3754423978A60C9317C58A42
<= 9000
=> E0048000964E3D000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000017312CBD32DF845A
<= 9000
=> E0048000963941F1BC80F33AD8F59C84260000000000000000000000006317C5E82A06E1D8BF200D21F4510AC2C038AC81000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000A0000000000000000000000000000000000000000000000000000000000000000000000000000000000000
<= 9000
=> E004800096000000000000000000000000000000000000000000E000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000059A19D8C652FA0284F44113D0FF9ABA70BD46FB4
<= 9000
=> E00480009600000000000000000000000000000000000000000000000016345785D8A000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000467BCCD9D29F223BCE8043B84E8C8B282827790F00000000000000000000000000000000000000000000
<= 9000
=> E0048000960000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000017312CBD32DF845A3941F1BC80F33AD8F59C8426000000000000000000000000
<= 9000
=> E0048000966317C5E82A06E1D8BF200D21F4510AC2C038AC81000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000A0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E00000
<= 9000
=> E004800096000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000003B63A353C996A2C0A7BEADD8A9052A04CA8D7A5C000000000000000000000000000000000000000000000004
<= 9000
=> E00480008b972411230CD2FD700000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF25A0FFB4409987569488BE7E9E6B94B4B3EAB41477C6ABEC965D73F547F0EB1FE421A00C180ECB60187F13D49B37F290B533671062D8AA1F01A34C34B6EBEDFBC89558
<= 26e8c2b5b956b34386e68c5cc5bfc76aac158706430fcf1c71c9f6eb7d9dd690c8064005410a778b047fdd4afcb1e712217c297e5b0a2190f88b9e56ac745fae699000
=> e00480006100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000076c65646765723200000000000000000000000000000000000000000000000000018080
<= 26d9e62b0b6ae0c18d3d2ecdf20ce7f1c959e0f609b4e73e2d138bbdc3e1e9390012469e2124a8955b5159f670b0333b803a70dd7dc51558a8f7460b27eed77be59000
`.toLowerCase()
)
);
// Original TX: https://etherscan.io/tx/0xf87e29ee49230352f56f099ef2ae9c7144b3ecb2d0085212e2478b267479b4df
const eth = new Eth(transport);
const result = await eth.signTransaction(
"44'/60'/0'/0'/0",
"f90b95820a13850c92a69c008309fb5e941bd435f3c054b6e901b7b108a0ab7617c808677b888ac7230489e80000b90b24ec1d21dd0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000000000000059012bb00000000000000000000000000000000000000000000000000000000059e752f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000b70617261737761702e696f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000020d0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000467bccd9d29f223bce8043b84e8c8b282827790f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000695725627e04898ef4a126ae71fc30aa935c5fb600000000000000000000000086d3579b043585a97532514016dcf0c2d6c4b6a100000000000000000000000000000000000000000000000000000000000011ac00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000467bccd9d29f223bce8043b84e8c8b282827790f00000000000000000000000017312cbd32df845a3941f1bc80f33ad8f59c84260000000000000000000000006317c5e82a06e1d8bf200d21f4510ac2c038ac81000000000000000000000000000000000000000000000000000000000000156400000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000006cb5c5cb789fae62ce5ce280e1fbc5dd3bbdad810000000000000000000000000000000000000000000000003fd67ba0cecc00000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000280000000000000000000000000ba100000625a3754423978a60c9317c58a424e3d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000017312cbd32df845a3941f1bc80f33ad8f59c84260000000000000000000000006317c5e82a06e1d8bf200d21f4510ac2c038ac81000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000059a19d8c652fa0284f44113d0ff9aba70bd46fb400000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000467bccd9d29f223bce8043b84e8c8b282827790f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000017312cbd32df845a3941f1bc80f33ad8f59c84260000000000000000000000006317c5e82a06e1d8bf200d21f4510ac2c038ac81000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000003b63a353c996a2c0a7beadd8a9052a04ca8d7a5c000000000000000000000000000000000000000000000004972411230cd2fd700000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff25a0ffb4409987569488be7e9e6b94b4b3eab41477c6abec965d73f547f0eb1fe421a00c180ecb60187f13d49b37f290b533671062d8aa1f01a34c34b6ebedfbc89558"
"44'/60'/0'/0/0",
"f903cd82043d8509c765240083042e73941bd435f3c054b6e901b7b108a0ab7617c808677b80b903a4cfc0afeb000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000af10f7eb24f506cfd00000000000000000000000000000000000000000000000002a5b905b3c9fa4c00000000000000000000000000000000000000000000000002baaee8d905020a000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000086d3579b043585a97532514016dcf0c2d6c4b6a100000000000000000000000000000000000000000000000000000000000000c499585aac00000000000000000000000000000000000000000000000af10f7eb24f506cfd000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c40000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000076c65646765723200000000000000000000000000000000000000000000000000018080"
);
expect(result).toEqual({
r: "e8c2b5b956b34386e68c5cc5bfc76aac158706430fcf1c71c9f6eb7d9dd690c8",
s: "064005410a778b047fdd4afcb1e712217c297e5b0a2190f88b9e56ac745fae69",
r: "d9e62b0b6ae0c18d3d2ecdf20ce7f1c959e0f609b4e73e2d138bbdc3e1e93900",
s: "12469e2124a8955b5159f670b0333b803a70dd7dc51558a8f7460b27eed77be5",
v: "26",
});
});