rpc

package
v1.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (

	// reward
	CreateRawWithDrawTransaction = "withdrawreward"
)

rpc cmd method

Variables

This section is empty.

Functions

This section is empty.

Types

type ConvertedPrice

type ConvertedPrice struct {
	FromTokenIDStr string
	ToTokenIDStr   string
	Amount         uint64
	Price          uint64
}

ConvertedPrice represents a price conversion between two tokenIDs.

type EstimateFeeResult

type EstimateFeeResult struct {
	EstimateFeeCoinPerKb uint64
	EstimateTxSizeInKb   uint64
}

EstimateFeeResult represents an estimated fee result returned by the remote server.

type ListCustomToken

type ListCustomToken struct {
	ID     int `json:"Id"`
	Result struct {
		ListCustomToken []struct {
			ID                 string        `json:"ID"`
			Name               string        `json:"Name"`
			Symbol             string        `json:"Symbol"`
			Image              string        `json:"Image"`
			Amount             float64       `json:"Amount"`
			IsPrivacy          bool          `json:"IsPrivacy"`
			IsBridgeToken      bool          `json:"IsBridgeToken"`
			ListTxs            []interface{} `json:"ListTxs"`
			CountTxs           int           `json:"CountTxs"`
			InitiatorPublicKey string        `json:"InitiatorPublicKey"`
			TxInfo             string        `json:"TxInfo"`
		} `json:"ListCustomToken"`
	} `json:"Result"`
	Error   interface{}   `json:"Error"`
	Params  []interface{} `json:"Params"`
	Method  string        `json:"Method"`
	Jsonrpc string        `json:"JsonRPC"`
}

ListCustomToken represents the custom-token listing result returned by the remote server.

type OutCoinKey

type OutCoinKey struct {
	// contains filtered or unexported fields
}

OutCoinKey is used to retrieve output coins via RPC.

The payment addresses is required in all cases. For retrieving output coins V2, the ota key is required. Readonly keys are optional.

func NewOutCoinKey

func NewOutCoinKey(paymentAddress, otaKey, readonlyKey string) *OutCoinKey

NewOutCoinKey create a new OutCoinKey with the given parameters.

func (OutCoinKey) OtaKey

func (outCoinKey OutCoinKey) OtaKey() string

OtaKey returns the ota key of an OutCoinKey.

func (OutCoinKey) PaymentAddress

func (outCoinKey OutCoinKey) PaymentAddress() string

PaymentAddress returns the payment address of an OutCoinKey.

func (OutCoinKey) ReadonlyKey

func (outCoinKey OutCoinKey) ReadonlyKey() string

ReadonlyKey returns the read-only of an OutCoinKey.

func (*OutCoinKey) SetOTAKey

func (outCoinKey *OutCoinKey) SetOTAKey(v string)

SetOTAKey sets v as the ota key of an OutCoinKey.

func (*OutCoinKey) SetPaymentAddress

func (outCoinKey *OutCoinKey) SetPaymentAddress(v string)

SetPaymentAddress sets v as the payment address of an OutCoinKey.

func (*OutCoinKey) SetReadonlyKey

func (outCoinKey *OutCoinKey) SetReadonlyKey(v string)

SetReadonlyKey sets v as the read-only key of an OutCoinKey.

type RPCServer

type RPCServer struct {
	// contains filtered or unexported fields
}

RPCServer represents a RPC host server.

func NewRPCServer

func NewRPCServer(url string) *RPCServer

NewRPCServer creates a new RPCServer pointing to the given url.

func (*RPCServer) AuthorizedSubmitKey

func (server *RPCServer) AuthorizedSubmitKey(otaStr string, accessToken string, fromHeight uint64, isReset bool) ([]byte, error)

AuthorizedSubmitKey submits an OTA Key in an authorized manner for more privileges.

func (*RPCServer) CheckShieldStatus

func (server *RPCServer) CheckShieldStatus(txHash string) ([]byte, error)

CheckShieldStatus checks the status of a decentralized shielding transaction.

func (*RPCServer) CheckTradeStatus

func (server *RPCServer) CheckTradeStatus(txHash string) ([]byte, error)

CheckTradeStatus retrieves the status of a trading transaction.

func (*RPCServer) ConvertPDEPrice

func (server *RPCServer) ConvertPDEPrice(tokenToSell, tokenToBuy string, amount uint64) ([]byte, error)

ConvertPDEPrice gets the pDEX to check the price between to tokens.

func (*RPCServer) ConvertPaymentAddress

func (server *RPCServer) ConvertPaymentAddress(addr string) ([]byte, error)

ConvertPaymentAddress calls the full-node to convert a payment address into the oldest version.

func (*RPCServer) CreateAndSendTokenInitTransaction

func (server *RPCServer) CreateAndSendTokenInitTransaction(privateKey string,
	tokenName,
	tokenSymbol string,
	initAmount uint64) ([]byte, error)

CreateAndSendTokenInitTransaction has the server create and broadcast a transaction that initializes a new token on the network.

NOTE: PrivateKey must be supplied and sent to the server.

func (*RPCServer) EstimateFeeWithEstimator

func (server *RPCServer) EstimateFeeWithEstimator(defaultFee int, shardID byte, numBlock int, tokenID string) ([]byte, error)

EstimateFeeWithEstimator retrieves an estimate fee for a tokenID.

func (*RPCServer) GenerateShieldingMultiSigAddress

func (server *RPCServer) GenerateShieldingMultiSigAddress(paymentAddress, tokenID string) ([]byte, error)

GenerateShieldingMultiSigAddress calls the remote node to generate the depositing address for a payment address w.r.t to a tokenID.

func (*RPCServer) GetActiveShards

func (server *RPCServer) GetActiveShards() ([]byte, error)

GetActiveShards retrieves the active shards of the network.

func (*RPCServer) GetAllBridgeTokens

func (server *RPCServer) GetAllBridgeTokens() ([]byte, error)

GetAllBridgeTokens retrieves the list of bridge tokens in the network.

func (*RPCServer) GetBalanceByPrivateKey

func (server *RPCServer) GetBalanceByPrivateKey(privateKey string) ([]byte, error)

GetBalanceByPrivateKey retrieves the PRV balance of a private key.

NOTE: PrivateKey must be supplied and sent to the server.

func (*RPCServer) GetBeaconBestState

func (server *RPCServer) GetBeaconBestState() ([]byte, error)

GetBeaconBestState returns the best state of the beacon chain.

func (*RPCServer) GetBestBlock

func (server *RPCServer) GetBestBlock() ([]byte, error)

GetBestBlock returns the best block numbers (for beacon and shard chains).

func (*RPCServer) GetBestBlockHash

func (server *RPCServer) GetBestBlockHash() ([]byte, error)

GetBestBlockHash returns the current best block hashes.

func (*RPCServer) GetBlockchainInfo

func (server *RPCServer) GetBlockchainInfo() ([]byte, error)

GetBlockchainInfo returns the current state of the Incognito network.

func (*RPCServer) GetBurnPRVPeggingProof

func (server *RPCServer) GetBurnPRVPeggingProof(txHash string, isBSC ...bool) ([]byte, error)

GetBurnPRVPeggingProof retrieves the burning prv pegging proof of a transaction.

func (*RPCServer) GetBurnProof

func (server *RPCServer) GetBurnProof(txHash string, isBSC ...bool) ([]byte, error)

GetBurnProof retrieves the burning proof of a transaction.

func (*RPCServer) GetBurnProofForSC

func (server *RPCServer) GetBurnProofForSC(txHash string) ([]byte, error)

GetBurnProofForSC retrieves the burning proof of a transaction for depositing to smart contracts.

func (*RPCServer) GetCommitteeState

func (server *RPCServer) GetCommitteeState(beaconHeight uint64, beaconRootHash string) ([]byte, error)

GetCommitteeState retrieves the committee state at the given beacon height and beacon root hash. This RPC is mainly used for debugging purposes.

func (*RPCServer) GetCommitteeStateByShardID

func (server *RPCServer) GetCommitteeStateByShardID(shardID int, shardRootHash string) ([]byte, error)

GetCommitteeStateByShardID retrieves the committee state of a shard given a root hash. This RPC is mainly used for debugging purposes.

func (*RPCServer) GetEncodedTransactionsByHashes

func (server *RPCServer) GetEncodedTransactionsByHashes(txHashList []string) ([]byte, error)

GetEncodedTransactionsByHashes retrieves base58-encoded transactions given their hashes.

func (*RPCServer) GetKeySubmissionInfo

func (server *RPCServer) GetKeySubmissionInfo(otaStr string) ([]byte, error)

GetKeySubmissionInfo returns the information of an OTAKey if it has been submitted.

func (*RPCServer) GetListOutputCoinsByRPCV1

func (server *RPCServer) GetListOutputCoinsByRPCV1(outCoinKey *OutCoinKey, tokenID string, h uint64) ([]byte, error)

GetListOutputCoinsByRPCV1 retrieves list of output coins of an OutCoinKey and returns the result in raw json bytes.

func (*RPCServer) GetListOutputCoinsByRPCV2

func (server *RPCServer) GetListOutputCoinsByRPCV2(outCoinKey *OutCoinKey, tokenID string, _ uint64) ([]byte, error)

GetListOutputCoinsByRPCV2 retrieves list of output coins of an OutCoinKey and returns the result in raw json bytes.

func (*RPCServer) GetListRewardAmount

func (server *RPCServer) GetListRewardAmount() ([]byte, error)

GetListRewardAmount returns the current reward amounts on the network.

func (*RPCServer) GetMiningInfo

func (server *RPCServer) GetMiningInfo() ([]byte, error)

GetMiningInfo retrieves the mining status of a remote (validator) node.

This RPC should call to the (staked) node, instead of a full-node.

func (*RPCServer) GetOTACoinLength

func (server *RPCServer) GetOTACoinLength() ([]byte, error)

GetOTACoinLength returns the number of OTA coins for each shard.

func (*RPCServer) GetOTACoinsByIndices

func (server *RPCServer) GetOTACoinsByIndices(shardID byte, tokenID string, idxList []uint64) ([]byte, error)

GetOTACoinsByIndices returns the list of output coins given the indices.

func (*RPCServer) GetPDEState

func (server *RPCServer) GetPDEState(beaconHeight uint64) ([]byte, error)

GetPDEState retrieves the pDEX state at the given beacon height.

func (*RPCServer) GetPortalShieldingRequestStatus

func (server *RPCServer) GetPortalShieldingRequestStatus(shieldID string) ([]byte, error)

GetPortalShieldingRequestStatus retrieves the status of a port shielding request.

func (*RPCServer) GetPortalUnShieldingRequestStatus

func (server *RPCServer) GetPortalUnShieldingRequestStatus(unShieldID string) ([]byte, error)

GetPortalUnShieldingRequestStatus retrieves the status of a portal un-shielding request.

func (*RPCServer) GetRawMemPool

func (server *RPCServer) GetRawMemPool() ([]byte, error)

GetRawMemPool returns a list of transactions currently in the pool.

func (*RPCServer) GetRewardAmount

func (server *RPCServer) GetRewardAmount(paymentAddress string) ([]byte, error)

GetRewardAmount gets the reward amounts of a user.

func (*RPCServer) GetShardBestState

func (server *RPCServer) GetShardBestState(shardID byte) ([]byte, error)

GetShardBestState returns the best state of a shard chain.

func (*RPCServer) GetSyncStats

func (server *RPCServer) GetSyncStats() ([]byte, error)

GetSyncStats retrieves the sync statistics of a remote (validator) node.

This RPC should call to the (staked) node, instead of a full-node.

func (*RPCServer) GetTokenByRPC

func (server *RPCServer) GetTokenByRPC(tokenID string) ([]byte, error)

GetTokenByRPC retrieves all the token's information on the blockchain.

func (*RPCServer) GetTransactionByHash

func (server *RPCServer) GetTransactionByHash(txHash string) ([]byte, error)

GetTransactionByHash retrieves the transaction detail given its hash.

func (*RPCServer) GetTxHashByPublicKey

func (server *RPCServer) GetTxHashByPublicKey(publicKeys []string) ([]byte, error)

GetTxHashByPublicKey returns the list of transactions sent to a public key.

func (*RPCServer) GetTxHashByReceiver

func (server *RPCServer) GetTxHashByReceiver(paymentAddress string) ([]byte, error)

GetTxHashByReceiver returns the list of transactions V1 sent to a payment address.

func (*RPCServer) GetTxHashBySerialNumber

func (server *RPCServer) GetTxHashBySerialNumber(snList []string, tokenID string, shardID byte) ([]byte, error)

GetTxHashBySerialNumber returns the list of transactions which have spent the given serial numbers.

func (*RPCServer) GetURL

func (server *RPCServer) GetURL() string

GetURL returns the url of a RPCServer.

func (*RPCServer) HasSerialNumberByRPC

func (server *RPCServer) HasSerialNumberByRPC(shardID byte, tokenID string, snList []string) ([]byte, error)

HasSerialNumberByRPC checks if the provided serial numbers have been spent or not.

Returned result in raw json bytes.

func (*RPCServer) HasSerialNumberInMemPool

func (server *RPCServer) HasSerialNumberInMemPool(snList []string) ([]byte, error)

HasSerialNumberInMemPool checks if the provided serial numbers are currently in the pool or not.

Returned result in raw json bytes.

func (*RPCServer) InitToURL

func (server *RPCServer) InitToURL(url string) *RPCServer

InitToURL points a RPCServer to a given url.

func (*RPCServer) ListBridgeTokenByRPC

func (server *RPCServer) ListBridgeTokenByRPC() ([]byte, error)

ListBridgeTokenByRPC lists all bridge-tokens currently present on the blockchain.

func (*RPCServer) ListPrivacyCustomTokenByRPC

func (server *RPCServer) ListPrivacyCustomTokenByRPC() ([]byte, error)

ListPrivacyCustomTokenByRPC lists all tokens currently present on the blockchain.

func (*RPCServer) ListUnspentOutputCoinsByRPC

func (server *RPCServer) ListUnspentOutputCoinsByRPC(privateKey string) ([]byte, error)

ListUnspentOutputCoinsByRPC retrieves list of output coins of an OutCoinKey and returns the result in raw json bytes.

NOTE: PrivateKey must be supplied and sent to the server.

func (*RPCServer) RandomCommitments

func (server *RPCServer) RandomCommitments(shardID byte, inputCoins []jsonresult.OutCoin, tokenID string) ([]byte, error)

RandomCommitments gets a list of random commitments to create transactions of version 1.

func (*RPCServer) RandomCommitmentsAndPublicKeys

func (server *RPCServer) RandomCommitmentsAndPublicKeys(shardID byte, tokenID string, lenDecoy int) ([]byte, error)

RandomCommitmentsAndPublicKeys gets a list of random commitments to create transactions of version 2.

func (*RPCServer) RetrieveBlock

func (server *RPCServer) RetrieveBlock(blockHash string, verbosity string) ([]byte, error)

RetrieveBlock returns the detail of a block given its hash.

func (*RPCServer) SendPostRequestWithQuery

func (server *RPCServer) SendPostRequestWithQuery(query string) ([]byte, error)

SendPostRequestWithQuery sends a query to the remote server using the POST method.

func (*RPCServer) SendQuery

func (server *RPCServer) SendQuery(method string, params []interface{}) ([]byte, error)

SendQuery sends a query to the remote server given the method and parameters.

func (*RPCServer) SendRawTokenTx

func (server *RPCServer) SendRawTokenTx(encodedTx string) ([]byte, error)

SendRawTokenTx broadcasts a base58-encoded token transaction to the network.

func (*RPCServer) SendRawTx

func (server *RPCServer) SendRawTx(encodedTx string) ([]byte, error)

SendRawTx broadcasts a base58-encoded PRV transaction to the network.

func (*RPCServer) SubmitKey

func (server *RPCServer) SubmitKey(otaStr string) ([]byte, error)

SubmitKey submits an OTA key to use the full-node's cache.

type TokenInitParam

type TokenInitParam struct {
	PrivateKey  string `json:"PrivateKey"`
	TokenName   string `json:"TokenName"`
	TokenSymbol string `json:"TokenSymbol"`
	Amount      uint64 `json:"Amount"`
}

TokenInitParam represents the parameters needed for the RPC createAndSendTokenInitTransaction.

Jump to

Keyboard shortcuts

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