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