/lib/DDG/Spice/BitcoinBalance.pm

https://github.com/pardocz/zeroclickinfo-spice · Perl · 34 lines · 22 code · 9 blank · 3 comment · 0 complexity · cf63aaa4b6b0edbda22ea30ef5b9c1ea MD5 · raw file

  1. package DDG::Spice::BitcoinBalance;
  2. # ABSTRACT: Displays the balance of a Bitcoin address from the Chain.com API.
  3. use DDG::Spice;
  4. primary_example_queries "17x23dNjXJLzGMev6R63uyRhMWP1VHawKc", "1Gn2dRFqouUHvuWPVhriCDtP3qVQc59WHy", "3QJmV3qfvL9SuYo34YihAf3sRCW3qSinyC";
  5. description "Display the balance of a Bitcoin address";
  6. name "Bitcoin Address Balance";
  7. source "http://chain.com";
  8. code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/BitcoinBalance.pm";
  9. topics "economy_and_finance";
  10. category "finance";
  11. icon_url "https://chain.com/chain32x32.ico";
  12. attribution github => ['https://github.com/chain-engineering','chain.com'],
  13. email => ['hello@chain.com','hello@chain.com'],
  14. twitter => "chain",
  15. web => ['https://chain.com','chain.com'];
  16. triggers query_raw => qr/^[13][1-9A-HJ-NP-Za-km-z]{26,33}$/;
  17. # This regular expression identifies the unique properties of a Bitcoin Address.
  18. spice to => 'https://api.chain.com/v1/bitcoin/addresses/$1?key={{ENV{DDG_SPICE_BITCOIN_APIKEY}}}';
  19. # The Chain API requires an API key. Chain has granted the spice a free account with unlimited access. We can provide this to DuckDuckGo before release.
  20. spice wrap_jsonp_callback => 1;
  21. spice proxy_cache_valid => "418 1d";
  22. handle query_raw => sub {
  23. return $_;
  24. };
  25. 1;