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