@ledgerhq/hw-app-eth 7.0.0-nightly.2 → 7.0.0-nightly.20251120135143
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/.unimportedrc.json +3 -28
- package/CHANGELOG.md +994 -17
- package/README.md +100 -0
- package/jest.config.ts +18 -0
- package/lib/Eth.d.ts +3 -18
- package/lib/Eth.d.ts.map +1 -1
- package/lib/Eth.js +160 -198
- package/lib/Eth.js.map +1 -1
- package/lib/errors.d.ts +3 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +2 -1
- package/lib/errors.js.map +1 -1
- package/lib/modules/Domains/index.js +6 -15
- package/lib/modules/Domains/index.js.map +1 -1
- package/lib/modules/EIP712/index.d.ts.map +1 -1
- package/lib/modules/EIP712/index.js +112 -125
- package/lib/modules/EIP712/index.js.map +1 -1
- package/lib/modules/EIP712/types.d.ts +1 -0
- package/lib/modules/EIP712/types.d.ts.map +1 -1
- package/lib/modules/EIP712/utils.d.ts +1 -0
- package/lib/modules/EIP712/utils.d.ts.map +1 -1
- package/lib/modules/EIP712/utils.js +14 -24
- package/lib/modules/EIP712/utils.js.map +1 -1
- package/lib/modules/Uniswap/constants.d.ts.map +1 -1
- package/lib/modules/Uniswap/constants.js +1 -0
- package/lib/modules/Uniswap/constants.js.map +1 -1
- package/lib/modules/Uniswap/decoders.d.ts.map +1 -1
- package/lib/modules/Uniswap/decoders.js +8 -3
- package/lib/modules/Uniswap/decoders.js.map +1 -1
- package/lib/modules/Uniswap/index.d.ts +2 -1
- package/lib/modules/Uniswap/index.d.ts.map +1 -1
- package/lib/modules/Uniswap/index.js +11 -20
- package/lib/modules/Uniswap/index.js.map +1 -1
- package/lib/modules/Uniswap/types.d.ts +1 -1
- package/lib/modules/Uniswap/types.d.ts.map +1 -1
- package/lib/services/ledger/contracts.js +4 -13
- package/lib/services/ledger/contracts.js.map +1 -1
- package/lib/services/ledger/erc20.d.ts +2 -1
- package/lib/services/ledger/erc20.d.ts.map +1 -1
- package/lib/services/ledger/erc20.js +16 -32
- package/lib/services/ledger/erc20.js.map +1 -1
- package/lib/services/ledger/index.d.ts.map +1 -1
- package/lib/services/ledger/index.js +34 -32
- package/lib/services/ledger/index.js.map +1 -1
- package/lib/services/ledger/loadConfig.d.ts.map +1 -1
- package/lib/services/ledger/loadConfig.js +7 -1
- package/lib/services/ledger/loadConfig.js.map +1 -1
- package/lib/services/ledger/nfts.js +9 -19
- package/lib/services/ledger/nfts.js.map +1 -1
- package/lib/services/types.d.ts +3 -0
- package/lib/services/types.d.ts.map +1 -1
- package/lib/utils.d.ts +56 -9
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +175 -81
- package/lib/utils.js.map +1 -1
- package/lib-es/Eth.d.ts +3 -18
- package/lib-es/Eth.d.ts.map +1 -1
- package/lib-es/Eth.js +160 -198
- package/lib-es/Eth.js.map +1 -1
- package/lib-es/errors.d.ts +3 -0
- package/lib-es/errors.d.ts.map +1 -1
- package/lib-es/errors.js +1 -0
- package/lib-es/errors.js.map +1 -1
- package/lib-es/modules/Domains/index.js +6 -15
- package/lib-es/modules/Domains/index.js.map +1 -1
- package/lib-es/modules/EIP712/index.d.ts.map +1 -1
- package/lib-es/modules/EIP712/index.js +112 -125
- package/lib-es/modules/EIP712/index.js.map +1 -1
- package/lib-es/modules/EIP712/types.d.ts +1 -0
- package/lib-es/modules/EIP712/types.d.ts.map +1 -1
- package/lib-es/modules/EIP712/utils.d.ts +1 -0
- package/lib-es/modules/EIP712/utils.d.ts.map +1 -1
- package/lib-es/modules/EIP712/utils.js +14 -24
- package/lib-es/modules/EIP712/utils.js.map +1 -1
- package/lib-es/modules/Uniswap/constants.d.ts.map +1 -1
- package/lib-es/modules/Uniswap/constants.js +1 -0
- package/lib-es/modules/Uniswap/constants.js.map +1 -1
- package/lib-es/modules/Uniswap/decoders.d.ts.map +1 -1
- package/lib-es/modules/Uniswap/decoders.js +8 -3
- package/lib-es/modules/Uniswap/decoders.js.map +1 -1
- package/lib-es/modules/Uniswap/index.d.ts +2 -1
- package/lib-es/modules/Uniswap/index.d.ts.map +1 -1
- package/lib-es/modules/Uniswap/index.js +11 -20
- package/lib-es/modules/Uniswap/index.js.map +1 -1
- package/lib-es/modules/Uniswap/types.d.ts +1 -1
- package/lib-es/modules/Uniswap/types.d.ts.map +1 -1
- package/lib-es/services/ledger/contracts.js +4 -13
- package/lib-es/services/ledger/contracts.js.map +1 -1
- package/lib-es/services/ledger/erc20.d.ts +2 -1
- package/lib-es/services/ledger/erc20.d.ts.map +1 -1
- package/lib-es/services/ledger/erc20.js +16 -32
- package/lib-es/services/ledger/erc20.js.map +1 -1
- package/lib-es/services/ledger/index.d.ts.map +1 -1
- package/lib-es/services/ledger/index.js +34 -32
- package/lib-es/services/ledger/index.js.map +1 -1
- package/lib-es/services/ledger/loadConfig.d.ts.map +1 -1
- package/lib-es/services/ledger/loadConfig.js +7 -1
- package/lib-es/services/ledger/loadConfig.js.map +1 -1
- package/lib-es/services/ledger/nfts.js +9 -19
- package/lib-es/services/ledger/nfts.js.map +1 -1
- package/lib-es/services/types.d.ts +3 -0
- package/lib-es/services/types.d.ts.map +1 -1
- package/lib-es/utils.d.ts +56 -9
- package/lib-es/utils.d.ts.map +1 -1
- package/lib-es/utils.js +148 -81
- package/lib-es/utils.js.map +1 -1
- package/package.json +19 -15
- package/src/Eth.ts +51 -82
- package/src/errors.ts +3 -0
- package/src/modules/EIP712/index.ts +17 -4
- package/src/modules/Uniswap/constants.ts +1 -0
- package/src/modules/Uniswap/decoders.ts +10 -3
- package/src/modules/Uniswap/index.ts +9 -8
- package/src/modules/Uniswap/types.ts +2 -1
- package/src/services/ledger/erc20.ts +16 -19
- package/src/services/ledger/index.ts +50 -22
- package/src/services/ledger/loadConfig.ts +4 -1
- package/src/services/ledger/nfts.ts +1 -1
- package/src/services/types.ts +12 -0
- package/src/utils.ts +170 -85
- package/tests/EIP712/filtered-signMessage.unit.test.ts +28 -116
- package/tests/EIP712/noFilter-signMessage.unit.test.ts +0 -2
- package/tests/ERC20/ERC20-CAL-KO.unit.test.ts +14 -25
- package/tests/ERC20/ERC20-CAL-OK.unit.test.ts +15 -10
- package/tests/Eth.unit.test.ts +242 -314
- package/tests/Uniswap/decoders.unit.test.ts +10 -0
- package/tests/Uniswap/index.unit.test.ts +17 -26
- package/tests/fixtures/messages/15-permit.json +3 -3
- package/tests/fixtures/messages/16-permit2.json +3 -3
- package/tests/fixtures/messages/17-uniswapx.json +5 -5
- package/tests/fixtures/utils.ts +17 -18
- package/tests/ledgerService.unit.test.ts +5 -7
- package/tests/utils.unit.test.ts +341 -0
package/tests/Eth.unit.test.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import nock from "nock";
|
|
2
2
|
import axios from "axios";
|
|
3
3
|
import { fail } from "assert";
|
|
4
|
-
import { ethers } from "ethers";
|
|
5
4
|
import BigNumber from "bignumber.js";
|
|
5
|
+
import { Interface } from "@ethersproject/abi";
|
|
6
|
+
import { parseUnits } from "@ethersproject/units";
|
|
7
|
+
import { BigNumber as EthersBigNumber } from "@ethersproject/bignumber";
|
|
8
|
+
import { serialize as serializeTransaction } from "@ethersproject/transactions";
|
|
6
9
|
import { openTransportReplayer, RecordStore } from "@ledgerhq/hw-transport-mocker";
|
|
7
10
|
import Eth, { ledgerService } from "../src/Eth";
|
|
8
11
|
import CAL_ETH from "./fixtures/SignatureCALEth";
|
|
@@ -36,18 +39,16 @@ describe("Eth app biding", () => {
|
|
|
36
39
|
const eth = new Eth(transport);
|
|
37
40
|
const result = await eth.clearSignTransaction(
|
|
38
41
|
"44'/60'/0'/0/0",
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
})
|
|
50
|
-
.substring(2),
|
|
42
|
+
serializeTransaction({
|
|
43
|
+
to: "0xB0b5B0106D69fE64545A60A68C014f7570D3F861",
|
|
44
|
+
value: EthersBigNumber.from("1"),
|
|
45
|
+
gasLimit: EthersBigNumber.from("21000"),
|
|
46
|
+
maxPriorityFeePerGas: EthersBigNumber.from("400000000"),
|
|
47
|
+
maxFeePerGas: EthersBigNumber.from("52925678988"),
|
|
48
|
+
chainId: 1,
|
|
49
|
+
nonce: 0,
|
|
50
|
+
type: 2,
|
|
51
|
+
}).slice(2),
|
|
51
52
|
{ erc20: true, externalPlugins: true, nft: true },
|
|
52
53
|
true,
|
|
53
54
|
);
|
|
@@ -70,32 +71,30 @@ describe("Eth app biding", () => {
|
|
|
70
71
|
const transport = await openTransportReplayer(
|
|
71
72
|
RecordStore.fromString(`
|
|
72
73
|
=> e00a000068054d415449437d1afa7b718fb893db30a3abc0cfc608aacfebb000000012000000013044022000d8fa7b6e409a0dc55723ba975179e7d1181d1fc78fccbece4e5a264814366a02203927d84a710c8892d02f7386ad20147c75fba4bdd486b0256ecd005770a7ca5b
|
|
73
|
-
<=
|
|
74
|
+
<= 009000
|
|
74
75
|
=> e004000085058000002c8000003c80000000000000000000000002f86d01808420c85580850dfe94e19e82fd25947d1afa7b718fb893db30a3abc0cfc608aacfebb080b844a9059cbb000000000000000000000000b0b5b0106d69fe64545a60a68c014f7570d3f8610000000000000000000000000000000000000000000000000de0b6b3a7640000c0
|
|
75
76
|
<= 00089a7656b73c72721952d9102dcb608b5f8e9e12e8dfa5d546743e3aa5ff99e24adc7e77795383bb1df13c572db4abfbce86ee4bbe3eaf9b3b50e5b5524793829000
|
|
76
77
|
`),
|
|
77
78
|
);
|
|
78
79
|
|
|
79
80
|
const eth = new Eth(transport);
|
|
80
|
-
const contract = new
|
|
81
|
+
const contract = new Interface(ERC20_ABI);
|
|
81
82
|
const result = await eth.clearSignTransaction(
|
|
82
83
|
"44'/60'/0'/0/0",
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
})
|
|
98
|
-
.substring(2),
|
|
84
|
+
serializeTransaction({
|
|
85
|
+
to: "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0",
|
|
86
|
+
value: EthersBigNumber.from("0"),
|
|
87
|
+
gasLimit: EthersBigNumber.from("64805"),
|
|
88
|
+
maxPriorityFeePerGas: EthersBigNumber.from("550000000"),
|
|
89
|
+
maxFeePerGas: EthersBigNumber.from("60105744798"),
|
|
90
|
+
data: contract.encodeFunctionData("transfer", [
|
|
91
|
+
"0xb0b5b0106d69fe64545a60a68c014f7570d3f861",
|
|
92
|
+
parseUnits("1", 18),
|
|
93
|
+
]),
|
|
94
|
+
chainId: 1,
|
|
95
|
+
nonce: 0,
|
|
96
|
+
type: 2,
|
|
97
|
+
}).slice(2),
|
|
99
98
|
{ erc20: true, externalPlugins: true, nft: true },
|
|
100
99
|
true,
|
|
101
100
|
);
|
|
@@ -138,37 +137,33 @@ describe("Eth app biding", () => {
|
|
|
138
137
|
<= 9000
|
|
139
138
|
=> e01400007001010752617269626c6560f80121c31a0d46b5279700f9df786054aa5ee500000000000000010101473045022067d4254b89367a7e35fe7507001d6c8a0844a35aa4839c94a4724de1f332382d022100b9353df1f6f69feb9970946603723657f5682e0cac1b480a2beb2ecba10c872f
|
|
140
139
|
<= 9000
|
|
141
|
-
=>
|
|
142
|
-
<= 9000
|
|
143
|
-
=> e004800010000000000000000000000000112999c0
|
|
140
|
+
=> e0040000a6058000002c8000003c80000000000000000000000002f88e018084448b9b80851278cdd392830238699460f80121c31a0d46b5279700f9df786054aa5ee580b86442842e0e0000000000000000000000006cbcd73cd8e8a42844662f0a0e76d7f79afd933d000000000000000000000000b0b5b0106d69fe64545a60a68c014f7570d3f8610000000000000000000000000000000000000000000000000000000000112999c0
|
|
144
141
|
<= 0187ce0994bbdfdfd93990a5afc03d7cf70a14c9efaabac810724a41f6375f54236c0056a02dc07650b1e68f86b9f18a92ff689a9eddf710bd9f76739260fff1939000
|
|
145
142
|
`),
|
|
146
143
|
);
|
|
147
144
|
|
|
148
145
|
const eth = new Eth(transport);
|
|
149
|
-
const contract = new
|
|
146
|
+
const contract = new Interface(ERC721_ABI);
|
|
150
147
|
const result = await eth.clearSignTransaction(
|
|
151
148
|
"44'/60'/0'/0/0",
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
})
|
|
171
|
-
.substring(2),
|
|
149
|
+
serializeTransaction({
|
|
150
|
+
to: contractAddr,
|
|
151
|
+
value: EthersBigNumber.from("0"),
|
|
152
|
+
gasLimit: EthersBigNumber.from("145513"),
|
|
153
|
+
maxPriorityFeePerGas: EthersBigNumber.from("1150000000"),
|
|
154
|
+
maxFeePerGas: EthersBigNumber.from("79336166290"),
|
|
155
|
+
data: contract.encodeFunctionData(
|
|
156
|
+
contract.getFunction("safeTransferFrom(address,address,uint256)"),
|
|
157
|
+
[
|
|
158
|
+
"0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d",
|
|
159
|
+
"0xb0b5b0106d69fe64545a60a68c014f7570d3f861",
|
|
160
|
+
"1124761",
|
|
161
|
+
],
|
|
162
|
+
),
|
|
163
|
+
chainId: 1,
|
|
164
|
+
nonce: 0,
|
|
165
|
+
type: 2,
|
|
166
|
+
}).slice(2),
|
|
172
167
|
{ erc20: true, externalPlugins: true, nft: true },
|
|
173
168
|
true,
|
|
174
169
|
);
|
|
@@ -211,36 +206,33 @@ describe("Eth app biding", () => {
|
|
|
211
206
|
<= 9000
|
|
212
207
|
=> e01400007001010752617269626c65d07dc4262bcdbf85190c01c996b4c06a461d243000000000000000010101473045022100fddd2264ca0eb3cc8a588d82b41edf9d262145a0ca1f08caab5bb6a4eac34a9e0220602b57cabdc40bbeb3a46a5d362ac2544124c9806aee196a87a51f61bb7e9230
|
|
213
208
|
<= 9000
|
|
214
|
-
=>
|
|
209
|
+
=> e0040000ff058000002c8000003c80000000000000000000000002f8ee01808414dc9380850d54eb0ea883010ab494d07dc4262bcdbf85190c01c996b4c06a461d243080b8c4f242432a0000000000000000000000006cbcd73cd8e8a42844662f0a0e76d7f79afd933d000000000000000000000000b0b5b0106d69fe64545a60a68c014f7570d3f861000000000000000000000000000000000000000000000000000000000004041c000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000
|
|
215
210
|
<= 9000
|
|
216
|
-
=>
|
|
211
|
+
=> e004800007000000000000c0
|
|
217
212
|
<= 016467047c39c2c3db9dbe8aa03802c80830beb659f0eed7470735098f2c44cfae7b2aa36e2f31c6e0d37a00b93789ef4eef4fd016dd3b92fa893e7e741a152be99000
|
|
218
213
|
`),
|
|
219
214
|
);
|
|
220
|
-
|
|
221
215
|
const eth = new Eth(transport);
|
|
222
|
-
const contract = new
|
|
216
|
+
const contract = new Interface(ERC1155_ABI);
|
|
223
217
|
const result = await eth.clearSignTransaction(
|
|
224
218
|
"44'/60'/0'/0/0",
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
})
|
|
243
|
-
.substring(2),
|
|
219
|
+
serializeTransaction({
|
|
220
|
+
to: contractAddr,
|
|
221
|
+
value: EthersBigNumber.from("0"),
|
|
222
|
+
gasLimit: EthersBigNumber.from("68276"),
|
|
223
|
+
maxPriorityFeePerGas: EthersBigNumber.from("350000000"),
|
|
224
|
+
maxFeePerGas: EthersBigNumber.from("57259265704"),
|
|
225
|
+
data: contract.encodeFunctionData("safeTransferFrom", [
|
|
226
|
+
"0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d",
|
|
227
|
+
"0xb0b5b0106d69fe64545a60a68c014f7570d3f861",
|
|
228
|
+
"263196",
|
|
229
|
+
"1",
|
|
230
|
+
"0x",
|
|
231
|
+
]),
|
|
232
|
+
chainId: 1,
|
|
233
|
+
nonce: 0,
|
|
234
|
+
type: 2,
|
|
235
|
+
}).slice(2),
|
|
244
236
|
{ erc20: true, externalPlugins: true, nft: true },
|
|
245
237
|
true,
|
|
246
238
|
);
|
|
@@ -267,63 +259,55 @@ describe("Eth app biding", () => {
|
|
|
267
259
|
=> e012000068085061726173776170def171fe48cf0115b1d80b88dc8eab59176fee5754e3f31b3045022100ec8e69d23371437ce5b5f1d894b836c036748e2fabf52fb069c34a9d0ba8704a022013e761d81c26ece4cb0ea385813699b7e646354d3404ed55f4bf068db02dda9a
|
|
268
260
|
<= 9000
|
|
269
261
|
=> e00a000068054d415449437d1afa7b718fb893db30a3abc0cfc608aacfebb000000012000000013044022000d8fa7b6e409a0dc55723ba975179e7d1181d1fc78fccbece4e5a264814366a02203927d84a710c8892d02f7386ad20147c75fba4bdd486b0256ecd005770a7ca5b
|
|
270
|
-
<=
|
|
262
|
+
<= 009000
|
|
271
263
|
=> e00a000067034441496b175474e89094c44da98b954eedeac495271d0f00000012000000013045022100b3aa979633284eb0f55459099333ab92cf06fdd58dc90e9c070000c8e968864c02207b10ec7d6609f51dda53d083a6e165a0abf3a77e13250e6f260772809b49aff5
|
|
264
|
+
<= 019000
|
|
265
|
+
=> e0040000ff058000002c8000003c80000000000000000000000002f9048f018084448b9b8085143fc44a5883048f8b94def171fe48cf0115b1d80b88dc8eab59176fee5780b9046454e3f31b00000000000000000000000000000000000000000000000000000000000000200000000000000000000000007d1afa7b718fb893db30a3abc0cfc608aacfebb00000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000014655db2d8c71619000000000000000000000000000000000000000000000000
|
|
272
266
|
<= 9000
|
|
273
|
-
=>
|
|
274
|
-
<= 9000
|
|
275
|
-
=> e00480009674e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000014655db2d8c71619000000000000000000000000000000000000000000000000147f9aa1bc47718c00000000000000000000000000000000000000000000000000000000000001e00000000000
|
|
276
|
-
<= 9000
|
|
277
|
-
=> e004800096000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000003e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000558247e365be655f9144e1a0140d79
|
|
278
|
-
<= 9000
|
|
279
|
-
=> e0048000963984372ef3010000000000000000000000000000000000000000000000000000000000405f000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000640be3823d2fae4b5ec240cd871aa6b675e99899000000000000000000000000000000000000000000000000000000000000000000
|
|
280
|
-
<= 9000
|
|
281
|
-
=> e004800096000000000000000000000000000001000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000000000000000000000000000000000000000000124c04b8d59000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a0000000
|
|
267
|
+
=> e0048000ff147f9aa1bc47718c00000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000220000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000003e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000558247e365be655f9144e1a0140d793984372ef3010000000000000000000000000000000000000000000000000000000000405f0000000000000000000000000000000000000000000000
|
|
282
268
|
<= 9000
|
|
283
|
-
=>
|
|
269
|
+
=> e0048000ff00000000000000042000000000000000000000000000000000000000000000000000000000640be3823d2fae4b5ec240cd871aa6b675e99899000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000000000000000000000000000000000000000000124c04b8d59000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000def171fe48cf
|
|
284
270
|
<= 9000
|
|
285
|
-
=>
|
|
271
|
+
=> e0048000ff0115b1d80b88dc8eab59176fee5700000000000000000000000000000000000000000000000000000000640b9d320000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002b7d1afa7b718fb893db30a3abc0cfc608aacfebb00027106b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
286
272
|
<= 9000
|
|
287
|
-
=>
|
|
273
|
+
=> e0048000ac000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000124000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0
|
|
288
274
|
<= 00775aed341ee9f0a0d0c0d724e242f9def19c09df02d1c474bc5750c86b952f5535bd98bc4a6482a895e94cd5ca9351ec1daeb955251a35dc8c2fb86851bf49189000
|
|
289
275
|
`),
|
|
290
276
|
);
|
|
291
277
|
|
|
292
278
|
const eth = new Eth(transport);
|
|
293
|
-
const contract = new
|
|
279
|
+
const contract = new Interface(PARASWAP_ABI);
|
|
294
280
|
const result = await eth.clearSignTransaction(
|
|
295
281
|
"44'/60'/0'/0/0",
|
|
296
|
-
|
|
297
|
-
.
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
})
|
|
326
|
-
.substring(2),
|
|
282
|
+
serializeTransaction({
|
|
283
|
+
to: transactionContracts.paraswap,
|
|
284
|
+
value: EthersBigNumber.from("0"),
|
|
285
|
+
gasLimit: EthersBigNumber.from("298891"),
|
|
286
|
+
maxPriorityFeePerGas: EthersBigNumber.from("1150000000"),
|
|
287
|
+
maxFeePerGas: EthersBigNumber.from("86969174616"),
|
|
288
|
+
data: contract.encodeFunctionData("simpleSwap", [
|
|
289
|
+
[
|
|
290
|
+
"0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", // MATIC
|
|
291
|
+
"0x6B175474E89094C44Da98b954EedeAC495271d0F", // DAI
|
|
292
|
+
"0x0de0b6b3a7640000", // 1 MATIC
|
|
293
|
+
"0x14655db2d8c71619", // ~1.469 DAI
|
|
294
|
+
"0x147f9aa1bc47718c", // EXPECT 1.477 DAI
|
|
295
|
+
["0xE592427A0AEce92De3Edee1F18E0157C05861564"],
|
|
296
|
+
"0xc04b8d59000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee5700000000000000000000000000000000000000000000000000000000640b9d320000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002b7d1afa7b718fb893db30a3abc0cfc608aacfebb00027106b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000",
|
|
297
|
+
["0x00", "0x0124"],
|
|
298
|
+
["0x00"],
|
|
299
|
+
"0x0000000000000000000000000000000000000000",
|
|
300
|
+
"0x558247e365be655f9144e1a0140D793984372Ef3",
|
|
301
|
+
"0x010000000000000000000000000000000000000000000000000000000000405f",
|
|
302
|
+
"0x",
|
|
303
|
+
"0x640be382",
|
|
304
|
+
"0x3d2fae4b5ec240cd871aa6b675e99899",
|
|
305
|
+
],
|
|
306
|
+
]),
|
|
307
|
+
chainId: 1,
|
|
308
|
+
nonce: 0,
|
|
309
|
+
type: 2,
|
|
310
|
+
}).slice(2),
|
|
327
311
|
{ erc20: true, externalPlugins: true, nft: true, uniswapV3: true },
|
|
328
312
|
true,
|
|
329
313
|
);
|
|
@@ -349,42 +333,32 @@ describe("Eth app biding", () => {
|
|
|
349
333
|
<= 9000
|
|
350
334
|
=> e00a0000680457455448c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000012000000013045022100b47ee8551c15a2cf681c649651e987d7e527c481d27c38da1f971a8242792bd3022069c3f688ac5493a23dab5798e3c9b07484765069e1d4be14321aae4d92cb8cbe
|
|
351
335
|
<= 009000
|
|
352
|
-
=>
|
|
353
|
-
<= 019000
|
|
354
|
-
=> e004000096058000002c8000003c80000000000000000000000002f9044f018084448b9b8085143fc44a5883048f8b943fc91a3afd70395cd496c647d5a6cc9d4b2b7fad80b904243593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000
|
|
336
|
+
=> e0040000ff058000002c8000003c80000000000000000000000002f9044f018084448b9b8085143fc44a5883048f8b943fc91a3afd70395cd496c647d5a6cc9d4b2b7fad80b904243593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000669ba25a00000000000000000000000000000000000000000000000000000000000000030a010c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
355
337
|
<= 9000
|
|
356
|
-
=>
|
|
338
|
+
=> e0048000ff0000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000016000000000000000000000000055747be9f9f5beb232ad59fe7af013b81d95fd5e000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000066c32ea60000000000000000000000000000000000000000000000
|
|
357
339
|
<= 9000
|
|
358
|
-
=>
|
|
340
|
+
=> e0048000ff000000000000000006000000000000000000000000ef1c6e67703c7bd7107eed8303fbe6ec2554bf6b00000000000000000000000000000000000000000000000000000000669ba25a00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000413cbf00ab90b6d1b17401cbf49e00c40f98bcb3f39461ca65e26009f9e9f77029279a4587efa2d792ea61ede56e0fbd7c1305007bc59d09bc60eaba46efa23edd1c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
359
341
|
<= 9000
|
|
360
|
-
=>
|
|
342
|
+
=> e0048000ff0000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000233a3559d9da00000000000000000000000000000000000000000000000062e76d8ff4b926e800000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc200271055747be9f9f5beb232ad59fe7af013b81d95fd5e00000000000000000000
|
|
361
343
|
<= 9000
|
|
362
|
-
=>
|
|
363
|
-
<= 9000
|
|
364
|
-
=> e0048000960000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000233a3559d9da00000000000000000000000000000000000000000000000062e76d8ff4b926e80000000000000000000000000000000000000000000000000000000000000
|
|
365
|
-
<= 9000
|
|
366
|
-
=> e0048000960000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc200271055747be9f9f5beb232ad59fe7af013b81d95fd5e00000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
367
|
-
<= 9000
|
|
368
|
-
=> e00480004e0000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000233a3559d9da000c0
|
|
344
|
+
=> e00480006c0000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000233a3559d9da000c0
|
|
369
345
|
<= 00a42d6ead5539eb1ac552b65b46df4e8fd87c37da54a280d33dc7a78992b56bb02244776870b31cfb50ea71c0ea31a30e6e513bd9766f74d61dc52b523ac256879000
|
|
370
346
|
`),
|
|
371
347
|
);
|
|
372
348
|
const eth = new Eth(transport);
|
|
373
349
|
const result = await eth.clearSignTransaction(
|
|
374
350
|
"44'/60'/0'/0/0",
|
|
375
|
-
|
|
376
|
-
.
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
})
|
|
387
|
-
.substring(2),
|
|
351
|
+
serializeTransaction({
|
|
352
|
+
to: transactionContracts.uniswapUniversaRouter,
|
|
353
|
+
value: EthersBigNumber.from("0"),
|
|
354
|
+
gasLimit: EthersBigNumber.from("298891"),
|
|
355
|
+
maxPriorityFeePerGas: EthersBigNumber.from("1150000000"),
|
|
356
|
+
maxFeePerGas: EthersBigNumber.from("86969174616"),
|
|
357
|
+
data: transactionData.uniswap["permit2>swap-out-v3>unwrap"],
|
|
358
|
+
chainId: 1,
|
|
359
|
+
nonce: 0,
|
|
360
|
+
type: 2,
|
|
361
|
+
}).slice(2),
|
|
388
362
|
{ erc20: true, externalPlugins: true, nft: true, uniswapV3: true },
|
|
389
363
|
true,
|
|
390
364
|
);
|
|
@@ -403,18 +377,16 @@ describe("Eth app biding", () => {
|
|
|
403
377
|
try {
|
|
404
378
|
await eth.clearSignTransaction(
|
|
405
379
|
"44'/60'/0'/0/0",
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
})
|
|
417
|
-
.substring(2),
|
|
380
|
+
serializeTransaction({
|
|
381
|
+
to: "0xB0b5B0106D69fE64545A60A68C014f7570D3F861",
|
|
382
|
+
value: EthersBigNumber.from("1"),
|
|
383
|
+
gasLimit: EthersBigNumber.from("21000"),
|
|
384
|
+
maxPriorityFeePerGas: EthersBigNumber.from("400000000"),
|
|
385
|
+
maxFeePerGas: EthersBigNumber.from("52925678988"),
|
|
386
|
+
chainId: 1,
|
|
387
|
+
nonce: 0,
|
|
388
|
+
type: 2,
|
|
389
|
+
}).slice(2),
|
|
418
390
|
{ erc20: true, externalPlugins: true, nft: true },
|
|
419
391
|
true,
|
|
420
392
|
);
|
|
@@ -441,18 +413,16 @@ describe("Eth app biding", () => {
|
|
|
441
413
|
try {
|
|
442
414
|
await eth.clearSignTransaction(
|
|
443
415
|
"44'/60'/0'/0/0",
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
})
|
|
455
|
-
.substring(2),
|
|
416
|
+
serializeTransaction({
|
|
417
|
+
to: "0xB0b5B0106D69fE64545A60A68C014f7570D3F861",
|
|
418
|
+
value: EthersBigNumber.from("1"),
|
|
419
|
+
gasLimit: EthersBigNumber.from("21000"),
|
|
420
|
+
maxPriorityFeePerGas: EthersBigNumber.from("400000000"),
|
|
421
|
+
maxFeePerGas: EthersBigNumber.from("52925678988"),
|
|
422
|
+
chainId: 1,
|
|
423
|
+
nonce: 0,
|
|
424
|
+
type: 2,
|
|
425
|
+
}).slice(2),
|
|
456
426
|
{ erc20: true, externalPlugins: true, nft: true },
|
|
457
427
|
false,
|
|
458
428
|
);
|
|
@@ -479,7 +449,7 @@ describe("Eth app biding", () => {
|
|
|
479
449
|
const resolution = await ledgerService
|
|
480
450
|
.resolveTransaction(
|
|
481
451
|
tx,
|
|
482
|
-
{},
|
|
452
|
+
{ staticERC20Signatures: { 1: CAL_ETH } },
|
|
483
453
|
resolutionConfig || { externalPlugins: true, erc20: true, nft: true },
|
|
484
454
|
)
|
|
485
455
|
.catch(e => {
|
|
@@ -572,11 +542,11 @@ describe("Eth app biding", () => {
|
|
|
572
542
|
});
|
|
573
543
|
});
|
|
574
544
|
|
|
575
|
-
test("signTransaction", async () => {
|
|
545
|
+
test("signTransaction with chainId 0 (Legacy before EIP-155)", async () => {
|
|
576
546
|
const transport = await openTransportReplayer(
|
|
577
547
|
RecordStore.fromString(`
|
|
578
548
|
=> e00400003e058000002c8000003c800000008000000000000000e8018504e3b292008252089428ee52a8f3d6e5d15f8b131996950d7f296c7952872bd72a2487400080
|
|
579
|
-
<=
|
|
549
|
+
<= 263694583045a85ada8d15d5e01b373b00e86a405c9c52f7835691dcc522b7353b30392e638a591c65ed307809825ca48346980f52d004ab7a5f93657f7e62a4009000
|
|
580
550
|
`),
|
|
581
551
|
);
|
|
582
552
|
const eth = new Eth(transport);
|
|
@@ -588,7 +558,7 @@ describe("Eth app biding", () => {
|
|
|
588
558
|
expect(result).toEqual({
|
|
589
559
|
r: "3694583045a85ada8d15d5e01b373b00e86a405c9c52f7835691dcc522b7353b",
|
|
590
560
|
s: "30392e638a591c65ed307809825ca48346980f52d004ab7a5f93657f7e62a400",
|
|
591
|
-
v: "
|
|
561
|
+
v: "26",
|
|
592
562
|
});
|
|
593
563
|
});
|
|
594
564
|
|
|
@@ -617,8 +587,8 @@ describe("Eth app biding", () => {
|
|
|
617
587
|
const transport = await openTransportReplayer(
|
|
618
588
|
RecordStore.fromString(`
|
|
619
589
|
=> e00a000066035a5258e41d2489571d322189246dafa5ebde1f4699f4980000001200000001304402200ae8634c22762a8ba41d2acb1e068dcce947337c6dd984f13b820d396176952302203306a49d8a6c35b11a61088e1570b3928ca3a0db6bd36f577b5ef87628561ff7
|
|
620
|
-
<=
|
|
621
|
-
=>
|
|
590
|
+
<= 009000
|
|
591
|
+
=> e004000085058000002c8000003c80000000000000000000000002f86d0106843b9aca008504a817c80082520894e41d2489571d322189246dafa5ebde1f4699f49800b844095ea7b3000000000000000000000000221657776846890989a759ba2973e427dff5c9bb0000000000000000000000000000000000000000000000004563918244f40000c0
|
|
622
592
|
<= 00d6814aa5db69de910824b14462af006fde864224c616ab93e30f646e7309a93f0312ac6e580e918ce6e39e5f910cb95ba7b68167f4d71e581dec2495a198ecc09000
|
|
623
593
|
`),
|
|
624
594
|
);
|
|
@@ -626,7 +596,7 @@ describe("Eth app biding", () => {
|
|
|
626
596
|
const result = await signTxWithResolution(
|
|
627
597
|
eth,
|
|
628
598
|
"44'/60'/0'/0/0",
|
|
629
|
-
"
|
|
599
|
+
"02f86d0106843b9aca008504a817c80082520894e41d2489571d322189246dafa5ebde1f4699f49800b844095ea7b3000000000000000000000000221657776846890989a759ba2973e427dff5c9bb0000000000000000000000000000000000000000000000004563918244f40000c0",
|
|
630
600
|
);
|
|
631
601
|
expect(result).toEqual({
|
|
632
602
|
r: "d6814aa5db69de910824b14462af006fde864224c616ab93e30f646e7309a93f",
|
|
@@ -638,9 +608,7 @@ describe("Eth app biding", () => {
|
|
|
638
608
|
test("signTransaction supports EIP2930", async () => {
|
|
639
609
|
const transport = await openTransportReplayer(
|
|
640
610
|
RecordStore.fromString(`
|
|
641
|
-
=>
|
|
642
|
-
<= 9000
|
|
643
|
-
=> e0048000080000000000000007
|
|
611
|
+
=> e00400009e058000002c8000003c80000000000000000000000001f886030685012a05f20082520894b2bb2b958afa2e96dab3f3ce7162b87daea39017872386f26fc1000080f85bf85994de0b295669a9fd93d5f28d9ec85e40f4cb697baef842a00000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000007
|
|
644
612
|
<= 01a74d82400f49d1f9d85f734c22a1648d4ab74bb6367bef54c6abb0936be3d8b77a84a09673394c3c1bd76be05620ee17a2d0ff32837607625efa433cc017854e9000
|
|
645
613
|
`),
|
|
646
614
|
);
|
|
@@ -661,114 +629,47 @@ describe("Eth app biding", () => {
|
|
|
661
629
|
* if 1inch token is popular again
|
|
662
630
|
might need to put this back, starting at line 2
|
|
663
631
|
=> e00a0000680531494e4348111111111117dc0aa78b770fa6a738034120c3020000001200000001304402204623e5f1375c54a446157ae8a739204284cf053634b7abd083dc5f5d2675c4e702206ff94b4c84ba9e93f44065c38d7c92506621fa69ba04f767aa58221de8afbf17
|
|
664
|
-
<=
|
|
632
|
+
<= 009000
|
|
665
633
|
*/
|
|
666
634
|
const paraswapAPDUs =
|
|
667
635
|
`=> e0120000670850617261737761701bd435f3c054b6e901b7b108a0ab7617c808677bcfc0afeb304402201c0cbe69aac517825b3a6eb5e7251e8fd57ff93a43bd3df52c7a841818eda81b022001a10cc326efaee2463fc96e7c29739c308fb8179bd2ac37303662bae4f7705c
|
|
668
636
|
<= 9000
|
|
669
|
-
=>
|
|
670
|
-
<= 9000
|
|
671
|
-
=> e0048000960000000af10f7eb24f506cfd00000000000000000000000000000000000000000000000002a5b905b3c9fa4c00000000000000000000000000000000000000000000000002baaee8d905020a000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000
|
|
672
|
-
<= 9000
|
|
673
|
-
=> e004800096000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000000
|
|
637
|
+
=> e0040000ff058000002c8000003c800000000000000000000000f903cd82043d8509c765240083042e73941bd435f3c054b6e901b7b108a0ab7617c808677b80b903a4cfc0afeb000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000af10f7eb24f506cfd00000000000000000000000000000000000000000000000002a5b905b3c9fa4c00000000000000000000000000000000000000000000000002baaee8d905020a0000000000000000000000000000000000000000000000000000000000
|
|
674
638
|
<= 9000
|
|
675
|
-
=>
|
|
639
|
+
=> e0048000ff00018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000086d3579b043585a97532514016dcf0c2
|
|
676
640
|
<= 9000
|
|
677
|
-
=>
|
|
641
|
+
=> e0048000ffd6c4b6a100000000000000000000000000000000000000000000000000000000000000c499585aac00000000000000000000000000000000000000000000000af10f7eb24f506cfd000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000000000
|
|
678
642
|
<= 9000
|
|
679
|
-
=>
|
|
680
|
-
<= 9000
|
|
681
|
-
=> e00480006100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000076c65646765723200000000000000000000000000000000000000000000000000018080
|
|
643
|
+
=> e0048000e800000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c40000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000076c65646765723200000000000000000000000000000000000000000000000000018080
|
|
682
644
|
<= 26d9e62b0b6ae0c18d3d2ecdf20ce7f1c959e0f609b4e73e2d138bbdc3e1e9390012469e2124a8955b5159f670b0333b803a70dd7dc51558a8f7460b27eed77be59000`.toLowerCase();
|
|
683
645
|
|
|
684
|
-
test("paraswap", async () => {
|
|
685
|
-
jest.spyOn(axios, "get").mockImplementation(async uri => {
|
|
686
|
-
if (uri?.includes("plugins/ethereum.json")) {
|
|
687
|
-
return {
|
|
688
|
-
data: ParaswapJSON,
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
return null;
|
|
692
|
-
});
|
|
693
|
-
const transport = await openTransportReplayer(RecordStore.fromString(paraswapAPDUs));
|
|
694
|
-
const eth = new Eth(transport);
|
|
695
|
-
const result = await signTxWithResolution(
|
|
696
|
-
eth,
|
|
697
|
-
"44'/60'/0'/0/0",
|
|
698
|
-
"f903cd82043d8509c765240083042e73941bd435f3c054b6e901b7b108a0ab7617c808677b80b903a4cfc0afeb000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000af10f7eb24f506cfd00000000000000000000000000000000000000000000000002a5b905b3c9fa4c00000000000000000000000000000000000000000000000002baaee8d905020a000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000086d3579b043585a97532514016dcf0c2d6c4b6a100000000000000000000000000000000000000000000000000000000000000c499585aac00000000000000000000000000000000000000000000000af10f7eb24f506cfd000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c40000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000076c65646765723200000000000000000000000000000000000000000000000000018080",
|
|
699
|
-
);
|
|
700
|
-
expect(result).toEqual({
|
|
701
|
-
r: "d9e62b0b6ae0c18d3d2ecdf20ce7f1c959e0f609b4e73e2d138bbdc3e1e93900",
|
|
702
|
-
s: "12469e2124a8955b5159f670b0333b803a70dd7dc51558a8f7460b27eed77be5",
|
|
703
|
-
v: "26",
|
|
704
|
-
});
|
|
705
|
-
});
|
|
706
646
|
|
|
707
|
-
test("
|
|
708
|
-
jest.spyOn(axios, "get").mockImplementation(async uri => {
|
|
709
|
-
if (uri?.includes("plugins/ethereum.json")) {
|
|
710
|
-
return { data: ParaswapJSON };
|
|
711
|
-
}
|
|
712
|
-
return null;
|
|
713
|
-
});
|
|
714
|
-
const transport = await openTransportReplayer(
|
|
715
|
-
// behave like paraswap test
|
|
716
|
-
RecordStore.fromString(paraswapAPDUs),
|
|
717
|
-
);
|
|
718
|
-
const eth = new Eth(transport);
|
|
719
|
-
eth.setLoadConfig({
|
|
720
|
-
pluginBaseURL: null,
|
|
721
|
-
extraPlugins: ParaswapJSON,
|
|
722
|
-
});
|
|
723
|
-
const result = await signTxWithResolution(
|
|
724
|
-
eth,
|
|
725
|
-
"44'/60'/0'/0/0",
|
|
726
|
-
"f903cd82043d8509c765240083042e73941bd435f3c054b6e901b7b108a0ab7617c808677b80b903a4cfc0afeb000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000af10f7eb24f506cfd00000000000000000000000000000000000000000000000002a5b905b3c9fa4c00000000000000000000000000000000000000000000000002baaee8d905020a000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000086d3579b043585a97532514016dcf0c2d6c4b6a100000000000000000000000000000000000000000000000000000000000000c499585aac00000000000000000000000000000000000000000000000af10f7eb24f506cfd000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c40000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000076c65646765723200000000000000000000000000000000000000000000000000018080",
|
|
727
|
-
);
|
|
728
|
-
expect(result).toEqual({
|
|
729
|
-
r: "d9e62b0b6ae0c18d3d2ecdf20ce7f1c959e0f609b4e73e2d138bbdc3e1e93900",
|
|
730
|
-
s: "12469e2124a8955b5159f670b0333b803a70dd7dc51558a8f7460b27eed77be5",
|
|
731
|
-
v: "26",
|
|
732
|
-
});
|
|
733
|
-
});
|
|
734
|
-
|
|
735
|
-
test("signTransactionLargeChainID", async () => {
|
|
647
|
+
test("signTransaction Large ChainID (2_716_446_429_837_000)", async () => {
|
|
736
648
|
const transport = await openTransportReplayer(
|
|
737
649
|
RecordStore.fromString(`
|
|
738
|
-
=>
|
|
739
|
-
<=
|
|
650
|
+
=> e004000048058000002c8000003c800000008000000000000000f2018504e3b292008252089428ee52a8f3d6e5d15f8b131996950d7f296c7952872bd72a24874000808709a697f88076c88080
|
|
651
|
+
<= 132ceca22fd700a75d8c18588cc4f5f8ba49ccbe583ddfb48f6b30186977f030312fb2c430662265c56fb09c0fcf0cfebde0e58d1a977d9c012b55c6c6cf66d99e9000
|
|
740
652
|
`),
|
|
741
653
|
);
|
|
742
654
|
const eth = new Eth(transport);
|
|
655
|
+
const transaction = {
|
|
656
|
+
chainId: 2_716_446_429_837_000,
|
|
657
|
+
nonce: 1,
|
|
658
|
+
gasPrice: EthersBigNumber.from("0x4e3b29200"),
|
|
659
|
+
gasLimit: EthersBigNumber.from("0x5208"),
|
|
660
|
+
to: "0x28ee52a8f3d6e5d15f8b131996950d7f296c7952",
|
|
661
|
+
value: EthersBigNumber.from("0x2bd72a24874000"),
|
|
662
|
+
data: "0x",
|
|
663
|
+
};
|
|
743
664
|
const result = await signTxWithResolution(
|
|
744
665
|
eth,
|
|
745
666
|
"44'/60'/0'/0'/0",
|
|
746
|
-
|
|
667
|
+
serializeTransaction(transaction).slice(2),
|
|
747
668
|
);
|
|
748
669
|
expect(result).toEqual({
|
|
749
|
-
r: "
|
|
750
|
-
s: "
|
|
751
|
-
v: "
|
|
752
|
-
});
|
|
753
|
-
});
|
|
754
|
-
|
|
755
|
-
test("signTransactionLargeChainID2", async () => {
|
|
756
|
-
const transport = await openTransportReplayer(
|
|
757
|
-
RecordStore.fromString(`
|
|
758
|
-
=> e004000043058000002c8000003c800000008000000000000000ed018504e3b292008252089428ee52a8f3d6e5d15f8b131996950d7f296c7952872bd72a248740008081fa008080
|
|
759
|
-
<= 173694583045a85ada8d15d5e01b373b00e86a405c9c52f7835691dcc522b7353b30392e638a591c65ed307809825ca48346980f52d004ab7a5f93657f7e62a4009000
|
|
760
|
-
`),
|
|
761
|
-
);
|
|
762
|
-
const eth = new Eth(transport);
|
|
763
|
-
const result = await signTxWithResolution(
|
|
764
|
-
eth,
|
|
765
|
-
"44'/60'/0'/0'/0",
|
|
766
|
-
"ed018504e3b292008252089428ee52a8f3d6e5d15f8b131996950d7f296c7952872bd72a248740008081fa008080",
|
|
767
|
-
);
|
|
768
|
-
expect(result).toEqual({
|
|
769
|
-
r: "3694583045a85ada8d15d5e01b373b00e86a405c9c52f7835691dcc522b7353b",
|
|
770
|
-
s: "30392e638a591c65ed307809825ca48346980f52d004ab7a5f93657f7e62a400",
|
|
771
|
-
v: "0217",
|
|
670
|
+
r: "2ceca22fd700a75d8c18588cc4f5f8ba49ccbe583ddfb48f6b30186977f03031",
|
|
671
|
+
s: "2fb2c430662265c56fb09c0fcf0cfebde0e58d1a977d9c012b55c6c6cf66d99e",
|
|
672
|
+
v: "134d2ff100edb3",
|
|
772
673
|
});
|
|
773
674
|
});
|
|
774
675
|
|
|
@@ -795,12 +696,10 @@ describe("Eth app biding", () => {
|
|
|
795
696
|
test("signTransactionChunkedLimit", async () => {
|
|
796
697
|
const transport = await openTransportReplayer(
|
|
797
698
|
RecordStore.fromString(`
|
|
798
|
-
=>
|
|
799
|
-
<= 9000
|
|
800
|
-
=> e00480009600000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000505846a0a89dd26fa5cd0677fd5406039c218620000000000000000000000000000000000000000000000000000000001f969fc88a4d19062c1525d6ca664dee285aa573c06e0f8bdd4971032d2b63be6183d05300000000000000000000
|
|
699
|
+
=> e0040000ff058000002c8000003c800000000000000000000000f901ad8205448505c205da808310c8e19402b3f51ac9202aa19be63d61a8c681579d6e3a5180b90184293491160000000000000000000000000000000000000000000000000000000005ee832e0000000000000000000000000000000000000000000000000000000005eeb9ac000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000505846a0a89dd26fa5cd0677fd5406039c218620000000000000000000000000000000000000000000000000000000001f
|
|
801
700
|
<= 9000
|
|
802
|
-
=>
|
|
803
|
-
<=
|
|
701
|
+
=> e0048000c6969fc88a4d19062c1525d6ca664dee285aa573c06e0f8bdd4971032d2b63be6183d05300000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000041c4c3f1f8711741f2180d850a09a2933bb21dff1c79caf8c45ecda957836ec7e60d78661c28ad96713e5f22a458376422599bd3776d9aeafc02e319ed0c1b41e51c00000000000000000000000000000000000000000000000000000000000000018080
|
|
702
|
+
<= 26dc6ad1d9d847defdffde2f3b70004c89a1a8a6c614fec484891ae8f1ebc46f9966159ca542f5cf36d64278218bfcce24ba96d7495dec25b10a7609346ca063ec9000
|
|
804
703
|
`), // Incorrect signature but it doesn't matter for tests
|
|
805
704
|
);
|
|
806
705
|
const eth = new Eth(transport);
|
|
@@ -812,17 +711,17 @@ describe("Eth app biding", () => {
|
|
|
812
711
|
expect(result).toEqual({
|
|
813
712
|
r: "dc6ad1d9d847defdffde2f3b70004c89a1a8a6c614fec484891ae8f1ebc46f99",
|
|
814
713
|
s: "66159ca542f5cf36d64278218bfcce24ba96d7495dec25b10a7609346ca063ec",
|
|
815
|
-
v: "
|
|
714
|
+
v: "26",
|
|
816
715
|
});
|
|
817
716
|
});
|
|
818
717
|
|
|
819
718
|
test("signTransactionChunkedLimitBigVRS", async () => {
|
|
820
719
|
const transport = await openTransportReplayer(
|
|
821
720
|
RecordStore.fromString(`
|
|
822
|
-
=>
|
|
721
|
+
=> e0040000ff058000002c8000003c800000000000000000000000f9011782abcd8609184e72a00082271094aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa820300b8edbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
|
823
722
|
<= 9000
|
|
824
|
-
=>
|
|
825
|
-
<=
|
|
723
|
+
=> e004800030bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb258080
|
|
724
|
+
<= 6edc6ad1d9d847defdffde2f3b70004c89a1a8a6c614fec484891ae8f1ebc46f9966159ca542f5cf36d64278218bfcce24ba96d7495dec25b10a7609346ca063ec9000
|
|
826
725
|
`),
|
|
827
726
|
);
|
|
828
727
|
const eth = new Eth(transport);
|
|
@@ -834,7 +733,7 @@ describe("Eth app biding", () => {
|
|
|
834
733
|
expect(result).toEqual({
|
|
835
734
|
r: "dc6ad1d9d847defdffde2f3b70004c89a1a8a6c614fec484891ae8f1ebc46f99",
|
|
836
735
|
s: "66159ca542f5cf36d64278218bfcce24ba96d7495dec25b10a7609346ca063ec",
|
|
837
|
-
v: "
|
|
736
|
+
v: "6e",
|
|
838
737
|
});
|
|
839
738
|
});
|
|
840
739
|
|
|
@@ -894,7 +793,7 @@ describe("Eth app biding", () => {
|
|
|
894
793
|
return {
|
|
895
794
|
data: {
|
|
896
795
|
payload:
|
|
897
|
-
"
|
|
796
|
+
"01010302010113010314010112041dad95c421013c200d6465762e30786b766e2e65746822146cbcd73cd8e8a42844662f0a0e76d7f79afd933d1546304402200247a175329e4025500b6cb62fc466c8876a9e3d3cb681200ae70d5b69afdb2902200a5de51730d17f8d62e10ca4ddfc0b353e8b42e284293c074e4a62f96a7e9f9c",
|
|
898
797
|
},
|
|
899
798
|
};
|
|
900
799
|
}
|
|
@@ -904,11 +803,11 @@ describe("Eth app biding", () => {
|
|
|
904
803
|
RecordStore.fromString(`
|
|
905
804
|
=> e020000000
|
|
906
805
|
<= 1dad95c49000
|
|
907
|
-
=>
|
|
806
|
+
=> e022010084008201010302010113010314010112041dad95c421013c200d6465762e30786b766e2e65746822146cbcd73cd8e8a42844662f0a0e76d7f79afd933d1546304402200247a175329e4025500b6cb62fc466c8876a9e3d3cb681200ae70d5b69afdb2902200a5de51730d17f8d62e10ca4ddfc0b353e8b42e284293c074e4a62f96a7e9f9c
|
|
908
807
|
<= 9000
|
|
909
808
|
=> e00a000068054d415449437d1afa7b718fb893db30a3abc0cfc608aacfebb000000012000000013044022000d8fa7b6e409a0dc55723ba975179e7d1181d1fc78fccbece4e5a264814366a02203927d84a710c8892d02f7386ad20147c75fba4bdd486b0256ecd005770a7ca5b
|
|
910
|
-
<=
|
|
911
|
-
=>
|
|
809
|
+
<= 009000
|
|
810
|
+
=> e004000085058000002c8000003c80000000000000000000000002f86d0146841dcd650085086a18cd7882fd50947d1afa7b718fb893db30a3abc0cfc608aacfebb080b844a9059cbb0000000000000000000000006cbcd73cd8e8a42844662f0a0e76d7f79afd933d0000000000000000000000000000000000000000000000029784d963dbc85a1ec0
|
|
912
811
|
<= 0030c7d7899a892c9370dc43aa15d309805f52319c32daf22406a42ff32ec6013b746d9409a45b70c6e511d9802cc477cebfd7128140ac649371e988f33f3a85559000
|
|
913
812
|
`),
|
|
914
813
|
);
|
|
@@ -916,7 +815,7 @@ describe("Eth app biding", () => {
|
|
|
916
815
|
const result = await signTxWithResolution(
|
|
917
816
|
eth,
|
|
918
817
|
"44'/60'/0'/0/0",
|
|
919
|
-
"
|
|
818
|
+
"02f86d0146841dcd650085086a18cd7882fd50947d1afa7b718fb893db30a3abc0cfc608aacfebb080b844a9059cbb0000000000000000000000006cbcd73cd8e8a42844662f0a0e76d7f79afd933d0000000000000000000000000000000000000000000000029784d963dbc85a1ec0",
|
|
920
819
|
{
|
|
921
820
|
erc20: true,
|
|
922
821
|
nft: true,
|
|
@@ -941,11 +840,11 @@ describe("Eth app biding", () => {
|
|
|
941
840
|
|
|
942
841
|
test("signTransaction NFT with domain", async () => {
|
|
943
842
|
jest.spyOn(axios, "request").mockImplementationOnce(async ({ url }) => {
|
|
944
|
-
if (url?.includes("dev.0xkvn.eth?challenge=
|
|
843
|
+
if (url?.includes("dev.0xkvn.eth?challenge=0x1dad95c4")) {
|
|
945
844
|
return {
|
|
946
845
|
data: {
|
|
947
846
|
payload:
|
|
948
|
-
"
|
|
847
|
+
"01010302010113010314010112041dad95c421013c200d6465762e30786b766e2e65746822146cbcd73cd8e8a42844662f0a0e76d7f79afd933d1546304402200247a175329e4025500b6cb62fc466c8876a9e3d3cb681200ae70d5b69afdb2902200a5de51730d17f8d62e10ca4ddfc0b353e8b42e284293c074e4a62f96a7e9f9c",
|
|
949
848
|
},
|
|
950
849
|
};
|
|
951
850
|
}
|
|
@@ -975,16 +874,16 @@ describe("Eth app biding", () => {
|
|
|
975
874
|
const transport = await openTransportReplayer(
|
|
976
875
|
RecordStore.fromString(`
|
|
977
876
|
=> e020000000
|
|
978
|
-
<=
|
|
979
|
-
=>
|
|
877
|
+
<= 1dad95c49000
|
|
878
|
+
=> e022010084008201010302010113010314010112041dad95c421013c200d6465762e30786b766e2e65746822146cbcd73cd8e8a42844662f0a0e76d7f79afd933d1546304402200247a175329e4025500b6cb62fc466c8876a9e3d3cb681200ae70d5b69afdb2902200a5de51730d17f8d62e10ca4ddfc0b353e8b42e284293c074e4a62f96a7e9f9c
|
|
980
879
|
<= 9000
|
|
981
880
|
=> e01600007301010645524337323160f80121c31a0d46b5279700f9df786054aa5ee5b88d4fde0000000000000001020147304502206224f90b61a09033d06ee1bd2045fb1f2edd26d479890d253229f3c2a1952aef0221008258bbde083cff7eab1e5b3e9dacccbdcf31232cc45740cb510f7aef00ec766e
|
|
982
881
|
<= 9000
|
|
983
882
|
=> e01400006f01010752617269626c6560f80121c31a0d46b5279700f9df786054aa5ee5000000000000000101014630440220587a77c4f5e7cc012e4e5e52548790a87c4eb20321249f3ef61e4018b107beeb02206ec8f371023bc15311c4637eb7ba7153fb9e47f1bb7b30db285f4bf9adaa2454
|
|
984
883
|
<= 9000
|
|
985
|
-
=>
|
|
884
|
+
=> e0040000ff058000002c8000003c80000000000000000000000002f8ee0146841ad27480850912e4364a83023c549460f80121c31a0d46b5279700f9df786054aa5ee580b8c4b88d4fde0000000000000000000000006cbcd73cd8e8a42844662f0a0e76d7f79afd933d0000000000000000000000006cbcd73cd8e8a42844662f0a0e76d7f79afd933d0000000000000000000000000000000000000000000000000000000000112999000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000043078303000000000000000000000000000000000000000000000
|
|
986
885
|
<= 9000
|
|
987
|
-
=>
|
|
886
|
+
=> e004800007000000000000c0
|
|
988
887
|
<= 01d82878b966f8e6fd94b76c942a7735e4668377f9030285aa2177bf77e59a39347f7908439d2968a8cdb261eae4498dbbf6c5808dc4974fc304486b373001a4349000
|
|
989
888
|
`),
|
|
990
889
|
);
|
|
@@ -992,7 +891,7 @@ describe("Eth app biding", () => {
|
|
|
992
891
|
const result = await signTxWithResolution(
|
|
993
892
|
eth,
|
|
994
893
|
"44'/60'/0'/0/0",
|
|
995
|
-
"
|
|
894
|
+
"02f8ee0146841ad27480850912e4364a83023c549460f80121c31a0d46b5279700f9df786054aa5ee580b8c4b88d4fde0000000000000000000000006cbcd73cd8e8a42844662f0a0e76d7f79afd933d0000000000000000000000006cbcd73cd8e8a42844662f0a0e76d7f79afd933d0000000000000000000000000000000000000000000000000000000000112999000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000043078303000000000000000000000000000000000000000000000000000000000c0",
|
|
996
895
|
{
|
|
997
896
|
erc20: true,
|
|
998
897
|
nft: true,
|
|
@@ -1064,11 +963,16 @@ describe("Eth app biding", () => {
|
|
|
1064
963
|
const transport = await openTransportReplayer(
|
|
1065
964
|
RecordStore.fromString(`
|
|
1066
965
|
=> e00a000066035a5258e41d2489571d322189246dafa5ebde1f4699f4980000001200000001304402200ae8634c22762a8ba41d2acb1e068dcce947337c6dd984f13b820d396176952302203306a49d8a6c35b11a61088e1570b3928ca3a0db6bd36f577b5ef87628561ff7
|
|
1067
|
-
<=
|
|
966
|
+
<= 009000
|
|
1068
967
|
`),
|
|
1069
968
|
);
|
|
1070
969
|
const eth = new Eth(transport);
|
|
1071
|
-
const zrxInfo = byContractAddressAndChainId(
|
|
970
|
+
const zrxInfo = byContractAddressAndChainId(
|
|
971
|
+
"0xe41d2489571d322189246dafa5ebde1f4699f498",
|
|
972
|
+
1,
|
|
973
|
+
null,
|
|
974
|
+
{ staticERC20Signatures: { 1: CAL_ETH } },
|
|
975
|
+
)!;
|
|
1072
976
|
const result = await eth.provideERC20TokenInformation(zrxInfo.data.toString("hex"));
|
|
1073
977
|
expect(result).toEqual(true);
|
|
1074
978
|
});
|
|
@@ -1149,22 +1053,27 @@ describe("Eth app biding", () => {
|
|
|
1149
1053
|
const transport = await openTransportReplayer(
|
|
1150
1054
|
RecordStore.fromString(`
|
|
1151
1055
|
=> e00a000066035a5258e41d2489571d322189246dafa5ebde1f4699f4980000001200000001304402200ae8634c22762a8ba41d2acb1e068dcce947337c6dd984f13b820d396176952302203306a49d8a6c35b11a61088e1570b3928ca3a0db6bd36f577b5ef87628561ff7
|
|
1152
|
-
<=
|
|
1056
|
+
<= 009000
|
|
1153
1057
|
=> e00a0000670455534454dac17f958d2ee523a2206206994597c13d831ec700000006000000013044022078c66ccea3e4dedb15a24ec3c783d7b582cd260daf62fd36afe9a8212a344aed0220160ba8c1c4b6a8aa6565bed20632a091aeeeb7bfdac67fc6589a6031acbf511c
|
|
1154
|
-
<=
|
|
1058
|
+
<= 019000
|
|
1155
1059
|
=> f004010091028000534b00000000e41d2489571d322189246dafa5ebde1f4699f4980000000000000000000000000000000000000000000000000000000000000001dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000000000000000000000000000000000000000000001000000010000000100000000000186a00000000000030d4000000d6a00001618
|
|
1156
1060
|
<= 0003c4a1aef46539c90eaad9a71eee8319586e2b749793335060a2431c42d0d48901faac9386aaaf9d8d2cc3229aecf9e202f4b83f63e3fff7426ca07725d10fb29000
|
|
1157
1061
|
`),
|
|
1158
1062
|
);
|
|
1159
1063
|
const eth = new Eth(transport);
|
|
1064
|
+
const loadConfig = { staticERC20Signatures: { 1: CAL_ETH } };
|
|
1160
1065
|
const tokenInfo1 = byContractAddressAndChainId(
|
|
1161
1066
|
"0xe41d2489571d322189246dafa5ebde1f4699f498",
|
|
1162
1067
|
1,
|
|
1068
|
+
null,
|
|
1069
|
+
loadConfig,
|
|
1163
1070
|
)!;
|
|
1164
1071
|
await eth.provideERC20TokenInformation(tokenInfo1.data.toString("hex"));
|
|
1165
1072
|
const tokenInfo2 = byContractAddressAndChainId(
|
|
1166
1073
|
"0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
1167
1074
|
1,
|
|
1075
|
+
null,
|
|
1076
|
+
loadConfig,
|
|
1168
1077
|
)!;
|
|
1169
1078
|
await eth.provideERC20TokenInformation(tokenInfo2.data.toString("hex"));
|
|
1170
1079
|
const result = await eth.starkSignOrder(
|
|
@@ -1190,22 +1099,27 @@ describe("Eth app biding", () => {
|
|
|
1190
1099
|
const transport = await openTransportReplayer(
|
|
1191
1100
|
RecordStore.fromString(`
|
|
1192
1101
|
=> e00a000066035a5258e41d2489571d322189246dafa5ebde1f4699f4980000001200000001304402200ae8634c22762a8ba41d2acb1e068dcce947337c6dd984f13b820d396176952302203306a49d8a6c35b11a61088e1570b3928ca3a0db6bd36f577b5ef87628561ff7
|
|
1193
|
-
<=
|
|
1102
|
+
<= 009000
|
|
1194
1103
|
=> e00a0000670455534454dac17f958d2ee523a2206206994597c13d831ec700000006000000013044022078c66ccea3e4dedb15a24ec3c783d7b582cd260daf62fd36afe9a8212a344aed0220160ba8c1c4b6a8aa6565bed20632a091aeeeb7bfdac67fc6589a6031acbf511c
|
|
1195
|
-
<=
|
|
1104
|
+
<= 019000
|
|
1196
1105
|
=> f0040300d3028000534b0000000002e41d2489571d322189246dafa5ebde1f4699f4980000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000002dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000010000000100000000000186a00000000000030d4000000d6a00001618
|
|
1197
1106
|
<= 0003c4a1aef46539c90eaad9a71eee8319586e2b749793335060a2431c42d0d48901faac9386aaaf9d8d2cc3229aecf9e202f4b83f63e3fff7426ca07725d10fb29000
|
|
1198
1107
|
`),
|
|
1199
1108
|
);
|
|
1200
1109
|
const eth = new Eth(transport);
|
|
1110
|
+
const loadConfig = { staticERC20Signatures: { 1: CAL_ETH } };
|
|
1201
1111
|
const tokenInfo1 = byContractAddressAndChainId(
|
|
1202
1112
|
"0xe41d2489571d322189246dafa5ebde1f4699f498",
|
|
1203
1113
|
1,
|
|
1114
|
+
null,
|
|
1115
|
+
loadConfig,
|
|
1204
1116
|
)!;
|
|
1205
1117
|
await eth.provideERC20TokenInformation(tokenInfo1.data.toString("hex"));
|
|
1206
1118
|
const tokenInfo2 = byContractAddressAndChainId(
|
|
1207
1119
|
"0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
1208
1120
|
1,
|
|
1121
|
+
null,
|
|
1122
|
+
loadConfig,
|
|
1209
1123
|
)!;
|
|
1210
1124
|
await eth.provideERC20TokenInformation(tokenInfo2.data.toString("hex"));
|
|
1211
1125
|
const result = await eth.starkSignOrder_v2(
|
|
@@ -1282,6 +1196,7 @@ describe("Eth app biding", () => {
|
|
|
1282
1196
|
s: "0305fe1782f050839619c3e9627121bacd3a8dc87859e1ba5376fbd1b3bee4d4",
|
|
1283
1197
|
});
|
|
1284
1198
|
});
|
|
1199
|
+
|
|
1285
1200
|
test("starkProvideQuantum", async () => {
|
|
1286
1201
|
const transport = await openTransportReplayer(
|
|
1287
1202
|
RecordStore.fromString(`
|
|
@@ -1296,6 +1211,7 @@ describe("Eth app biding", () => {
|
|
|
1296
1211
|
);
|
|
1297
1212
|
expect(result).toEqual(true);
|
|
1298
1213
|
});
|
|
1214
|
+
|
|
1299
1215
|
test("starkProvideQuantum_v2", async () => {
|
|
1300
1216
|
const transport = await openTransportReplayer(
|
|
1301
1217
|
RecordStore.fromString(`
|
|
@@ -1311,6 +1227,7 @@ describe("Eth app biding", () => {
|
|
|
1311
1227
|
);
|
|
1312
1228
|
expect(result).toEqual(true);
|
|
1313
1229
|
});
|
|
1230
|
+
|
|
1314
1231
|
test("starkDepositEth", async () => {
|
|
1315
1232
|
const transport = await openTransportReplayer(
|
|
1316
1233
|
RecordStore.fromString(`
|
|
@@ -1333,16 +1250,15 @@ describe("Eth app biding", () => {
|
|
|
1333
1250
|
v: "1b",
|
|
1334
1251
|
});
|
|
1335
1252
|
});
|
|
1253
|
+
|
|
1336
1254
|
test("starkDepositToken", async () => {
|
|
1337
1255
|
const transport = await openTransportReplayer(
|
|
1338
1256
|
RecordStore.fromString(`
|
|
1339
1257
|
=> e00a0000670455534454dac17f958d2ee523a2206206994597c13d831ec700000006000000013044022078c66ccea3e4dedb15a24ec3c783d7b582cd260daf62fd36afe9a8212a344aed0220160ba8c1c4b6a8aa6565bed20632a091aeeeb7bfdac67fc6589a6031acbf511c
|
|
1340
|
-
<=
|
|
1258
|
+
<= 009000
|
|
1341
1259
|
=> f008000034dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000000000000000000000000000000000000000000001
|
|
1342
1260
|
<= 9000
|
|
1343
|
-
=>
|
|
1344
|
-
<= 9000
|
|
1345
|
-
=> e00480000e0000000000000000000000030d40
|
|
1261
|
+
=> e0040000a4058000002c8000003c800000000000000000000000f88d018504e3b29200825208940102030405060708090a0b0c0d0e0f1011121314872bd72a24874000b86400aeef8a02ce625e94458d39dd0bf3b45a843544dd4a14b8169045a3a3d15aa564b936c500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000030d40
|
|
1346
1262
|
<= 1b294214de6341a0a63609f5643700c58be4b7aa46a5f56dea8c9ff5ecf4d5228662a3a4c8a6a0714d147b2a98071cfb892ed3f3edd5da049a2608605970b63dc29000
|
|
1347
1263
|
`),
|
|
1348
1264
|
);
|
|
@@ -1350,6 +1266,8 @@ describe("Eth app biding", () => {
|
|
|
1350
1266
|
const tokenInfo = byContractAddressAndChainId(
|
|
1351
1267
|
"0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
1352
1268
|
1,
|
|
1269
|
+
null,
|
|
1270
|
+
{ staticERC20Signatures: { 1: CAL_ETH } },
|
|
1353
1271
|
)!;
|
|
1354
1272
|
await eth.provideERC20TokenInformation(tokenInfo.data.toString("hex"));
|
|
1355
1273
|
await eth.starkProvideQuantum("0xdac17f958d2ee523a2206206994597c13d831ec7", new BigNumber(1));
|
|
@@ -1364,6 +1282,7 @@ describe("Eth app biding", () => {
|
|
|
1364
1282
|
v: "1b",
|
|
1365
1283
|
});
|
|
1366
1284
|
});
|
|
1285
|
+
|
|
1367
1286
|
test("starkWithdrawEth", async () => {
|
|
1368
1287
|
const transport = await openTransportReplayer(
|
|
1369
1288
|
RecordStore.fromString(`
|
|
@@ -1386,11 +1305,12 @@ describe("Eth app biding", () => {
|
|
|
1386
1305
|
v: "1b",
|
|
1387
1306
|
});
|
|
1388
1307
|
});
|
|
1308
|
+
|
|
1389
1309
|
test("starkWithdrawToken", async () => {
|
|
1390
1310
|
const transport = await openTransportReplayer(
|
|
1391
1311
|
RecordStore.fromString(`
|
|
1392
1312
|
=> e00a0000670455534454dac17f958d2ee523a2206206994597c13d831ec700000006000000013044022078c66ccea3e4dedb15a24ec3c783d7b582cd260daf62fd36afe9a8212a344aed0220160ba8c1c4b6a8aa6565bed20632a091aeeeb7bfdac67fc6589a6031acbf511c
|
|
1393
|
-
<=
|
|
1313
|
+
<= 009000
|
|
1394
1314
|
=> f008000034dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000000000000000000000000000000000000000000001
|
|
1395
1315
|
<= 9000
|
|
1396
1316
|
=> e004000063058000002c8000003c800000000000000000000000f84c018504e3b29200825208940102030405060708090a0b0c0d0e0f1011121314872bd72a24874000a42e1a7d4d02ce625e94458d39dd0bf3b45a843544dd4a14b8169045a3a3d15aa564b936c5
|
|
@@ -1401,6 +1321,8 @@ describe("Eth app biding", () => {
|
|
|
1401
1321
|
const tokenInfo = byContractAddressAndChainId(
|
|
1402
1322
|
"0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
1403
1323
|
1,
|
|
1324
|
+
null,
|
|
1325
|
+
{ staticERC20Signatures: { 1: CAL_ETH } },
|
|
1404
1326
|
)!;
|
|
1405
1327
|
await eth.provideERC20TokenInformation(tokenInfo.data.toString("hex"));
|
|
1406
1328
|
await eth.starkProvideQuantum("0xdac17f958d2ee523a2206206994597c13d831ec7", new BigNumber(1));
|
|
@@ -1415,6 +1337,7 @@ describe("Eth app biding", () => {
|
|
|
1415
1337
|
v: "1b",
|
|
1416
1338
|
});
|
|
1417
1339
|
});
|
|
1340
|
+
|
|
1418
1341
|
test("starkDepositCancel", async () => {
|
|
1419
1342
|
const transport = await openTransportReplayer(
|
|
1420
1343
|
RecordStore.fromString(`
|
|
@@ -1437,6 +1360,7 @@ describe("Eth app biding", () => {
|
|
|
1437
1360
|
v: "1c",
|
|
1438
1361
|
});
|
|
1439
1362
|
});
|
|
1363
|
+
|
|
1440
1364
|
test("starkDepositReclaim", async () => {
|
|
1441
1365
|
const transport = await openTransportReplayer(
|
|
1442
1366
|
RecordStore.fromString(`
|
|
@@ -1459,6 +1383,7 @@ describe("Eth app biding", () => {
|
|
|
1459
1383
|
v: "1b",
|
|
1460
1384
|
});
|
|
1461
1385
|
});
|
|
1386
|
+
|
|
1462
1387
|
test("starkFullWithdrawal", async () => {
|
|
1463
1388
|
const transport = await openTransportReplayer(
|
|
1464
1389
|
RecordStore.fromString(`
|
|
@@ -1478,6 +1403,7 @@ describe("Eth app biding", () => {
|
|
|
1478
1403
|
v: "1b",
|
|
1479
1404
|
});
|
|
1480
1405
|
});
|
|
1406
|
+
|
|
1481
1407
|
test("starkFreeze", async () => {
|
|
1482
1408
|
const transport = await openTransportReplayer(
|
|
1483
1409
|
RecordStore.fromString(`
|
|
@@ -1497,14 +1423,13 @@ describe("Eth app biding", () => {
|
|
|
1497
1423
|
v: "1b",
|
|
1498
1424
|
});
|
|
1499
1425
|
});
|
|
1426
|
+
|
|
1500
1427
|
test("starkEscapeEth", async () => {
|
|
1501
1428
|
const transport = await openTransportReplayer(
|
|
1502
1429
|
RecordStore.fromString(`
|
|
1503
1430
|
=> f00800003400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
|
|
1504
1431
|
<= 9000
|
|
1505
|
-
=>
|
|
1506
|
-
<= 9000
|
|
1507
|
-
=> e00480002e2b811f56f27130937c267e29bd9e00000000000000000000000000000000000000000000000000000000000186a0
|
|
1432
|
+
=> e0040000c4058000002c8000003c800000000000000000000000f8ad018504e3b29200825208940102030405060708090a0b0c0d0e0f1011121314872bd72a24874000b8849e3adac40000000000000000000000000000000000000000000000000000000000000001010101010101010101010101010101010101010101010101010101010101010101142460171646987f20c714eda4b92812b22b811f56f27130937c267e29bd9e00000000000000000000000000000000000000000000000000000000000186a0
|
|
1508
1433
|
<= 1c77220f9513431ecb2eeb53edee025eb78f1fd3c194d75f4988462b78bacd88b43e74b88584f9091a4bdb2605ec128e2bda7eaa262891bf83bb7b34acf22c6a9c9000
|
|
1509
1434
|
`),
|
|
1510
1435
|
);
|
|
@@ -1521,16 +1446,15 @@ describe("Eth app biding", () => {
|
|
|
1521
1446
|
v: "1c",
|
|
1522
1447
|
});
|
|
1523
1448
|
});
|
|
1449
|
+
|
|
1524
1450
|
test("starkEscapeTokens", async () => {
|
|
1525
1451
|
const transport = await openTransportReplayer(
|
|
1526
1452
|
RecordStore.fromString(`
|
|
1527
1453
|
=> e00a0000670455534454dac17f958d2ee523a2206206994597c13d831ec700000006000000013044022078c66ccea3e4dedb15a24ec3c783d7b582cd260daf62fd36afe9a8212a344aed0220160ba8c1c4b6a8aa6565bed20632a091aeeeb7bfdac67fc6589a6031acbf511c
|
|
1528
|
-
<=
|
|
1454
|
+
<= 009000
|
|
1529
1455
|
=> f008000034dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000000000000000000000000000000000000000000001
|
|
1530
1456
|
<= 9000
|
|
1531
|
-
=>
|
|
1532
|
-
<= 9000
|
|
1533
|
-
=> e00480002e14b8169045a3a3d15aa564b936c50000000000000000000000000000000000000000000000000000000000030d40
|
|
1457
|
+
=> e0040000c4058000002c8000003c800000000000000000000000f8ad018504e3b29200825208940102030405060708090a0b0c0d0e0f1011121314872bd72a24874000b8849e3adac40000000000000000000000000000000000000000000000000000000000000001010101010101010101010101010101010101010101010101010101010101010102ce625e94458d39dd0bf3b45a843544dd4a14b8169045a3a3d15aa564b936c50000000000000000000000000000000000000000000000000000000000030d40
|
|
1534
1458
|
<= 1c56846c1ec5ce862f0abb59054ae9a5279ddac47953907902a0dada43b9a0e06b35ad5523cf0b01efa3a369c24b80cd003f87a2f725cf40ecc2354290fc8369a29000
|
|
1535
1459
|
`),
|
|
1536
1460
|
);
|
|
@@ -1538,6 +1462,8 @@ describe("Eth app biding", () => {
|
|
|
1538
1462
|
const tokenInfo = byContractAddressAndChainId(
|
|
1539
1463
|
"0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
1540
1464
|
1,
|
|
1465
|
+
null,
|
|
1466
|
+
{ staticERC20Signatures: { 1: CAL_ETH } },
|
|
1541
1467
|
)!;
|
|
1542
1468
|
await eth.provideERC20TokenInformation(tokenInfo.data.toString("hex"));
|
|
1543
1469
|
await eth.starkProvideQuantum("0xdac17f958d2ee523a2206206994597c13d831ec7", new BigNumber(1));
|
|
@@ -1552,12 +1478,11 @@ describe("Eth app biding", () => {
|
|
|
1552
1478
|
v: "1c",
|
|
1553
1479
|
});
|
|
1554
1480
|
});
|
|
1481
|
+
|
|
1555
1482
|
test("starkEscapeVerify", async () => {
|
|
1556
1483
|
const transport = await openTransportReplayer(
|
|
1557
1484
|
RecordStore.fromString(`
|
|
1558
|
-
=>
|
|
1559
|
-
<= 9000
|
|
1560
|
-
=> e00480000e0000000000000000000000030d40
|
|
1485
|
+
=> e0040000a4058000002c8000003c800000000000000000000000f88d018504e3b29200825208940102030405060708090a0b0c0d0e0f1011121314872bd72a24874000b8642dd5300602ce625e94458d39dd0bf3b45a843544dd4a14b8169045a3a3d15aa564b936c500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000030d40
|
|
1561
1486
|
<= 1b372586695f148927a74b6ef4b2e40f42b3a6e44afbd16cb4d3dcec6859aec1d2736da27ba0a716492e96ebd6cbbaec894af5cad24a2c6c3f683ade376f9fdc4f9000
|
|
1562
1487
|
`),
|
|
1563
1488
|
);
|
|
@@ -1573,6 +1498,7 @@ describe("Eth app biding", () => {
|
|
|
1573
1498
|
v: "1b",
|
|
1574
1499
|
});
|
|
1575
1500
|
});
|
|
1501
|
+
|
|
1576
1502
|
test("eth2GetPublicKey", async () => {
|
|
1577
1503
|
const transport = await openTransportReplayer(
|
|
1578
1504
|
RecordStore.fromString(`
|
|
@@ -1587,6 +1513,7 @@ describe("Eth app biding", () => {
|
|
|
1587
1513
|
"a0fcd39edaa082bdbf23a0c01568471b8a2bd998c9ae347f7e7690e420bd2f96e436c215422aa86f233f67cbbdfb9b2f",
|
|
1588
1514
|
});
|
|
1589
1515
|
});
|
|
1516
|
+
|
|
1590
1517
|
test("eth2SetWithdrawalIndex", async () => {
|
|
1591
1518
|
const transport = await openTransportReplayer(
|
|
1592
1519
|
RecordStore.fromString(`
|
|
@@ -1598,6 +1525,7 @@ describe("Eth app biding", () => {
|
|
|
1598
1525
|
const result = await eth.eth2SetWithdrawalIndex(1);
|
|
1599
1526
|
expect(result).toEqual(true);
|
|
1600
1527
|
});
|
|
1528
|
+
|
|
1601
1529
|
test("getEIP1024PublicEncryptionKey", async () => {
|
|
1602
1530
|
const transport = await openTransportReplayer(
|
|
1603
1531
|
RecordStore.fromString(`
|