blockcypher

package
v0.3.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2018 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Overview

Package blockcypher defines primitives to work with the BlockCypher API.

Index

Constants

View Source
const (
	// DefaultLimiterInterval is the default BlockCypher API limiter
	// interval.
	DefaultLimiterInterval = time.Minute

	// DefaultLimiterSize is the default BlockCypher API limiter size.
	DefaultLimiterSize = 2
)

Variables

This section is empty.

Functions

func RegisterFlags added in v0.3.0

func RegisterFlags()

RegisterFlags registers the flags used by InitializeWithFlags.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a BlockCypher API client.

func New

func New(c *Config) *Client

New creates a client for a Bitcoin network, using an optional BlockCypher API key.

func RunWithFlags added in v0.3.0

func RunWithFlags(ctx context.Context, key string) *Client

RunWithFlags should be called after RegisterFlags and flag.Parse to initialize a blockcypher client using flag values.

func (*Client) Broadcast

func (c *Client) Broadcast(raw []byte) error

Broadcast implements github.com/stratumn/go-indigocore/blockchain/btc.Broadcaster.Broadcast.

func (*Client) FindUnspent

func (c *Client) FindUnspent(address *types.ReversedBytes20, amount int64) ([]btc.Output, int64, error)

FindUnspent implements github.com/stratumn/go-indigocore/blockchain/btc.UnspentFinder.FindUnspent.

func (*Client) Start

func (c *Client) Start(ctx context.Context)

Start starts the client.

type Config

type Config struct {
	// Network is the Bitcoin network.
	Network btc.Network

	// APIKey is an optional BlockCypher API key.
	APIKey string

	// LimiterInterval is the BlockCypher API limiter interval.
	LimiterInterval time.Duration

	// LimiterSize is the BlockCypher API limiter size.
	LimiterSize int
}

Config contains configuration options for the client.

Jump to

Keyboard shortcuts

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