@ledgerhq/live-env 0.1.1-nightly.0 → 0.2.0-next.0

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