@ledgerhq/live-env 0.1.1-nightly.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,451 +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.",
437
429
  },
438
430
  LIST_APPS_V2: {
439
431
  def: false,
440
432
  parser: boolParser,
441
- desc: "use new version of list apps for My Ledger"
433
+ desc: "use new version of list apps for My Ledger",
442
434
  },
443
435
  MANAGER_API_BASE: {
444
436
  def: "https://manager.api.live.ledger.com/api",
445
437
  parser: stringParser,
446
- desc: "Ledger Manager API"
438
+ desc: "Ledger Manager API",
447
439
  },
448
440
  MANAGER_DEV_MODE: {
449
441
  def: false,
450
442
  parser: boolParser,
451
- desc: "enable visibility of utility apps in Manager"
443
+ desc: "enable visibility of utility apps in Manager",
452
444
  },
453
445
  MANAGER_INSTALL_DELAY: {
454
446
  def: 1000,
455
447
  parser: intParser,
456
- 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",
457
449
  },
458
450
  MAX_ACCOUNT_NAME_SIZE: {
459
451
  def: 50,
460
452
  parser: intParser,
461
- desc: "maximum size of account names"
453
+ desc: "maximum size of account names",
462
454
  },
463
455
  MOCK: {
464
456
  def: "",
465
457
  parser: stringParser,
466
- 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.",
467
459
  },
468
460
  MOCK_COUNTERVALUES: {
469
461
  def: "",
470
462
  parser: stringParser,
471
- 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",
472
464
  },
473
465
  MOCK_SWAP_KYC: {
474
466
  def: "",
475
467
  parser: stringParser,
476
- 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'.",
477
469
  },
478
470
  MOCK_SWAP_CHECK_QUOTE: {
479
471
  def: "",
480
472
  parser: stringParser,
481
- 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'.",
482
474
  },
483
475
  MOCK_SWAP_WIDGET_BASE_URL: {
484
476
  def: "",
485
477
  parser: stringParser,
486
- desc: "mock the FTX swap widget base url"
478
+ desc: "mock the FTX swap widget base url",
487
479
  },
488
480
  /**
489
481
  * Note: the mocked cryptoassets config and test partner are signed with the
@@ -492,283 +484,273 @@ var envDefinitions = {
492
484
  MOCK_EXCHANGE_TEST_CONFIG: {
493
485
  def: false,
494
486
  parser: boolParser,
495
- 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)",
496
488
  },
497
489
  MOCK_REMOTE_LIVE_MANIFEST: {
498
490
  def: "",
499
491
  parser: stringParser,
500
- desc: "mock remote live app manifest"
492
+ desc: "mock remote live app manifest",
501
493
  },
502
494
  MOCK_OS_VERSION: {
503
495
  def: "",
504
496
  parser: stringParser,
505
- 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",
506
498
  },
507
499
  NFT_CURRENCIES: {
508
500
  def: "ethereum,polygon",
509
501
  parser: stringParser,
510
- desc: "set the currencies where NFT is active"
502
+ desc: "set the currencies where NFT is active",
511
503
  },
512
504
  NFT_ETH_METADATA_SERVICE: {
513
505
  def: "https://nft.api.live.ledger.com",
514
506
  parser: stringParser,
515
- desc: "service uri used to get the metadata of an nft"
507
+ desc: "service uri used to get the metadata of an nft",
516
508
  },
517
509
  OPERATION_ADDRESSES_LIMIT: {
518
510
  def: 100,
519
511
  parser: intParser,
520
- desc: "limit the number of addresses in from/to of operations"
512
+ desc: "limit the number of addresses in from/to of operations",
521
513
  },
522
514
  OPERATION_OPTIMISTIC_RETENTION: {
523
515
  def: 30 * 60 * 1000,
524
516
  parser: intParser,
525
- 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",
526
518
  },
527
519
  OPERATION_PAGE_SIZE_INITIAL: {
528
520
  def: 100,
529
521
  parser: intParser,
530
- desc: "defines the initial default operation length page to use"
522
+ desc: "defines the initial default operation length page to use",
531
523
  },
532
524
  POLKADOT_ELECTION_STATUS_THRESHOLD: {
533
525
  def: 25,
534
526
  parser: intParser,
535
- 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",
536
528
  },
537
529
  SATSTACK: {
538
530
  def: false,
539
531
  parser: boolParser,
540
- desc: "Switch to satstack mode"
532
+ desc: "Switch to satstack mode",
541
533
  },
542
534
  SCAN_FOR_INVALID_PATHS: {
543
535
  def: false,
544
536
  parser: boolParser,
545
- desc: "enable searching accounts in exotic derivation paths"
537
+ desc: "enable searching accounts in exotic derivation paths",
546
538
  },
547
539
  SEED: {
548
540
  def: "",
549
541
  parser: stringParser,
550
- desc: "(dev feature) seed to be used by speculos (device simulator)"
542
+ desc: "(dev feature) seed to be used by speculos (device simulator)",
551
543
  },
552
544
  SHOW_LEGACY_NEW_ACCOUNT: {
553
545
  def: false,
554
546
  parser: boolParser,
555
- desc: "allow the creation of legacy accounts"
547
+ desc: "allow the creation of legacy accounts",
556
548
  },
557
549
  SKIP_ONBOARDING: {
558
550
  def: false,
559
551
  parser: boolParser,
560
- desc: "dev flag to skip onboarding flow"
552
+ desc: "dev flag to skip onboarding flow",
561
553
  },
562
554
  SPECULOS_PID_OFFSET: {
563
555
  def: 0,
564
556
  parser: intParser,
565
- 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",
566
558
  },
567
559
  SWAP_API_BASE: {
568
560
  def: "https://swap.ledger.com/v4",
569
561
  parser: stringParser,
570
- desc: "Swap API base"
562
+ desc: "Swap API base",
571
563
  },
572
564
  SYNC_ALL_INTERVAL: {
573
565
  def: 8 * 60 * 1000,
574
566
  parser: intParser,
575
- desc: "delay between successive sync"
567
+ desc: "delay between successive sync",
576
568
  },
577
569
  SYNC_BOOT_DELAY: {
578
570
  def: 2 * 1000,
579
571
  parser: intParser,
580
- desc: "delay before the sync starts"
572
+ desc: "delay before the sync starts",
581
573
  },
582
574
  SYNC_PENDING_INTERVAL: {
583
575
  def: 10 * 1000,
584
576
  parser: intParser,
585
- desc: "delay between sync when an operation is still pending"
577
+ desc: "delay between sync when an operation is still pending",
586
578
  },
587
579
  SYNC_OUTDATED_CONSIDERED_DELAY: {
588
580
  def: 10 * 60 * 1000,
589
581
  parser: intParser,
590
- desc: "delay until Live consider a sync outdated"
582
+ desc: "delay until Live consider a sync outdated",
591
583
  },
592
584
  SYNC_MAX_CONCURRENT: {
593
585
  def: 4,
594
586
  parser: intParser,
595
- desc: "maximum limit to synchronize accounts concurrently to limit overload"
587
+ desc: "maximum limit to synchronize accounts concurrently to limit overload",
596
588
  },
597
589
  BOT_MAX_CONCURRENT: {
598
590
  def: 10,
599
591
  parser: intParser,
600
- desc: "maximum limit to run bot spec in parallel"
592
+ desc: "maximum limit to run bot spec in parallel",
601
593
  },
602
594
  USER_ID: {
603
595
  def: "",
604
596
  parser: stringParser,
605
- 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).",
606
598
  },
607
599
  WALLETCONNECT: {
608
600
  def: false,
609
601
  parser: boolParser,
610
- desc: "is walletconnect enabled"
602
+ desc: "is walletconnect enabled",
611
603
  },
612
604
  WITH_DEVICE_POLLING_DELAY: {
613
605
  def: 500,
614
606
  parser: floatParser,
615
- desc: "delay when polling device"
607
+ desc: "delay when polling device",
616
608
  },
617
609
  ANNOUNCEMENTS_API_URL: {
618
610
  def: "https://cdn.live.ledger.com/announcements",
619
611
  parser: stringParser,
620
- desc: "url used to fetch new announcements"
612
+ desc: "url used to fetch new announcements",
621
613
  },
622
614
  ANNOUNCEMENTS_API_VERSION: {
623
615
  def: 1,
624
616
  parser: intParser,
625
- desc: "version used for the announcements api"
617
+ desc: "version used for the announcements api",
626
618
  },
627
619
  STATUS_API_URL: {
628
620
  def: "https://ledger.statuspage.io/api",
629
621
  parser: stringParser,
630
- desc: "url used to fetch ledger status"
622
+ desc: "url used to fetch ledger status",
631
623
  },
632
624
  STATUS_API_VERSION: {
633
625
  def: 2,
634
626
  parser: intParser,
635
- desc: "version used for ledger status api"
627
+ desc: "version used for ledger status api",
636
628
  },
637
629
  TEZOS_MAX_TX_QUERIES: {
638
630
  def: 100,
639
631
  parser: intParser,
640
- 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",
641
633
  },
642
634
  PLATFORM_DEBUG: {
643
635
  def: false,
644
636
  parser: boolParser,
645
- desc: "enable visibility of debug apps and tools in Platform Catalog"
637
+ desc: "enable visibility of debug apps and tools in Platform Catalog",
646
638
  },
647
639
  PLATFORM_EXPERIMENTAL_APPS: {
648
640
  def: false,
649
641
  parser: boolParser,
650
- desc: "enable visibility of experimental apps and tools in Platform Catalog"
642
+ desc: "enable visibility of experimental apps and tools in Platform Catalog",
651
643
  },
652
644
  PLATFORM_MANIFEST_API_URL: {
653
645
  def: "https://live-app-catalog.ledger.com/api/v1/apps",
654
646
  parser: stringParser,
655
- desc: "url used to fetch platform app manifests"
647
+ desc: "url used to fetch platform app manifests",
656
648
  },
657
649
  PLATFORM_LOCAL_MANIFEST_JSON: {
658
650
  def: "",
659
651
  parser: stringParser,
660
- 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)"',
661
653
  },
662
654
  PLATFORM_GLOBAL_CATALOG_API_URL: {
663
655
  def: "https://cdn.live.ledger.com/platform/catalog/v1/data.json",
664
656
  parser: stringParser,
665
- desc: "url used to fetch platform app manifests"
657
+ desc: "url used to fetch platform app manifests",
666
658
  },
667
659
  PLATFORM_GLOBAL_CATALOG_STAGING_API_URL: {
668
660
  def: "https://cdn.live.ledger-stg.com/platform/catalog/v1/data.json",
669
661
  parser: stringParser,
670
- desc: "url used to fetch platform app manifests (staging)"
662
+ desc: "url used to fetch platform app manifests (staging)",
671
663
  },
672
664
  PLATFORM_RAMP_CATALOG_API_URL: {
673
665
  def: "https://cdn.live.ledger.com/platform/trade/v1/data.json",
674
666
  parser: stringParser,
675
- desc: "url used to fetch platform app manifests"
667
+ desc: "url used to fetch platform app manifests",
676
668
  },
677
669
  PLATFORM_RAMP_CATALOG_STAGING_API_URL: {
678
670
  def: "https://cdn.live.ledger-stg.com/platform/trade/v1/data.json",
679
671
  parser: stringParser,
680
- desc: "url used to fetch platform app manifests (staging)"
672
+ desc: "url used to fetch platform app manifests (staging)",
681
673
  },
682
674
  PLATFORM_API_URL: {
683
675
  def: "",
684
676
  parser: stringParser,
685
- desc: "url used to fetch platform catalog"
677
+ desc: "url used to fetch platform catalog",
686
678
  },
687
679
  PLATFORM_API_VERSION: {
688
680
  def: 1,
689
681
  parser: intParser,
690
- desc: "version used for the platform api"
682
+ desc: "version used for the platform api",
691
683
  },
692
684
  PLAYWRIGHT_RUN: {
693
685
  def: false,
694
686
  parser: boolParser,
695
- desc: "true when launched for E2E testing"
687
+ desc: "true when launched for E2E testing",
696
688
  },
697
689
  MARKET_API_URL: {
698
690
  def: "https://proxycg.api.live.ledger.com/api/v3",
699
691
  parser: stringParser,
700
- desc: "Market data api"
692
+ desc: "Market data api",
701
693
  },
702
694
  USE_LEARN_STAGING_URL: {
703
695
  def: false,
704
696
  parser: boolParser,
705
- desc: "use the staging URL for the learn page"
697
+ desc: "use the staging URL for the learn page",
706
698
  },
707
699
  DYNAMIC_CAL_BASE_URL: {
708
700
  def: "https://cdn.live.ledger.com/cryptoassets",
709
701
  parser: stringParser,
710
- desc: "bucket S3 of the dynamic cryptoassets list"
702
+ desc: "bucket S3 of the dynamic cryptoassets list",
711
703
  },
712
704
  FEATURE_FLAGS: {
713
705
  def: "{}",
714
706
  parser: jsonParser,
715
- desc: "key value map for feature flags: {[key in FeatureId]?: Feature]}"
707
+ desc: "key value map for feature flags: {[key in FeatureId]?: Feature]}",
716
708
  },
717
709
  PERFORMANCE_CONSOLE: {
718
710
  def: false,
719
711
  parser: boolParser,
720
- desc: "Show a performance overlay on the app UI"
712
+ desc: "Show a performance overlay on the app UI",
721
713
  },
722
714
  ETHEREUM_STUCK_TRANSACTION_TIMEOUT: {
723
715
  def: 5 * 60 * 1000,
724
716
  parser: intParser,
725
- desc: "Time after which an optimisc operation is considered stuck"
726
- }
727
- };
728
- export var getDefinition = function (name) {
729
- return envDefinitions[name];
717
+ desc: "Time after which an optimisc operation is considered stuck",
718
+ },
730
719
  };
720
+ export const getDefinition = (name) => envDefinitions[name];
731
721
  envDefinitions;
732
- var defaults = mapValues(envDefinitions, function (o) { return o.def; });
722
+ const defaults = mapValues(envDefinitions, (o) => o.def);
733
723
  // private local state
734
- var env = __assign({}, defaults);
735
- export var getAllEnvNames = function () {
736
- return Object.keys(envDefinitions);
737
- };
738
- 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));
739
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)
740
- export var getEnv = function (name) {
741
- return env[name];
742
- };
743
- export var getEnvDefault = function (name) { return defaults[name]; };
744
- export var isEnvDefault = function (name) {
745
- return env[name] === defaults[name];
746
- };
747
- export var getEnvDesc = function (name) {
748
- return envDefinitions[name].desc;
749
- };
750
- 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();
751
733
  // change one environment
752
- export var setEnv = function (name, value) {
753
- var oldValue = env[name];
734
+ export const setEnv = (name, value) => {
735
+ const oldValue = env[name];
754
736
  if (oldValue !== value) {
755
737
  env[name] = value;
756
738
  changes.next({
757
- name: name,
758
- value: value,
759
- oldValue: oldValue
739
+ name,
740
+ value,
741
+ oldValue,
760
742
  });
761
743
  }
762
744
  };
763
745
  // change one environment with safety. returns true if it succeed
764
- export var setEnvUnsafe = function (name, unsafeValue) {
765
- var definition = getDefinition(name);
746
+ export const setEnvUnsafe = (name, unsafeValue) => {
747
+ const definition = getDefinition(name);
766
748
  if (!definition)
767
749
  return false;
768
- var parser = definition.parser;
769
- var value = parser(unsafeValue);
750
+ const { parser } = definition;
751
+ const value = parser(unsafeValue);
770
752
  if (value === undefined || value === null) {
771
- console.warn("Invalid ENV value for ".concat(name));
753
+ console.warn(`Invalid ENV value for ${name}`);
772
754
  return false;
773
755
  }
774
756
  // $FlowFixMe flow don't seem to type proof it