-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpcmempoolinfo.go
139 lines (121 loc) · 4.82 KB
/
rpcmempoolinfo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package maestrobitcoingosdk
import (
"context"
"net/http"
"github.com/maestro-org/maestro-bitcoin-go-sdk/internal/apijson"
"github.com/maestro-org/maestro-bitcoin-go-sdk/internal/requestconfig"
"github.com/maestro-org/maestro-bitcoin-go-sdk/option"
)
// RpcMempoolInfoService contains methods and other services that help with
// interacting with the Maestro API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewRpcMempoolInfoService] method instead.
type RpcMempoolInfoService struct {
Options []option.RequestOption
}
// NewRpcMempoolInfoService generates a new service that applies the given options
// to each request. These options are applied after the parent client's options (if
// there is one), and before any request-specific options.
func NewRpcMempoolInfoService(opts ...option.RequestOption) (r *RpcMempoolInfoService) {
r = &RpcMempoolInfoService{}
r.Options = opts
return
}
// Mempool Info
func (r *RpcMempoolInfoService) Get(ctx context.Context, opts ...option.RequestOption) (res *TimestampedMempoolInfo, err error) {
opts = append(r.Options[:], opts...)
path := "rpc/mempool/info"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
type TimestampedMempoolInfo struct {
Data TimestampedMempoolInfoData `json:"data,required"`
LastUpdated TimestampedMempoolInfoLastUpdated `json:"last_updated,required"`
JSON timestampedMempoolInfoJSON `json:"-"`
}
// timestampedMempoolInfoJSON contains the JSON metadata for the struct
// [TimestampedMempoolInfo]
type timestampedMempoolInfoJSON struct {
Data apijson.Field
LastUpdated apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *TimestampedMempoolInfo) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r timestampedMempoolInfoJSON) RawJSON() string {
return r.raw
}
type TimestampedMempoolInfoData struct {
// Total memory usage for the mempool (in bytes)
Bytes int64 `json:"bytes,required"`
// Whether full replace-by-fee (RBF) is enabled
FullRbf bool `json:"full_rbf,required"`
// The incremental relay fee setting (in BTC)
IncrementalRelayFee string `json:"incremental_relay_fee,required"`
// Whether the mempool is fully loaded
Loaded bool `json:"loaded,required"`
// Maximum memory usage for the mempool (in bytes)
MaxMempool int64 `json:"max_mempool,required"`
// The minimum fee rate (in BTC/kB) for mempool transactions
MempoolMinFee string `json:"mempool_min_fee,required"`
// The minimum fee rate (in BTC/kB) for relaying transactions
MinRelayTxFee string `json:"min_relay_tx_fee,required"`
// Number of transactions in the mempool
Size int64 `json:"size,required"`
// The total fees (in BTC) in the mempool
TotalFee string `json:"total_fee,required"`
// Number of transactions that have not been broadcast
UnbroadcastCount int64 `json:"unbroadcast_count,required"`
// Total usage of the mempool (in bytes)
Usage int64 `json:"usage,required"`
JSON timestampedMempoolInfoDataJSON `json:"-"`
}
// timestampedMempoolInfoDataJSON contains the JSON metadata for the struct
// [TimestampedMempoolInfoData]
type timestampedMempoolInfoDataJSON struct {
Bytes apijson.Field
FullRbf apijson.Field
IncrementalRelayFee apijson.Field
Loaded apijson.Field
MaxMempool apijson.Field
MempoolMinFee apijson.Field
MinRelayTxFee apijson.Field
Size apijson.Field
TotalFee apijson.Field
UnbroadcastCount apijson.Field
Usage apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *TimestampedMempoolInfoData) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r timestampedMempoolInfoDataJSON) RawJSON() string {
return r.raw
}
type TimestampedMempoolInfoLastUpdated struct {
// The hash of the block
BlockHash string `json:"block_hash,required"`
// The height of the block in the blockchain
BlockHeight int64 `json:"block_height,required"`
JSON timestampedMempoolInfoLastUpdatedJSON `json:"-"`
}
// timestampedMempoolInfoLastUpdatedJSON contains the JSON metadata for the struct
// [TimestampedMempoolInfoLastUpdated]
type timestampedMempoolInfoLastUpdatedJSON struct {
BlockHash apijson.Field
BlockHeight apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *TimestampedMempoolInfoLastUpdated) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r timestampedMempoolInfoLastUpdatedJSON) RawJSON() string {
return r.raw
}