jsonrpc

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: MIT Imports: 20 Imported by: 3

Documentation

Index

Constants

View Source
const (
	CurrencyLBC = Currency("LBC")
	CurrencyUSD = Currency("USD")
	CurrencyBTC = Currency("BTC")
)
View Source
const DefaultPort = 5279

Variables

View Source
var (
	StreamTypeVideo = streamType("video")
	StreamTypeAudio = streamType("audio")
	StreamTypeImage = streamType("image")
)

Functions

func Decode added in v0.1.0

func Decode(data interface{}, targetStruct interface{}) error

Types

type Account added in v0.1.0

type Account struct {
	AddressGenerator struct {
		Change struct {
			Gap                   uint64 `json:"gap"`
			MaximumUsesPerAddress uint64 `json:"maximum_uses_per_address"`
		} `json:"change"`
		Name      string `json:"name"`
		Receiving struct {
			Gap                   uint64 `json:"gap"`
			MaximumUsesPerAddress uint64 `json:"maximum_uses_per_address"`
		} `json:"receiving"`
	} `json:"address_generator"`
	Certificates uint64  `json:"certificates"`
	Coins        float64 `json:"coins"`
	Encrypted    bool    `json:"encrypted"`
	ID           string  `json:"id"`
	IsDefault    bool    `json:"is_default"`
	Name         string  `json:"name"`
	PublicKey    string  `json:"public_key"`
	Satoshis     uint64  `json:"satoshis"`
}

type AccountBalanceResponse added in v0.1.0

type AccountBalanceResponse string

type AccountCreateResponse added in v0.1.0

type AccountCreateResponse struct {
	ID         string  `json:"id"`
	Name       string  `json:"name"`
	PublicKey  string  `json:"public_key"`
	PrivateKey string  `json:"private_key"`
	Seed       string  `json:"seed"`
	Ledger     string  `json:"ledger"`
	ModifiedOn float64 `json:"modified_on"`
}

type AccountFundResponse added in v0.1.0

type AccountFundResponse TransactionSummary

type AccountListResponse added in v0.1.0

type AccountListResponse struct {
	LBCMainnet []Account `json:"lbc_mainnet"`
	LBCTestnet []Account `json:"lbc_testnet"`
	LBCRegtest []Account `json:"lbc_regtest"`
}

type AccountRemoveResponse added in v0.1.0

type AccountRemoveResponse AccountCreateResponse

type AccountSettings added in v0.1.0

type AccountSettings struct {
	Default          *bool   `json:"default,omitempty"`
	NewName          *string `json:"new_name,omitempty"`
	ReceivingGap     *int    `json:"receiving_gap,omitempty"`
	ReceivingMaxUses *int    `json:"receiving_max_uses,omitempty"`
	ChangeGap        *int    `json:"change_gap,omitempty"`
	ChangeMaxUses    *int    `json:"change_max_uses,omitempty"`
}

type Address added in v0.1.0

type Address string

type AddressListResponse added in v0.1.0

type AddressListResponse []Address

type AddressUnusedResponse added in v0.1.0

type AddressUnusedResponse Address

type BlobAnnounceResponse

type BlobAnnounceResponse bool

type BlobAvailability

type BlobAvailability struct {
	IsAvailable      bool     `json:"is_available"`
	ReachablePeers   []string `json:"reachable_peers"`
	UnReachablePeers []string `json:"unreachable_peers"`
}

type BlobGetResponse

type BlobGetResponse struct {
	Blobs []struct {
		BlobHash string `json:"blob_hash,omitempty"`
		BlobNum  int    `json:"blob_num"`
		IV       string `json:"iv"`
		Length   int    `json:"length"`
	} `json:"blobs"`
	Key               string `json:"key"`
	StreamHash        string `json:"stream_hash"`
	StreamName        string `json:"stream_name"`
	StreamType        string `json:"stream_type"`
	SuggestedFileName string `json:"suggested_file_name"`
}

type ChannelCreateOptions added in v0.1.0

type ChannelCreateOptions struct {
	ClaimCreateOptions `json:",flatten"`
	Email              *string  `json:"email,omitempty"`
	WebsiteURL         *string  `json:"website_url,omitempty"`
	CoverURL           *string  `json:"cover_url,omitempty"`
	Featured           []string `json:"featured,omitempty"`
}

type ChannelExportResponse added in v1.0.16

type ChannelExportResponse string

type ChannelListResponse

type ChannelListResponse struct {
	Items      []Transaction `json:"items"`
	Page       uint64        `json:"page"`
	PageSize   uint64        `json:"page_size"`
	TotalPages uint64        `json:"total_pages"`
}

type ChannelUpdateOptions added in v0.1.0

type ChannelUpdateOptions struct {
	ChannelCreateOptions `json:",flatten"`
	NewSigningKey        *bool `json:"new_signing_key,omitempty"`
	ClearFeatured        *bool `json:"clear_featured,omitempty"`
	ClearTags            *bool `json:"clear_tags,omitempty"`
	ClearLanguages       *bool `json:"clear_languages,omitempty"`
	ClearLocations       *bool `json:"clear_locations,omitempty"`
}

type Claim

type Claim struct {
	Address                 string           `json:"address"`
	Amount                  string           `json:"amount"`
	CanonicalURL            string           `json:"canonical_url"`
	ClaimID                 string           `json:"claim_id"`
	ClaimOp                 string           `json:"claim_op,omitempty"`
	Confirmations           int              `json:"confirmations"`
	Height                  int              `json:"height"`
	IsChange                bool             `json:"is_change,omitempty"`
	IsChannelSignatureValid bool             `json:"is_channel_signature_valid,omitempty"`
	Meta                    Meta             `json:"meta,omitempty"`
	Name                    string           `json:"name"`
	NormalizedName          string           `json:"normalized_name"`
	Nout                    uint64           `json:"nout"`
	PermanentURL            string           `json:"permanent_url"`
	ShortURL                string           `json:"short_url"`
	SigningChannel          *Claim           `json:"signing_channel,omitempty"`
	Timestamp               int              `json:"timestamp"`
	Txid                    string           `json:"txid"`
	Type                    string           `json:"type,omitempty"`
	Value                   lbryschema.Claim `json:"protobuf,omitempty"`
	ValueType               string           `json:"value_type,omitempty"`
	AbsoluteChannelPosition int              `json:"absolute_channel_position,omitempty"`
	ChannelName             string           `json:"channel_name,omitempty"`
	ClaimSequence           int64            `json:"claim_sequence,omitempty"`
	DecodedClaim            bool             `json:"decoded_claim,omitempty"`
	EffectiveAmount         string           `json:"effective_amount,omitempty"`
	HasSignature            *bool            `json:"has_signature,omitempty"`
	SignatureIsValid        *bool            `json:"signature_is_valid,omitempty"`
	Supports                []Support        `json:"supports,omitempty"`
	ValidAtHeight           int              `json:"valid_at_height,omitempty"`
}

func (*Claim) GetStreamSizeByMagic added in v0.1.0

func (c *Claim) GetStreamSizeByMagic() (streamSize uint64, e error)

GetStreamSizeByMagic uses "magic" to not just estimate, but actually return the exact size of a stream It does so by fetching the sd blob and the last blob from our S3 bucket, decrypting and unpadding the last blob adding up all full blobs that have a known size and finally adding the real last blob size too. This will only work if we host at least the sd blob and the last blob on S3, if not, this will error.

type ClaimAbandonResponse

type ClaimAbandonResponse struct {
	Success bool               `json:"success"`
	Tx      TransactionSummary `json:"tx"`
}

type ClaimCreateOptions added in v0.1.0

type ClaimCreateOptions struct {
	Title        *string    `json:"title,omitempty"`
	Description  *string    `json:"description,omitempty"`
	Tags         []string   `json:"tags,omitempty"`
	Languages    []string   `json:"languages,omitempty"`
	Locations    []Location `json:"locations,omitempty"`
	ThumbnailURL *string    `json:"thumbnail_url,omitempty"`
	AccountID    *string    `json:"account_id,omitempty"`
	ClaimAddress *string    `json:"claim_address,omitempty"`
	Preview      *bool      `json:"preview,omitempty"`
}

type ClaimListResponse

type ClaimListResponse struct {
	Claims     []Claim `json:"items"`
	Page       uint64  `json:"page"`
	PageSize   uint64  `json:"page_size"`
	TotalPages uint64  `json:"total_pages"`
}

type ClaimSearchResponse added in v0.1.0

type ClaimSearchResponse ClaimListResponse

type ClaimShowResponse

type ClaimShowResponse *Claim

type Client

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

func NewClient

func NewClient(address string) *Client

func NewClientAndWait

func NewClientAndWait(address string) *Client

func (*Client) AccountBalance added in v0.1.0

func (d *Client) AccountBalance(account *string) (*AccountBalanceResponse, error)

func (*Client) AccountCreate added in v0.1.0

func (d *Client) AccountCreate(accountName string, singleKey bool) (*AccountCreateResponse, error)

func (*Client) AccountFund added in v0.1.0

func (d *Client) AccountFund(fromAccount string, toAccount string, amount string, outputs uint64, everything bool) (*AccountFundResponse, error)

funds an account. If everything is true then amount is ignored

func (*Client) AccountList added in v0.1.0

func (d *Client) AccountList() (*AccountListResponse, error)

============================================

NEW SDK

============================================

func (*Client) AccountRemove added in v0.1.0

func (d *Client) AccountRemove(accountID string) (*AccountRemoveResponse, error)

func (*Client) AccountSet added in v0.1.0

func (d *Client) AccountSet(accountID string, settings AccountSettings) (*Account, error)

func (*Client) AddressList added in v0.1.0

func (d *Client) AddressList(account *string) (*AddressListResponse, error)

func (*Client) AddressUnused added in v0.1.0

func (d *Client) AddressUnused(account *string) (*AddressUnusedResponse, error)

func (*Client) ChannelAbandon added in v0.1.0

func (d *Client) ChannelAbandon(txID string, nOut uint64, accountID *string, blocking bool) (*TransactionSummary, error)

func (*Client) ChannelCreate added in v0.1.0

func (d *Client) ChannelCreate(name string, bid float64, options ChannelCreateOptions) (*TransactionSummary, error)

func (*Client) ChannelExport added in v1.0.16

func (d *Client) ChannelExport(channelClaimID string, channelName, accountID *string) (*ChannelExportResponse, error)

func (*Client) ChannelList

func (d *Client) ChannelList(account *string, page uint64, pageSize uint64) (*ChannelListResponse, error)

func (*Client) ChannelUpdate added in v0.1.0

func (d *Client) ChannelUpdate(claimID string, options ChannelUpdateOptions) (*TransactionSummary, error)

func (*Client) ClaimList

func (d *Client) ClaimList(account *string, page uint64, pageSize uint64) (*ClaimListResponse, error)

func (*Client) ClaimSearch added in v0.1.0

func (d *Client) ClaimSearch(claimName, claimID, txid *string, nout *uint) (*ClaimSearchResponse, error)

func (*Client) FileList

func (d *Client) FileList() (*FileListResponse, error)

func (*Client) Get

func (d *Client) Get(uri string) (*GetResponse, error)

func (*Client) Resolve

func (d *Client) Resolve(urls string) (*ResolveResponse, error)

func (*Client) SetRPCTimeout

func (d *Client) SetRPCTimeout(timeout time.Duration)

func (*Client) SingleAccountList added in v0.1.0

func (d *Client) SingleAccountList(accountID string) (*Account, error)

func (*Client) Status

func (d *Client) Status() (*StatusResponse, error)

func (*Client) StreamAbandon added in v0.1.0

func (d *Client) StreamAbandon(txID string, nOut uint64, accountID *string, blocking bool) (*ClaimAbandonResponse, error)

func (*Client) StreamCreate added in v0.1.0

func (d *Client) StreamCreate(name, filePath string, bid float64, options StreamCreateOptions) (*TransactionSummary, error)

func (*Client) StreamUpdate added in v0.1.0

func (d *Client) StreamUpdate(claimID string, options StreamUpdateOptions) (*TransactionSummary, error)

func (*Client) UTXOList

func (d *Client) UTXOList(account *string) (*UTXOListResponse, error)

func (*Client) Version

func (d *Client) Version() (*VersionResponse, error)

type Currency

type Currency string

type Fee

type Fee struct {
	FeeCurrency Currency        `json:"fee_currency"`
	FeeAmount   decimal.Decimal `json:"fee_amount"`
	FeeAddress  *string         `json:"fee_address"`
}

type File

type File struct {
	BlobsCompleted       uint64            `json:"blobs_completed"`
	BlobsInStream        uint64            `json:"blobs_in_stream"`
	BlobsRemaining       uint64            `json:"blobs_remaining"`
	ChannelClaimID       string            `json:"channel_claim_id"`
	ChannelName          string            `json:"channel_name"`
	ClaimID              string            `json:"claim_id"`
	ClaimName            string            `json:"claim_name"`
	Completed            bool              `json:"completed"`
	Confirmations        int64             `json:"confirmations"`
	ContentFee           *Fee              `json:"content_fee"`
	DownloadDirectory    string            `json:"download_directory"`
	DownloadPath         string            `json:"download_path"`
	FileName             string            `json:"file_name"`
	Height               int               `json:"height"`
	Key                  string            `json:"key"`
	Metadata             *lbryschema.Claim `json:"protobuf"`
	MimeType             string            `json:"mime_type"`
	Nout                 int               `json:"nout"`
	Outpoint             string            `json:"outpoint"`
	PointsPaid           decimal.Decimal   `json:"points_paid"`
	SdHash               string            `json:"sd_hash"`
	Status               string            `json:"status"`
	Stopped              bool              `json:"stopped"`
	StreamHash           string            `json:"stream_hash"`
	StreamName           string            `json:"stream_name"`
	StreamingURL         string            `json:"streaming_url"`
	SuggestedFileName    string            `json:"suggested_file_name"`
	Timestamp            int64             `json:"timestamp"`
	TotalBytes           uint64            `json:"total_bytes"`
	TotalBytesLowerBound uint64            `json:"total_bytes_lower_bound"`
	Txid                 string            `json:"txid"`
	WrittenBytes         uint64            `json:"written_bytes"`
}

type FileListResponse

type FileListResponse []File

type GetResponse

type GetResponse File

type Location added in v0.1.0

type Location struct {
	Country    *string `json:"country,omitempty"`
	State      *string `json:"state,omitempty"`
	City       *string `json:"city,omitempty"`
	PostalCode *string `json:"code,omitempty"`
	Latitude   *string `json:"latitude,omitempty"`
	Longitude  *string `json:"longitude,omitempty"`
}

type Meta added in v0.1.0

type Meta struct {
	ActivationHeight  int64   `json:"activation_height,omitempty"`
	CreationHeight    int64   `json:"creation_height,omitempty"`
	CreationTimestamp int     `json:"creation_timestamp,omitempty"`
	EffectiveAmount   string  `json:"effective_amount,omitempty"`
	ExpirationHeight  int64   `json:"expiration_height,omitempty"`
	IsControlling     bool    `json:"is_controlling,omitempty"`
	SupportAmount     string  `json:"support_amount,omitempty"`
	TrendingGlobal    float64 `json:"trending_global,omitempty"`
	TrendingGroup     float64 `json:"trending_group,omitempty"`
	TrendingLocal     float64 `json:"trending_local,omitempty"`
	TrendingMixed     float64 `json:"trending_mixed,omitempty"`
}

type NumClaimsInChannelResponse

type NumClaimsInChannelResponse map[string]struct {
	ClaimsInChannel *uint64 `json:"claims_in_channel,omitempty"`
	Error           *string `json:"error,omitempty"`
}

type PeerListResponse

type PeerListResponse []PeerListResponsePeer

type PeerListResponsePeer

type PeerListResponsePeer struct {
	IP     string `json:"host"`
	Port   uint   `json:"port"`
	NodeId string `json:"node_id"`
}

type ResolveResponse

type ResolveResponse map[string]Claim

type StatusResponse

type StatusResponse struct {
	BlobManager struct {
		FinishedBlobs uint64 `json:"finished_blobs"`
	} `json:"blob_manager"`
	ConnectionStatus struct {
		Code    string `json:"code"`
		Message string `json:"message"`
	} `json:"connection_status"`
	Dht struct {
		NodeID              string `json:"node_id"`
		PeersInRoutingTable uint64 `json:"peers_in_routing_table"`
	} `json:"dht"`
	HashAnnouncer struct {
		AnnounceQueueSize uint64 `json:"announce_queue_size"`
	} `json:"hash_announcer"`
	InstallationID    string   `json:"installation_id"`
	IsFirstRun        bool     `json:"is_first_run"`
	IsRunning         bool     `json:"is_running"`
	SkippedComponents []string `json:"skipped_components"`
	StartupStatus     struct {
		BlobManager         bool `json:"blob_manager"`
		BlockchainHeaders   bool `json:"blockchain_headers"`
		Database            bool `json:"database"`
		Dht                 bool `json:"dht"`
		ExchangeRateManager bool `json:"exchange_rate_manager"`
		HashAnnouncer       bool `json:"hash_announcer"`
		PeerProtocolServer  bool `json:"peer_protocol_server"`
		StreamManager       bool `json:"stream_manager"`
		Upnp                bool `json:"upnp"`
		Wallet              bool `json:"wallet"`
	} `json:"startup_status"`
	StreamManager struct {
		ManagedFiles int64 `json:"managed_files"`
	} `json:"stream_manager"`
	Upnp struct {
		AioupnpVersion  string   `json:"aioupnp_version"`
		DhtRedirectSet  bool     `json:"dht_redirect_set"`
		ExternalIp      string   `json:"external_ip"`
		Gateway         string   `json:"gateway"`
		PeerRedirectSet bool     `json:"peer_redirect_set"`
		Redirects       struct{} `json:"redirects"`
	}
	Wallet struct {
		BestBlochash string `json:"best_blockhash"`
		Blocks       int    `json:"blocks"`
		BlocksBehind int    `json:"blocks_behind"`
		IsEncrypted  bool   `json:"is_encrypted"`
		IsLocked     bool   `json:"is_locked"`
	} `json:"wallet"`
}

type StreamAvailabilityResponse

type StreamAvailabilityResponse struct {
	IsAvailable          bool             `json:"is_available"`
	DidDecode            bool             `json:"did_decode"`
	DidResolve           bool             `json:"did_resolve"`
	IsStream             bool             `json:"is_stream"`
	NumBlobsInStream     uint64           `json:"num_blobs_in_stream"`
	SDHash               string           `json:"sd_hash"`
	SDBlobAvailability   BlobAvailability `json:"sd_blob_availability"`
	HeadBlobHash         string           `json:"head_blob_hash"`
	HeadBlobAvailability BlobAvailability `json:"head_blob_availability"`
	UseUPNP              bool             `json:"use_upnp"`
	UPNPRedirectIsSet    bool             `json:"upnp_redirect_is_set"`
	Error                string           `json:"error,omitempty"`
}

type StreamCostEstimateResponse

type StreamCostEstimateResponse decimal.Decimal

type StreamCreateOptions added in v0.1.0

type StreamCreateOptions struct {
	ClaimCreateOptions `json:",flatten"`
	Fee                *Fee        `json:",omitempty,flatten"`
	Author             *string     `json:"author,omitempty"`
	License            *string     `json:"license,omitempty"`
	LicenseURL         *string     `json:"license_url,omitempty"`
	StreamType         *streamType `json:"stream_type,omitempty"`
	ReleaseTime        *int64      `json:"release_time,omitempty"`
	Duration           *uint64     `json:"duration,omitempty"`
	Width              *uint       `json:"width,omitempty"`
	Height             *uint       `json:"height,omitempty"`
	Preview            *string     `json:"preview,omitempty"`
	AllowDuplicateName *bool       `json:"allow_duplicate_name,omitempty"`
	ChannelName        *string     `json:"channel_name,omitempty"`
	ChannelID          *string     `json:"channel_id,omitempty"`
	ChannelAccountID   *string     `json:"channel_account_id,omitempty"`
}

type StreamUpdateOptions added in v0.1.0

type StreamUpdateOptions struct {
	ClearTags            *bool   `json:"clear_tags,omitempty"`
	ClearLanguages       *bool   `json:"clear_languages,omitempty"`
	ClearLocations       *bool   `json:"clear_locations,omitempty"`
	Name                 *string `json:"name,omitempty"`
	FilePath             *string `json:"file_path,omitempty"`
	FileSize             *uint64 `json:"file_size,omitempty"`
	Bid                  *string `json:"bid,omitempty"`
	*StreamCreateOptions `json:",flatten"`
}

type Support

type Support struct {
	Amount string `json:"amount"`
	Nout   uint64 `json:"nout"`
	Txid   string `json:"txid"`
}

type Transaction added in v0.1.0

type Transaction struct {
	Address       string            `json:"address"`
	Amount        string            `json:"amount"`
	ClaimID       string            `json:"claim_id"`
	Confirmations int               `json:"confirmations"`
	Height        int               `json:"height"`
	IsChange      bool              `json:"is_change"`
	IsMine        bool              `json:"is_mine"`
	Name          string            `json:"name"`
	Nout          uint64            `json:"nout"`
	PermanentUrl  string            `json:"permanent_url"`
	Protobuf      string            `json:"protobuf,omitempty"`
	Txid          string            `json:"txid"`
	Type          string            `json:"type"`
	Value         *lbryschema.Claim `json:"protobuf"`
}

type TransactionSummary added in v0.1.0

type TransactionSummary struct {
	Height      int           `json:"height"`
	Hex         string        `json:"hex"`
	Inputs      []Transaction `json:"inputs"`
	Outputs     []Transaction `json:"outputs"`
	TotalFee    string        `json:"total_fee"`
	TotalOutput string        `json:"total_output"`
	Txid        string        `json:"txid"`
}

type UTXOListResponse

type UTXOListResponse []struct {
	Address       string `json:"address"`
	Amount        string `json:"amount"`
	Confirmations int    `json:"confirmations"`
	Height        int    `json:"height"`
	IsChange      bool   `json:"is_change"`
	IsMine        bool   `json:"is_mine"`
	Nout          int    `json:"nout"`
	Txid          string `json:"txid"`
	Type          string `json:"type"`
}

type VersionResponse

type VersionResponse struct {
	Build   string `json:"build"`
	Desktop string `json:"desktop"`
	Distro  struct {
		Codename     string `json:"codename"`
		ID           string `json:"id"`
		Like         string `json:"like"`
		Version      string `json:"version"`
		VersionParts struct {
			BuildNumber string `json:"build_number"`
			Major       string `json:"major"`
			Minor       string `json:"minor"`
		} `json:"version_parts"`
	} `json:"distro"`
	LbrynetVersion    string `json:"lbrynet_version"`
	LbryschemaVersion string `json:"lbryschema_version"`
	OsRelease         string `json:"os_release"`
	OsSystem          string `json:"os_system"`
	Platform          string `json:"platform"`
	Processor         string `json:"processor"`
	PythonVersion     string `json:"python_version"`
}

type WalletBalanceResponse

type WalletBalanceResponse decimal.Decimal

type WalletListResponse

type WalletListResponse []string

type WalletNewAddressResponse

type WalletNewAddressResponse string

type WalletPrefillAddressesResponse

type WalletPrefillAddressesResponse struct {
	Broadcast bool   `json:"broadcast"`
	Complete  bool   `json:"complete"`
	Hex       string `json:"hex"`
}

type WalletUnusedAddressResponse

type WalletUnusedAddressResponse string

Jump to

Keyboard shortcuts

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