@ledgerhq/hw-app-eth 6.21.3 → 6.22.0
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 +51 -100
- package/erc20.js +1 -1
- package/lib/Eth.d.ts +14 -33
- package/lib/Eth.d.ts.map +1 -1
- package/lib/Eth.js +273 -305
- package/lib/Eth.js.map +1 -1
- package/lib/services/ledger/contracts.d.ts +14 -0
- package/lib/services/ledger/contracts.d.ts.map +1 -0
- package/lib/{contracts.js → services/ledger/contracts.js} +0 -0
- package/lib/services/ledger/contracts.js.map +1 -0
- package/lib/services/ledger/erc20.d.ts +22 -0
- package/lib/services/ledger/erc20.d.ts.map +1 -0
- package/lib/{erc20.js → services/ledger/erc20.js} +0 -0
- package/lib/services/ledger/erc20.js.map +1 -0
- package/lib/services/ledger/index.d.ts +4 -0
- package/lib/services/ledger/index.d.ts.map +1 -0
- package/lib/services/ledger/index.js +168 -0
- package/lib/services/ledger/index.js.map +1 -0
- package/lib/services/ledger/loadConfig.d.ts +3 -0
- package/lib/services/ledger/loadConfig.d.ts.map +1 -0
- package/lib/{loadConfig.js → services/ledger/loadConfig.js} +0 -0
- package/lib/services/ledger/loadConfig.js.map +1 -0
- package/lib/services/ledger/nfts.d.ts +10 -0
- package/lib/services/ledger/nfts.d.ts.map +1 -0
- package/lib/{nfts.js → services/ledger/nfts.js} +3 -14
- package/lib/services/ledger/nfts.js.map +1 -0
- package/lib/services/types.d.ts +18 -0
- package/lib/services/types.d.ts.map +1 -0
- package/lib/services/types.js +3 -0
- package/lib/services/types.js.map +1 -0
- package/lib/utils.d.ts +8 -27
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +68 -68
- package/lib/utils.js.map +1 -1
- package/lib-es/Eth.d.ts +14 -33
- package/lib-es/Eth.d.ts.map +1 -1
- package/lib-es/Eth.js +261 -296
- package/lib-es/Eth.js.map +1 -1
- package/{lib → lib-es/services/ledger}/contracts.d.ts +1 -1
- package/lib-es/services/ledger/contracts.d.ts.map +1 -0
- package/lib-es/services/ledger/contracts.js +96 -0
- package/lib-es/services/ledger/contracts.js.map +1 -0
- package/{lib → lib-es/services/ledger}/erc20.d.ts +0 -0
- package/lib-es/services/ledger/erc20.d.ts.map +1 -0
- package/lib-es/services/ledger/erc20.js +64 -0
- package/lib-es/services/ledger/erc20.js.map +1 -0
- package/lib-es/services/ledger/index.d.ts +4 -0
- package/lib-es/services/ledger/index.d.ts.map +1 -0
- package/lib-es/services/ledger/index.js +166 -0
- package/lib-es/services/ledger/index.js.map +1 -0
- package/lib-es/services/ledger/loadConfig.d.ts +3 -0
- package/lib-es/services/ledger/loadConfig.d.ts.map +1 -0
- package/lib-es/services/ledger/loadConfig.js +20 -0
- package/lib-es/services/ledger/loadConfig.js.map +1 -0
- package/{lib → lib-es/services/ledger}/nfts.d.ts +2 -3
- package/lib-es/services/ledger/nfts.d.ts.map +1 -0
- package/lib-es/services/ledger/nfts.js +83 -0
- package/lib-es/services/ledger/nfts.js.map +1 -0
- package/lib-es/services/types.d.ts +18 -0
- package/lib-es/services/types.d.ts.map +1 -0
- package/lib-es/services/types.js +2 -0
- package/lib-es/services/types.js.map +1 -0
- package/lib-es/utils.d.ts +8 -27
- package/lib-es/utils.d.ts.map +1 -1
- package/lib-es/utils.js +66 -61
- package/lib-es/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/Eth.ts +124 -258
- package/src/{contracts.ts → services/ledger/contracts.ts} +1 -1
- package/src/{erc20.ts → services/ledger/erc20.ts} +0 -0
- package/src/services/ledger/index.ts +119 -0
- package/src/services/ledger/loadConfig.ts +14 -0
- package/src/{nfts.ts → services/ledger/nfts.ts} +5 -18
- package/src/services/types.ts +28 -0
- package/src/utils.ts +72 -94
- package/tests/Eth.test.ts +2 -2
- package/lib/contracts.d.ts.map +0 -1
- package/lib/contracts.js.map +0 -1
- package/lib/erc20.d.ts.map +0 -1
- package/lib/erc20.js.map +0 -1
- package/lib/loadConfig.d.ts +0 -7
- package/lib/loadConfig.d.ts.map +0 -1
- package/lib/loadConfig.js.map +0 -1
- package/lib/nfts.d.ts.map +0 -1
- package/lib/nfts.js.map +0 -1
- package/src/loadConfig.ts +0 -23
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type LedgerEthTransactionResolution = {
|
|
2
|
+
// device serialized data that contains ERC20 data (hex format)
|
|
3
|
+
erc20Tokens: Array<string>;
|
|
4
|
+
// device serialized data that contains NFT data (hex format)
|
|
5
|
+
nfts: Array<string>;
|
|
6
|
+
// device serialized data that contains external plugin data (hex format)
|
|
7
|
+
externalPlugin: Array<{ payload: string; signature: string }>;
|
|
8
|
+
// device serialized data that contains plugin data (hex format)
|
|
9
|
+
plugin: Array<string>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type LoadConfig = {
|
|
13
|
+
nftExplorerBaseURL?: string | null;
|
|
14
|
+
// example of payload https://cdn.live.ledger.com/plugins/ethereum/1.json
|
|
15
|
+
// fetch against an api (base url is an api that hosts /plugins/ethereum/${chainId}.json )
|
|
16
|
+
// set to null will disable it
|
|
17
|
+
pluginBaseURL?: string | null;
|
|
18
|
+
// provide manually some extra plugins to add for the resolution (e.g. for dev purpose)
|
|
19
|
+
// object will be merged with the returned value of the Ledger cdn payload
|
|
20
|
+
extraPlugins?: any | null;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type LedgerEthTransactionService = {
|
|
24
|
+
resolveTransaction: (
|
|
25
|
+
rawTxHex: string,
|
|
26
|
+
loadConfig: LoadConfig
|
|
27
|
+
) => Promise<LedgerEthTransactionResolution>;
|
|
28
|
+
};
|
package/src/utils.ts
CHANGED
|
@@ -1,104 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* (c) 2016-2017 Ledger
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
********************************************************************************/
|
|
17
|
-
type Defer<T> = {
|
|
18
|
-
promise: Promise<T>;
|
|
19
|
-
resolve: (arg0: T) => void;
|
|
20
|
-
reject: (arg0: any) => void;
|
|
21
|
-
};
|
|
22
|
-
export function defer<T>(): Defer<T> {
|
|
23
|
-
let resolve, reject;
|
|
24
|
-
const promise = new Promise<T>(function (success, failure) {
|
|
25
|
-
resolve = success;
|
|
26
|
-
reject = failure;
|
|
27
|
-
});
|
|
28
|
-
if (!resolve || !reject) throw "defer() error"; // this never happens and is just to make flow happy
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
|
+
import { BigNumber } from "bignumber.js";
|
|
29
3
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const components = path.split("/");
|
|
40
|
-
components.forEach((element) => {
|
|
41
|
-
let number = parseInt(element, 10);
|
|
4
|
+
export function decodeTxInfo(rawTx: Buffer) {
|
|
5
|
+
const VALID_TYPES = [1, 2];
|
|
6
|
+
const txType = VALID_TYPES.includes(rawTx[0]) ? rawTx[0] : null;
|
|
7
|
+
const rlpData = txType === null ? rawTx : rawTx.slice(1);
|
|
8
|
+
const rlpTx = ethers.utils.RLP.decode(rlpData).map((hex) =>
|
|
9
|
+
Buffer.from(hex.slice(2), "hex")
|
|
10
|
+
);
|
|
11
|
+
let chainIdTruncated = 0;
|
|
12
|
+
const rlpDecoded = ethers.utils.RLP.decode(rlpData);
|
|
42
13
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
14
|
+
let decodedTx;
|
|
15
|
+
if (txType === 2) {
|
|
16
|
+
// EIP1559
|
|
17
|
+
decodedTx = {
|
|
18
|
+
data: rlpDecoded[7],
|
|
19
|
+
to: rlpDecoded[5],
|
|
20
|
+
chainId: rlpTx[0],
|
|
21
|
+
};
|
|
22
|
+
} else if (txType === 1) {
|
|
23
|
+
// EIP2930
|
|
24
|
+
decodedTx = {
|
|
25
|
+
data: rlpDecoded[6],
|
|
26
|
+
to: rlpDecoded[4],
|
|
27
|
+
chainId: rlpTx[0],
|
|
28
|
+
};
|
|
29
|
+
} else {
|
|
30
|
+
// Legacy tx
|
|
31
|
+
decodedTx = {
|
|
32
|
+
data: rlpDecoded[5],
|
|
33
|
+
to: rlpDecoded[3],
|
|
34
|
+
// Default to 1 for non EIP 155 txs
|
|
35
|
+
chainId: rlpTx.length > 6 ? rlpTx[6] : Buffer.from("0x01", "hex"),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
46
38
|
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
const chainIdSrc = decodedTx.chainId;
|
|
40
|
+
let chainId = new BigNumber(0);
|
|
41
|
+
if (chainIdSrc) {
|
|
42
|
+
// Using BigNumber because chainID could be any uint256.
|
|
43
|
+
chainId = new BigNumber(chainIdSrc.toString("hex"), 16);
|
|
44
|
+
const chainIdTruncatedBuf = Buffer.alloc(4);
|
|
45
|
+
if (chainIdSrc.length > 4) {
|
|
46
|
+
chainIdSrc.copy(chainIdTruncatedBuf);
|
|
47
|
+
} else {
|
|
48
|
+
chainIdSrc.copy(chainIdTruncatedBuf, 4 - chainIdSrc.length);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
result.push(number);
|
|
52
|
-
});
|
|
53
|
-
return result;
|
|
54
|
-
}
|
|
55
|
-
// TODO use async await
|
|
56
|
-
export function eachSeries<A>(
|
|
57
|
-
arr: A[],
|
|
58
|
-
fun: (arg0: A) => Promise<any>
|
|
59
|
-
): Promise<any> {
|
|
60
|
-
return arr.reduce((p, e) => p.then(() => fun(e)), Promise.resolve());
|
|
61
|
-
}
|
|
62
|
-
export function foreach<T, A>(
|
|
63
|
-
arr: T[],
|
|
64
|
-
callback: (arg0: T, arg1: number) => Promise<A>
|
|
65
|
-
): Promise<A[]> {
|
|
66
|
-
function iterate(index, array, result) {
|
|
67
|
-
if (index >= array.length) {
|
|
68
|
-
return result;
|
|
69
|
-
} else
|
|
70
|
-
return callback(array[index], index).then(function (res) {
|
|
71
|
-
result.push(res);
|
|
72
|
-
return iterate(index + 1, array, result);
|
|
73
|
-
});
|
|
50
|
+
chainIdTruncated = chainIdTruncatedBuf.readUInt32BE(0);
|
|
74
51
|
}
|
|
75
52
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
} else {
|
|
96
|
-
return callback().then((res) => {
|
|
97
|
-
result.push(res);
|
|
98
|
-
return iterate(result);
|
|
99
|
-
});
|
|
53
|
+
let vrsOffset = 0;
|
|
54
|
+
if (txType === null && rlpTx.length > 6) {
|
|
55
|
+
const rlpVrs = Buffer.from(
|
|
56
|
+
ethers.utils.RLP.encode(rlpTx.slice(-3)).slice(2),
|
|
57
|
+
"hex"
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
vrsOffset = rawTx.length - (rlpVrs.length - 1);
|
|
61
|
+
|
|
62
|
+
// First byte > 0xf7 means the length of the list length doesn't fit in a single byte.
|
|
63
|
+
if (rlpVrs[0] > 0xf7) {
|
|
64
|
+
// Increment vrsOffset to account for that extra byte.
|
|
65
|
+
vrsOffset++;
|
|
66
|
+
|
|
67
|
+
// Compute size of the list length.
|
|
68
|
+
const sizeOfListLen = rlpVrs[0] - 0xf7;
|
|
69
|
+
|
|
70
|
+
// Increase rlpOffset by the size of the list length.
|
|
71
|
+
vrsOffset += sizeOfListLen - 1;
|
|
100
72
|
}
|
|
101
73
|
}
|
|
102
74
|
|
|
103
|
-
return
|
|
75
|
+
return {
|
|
76
|
+
decodedTx,
|
|
77
|
+
txType,
|
|
78
|
+
chainId,
|
|
79
|
+
chainIdTruncated,
|
|
80
|
+
vrsOffset,
|
|
81
|
+
};
|
|
104
82
|
}
|
package/tests/Eth.test.ts
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
RecordStore,
|
|
4
4
|
} from "@ledgerhq/hw-transport-mocker";
|
|
5
5
|
import Eth from "../src/Eth";
|
|
6
|
-
import { TokenInfo } from "../src/erc20";
|
|
6
|
+
import { TokenInfo } from "../src/services/ledger/erc20";
|
|
7
7
|
import { BigNumber } from "bignumber.js";
|
|
8
|
-
import { byContractAddressAndChainId } from "../src/erc20";
|
|
8
|
+
import { byContractAddressAndChainId } from "../src/services/ledger/erc20";
|
|
9
9
|
import paraswapJSON from "./paraswap.json";
|
|
10
10
|
|
|
11
11
|
test("getAppConfiguration", async () => {
|
package/lib/contracts.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,aAAK,cAAc,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,oBACpB,MAAM,YACb,MAAM,WACP,MAAM,kBACC,UAAU,KACzB,QAAQ,cAAc,GAAG,SAAS,CAsCpC,CAAC"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AU,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;AA3CW,QAAA,0BAA0B,8BA2CrC"}
|
package/lib/erc20.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"erc20.d.ts","sourceRoot":"","sources":["../src/erc20.ts"],"names":[],"mappings":";AAEA;;GAEG;AACH,eAAO,MAAM,2BAA2B,aAC5B,MAAM,WACP,MAAM,KACd,SAAS,GAAG,IAAI,GAAG,SAC4C,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,IAAI,QAAO,SAAS,EAAkB,CAAC;AACpD,oBAAY,SAAS,GAAG;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,oBAAY,GAAG,GAAG;IAChB,oBAAoB,EAAE,CACpB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,KACP,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,MAAM,SAAS,EAAE,CAAC;CACzB,CAAC"}
|
package/lib/erc20.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"erc20.js","sourceRoot":"","sources":["../src/erc20.ts"],"names":[],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CAAC,CAAC,EAAE,CAAC"}
|
package/lib/loadConfig.d.ts
DELETED
package/lib/loadConfig.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadConfig.d.ts","sourceRoot":"","sources":["../src/loadConfig.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU,GAAG;IACvB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAInC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,YAAY,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;CAC3B,CAAC;AAQF,wBAAgB,aAAa,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,UAAU,CAKrE"}
|
package/lib/loadConfig.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadConfig.js","sourceRoot":"","sources":["../src/loadConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAWA,IAAM,iBAAiB,GAAG;IACxB,kBAAkB,EAAE,IAAI;IACxB,aAAa,EAAE,6BAA6B;IAC5C,YAAY,EAAE,IAAI;CACnB,CAAC;AAEF,SAAgB,aAAa,CAAC,cAA2B;IACvD,6BACK,iBAAiB,GACjB,cAAc,EACjB;AACJ,CAAC;AALD,sCAKC"}
|
package/lib/nfts.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nfts.d.ts","sourceRoot":"","sources":["../src/nfts.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,aAAK,OAAO,GAAG;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAMF,eAAO,MAAM,UAAU,oBACJ,MAAM,WACd,MAAM,kBACC,UAAU,KACzB,QAAQ,OAAO,GAAG,SAAS,CAqB7B,CAAC;AAEF,eAAO,MAAM,aA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wBACL,eAAe,EAAE,eAAe;wBAChC,cAAc,EAAE,cAAc;wBAC9B,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC;qBAClC,EAAC;;;KACH,CAAC;AAzBW,QAAA,UAAU,cAyBrB;AAEK,IAAM,aAAa,GAAG,UAC3B,eAAuB,EACvB,QAAgB,EAChB,OAAe,EACf,cAA0B;;;;;gBAElB,kBAAkB,GAAK,IAAA,0BAAa,EAAC,cAAc,CAAC,mBAAlC,CAAmC;gBAC7D,IAAI,CAAC,kBAAkB;oBAAE,sBAAO;gBAC1B,GAAG,GAAG,UAAG,kBAAkB,cAAI,OAAO,wBAAc,eAAe,8BAAoB,QAAQ,CAAE,CAAC;gBAEvF,qBAAM,kBAAK;yBACzB,GAAG,CAAkB,GAAG,CAAC;yBACzB,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC,CACnB,OAAK,CAAA,CAAC,UAAC,CAAC;wBACP,IAAA,UAAG,EAAC,OAAO,EAAE,uBAAuB,GAAG,GAAG,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;wBAC/D,OAAO,IAAI,CAAC;oBACd,CAAC,CAAC,EAAA;;gBANE,QAAQ,GAAG,SAMb;gBACJ,IAAI,CAAC,QAAQ;oBAAE,sBAAO;gBAEhB,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;gBACpC,sBAAO,OAAO,EAAC;;;KAChB,CAAC;AArBW,QAAA,aAAa,iBAqBxB"}
|
package/src/loadConfig.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export type LoadConfig = {
|
|
2
|
-
nftExplorerBaseURL?: string | null;
|
|
3
|
-
// example of payload https://cdn.live.ledger.com/plugins/ethereum/1.json
|
|
4
|
-
// fetch against an api (base url is an api that hosts /plugins/ethereum/${chainId}.json )
|
|
5
|
-
// set to null will disable it
|
|
6
|
-
pluginBaseURL?: string | null;
|
|
7
|
-
// provide manually some extra plugins to add for the resolution (e.g. for dev purpose)
|
|
8
|
-
// object will be merged with the returned value of the Ledger cdn payload
|
|
9
|
-
extraPlugins?: any | null;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const defaultLoadConfig = {
|
|
13
|
-
nftExplorerBaseURL: null, // set a value when an official production endpoint is released
|
|
14
|
-
pluginBaseURL: "https://cdn.live.ledger.com",
|
|
15
|
-
extraPlugins: null,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export function getLoadConfig(userLoadConfig?: LoadConfig): LoadConfig {
|
|
19
|
-
return {
|
|
20
|
-
...defaultLoadConfig,
|
|
21
|
-
...userLoadConfig,
|
|
22
|
-
};
|
|
23
|
-
}
|