Skip to content

Commit a6a77d4

Browse files
committed
Copy dcrdata types to remove dependencies.
1 parent 5250585 commit a6a77d4

4 files changed

Lines changed: 75 additions & 293 deletions

File tree

dcrdata.go

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package main
2+
3+
// The types in this file are returned by the dcrdata API. They are copied from
4+
// the decred/dcrdata repo to prevent having to import it and all of its
5+
// dependencies.
6+
7+
// TreasuryBalance is the current balance, spent amount, and tx count for the
8+
// treasury.
9+
type TreasuryBalance struct {
10+
Balance int64 `json:"balance"`
11+
// TxCount should probably be called OutputCount.
12+
TxCount int64 `json:"tx_count"`
13+
AddCount int64 `json:"add_count"`
14+
Added int64 `json:"added"`
15+
SpendCount int64 `json:"spend_count"`
16+
Spent int64 `json:"spent"`
17+
TGenCount int64 `json:"tgen_count"`
18+
TGen int64 `json:"tbase"`
19+
ImmatureCount int64 `json:"immature_count"`
20+
Immature int64 `json:"immature"`
21+
}
22+
23+
// CoinSupply models the coin supply at a certain best block.
24+
type CoinSupply struct {
25+
Height int64 `json:"block_height"`
26+
Hash string `json:"block_hash"`
27+
Mined int64 `json:"supply_mined"`
28+
Ultimate int64 `json:"supply_ultimate"`
29+
}
30+
31+
// BlockDataBasic models primary information about a block.
32+
type BlockDataBasic struct {
33+
Height uint32 `json:"height"`
34+
Size uint32 `json:"size"`
35+
Hash string `json:"hash"`
36+
Difficulty float64 `json:"diff"`
37+
StakeDiff float64 `json:"sdiff"`
38+
Time int64 `json:"time"`
39+
NumTx uint32 `json:"txlength"`
40+
MiningFee *int64 `json:"fees,omitempty"`
41+
TotalSent *int64 `json:"total_sent,omitempty"`
42+
// TicketPoolInfo may be nil for side chain blocks.
43+
PoolInfo *TicketPoolInfo `json:"ticket_pool,omitempty"`
44+
}
45+
46+
// BlockSubsidies contains the block reward proportions for a certain block
47+
// height. The stake_reward is per vote, while total is for a certain number of
48+
// votes.
49+
type BlockSubsidies struct {
50+
BlockNum int64 `json:"height"`
51+
BlockHash string `json:"hash,omitempty"`
52+
Work int64 `json:"work_reward"`
53+
Stake int64 `json:"stake_reward"`
54+
NumVotes int16 `json:"num_votes,omitempty"`
55+
TotalStake int64 `json:"stake_reward_total,omitempty"`
56+
Tax int64 `json:"project_subsidy"`
57+
Total int64 `json:"total,omitempty"`
58+
}
59+
60+
// TicketPoolInfo models data about ticket pool
61+
type TicketPoolInfo struct {
62+
Height uint32 `json:"height"`
63+
Size uint32 `json:"size"`
64+
Value float64 `json:"value"`
65+
ValAvg float64 `json:"valavg"`
66+
Winners []string `json:"winners"`
67+
}

go.mod

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,10 @@
11
module github.com/decred/dcrwebapi
22

3-
go 1.23.0
3+
go 1.25.0
44

55
require (
6-
github.com/decred/dcrdata/v6 v6.0.0
76
github.com/decred/vspd/types/v3 v3.0.0
87
github.com/gorilla/handlers v1.5.2
98
)
109

11-
require (
12-
decred.org/dcrwallet v1.7.1 // indirect
13-
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
14-
github.com/dchest/siphash v1.2.3 // indirect
15-
github.com/decred/base58 v1.0.5 // indirect
16-
github.com/decred/dcrd/blockchain/stake/v3 v3.0.1 // indirect
17-
github.com/decred/dcrd/blockchain/standalone/v2 v2.2.0 // indirect
18-
github.com/decred/dcrd/chaincfg/chainhash v1.0.4 // indirect
19-
github.com/decred/dcrd/chaincfg/v3 v3.2.1 // indirect
20-
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
21-
github.com/decred/dcrd/crypto/ripemd160 v1.0.2 // indirect
22-
github.com/decred/dcrd/database/v2 v2.0.3 // indirect
23-
github.com/decred/dcrd/dcrec v1.0.1 // indirect
24-
github.com/decred/dcrd/dcrec/edwards/v2 v2.0.3 // indirect
25-
github.com/decred/dcrd/dcrec/secp256k1/v3 v3.0.1 // indirect
26-
github.com/decred/dcrd/dcrjson/v3 v3.1.1 // indirect
27-
github.com/decred/dcrd/dcrutil/v3 v3.0.1 // indirect
28-
github.com/decred/dcrd/rpc/jsonrpc/types/v2 v2.3.1 // indirect
29-
github.com/decred/dcrd/txscript/v3 v3.0.1 // indirect
30-
github.com/decred/dcrd/wire v1.7.0 // indirect
31-
github.com/decred/slog v1.2.0 // indirect
32-
github.com/felixge/httpsnoop v1.0.4 // indirect
33-
github.com/golang/snappy v0.0.4 // indirect
34-
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
35-
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
36-
golang.org/x/net v0.38.0 // indirect
37-
golang.org/x/sys v0.31.0 // indirect
38-
gopkg.in/yaml.v2 v2.4.0 // indirect
39-
lukechampine.com/blake3 v1.3.0 // indirect
40-
)
10+
require github.com/felixge/httpsnoop v1.1.0 // indirect

0 commit comments

Comments
 (0)