@ledgerhq/hw-app-eth 6.6.0 → 6.8.2
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/README.md +3 -0
- package/lib/Eth.d.ts +4 -1
- package/lib/Eth.d.ts.map +1 -1
- package/lib/Eth.js +8 -3
- package/lib/Eth.js.map +1 -1
- package/lib/contracts.d.ts +5 -1
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js +37 -9
- package/lib/contracts.js.map +1 -1
- package/lib-es/Eth.d.ts +4 -1
- package/lib-es/Eth.d.ts.map +1 -1
- package/lib-es/Eth.js +8 -3
- package/lib-es/Eth.js.map +1 -1
- package/lib-es/contracts.d.ts +5 -1
- package/lib-es/contracts.d.ts.map +1 -1
- package/lib-es/contracts.js +37 -9
- package/lib-es/contracts.js.map +1 -1
- package/package.json +6 -6
- package/src/Eth.ts +19 -3
- package/src/contracts.ts +42 -10
- package/tests/Eth.test.ts +62 -23
- package/tests/paraswap.json +1256 -0
package/lib-es/contracts.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
13
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
14
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -35,23 +46,40 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
46
|
}
|
|
36
47
|
};
|
|
37
48
|
import axios from "axios";
|
|
49
|
+
var defaultPluginsLoadConfig = {
|
|
50
|
+
baseURL: "https://cdn.live.ledger.com",
|
|
51
|
+
extraPlugins: null
|
|
52
|
+
};
|
|
38
53
|
/**
|
|
39
54
|
* Retrieve the metadatas a given contract address and a method selector
|
|
40
55
|
*/
|
|
41
|
-
export var loadInfosForContractMethod = function (contractAddress, selector) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
-
var data, lcSelector, lcContractAddress, contractSelectors;
|
|
43
|
-
return __generator(this, function (
|
|
44
|
-
switch (
|
|
45
|
-
case 0:
|
|
46
|
-
|
|
56
|
+
export var loadInfosForContractMethod = function (contractAddress, selector, chainId, userPluginsLoadConfig) { return __awaiter(void 0, void 0, void 0, function () {
|
|
57
|
+
var _a, baseURL, extraPlugins, data, _b, lcSelector, lcContractAddress, contractSelectors;
|
|
58
|
+
return __generator(this, function (_c) {
|
|
59
|
+
switch (_c.label) {
|
|
60
|
+
case 0:
|
|
61
|
+
_a = __assign(__assign({}, defaultPluginsLoadConfig), userPluginsLoadConfig), baseURL = _a.baseURL, extraPlugins = _a.extraPlugins;
|
|
62
|
+
if (!!baseURL) return [3 /*break*/, 1];
|
|
63
|
+
_b = {};
|
|
64
|
+
return [3 /*break*/, 3];
|
|
65
|
+
case 1: return [4 /*yield*/, axios
|
|
66
|
+
.get(baseURL + "/plugins/ethereum.json")
|
|
47
67
|
.then(function (r) { return r.data; })["catch"](function (e) {
|
|
48
|
-
if (e.response &&
|
|
68
|
+
if (e.response &&
|
|
69
|
+
400 <= e.response.status &&
|
|
70
|
+
e.response.status < 500) {
|
|
49
71
|
return null; // not found cases can be ignored to allow future changes in endpoint without failing a signature to be done.
|
|
50
72
|
}
|
|
51
73
|
throw e;
|
|
52
74
|
})];
|
|
53
|
-
case
|
|
54
|
-
|
|
75
|
+
case 2:
|
|
76
|
+
_b = _c.sent();
|
|
77
|
+
_c.label = 3;
|
|
78
|
+
case 3:
|
|
79
|
+
data = _b;
|
|
80
|
+
if (extraPlugins) {
|
|
81
|
+
data = __assign(__assign({}, data), extraPlugins);
|
|
82
|
+
}
|
|
55
83
|
if (!data)
|
|
56
84
|
return [2 /*return*/];
|
|
57
85
|
lcSelector = selector.toLowerCase();
|
package/lib-es/contracts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAoB1B,IAAM,wBAAwB,GAAG;IAC/B,OAAO,EAAE,6BAA6B;IACtC,YAAY,EAAE,IAAI;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,IAAM,0BAA0B,GAAG,UACxC,eAAuB,EACvB,QAAgB,EAChB,OAAe,EACf,qBAAwC;;;;;gBAElC,2BACD,wBAAwB,GACxB,qBAAqB,CACzB,EAHO,OAAO,aAAA,EAAE,YAAY,kBAAA,CAG3B;qBACS,CAAC,OAAO,EAAR,wBAAQ;gBACf,KAAA,EAAE,CAAA;;oBACF,qBAAM,KAAK;qBACR,GAAG,CAAI,OAAO,2BAAwB,CAAC;qBACvC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC,CACnB,OAAK,CAAA,CAAC,UAAC,CAAC;oBACP,IACE,CAAC,CAAC,QAAQ;wBACV,GAAG,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM;wBACxB,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,EACvB;wBACA,OAAO,IAAI,CAAC,CAAC,6GAA6G;qBAC3H;oBACD,MAAM,CAAC,CAAC;gBACV,CAAC,CAAC,EAAA;;gBAZJ,KAAA,SAYI,CAAA;;;gBAdJ,IAAI,KAcA;gBAER,IAAI,YAAY,EAAE;oBAChB,IAAI,yBAAQ,IAAI,GAAK,YAAY,CAAE,CAAC;iBACrC;gBAED,IAAI,CAAC,IAAI;oBAAE,sBAAO;gBAEZ,UAAU,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;gBACpC,iBAAiB,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;gBAExD,IAAI,iBAAiB,IAAI,IAAI,EAAE;oBACvB,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC;oBAElD,IAAI,UAAU,IAAI,iBAAiB,EAAE;wBACnC,sBAAO;gCACL,OAAO,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,iBAAiB,CAAC;gCACzD,SAAS,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC;gCACrD,MAAM,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC;gCAC/C,eAAe,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,iBAAiB,CAAC;gCACjE,GAAG,EAAE,iBAAiB,CAAC,KAAK,CAAC;6BAC9B,EAAC;qBACH;iBACF;;;;KACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/hw-app-eth",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.2",
|
|
4
4
|
"description": "Ledger Hardware Wallet Ethereum Application API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"types": "lib/Eth.d.ts",
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@ledgerhq/cryptoassets": "^6.
|
|
30
|
+
"@ledgerhq/cryptoassets": "^6.8.1",
|
|
31
31
|
"@ledgerhq/errors": "^6.2.0",
|
|
32
|
-
"@ledgerhq/hw-transport": "^6.
|
|
32
|
+
"@ledgerhq/hw-transport": "^6.7.0",
|
|
33
33
|
"@ledgerhq/logs": "^6.2.0",
|
|
34
|
-
"axios": "^0.21.
|
|
34
|
+
"axios": "^0.21.4",
|
|
35
35
|
"bignumber.js": "^9.0.1",
|
|
36
|
-
"ethers": "^5.4.
|
|
36
|
+
"ethers": "^5.4.7"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"clean": "bash ../../script/clean.sh",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"watch": "bash ../../script/watch.sh",
|
|
42
42
|
"doc": "bash ../../script/doc.sh"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "e93a2c7858b220c8e933ecfb24dccb1e62d195f2"
|
|
45
45
|
}
|
package/src/Eth.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { BigNumber } from "bignumber.js";
|
|
|
23
23
|
import { ethers } from "ethers";
|
|
24
24
|
import { byContractAddressAndChainId } from "./erc20";
|
|
25
25
|
import { loadInfosForContractMethod } from "./contracts";
|
|
26
|
+
import type { PluginsLoadConfig } from "./contracts";
|
|
26
27
|
|
|
27
28
|
export type StarkQuantizationType =
|
|
28
29
|
| "eth"
|
|
@@ -52,7 +53,7 @@ function maybeHexBuffer(
|
|
|
52
53
|
const remapTransactionRelatedErrors = (e) => {
|
|
53
54
|
if (e && e.statusCode === 0x6a80) {
|
|
54
55
|
return new EthAppPleaseEnableContractData(
|
|
55
|
-
"Please enable Contract data
|
|
56
|
+
"Please enable Blind signing or Contract data in the Ethereum app Settings"
|
|
56
57
|
);
|
|
57
58
|
}
|
|
58
59
|
|
|
@@ -68,9 +69,19 @@ const remapTransactionRelatedErrors = (e) => {
|
|
|
68
69
|
|
|
69
70
|
export default class Eth {
|
|
70
71
|
transport: Transport;
|
|
72
|
+
pluginsLoadConfig: PluginsLoadConfig;
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
setPluginsLoadConfig(pluginsLoadConfig: PluginsLoadConfig): void {
|
|
75
|
+
this.pluginsLoadConfig = pluginsLoadConfig;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
constructor(
|
|
79
|
+
transport: Transport,
|
|
80
|
+
scrambleKey = "w0w",
|
|
81
|
+
pluginsLoadConfig: PluginsLoadConfig = {}
|
|
82
|
+
) {
|
|
73
83
|
this.transport = transport;
|
|
84
|
+
this.pluginsLoadConfig = pluginsLoadConfig;
|
|
74
85
|
transport.decorateAppAPIMethods(
|
|
75
86
|
this,
|
|
76
87
|
[
|
|
@@ -313,7 +324,12 @@ export default class Eth {
|
|
|
313
324
|
|
|
314
325
|
if (decodedTx.data.length >= 10) {
|
|
315
326
|
const selector = decodedTx.data.substring(0, 10);
|
|
316
|
-
const infos = await loadInfosForContractMethod(
|
|
327
|
+
const infos = await loadInfosForContractMethod(
|
|
328
|
+
decodedTx.to,
|
|
329
|
+
selector,
|
|
330
|
+
chainIdTruncated,
|
|
331
|
+
this.pluginsLoadConfig
|
|
332
|
+
);
|
|
317
333
|
|
|
318
334
|
if (infos) {
|
|
319
335
|
const { plugin, payload, signature, erc20OfInterest, abi } = infos;
|
package/src/contracts.ts
CHANGED
|
@@ -8,22 +8,54 @@ type ContractMethod = {
|
|
|
8
8
|
abi: any;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
+
// example of payload https://cdn.live.ledger.com/plugins/ethereum/1.json
|
|
12
|
+
export type PluginsLoadConfig = {
|
|
13
|
+
// fetch against an api (base url is an api that hosts /plugins/ethereum/${chainId}.json )
|
|
14
|
+
// set to null will disable it
|
|
15
|
+
baseURL?: string | null;
|
|
16
|
+
// provide manually some extra plugins to add for the resolution (e.g. for dev purpose)
|
|
17
|
+
// object will be merged with the returned value of the Ledger cdn payload
|
|
18
|
+
extraPlugins?: any | null;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const defaultPluginsLoadConfig = {
|
|
22
|
+
baseURL: "https://cdn.live.ledger.com",
|
|
23
|
+
extraPlugins: null,
|
|
24
|
+
};
|
|
25
|
+
|
|
11
26
|
/**
|
|
12
27
|
* Retrieve the metadatas a given contract address and a method selector
|
|
13
28
|
*/
|
|
14
29
|
export const loadInfosForContractMethod = async (
|
|
15
30
|
contractAddress: string,
|
|
16
|
-
selector: string
|
|
31
|
+
selector: string,
|
|
32
|
+
chainId: number,
|
|
33
|
+
userPluginsLoadConfig: PluginsLoadConfig
|
|
17
34
|
): Promise<ContractMethod | undefined> => {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
35
|
+
const { baseURL, extraPlugins } = {
|
|
36
|
+
...defaultPluginsLoadConfig,
|
|
37
|
+
...userPluginsLoadConfig,
|
|
38
|
+
};
|
|
39
|
+
let data = !baseURL
|
|
40
|
+
? {}
|
|
41
|
+
: await axios
|
|
42
|
+
.get(`${baseURL}/plugins/ethereum.json`)
|
|
43
|
+
.then((r) => r.data)
|
|
44
|
+
.catch((e) => {
|
|
45
|
+
if (
|
|
46
|
+
e.response &&
|
|
47
|
+
400 <= e.response.status &&
|
|
48
|
+
e.response.status < 500
|
|
49
|
+
) {
|
|
50
|
+
return null; // not found cases can be ignored to allow future changes in endpoint without failing a signature to be done.
|
|
51
|
+
}
|
|
52
|
+
throw e;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (extraPlugins) {
|
|
56
|
+
data = { ...data, ...extraPlugins };
|
|
57
|
+
}
|
|
58
|
+
|
|
27
59
|
if (!data) return;
|
|
28
60
|
|
|
29
61
|
const lcSelector = selector.toLowerCase();
|
package/tests/Eth.test.ts
CHANGED
|
@@ -6,7 +6,7 @@ import Eth from "../src/Eth";
|
|
|
6
6
|
import { TokenInfo } from "../src/erc20";
|
|
7
7
|
import { BigNumber } from "bignumber.js";
|
|
8
8
|
import { byContractAddressAndChainId } from "../src/erc20";
|
|
9
|
-
import
|
|
9
|
+
import paraswapJSON from "./paraswap.json";
|
|
10
10
|
|
|
11
11
|
test("getAppConfiguration", async () => {
|
|
12
12
|
const transport = await openTransportReplayer(
|
|
@@ -125,32 +125,71 @@ test("signTransaction supports EIP2930", async () => {
|
|
|
125
125
|
});
|
|
126
126
|
});
|
|
127
127
|
|
|
128
|
+
const paraswapAPDUs = `=> e0120000670850617261737761701bd435f3c054b6e901b7b108a0ab7617c808677bcfc0afeb304402201c0cbe69aac517825b3a6eb5e7251e8fd57ff93a43bd3df52c7a841818eda81b022001a10cc326efaee2463fc96e7c29739c308fb8179bd2ac37303662bae4f7705c
|
|
129
|
+
<= 9000
|
|
130
|
+
=> e00a0000680531494e4348111111111117dc0aa78b770fa6a738034120c3020000001200000001304402204623e5f1375c54a446157ae8a739204284cf053634b7abd083dc5f5d2675c4e702206ff94b4c84ba9e93f44065c38d7c92506621fa69ba04f767aa58221de8afbf17
|
|
131
|
+
<= 9000
|
|
132
|
+
=> e004000096058000002c8000003c800000000000000000000000f903cd82043d8509c765240083042e73941bd435f3c054b6e901b7b108a0ab7617c808677b80b903a4cfc0afeb000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000
|
|
133
|
+
<= 9000
|
|
134
|
+
=> e0048000960000000af10f7eb24f506cfd00000000000000000000000000000000000000000000000002a5b905b3c9fa4c00000000000000000000000000000000000000000000000002baaee8d905020a000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000
|
|
135
|
+
<= 9000
|
|
136
|
+
=> e004800096000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000000
|
|
137
|
+
<= 9000
|
|
138
|
+
=> e004800096000000000000000000000000000000000000000000000000000000000000000100000000000000000000000086d3579b043585a97532514016dcf0c2d6c4b6a100000000000000000000000000000000000000000000000000000000000000c499585aac00000000000000000000000000000000000000000000000af10f7eb24f506cfd000000000000000000000000000000000000
|
|
139
|
+
<= 9000
|
|
140
|
+
=> e004800096000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000
|
|
141
|
+
<= 9000
|
|
142
|
+
=> e00480009600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000010000
|
|
143
|
+
<= 9000
|
|
144
|
+
=> e00480006100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000076c65646765723200000000000000000000000000000000000000000000000000018080
|
|
145
|
+
<= 26d9e62b0b6ae0c18d3d2ecdf20ce7f1c959e0f609b4e73e2d138bbdc3e1e9390012469e2124a8955b5159f670b0333b803a70dd7dc51558a8f7460b27eed77be59000`.toLowerCase();
|
|
146
|
+
|
|
128
147
|
test("paraswap", async () => {
|
|
129
148
|
const transport = await openTransportReplayer(
|
|
130
|
-
RecordStore.fromString(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
=> e00480006100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000076c65646765723200000000000000000000000000000000000000000000000000018080
|
|
149
|
-
<= 26d9e62b0b6ae0c18d3d2ecdf20ce7f1c959e0f609b4e73e2d138bbdc3e1e9390012469e2124a8955b5159f670b0333b803a70dd7dc51558a8f7460b27eed77be59000
|
|
150
|
-
`.toLowerCase()
|
|
151
|
-
)
|
|
149
|
+
RecordStore.fromString(paraswapAPDUs)
|
|
150
|
+
);
|
|
151
|
+
const eth = new Eth(transport);
|
|
152
|
+
const result = await eth.signTransaction(
|
|
153
|
+
"44'/60'/0'/0/0",
|
|
154
|
+
"f903cd82043d8509c765240083042e73941bd435f3c054b6e901b7b108a0ab7617c808677b80b903a4cfc0afeb000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000af10f7eb24f506cfd00000000000000000000000000000000000000000000000002a5b905b3c9fa4c00000000000000000000000000000000000000000000000002baaee8d905020a000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000086d3579b043585a97532514016dcf0c2d6c4b6a100000000000000000000000000000000000000000000000000000000000000c499585aac00000000000000000000000000000000000000000000000af10f7eb24f506cfd000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c40000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000076c65646765723200000000000000000000000000000000000000000000000000018080"
|
|
155
|
+
);
|
|
156
|
+
expect(result).toEqual({
|
|
157
|
+
r: "d9e62b0b6ae0c18d3d2ecdf20ce7f1c959e0f609b4e73e2d138bbdc3e1e93900",
|
|
158
|
+
s: "12469e2124a8955b5159f670b0333b803a70dd7dc51558a8f7460b27eed77be5",
|
|
159
|
+
v: "26",
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test("paraswap without plugins", async () => {
|
|
164
|
+
const transport = await openTransportReplayer(
|
|
165
|
+
// skip 2 first apdu that is used for plugins
|
|
166
|
+
RecordStore.fromString(paraswapAPDUs.split("\n").slice(4).join("\n"))
|
|
152
167
|
);
|
|
153
168
|
const eth = new Eth(transport);
|
|
169
|
+
eth.setPluginsLoadConfig({
|
|
170
|
+
baseURL: null,
|
|
171
|
+
});
|
|
172
|
+
const result = await eth.signTransaction(
|
|
173
|
+
"44'/60'/0'/0/0",
|
|
174
|
+
"f903cd82043d8509c765240083042e73941bd435f3c054b6e901b7b108a0ab7617c808677b80b903a4cfc0afeb000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000af10f7eb24f506cfd00000000000000000000000000000000000000000000000002a5b905b3c9fa4c00000000000000000000000000000000000000000000000002baaee8d905020a000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000086d3579b043585a97532514016dcf0c2d6c4b6a100000000000000000000000000000000000000000000000000000000000000c499585aac00000000000000000000000000000000000000000000000af10f7eb24f506cfd000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c40000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000076c65646765723200000000000000000000000000000000000000000000000000018080"
|
|
175
|
+
);
|
|
176
|
+
expect(result).toEqual({
|
|
177
|
+
r: "d9e62b0b6ae0c18d3d2ecdf20ce7f1c959e0f609b4e73e2d138bbdc3e1e93900",
|
|
178
|
+
s: "12469e2124a8955b5159f670b0333b803a70dd7dc51558a8f7460b27eed77be5",
|
|
179
|
+
v: "26",
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
test("paraswap without plugins CDN but with explicit plugin", async () => {
|
|
184
|
+
const transport = await openTransportReplayer(
|
|
185
|
+
// behave like paraswap test
|
|
186
|
+
RecordStore.fromString(paraswapAPDUs)
|
|
187
|
+
);
|
|
188
|
+
const eth = new Eth(transport);
|
|
189
|
+
eth.setPluginsLoadConfig({
|
|
190
|
+
baseURL: null,
|
|
191
|
+
extraPlugins: paraswapJSON,
|
|
192
|
+
});
|
|
154
193
|
const result = await eth.signTransaction(
|
|
155
194
|
"44'/60'/0'/0/0",
|
|
156
195
|
"f903cd82043d8509c765240083042e73941bd435f3c054b6e901b7b108a0ab7617c808677b80b903a4cfc0afeb000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000af10f7eb24f506cfd00000000000000000000000000000000000000000000000002a5b905b3c9fa4c00000000000000000000000000000000000000000000000002baaee8d905020a000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000086d3579b043585a97532514016dcf0c2d6c4b6a100000000000000000000000000000000000000000000000000000000000000c499585aac00000000000000000000000000000000000000000000000af10f7eb24f506cfd000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c40000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000076c65646765723200000000000000000000000000000000000000000000000000018080"
|