graph

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const DefaultUrl = "http://localhost:26770/graphql"

Variables

This section is empty.

Functions

func Broadcast

func Broadcast(graphUrl, txRaw string) error

func GetHistoryQuery

func GetHistoryQuery(addressUpdates []AddressUpdate) ([]byte, error)

Types

type AddrTxs

type AddrTxs struct {
	Address wallet.Addr
	Txs     []Tx
}

type Address

type Address struct {
	Address string `json:"address"`
	Txs     []Tx   `json:"txs"`
}

type AddressUpdate

type AddressUpdate struct {
	Address wallet.Addr
	Time    time.Time
}

type Block

type Block struct {
	Hash      string    `json:"hash"`
	Height    int64     `json:"height"`
	Timestamp time.Time `json:"timestamp"`
}

type History

type History []AddrTxs

func GetHistory

func GetHistory(url string, addressUpdates []AddressUpdate) (History, error)

func (History) GetAllTxs

func (h History) GetAllTxs() []Tx

type Input

type Input struct {
	Tx        Tx     `json:"tx"`
	Hash      string `json:"hash"`
	Index     int    `json:"index"`
	PrevHash  string `json:"prev_hash"`
	PrevIndex int    `json:"prev_index"`
	Output    Output `json:"output"`
}

type Lock

type Lock struct {
	Address string `json:"address"`
}

type Output

type Output struct {
	Tx       Tx        `json:"tx"`
	Hash     string    `json:"hash"`
	Script   string    `json:"script"`
	Index    int       `json:"index"`
	Amount   int64     `json:"amount"`
	Spends   []Input   `json:"spends"`
	Lock     Lock      `json:"lock"`
	Slp      *Slp      `json:"slp"`
	SlpBaton *SlpBaton `json:"slp_baton"`
}

type Post

type Post struct {
	TxHash  string `json:"tx_hash"`
	Address string `json:"address"`
	Text    string `json:"text"`
	Tx      *Tx    `json:"tx"`
}

func GetPosts

func GetPosts(start time.Time) ([]*Post, error)

type Slp

type Slp struct {
	Hash      string      `json:"hash"`
	Index     uint32      `json:"index"`
	TokenHash string      `json:"token_hash"`
	Amount    uint64      `json:"amount"`
	Genesis   *SlpGenesis `json:"genesis"`
}

type SlpBaton

type SlpBaton struct {
	Hash      string      `json:"hash"`
	Index     uint32      `json:"index"`
	TokenHash string      `json:"token_hash"`
	Genesis   *SlpGenesis `json:"genesis"`
}

type SlpGenesis

type SlpGenesis struct {
	Hash      string `json:"hash"`
	TokenType uint8  `json:"token_type"`
	Decimals  uint8  `json:"decimals"`
	Ticker    string `json:"ticker"`
	Name      string `json:"name"`
	DocUrl    string `json:"doc_url"`
}

type Tx

type Tx struct {
	Hash    string    `json:"hash"`
	Raw     string    `json:"raw"`
	Seen    time.Time `json:"seen"`
	Inputs  []Input   `json:"inputs"`
	Outputs []Output  `json:"outputs"`
	Blocks  []TxBlock `json:"blocks"`
}

func GetTx

func GetTx(hash string) (*Tx, error)

type TxBlock

type TxBlock struct {
	TxHash    string `json:"tx_hash"`
	BlockHash string `json:"block_hash"`
	Tx        Tx     `json:"tx"`
	Block     Block  `json:"block"`
	Index     int    `json:"index"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL