Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New endpoints for dcrweb statistics. #184

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ISC License

Copyright (c) 2017-2023 The Decred developers
Copyright (c) 2017-2024 The Decred developers

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand Down
34 changes: 34 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,37 @@ Example: <https://api.decred.org/?c=vsp>
},
}
```

## Web Info

Collects data from dcrdata and caches it, serves to JavaScript running on the
homepage of <https://decred.org>.

Example: <https://api.decred.org/?c=webinfo>

```json
{
"circulatingsupply": 15804577.17784509,
"ultimatesupply": 20999999.9839432,
"stakedsupply": 9855286.05084056,
"blockreward": 8.061013,
"treasury": 822237.44313611,
"ticketprice": 268.19271648,
"height": 837324,
"lastupdated": 1706092430
}
```

## Price Info

Returns the current USD price of Bitcoin and Decred as reported by dcrdata.

Example: <https://api.decred.org/?c=price>

```json
{
"bitcoin_usd": 40119.53495,
"decred_usd": 14.1665886541639,
"lastupdated": 1706092430
}
```
58 changes: 56 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,60 @@ module github.com/decred/dcrwebapi

go 1.18

require github.com/gorilla/handlers v1.5.1
require (
github.com/decred/dcrd/dcrutil/v4 v4.0.0
github.com/decred/dcrdata/exchanges/v3 v3.1.0
github.com/decred/dcrdata/v6 v6.0.0
github.com/gorilla/handlers v1.5.1
)

require github.com/felixge/httpsnoop v1.0.3 // indirect
require (
decred.org/dcrdex v0.4.3 // indirect
decred.org/dcrwallet v1.7.0 // indirect
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
github.com/carterjones/go-cloudflare-scraper v0.1.2 // indirect
github.com/carterjones/signalr v0.3.5 // indirect
github.com/dchest/siphash v1.2.2 // indirect
github.com/decred/base58 v1.0.3 // indirect
github.com/decred/dcrd/blockchain/stake/v3 v3.0.0 // indirect
github.com/decred/dcrd/blockchain/standalone/v2 v2.1.0 // indirect
github.com/decred/dcrd/certgen v1.1.1 // indirect
github.com/decred/dcrd/chaincfg/chainhash v1.0.3 // indirect
github.com/decred/dcrd/chaincfg/v3 v3.1.1 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.1-0.20200921185235-6d75c7ec1199 // indirect
github.com/decred/dcrd/crypto/ripemd160 v1.0.1 // indirect
github.com/decred/dcrd/database/v2 v2.0.2 // indirect
github.com/decred/dcrd/dcrec v1.0.1-0.20200921185235-6d75c7ec1199 // indirect
github.com/decred/dcrd/dcrec/edwards/v2 v2.0.2 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v3 v3.0.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/decred/dcrd/dcrjson/v3 v3.1.0 // indirect
github.com/decred/dcrd/dcrutil/v3 v3.0.0 // indirect
github.com/decred/dcrd/hdkeychain/v3 v3.1.0 // indirect
github.com/decred/dcrd/rpc/jsonrpc/types/v2 v2.3.0 // indirect
github.com/decred/dcrd/txscript/v3 v3.0.0 // indirect
github.com/decred/dcrd/txscript/v4 v4.0.0 // indirect
github.com/decred/dcrd/wire v1.5.0 // indirect
github.com/decred/go-socks v1.1.0 // indirect
github.com/decred/slog v1.2.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/go-chi/chi/v5 v5.0.4 // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/lib/pq v1.10.3 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/robertkrimen/otto v0.0.0-20180617131154-15f95af6e78d // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
go.etcd.io/bbolt v1.3.7-0.20220130032806-d5db64bdbfde // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f // indirect
golang.org/x/sys v0.0.0-20210902050250-f475640dd07b // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
google.golang.org/genproto v0.0.0-20201022181438-0ff5f38871d5 // indirect
google.golang.org/grpc v1.36.1 // indirect
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/ini.v1 v1.55.0 // indirect
gopkg.in/sourcemap.v1 v1.0.5 // indirect
)
Loading
Loading