Documentation ¶
Overview ¶
Package client provides HTTP client for waves nodes.
Creating client with default params:
c, err := client.NewClient() ...
Client can accept custom node url, http client, and api key:
c, err := client.NewClient(client.Options{ Client: &http.Client{Timeout: 30 * time.Second}, BaseUrl: "https://nodes.wavesnodes.com", ApiKey: "ApiKey", }) ...
Simple example of client usage:
c, err := client.NewClient() if err != nil { // handle error } body, response, err := c.Blocks.First(context.Background()) if err != nil { // handle error } ...
Index ¶
- Constants
- Variables
- func NewTimestampFromTime(t time.Time) uint64
- func NewTimestampFromUnixNano(nano int64) uint64
- type Addresses
- func (a *Addresses) Addresses(ctx context.Context) ([]proto.Address, *Response, error)
- func (a *Addresses) Balance(ctx context.Context, address proto.Address) (*AddressesBalance, *Response, error)
- func (a *Addresses) BalanceAfterConfirmations(ctx context.Context, address proto.Address, confirmations uint64) (*BalanceAfterConfirmations, *Response, error)
- func (a *Addresses) BalanceDetails(ctx context.Context, address proto.Address) (*AddressesBalanceDetails, *Response, error)
- func (a *Addresses) EffectiveBalance(ctx context.Context, address proto.Address) (*AddressesEffectiveBalance, *Response, error)
- func (a *Addresses) PublicKey(ctx context.Context, publicKey string) (*proto.Address, *Response, error)
- func (a *Addresses) ScriptInfo(ctx context.Context, address proto.Address) (*AddressesScriptInfo, *Response, error)
- func (a *Addresses) SignText(ctx context.Context, address proto.Address, message string) (*AddressesSignText, *Response, error)
- func (a *Addresses) Validate(ctx context.Context, address proto.Address) (*AddressesValidate, *Response, error)
- func (a *Addresses) VerifyText(ctx context.Context, address proto.Address, body VerifyTextReq) (bool, *Response, error)
- type AddressesBalance
- type AddressesBalanceDetails
- type AddressesEffectiveBalance
- type AddressesScriptInfo
- type AddressesSignText
- type AddressesValidate
- type Alias
- func (a *Alias) Broadcast(ctx context.Context, broadcastReq AliasBroadcastReq) (*CreateAliasWithSig, *Response, error)
- func (a *Alias) Create(ctx context.Context, createReq AliasCreateReq) (*CreateAliasWithSig, *Response, error)
- func (a *Alias) Get(ctx context.Context, alias string) (proto.Address, *Response, error)
- func (a *Alias) GetByAddress(ctx context.Context, address proto.Address) ([]*proto.Alias, *Response, error)
- type AliasBroadcastReq
- type AliasCreateReq
- type Assets
- func (a *Assets) BalanceByAddress(ctx context.Context, address proto.Address) (*AssetsBalances, *Response, error)
- func (a *Assets) BalanceByAddressAndAsset(ctx context.Context, address proto.Address, assetId crypto.Digest) (*AssetsBalanceAndAsset, *Response, error)
- func (a *Assets) Burn(ctx context.Context, burnReq AssetsBurnReq) (*proto.BurnWithSig, *Response, error)
- func (a *Assets) Details(ctx context.Context, assetId crypto.Digest) (*AssetsDetail, *Response, error)
- func (a *Assets) Distribution(ctx context.Context, assetId crypto.Digest) (AssetsDistribution, *Response, error)
- func (a *Assets) Issue(ctx context.Context, issueReq AssetsIssueReq) (*AssetsIssue, *Response, error)
- func (a *Assets) MassTransfer(ctx context.Context, transfersReq AssetsMassTransfersReq) (*proto.MassTransferWithProofs, *Response, error)
- func (a *Assets) Sponsor(ctx context.Context, sponsorReq AssetsSponsorReq) (*proto.SponsorshipWithProofs, *Response, error)
- type AssetsBalance
- type AssetsBalanceAndAsset
- type AssetsBalances
- type AssetsBurnReq
- type AssetsDetail
- type AssetsDistribution
- type AssetsIssue
- type AssetsIssueReq
- type AssetsMassTransferReq
- type AssetsMassTransfersReq
- type AssetsSponsorReq
- type BalanceAfterConfirmations
- type BalancesHistoryRow
- type Block
- type Blocks
- func (a *Blocks) Address(ctx context.Context, addr proto.Address, from, to uint64) ([]*Block, *Response, error)
- func (a *Blocks) At(ctx context.Context, height uint64) (*Block, *Response, error)
- func (a *Blocks) Child(ctx context.Context, id proto.BlockID) (*Block, *Response, error)
- func (a *Blocks) Delay(ctx context.Context, id proto.BlockID, blockNum uint64) (uint64, *Response, error)
- func (a *Blocks) First(ctx context.Context) (*Block, *Response, error)
- func (a *Blocks) HeadersAt(ctx context.Context, height uint64) (*Headers, *Response, error)
- func (a *Blocks) HeadersLast(ctx context.Context) (*Headers, *Response, error)
- func (a *Blocks) HeadersSeq(ctx context.Context, from uint64, to uint64) ([]*Headers, *Response, error)
- func (a *Blocks) Height(ctx context.Context) (*BlocksHeight, *Response, error)
- func (a *Blocks) HeightByID(ctx context.Context, id proto.BlockID) (*BlocksHeight, *Response, error)
- func (a *Blocks) HeightBySignature(ctx context.Context, id string) (*BlocksHeight, *Response, error)
- func (a *Blocks) Last(ctx context.Context) (*Block, *Response, error)
- func (a *Blocks) Seq(ctx context.Context, from, to uint64) ([]*Block, *Response, error)
- func (a *Blocks) Signature(ctx context.Context, id proto.BlockID) (*Block, *Response, error)
- type BlocksHeight
- type Client
- type Consensus
- func (a *Consensus) Algo(ctx context.Context) (string, *Response, error)
- func (a *Consensus) BaseTarget(ctx context.Context) (*ConsensusBaseTarget, *Response, error)
- func (a *Consensus) BaseTargetByBlock(ctx context.Context, blockID string) (uint64, *Response, error)
- func (a Consensus) GeneratingBalance(ctx context.Context, address proto.Address) (*ConsensusGeneratingBalance, *Response, error)
- func (a *Consensus) GenerationSignature(ctx context.Context) (string, *Response, error)
- func (a *Consensus) GenerationSignatureByBlock(ctx context.Context, blockID string) (string, *Response, error)
- type ConsensusBaseTarget
- type ConsensusGeneratingBalance
- type CreateAliasWithSig
- type Debug
- func (a *Debug) BalancesHistory(ctx context.Context, address proto.Address) ([]*BalancesHistoryRow, *Response, error)
- func (a *Debug) Blocks(ctx context.Context, howMany uint64) ([]map[uint64]string, *Response, error)
- func (a *Debug) ConfigInfo(ctx context.Context, full bool) ([]byte, *Response, error)
- func (a *Debug) HistoryInfo(ctx context.Context) (*DebugHistoryInfo, *Response, error)
- func (a *Debug) Info(ctx context.Context) (*DebugInfo, *Response, error)
- func (a *Debug) MinerInfo(ctx context.Context) ([]*DebugMinerInfo, *Response, error)
- func (a *Debug) StateChanges(ctx context.Context, id crypto.Digest) (*StateChangesResponse, *Response, error)
- func (a *Debug) StateHash(ctx context.Context, height uint64) (*proto.StateHash, *Response, error)
- type DebugHistoryInfo
- type DebugInfo
- type DebugMinerInfo
- type Doer
- type Headers
- type HttpClient
- type Leasing
- type LocalScore
- type NxtConsensus
- type Options
- type ParseError
- type PeerAllRow
- type Peers
- func (a *Peers) All(ctx context.Context) ([]*PeerAllRow, *Response, error)
- func (a *Peers) Blacklisted(ctx context.Context) ([]*PeersBlacklistedRow, *Response, error)
- func (a *Peers) ClearBlacklist(ctx context.Context) (string, *Response, error)
- func (a *Peers) Connect(ctx context.Context, host string, port uint16) (*PeersConnect, *Response, error)
- func (a *Peers) Connected(ctx context.Context) ([]*PeersConnectedRow, *Response, error)
- func (a *Peers) Suspended(ctx context.Context) ([]*PeersSuspendedRow, *Response, error)
- type PeersBlacklistedRow
- type PeersConnect
- type PeersConnectedRow
- type PeersSuspendedRow
- type RequestError
- type Response
- type StateChangesResponse
- type Transactions
- func (a *Transactions) Address(ctx context.Context, address proto.Address, limit uint) ([]proto.Transaction, *Response, error)
- func (a *Transactions) Broadcast(ctx context.Context, transaction proto.Transaction) (*Response, error)
- func (a *Transactions) Info(ctx context.Context, id crypto.Digest) (proto.Transaction, *Response, error)
- func (a *Transactions) Unconfirmed(ctx context.Context) ([]proto.Transaction, *Response, error)
- func (a *Transactions) UnconfirmedInfo(ctx context.Context, id crypto.Digest) (proto.Transaction, *Response, error)
- func (a *Transactions) UnconfirmedSize(ctx context.Context) (uint64, *Response, error)
- type TransactionsField
- type Utils
- func (a *Utils) HashFast(ctx context.Context, message string) (*UtilsHashFast, *Response, error)
- func (a *Utils) HashSecure(ctx context.Context, message string) (*UtilsHashSecure, *Response, error)
- func (a *Utils) ScriptCompile(ctx context.Context, code string) (*UtilsScriptCompile, *Response, error)
- func (a *Utils) ScriptEstimate(ctx context.Context, base64code string) (*UtilsScriptEstimate, *Response, error)
- func (a *Utils) Seed(ctx context.Context) (string, *Response, error)
- func (a *Utils) SeedByLength(ctx context.Context, length uint16) (string, *Response, error)
- func (a *Utils) Sign(ctx context.Context, secretKey crypto.SecretKey, message string) (*UtilsSign, *Response, error)
- func (a *Utils) Time(ctx context.Context) (*UtilsTime, *Response, error)
- type UtilsHashFast
- type UtilsHashSecure
- type UtilsScriptCompile
- type UtilsScriptEstimate
- type UtilsSign
- type UtilsTime
- type VerifyText
- type VerifyTextReq
- type Wallet
Constants ¶
const ApiKeyHeader = "X-API-Key"
Variables ¶
var NoApiKeyError = errors.New("no api key provided")
Functions ¶
func NewTimestampFromTime ¶
Types ¶
type Addresses ¶
type Addresses struct {
// contains filtered or unexported fields
}
func NewAddresses ¶
NewAddresses create new address block
func (*Addresses) Balance ¶
func (a *Addresses) Balance(ctx context.Context, address proto.Address) (*AddressesBalance, *Response, error)
Balance returns account's balance by its address
func (*Addresses) BalanceAfterConfirmations ¶
func (a *Addresses) BalanceAfterConfirmations( ctx context.Context, address proto.Address, confirmations uint64) (*BalanceAfterConfirmations, *Response, error)
Balance of address after confirmations
func (*Addresses) BalanceDetails ¶
func (a *Addresses) BalanceDetails(ctx context.Context, address proto.Address) (*AddressesBalanceDetails, *Response, error)
BalanceDetails returns account's detail balance by its address
func (*Addresses) EffectiveBalance ¶
func (a *Addresses) EffectiveBalance(ctx context.Context, address proto.Address) (*AddressesEffectiveBalance, *Response, error)
Account's balance
func (*Addresses) PublicKey ¶
func (a *Addresses) PublicKey(ctx context.Context, publicKey string) (*proto.Address, *Response, error)
Generate address from public key
func (*Addresses) ScriptInfo ¶
func (a *Addresses) ScriptInfo(ctx context.Context, address proto.Address) (*AddressesScriptInfo, *Response, error)
ScriptInfo gets account's script information
func (*Addresses) SignText ¶
func (a *Addresses) SignText(ctx context.Context, address proto.Address, message string) (*AddressesSignText, *Response, error)
Sign a message with a private key associated with address
type AddressesBalance ¶
type AddressesBalanceDetails ¶
type AddressesScriptInfo ¶
type AddressesSignText ¶
type AddressesValidate ¶
type Alias ¶
type Alias struct {
// contains filtered or unexported fields
}
func (*Alias) Broadcast ¶
func (a *Alias) Broadcast(ctx context.Context, broadcastReq AliasBroadcastReq) (*CreateAliasWithSig, *Response, error)
func (*Alias) Create ¶
func (a *Alias) Create(ctx context.Context, createReq AliasCreateReq) (*CreateAliasWithSig, *Response, error)
type AliasBroadcastReq ¶
type AliasCreateReq ¶
type Assets ¶ added in v0.1.2
type Assets struct {
// contains filtered or unexported fields
}
func (*Assets) BalanceByAddress ¶ added in v0.1.2
func (a *Assets) BalanceByAddress(ctx context.Context, address proto.Address) (*AssetsBalances, *Response, error)
Provides detailed information about given asset
func (*Assets) BalanceByAddressAndAsset ¶ added in v0.1.2
func (a *Assets) BalanceByAddressAndAsset(ctx context.Context, address proto.Address, assetId crypto.Digest) (*AssetsBalanceAndAsset, *Response, error)
Account's balance by given asset
func (*Assets) Burn ¶ added in v0.1.2
func (a *Assets) Burn(ctx context.Context, burnReq AssetsBurnReq) (*proto.BurnWithSig, *Response, error)
Burn some of your assets
func (*Assets) Details ¶ added in v0.1.2
func (a *Assets) Details(ctx context.Context, assetId crypto.Digest) (*AssetsDetail, *Response, error)
Provides detailed information about given asset
func (*Assets) Distribution ¶ added in v0.1.2
func (a *Assets) Distribution(ctx context.Context, assetId crypto.Digest) (AssetsDistribution, *Response, error)
Asset balance distribution by account
func (*Assets) Issue ¶ added in v0.1.2
func (a *Assets) Issue(ctx context.Context, issueReq AssetsIssueReq) (*AssetsIssue, *Response, error)
Issue new Asset
func (*Assets) MassTransfer ¶ added in v0.1.2
func (a *Assets) MassTransfer(ctx context.Context, transfersReq AssetsMassTransfersReq) (*proto.MassTransferWithProofs, *Response, error)
Mass transfer of assets
func (*Assets) Sponsor ¶ added in v0.1.2
func (a *Assets) Sponsor(ctx context.Context, sponsorReq AssetsSponsorReq) (*proto.SponsorshipWithProofs, *Response, error)
Sponsor provided asset
type AssetsBalance ¶ added in v0.1.2
type AssetsBalance struct { AssetId crypto.Digest `json:"assetId"` Balance uint64 `json:"balance"` Reissuable bool `json:"reissuable"` MinSponsoredAssetFee uint64 `json:"minSponsoredAssetFee"` SponsorBalance uint64 `json:"sponsorBalance"` Quantity uint64 `json:"quantity"` IssueTransaction proto.IssueWithSig `json:"issueTransaction"` }
type AssetsBalanceAndAsset ¶ added in v0.1.2
type AssetsBalances ¶ added in v0.1.2
type AssetsBalances struct { Address proto.Address `json:"address"` Balances []AssetsBalance `json:"balances"` }
type AssetsBurnReq ¶ added in v0.1.2
type AssetsDetail ¶ added in v0.1.2
type AssetsDetail struct { AssetId crypto.Digest `json:"assetId"` IssueHeight uint64 `json:"issueHeight"` IssueTimestamp uint64 `json:"issueTimestamp"` Issuer proto.Address `json:"issuer"` Name string `json:"name"` Description string `json:"description"` Decimals uint64 `json:"decimals"` Reissuable bool `json:"reissuable"` Quantity uint64 `json:"quantity"` MinSponsoredAssetFee uint64 `json:"minSponsoredAssetFee"` }
type AssetsDistribution ¶ added in v0.1.2
type AssetsIssue ¶ added in v0.1.2
type AssetsIssueReq ¶ added in v0.1.2
type AssetsMassTransferReq ¶ added in v0.1.2
type AssetsMassTransfersReq ¶ added in v0.1.2
type AssetsSponsorReq ¶ added in v0.1.2
type BalancesHistoryRow ¶ added in v0.8.0
type Block ¶
type Block struct { Headers Fee uint64 `json:"fee"` Transactions TransactionsField `json:"transactions"` }
type Blocks ¶
type Blocks struct {
// contains filtered or unexported fields
}
func (*Blocks) HeadersLast ¶
func (*Blocks) HeadersSeq ¶
func (*Blocks) HeightByID ¶ added in v0.8.0
func (*Blocks) HeightBySignature ¶
type BlocksHeight ¶
type BlocksHeight struct {
Height uint64 `json:"height"`
}
type Client ¶
type Client struct { Addresses *Addresses Blocks *Blocks Wallet *Wallet Alias *Alias Peers *Peers Consensus *Consensus Transactions *Transactions Assets *Assets Utils *Utils Leasing *Leasing Debug *Debug // contains filtered or unexported fields }
func (Client) GetOptions ¶
type Consensus ¶
type Consensus struct {
// contains filtered or unexported fields
}
func (*Consensus) BaseTarget ¶
Base target of a last block
func (*Consensus) BaseTargetByBlock ¶
func (a *Consensus) BaseTargetByBlock(ctx context.Context, blockID string) (uint64, *Response, error)
Base target of a block with specified id
func (Consensus) GeneratingBalance ¶
func (a Consensus) GeneratingBalance(ctx context.Context, address proto.Address) (*ConsensusGeneratingBalance, *Response, error)
Account's generating balance(the same as balance atm)
func (*Consensus) GenerationSignature ¶
Generation signature of a last block
type ConsensusBaseTarget ¶
type CreateAliasWithSig ¶ added in v0.5.0
type CreateAliasWithSig struct { Type proto.TransactionType `json:"type"` Version byte `json:"version,omitempty"` ID *crypto.Digest `json:"id,omitempty"` Signature *crypto.Signature `json:"signature,omitempty"` SenderPK crypto.PublicKey `json:"senderPublicKey"` Alias string `json:"alias"` Fee uint64 `json:"fee"` Timestamp uint64 `json:"timestamp,omitempty"` }
type Debug ¶ added in v0.2.0
type Debug struct {
// contains filtered or unexported fields
}
func (*Debug) BalancesHistory ¶ added in v0.8.0
func (*Debug) ConfigInfo ¶ added in v0.2.0
Currently running node config
func (*Debug) HistoryInfo ¶ added in v0.2.0
All history info you need to debug
func (*Debug) StateChanges ¶ added in v0.8.0
type DebugHistoryInfo ¶ added in v0.2.0
type DebugInfo ¶ added in v0.2.0
type DebugInfo struct { StateHeight uint64 `json:"stateHeight"` ExtensionLoaderState string `json:"extensionLoaderState"` HistoryReplierCacheSizes struct { Blocks uint64 `json:"blocks"` MicroBlocks uint64 `json:"microBlocks"` } `json:"historyReplierCacheSizes"` MicroBlockSynchronizerCacheSizes struct { MicroBlockOwners uint64 `json:"microBlockOwners"` NextInvs uint64 `json:"nextInvs"` Awaiting uint64 `json:"awaiting"` SuccessfullyReceived uint64 `json:"successfullyReceived"` } `json:"microBlockSynchronizerCacheSizes"` ScoreObserverStats struct { LocalScore LocalScore `json:"localScore"` CurrentBestChannel string `json:"currentBestChannel"` ScoresCacheSize uint64 `json:"scoresCacheSize"` } `json:"scoreObserverStats"` MinerState string `json:"minerState"` }
type DebugMinerInfo ¶ added in v0.2.0
type Headers ¶
type Headers struct { Version uint64 `json:"version"` Timestamp uint64 `json:"timestamp"` Reference proto.BlockID `json:"reference"` NxtConsensus NxtConsensus `json:"nxt-consensus"` TransactionsRoot string `json:"transactionsRoot"` Features []uint64 `json:"features"` DesiredReward int64 `json:"desiredReward"` Generator proto.Address `json:"generator"` GeneratorPublicKey string `json:"generatorPublicKey"` Signature crypto.Signature `json:"signature"` Blocksize uint64 `json:"blocksize"` TransactionCount uint64 `json:"transactionCount"` Height uint64 `json:"height"` TotalFee int64 `json:"totalFee"` Reward int64 `json:"reward"` VRF string `json:"VRF"` ID proto.BlockID `json:"id"` }
type HttpClient ¶
type HttpClient interface { }
type LocalScore ¶ added in v0.2.0
type LocalScore string
func (*LocalScore) UnmarshalJSON ¶ added in v0.2.0
func (a *LocalScore) UnmarshalJSON(data []byte) error
type NxtConsensus ¶
type ParseError ¶
type ParseError struct {
Err error
}
func (ParseError) Error ¶
func (a ParseError) Error() string
type PeerAllRow ¶
type Peers ¶
type Peers struct {
// contains filtered or unexported fields
}
func (*Peers) Blacklisted ¶
func (*Peers) ClearBlacklist ¶
type PeersBlacklistedRow ¶
type PeersConnect ¶
type PeersConnectedRow ¶
type PeersConnectedRow struct { Address proto.PeerInfo `json:"address"` DeclaredAddress proto.PeerInfo `json:"declaredAddress"` PeerName string `json:"peerName"` PeerNonce uint64 `json:"peerNonce"` ApplicationName string `json:"applicationName"` ApplicationVersion string `json:"applicationVersion"` }
type PeersSuspendedRow ¶
type RequestError ¶
func (*RequestError) Error ¶
func (a *RequestError) Error() string
type StateChangesResponse ¶ added in v0.8.0
type StateChangesResponse struct { Id string `json:"id"` Height uint64 `json:"height"` StateChanges struct { Data proto.DataEntries `json:"data"` Transfers []*struct { Address proto.Address `json:"address"` Asset crypto.Digest `json:"asset"` Amount uint64 `json:"amount"` } `json:"transfers"` } `json:"stateChanges"` }
type Transactions ¶ added in v0.1.2
type Transactions struct {
// contains filtered or unexported fields
}
func NewTransactions ¶ added in v0.1.2
func NewTransactions(options Options) *Transactions
Creates new transaction api section
func (*Transactions) Address ¶ added in v0.1.2
func (a *Transactions) Address(ctx context.Context, address proto.Address, limit uint) ([]proto.Transaction, *Response, error)
Get list of transactions where specified address has been involved
func (*Transactions) Broadcast ¶ added in v0.2.0
func (a *Transactions) Broadcast(ctx context.Context, transaction proto.Transaction) (*Response, error)
Broadcast a signed transaction
func (*Transactions) Info ¶ added in v0.1.2
func (a *Transactions) Info(ctx context.Context, id crypto.Digest) (proto.Transaction, *Response, error)
Get transaction info
func (*Transactions) Unconfirmed ¶ added in v0.1.2
func (a *Transactions) Unconfirmed(ctx context.Context) ([]proto.Transaction, *Response, error)
Get the number of unconfirmed transactions in the UTX pool
func (*Transactions) UnconfirmedInfo ¶ added in v0.1.2
func (a *Transactions) UnconfirmedInfo(ctx context.Context, id crypto.Digest) (proto.Transaction, *Response, error)
Get transaction that is in the UTX
func (*Transactions) UnconfirmedSize ¶ added in v0.1.2
Get the number of unconfirmed transactions in the UTX pool
type TransactionsField ¶ added in v0.2.0
type TransactionsField []proto.Transaction
func (*TransactionsField) UnmarshalJSON ¶ added in v0.2.0
func (b *TransactionsField) UnmarshalJSON(data []byte) error
type Utils ¶ added in v0.1.2
type Utils struct {
// contains filtered or unexported fields
}
func (*Utils) HashSecure ¶ added in v0.1.2
func (a *Utils) HashSecure(ctx context.Context, message string) (*UtilsHashSecure, *Response, error)
Return SecureCryptographicHash of specified message
func (*Utils) ScriptCompile ¶ added in v0.1.2
func (a *Utils) ScriptCompile(ctx context.Context, code string) (*UtilsScriptCompile, *Response, error)
Compiles string code to base64 script representation
func (*Utils) ScriptEstimate ¶ added in v0.1.2
func (a *Utils) ScriptEstimate(ctx context.Context, base64code string) (*UtilsScriptEstimate, *Response, error)
Estimates compiled code in Base64 representation
func (*Utils) SeedByLength ¶ added in v0.1.2
Generate random seed of specified length
type UtilsHashFast ¶ added in v0.1.2
type UtilsHashSecure ¶ added in v0.1.2
type UtilsScriptCompile ¶ added in v0.1.2
type UtilsScriptEstimate ¶ added in v0.1.2
type VerifyText ¶
type VerifyText struct {
Valid bool
}