rpc

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const AddressServiceNamespace = "address"

AddressServiceNamespace is the namespace for address service rpc.

View Source
const BlockServiceNamespace = "block"

BlockServiceNamespace is the namespace for block service rpc.

View Source
const ChannelServiceNamespace = "channel"

ChannelServiceNamespace is the namespace for channel service rpc.

View Source
const DataTransferServiceNamespace = "data_transfer"

DataTransferServiceNamespace is the namespace for data transfer service rpc.

View Source
const FilefilegoServiceNamespace = "filefilego"

FilefilegoServiceNamespace is the namespace for filefilego service rpc.

View Source
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) 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 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) GetByHash

func (api *BlockAPI) GetByHash(r *http.Request, args *GetByHashArgs, response *JSONBlock) error

GetByHash gets a block by hash.

func (*BlockAPI) GetByNumber

func (api *BlockAPI) GetByNumber(r *http.Request, args *GetByNumberArgs, response *JSONBlock) error

GetByNumber gets a block by number.

func (*BlockAPI) Pool

func (api *BlockAPI) Pool(r *http.Request, args *EmptyArgs, response *PoolResponse) error

Pool gets the block pool hashes.

type Blockchain

type Blockchain interface {
	PutMemPool(tx transaction.Transaction) error
	GetTransactionsFromPool() []transaction.Transaction
	GetAddressTransactions(address []byte, currentPage, limit int) ([]transaction.Transaction, []uint64, 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"`
	Limit       int    `json:"limit"`
}

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"`
	UnavailableFileHashes []string `json:"unavailable_file_hashes"`
	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) 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 EmptyArgs

type EmptyArgs struct{}

EmptyArgs

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 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 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 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"`
	Transaction JSONTransaction `json:"transaction"`
}

JSONBlockTransaction represnts the block number and a transaction.

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 ListArgs

type ListArgs struct {
	Limit  int `json:"limit"`
	Offset int `json:"offset"`
}

ListArgs is a list args

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

type LockAddressArgs struct {
	Address string `json:"address"`
	Token   string `json:"token"`
}

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, 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 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"`
	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 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.

Jump to

Keyboard shortcuts

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