Documentation ¶
Index ¶
- Constants
- type AddressAPI
- func (api *AddressAPI) Authorized(r *http.Request, args *AuthorizedArgs, response *AuthorizedResponse) error
- func (api *AddressAPI) Balance(r *http.Request, args *BalanceOfAddressArgs, ...) error
- func (api *AddressAPI) List(r *http.Request, args *EmptyArgs, response *ListAddressesResponse) error
- func (api *AddressAPI) Lock(r *http.Request, args *LockAddressArgs, response *LockAddressResponse) error
- func (api *AddressAPI) Unlock(r *http.Request, args *UnlockAddressArgs, response *UnlockAddressResponse) error
- type AuthorizedArgs
- type AuthorizedResponse
- type BalanceOfAddressArgs
- type BalanceOfAddressResponse
- type BlockAPI
- type Blockchain
- type ByAddressArgs
- type ChannelAPI
- func (api *ChannelAPI) CreateNodeItemsTxDataPayload(r *http.Request, args *CreateNodeItemsTxDataPayloadArgs, ...) error
- func (api *ChannelAPI) FilesFromEntryOrFolder(r *http.Request, args *FilesFromEntryOrFolderArgs, ...) error
- func (api *ChannelAPI) GetNodeItem(r *http.Request, args *GetNodeItemArgs, response *GetNodeItemResponse) error
- func (api *ChannelAPI) List(r *http.Request, args *ListArgs, response *ListResponse) error
- func (api *ChannelAPI) Search(r *http.Request, args *SearchArgs, response *SearchResponse) error
- type CheckDataQueryResponse
- type CheckDataQueryResponseArgs
- type CreateContractsFromDataQueryResponsesArgs
- type CreateContractsFromDataQueryResponsesResponse
- type CreateNodeItemsTxDataPayloadArgs
- type CreateNodeItemsTxDataPayloadResponse
- type CreateTransactionDataPayloadFromContractHashesArgs
- type CreateTransactionDataPayloadFromContractHashesResponse
- type DataQueryResponseJSON
- type DataTransferAPI
- func (api *DataTransferAPI) CheckDataQueryResponse(r *http.Request, args *CheckDataQueryResponseArgs, ...) error
- func (api *DataTransferAPI) CreateContractsFromDataQueryResponses(r *http.Request, args *CreateContractsFromDataQueryResponsesArgs, ...) error
- func (api *DataTransferAPI) CreateTransactionsWithDataPayloadFromContractHashes(r *http.Request, args *CreateTransactionDataPayloadFromContractHashesArgs, ...) error
- func (api *DataTransferAPI) DownloadFile(r *http.Request, args *DownloadFileArgs, response *DownloadFileResponse) error
- func (api *DataTransferAPI) DownloadFileProgress(r *http.Request, args *DownloadFileProgressArgs, ...) error
- func (api *DataTransferAPI) GetDownloadContract(r *http.Request, args *GetDownloadContractArgs, ...) error
- func (api *DataTransferAPI) PauseFileDownload(r *http.Request, args *PauseFileDownloadArgs, ...) error
- func (api *DataTransferAPI) RebroadcastDataQueryRequest(r *http.Request, args *RebroadcastDataQueryRequestArgs, ...) error
- func (api *DataTransferAPI) RequestDataQueryResponseFromVerifiers(r *http.Request, args *CheckDataQueryResponseArgs, ...) error
- func (api *DataTransferAPI) RequestEncryptionDataFromVerifierAndDecrypt(r *http.Request, args *RequestEncryptionDataFromVerifierArgs, ...) error
- func (api *DataTransferAPI) SendContractToFileHosterAndVerifier(r *http.Request, args *SendContractToFileHosterAndVerifierArgs, ...) error
- func (api *DataTransferAPI) SendDataQueryRequest(r *http.Request, args *SendDataQueryRequestArgs, ...) error
- func (api *DataTransferAPI) SendFileMerkleTreeNodesToVerifier(r *http.Request, args *SendFileMerkleTreeNodesToVerifierArgs, ...) error
- type DownloadContractJSON
- type DownloadFileArgs
- type DownloadFileProgressArgs
- type DownloadFileProgressResponse
- type DownloadFileResponse
- type EmptyArgs
- type FileMetadata
- type FileRanges
- type FileUploadProgressArgs
- type FileUploadProgressResponse
- type FilefilegoAPI
- type FilesFromEntryOrFolderArgs
- type FilesFromEntryOrFolderResponse
- type FindProvidersArgs
- type FindProvidersResponse
- type GetByHashArgs
- type GetByNumberArgs
- type GetDiscoveredProvidersResponse
- type GetDownloadContractArgs
- type GetDownloadContractResponse
- type GetNodeItemArgs
- type GetNodeItemResponse
- type HostInfoResponse
- type JSONBlock
- type JSONBlockTransaction
- type JSONStorageProvider
- type JSONTransaction
- type ListAddressesResponse
- type ListArgs
- type ListResponse
- type LockAddressArgs
- type LockAddressResponse
- type MemPoolResponse
- type NetworkMessagePublisher
- type NodeItemJSON
- type PauseFileDownloadArgs
- type PauseFileDownloadResponse
- type PoolResponse
- type PublisherNodesFinder
- type RebroadcastDataQueryRequestArgs
- type RebroadcastDataQueryRequestResponse
- type ReceiptArgs
- type RequestEncryptionDataFromVerifierArgs
- type RequestEncryptionDataFromVerifierResponse
- type SearchArgs
- type SearchResponse
- type SendContractToFileHosterAndVerifierArgs
- type SendContractToFileHosterAndVerifierResponse
- type SendDataQueryRequestArgs
- type SendDataQueryRequestResponse
- type SendFileMerkleTreeNodesToVerifierArgs
- type SendFileMerkleTreeNodesToVerifierResponse
- type SendRawTransactionArgs
- type SendTransactionArgs
- type StatsResponse
- type StorageAPI
- func (api *StorageAPI) FileUploadProgress(r *http.Request, args *FileUploadProgressArgs, ...) error
- func (api *StorageAPI) FindProviders(r *http.Request, args *FindProvidersArgs, response *FindProvidersResponse) error
- func (api *StorageAPI) GetDiscoveredProviders(r *http.Request, args *EmptyArgs, response *GetDiscoveredProvidersResponse) error
- func (api *StorageAPI) TestSpeedWithRemotePeer(r *http.Request, args *TestSpeedWithRemotePeerArgs, ...) error
- func (api *StorageAPI) UploadFileToProvider(r *http.Request, args *UploadFileToProviderArgs, ...) error
- type TestSpeedWithRemotePeerArgs
- type TestSpeedWithRemotePeerResponse
- type TransactionAPI
- func (api *TransactionAPI) ByAddress(r *http.Request, args *ByAddressArgs, response *TransactionsResponse) error
- func (api *TransactionAPI) Pool(r *http.Request, args *EmptyArgs, response *MemPoolResponse) error
- func (api *TransactionAPI) Receipt(r *http.Request, args *ReceiptArgs, response *TransactionsResponse) error
- func (api *TransactionAPI) SendRawTransaction(r *http.Request, args *SendRawTransactionArgs, response *TransactionResponse) error
- func (api *TransactionAPI) SendTransaction(r *http.Request, args *SendTransactionArgs, response *TransactionResponse) error
- type TransactionResponse
- type TransactionsResponse
- type UnlockAddressArgs
- type UnlockAddressResponse
- type UploadFileToProviderArgs
- type UploadFileToProviderResponse
Constants ¶
const AddressServiceNamespace = "address"
AddressServiceNamespace is the namespace for address service rpc.
const BlockServiceNamespace = "block"
BlockServiceNamespace is the namespace for block service rpc.
const ChannelServiceNamespace = "channel"
ChannelServiceNamespace is the namespace for channel service rpc.
const DataTransferServiceNamespace = "data_transfer"
DataTransferServiceNamespace is the namespace for data transfer service rpc.
const FilefilegoServiceNamespace = "filefilego"
FilefilegoServiceNamespace is the namespace for filefilego service rpc.
const StorageServiceNamespace = "storage"
StorageServiceNamespace is the namespace for storage service rpc.
const TransactionServiceNamespace = "transaction"
TransactionServiceNamespace is the namespace for transaction service rpc.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressAPI ¶
type AddressAPI struct {
// contains filtered or unexported fields
}
AddressAPI represents address service
func NewAddressAPI ¶
func NewAddressAPI(keystore keystore.KeyLockUnlockLister, bchain blockchain.Interface) (*AddressAPI, error)
NewAddressAPI creates a new address API to be served using JSONRPC.
func (*AddressAPI) Authorized ¶ added in v1.1.16
func (api *AddressAPI) Authorized(r *http.Request, args *AuthorizedArgs, response *AuthorizedResponse) error
Authorized checks if an access token is currently available.
func (*AddressAPI) Balance ¶
func (api *AddressAPI) Balance(r *http.Request, args *BalanceOfAddressArgs, response *BalanceOfAddressResponse) error
Balance of an address.
func (*AddressAPI) List ¶ added in v1.1.6
func (api *AddressAPI) List(r *http.Request, args *EmptyArgs, response *ListAddressesResponse) error
List the addresses of the node.
func (*AddressAPI) Lock ¶
func (api *AddressAPI) Lock(r *http.Request, args *LockAddressArgs, response *LockAddressResponse) error
Lock a key given an access token and the address.
func (*AddressAPI) Unlock ¶
func (api *AddressAPI) Unlock(r *http.Request, args *UnlockAddressArgs, response *UnlockAddressResponse) error
Unlock a key given an address and a passphrase.
type AuthorizedArgs ¶ added in v1.1.16
type AuthorizedArgs struct {
Token string `json:"token"`
}
AuthorizedArgs arguments required for checking authorized token.
type AuthorizedResponse ¶ added in v1.1.16
type AuthorizedResponse struct {
Authorized bool `json:"authorized"`
}
AuthorizedResponse is a result of the authorization request.
type BalanceOfAddressArgs ¶
type BalanceOfAddressArgs struct {
Address string `json:"address"`
}
BalanceOfAddressArgs arguments required for balance of an address.
type BalanceOfAddressResponse ¶
type BalanceOfAddressResponse struct { Balance string `json:"balance"` BalanceHex string `json:"balance_hex"` Nounce string `json:"nounce"` NextNounce string `json:"next_nounce"` }
BalanceOfAddressResponse represents the balance response of an address.
type BlockAPI ¶
type BlockAPI struct {
// contains filtered or unexported fields
}
BlockAPI represents the block rpc service.
func NewBlockAPI ¶
func NewBlockAPI(bchain blockchain.Interface) (*BlockAPI, error)
NewBlockAPI creates a new block API to be served using JSONRPC.
func (*BlockAPI) GetByNumber ¶
GetByNumber gets a block by number.
type Blockchain ¶
type Blockchain interface { PutMemPool(tx transaction.Transaction) error GetTransactionsFromPool() []transaction.Transaction GetAddressTransactions(address []byte, currentPage, limit int) ([]transaction.Transaction, []uint64, []int64, error) GetTransactionByHash(hash []byte) ([]transaction.Transaction, []uint64, error) }
Blockchain defines the blockchain functionality needed for this rpc service,
type ByAddressArgs ¶
type ByAddressArgs struct { Address string `json:"address"` CurrentPage int `json:"current_page"` PageSize int `json:"page_size"` }
ByAddressArgs get transactions by address arguments.
type ChannelAPI ¶
type ChannelAPI struct {
// contains filtered or unexported fields
}
ChannelAPI represents the channel rpc service.
func NewChannelAPI ¶
func NewChannelAPI(bchain blockchain.Interface, search search.IndexSearcher) (*ChannelAPI, error)
NewChannelAPI creates a new channel API to be served using JSONRPC.
func (*ChannelAPI) CreateNodeItemsTxDataPayload ¶ added in v1.1.7
func (api *ChannelAPI) CreateNodeItemsTxDataPayload(r *http.Request, args *CreateNodeItemsTxDataPayloadArgs, response *CreateNodeItemsTxDataPayloadResponse) error
CreateNodeItemsTxDataPayload a channel node items that returns the transaction data payload, which in turn can be used in a transaction data payload.
func (*ChannelAPI) FilesFromEntryOrFolder ¶
func (api *ChannelAPI) FilesFromEntryOrFolder(r *http.Request, args *FilesFromEntryOrFolderArgs, response *FilesFromEntryOrFolderResponse) error
FilesFromEntryOrFolder all the files of a node which is a dir or an entry recursvely.
func (*ChannelAPI) GetNodeItem ¶
func (api *ChannelAPI) GetNodeItem(r *http.Request, args *GetNodeItemArgs, response *GetNodeItemResponse) error
GetNodeItem gets a node item.
func (*ChannelAPI) List ¶
func (api *ChannelAPI) List(r *http.Request, args *ListArgs, response *ListResponse) error
List returns a list of channels.
func (*ChannelAPI) Search ¶
func (api *ChannelAPI) Search(r *http.Request, args *SearchArgs, response *SearchResponse) error
Search search in nodes.
type CheckDataQueryResponse ¶
type CheckDataQueryResponse struct {
Responses []DataQueryResponseJSON `json:"responses"`
}
CheckDataQueryResponse is a data query response payload.
type CheckDataQueryResponseArgs ¶
type CheckDataQueryResponseArgs struct {
DataQueryRequestHash string `json:"data_query_request_hash"`
}
CheckDataQueryResponseArgs is a data query response arg.
type CreateContractsFromDataQueryResponsesArgs ¶
type CreateContractsFromDataQueryResponsesArgs struct {
DataQueryRequestHash string `json:"data_query_request_hash"`
}
CreateContractsFromDataQueryResponseHashArgs represents args.
type CreateContractsFromDataQueryResponsesResponse ¶
type CreateContractsFromDataQueryResponsesResponse struct {
ContractHashes []string `json:"contract_hashes"`
}
CreateContractsFromDataQueryResponsesResponse represents the response.
type CreateNodeItemsTxDataPayloadArgs ¶ added in v1.1.7
type CreateNodeItemsTxDataPayloadArgs struct {
Nodes []NodeItemJSON `json:"nodes"`
}
CreateNodeItemsTxDataPayloadArgs is a create channel node item request payload.
type CreateNodeItemsTxDataPayloadResponse ¶ added in v1.1.7
type CreateNodeItemsTxDataPayloadResponse struct { TransactionDataPayloadHex string `json:"transaction_data_payload_hex"` TotalFeesRequired string `json:"total_fees_required"` }
CreateNodeItemsTxDataPayloadResponse is a response which contains the transaction data payload for creating the channel node items. It contains the required fees for creating the provided node items based on their type.
type CreateTransactionDataPayloadFromContractHashesArgs ¶
type CreateTransactionDataPayloadFromContractHashesArgs struct { AccessToken string `json:"access_token"` ContractHashes []string `json:"contract_hashes"` CurrentNounce string `json:"current_nounce"` TransactionFeesToBeUsed string `json:"transaction_fees_to_be_used"` }
CreateTransactionDataPayloadFromContractHashesArgs represent the function args.
type CreateTransactionDataPayloadFromContractHashesResponse ¶
type CreateTransactionDataPayloadFromContractHashesResponse struct { TransactionDataBytesHex []string `json:"transaction_data_bytes_hex"` TotalFeesForTransactions string `json:"total_fees_for_transaction"` }
CreateTransactionDataPayloadFromContractHashesResponse represent the function response.
type DataQueryResponseJSON ¶
type DataQueryResponseJSON struct { FromPeerAddr string `json:"from_peer_addr"` FeesPerByte string `json:"fees_per_byte"` HashDataQueryRequest string `json:"hash_data_query_request"` PublicKey string `json:"public_key"` Signature string `json:"signature"` FileHashes []string `json:"file_hashes"` FileHashesSizes []uint64 `json:"file_hashes_sizes"` Timestamp int64 `json:"timestamp"` }
DataQueryResponseJSON represents a json payload which represents a DataQueryResponse.
type DataTransferAPI ¶
type DataTransferAPI struct {
// contains filtered or unexported fields
}
DataTransferAPI represents the data transfer rpc service which includes data query and verification protocols.
func NewDataTransferAPI ¶
func NewDataTransferAPI(host host.Host, dataQueryProtocol dataquery.Interface, dataVerificationProtocol dataverification.Interface, publisherNodeFinder PublisherNodesFinder, contractStore contract.Interface, keystore keystore.KeyAuthorizer) (*DataTransferAPI, error)
NewDataTransferAPI creates a new data transfer API to be served using JSONRPC.
func (*DataTransferAPI) CheckDataQueryResponse ¶
func (api *DataTransferAPI) CheckDataQueryResponse(r *http.Request, args *CheckDataQueryResponseArgs, response *CheckDataQueryResponse) error
CheckDataQueryResponse returns a list of data query responses.
func (*DataTransferAPI) CreateContractsFromDataQueryResponses ¶
func (api *DataTransferAPI) CreateContractsFromDataQueryResponses(r *http.Request, args *CreateContractsFromDataQueryResponsesArgs, response *CreateContractsFromDataQueryResponsesResponse) error
CreateContractsFromDataQueryResponses creates contracts from the available data query responses.
func (*DataTransferAPI) CreateTransactionsWithDataPayloadFromContractHashes ¶
func (api *DataTransferAPI) CreateTransactionsWithDataPayloadFromContractHashes(r *http.Request, args *CreateTransactionDataPayloadFromContractHashesArgs, response *CreateTransactionDataPayloadFromContractHashesResponse) error
CreateTransactionsWithDataPayloadFromContractHashes given a list of contract hashes it creates the transactions and its data payloads.
func (*DataTransferAPI) DownloadFile ¶
func (api *DataTransferAPI) DownloadFile(r *http.Request, args *DownloadFileArgs, response *DownloadFileResponse) error
DownloadFile downloads a file from a contract.
func (*DataTransferAPI) DownloadFileProgress ¶
func (api *DataTransferAPI) DownloadFileProgress(r *http.Request, args *DownloadFileProgressArgs, response *DownloadFileProgressResponse) error
DownloadFileProgress returns the download progress of a file.
func (*DataTransferAPI) GetDownloadContract ¶
func (api *DataTransferAPI) GetDownloadContract(r *http.Request, args *GetDownloadContractArgs, response *GetDownloadContractResponse) error
GetDownloadContract returns a contract from the memmory.
func (*DataTransferAPI) PauseFileDownload ¶ added in v1.1.9
func (api *DataTransferAPI) PauseFileDownload(r *http.Request, args *PauseFileDownloadArgs, response *PauseFileDownloadResponse) error
PauseFileDownload pauses a file download.
func (*DataTransferAPI) RebroadcastDataQueryRequest ¶ added in v1.1.16
func (api *DataTransferAPI) RebroadcastDataQueryRequest(r *http.Request, args *RebroadcastDataQueryRequestArgs, response *RebroadcastDataQueryRequestResponse) error
SendDataQueryRequest sends a data query request to the network.
func (*DataTransferAPI) RequestDataQueryResponseFromVerifiers ¶
func (api *DataTransferAPI) RequestDataQueryResponseFromVerifiers(r *http.Request, args *CheckDataQueryResponseArgs, response *CheckDataQueryResponse) error
RequestDataQueryResponseFromVerifiers returns a list of data query responses by contacting the verifiers.
func (*DataTransferAPI) RequestEncryptionDataFromVerifierAndDecrypt ¶
func (api *DataTransferAPI) RequestEncryptionDataFromVerifierAndDecrypt(r *http.Request, args *RequestEncryptionDataFromVerifierArgs, response *RequestEncryptionDataFromVerifierResponse) error
RequestEncryptionDataFromVerifierAndDecrypt requires encryption data from verifier and decrypts.
func (*DataTransferAPI) SendContractToFileHosterAndVerifier ¶
func (api *DataTransferAPI) SendContractToFileHosterAndVerifier(r *http.Request, args *SendContractToFileHosterAndVerifierArgs, response *SendContractToFileHosterAndVerifierResponse) error
SendContractToFileHosterAndVerifier sends the contract to file hoster and verifier.
func (*DataTransferAPI) SendDataQueryRequest ¶
func (api *DataTransferAPI) SendDataQueryRequest(r *http.Request, args *SendDataQueryRequestArgs, response *SendDataQueryRequestResponse) error
SendDataQueryRequest sends a data query request to the network.
func (*DataTransferAPI) SendFileMerkleTreeNodesToVerifier ¶
func (api *DataTransferAPI) SendFileMerkleTreeNodesToVerifier(r *http.Request, args *SendFileMerkleTreeNodesToVerifierArgs, response *SendFileMerkleTreeNodesToVerifierResponse) error
SendFileMerkleTreeNodesToVerifier sends the merkle tree nodes of a downloaded encrypted file to verifier from the file downloader.
type DownloadContractJSON ¶
type DownloadContractJSON struct { FileHosterResponse DataQueryResponseJSON `json:"file_hoster_response"` FileRequesterNodePublicKey string `json:"file_requester_node_public_key"` FileHashesNeeded []string `json:"file_hashes_needed"` FileHashesNeededSizes []uint64 `json:"file_hashes_needed_sizes"` VerifierPublicKey string `json:"verifier_public_key"` VerifierFees string `json:"verifier_fees"` ContractHash string `json:"contract_hash"` VerifierSignature string `json:"verifier_signature"` }
DownloadContractJSON is a download contract in JSON.
type DownloadFileArgs ¶
type DownloadFileArgs struct { ContractHash string `json:"contract_hash"` FileHash string `json:"file_hash"` ReDownload bool `json:"re_download"` }
DownloadFileArgs represent args.
type DownloadFileProgressArgs ¶
type DownloadFileProgressArgs struct { ContractHash string `json:"contract_hash"` FileHash string `json:"file_hash"` }
DownloadFileProgressArgs represent args.
type DownloadFileProgressResponse ¶
type DownloadFileProgressResponse struct { Error string `json:"error"` BytesTransfered uint64 `json:"bytes_transfered"` }
DownloadFileProgressResponse represents the response of a download file progress.
type DownloadFileResponse ¶
type DownloadFileResponse struct {
Status string `json:"status"`
}
DownloadFileArgs represents a response.
type FileMetadata ¶
type FileMetadata struct { Name string `json:"name"` Hash string `json:"hash"` Size uint64 `json:"size"` Path string `json:"path"` }
FileMetadata represents a file metadata
type FileRanges ¶
type FileRanges struct {
// contains filtered or unexported fields
}
type FileUploadProgressArgs ¶ added in v1.1.16
type FileUploadProgressArgs struct { PeerID string `json:"peer_id"` FilePath string `json:"file_path"` }
FileUploadProgressArgs args for upload progress.
type FileUploadProgressResponse ¶ added in v1.1.16
type FileUploadProgressResponse struct { Progress int `json:"progress"` Error string `json:"error"` }
FileUploadProgressResponse is the response of the progress.
type FilefilegoAPI ¶
type FilefilegoAPI struct {
// contains filtered or unexported fields
}
FilefilegoAPI represents the filefilego rpc service.
func NewFilefilegoAPI ¶
func NewFilefilegoAPI(cfg *config.Config, node node.Interface, blockchain blockchain.Interface, host host.Host) (*FilefilegoAPI, error)
NewFilefilegoAPI creates a new filefilego API to be served using JSONRPC.
func (*FilefilegoAPI) HostInfo ¶
func (api *FilefilegoAPI) HostInfo(r *http.Request, args *EmptyArgs, response *HostInfoResponse) error
HostInfo returns the node's addresses.
func (*FilefilegoAPI) Stats ¶
func (api *FilefilegoAPI) Stats(r *http.Request, args *EmptyArgs, response *StatsResponse) error
Stats reports the stats of the node.
type FilesFromEntryOrFolderArgs ¶
type FilesFromEntryOrFolderArgs struct {
NodeHash string `json:"node_hash"`
}
FilesFromEntryOrFolderArgs is a request.
type FilesFromEntryOrFolderResponse ¶
type FilesFromEntryOrFolderResponse struct {
Files []FileMetadata `json:"files"`
}
FilesFromEntryOrFolderResponse is a response.
type FindProvidersArgs ¶ added in v1.1.16
type FindProvidersArgs struct {
PreferredLocation string `json:"preferred_location"`
}
FindProvidersArgs args for finding providers
type FindProvidersResponse ¶ added in v1.1.16
type FindProvidersResponse struct {
Success bool `json:"success"`
}
FindProvidersResponse the response of the finding storage providers mechanism.
type GetByHashArgs ¶
type GetByHashArgs struct {
Hash string `json:"hash"`
}
GetByHashArgs represents the args of rpc request.
type GetByNumberArgs ¶
type GetByNumberArgs struct {
Number uint64 `json:"number"`
}
GetByNumberArgs represents the args of rpc request.
type GetDiscoveredProvidersResponse ¶ added in v1.1.16
type GetDiscoveredProvidersResponse struct {
StorageProviders []JSONStorageProvider `json:"storage_providers"`
}
GetDiscoveredProvidersResponse is the response containing the discovered storage providers.
type GetDownloadContractArgs ¶
type GetDownloadContractArgs struct {
ContractHash string `json:"contract_hash"`
}
GetDownloadContractArgs represent the args.
type GetDownloadContractResponse ¶
type GetDownloadContractResponse struct {
Contract DownloadContractJSON `json:"contract"`
}
GetDownloadContractResponse represents the response.
type GetNodeItemArgs ¶
type GetNodeItemArgs struct {
NodeHash string `json:"node_hash"`
}
GetNodeItemArgs is a response.
type GetNodeItemResponse ¶
type GetNodeItemResponse struct {
Node NodeItemJSON `json:"node"`
}
GetNodeItemResponse is a response.
type HostInfoResponse ¶
type HostInfoResponse struct { PeerID string `json:"peer_id"` Address string `json:"address"` PeerCount int `json:"peer_count"` }
HostInfoResponse represents a response.
type JSONBlock ¶
type JSONBlock struct { Number uint64 `json:"number"` Timestamp int64 `json:"timestamp"` Data string `json:"data"` PreviousBlockHash string `json:"previous_block_hash"` Hash string `json:"hash"` Signature string `json:"signature"` MerkleHash string `json:"merkle_hash"` Transactions []JSONTransaction `json:"transactions"` }
JSONBlock represents the block response of rpc request.
type JSONBlockTransaction ¶
type JSONBlockTransaction struct { BlockNumber uint64 `json:"block_number"` Timestamp int64 `json:"timestamp"` Transaction JSONTransaction `json:"transaction"` }
JSONBlockTransaction represnts the block number and a transaction.
type JSONStorageProvider ¶ added in v1.1.16
type JSONStorageProvider struct { StorageProviderPeerAddr string `json:"storage_provider_peer_addr"` Location string `json:"location"` FeesPerByte string `json:"fees_per_byte"` PublicKey string `json:"public_key"` Hash string `json:"hash"` Signature string `json:"signature"` }
JSONStorageProvider is a json storage provider.
type JSONTransaction ¶
type JSONTransaction struct { Hash string `json:"hash"` Signature string `json:"signature"` PublicKey string `json:"public_key"` Nounce string `json:"nounce"` Data string `json:"data"` From string `json:"from"` To string `json:"to"` Value string `json:"value"` TransactionFees string `json:"transaction_fees"` Chain string `json:"chain"` }
JSONTransaction represents a json transaction.
type ListAddressesResponse ¶ added in v1.1.6
type ListAddressesResponse struct {
Addresses []string `json:"addresses"`
}
ListAddressesResponse is a key unlock response.
type ListResponse ¶
type ListResponse struct { Total uint64 `json:"total"` Limit int `json:"limit"` Offset int `json:"offset"` Channels []NodeItemJSON `json:"channels"` }
ListResponse is a list response.
type LockAddressArgs ¶
LockAddressArgs arguments required for locking a key.
type LockAddressResponse ¶
type LockAddressResponse struct {
Success bool `json:"success"`
}
LockAddressResponse is a key unlock response.
type MemPoolResponse ¶
type MemPoolResponse struct {
TransactionHashes []string `json:"transaction_hashes"`
}
MemPoolResponse represents the mempool hashes.
type NetworkMessagePublisher ¶
type NetworkMessagePublisher interface {
PublishMessageToNetwork(ctx context.Context, topicName string, data []byte) error
}
NetworkMessagePublisher is a pub sub message broadcaster.
type NodeItemJSON ¶ added in v1.1.6
type NodeItemJSON struct { Name string `json:"name"` NodeHash string `json:"node_hash"` Owner string `json:"owner"` Enabled bool `json:"enabled"` NodeType int32 `json:"node_type"` Attributes []string `json:"attributes"` Admins []string `json:"admins"` Posters []string `json:"posters"` Timestamp int64 `json:"timestamp"` Description string `json:"description"` MerkleRoot string `json:"merkle_root"` FileHash string `json:"file_hash"` Size uint64 `json:"size"` ParentHash string `json:"parent_hash"` ContentType string `json:"content_type"` }
NodeItemJSON represents a node item json.
type PauseFileDownloadArgs ¶ added in v1.1.9
type PauseFileDownloadArgs struct { ContractHash string `json:"contract_hash"` FileHash string `json:"file_hash"` }
PauseFileDownloadArgs represent args.
type PauseFileDownloadResponse ¶ added in v1.1.9
type PauseFileDownloadResponse struct{}
PauseFileDownloadResponse represent response.
type PoolResponse ¶
type PoolResponse struct {
BlockHashes []string `json:"block_hashes"`
}
PoolResponse represents the block pool hashes.
type PublisherNodesFinder ¶
type PublisherNodesFinder interface { NetworkMessagePublisher FindPeers(ctx context.Context, peerIDs []peer.ID) []peer.AddrInfo }
PublisherNodesFinder is an interface that specifies finding nodes and publishing a message to the network functionalities.
type RebroadcastDataQueryRequestArgs ¶ added in v1.1.16
type RebroadcastDataQueryRequestArgs struct {
Hash string `json:"hash"`
}
RebroadcastDataQueryRequestArgs rebroadcasts a data query.
type RebroadcastDataQueryRequestResponse ¶ added in v1.1.16
type RebroadcastDataQueryRequestResponse struct {
Success bool `json:"success"`
}
SendDataQueryRequestResponse is a data query hash response.
type ReceiptArgs ¶
type ReceiptArgs struct {
Hash string `json:"hash"`
}
ReceiptArgs receipt arguments.
type RequestEncryptionDataFromVerifierArgs ¶
type RequestEncryptionDataFromVerifierArgs struct { ContractHash string `json:"contract_hash"` FileHashes []string `json:"file_hashes"` FileMerkleRootHashes []string `json:"file_merkle_root_hashes"` RestoredFilePaths []string `json:"restored_file_paths"` }
RequestEncryptionDataFromVerifierArgs represents args.
type RequestEncryptionDataFromVerifierResponse ¶
type RequestEncryptionDataFromVerifierResponse struct {
DecryptedFilePaths []string `json:"decrypted_file_paths"`
}
RequestEncryptionDataFromVerifierResponse represents the response.
type SearchArgs ¶
type SearchArgs struct { Query string `json:"query"` SearchType string `json:"search_type"` Size int `json:"size"` CurrentPage int `json:"current_page"` }
SearchArgs is a search args.
type SearchResponse ¶
type SearchResponse struct {
Nodes []NodeItemJSON `json:"nodes"`
}
SearchResponse is a response with the search results.
type SendContractToFileHosterAndVerifierArgs ¶
type SendContractToFileHosterAndVerifierArgs struct {
ContractHash string `json:"contract_hash"`
}
SendContractToFileHosterAndVerifierArgs represents the args.
type SendContractToFileHosterAndVerifierResponse ¶
type SendContractToFileHosterAndVerifierResponse struct {
Success bool `json:"success"`
}
SendContractToFileHosterAndVerifierResponse represents a response.
type SendDataQueryRequestArgs ¶
type SendDataQueryRequestArgs struct { // FileHashes is a list of comma-separated file hashes. FileHashes string `json:"file_hashes"` }
SendDataQueryRequestArgs is a data query request argument.
type SendDataQueryRequestResponse ¶
type SendDataQueryRequestResponse struct {
Hash string `json:"hash"`
}
SendDataQueryRequestResponse is a data query hash response.
type SendFileMerkleTreeNodesToVerifierArgs ¶
type SendFileMerkleTreeNodesToVerifierArgs struct { ContractHash string `json:"contract_hash"` FileHash string `json:"file_hash"` }
SendFileMerkleTreeNodesToVerifierArgs represents args.
type SendFileMerkleTreeNodesToVerifierResponse ¶
type SendFileMerkleTreeNodesToVerifierResponse struct {
Success bool `json:"success"`
}
SendFileMerkleTreeNodesToVerifierResponse represents a struct.
type SendRawTransactionArgs ¶
type SendRawTransactionArgs struct {
RawTransaction string `json:"raw_transaction"`
}
SendRawTransactionArgs is a raw transaction sent by clients.
type SendTransactionArgs ¶
type SendTransactionArgs struct { AccessToken string `json:"access_token"` Nounce string `json:"nounce"` Data string `json:"data"` From string `json:"from"` To string `json:"to"` Value string `json:"value"` TransactionFees string `json:"transaction_fees"` }
SendTransactionArgs represents the arguments for sending a transaction using the client keystore mechanism.
type StatsResponse ¶
type StatsResponse struct { Syncing bool `json:"syncing"` BlockchainHeight uint64 `json:"blockchain_height"` HeighestBlockNumberDiscovered uint64 `json:"heighest_block_number_discovered"` PeerCount int `json:"peer_count"` PeerID string `json:"peer_id"` StorageEnabled bool `json:"storage_enabled"` Verifiers []verifier `json:"verifiers"` }
StatsResponse represents a syncing status
type StorageAPI ¶ added in v1.1.16
type StorageAPI struct {
// contains filtered or unexported fields
}
StorageAPI represents the storage rpc service.
func NewStorageAPI ¶ added in v1.1.16
func NewStorageAPI(host host.Host, publisher NetworkMessagePublisher, storageProtocol storageprotocol.Interface) (*StorageAPI, error)
NewStorageAPI creates a new storage API to be served using JSONRPC.
func (*StorageAPI) FileUploadProgress ¶ added in v1.1.16
func (api *StorageAPI) FileUploadProgress(r *http.Request, args *FileUploadProgressArgs, response *FileUploadProgressResponse) error
FileUploadProgress show the file upload progress and errors
func (*StorageAPI) FindProviders ¶ added in v1.1.16
func (api *StorageAPI) FindProviders(r *http.Request, args *FindProvidersArgs, response *FindProvidersResponse) error
FindProviders reports the stats of the node.
func (*StorageAPI) GetDiscoveredProviders ¶ added in v1.1.16
func (api *StorageAPI) GetDiscoveredProviders(r *http.Request, args *EmptyArgs, response *GetDiscoveredProvidersResponse) error
GetDiscoveredProviders returns a list of discovered storage providers.
func (*StorageAPI) TestSpeedWithRemotePeer ¶ added in v1.1.16
func (api *StorageAPI) TestSpeedWithRemotePeer(r *http.Request, args *TestSpeedWithRemotePeerArgs, response *TestSpeedWithRemotePeerResponse) error
TestSpeedWithRemotePeer tests the remote peer speed.
func (*StorageAPI) UploadFileToProvider ¶ added in v1.1.16
func (api *StorageAPI) UploadFileToProvider(r *http.Request, args *UploadFileToProviderArgs, response *UploadFileToProviderResponse) error
UploadFileToProvider uploads a file to provider.
type TestSpeedWithRemotePeerArgs ¶ added in v1.1.16
type TestSpeedWithRemotePeerArgs struct { PeerID string `json:"peer_id"` FileSize uint64 `json:"file_size"` }
TestSpeedWithRemotePeerArgs args for testing speed.
type TestSpeedWithRemotePeerResponse ¶ added in v1.1.16
type TestSpeedWithRemotePeerResponse struct {
DownloadThroughputMB float64 `json:"download_throughput_mb"`
}
TestSpeedWithRemotePeerResponse the response of the speed test.
type TransactionAPI ¶
type TransactionAPI struct {
// contains filtered or unexported fields
}
TransactionAPI represents the transaction rpc service.
func NewTransactionAPI ¶
func NewTransactionAPI(keystore keystore.KeyAuthorizer, publisher NetworkMessagePublisher, blockchain Blockchain, superLightNode bool) (*TransactionAPI, error)
NewTransactionAPI creates a new transaction API to be served using JSONRPC.
func (*TransactionAPI) ByAddress ¶
func (api *TransactionAPI) ByAddress(r *http.Request, args *ByAddressArgs, response *TransactionsResponse) error
ByAddress gets the list of transactions by address.
func (*TransactionAPI) Pool ¶
func (api *TransactionAPI) Pool(r *http.Request, args *EmptyArgs, response *MemPoolResponse) error
Pool gets the list of transactions in mempool.
func (*TransactionAPI) Receipt ¶
func (api *TransactionAPI) Receipt(r *http.Request, args *ReceiptArgs, response *TransactionsResponse) error
Receipt gets the transaction receipt.
func (*TransactionAPI) SendRawTransaction ¶
func (api *TransactionAPI) SendRawTransaction(r *http.Request, args *SendRawTransactionArgs, response *TransactionResponse) error
SendRawTransaction sends a raw transaction.
func (*TransactionAPI) SendTransaction ¶
func (api *TransactionAPI) SendTransaction(r *http.Request, args *SendTransactionArgs, response *TransactionResponse) error
SendTransaction sends a transaction.
type TransactionResponse ¶
type TransactionResponse struct {
Transaction JSONTransaction `json:"transaction"`
}
TransactionResponse represents a response with a transaction.
type TransactionsResponse ¶
type TransactionsResponse struct {
Transactions []JSONBlockTransaction `json:"transactions"`
}
TransactionsResponse represents a response with block and transaction
type UnlockAddressArgs ¶
type UnlockAddressArgs struct { Address string `json:"address"` Passphrase string `json:"passphrase"` }
UnlockAddressArgs arguments required for unlocking a key.
type UnlockAddressResponse ¶
type UnlockAddressResponse struct {
Token string `json:"token"`
}
UnlockAddressResponse is a key unlock response.
type UploadFileToProviderArgs ¶ added in v1.1.16
type UploadFileToProviderArgs struct { PeerID string `json:"peer_id"` FilePath string `json:"file_path"` ChannelNodeItemHash string `json:"channel_node_item_hash"` }
UploadFileToProviderArgs args for uploading to a provider.
type UploadFileToProviderResponse ¶ added in v1.1.16
type UploadFileToProviderResponse struct {
Success bool `json:"success"`
}
UploadFileToProviderResponse is the response of the uploaded file to provider.