Documentation ¶
Index ¶
- Constants
- Variables
- func GetDurationTime(timestamp int32) int
- func GetTime() int32
- func GetTransactionTime(timestamp int32) time.Time
- func LoadActiveConfiguration(arknetwork ArkNetworkType) string
- type AccountData
- type AccountQueryParams
- type AccountResponse
- type ArkApiResponseError
- type ArkClient
- func (s *ArkClient) CalculateVotersProfit(params DelegateQueryParams, shareRatio float64) []DelegateDataProfit
- func (s *ArkClient) GetAccount(params AccountQueryParams) (AccountResponse, *http.Response, error)
- func (s *ArkClient) GetDelegate(params DelegateQueryParams) (DelegateResponse, *http.Response, error)
- func (s *ArkClient) GetDelegateVoteWeight(params DelegateQueryParams) (int, *http.Response, error)
- func (s *ArkClient) GetDelegateVoters(params DelegateQueryParams) (DelegateVoters, *http.Response, error)
- func (s *ArkClient) GetFidelityFactor(address string) int
- func (s *ArkClient) GetForgedData(params DelegateQueryParams) (ForgedDetails, *http.Response, error)
- func (s *ArkClient) GetPeer(params PeerQueryParams) (PeerResponse, *http.Response, error)
- func (s *ArkClient) GetTransaction(params TransactionQueryParams) (TransactionResponse, *http.Response, error)
- func (s *ArkClient) GetTransactionUnconfirmed(params TransactionQueryParams) (TransactionResponse, *http.Response, error)
- func (s *ArkClient) ListDelegates(params DelegateQueryParams) (DelegateResponse, *http.Response, error)
- func (s *ArkClient) ListPeers(params PeerQueryParams) (PeerResponse, *http.Response, error)
- func (s *ArkClient) ListTransaction(params TransactionQueryParams) (TransactionResponse, *http.Response, error)
- func (s *ArkClient) ListTransactionUnconfirmed(params TransactionQueryParams) (TransactionResponse, *http.Response, error)
- func (s *ArkClient) PostTransaction(payload TransactionPayload) (PostTransactionResponse, *http.Response, error)
- func (s *ArkClient) SetActiveConfiguration(arkNetwork ArkNetworkType) *ArkClient
- type ArkEnvParams
- type ArkNetworkType
- type DelegateData
- type DelegateDataProfit
- type DelegateQueryParams
- type DelegateResponse
- type DelegateVoters
- type Fees
- type ForgedDetails
- type Network
- type Peer
- type PeerQueryParams
- type PeerResponse
- type PostTransactionResponse
- type Transaction
- func CreateDelegate(username, passphrase, secondPassphrase string) *Transaction
- func CreateSecondSignature(passphrase, secondPassphrase string) *Transaction
- func CreateTransaction(recipientID string, satoshiAmount int64, ...) *Transaction
- func CreateVote(updown, delegatePubKey, passphrase, secondPassphrase string) *Transaction
- type TransactionPayload
- type TransactionQueryParams
- type TransactionResponse
- type TransactionType
Constants ¶
const ( MAINNET = iota DEVNET )
const ( SENDARK = 0 SECONDSIGNATURE = 1 CREATEDELEGATE = 2 VOTE = 3 MULTISIGNATURE = 4 )
const (
SATOSHI = 100000000
)
Variables ¶
var BaseURL = ""
var EnvironmentParams = new(ArkEnvParams)
Global ARK EnvironmentParams read from acitve peers
var SeedList = [...]string{
"5.39.9.240:4001",
"5.39.9.241:4001",
"5.39.9.242:4001",
"5.39.9.243:4001",
"5.39.9.244:4001",
"5.39.9.250:4001",
"5.39.9.251:4001",
"5.39.9.252:4001",
"5.39.9.253:4001",
"5.39.9.254:4001",
"5.39.9.255:4001",
"5.39.53.48:4001",
"5.39.53.49:4001",
"5.39.53.50:4001",
"5.39.53.51:4001",
"5.39.53.52:4001",
"5.39.53.53:4001",
"5.39.53.54:4001",
"5.39.53.55:4001",
"37.59.129.160:4001",
"37.59.129.161:4001",
"37.59.129.162:4001",
"37.59.129.163:4001",
"37.59.129.164:4001",
"37.59.129.165:4001",
"37.59.129.166:4001",
"37.59.129.167:4001",
"37.59.129.168:4001",
"37.59.129.169:4001",
"37.59.129.170:4001",
"37.59.129.171:4001",
"37.59.129.172:4001",
"37.59.129.173:4001",
"37.59.129.174:4001",
"37.59.129.175:4001",
"193.70.72.80:4001",
"193.70.72.81:4001",
"193.70.72.82:4001",
"193.70.72.83:4001",
"193.70.72.84:4001",
"193.70.72.85:4001",
"193.70.72.86:4001",
"193.70.72.87:4001",
"193.70.72.88:4001",
"193.70.72.89:4001",
"193.70.72.90:4001"}
var TestSeedList = [...]string{
"164.8.251.179:4002",
"164.8.251.172:4002",
"164.8.251.91:4002",
"167.114.43.48:4002",
"167.114.29.49:4002",
"167.114.43.43:4002",
"167.114.29.54:4002",
"167.114.29.45:4002",
"167.114.29.40:4002",
"167.114.29.56:4002",
"167.114.43.35:4002",
"167.114.29.51:4002",
"167.114.29.59:4002",
"167.114.43.42:4002",
"167.114.29.34:4002",
"167.114.29.62:4002",
"167.114.43.49:4002",
"167.114.29.44:4002",
"167.114.43.37:4002",
"167.114.29.63:4002",
"167.114.29.42:4002",
"167.114.29.48:4002",
"167.114.29.61:4002",
"167.114.43.36:4002",
"167.114.29.57:4002",
"167.114.43.33:4002",
"167.114.29.52:4002",
"167.114.29.50:4002",
"167.114.43.47:4002",
"167.114.29.47:4002",
"167.114.29.36:4002",
"167.114.29.35:4002",
"167.114.43.39:4002",
"167.114.43.45:4002",
"167.114.29.46:4002",
"167.114.29.41:4002",
"167.114.43.34:4002",
"167.114.29.43:4002",
"167.114.43.41:4002",
"167.114.29.60:4002",
"167.114.43.32:4002",
"167.114.29.55:4002",
"167.114.29.53:4002",
"167.114.29.38:4002",
"167.114.43.40:4002",
"167.114.29.32:4002",
"167.114.43.46:4002",
"167.114.43.38:4002",
"167.114.29.33:4002",
"167.114.43.44:4002",
"167.114.43.50:4002",
"167.114.29.37:4002",
"167.114.29.58:4002",
"167.114.29.39:4002"}
Functions ¶
func GetDurationTime ¶
Calculates duration between now and provided timestamp
func GetTime ¶
func GetTime() int32
GetTime return time slot difference in secods. This timestamp is added to the transaction.
func GetTransactionTime ¶
GetTransactionTime from timestamp
func LoadActiveConfiguration ¶
func LoadActiveConfiguration(arknetwork ArkNetworkType) string
SetActiveConfiguration reads arknetwork parameters from the Network and fills the EnvironmentParams structure selected and connected peer address is returned
Types ¶
type AccountData ¶
type AccountData struct { Address string `json:"address"` UnconfirmedBalance string `json:"unconfirmedBalance"` Balance string `json:"balance"` PublicKey string `json:"publicKey"` UnconfirmedSignature int `json:"unconfirmedSignature"` SecondSignature int `json:"secondSignature"` SecondPublicKey interface{} `json:"secondPublicKey"` Multisignatures []interface{} `json:"multisignatures"` UMultisignatures []interface{} `json:"u_multisignatures"` }
type AccountQueryParams ¶
type AccountQueryParams struct {
Address string `url:"address,omitempty"`
}
type AccountResponse ¶
type AccountResponse struct { Success bool `json:"success"` Account AccountData `json:"account"` }
type ArkApiResponseError ¶
type ArkApiResponseError struct { Success bool `json:"success,omitempty"` Message string `json:"message,omitempty"` ErrorMessage string `json:"error,omitempty"` Data string `json:"data,omitempty"` }
ArkApiResponseError struct to hold error response from api node
func (ArkApiResponseError) Error ¶
func (e ArkApiResponseError) Error() string
Error interface function
type ArkClient ¶
type ArkClient struct {
// contains filtered or unexported fields
}
ArkClient sling rest pointer
func NewArkClient ¶
NewArkClient creations with supported network
func (*ArkClient) CalculateVotersProfit ¶
func (s *ArkClient) CalculateVotersProfit(params DelegateQueryParams, shareRatio float64) []DelegateDataProfit
func (*ArkClient) GetAccount ¶
func (s *ArkClient) GetAccount(params AccountQueryParams) (AccountResponse, *http.Response, error)
GetAccount by address function returns list of peers from ArkNode
func (*ArkClient) GetDelegate ¶
func (s *ArkClient) GetDelegate(params DelegateQueryParams) (DelegateResponse, *http.Response, error)
GetDelegate function returns a delegate
func (*ArkClient) GetDelegateVoteWeight ¶
GetDelegateVoteWeight function returns a summary of ARK voted for selected delegate
func (*ArkClient) GetDelegateVoters ¶
func (s *ArkClient) GetDelegateVoters(params DelegateQueryParams) (DelegateVoters, *http.Response, error)
GetDelegateVoters function returns a delegate
func (*ArkClient) GetFidelityFactor ¶
func (*ArkClient) GetForgedData ¶
func (s *ArkClient) GetForgedData(params DelegateQueryParams) (ForgedDetails, *http.Response, error)
GetDelegateForging details
func (*ArkClient) GetPeer ¶
func (s *ArkClient) GetPeer(params PeerQueryParams) (PeerResponse, *http.Response, error)
GetPeer function returns one peer with params
func (*ArkClient) GetTransaction ¶
func (s *ArkClient) GetTransaction(params TransactionQueryParams) (TransactionResponse, *http.Response, error)
GetTransaction function returns list of peers from ArkNode
func (*ArkClient) GetTransactionUnconfirmed ¶
func (s *ArkClient) GetTransactionUnconfirmed(params TransactionQueryParams) (TransactionResponse, *http.Response, error)
GetTransactionUnconfirmed function returns list of peers from ArkNode
func (*ArkClient) ListDelegates ¶
func (s *ArkClient) ListDelegates(params DelegateQueryParams) (DelegateResponse, *http.Response, error)
ListDelegates function returns list of delegtes. The top 51 delegates are returned
func (*ArkClient) ListPeers ¶
func (s *ArkClient) ListPeers(params PeerQueryParams) (PeerResponse, *http.Response, error)
ListPeers function returns list of peers from ArkNode
func (*ArkClient) ListTransaction ¶
func (s *ArkClient) ListTransaction(params TransactionQueryParams) (TransactionResponse, *http.Response, error)
ListTransaction function returns list of peers from ArkNode
func (*ArkClient) ListTransactionUnconfirmed ¶
func (s *ArkClient) ListTransactionUnconfirmed(params TransactionQueryParams) (TransactionResponse, *http.Response, error)
ListTransactionUnconfirmed function returns list of peers from ArkNode
func (*ArkClient) PostTransaction ¶
func (s *ArkClient) PostTransaction(payload TransactionPayload) (PostTransactionResponse, *http.Response, error)
PostTransaction to selected ARKNetwork
func (*ArkClient) SetActiveConfiguration ¶
func (s *ArkClient) SetActiveConfiguration(arkNetwork ArkNetworkType) *ArkClient
type ArkEnvParams ¶
type ArkEnvParams struct { Success bool `json:"success"` Network Network `json:"network"` Fees Fees `json:"fees"` }
ArkEnvParams structure to hold parameters from autoconfigure structure is filled from peers at arkclient init call
type ArkNetworkType ¶
type ArkNetworkType int
type DelegateData ¶
type DelegateData struct { Username string `json:"username"` Address string `json:"address"` PublicKey string `json:"publicKey"` Vote string `json:"vote"` Producedblocks int `json:"producedblocks"` Missedblocks int `json:"missedblocks"` Rate int `json:"rate"` Approval float64 `json:"approval"` Productivity float64 `json:"productivity"` }
DelegateData holds parsed json from api calls. It is used in upper DelegateResponse struct
type DelegateDataProfit ¶
type DelegateQueryParams ¶
type DelegateQueryParams struct { UserName string `url:"username,omitempty"` PublicKey string `url:"publicKey,omitempty"` Offset int `url:"offset,omitempty"` OrderBy string `url:"orderBy,omitempty"` Limit int `url:"limit,omitempty"` }
DelegateQueryParams - when set, they are automatically added to get requests
type DelegateResponse ¶
type DelegateResponse struct { Success bool `json:"success,omitempty"` Delegates []DelegateData `json:"delegates,omitempty"` SingleDelegate DelegateData `json:"delegate,omitempty"` TotalCount int `json:"totalCount,omitempty"` }
DelegateResponse data - received from api-call.
type DelegateVoters ¶
type DelegateVoters struct { Success bool `json:"success"` Accounts []struct { Username string `json:"username"` Address string `json:"address"` PublicKey string `json:"publicKey"` Balance string `json:"balance"` } `json:"accounts"` }
DelegateVoters struct to hold voters for a publicKey(delegate)
type Fees ¶
type Fees struct { Send int64 `json:"send"` Vote int64 `json:"vote"` SecondSignature int64 `json:"secondsignature"` Delegate int64 `json:"delegate"` MultiSignature int64 `json:"multisignature"` }
Fees constant parameters for active configuration
type ForgedDetails ¶
type Network ¶
type Network struct { Nethash string `json:"nethash"` Token string `json:"token"` Symbol string `json:"symbol"` Explorer string `json:"explorer"` AddressVersion byte `json:"version"` //this is address generator version!!! Type ArkNetworkType //holding ark networktype ActivePeer Peer }
Network parameters
type Peer ¶
type Peer struct { IP string `json:"ip"` Port int `json:"port"` Version string `json:"version,omitempty"` Os string `json:"os,omitempty"` Height int `json:"height,omitempty"` Status string `json:"status"` Delay int `json:"delay"` }
Peer structure to hold peer data
type PeerQueryParams ¶
type PeerQueryParams struct { Status string `url:"status,omitempty"` //State of peer. OK, ETIMEOUT,... Os string `url:"os,omitempty"` //OS of peer. (String) Version string `url:"version,omitempty"` //Version of peer. (String) Limit int `url:"limit,omitempty"` //Limit to show. Max limit is 100. (Integer) OrderBy string `url:"orderBy,omitempty"` //Name of column to order. After column name must go 'desc' or 'asc' to choose order type. (String) Offset int `url:"offset,omitempty"` IP string `url:"ip,omitempty"` Port int `url:"port,omitempty"` }
PeerQueryParams - when set, they are automatically added to get requests
type PeerResponse ¶
type PeerResponse struct { Success bool `json:"success"` Peers []Peer `json:"peers"` SinglePeer Peer `json:"peer"` }
PeerResponse structure for call /peer/list
type PostTransactionResponse ¶
type PostTransactionResponse struct { Success bool `json:"success"` Message string `json:"message"` Error string `json:"error"` TransactionIDs []string `json:"transactionIds"` }
PostTransactionResponse structure for call /peer/list
type Transaction ¶
type Transaction struct { ID string `json:"id,omitempty"` Timestamp int32 `json:"timestamp,omitempty"` RecipientID string `json:"recipientId,omitempty"` Amount int64 `json:"amount,omitempty"` Asset map[string]string `json:"asset,omitempty"` Fee int64 `json:"fee,omitempty"` Type TransactionType `json:"type"` VendorField string `json:"vendorField,omitempty"` Signature string `json:"signature,omitempty"` SignSignature string `json:"signSignature,omitempty"` SenderPublicKey string `json:"senderPublicKey,omitempty"` SecondSenderPublicKey string `json:"secondSenderPublicKey,omitempty"` RequesterPublicKey string `json:"requesterPublicKey,omitempty"` Blockid string `json:"blockid,omitempty"` Height int `json:"height,omitempty"` SenderID string `json:"senderId,omitempty"` Confirmations int `json:"confirmations,omitempty"` }
Transaction struct - represents structure of ARK.io blockchain transaction It is used to post transaction to mainnet and to receive results from arkapi Empty fields are emmited by default
func CreateDelegate ¶
func CreateDelegate(username, passphrase, secondPassphrase string) *Transaction
CreateDelegate creates and returns new Transaction struct...
func CreateSecondSignature ¶
func CreateSecondSignature(passphrase, secondPassphrase string) *Transaction
CreateSecondSignature creates and returns new Transaction struct...
func CreateTransaction ¶
func CreateTransaction(recipientID string, satoshiAmount int64, vendorField, passphrase, secondPassphrase string) *Transaction
CreateTransaction creates and returns new Transaction struct...
func CreateVote ¶
func CreateVote(updown, delegatePubKey, passphrase, secondPassphrase string) *Transaction
CreateVote transaction used to vote for a chosen Delegate if updown value = "+" vot is given to the specified PublicKey if updown value = "-" vot is taken from the specified PublicKey
func (*Transaction) SecondVerify ¶
func (tx *Transaction) SecondVerify() error
SecondVerify function verifies if tx is validly signed if return == nill verification was succesfull
func (*Transaction) ToJSON ¶
func (tx *Transaction) ToJSON() string
ToJSON converts transaction object to JSON string
func (*Transaction) Verify ¶
func (tx *Transaction) Verify() error
Verify function verifies if tx is validly signed if return == nill verification was succesfull
type TransactionPayload ¶
type TransactionPayload struct {
Transactions []*Transaction `json:"transactions"`
}
type TransactionQueryParams ¶
type TransactionQueryParams struct { ID string `url:"id,omitempty"` BlockID string `url:"blockId,omitempty"` SenderID string `url:"senderId,omitempty"` RecipientID string `url:"recipientId,omitempty"` Limit int `url:"limit,omitempty"` Offset int `url:"offset,omitempty"` OrderBy string `url:"orderBy,omitempty"` //"Name of column to order. After column name must go 'desc' or 'asc' to choose order type, prefix for column name is t_. Example: orderBy=t_timestamp:desc (String)" Type TransactionType `url:"type,omitempty"` }
TransactionQueryParams for returing filtered list of transactions
type TransactionResponse ¶
type TransactionResponse struct { Success bool `json:"success"` Transactions []Transaction `json:"transactions"` SingleTransaction Transaction `json:"transaction"` Count string `json:"count"` Error string `json:"error"` }
TransactionResponse structure holds parsed jsong reply from ark-node when calling list methods the Transactions [] has results when calling get methods the transaction object (Single) has results
type TransactionType ¶
type TransactionType byte