Documentation ¶
Index ¶
- Constants
- Variables
- func AmountToString(m int64) (string, error)
- func Run(cfg *config.Config) error
- func StringToAmount(s string) (chainutil.Amount, error)
- type Server
- func (s *Server) ChangePrivatePass(ctx context.Context, in *pb.ChangePrivatePassRequest) (*pb.ChangePrivatePassResponse, error)
- func (s *Server) ChangePublicPass(ctx context.Context, in *pb.ChangePublicPassRequest) (*pb.ChangePublicPassResponse, error)
- func (s *Server) ConfigureCapacity(ctx context.Context, in *pb.ConfigureSpaceKeeperRequest) (*pb.WorkSpacesResponse, error)
- func (s *Server) ConfigureCapacityByDirs(ctx context.Context, in *pb.ConfigureSpaceKeeperByDirsRequest) (*pb.WorkSpacesByDirsResponse, error)
- func (s *Server) ExportKeystore(ctx context.Context, in *pb.ExportKeystoreRequest) (*pb.ExportKeystoreResponse, error)
- func (s *Server) ExportKeystoreByDir(ctx context.Context, in *pb.ExportKeystoreByDirRequest) (*pb.ExportKeystoreByDirResponse, error)
- func (s *Server) GetBestBlock(ctx context.Context, msg *empty.Empty) (*pb.GetBestBlockResponse, error)
- func (s *Server) GetBlock(ctx context.Context, in *pb.GetBlockRequest) (*pb.GetBlockResponse, error)
- func (s *Server) GetBlockByHeight(ctx context.Context, in *pb.GetBlockByHeightRequest) (*pb.GetBlockResponse, error)
- func (s *Server) GetBlockHashByHeight(ctx context.Context, in *pb.GetBlockHashByHeightRequest) (*pb.GetBlockHashByHeightResponse, error)
- func (s *Server) GetBlockHeader(ctx context.Context, in *pb.GetBlockHeaderRequest) (*pb.GetBlockHeaderResponse, error)
- func (s *Server) GetBlockHeaderV2(ctx context.Context, in *pb.GetBlockRequestV2) (*pb.GetBlockHeaderResponse, error)
- func (s *Server) GetBlockHeightByPubKey(ctx context.Context, in *pb.GetBlockHeightByPubKeyRequest) (*pb.GetBlockHeightByPubKeyResponse, error)
- func (s *Server) GetBlockV2(ctx context.Context, in *pb.GetBlockRequestV2) (*pb.GetBlockResponseV2, error)
- func (s *Server) GetBlockVerbose1V2(ctx context.Context, in *pb.GetBlockRequestV2) (*pb.GetBlockResponse, error)
- func (s *Server) GetCapacitySpace(ctx context.Context, in *pb.WorkSpaceRequest) (*pb.WorkSpaceResponse, error)
- func (s *Server) GetCapacitySpaces(ctx context.Context, in *empty.Empty) (*pb.WorkSpacesResponse, error)
- func (s *Server) GetCapacitySpacesByDirs(ctx context.Context, in *empty.Empty) (*pb.WorkSpacesByDirsResponse, error)
- func (s *Server) GetClientStatus(ctx context.Context, in *empty.Empty) (*pb.GetClientStatusResponse, error)
- func (s *Server) GetCoinbase(ctx context.Context, in *pb.GetCoinbaseRequest) (*pb.GetCoinbaseResponse, error)
- func (s *Server) GetGovernConfig(ctx context.Context, in *pb.GetGovernConfigRequest) (*pb.GetGovernConfigResponse, error)
- func (s *Server) GetGovernConfigHistory(ctx context.Context, in *pb.GetGovernConfigHistoryRequest) (*pb.GetGovernConfigHistoryResponse, error)
- func (s *Server) GetKeystore(ctx context.Context, msg *empty.Empty) (*pb.GetKeystoreResponse, error)
- func (s *Server) GetKeystoreDetail(ctx context.Context, in *pb.GetKeystoreDetailRequest) (*pb.GetKeystoreDetailResponse, error)
- func (s *Server) GetRawTransaction(ctx context.Context, in *pb.GetRawTransactionRequest) (*pb.TxRawResult, error)
- func (s *Server) GetStakingRewardRecord(ctx context.Context, in *pb.GetStakingRewardRecordRequest) (*pb.GetStakingRewardRecordResponse, error)
- func (s *Server) GetStakingTxPoolInfo(ctx context.Context, in *empty.Empty) (*pb.GetStakingTxPoolInfoResponse, error)
- func (s *Server) GetTxPool(ctx context.Context, in *empty.Empty) (*pb.GetTxPoolResponse, error)
- func (s *Server) GetTxPoolVerbose0(ctx context.Context, in *empty.Empty) (*pb.GetTxPoolVerbose0Response, error)
- func (s *Server) GetTxPoolVerbose1(ctx context.Context, in *empty.Empty) (*pb.GetTxPoolVerbose1Response, error)
- func (s *Server) ImportKeystore(ctx context.Context, in *pb.ImportKeystoreRequest) (*pb.ImportKeystoreResponse, error)
- func (s *Server) ImportKeystoreByDir(ctx context.Context, in *pb.ImportKeystoreByDirRequest) (*pb.ImportKeystoreByDirResponse, error)
- func (s *Server) LockWallet(ctx context.Context, msg *empty.Empty) (*pb.LockWalletResponse, error)
- func (s *Server) MineCapacitySpace(ctx context.Context, in *pb.WorkSpaceRequest) (*pb.ActOnSpaceKeeperResponse, error)
- func (s *Server) MineCapacitySpaces(ctx context.Context, in *empty.Empty) (*pb.ActOnSpaceKeeperResponse, error)
- func (s *Server) PlotCapacitySpace(ctx context.Context, in *pb.WorkSpaceRequest) (*pb.ActOnSpaceKeeperResponse, error)
- func (s *Server) PlotCapacitySpaces(ctx context.Context, in *empty.Empty) (*pb.ActOnSpaceKeeperResponse, error)
- func (s *Server) QuitClient(ctx context.Context, in *empty.Empty) (*pb.QuitClientResponse, error)
- func (s *Server) RunGateway()
- func (s *Server) Start() error
- func (s *Server) Stop()
- func (s *Server) StopCapacitySpace(ctx context.Context, in *pb.WorkSpaceRequest) (*pb.ActOnSpaceKeeperResponse, error)
- func (s *Server) StopCapacitySpaces(ctx context.Context, in *empty.Empty) (*pb.ActOnSpaceKeeperResponse, error)
- func (s *Server) UnlockWallet(ctx context.Context, in *pb.UnlockWalletRequest) (*pb.UnlockWalletResponse, error)
Constants ¶
View Source
const ( // transaction err ErrAPINoTxInfo = 1101 ErrAPINoTxOut = 1102 ErrAPIRawTx = 1103 ErrAPIDuplicateTx = 1104 ErrAPIInsufficient = 1105 ErrAPIFailedToSukhavati = 1106 ErrAPIFindingUtxo = 1107 ErrAPIFindingBalance = 1108 ErrAPIEstimateTxFee = 1109 ErrAPIUserTxFee = 1110 // block err ErrAPINewestHash = 1201 ErrAPIBlockNotFound = 1202 ErrAPINextBlock = 1203 ErrAPIBlockHashByHeight = 1204 ErrAPIBlockHeaderNotFound = 1205 // txScript ErrAPICreatePkScript = 1401 ErrAPISignTx = 1402 ErrAPINewEngine = 1403 ErrAPIExecute = 1404 ErrAPIRejectTx = 1405 ErrAPIExtractPKScript = 1406 // Invalid Parameter ErrAPIInvalidParameter = 1501 ErrAPIInvalidLockTime = 1502 ErrAPIInvalidAmount = 1503 ErrAPIInvalidAddress = 1504 ErrAPIInvalidFlag = 1505 ErrAPIInvalidIndex = 1506 ErrAPIInvalidHash = 1507 ErrAPIInvalidPublicKey = 1508 ErrAPIInvalidWalletId = 1509 ErrAPIInvalidPassphrase = 1510 ErrAPIInvalidSpaceID = 1511 // wallet ErrAPIInvalidTxHex = 1517 ErrAPIInvalidTxId = 1518 // Decode, Encode and deserialize err ErrAPIFailedDecodeAddress = 1601 ErrAPIDecodeHexString = 1602 ErrAPIShaHashFromStr = 1603 ErrAPIEncode = 1604 ErrAPIDeserialization = 1605 ErrAPIDecodePrivKey = 1606 ErrAPIDisasmScript = 1607 // other err ErrAPIUnknownErr = 1701 ErrAPINet = 1702 ErrNoMinningAddrress = 1703 // Miner err ErrAPIMinerInternal = 1801 ErrAPIMinerNoConfig = 1802 ErrAPIMinerSpaceNotFound = 1803 ErrAPIMinerSpaceNotReady = 1804 ErrAPIMinerNotStopped = 1805 ErrAPIMinerInvalidAddress = 1806 ErrAPIMinerInvalidCapacity = 1807 ErrAPIMinerInvalidSpaceID = 1808 ErrAPIMinerNoAddress = 1809 ErrAPIMinerWrongPassphrase = 1810 ErrAPIMinerInvalidAllocation = 1811 // Wallet err ErrAPIExportWallet = 1901 ErrAPIOpenFile = 1902 ErrAPIWriteFile = 1903 ErrAPIFlush = 1904 ErrAPIWalletInternal = 1905 ErrAPIWalletIsMining = 1906 )
View Source
const ( UndeclaredTX int32 = -1 StakingTX int32 = 1 BindingTX int32 = 2 OrdinaryTX int32 = 3 CoinbaseTX int32 = 4 PoolingTX int32 = 5 )
View Source
const ( LenHash = 64 LenAddress = 63 LenTxId = 64 LenPkString = 66 LenWalletId = 42 LenPassMax = 40 LenPassMin = 6 // evaluate value LenSpaceIDMax = 80 )
View Source
const (
DefaultHTTPLimit = 128 // DefaultHTTPLimit default max http connections
)
View Source
const (
GRPCListenAddress = "127.0.0.1"
)
Variables ¶
View Source
var ( RegexpBlockHeightPattern = `^height-\d+$` RegexpBlockHashPattern = `^hash-[a-fA-F0-9]{64}$` RegexpBlockHeight *regexp.Regexp RegexpBlockHash *regexp.Regexp )
View Source
var ErrCode = map[uint32]string{ ErrAPINoTxInfo: "No information available about transaction", ErrAPIInvalidIndex: "Invalid OutPoint index", ErrAPINoTxOut: "Invalid preOutPoint", ErrAPIDuplicateTx: "OutPoint index has been spent", ErrAPIInsufficient: "Insufficient balance", ErrAPIFailedToSukhavati: "Failed convert the amount", ErrAPIFindingUtxo: "Failed to find Utxo", ErrAPIFindingBalance: "Failed to find balance", ErrAPIInvalidParameter: "Invalid parameter", ErrAPIInvalidLockTime: "Invalid locktime", ErrAPIInvalidAmount: "Invalid amount", ErrAPIInvalidAddress: "Invalid address", ErrAPIInvalidFlag: "Invalid sighash parameter", ErrAPICreatePkScript: "Failed to create pkScript", ErrAPIFailedDecodeAddress: "Failed to decode address", ErrAPIDecodeHexString: "Argument must be hexadecimal string", ErrAPIShaHashFromStr: "Failed to decode hash from string", ErrAPIEncode: "Failed to encode data", ErrAPIDeserialization: "Failed to deserialize", ErrAPIDecodePrivKey: "Failed to decode WIF for the privkey", ErrAPIDisasmScript: "Failed to disasm script to string", ErrAPINet: "Mismatched network", ErrAPISignTx: "Failed to sign transaction", ErrAPINewEngine: "Failed to create new engine", ErrAPIExecute: "Failed to execute engine", ErrAPIRejectTx: "Reject receive transaction", ErrAPIExtractPKScript: "Failed to extract info from pkScript", ErrAPINewestHash: "Failed to get newest hash", ErrAPIBlockNotFound: "Failed to find block", ErrAPIRawTx: "Failed to create raw transaction", ErrAPINextBlock: "No next block", ErrAPIBlockHashByHeight: "Failed to get block hash by height", ErrAPIBlockHeaderNotFound: "Failed to find block header", ErrNoMinningAddrress: "No payment addresses specified via --miningaddr", ErrAPIUnknownErr: "Unknown error", ErrAPIEstimateTxFee: "Failed to estimateTxFee", ErrAPIUserTxFee: "Invalid userTxFee", ErrAPIMinerInternal: "Error in miner internal", ErrAPIMinerNoConfig: "No config specified", ErrAPIMinerSpaceNotFound: "Fail to find space", ErrAPIMinerSpaceNotReady: "Not Ready space", ErrAPIMinerNotStopped: "Invalid miner status, should be stopped", ErrAPIMinerInvalidAddress: "Invalid miner payout address", ErrAPIMinerInvalidCapacity: "Invalid miner capacity", ErrAPIMinerInvalidSpaceID: "Invalid spaceID", ErrAPIInvalidHash: "Invalid hash", ErrAPIInvalidPublicKey: "Invalid public key", ErrAPIInvalidWalletId: "Invalid walletId", ErrAPIInvalidPassphrase: "Invalid passphrase", ErrAPIInvalidSpaceID: "Invalid space id", ErrAPIMinerNoAddress: "Missing miner payout addresses", ErrAPIMinerWrongPassphrase: "Wrong miner passphrase", ErrAPIMinerInvalidAllocation: "Invalid miner allocation", ErrAPIInvalidTxId: "Invalid transaction id", ErrAPIInvalidTxHex: "Invalid txHex", ErrAPIExportWallet: "Failed to export wallet", ErrAPIOpenFile: "Failed to open keystore file", ErrAPIWriteFile: "Failed to write keystore file to cache", ErrAPIFlush: "Failed to write keystore file to disk", ErrAPIWalletInternal: "Internal error in wallet", ErrAPIWalletIsMining: "Fail to lock wallet while mining", }
View Source
var ErrInvalidBlockID = errors.New("invalid id for block")
Functions ¶
func AmountToString ¶
AmountToString converts m(in Sukhavati) to the string representation(float, in Skt)
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(db database.DB, pocMiner pocminer.PoCMiner, spaceKeeper mining.SpaceKeeper, chain *blockchain.Blockchain, txMemPool *blockchain.TxPool, sm *netsync.SyncManager, pocWallet *wallet.PoCWallet, quitClient func(), config *config.Config) (*Server, error)
func (*Server) ChangePrivatePass ¶
func (s *Server) ChangePrivatePass(ctx context.Context, in *pb.ChangePrivatePassRequest) (*pb.ChangePrivatePassResponse, error)
func (*Server) ChangePublicPass ¶
func (s *Server) ChangePublicPass(ctx context.Context, in *pb.ChangePublicPassRequest) (*pb.ChangePublicPassResponse, error)
func (*Server) ConfigureCapacity ¶
func (s *Server) ConfigureCapacity(ctx context.Context, in *pb.ConfigureSpaceKeeperRequest) (*pb.WorkSpacesResponse, error)
func (*Server) ConfigureCapacityByDirs ¶
func (s *Server) ConfigureCapacityByDirs(ctx context.Context, in *pb.ConfigureSpaceKeeperByDirsRequest) (*pb.WorkSpacesByDirsResponse, error)
func (*Server) ExportKeystore ¶
func (s *Server) ExportKeystore(ctx context.Context, in *pb.ExportKeystoreRequest) (*pb.ExportKeystoreResponse, error)
func (*Server) ExportKeystoreByDir ¶
func (s *Server) ExportKeystoreByDir(ctx context.Context, in *pb.ExportKeystoreByDirRequest) (*pb.ExportKeystoreByDirResponse, error)
func (*Server) GetBestBlock ¶
func (*Server) GetBlock ¶
func (s *Server) GetBlock(ctx context.Context, in *pb.GetBlockRequest) (*pb.GetBlockResponse, error)
func (*Server) GetBlockByHeight ¶
func (s *Server) GetBlockByHeight(ctx context.Context, in *pb.GetBlockByHeightRequest) (*pb.GetBlockResponse, error)
func (*Server) GetBlockHashByHeight ¶
func (s *Server) GetBlockHashByHeight(ctx context.Context, in *pb.GetBlockHashByHeightRequest) (*pb.GetBlockHashByHeightResponse, error)
func (*Server) GetBlockHeader ¶
func (s *Server) GetBlockHeader(ctx context.Context, in *pb.GetBlockHeaderRequest) (*pb.GetBlockHeaderResponse, error)
func (*Server) GetBlockHeaderV2 ¶
func (s *Server) GetBlockHeaderV2(ctx context.Context, in *pb.GetBlockRequestV2) (*pb.GetBlockHeaderResponse, error)
func (*Server) GetBlockHeightByPubKey ¶
func (s *Server) GetBlockHeightByPubKey(ctx context.Context, in *pb.GetBlockHeightByPubKeyRequest) (*pb.GetBlockHeightByPubKeyResponse, error)
func (*Server) GetBlockV2 ¶
func (s *Server) GetBlockV2(ctx context.Context, in *pb.GetBlockRequestV2) (*pb.GetBlockResponseV2, error)
func (*Server) GetBlockVerbose1V2 ¶
func (s *Server) GetBlockVerbose1V2(ctx context.Context, in *pb.GetBlockRequestV2) (*pb.GetBlockResponse, error)
func (*Server) GetCapacitySpace ¶
func (s *Server) GetCapacitySpace(ctx context.Context, in *pb.WorkSpaceRequest) (*pb.WorkSpaceResponse, error)
func (*Server) GetCapacitySpaces ¶
func (*Server) GetCapacitySpacesByDirs ¶
func (s *Server) GetCapacitySpacesByDirs(ctx context.Context, in *empty.Empty) (*pb.WorkSpacesByDirsResponse, error)
TODO auto get all spaces info
func (*Server) GetClientStatus ¶
func (*Server) GetCoinbase ¶
func (s *Server) GetCoinbase(ctx context.Context, in *pb.GetCoinbaseRequest) (*pb.GetCoinbaseResponse, error)
func (*Server) GetGovernConfig ¶
func (s *Server) GetGovernConfig(ctx context.Context, in *pb.GetGovernConfigRequest) (*pb.GetGovernConfigResponse, error)
func (*Server) GetGovernConfigHistory ¶
func (s *Server) GetGovernConfigHistory(ctx context.Context, in *pb.GetGovernConfigHistoryRequest) (*pb.GetGovernConfigHistoryResponse, error)
func (*Server) GetKeystore ¶
func (*Server) GetKeystoreDetail ¶
func (s *Server) GetKeystoreDetail(ctx context.Context, in *pb.GetKeystoreDetailRequest) (*pb.GetKeystoreDetailResponse, error)
func (*Server) GetRawTransaction ¶
func (s *Server) GetRawTransaction(ctx context.Context, in *pb.GetRawTransactionRequest) (*pb.TxRawResult, error)
func (*Server) GetStakingRewardRecord ¶
func (s *Server) GetStakingRewardRecord(ctx context.Context, in *pb.GetStakingRewardRecordRequest) (*pb.GetStakingRewardRecordResponse, error)
func (*Server) GetStakingTxPoolInfo ¶
func (*Server) GetTxPoolVerbose0 ¶
func (*Server) GetTxPoolVerbose1 ¶
func (*Server) ImportKeystore ¶
func (s *Server) ImportKeystore(ctx context.Context, in *pb.ImportKeystoreRequest) (*pb.ImportKeystoreResponse, error)
func (*Server) ImportKeystoreByDir ¶
func (s *Server) ImportKeystoreByDir(ctx context.Context, in *pb.ImportKeystoreByDirRequest) (*pb.ImportKeystoreByDirResponse, error)
func (*Server) LockWallet ¶
func (*Server) MineCapacitySpace ¶
func (s *Server) MineCapacitySpace(ctx context.Context, in *pb.WorkSpaceRequest) (*pb.ActOnSpaceKeeperResponse, error)
func (*Server) MineCapacitySpaces ¶
func (*Server) PlotCapacitySpace ¶
func (s *Server) PlotCapacitySpace(ctx context.Context, in *pb.WorkSpaceRequest) (*pb.ActOnSpaceKeeperResponse, error)
func (*Server) PlotCapacitySpaces ¶
func (*Server) QuitClient ¶
func (*Server) RunGateway ¶
func (s *Server) RunGateway()
func (*Server) StopCapacitySpace ¶
func (s *Server) StopCapacitySpace(ctx context.Context, in *pb.WorkSpaceRequest) (*pb.ActOnSpaceKeeperResponse, error)
func (*Server) StopCapacitySpaces ¶
func (*Server) UnlockWallet ¶
func (s *Server) UnlockWallet(ctx context.Context, in *pb.UnlockWalletRequest) (*pb.UnlockWalletResponse, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.