MCPcopy Create free account
hub / github.com/ElementsProject/lightning / add_default_sources

Function add_default_sources

plugins/currencyrate-plugin/src/main.rs:407–459  ·  view source on GitHub ↗
(result: &mut Vec<Source>, has_proxy: bool)

Source from the content-addressed store, hash-verified

405}
406
407fn add_default_sources(result: &mut Vec<Source>, has_proxy: bool) {
408 let coingecko = Source::new(
409 "coingecko",
410 "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies={currency_lc}",
411 vec!["bitcoin", "{currency_lc}"],
412 );
413 result.push(coingecko);
414
415 let kraken = Source::new(
416 "kraken",
417 "https://api.kraken.com/0/public/Ticker?pair=XXBTZ{currency}",
418 vec!["result", "XXBTZ{currency}", "c", "0"],
419 );
420 result.push(kraken);
421
422 let blockchain_info = Source::new(
423 "blockchain.info",
424 "https://blockchain.info/ticker",
425 vec!["{currency}", "last"],
426 );
427 result.push(blockchain_info);
428
429 if !has_proxy {
430 let bitstamp = Source::new(
431 "bitstamp",
432 "https://www.bitstamp.net/api/v2/ticker/btc{currency_lc}",
433 vec!["last"],
434 );
435 result.push(bitstamp);
436 }
437
438 let coindesk = Source::new(
439 "coindesk",
440 "https://data-api.coindesk.com/index/cc/v1/latest/tick\
441 ?market=cadli&instruments=BTC-{currency}&apply_mapping=true",
442 vec!["Data", "BTC-{currency}", "VALUE"],
443 );
444 result.push(coindesk);
445
446 let coinbase = Source::new(
447 "coinbase",
448 "https://api.coinbase.com/v2/prices/BTC-{currency}/spot",
449 vec!["data", "amount"],
450 );
451 result.push(coinbase);
452
453 let binance = Source::new(
454 "binance",
455 "https://data-api.binance.vision/api/v3/ticker/price?symbol=BTC{currency}",
456 vec!["price"],
457 );
458 result.push(binance);
459}

Callers 2

gather_sourcesFunction · 0.85
test_sourcesFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_sourcesFunction · 0.68