@ledgerhq/live-env 0.1.0 → 0.2.0-nightly.1

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/lib-es/env.js CHANGED
@@ -1,35 +1,22 @@
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
- };
12
1
  // TODO: this file will be moved to a @ledgerhq/env library
13
2
  import mapValues from "lodash/mapValues";
14
3
  // set and get environment & config variables
15
4
  import { Subject } from "rxjs";
16
- var intParser = function (v) {
5
+ const intParser = (v) => {
17
6
  if (!Number.isNaN(v))
18
7
  return parseInt(v, 10);
19
8
  };
20
- var floatParser = function (v) {
9
+ const floatParser = (v) => {
21
10
  if (!Number.isNaN(v))
22
11
  return parseFloat(v);
23
12
  };
24
- var boolParser = function (v) {
13
+ const boolParser = (v) => {
25
14
  if (typeof v === "boolean")
26
15
  return v;
27
16
  return !(v === "0" || v === "false");
28
17
  };
29
- var stringParser = function (v) {
30
- return typeof v === "string" ? v : undefined;
31
- };
32
- var jsonParser = function (v) {
18
+ const stringParser = (v) => typeof v === "string" ? v : undefined;
19
+ const jsonParser = (v) => {
33
20
  try {
34
21
  if (typeof v !== "string")
35
22
  throw new Error();
@@ -39,446 +26,456 @@ var jsonParser = function (v) {
39
26
  return undefined;
40
27
  }
41
28
  };
42
- var stringArrayParser = function (v) {
43
- var v_array = typeof v === "string" ? v.split(",") : null;
29
+ const stringArrayParser = (v) => {
30
+ const v_array = typeof v === "string" ? v.split(",") : null;
44
31
  if (Array.isArray(v_array) && v_array.length > 0)
45
32
  return v_array;
46
33
  };
47
- var envDefinitions = {
34
+ const envDefinitions = {
48
35
  ADDRESS_POISONING_FAMILIES: {
49
36
  def: "ethereum,evm,tron",
50
37
  parser: stringParser,
51
- desc: "List of families impacted by the address poisoning attack"
38
+ desc: "List of families impacted by the address poisoning attack",
52
39
  },
53
40
  ANALYTICS_CONSOLE: {
54
41
  def: false,
55
42
  parser: boolParser,
56
- desc: "Show tracking overlays on the app UI"
43
+ desc: "Show tracking overlays on the app UI",
57
44
  },
58
45
  DEBUG_THEME: {
59
46
  def: false,
60
47
  parser: boolParser,
61
- desc: "Show theme debug overlay UI"
48
+ desc: "Show theme debug overlay UI",
62
49
  },
63
50
  API_ALGORAND_BLOCKCHAIN_EXPLORER_API_ENDPOINT: {
64
51
  def: "https://algorand.coin.ledger.com",
65
52
  parser: stringParser,
66
- desc: "Node API endpoint for algorand"
53
+ desc: "Node API endpoint for algorand",
67
54
  },
68
55
  API_CELO_INDEXER: {
69
56
  def: "https://celo.coin.ledger.com/indexer/",
70
57
  parser: stringParser,
71
- desc: "Explorer API for celo"
58
+ desc: "Explorer API for celo",
72
59
  },
73
60
  API_CELO_NODE: {
74
61
  def: "https://celo.coin.ledger.com/archive/",
75
62
  parser: stringParser,
76
- desc: "Node endpoint for celo"
63
+ desc: "Node endpoint for celo",
77
64
  },
78
65
  COSMOS_GAS_AMPLIFIER: {
79
66
  def: 1.2,
80
67
  parser: intParser,
81
- desc: "Cosmos gas estimate multiplier"
68
+ desc: "Cosmos gas estimate multiplier",
82
69
  },
83
70
  API_COSMOS_BLOCKCHAIN_EXPLORER_API_ENDPOINT: {
84
71
  def: "https://cosmoshub4.coin.ledger.com",
85
72
  parser: stringParser,
86
- desc: "Node endpoint for cosmos"
73
+ desc: "Node endpoint for cosmos",
87
74
  },
88
75
  API_RIPPLE_RPC: {
89
76
  parser: stringParser,
90
77
  def: "https://xrplcluster.com/ledgerlive",
91
- desc: "XRP Ledger full history open JSON-RPC endpoint"
78
+ desc: "XRP Ledger full history open JSON-RPC endpoint",
92
79
  },
93
80
  API_FILECOIN_ENDPOINT: {
94
81
  parser: stringParser,
95
82
  def: "https://filecoin.coin.ledger.com",
96
- desc: "Filecoin API url"
83
+ desc: "Filecoin API url",
97
84
  },
98
85
  API_NEAR_ARCHIVE_NODE: {
99
86
  def: "https://near.coin.ledger.com/node/",
100
87
  parser: stringParser,
101
- desc: "Archive node endpoint for NEAR"
88
+ desc: "Archive node endpoint for NEAR",
102
89
  },
103
90
  API_NEAR_INDEXER: {
104
91
  def: "https://near.coin.ledger.com/indexer/",
105
92
  parser: stringParser,
106
- desc: "Datahub Indexer API for NEAR"
93
+ desc: "Datahub Indexer API for NEAR",
107
94
  },
108
95
  API_NEAR_STAKING_POSITIONS_API: {
109
96
  def: "https://validators-near.coin.ledger.com/",
110
97
  parser: stringParser,
111
- desc: "NEAR staking positions API"
98
+ desc: "NEAR staking positions API",
112
99
  },
113
100
  API_POLKADOT_INDEXER: {
114
101
  parser: stringParser,
115
102
  def: "https://polkadot.coin.ledger.com",
116
- desc: "Explorer API for polkadot"
103
+ desc: "Explorer API for polkadot",
117
104
  },
118
105
  API_POLKADOT_SIDECAR: {
119
106
  parser: stringParser,
120
107
  def: "https://polkadot-sidecar.coin.ledger.com",
121
- desc: "Polkadot Sidecar API url"
108
+ desc: "Polkadot Sidecar API url",
122
109
  },
123
110
  ELROND_API_ENDPOINT: {
124
111
  parser: stringParser,
125
112
  def: "https://elrond.coin.ledger.com",
126
- desc: "Elrond API url"
113
+ desc: "Elrond API url",
127
114
  },
128
115
  ELROND_DELEGATION_API_ENDPOINT: {
129
116
  parser: stringParser,
130
117
  def: "https://delegations-elrond.coin.ledger.com",
131
- desc: "Elrond DELEGATION API url"
118
+ desc: "Elrond DELEGATION API url",
132
119
  },
133
120
  API_STELLAR_HORIZON: {
134
121
  parser: stringParser,
135
122
  def: "https://stellar.coin.ledger.com",
136
- desc: "Stellar Horizon API url"
123
+ desc: "Stellar Horizon API url",
137
124
  },
138
125
  API_STELLAR_HORIZON_FETCH_LIMIT: {
139
126
  parser: intParser,
140
127
  def: 100,
141
- desc: "Limit of operation that Horizon will fetch per page"
128
+ desc: "Limit of operation that Horizon will fetch per page",
142
129
  },
143
130
  API_STELLAR_HORIZON_STATIC_FEE: {
144
131
  def: false,
145
132
  parser: boolParser,
146
- desc: "Static fee for Stellar account"
133
+ desc: "Static fee for Stellar account",
147
134
  },
148
135
  API_OSMOSIS_NODE: {
149
136
  def: "https://osmosis.coin.ledger.com/lcd",
150
137
  parser: stringParser,
151
- desc: "Endpoint for Osmosis Node"
138
+ desc: "Endpoint for Osmosis Node",
152
139
  },
153
140
  API_TEZOS_BAKER: {
154
141
  parser: stringParser,
155
142
  def: "https://tezos-bakers.api.live.ledger.com",
156
- desc: "bakers API for tezos"
143
+ desc: "bakers API for tezos",
157
144
  },
158
145
  API_TEZOS_BLOCKCHAIN_EXPLORER_API_ENDPOINT: {
159
146
  def: "https://xtz-explorer.api.live.ledger.com/explorer",
160
147
  parser: stringParser,
161
- desc: "Ledger explorer API for tezos"
148
+ desc: "Ledger explorer API for tezos",
162
149
  },
163
150
  API_TEZOS_TZKT_API: {
164
151
  def: "https://xtz-tzkt-explorer.api.live.ledger.com",
165
152
  parser: stringParser,
166
- desc: "tzkt.io explorer"
153
+ desc: "tzkt.io explorer",
167
154
  },
168
155
  API_TEZOS_NODE: {
169
156
  def: "https://xtz-node.api.live.ledger.com",
170
157
  parser: stringParser,
171
- desc: "node API for tezos (for broadcast only)"
158
+ desc: "node API for tezos (for broadcast only)",
172
159
  },
173
160
  API_TRONGRID_PROXY: {
174
161
  parser: stringParser,
175
162
  def: "https://tron.coin.ledger.com",
176
- desc: "proxy url for trongrid API"
163
+ desc: "proxy url for trongrid API",
177
164
  },
178
165
  API_SOLANA_PROXY: {
179
166
  parser: stringParser,
180
167
  def: "https://solana.coin.ledger.com",
181
- desc: "proxy url for solana API"
168
+ desc: "proxy url for solana API",
182
169
  },
183
170
  SOLANA_VALIDATORS_APP_BASE_URL: {
184
171
  parser: stringParser,
185
172
  def: "https://validators-solana.coin.ledger.com/api/v1/validators",
186
- desc: "base url for validators.app validator list"
173
+ desc: "base url for validators.app validator list",
187
174
  },
188
175
  SOLANA_TX_CONFIRMATION_TIMEOUT: {
189
176
  def: 100 * 1000,
190
177
  parser: intParser,
191
- desc: "solana transaction broadcast confirmation timeout"
178
+ desc: "solana transaction broadcast confirmation timeout",
192
179
  },
193
180
  API_HEDERA_MIRROR: {
194
181
  def: "https://hedera.coin.ledger.com",
195
182
  parser: stringParser,
196
- desc: "mirror node API for Hedera"
183
+ desc: "mirror node API for Hedera",
197
184
  },
198
185
  BASE_SOCKET_URL: {
199
186
  def: "wss://scriptrunner.api.live.ledger.com/update",
200
187
  parser: stringParser,
201
- desc: "Ledger script runner API"
188
+ desc: "Ledger script runner API",
202
189
  },
203
190
  BOT_TIMEOUT_SCAN_ACCOUNTS: {
204
191
  def: 10 * 60 * 1000,
205
192
  parser: intParser,
206
- desc: "bot's default timeout for scanAccounts"
193
+ desc: "bot's default timeout for scanAccounts",
207
194
  },
208
195
  BOT_SPEC_DEFAULT_TIMEOUT: {
209
196
  def: 30 * 60 * 1000,
210
197
  parser: intParser,
211
- desc: "define the default value of spec.skipMutationsTimeout (if not overriden by spec)"
198
+ desc: "define the default value of spec.skipMutationsTimeout (if not overriden by spec)",
212
199
  },
213
200
  CARDANO_API_ENDPOINT: {
214
201
  def: "https://cardano.coin.ledger.com/api",
215
202
  parser: stringParser,
216
- desc: "Cardano API url"
203
+ desc: "Cardano API url",
217
204
  },
218
205
  CARDANO_TESTNET_API_ENDPOINT: {
219
206
  def: "https://testnet-ledger.cardanoscan.io/api",
220
207
  parser: stringParser,
221
- desc: "Cardano API url"
208
+ desc: "Cardano API url",
222
209
  },
223
210
  COINAPPS: {
224
211
  def: "",
225
212
  parser: stringParser,
226
- desc: "(dev feature) defines the folder for speculos mode that contains Nano apps binaries (.elf) in a specific structure: <device>/<firmware>/<appName>/app_<appVersion>.elf"
213
+ desc: "(dev feature) defines the folder for speculos mode that contains Nano apps binaries (.elf) in a specific structure: <device>/<firmware>/<appName>/app_<appVersion>.elf",
227
214
  },
228
215
  CRYPTO_ORG_INDEXER: {
229
216
  def: "https://cryptoorg-rpc-indexer.coin.ledger.com",
230
217
  parser: stringParser,
231
- desc: "location of the crypto.org indexer API"
218
+ desc: "location of the crypto.org indexer API",
232
219
  },
233
220
  CRYPTO_ORG_TESTNET_INDEXER: {
234
221
  def: "https://crypto.org/explorer/croeseid4",
235
222
  parser: stringParser,
236
- desc: "location of the crypto.org indexer testnet API"
223
+ desc: "location of the crypto.org indexer testnet API",
237
224
  },
238
225
  CRYPTO_ORG_RPC_URL: {
239
226
  def: "https://cryptoorg-rpc-node.coin.ledger.com",
240
227
  parser: stringParser,
241
- desc: "location of the crypto.org chain node"
228
+ desc: "location of the crypto.org chain node",
242
229
  },
243
230
  CRYPTO_ORG_TESTNET_RPC_URL: {
244
231
  def: "https://rpc-testnet-croeseid-4.crypto.org",
245
232
  parser: stringParser,
246
- desc: "location of the crypto.org chain testnet node"
233
+ desc: "location of the crypto.org chain testnet node",
247
234
  },
248
235
  DEBUG_UTXO_DISPLAY: {
249
236
  def: 4,
250
237
  parser: intParser,
251
- desc: "define maximum number of utxos to display in CLI"
238
+ desc: "define maximum number of utxos to display in CLI",
252
239
  },
253
240
  DEBUG_HTTP_RESPONSE: {
254
241
  def: false,
255
242
  parser: boolParser,
256
- desc: "includes HTTP response body in logs"
243
+ desc: "includes HTTP response body in logs",
257
244
  },
258
245
  DEVICE_CANCEL_APDU_FLUSH_MECHANISM: {
259
246
  def: true,
260
247
  parser: boolParser,
261
- desc: "enable a mechanism that send a 0x00 apdu to force device to awake from its 'Processing' UI state"
248
+ desc: "enable a mechanism that send a 0x00 apdu to force device to awake from its 'Processing' UI state",
262
249
  },
263
250
  DEVICE_PROXY_URL: {
264
251
  def: "",
265
252
  parser: stringParser,
266
- desc: "enable a proxy to use instead of a physical device"
253
+ desc: "enable a proxy to use instead of a physical device",
267
254
  },
268
255
  DEVICE_PROXY_MODEL: {
269
256
  def: "nanoS",
270
257
  parser: stringParser,
271
- desc: "allow to override the default model of a proxied device"
258
+ desc: "allow to override the default model of a proxied device",
272
259
  },
273
260
  DISABLE_TRANSACTION_BROADCAST: {
274
261
  def: false,
275
262
  parser: boolParser,
276
- desc: "disable broadcast of transactions"
263
+ desc: "disable broadcast of transactions",
277
264
  },
278
265
  DISABLE_SYNC_TOKEN: {
279
266
  def: true,
280
267
  parser: boolParser,
281
- desc: "disable a problematic mechanism of our API"
268
+ desc: "disable a problematic mechanism of our API",
282
269
  },
283
270
  DISABLE_FW_UPDATE_VERSION_CHECK: {
284
271
  def: false,
285
272
  parser: boolParser,
286
- desc: "disable the version check for firmware update eligibility"
273
+ desc: "disable the version check for firmware update eligibility",
287
274
  },
288
275
  EIP1559_ENABLED_CURRENCIES: {
289
276
  def: "ethereum,ethereum_goerli,polygon",
290
277
  parser: stringArrayParser,
291
- desc: "set the currency ids where EIP1559 is enabled"
278
+ desc: "set the currency ids where EIP1559 is enabled",
292
279
  },
293
280
  EIP1559_MINIMUM_FEES_GATE: {
294
281
  def: true,
295
282
  parser: boolParser,
296
- desc: "prevents the user from doing an EIP1559 transaction with fees too low"
283
+ desc: "prevents the user from doing an EIP1559 transaction with fees too low",
297
284
  },
298
285
  EIP1559_PRIORITY_FEE_LOWER_GATE: {
299
286
  def: 0.85,
300
287
  parser: floatParser,
301
- desc: "minimum priority fee percents allowed compared to network conditions allowed when EIP1559_MINIMUM_FEES_GATE is activated"
288
+ desc: "minimum priority fee percents allowed compared to network conditions allowed when EIP1559_MINIMUM_FEES_GATE is activated",
289
+ },
290
+ EIP1559_BASE_FEE_MULTIPLIER: {
291
+ def: 1.5,
292
+ parser: floatParser,
293
+ desc: "mutiplier for the base fee that is composing the maxFeePerGas property",
302
294
  },
303
295
  ETHEREUM_GAS_LIMIT_AMPLIFIER: {
304
296
  def: 1.2,
305
297
  parser: floatParser,
306
- desc: "Ethereum gasLimit multiplier for contracts to prevent out of gas issue"
298
+ desc: "Ethereum gasLimit multiplier for contracts to prevent out of gas issue",
307
299
  },
308
300
  EXPERIMENTAL_BLE: {
309
301
  def: false,
310
302
  parser: boolParser,
311
- desc: "enable experimental support of Bluetooth"
303
+ desc: "enable experimental support of Bluetooth",
312
304
  },
313
305
  EXPERIMENTAL_CURRENCIES: {
314
306
  def: "",
315
307
  parser: stringParser,
316
- desc: "enable experimental support of currencies (comma separated)"
308
+ desc: "enable experimental support of currencies (comma separated)",
317
309
  },
318
310
  EXPERIMENTAL_EXPLORERS: {
319
311
  def: false,
320
312
  parser: boolParser,
321
- desc: "enable experimental explorer APIs"
313
+ desc: "enable experimental explorer APIs",
322
314
  },
323
315
  EXPERIMENTAL_LANGUAGES: {
324
316
  def: false,
325
317
  parser: boolParser,
326
- desc: "enable experimental languages"
318
+ desc: "enable experimental languages",
327
319
  },
328
320
  EXPERIMENTAL_MANAGER: {
329
321
  def: false,
330
322
  parser: boolParser,
331
- desc: "enable an experimental version of Manager"
323
+ desc: "enable an experimental version of Manager",
332
324
  },
333
325
  EXPERIMENTAL_ROI_CALCULATION: {
334
326
  def: false,
335
327
  parser: boolParser,
336
- desc: "enable an experimental version of the portfolio percentage calculation"
328
+ desc: "enable an experimental version of the portfolio percentage calculation",
337
329
  },
338
330
  EXPERIMENTAL_SEND_MAX: {
339
331
  def: false,
340
332
  parser: boolParser,
341
- desc: "force enabling SEND MAX even if not yet stable"
333
+ desc: "force enabling SEND MAX even if not yet stable",
342
334
  },
343
335
  EXPERIMENTAL_USB: {
344
336
  def: false,
345
337
  parser: boolParser,
346
- desc: "enable an experimental implementation of USB support"
338
+ desc: "enable an experimental implementation of USB support",
347
339
  },
348
340
  EXPERIMENTAL_SWAP: {
349
341
  def: false,
350
342
  parser: boolParser,
351
- desc: "enable an experimental swap interface"
343
+ desc: "enable an experimental swap interface",
352
344
  },
353
345
  EXPLORER: {
354
346
  def: "https://explorers.api.live.ledger.com",
355
347
  parser: stringParser,
356
- desc: "Ledger generic explorer API"
348
+ desc: "Ledger generic explorer API",
357
349
  },
358
350
  EXPLORER_STAGING: {
359
351
  def: "https://explorers.api-01.live.ledger-stg.com",
360
352
  parser: stringParser,
361
- desc: "Ledger staging explorer API"
353
+ desc: "Ledger staging explorer API",
362
354
  },
363
355
  EXPLORER_BETA: {
364
356
  def: "https://explorers.api.live.ledger.com",
365
357
  parser: stringParser,
366
- desc: "Ledger generic explorer beta API"
358
+ desc: "Ledger generic explorer beta API",
367
359
  },
368
360
  EXPLORER_SATSTACK: {
369
361
  def: "http://localhost:20000",
370
362
  parser: stringParser,
371
- desc: "Ledger satstack Bitcoin explorer API"
363
+ desc: "Ledger satstack Bitcoin explorer API",
372
364
  },
373
365
  EXPORT_EXCLUDED_LOG_TYPES: {
374
366
  def: "ble-frame",
375
367
  parser: stringParser,
376
- desc: "comma-separated list of excluded log types for exported logs"
368
+ desc: "comma-separated list of excluded log types for exported logs",
377
369
  },
378
370
  EXPORT_MAX_LOGS: {
379
371
  def: 5000,
380
372
  parser: intParser,
381
- desc: "maximum logs to keep for export"
373
+ desc: "maximum logs to keep for export",
382
374
  },
383
375
  DISABLE_APP_VERSION_REQUIREMENTS: {
384
376
  def: false,
385
377
  parser: boolParser,
386
- desc: "force an old application version to be accepted regardless of its version"
378
+ desc: "force an old application version to be accepted regardless of its version",
387
379
  },
388
380
  FORCE_PROVIDER: {
389
381
  def: 1,
390
382
  parser: intParser,
391
- desc: "use a different provider for app store (for developers only)"
383
+ desc: "use a different provider for app store (for developers only)",
392
384
  },
393
385
  FILTER_ZERO_AMOUNT_ERC20_EVENTS: {
394
386
  def: true,
395
387
  parser: boolParser,
396
- desc: "Remove filter of address poisoning"
388
+ desc: "Remove filter of address poisoning",
397
389
  },
398
390
  GET_CALLS_RETRY: {
399
391
  def: 2,
400
392
  parser: intParser,
401
- desc: "how many times to retry a GET http call"
393
+ desc: "how many times to retry a GET http call",
402
394
  },
403
395
  GET_CALLS_TIMEOUT: {
404
396
  def: 60 * 1000,
405
397
  parser: intParser,
406
- desc: "how much time to timeout a GET http call"
398
+ desc: "how much time to timeout a GET http call",
407
399
  },
408
400
  HIDE_EMPTY_TOKEN_ACCOUNTS: {
409
401
  def: false,
410
402
  parser: boolParser,
411
- desc: "hide the sub accounts when they are empty"
403
+ desc: "hide the sub accounts when they are empty",
412
404
  },
413
405
  KEYCHAIN_OBSERVABLE_RANGE: {
414
406
  def: 0,
415
407
  parser: intParser,
416
- desc: "overrides the gap limit specified by BIP44 (default to 20)"
408
+ desc: "overrides the gap limit specified by BIP44 (default to 20)",
417
409
  },
418
410
  LEDGER_CLIENT_VERSION: {
419
411
  def: "",
420
412
  parser: stringParser,
421
- desc: "the 'X-Ledger-Client-Version' HTTP header to use for queries to Ledger APIs"
413
+ desc: "the 'X-Ledger-Client-Version' HTTP header to use for queries to Ledger APIs",
422
414
  },
423
415
  LEDGER_COUNTERVALUES_API: {
424
416
  def: "https://countervalues.live.ledger.com",
425
417
  parser: stringParser,
426
- desc: "Ledger countervalues API"
418
+ desc: "Ledger countervalues API",
427
419
  },
428
420
  LEDGER_REST_API_BASE: {
429
421
  def: "https://explorers.api.live.ledger.com",
430
422
  parser: stringParser,
431
- desc: "DEPRECATED"
423
+ desc: "DEPRECATED",
432
424
  },
433
425
  LEGACY_KT_SUPPORT_TO_YOUR_OWN_RISK: {
434
426
  def: false,
435
427
  parser: boolParser,
436
- desc: "enable sending to KT accounts. Not tested."
428
+ desc: "enable sending to KT accounts. Not tested.",
429
+ },
430
+ LIST_APPS_V2: {
431
+ def: false,
432
+ parser: boolParser,
433
+ desc: "use new version of list apps for My Ledger",
437
434
  },
438
435
  MANAGER_API_BASE: {
439
436
  def: "https://manager.api.live.ledger.com/api",
440
437
  parser: stringParser,
441
- desc: "Ledger Manager API"
438
+ desc: "Ledger Manager API",
442
439
  },
443
440
  MANAGER_DEV_MODE: {
444
441
  def: false,
445
442
  parser: boolParser,
446
- desc: "enable visibility of utility apps in Manager"
443
+ desc: "enable visibility of utility apps in Manager",
447
444
  },
448
445
  MANAGER_INSTALL_DELAY: {
449
446
  def: 1000,
450
447
  parser: intParser,
451
- desc: "defines the time to wait before installing apps to prevent known glitch (<=1.5.5) when chaining installs"
448
+ desc: "defines the time to wait before installing apps to prevent known glitch (<=1.5.5) when chaining installs",
452
449
  },
453
450
  MAX_ACCOUNT_NAME_SIZE: {
454
451
  def: 50,
455
452
  parser: intParser,
456
- desc: "maximum size of account names"
453
+ desc: "maximum size of account names",
457
454
  },
458
455
  MOCK: {
459
456
  def: "",
460
457
  parser: stringParser,
461
- desc: "switch the app into a MOCK mode for test purpose, the value will be used as a seed for the rng. Avoid falsy values."
458
+ desc: "switch the app into a MOCK mode for test purpose, the value will be used as a seed for the rng. Avoid falsy values.",
462
459
  },
463
460
  MOCK_COUNTERVALUES: {
464
461
  def: "",
465
462
  parser: stringParser,
466
- desc: "switch the countervalues resolution into a MOCK mode for test purpose"
463
+ desc: "switch the countervalues resolution into a MOCK mode for test purpose",
467
464
  },
468
465
  MOCK_SWAP_KYC: {
469
466
  def: "",
470
467
  parser: stringParser,
471
- desc: "mock the server response for the exchange KYC check, options are 'open', 'pending', 'closed' or 'approved'."
468
+ desc: "mock the server response for the exchange KYC check, options are 'open', 'pending', 'closed' or 'approved'.",
472
469
  },
473
470
  MOCK_SWAP_CHECK_QUOTE: {
474
471
  def: "",
475
472
  parser: stringParser,
476
- desc: "mock the server response for the exchange check quote, options are 'RATE_VALID', 'KYC_FAILED', 'KYC_PENDING', 'KYC_UNDEFINED', 'KYC_UPGRADE_REQUIRED', 'MFA_REQUIRED', 'OVER_TRADE_LIMIT', 'UNKNOW_USER' or 'UNKNOWN_ERROR'."
473
+ desc: "mock the server response for the exchange check quote, options are 'RATE_VALID', 'KYC_FAILED', 'KYC_PENDING', 'KYC_UNDEFINED', 'KYC_UPGRADE_REQUIRED', 'MFA_REQUIRED', 'OVER_TRADE_LIMIT', 'UNKNOW_USER' or 'UNKNOWN_ERROR'.",
477
474
  },
478
475
  MOCK_SWAP_WIDGET_BASE_URL: {
479
476
  def: "",
480
477
  parser: stringParser,
481
- desc: "mock the FTX swap widget base url"
478
+ desc: "mock the FTX swap widget base url",
482
479
  },
483
480
  /**
484
481
  * Note: the mocked cryptoassets config and test partner are signed with the
@@ -487,283 +484,273 @@ var envDefinitions = {
487
484
  MOCK_EXCHANGE_TEST_CONFIG: {
488
485
  def: false,
489
486
  parser: boolParser,
490
- desc: "mock the cryptoassets config and test partner (in the context of app-exchange)"
487
+ desc: "mock the cryptoassets config and test partner (in the context of app-exchange)",
491
488
  },
492
489
  MOCK_REMOTE_LIVE_MANIFEST: {
493
490
  def: "",
494
491
  parser: stringParser,
495
- desc: "mock remote live app manifest"
492
+ desc: "mock remote live app manifest",
496
493
  },
497
494
  MOCK_OS_VERSION: {
498
495
  def: "",
499
496
  parser: stringParser,
500
- desc: "if defined, overrides the os and version. format: os@version. Example: Windows_NT@6.1.7601"
497
+ desc: "if defined, overrides the os and version. format: os@version. Example: Windows_NT@6.1.7601",
501
498
  },
502
499
  NFT_CURRENCIES: {
503
500
  def: "ethereum,polygon",
504
501
  parser: stringParser,
505
- desc: "set the currencies where NFT is active"
502
+ desc: "set the currencies where NFT is active",
506
503
  },
507
504
  NFT_ETH_METADATA_SERVICE: {
508
505
  def: "https://nft.api.live.ledger.com",
509
506
  parser: stringParser,
510
- desc: "service uri used to get the metadata of an nft"
507
+ desc: "service uri used to get the metadata of an nft",
511
508
  },
512
509
  OPERATION_ADDRESSES_LIMIT: {
513
510
  def: 100,
514
511
  parser: intParser,
515
- desc: "limit the number of addresses in from/to of operations"
512
+ desc: "limit the number of addresses in from/to of operations",
516
513
  },
517
514
  OPERATION_OPTIMISTIC_RETENTION: {
518
515
  def: 30 * 60 * 1000,
519
516
  parser: intParser,
520
- desc: "timeout to keep an optimistic operation that was broadcasted but not yet visible from the coin implementation or the API"
517
+ desc: "timeout to keep an optimistic operation that was broadcasted but not yet visible from the coin implementation or the API",
521
518
  },
522
519
  OPERATION_PAGE_SIZE_INITIAL: {
523
520
  def: 100,
524
521
  parser: intParser,
525
- desc: "defines the initial default operation length page to use"
522
+ desc: "defines the initial default operation length page to use",
526
523
  },
527
524
  POLKADOT_ELECTION_STATUS_THRESHOLD: {
528
525
  def: 25,
529
526
  parser: intParser,
530
- desc: "in blocks - number of blocks before Polkadot election effectively opens to consider it as open and disable all staking features"
527
+ desc: "in blocks - number of blocks before Polkadot election effectively opens to consider it as open and disable all staking features",
531
528
  },
532
529
  SATSTACK: {
533
530
  def: false,
534
531
  parser: boolParser,
535
- desc: "Switch to satstack mode"
532
+ desc: "Switch to satstack mode",
536
533
  },
537
534
  SCAN_FOR_INVALID_PATHS: {
538
535
  def: false,
539
536
  parser: boolParser,
540
- desc: "enable searching accounts in exotic derivation paths"
537
+ desc: "enable searching accounts in exotic derivation paths",
541
538
  },
542
539
  SEED: {
543
540
  def: "",
544
541
  parser: stringParser,
545
- desc: "(dev feature) seed to be used by speculos (device simulator)"
542
+ desc: "(dev feature) seed to be used by speculos (device simulator)",
546
543
  },
547
544
  SHOW_LEGACY_NEW_ACCOUNT: {
548
545
  def: false,
549
546
  parser: boolParser,
550
- desc: "allow the creation of legacy accounts"
547
+ desc: "allow the creation of legacy accounts",
551
548
  },
552
549
  SKIP_ONBOARDING: {
553
550
  def: false,
554
551
  parser: boolParser,
555
- desc: "dev flag to skip onboarding flow"
552
+ desc: "dev flag to skip onboarding flow",
556
553
  },
557
554
  SPECULOS_PID_OFFSET: {
558
555
  def: 0,
559
556
  parser: intParser,
560
- desc: "offset to be added to the speculos pid and avoid collision with other instances"
557
+ desc: "offset to be added to the speculos pid and avoid collision with other instances",
561
558
  },
562
559
  SWAP_API_BASE: {
563
560
  def: "https://swap.ledger.com/v4",
564
561
  parser: stringParser,
565
- desc: "Swap API base"
562
+ desc: "Swap API base",
566
563
  },
567
564
  SYNC_ALL_INTERVAL: {
568
565
  def: 8 * 60 * 1000,
569
566
  parser: intParser,
570
- desc: "delay between successive sync"
567
+ desc: "delay between successive sync",
571
568
  },
572
569
  SYNC_BOOT_DELAY: {
573
570
  def: 2 * 1000,
574
571
  parser: intParser,
575
- desc: "delay before the sync starts"
572
+ desc: "delay before the sync starts",
576
573
  },
577
574
  SYNC_PENDING_INTERVAL: {
578
575
  def: 10 * 1000,
579
576
  parser: intParser,
580
- desc: "delay between sync when an operation is still pending"
577
+ desc: "delay between sync when an operation is still pending",
581
578
  },
582
579
  SYNC_OUTDATED_CONSIDERED_DELAY: {
583
580
  def: 10 * 60 * 1000,
584
581
  parser: intParser,
585
- desc: "delay until Live consider a sync outdated"
582
+ desc: "delay until Live consider a sync outdated",
586
583
  },
587
584
  SYNC_MAX_CONCURRENT: {
588
585
  def: 4,
589
586
  parser: intParser,
590
- desc: "maximum limit to synchronize accounts concurrently to limit overload"
587
+ desc: "maximum limit to synchronize accounts concurrently to limit overload",
591
588
  },
592
589
  BOT_MAX_CONCURRENT: {
593
590
  def: 10,
594
591
  parser: intParser,
595
- desc: "maximum limit to run bot spec in parallel"
592
+ desc: "maximum limit to run bot spec in parallel",
596
593
  },
597
594
  USER_ID: {
598
595
  def: "",
599
596
  parser: stringParser,
600
- desc: "unique identifier of app instance. used to derivate dissociated ids for difference purposes (e.g. the firmware update incremental deployment)."
597
+ desc: "unique identifier of app instance. used to derivate dissociated ids for difference purposes (e.g. the firmware update incremental deployment).",
601
598
  },
602
599
  WALLETCONNECT: {
603
600
  def: false,
604
601
  parser: boolParser,
605
- desc: "is walletconnect enabled"
602
+ desc: "is walletconnect enabled",
606
603
  },
607
604
  WITH_DEVICE_POLLING_DELAY: {
608
605
  def: 500,
609
606
  parser: floatParser,
610
- desc: "delay when polling device"
607
+ desc: "delay when polling device",
611
608
  },
612
609
  ANNOUNCEMENTS_API_URL: {
613
610
  def: "https://cdn.live.ledger.com/announcements",
614
611
  parser: stringParser,
615
- desc: "url used to fetch new announcements"
612
+ desc: "url used to fetch new announcements",
616
613
  },
617
614
  ANNOUNCEMENTS_API_VERSION: {
618
615
  def: 1,
619
616
  parser: intParser,
620
- desc: "version used for the announcements api"
617
+ desc: "version used for the announcements api",
621
618
  },
622
619
  STATUS_API_URL: {
623
620
  def: "https://ledger.statuspage.io/api",
624
621
  parser: stringParser,
625
- desc: "url used to fetch ledger status"
622
+ desc: "url used to fetch ledger status",
626
623
  },
627
624
  STATUS_API_VERSION: {
628
625
  def: 2,
629
626
  parser: intParser,
630
- desc: "version used for ledger status api"
627
+ desc: "version used for ledger status api",
631
628
  },
632
629
  TEZOS_MAX_TX_QUERIES: {
633
630
  def: 100,
634
631
  parser: intParser,
635
- desc: "safe max on maximum number of queries to synchronize a tezos account"
632
+ desc: "safe max on maximum number of queries to synchronize a tezos account",
636
633
  },
637
634
  PLATFORM_DEBUG: {
638
635
  def: false,
639
636
  parser: boolParser,
640
- desc: "enable visibility of debug apps and tools in Platform Catalog"
637
+ desc: "enable visibility of debug apps and tools in Platform Catalog",
641
638
  },
642
639
  PLATFORM_EXPERIMENTAL_APPS: {
643
640
  def: false,
644
641
  parser: boolParser,
645
- desc: "enable visibility of experimental apps and tools in Platform Catalog"
642
+ desc: "enable visibility of experimental apps and tools in Platform Catalog",
646
643
  },
647
644
  PLATFORM_MANIFEST_API_URL: {
648
645
  def: "https://live-app-catalog.ledger.com/api/v1/apps",
649
646
  parser: stringParser,
650
- desc: "url used to fetch platform app manifests"
647
+ desc: "url used to fetch platform app manifests",
651
648
  },
652
649
  PLATFORM_LOCAL_MANIFEST_JSON: {
653
650
  def: "",
654
651
  parser: stringParser,
655
- desc: 'json manifest for a local (test) platform app manifests. How to use: PLATFORM_LOCAL_MANIFEST_JSON="$(cat /path/to/file.json)"'
652
+ desc: 'json manifest for a local (test) platform app manifests. How to use: PLATFORM_LOCAL_MANIFEST_JSON="$(cat /path/to/file.json)"',
656
653
  },
657
654
  PLATFORM_GLOBAL_CATALOG_API_URL: {
658
655
  def: "https://cdn.live.ledger.com/platform/catalog/v1/data.json",
659
656
  parser: stringParser,
660
- desc: "url used to fetch platform app manifests"
657
+ desc: "url used to fetch platform app manifests",
661
658
  },
662
659
  PLATFORM_GLOBAL_CATALOG_STAGING_API_URL: {
663
660
  def: "https://cdn.live.ledger-stg.com/platform/catalog/v1/data.json",
664
661
  parser: stringParser,
665
- desc: "url used to fetch platform app manifests (staging)"
662
+ desc: "url used to fetch platform app manifests (staging)",
666
663
  },
667
664
  PLATFORM_RAMP_CATALOG_API_URL: {
668
665
  def: "https://cdn.live.ledger.com/platform/trade/v1/data.json",
669
666
  parser: stringParser,
670
- desc: "url used to fetch platform app manifests"
667
+ desc: "url used to fetch platform app manifests",
671
668
  },
672
669
  PLATFORM_RAMP_CATALOG_STAGING_API_URL: {
673
670
  def: "https://cdn.live.ledger-stg.com/platform/trade/v1/data.json",
674
671
  parser: stringParser,
675
- desc: "url used to fetch platform app manifests (staging)"
672
+ desc: "url used to fetch platform app manifests (staging)",
676
673
  },
677
674
  PLATFORM_API_URL: {
678
675
  def: "",
679
676
  parser: stringParser,
680
- desc: "url used to fetch platform catalog"
677
+ desc: "url used to fetch platform catalog",
681
678
  },
682
679
  PLATFORM_API_VERSION: {
683
680
  def: 1,
684
681
  parser: intParser,
685
- desc: "version used for the platform api"
682
+ desc: "version used for the platform api",
686
683
  },
687
684
  PLAYWRIGHT_RUN: {
688
685
  def: false,
689
686
  parser: boolParser,
690
- desc: "true when launched for E2E testing"
687
+ desc: "true when launched for E2E testing",
691
688
  },
692
689
  MARKET_API_URL: {
693
690
  def: "https://proxycg.api.live.ledger.com/api/v3",
694
691
  parser: stringParser,
695
- desc: "Market data api"
692
+ desc: "Market data api",
696
693
  },
697
694
  USE_LEARN_STAGING_URL: {
698
695
  def: false,
699
696
  parser: boolParser,
700
- desc: "use the staging URL for the learn page"
697
+ desc: "use the staging URL for the learn page",
701
698
  },
702
699
  DYNAMIC_CAL_BASE_URL: {
703
700
  def: "https://cdn.live.ledger.com/cryptoassets",
704
701
  parser: stringParser,
705
- desc: "bucket S3 of the dynamic cryptoassets list"
702
+ desc: "bucket S3 of the dynamic cryptoassets list",
706
703
  },
707
704
  FEATURE_FLAGS: {
708
705
  def: "{}",
709
706
  parser: jsonParser,
710
- desc: "key value map for feature flags: {[key in FeatureId]?: Feature]}"
707
+ desc: "key value map for feature flags: {[key in FeatureId]?: Feature]}",
711
708
  },
712
709
  PERFORMANCE_CONSOLE: {
713
710
  def: false,
714
711
  parser: boolParser,
715
- desc: "Show a performance overlay on the app UI"
712
+ desc: "Show a performance overlay on the app UI",
716
713
  },
717
714
  ETHEREUM_STUCK_TRANSACTION_TIMEOUT: {
718
715
  def: 5 * 60 * 1000,
719
716
  parser: intParser,
720
- desc: "Time after which an optimisc operation is considered stuck"
721
- }
722
- };
723
- export var getDefinition = function (name) {
724
- return envDefinitions[name];
717
+ desc: "Time after which an optimisc operation is considered stuck",
718
+ },
725
719
  };
720
+ export const getDefinition = (name) => envDefinitions[name];
726
721
  envDefinitions;
727
- var defaults = mapValues(envDefinitions, function (o) { return o.def; });
722
+ const defaults = mapValues(envDefinitions, (o) => o.def);
728
723
  // private local state
729
- var env = __assign({}, defaults);
730
- export var getAllEnvNames = function () {
731
- return Object.keys(envDefinitions);
732
- };
733
- export var getAllEnvs = function () { return (__assign({}, env)); };
724
+ const env = Object.assign({}, defaults);
725
+ export const getAllEnvNames = () => Object.keys(envDefinitions);
726
+ export const getAllEnvs = () => (Object.assign({}, env));
734
727
  // Usage: you must use getEnv at runtime because the env might be settled over time. typically will allow us to dynamically change them on the interface (e.g. some sort of experimental flags system)
735
- export var getEnv = function (name) {
736
- return env[name];
737
- };
738
- export var getEnvDefault = function (name) { return defaults[name]; };
739
- export var isEnvDefault = function (name) {
740
- return env[name] === defaults[name];
741
- };
742
- export var getEnvDesc = function (name) {
743
- return envDefinitions[name].desc;
744
- };
745
- export var changes = new Subject();
728
+ export const getEnv = (name) => env[name];
729
+ export const getEnvDefault = (name) => defaults[name];
730
+ export const isEnvDefault = (name) => env[name] === defaults[name];
731
+ export const getEnvDesc = (name) => envDefinitions[name].desc;
732
+ export const changes = new Subject();
746
733
  // change one environment
747
- export var setEnv = function (name, value) {
748
- var oldValue = env[name];
734
+ export const setEnv = (name, value) => {
735
+ const oldValue = env[name];
749
736
  if (oldValue !== value) {
750
737
  env[name] = value;
751
738
  changes.next({
752
- name: name,
753
- value: value,
754
- oldValue: oldValue
739
+ name,
740
+ value,
741
+ oldValue,
755
742
  });
756
743
  }
757
744
  };
758
745
  // change one environment with safety. returns true if it succeed
759
- export var setEnvUnsafe = function (name, unsafeValue) {
760
- var definition = getDefinition(name);
746
+ export const setEnvUnsafe = (name, unsafeValue) => {
747
+ const definition = getDefinition(name);
761
748
  if (!definition)
762
749
  return false;
763
- var parser = definition.parser;
764
- var value = parser(unsafeValue);
750
+ const { parser } = definition;
751
+ const value = parser(unsafeValue);
765
752
  if (value === undefined || value === null) {
766
- console.warn("Invalid ENV value for ".concat(name));
753
+ console.warn(`Invalid ENV value for ${name}`);
767
754
  return false;
768
755
  }
769
756
  // $FlowFixMe flow don't seem to type proof it