client

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LOTUS_JSON_RPC_ID            = 7878
	LOTUS_JSON_RPC_VERSION       = "2.0"
	LOTUS_CLIENT_GET_DEAL_INFO   = "Filecoin.ClientGetDealInfo"
	LOTUS_CLIENT_GET_DEAL_STATUS = "Filecoin.ClientGetDealStatus"
	LOTUS_CHAIN_HEAD             = "Filecoin.ChainHead"
	LOTUS_MARKET_GET_ASK         = "Filecoin.MarketGetAsk"
	LOTUS_CLIENT_CALC_COMM_P     = "Filecoin.ClientCalcCommP"
	LOTUS_CLIENT_IMPORT          = "Filecoin.ClientImport"
	LOTUS_CLIENT_GEN_CAR         = "Filecoin.ClientGenCar"
	LOTUS_CLIENT_START_DEAL      = "Filecoin.ClientStartDeal"
	LOTUS_VERSION                = "Filecoin.Version"
)
View Source
const GET_OFFLINEDEAL_LIMIT_DEFAULT = 50
View Source
const HTTP_CONTENT_TYPE_FORM = "application/x-www-form-urlencoded"
View Source
const HTTP_CONTENT_TYPE_JSON = "application/json; charset=utf-8"
View Source
const RESPONSE_STATUS_SUCCESS = "SUCCESS"
View Source
const SHELL_TO_USE = "bash"

Variables

This section is empty.

Functions

func ExecOsCmd

func ExecOsCmd(cmdStr string, checkStdErr bool) (string, error)

func ExecOsCmd2Screen

func ExecOsCmd2Screen(cmdStr string, checkStdErr bool) (string, error)

func ExecOsCmdBase

func ExecOsCmdBase(cmdStr string, out2Screen bool, checkStdErr bool) (string, error)

func HttpDelete

func HttpDelete(uri, tokenString string, params interface{}) string

func HttpGet

func HttpGet(uri, tokenString string, params interface{}) string

func HttpGetNoToken

func HttpGetNoToken(uri string, params interface{}) string

func HttpPost

func HttpPost(uri, tokenString string, params interface{}) string

func HttpPostFile

func HttpPostFile(url string, tokenString string, paramTexts map[string]string, paramFilename, paramFilepath string) (string, error)

func HttpPostNoToken

func HttpPostNoToken(uri string, params interface{}) string

func HttpPut

func HttpPut(uri, tokenString string, params interface{}) string

func HttpPutFile

func HttpPutFile(url string, tokenString string, paramTexts map[string]string, paramFilename, paramFilepath string) (string, error)

func HttpRequestFile

func HttpRequestFile(httpMethod, url string, tokenString string, paramTexts map[string]string, paramFilename, paramFilepath string) (string, error)

func HttpUploadFileByStream added in v0.0.9

func HttpUploadFileByStream(uri, filefullpath string) (string, error)

func IpfsUploadCarFile

func IpfsUploadCarFile(carFilePath string) (*string, error)

func IpfsUploadCarFileByWebApi added in v0.0.9

func IpfsUploadCarFileByWebApi(apiUrl, carFilePath string) (*string, error)

func LevelDbDelete added in v0.0.9

func LevelDbDelete(dbFilepath, key, value string) error

func LevelDbGet added in v0.0.9

func LevelDbGet(dbFilepath, key string) ([]byte, error)

func LevelDbPut added in v0.0.9

func LevelDbPut(dbFilepath, key string, value interface{}) error

func LotusGetMinerConfig

func LotusGetMinerConfig(minerFid string) (*decimal.Decimal, *decimal.Decimal, *string, *string)

func LotusProposeOfflineDeal

func LotusProposeOfflineDeal(carFile model.FileDesc, cost decimal.Decimal, pieceSize int64, dealConfig model.DealConfig, relativeEpoch int) (*string, *int, error)

Types

type Cid

type Cid struct {
	Cid string `json:"/"`
}

type ClientCalcCommP

type ClientCalcCommP struct {
	LotusJsonRpcResult
	Result *ClientCalcCommPResult `json:"result"`
}

type ClientCalcCommPResult

type ClientCalcCommPResult struct {
	Root Cid
	Size int
}

type ClientFileParam

type ClientFileParam struct {
	Path  string
	IsCAR bool
}

type ClientImport

type ClientImport struct {
	LotusJsonRpcResult
	Result *ClientImportResult `json:"result"`
}

type ClientImportResult

type ClientImportResult struct {
	Root     Cid
	ImportID int64
}

type ClientStartDeal

type ClientStartDeal struct {
	LotusJsonRpcResult
	Result *Cid `json:"result"`
}

type ClientStartDealParam

type ClientStartDealParam struct {
	Data               ClientStartDealParamData
	Wallet             string
	Miner              string
	EpochPrice         string
	MinBlocksDuration  int
	ProviderCollateral string
	DealStartEpoch     int
	FastRetrieval      bool
	VerifiedDeal       bool
}

type ClientStartDealParamData

type ClientStartDealParamData struct {
	TransferType string
	Root         Cid
	PieceCid     Cid
	PieceSize    int
	RawBlockSize int
}

type GetOfflineDealData

type GetOfflineDealData struct {
	Deal []model.OfflineDeal `json:"deal"`
}

type GetOfflineDealResponse

type GetOfflineDealResponse struct {
	Data   GetOfflineDealData `json:"data"`
	Status string             `json:"status"`
}

type GetOfflineDealsByTaskUuidResult

type GetOfflineDealsByTaskUuidResult struct {
	Data   GetOfflineDealsByTaskUuidResultData `json:"data"`
	Status string                              `json:"status"`
}

type GetOfflineDealsByTaskUuidResultData

type GetOfflineDealsByTaskUuidResultData struct {
	AverageBid       string              `json:"average_bid"`
	BidCount         int                 `json:"bid_count"`
	DealCompleteRate string              `json:"deal_complete_rate"`
	Deal             []model.OfflineDeal `json:"deal"`
	Miner            model.Miner         `json:"miner"`
	Task             model.Task          `json:"task"`
}

type GetTaskResult

type GetTaskResult struct {
	Data   GetTaskResultData `json:"data"`
	Status string            `json:"status"`
}

type GetTaskResultData

type GetTaskResultData struct {
	Task           []model.Task `json:"task"`
	TotalItems     int          `json:"total_items"`
	TotalTaskCount int          `json:"total_task_count"`
}

type JsonRpcError

type JsonRpcError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type LotusClient

type LotusClient struct {
	ApiUrl      string
	AccessToken string
}

func LotusGetClient

func LotusGetClient(apiUrl, accessToken string) (*LotusClient, error)

func (*LotusClient) LotusClientCalcCommP

func (lotusClient *LotusClient) LotusClientCalcCommP(filepath string) *string

"lotus client commP " + carFilePath

func (*LotusClient) LotusClientGenCar

func (lotusClient *LotusClient) LotusClientGenCar(srcFilePath, destCarFilePath string, srcFilePathIsCar bool) error

"lotus client generate-car " + srcFilePath + " " + destCarFilePath

func (*LotusClient) LotusClientImport

func (lotusClient *LotusClient) LotusClientImport(filepath string, isCar bool) (*string, error)

"lotus client import --car " + carFilePath

func (*LotusClient) LotusClientStartDeal

func (lotusClient *LotusClient) LotusClientStartDeal(carFile model.FileDesc, cost decimal.Decimal, pieceSize int64, dealConfig model.DealConfig) (*string, error)

"lotus client generate-car " + srcFilePath + " " + destCarFilePath

func (*LotusClient) LotusMarketGetAsk

func (lotusClient *LotusClient) LotusMarketGetAsk() *MarketGetAskResultAsk

"lotus client query-ask " + minerFid

func (*LotusClient) LotusVersion

func (lotusClient *LotusClient) LotusVersion() (*string, error)

"lotus client query-ask " + minerFid

type LotusJsonRpcParams

type LotusJsonRpcParams struct {
	JsonRpc string        `json:"jsonrpc"`
	Method  string        `json:"method"`
	Params  []interface{} `json:"params"`
	Id      int           `json:"id"`
}

type LotusJsonRpcResult

type LotusJsonRpcResult struct {
	Id      int           `json:"id"`
	JsonRpc string        `json:"jsonrpc"`
	Error   *JsonRpcError `json:"error"`
}

type LotusVersionResponse

type LotusVersionResponse struct {
	LotusJsonRpcResult
	Result LotusVersionResult `json:"result"`
}

type LotusVersionResult

type LotusVersionResult struct {
	Version    string
	APIVersion int
	BlockDelay int
}

type MarketGetAsk

type MarketGetAsk struct {
	LotusJsonRpcResult
	Result *MarketGetAskResult `json:"result"`
}

type MarketGetAskResult

type MarketGetAskResult struct {
	Ask MarketGetAskResultAsk
}

type MarketGetAskResultAsk

type MarketGetAskResultAsk struct {
	Price         string
	VerifiedPrice string
	MinPieceSize  int
	MaxPieceSize  int
	Miner         string
	Timestamp     int
	Expiry        int
	SeqNo         int
}

type SwanClient

type SwanClient struct {
	ApiUrl   string
	JwtToken string
}

func SwanGetClient

func SwanGetClient(apiUrl, apiKey, accessToken, jwtToken string) (*SwanClient, error)

func SwanGetClientByKey added in v0.0.9

func SwanGetClientByKey(apiUrl, apiKey, accessToken string) (*SwanClient, error)

func (*SwanClient) SwanCreateTask

func (swanClient *SwanClient) SwanCreateTask(task model.Task, csvFilePath string) (*SwanCreateTaskResponse, error)

func (*SwanClient) SwanGetAssignedTasks

func (swanClient *SwanClient) SwanGetAssignedTasks() ([]model.Task, error)

func (*SwanClient) SwanGetJwtToken

func (swanClient *SwanClient) SwanGetJwtToken(apiKey, accessToken string) error

func (*SwanClient) SwanGetOfflineDeals

func (swanClient *SwanClient) SwanGetOfflineDeals(minerFid, status string, limit ...string) []model.OfflineDeal

func (*SwanClient) SwanGetOfflineDealsByTaskUuid

func (swanClient *SwanClient) SwanGetOfflineDealsByTaskUuid(taskUuid string) (*GetOfflineDealsByTaskUuidResult, error)

func (*SwanClient) SwanGetTasks

func (swanClient *SwanClient) SwanGetTasks(limit *int) (*GetTaskResult, error)

func (*SwanClient) SwanUpdateAssignedTask

func (swanClient *SwanClient) SwanUpdateAssignedTask(taskUuid, status, csvFilePath string) (*SwanCreateTaskResponse, error)

func (*SwanClient) SwanUpdateOfflineDealStatus

func (swanClient *SwanClient) SwanUpdateOfflineDealStatus(dealId int, status string, statusInfo ...string) bool

func (*SwanClient) SwanUpdateTaskByUuid

func (swanClient *SwanClient) SwanUpdateTaskByUuid(taskUuid string, minerFid string, csvFilePath string) error

type SwanCreateTaskResponse

type SwanCreateTaskResponse struct {
	Data    SwanCreateTaskResponseData `json:"data"`
	Status  string                     `json:"status"`
	Message string                     `json:"message"`
}

type SwanCreateTaskResponseData

type SwanCreateTaskResponseData struct {
	Filename string `json:"filename"`
	Uuid     string `json:"uuid"`
}

type TokenAccessInfo

type TokenAccessInfo struct {
	ApiKey      string `json:"apikey"`
	AccessToken string `json:"access_token"`
}

type UpdateOfflineDealData

type UpdateOfflineDealData struct {
	Deal    model.OfflineDeal `json:"deal"`
	Message string            `json:"message"`
}

type UpdateOfflineDealResponse

type UpdateOfflineDealResponse struct {
	Data   UpdateOfflineDealData `json:"data"`
	Status string                `json:"status"`
}

Jump to

Keyboard shortcuts

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