mirror of
https://github.com/muun/recovery.git
synced 2025-11-13 23:31:38 -05:00
Release v0.3.0
This commit is contained in:
182
vendor/github.com/btcsuite/btcd/btcjson/chainsvrresults.go
generated
vendored
182
vendor/github.com/btcsuite/btcd/btcjson/chainsvrresults.go
generated
vendored
@@ -4,7 +4,14 @@
|
||||
|
||||
package btcjson
|
||||
|
||||
import "encoding/json"
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
)
|
||||
|
||||
// GetBlockHeaderVerboseResult models the data from the getblockheader command when
|
||||
// the verbose flag is set. When the verbose flag is not set, getblockheader
|
||||
@@ -24,9 +31,44 @@ type GetBlockHeaderVerboseResult struct {
|
||||
NextHash string `json:"nextblockhash,omitempty"`
|
||||
}
|
||||
|
||||
// GetBlockStatsResult models the data from the getblockstats command.
|
||||
type GetBlockStatsResult struct {
|
||||
AverageFee int64 `json:"avgfee"`
|
||||
AverageFeeRate int64 `json:"avgfeerate"`
|
||||
AverageTxSize int64 `json:"avgtxsize"`
|
||||
FeeratePercentiles []int64 `json:"feerate_percentiles"`
|
||||
Hash string `json:"blockhash"`
|
||||
Height int64 `json:"height"`
|
||||
Ins int64 `json:"ins"`
|
||||
MaxFee int64 `json:"maxfee"`
|
||||
MaxFeeRate int64 `json:"maxfeerate"`
|
||||
MaxTxSize int64 `json:"maxtxsize"`
|
||||
MedianFee int64 `json:"medianfee"`
|
||||
MedianTime int64 `json:"mediantime"`
|
||||
MedianTxSize int64 `json:"mediantxsize"`
|
||||
MinFee int64 `json:"minfee"`
|
||||
MinFeeRate int64 `json:"minfeerate"`
|
||||
MinTxSize int64 `json:"mintxsize"`
|
||||
Outs int64 `json:"outs"`
|
||||
SegWitTotalSize int64 `json:"swtotal_size"`
|
||||
SegWitTotalWeight int64 `json:"swtotal_weight"`
|
||||
SegWitTxs int64 `json:"swtxs"`
|
||||
Subsidy int64 `json:"subsidy"`
|
||||
Time int64 `json:"time"`
|
||||
TotalOut int64 `json:"total_out"`
|
||||
TotalSize int64 `json:"total_size"`
|
||||
TotalWeight int64 `json:"total_weight"`
|
||||
Txs int64 `json:"txs"`
|
||||
UTXOIncrease int64 `json:"utxo_increase"`
|
||||
UTXOSizeIncrease int64 `json:"utxo_size_inc"`
|
||||
}
|
||||
|
||||
// GetBlockVerboseResult models the data from the getblock command when the
|
||||
// verbose flag is set. When the verbose flag is not set, getblock returns a
|
||||
// hex-encoded string.
|
||||
// verbose flag is set to 1. When the verbose flag is set to 0, getblock returns a
|
||||
// hex-encoded string. When the verbose flag is set to 1, getblock returns an object
|
||||
// whose tx field is an array of transaction hashes. When the verbose flag is set to 2,
|
||||
// getblock returns an object whose tx field is an array of raw transactions.
|
||||
// Use GetBlockVerboseTxResult to unmarshal data received from passing verbose=2 to getblock.
|
||||
type GetBlockVerboseResult struct {
|
||||
Hash string `json:"hash"`
|
||||
Confirmations int64 `json:"confirmations"`
|
||||
@@ -38,7 +80,7 @@ type GetBlockVerboseResult struct {
|
||||
VersionHex string `json:"versionHex"`
|
||||
MerkleRoot string `json:"merkleroot"`
|
||||
Tx []string `json:"tx,omitempty"`
|
||||
RawTx []TxRawResult `json:"rawtx,omitempty"`
|
||||
RawTx []TxRawResult `json:"rawtx,omitempty"` // Note: this field is always empty when verbose != 2.
|
||||
Time int64 `json:"time"`
|
||||
Nonce uint32 `json:"nonce"`
|
||||
Bits string `json:"bits"`
|
||||
@@ -47,6 +89,43 @@ type GetBlockVerboseResult struct {
|
||||
NextHash string `json:"nextblockhash,omitempty"`
|
||||
}
|
||||
|
||||
// GetBlockVerboseTxResult models the data from the getblock command when the
|
||||
// verbose flag is set to 2. When the verbose flag is set to 0, getblock returns a
|
||||
// hex-encoded string. When the verbose flag is set to 1, getblock returns an object
|
||||
// whose tx field is an array of transaction hashes. When the verbose flag is set to 2,
|
||||
// getblock returns an object whose tx field is an array of raw transactions.
|
||||
// Use GetBlockVerboseResult to unmarshal data received from passing verbose=1 to getblock.
|
||||
type GetBlockVerboseTxResult struct {
|
||||
Hash string `json:"hash"`
|
||||
Confirmations int64 `json:"confirmations"`
|
||||
StrippedSize int32 `json:"strippedsize"`
|
||||
Size int32 `json:"size"`
|
||||
Weight int32 `json:"weight"`
|
||||
Height int64 `json:"height"`
|
||||
Version int32 `json:"version"`
|
||||
VersionHex string `json:"versionHex"`
|
||||
MerkleRoot string `json:"merkleroot"`
|
||||
Tx []TxRawResult `json:"tx,omitempty"`
|
||||
Time int64 `json:"time"`
|
||||
Nonce uint32 `json:"nonce"`
|
||||
Bits string `json:"bits"`
|
||||
Difficulty float64 `json:"difficulty"`
|
||||
PreviousHash string `json:"previousblockhash"`
|
||||
NextHash string `json:"nextblockhash,omitempty"`
|
||||
}
|
||||
|
||||
// GetChainTxStatsResult models the data from the getchaintxstats command.
|
||||
type GetChainTxStatsResult struct {
|
||||
Time int64 `json:"time"`
|
||||
TxCount int64 `json:"txcount"`
|
||||
WindowFinalBlockHash string `json:"window_final_block_hash"`
|
||||
WindowFinalBlockHeight int32 `json:"window_final_block_height"`
|
||||
WindowBlockCount int32 `json:"window_block_count"`
|
||||
WindowTxCount int32 `json:"window_tx_count"`
|
||||
WindowInterval int32 `json:"window_interval"`
|
||||
TxRate float64 `json:"txrate"`
|
||||
}
|
||||
|
||||
// CreateMultiSigResult models the data returned from the createmultisig
|
||||
// command.
|
||||
type CreateMultiSigResult struct {
|
||||
@@ -206,23 +285,35 @@ type GetBlockTemplateResult struct {
|
||||
RejectReasion string `json:"reject-reason,omitempty"`
|
||||
}
|
||||
|
||||
// GetMempoolEntryResult models the data returned from the getmempoolentry's
|
||||
// fee field
|
||||
|
||||
type MempoolFees struct {
|
||||
Base float64 `json:"base"`
|
||||
Modified float64 `json:"modified"`
|
||||
Ancestor float64 `json:"ancestor"`
|
||||
Descendant float64 `json:"descendant"`
|
||||
}
|
||||
|
||||
// GetMempoolEntryResult models the data returned from the getmempoolentry
|
||||
// command.
|
||||
type GetMempoolEntryResult struct {
|
||||
Size int32 `json:"size"`
|
||||
Fee float64 `json:"fee"`
|
||||
ModifiedFee float64 `json:"modifiedfee"`
|
||||
Time int64 `json:"time"`
|
||||
Height int64 `json:"height"`
|
||||
StartingPriority float64 `json:"startingpriority"`
|
||||
CurrentPriority float64 `json:"currentpriority"`
|
||||
DescendantCount int64 `json:"descendantcount"`
|
||||
DescendantSize int64 `json:"descendantsize"`
|
||||
DescendantFees float64 `json:"descendantfees"`
|
||||
AncestorCount int64 `json:"ancestorcount"`
|
||||
AncestorSize int64 `json:"ancestorsize"`
|
||||
AncestorFees float64 `json:"ancestorfees"`
|
||||
Depends []string `json:"depends"`
|
||||
VSize int32 `json:"vsize"`
|
||||
Size int32 `json:"size"`
|
||||
Weight int64 `json:"weight"`
|
||||
Fee float64 `json:"fee"`
|
||||
ModifiedFee float64 `json:"modifiedfee"`
|
||||
Time int64 `json:"time"`
|
||||
Height int64 `json:"height"`
|
||||
DescendantCount int64 `json:"descendantcount"`
|
||||
DescendantSize int64 `json:"descendantsize"`
|
||||
DescendantFees float64 `json:"descendantfees"`
|
||||
AncestorCount int64 `json:"ancestorcount"`
|
||||
AncestorSize int64 `json:"ancestorsize"`
|
||||
AncestorFees float64 `json:"ancestorfees"`
|
||||
WTxId string `json:"wtxid"`
|
||||
Fees MempoolFees `json:"fees"`
|
||||
Depends []string `json:"depends"`
|
||||
}
|
||||
|
||||
// GetMempoolInfoResult models the data returned from the getmempoolinfo
|
||||
@@ -584,3 +675,58 @@ type ValidateAddressChainResult struct {
|
||||
IsValid bool `json:"isvalid"`
|
||||
Address string `json:"address,omitempty"`
|
||||
}
|
||||
|
||||
// EstimateSmartFeeResult models the data returned buy the chain server
|
||||
// estimatesmartfee command
|
||||
type EstimateSmartFeeResult struct {
|
||||
FeeRate *float64 `json:"feerate,omitempty"`
|
||||
Errors []string `json:"errors,omitempty"`
|
||||
Blocks int64 `json:"blocks"`
|
||||
}
|
||||
|
||||
var _ json.Unmarshaler = &FundRawTransactionResult{}
|
||||
|
||||
type rawFundRawTransactionResult struct {
|
||||
Transaction string `json:"hex"`
|
||||
Fee float64 `json:"fee"`
|
||||
ChangePosition int `json:"changepos"`
|
||||
}
|
||||
|
||||
// FundRawTransactionResult is the result of the fundrawtransaction JSON-RPC call
|
||||
type FundRawTransactionResult struct {
|
||||
Transaction *wire.MsgTx
|
||||
Fee btcutil.Amount
|
||||
ChangePosition int // the position of the added change output, or -1
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals the result of the fundrawtransaction JSON-RPC call
|
||||
func (f *FundRawTransactionResult) UnmarshalJSON(data []byte) error {
|
||||
var rawRes rawFundRawTransactionResult
|
||||
if err := json.Unmarshal(data, &rawRes); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
txBytes, err := hex.DecodeString(rawRes.Transaction)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var msgTx wire.MsgTx
|
||||
witnessErr := msgTx.Deserialize(bytes.NewReader(txBytes))
|
||||
if witnessErr != nil {
|
||||
legacyErr := msgTx.DeserializeNoWitness(bytes.NewReader(txBytes))
|
||||
if legacyErr != nil {
|
||||
return legacyErr
|
||||
}
|
||||
}
|
||||
|
||||
fee, err := btcutil.NewAmount(rawRes.Fee)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
f.Transaction = &msgTx
|
||||
f.Fee = fee
|
||||
f.ChangePosition = rawRes.ChangePosition
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user