Documentation
¶
Index ¶
- Constants
- func GetResponseBodyContract(url string, postP ContractRequest, signature string) ([]byte, error)
- func GetResponseBodyPlatform(url string, method string, params interface{}) ([]byte, error)
- func GetSeed(url string) (string, error)
- func MakeContractRequest(url string, postP ContractRequest, signature string) (*http.Request, error)
- func MakeRequestWithSeed(ctx context.Context, url string, userCfg *UserConfigJSON, params *Params, ...) (*http.Request, error)
- func Send(ctx context.Context, url string, userCfg *UserConfigJSON, params *Params) ([]byte, error)
- func SendWithSeed(ctx context.Context, url string, userCfg *UserConfigJSON, params *Params, ...) ([]byte, error)
- func SetTimeout(timeout uint)
- func SetVerbose(verb bool)
- func Sign(privateKey crypto.PrivateKey, data []byte) (string, error)
- type ContractRequest
- type ContractResponse
- type ContractResult
- type Data
- type Error
- type InfoResponse
- type Node
- type Params
- type PlatformRequest
- type Request
- type Response
- type SeedReply
- type StatusResponse
- type UserConfigJSON
Constants ¶
const ( RequestTimeout = 32 * time.Second Digest = "Digest" Signature = "Signature" ContentType = "Content-Type" JSONRPCVersion = "2.0" )
Variables ¶
This section is empty.
Functions ¶
func GetResponseBodyContract ¶
func GetResponseBodyContract(url string, postP ContractRequest, signature string) ([]byte, error)
GetResponseBodyContract makes request to contract and extracts body
func GetResponseBodyPlatform ¶
GetResponseBodyPlatform makes request to platform and extracts body
func MakeContractRequest ¶
func MakeRequestWithSeed ¶
func MakeRequestWithSeed(ctx context.Context, url string, userCfg *UserConfigJSON, params *Params, seed string) (*http.Request, error)
MakeRequestWithSeed creates request with provided url, user config, params and seed.
func SendWithSeed ¶
func SendWithSeed(ctx context.Context, url string, userCfg *UserConfigJSON, params *Params, seed string) ([]byte, error)
SendWithSeed sends request with known seed
func SetTimeout ¶
func SetTimeout(timeout uint)
Types ¶
type ContractRequest ¶
ContractRequest is a representation of request struct to api
type ContractResponse ¶
type ContractResponse struct {
Response
Result *ContractResult `json:"result,omitempty"`
}
type ContractResult ¶
type Error ¶
type InfoResponse ¶
type InfoResponse struct {
RootDomain string `json:"rootDomain"`
RootMember string `json:"rootMember"`
MigrationAdminMember string `json:"migrationAdminMember"`
FeeMember string `json:"feeMember"`
MigrationDaemonMembers []string `json:"migrationDaemonMembers"`
NodeDomain string `json:"nodeDomain"`
TraceID string `json:"traceID"`
}
InfoResponse represents response from rpc on network.getInfo method
func Info ¶
func Info(url string) (*InfoResponse, error)
Info makes rpc request to network.getInfo method and extracts it
type Params ¶
type Params struct {
Seed string `json:"seed"`
CallSite string `json:"callSite"`
CallParams interface{} `json:"callParams,omitempty"`
Reference string `json:"reference"`
PublicKey string `json:"publicKey"`
LogLevel interface{} `json:"logLevel,omitempty"`
Test string `json:"test,omitempty"`
}
func ReadRequestParamsFromFile ¶
ReadRequestParamsFromFile read request config from file
type PlatformRequest ¶
type PlatformRequest struct {
Request
PlatformParams interface{} `json:"params,omitempty"`
LogLevel string `json:"logLevel,omitempty"`
}
PlatformRequest represents params struct
type StatusResponse ¶
type StatusResponse struct {
NetworkState string `json:"networkState"`
Origin Node `json:"origin"`
ActiveListSize int `json:"activeListSize"`
WorkingListSize int `json:"workingListSize"`
Nodes []Node `json:"nodes"`
PulseNumber uint32 `json:"pulseNumber"`
NetworkPulseNumber uint32 `json:"networkPulseNumber"`
Entropy []byte `json:"entropy"`
Version string `json:"version"`
Timestamp time.Time `json:"timestamp"`
StartTime time.Time `json:"startTime"`
}
StatusResponse represents response from rpc on node.getStatus method
func Status ¶
func Status(url string) (*StatusResponse, error)
Status makes rpc request to node.getStatus method and extracts it
type UserConfigJSON ¶
type UserConfigJSON struct {
PrivateKey string `json:"private_key"`
PublicKey string `json:"public_key"`
Caller string `json:"caller"`
// contains filtered or unexported fields
}
UserConfigJSON holds info about user
func CreateUserConfig ¶
func CreateUserConfig(caller string, privKey string, publicKey string) (*UserConfigJSON, error)
CreateUserConfig creates user config from arguments
func ReadUserConfigFromFile ¶
func ReadUserConfigFromFile(file string) (*UserConfigJSON, error)
ReadUserConfigFromFile read user config from file