rpcservice

package
v0.0.0-...-7ece11e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 46 Imported by: 1

Documentation

Index

Constants

View Source
const (
	WaitingContributions = "WaitingContributions"
	PoolPairs            = "PoolPairs"
	PoolPair             = "PoolPair"
	PoolPairShares       = "PoolPairShares"
	PoolPairOrders       = "PoolPairOrders"
	PoolPairOrderRewards = "PoolPairOrderRewards"
	Params               = "Params"
	StakingPools         = "StakingPools"
	StakingPool          = "StakingPool"
	NftIDs               = "NftIDs"
	NftIDsCached         = "NftIDsCached"
	All                  = "All"
	SimpleVerbosity      = 1
	IntermidateVerbosity = 2
	FullVerbosity        = 3
	LiquidityVerbosity   = 4
)
View Source
const (
	UnexpectedError = iota
	AlreadyStartedError
	JsonError

	RPCInvalidRequestError
	RPCMethodNotFoundError
	RPCInvalidParamsError
	RPCInvalidMethodPermissionError
	RPCInternalError
	RPCParseError

	InvalidTypeError
	AuthFailError
	InvalidSenderPrivateKeyError
	InvalidSenderViewingKeyError
	InvalidReceiverPaymentAddressError
	ListTokenNotFoundError
	CanNotSignError
	GetOutputCoinError
	GetOutputCoinsVer1Error
	GetOutputCoinsVer2Error
	CreateTxDataError
	SendTxDataError
	Base58ChedkDataOfTxInvalid
	JsonDataOfTxInvalid
	TxTypeInvalidError
	TxNotExistedInMemAndBLockError
	UnsubcribeError
	SubcribeError
	NetworkError
	TokenIsInvalidError
	GetClonedBeaconBestStateError
	GetBeaconViewByBlockHashError
	GetBeaconBestBlockHashError
	GetBeaconBestBlockError
	GetClonedShardBestStateError
	GetShardBlockByHeightError
	GetShardBestBlockError
	GetLatestFinalizedShardBlockError
	GetShardBlockByHashError
	GetBeaconBlockByHashError
	GetBeaconBlockByHeightError
	GeTxFromPoolError
	NoSwapConfirmInst
	GetKeySetFromPrivateKeyError
	GetPDEStateError
	ListCommitteeRewardError
	GetDelegationRewardAmountError
	GetRewardAmountError
	ListDecryptedOutputCoinsByKeyError
	ListUnspentOutputCoinsByKeyError
	SendRawTransactionError
	BuildTokenParamError
	BuildPrivacyTokenParamError
	GetListPrivacyCustomTokenBalanceError
	GetPrivacyTokenError
	// reject tx
	RejectInvalidTxFeeTooLargeError
	RejectInvalidTxFeeError
	RejectInvalidTxSizeError
	RejectInvalidTxTypeError
	RejectInvalidTxError
	RejectDoubleSpendTxError
	RejectDuplicateTxInPoolError
	RejectInvalidTxVersionError
	RejectSanityTxLocktime
	RejectReplacementTx
	TxPoolRejectTxError
	RejectInvalidFeeError

	//portal
	GetFinalExchangeRatesError
	ConvertExchangeRatesError
	GetPortingRequestFeesError
	GetExchangeRatesIsEmpty
	GetPortingRequestError
	GetPortingRequestIsEmpty

	GetCustodianWithdrawError
	GetReqPTokenStatusError
	GetCustodianDepositError
	GetPortalStateError
	GetReqUnlockCollateralStatusError
	GetReqRedeemStatusError
	GetRequestWithdrawRewardStatusError
	GetPortalRewardError
	GetReqMatchingRedeemStatusError
	GetReqRedeemFromLiquidationPoolStatusError

	GetCustodianLiquidationStatusError
	GetTpExchangeRatesLiquidationError
	GetTpExchangeRatesLiquidationByTokenIdError
	GetExchangeRatesLiquidationPoolError

	GetAmountNeededForCustodianDepositLiquidationError
	GetCustodianTopupStatusError
	GetCustodianTopupWaitingPortingStatusError
	GetAmountTopUpWaitingPortingError
	GetCustodianDepositV3Error

	// relaying
	GetRelayingBNBHeaderByBlockHeightError
	GetBTCRelayingBestState
	GetBTCBlockByHash
	GetRelayingBNBHeaderError
	GetLatestBNBHeaderBlockHeightError

	// feature reward
	GetRewardFeatureByFeatureNameError

	// Init State Root hash
	InitStateRootHash

	GetAllBeaconViews

	// Restore
	RestoreBeaconCommittee
	RestoreShardCommittee
	RestoreBeaconPendingValidator
	RestoreShardPendingValidator
	RestoreCandidateBeaconWaitingForCurrentRandom
	RestoreCandidateBeaconWaitingForNextRandom
	RestoreCandidateShardWaitingForCurrentRandom
	RestoreCandidateShardWaitingForNextRandom

	GetTotalStakerError

	// Portal v4
	GetPortalV4StateError
	GetPortalV4ParamsError
	GetPortalV4ShieldReqStatusError
	GetPortalV4UnshieldReqStatusError
	GetPortalV4BatchUnshieldReqStatusError
	GetPortalV4FeeReplacementReqStatusError
	GetPortalV4SubmitConfirmedTxStatusError
	GetPortalV4ConvertVaultTxStatusError

	CacheQueueError

	// pdex v3
	GetPdexv3StateError
	GenerateOTAFailError
	GetPdexv3ParamsModyfingStatusError
	GetPdexv3LPFeeError
	GetPdexv3StakingRewardError
	GetPdexv3WithdrawalLPFeeStatusError
	GetPdexv3WithdrawalProtocolFeeStatusError
	GetPdexv3WithdrawalStakingRewardStatusError

	// bridgeagg
	GetBridgeAggStateError
	BridgeAggEstimateFeeByBurntAmountError
	BridgeAggEstimateFeeByExpectedAmountError
	BridgeAggEstimateRewardError

	// prune
	PruneError
)

Variables

View Source
var BLogger = DeBridgeLogger{}
View Source
var ErrCodeMessage = map[int]struct {
	Code    int
	Message string

}{}/* 114 elements not displayed */

Standard JSON-RPC 2.0 errors.

View Source
var Logger = RpcLogger{}

Global instant to use

Functions

func CreateCustomTokenPrivacyBurningReceiverArray

func CreateCustomTokenPrivacyBurningReceiverArray(dataReceiver interface{}, bcr metadata.ChainRetriever, beaconHeight uint64) ([]*privacy.PaymentInfo, int64, error)

func CreateCustomTokenPrivacyReceiverArray

func CreateCustomTokenPrivacyReceiverArray(dataReceiver interface{}) ([]*privacy.PaymentInfo, int64, error)

func CreateCustomTokenPrivacyReceiverArrayV2

func CreateCustomTokenPrivacyReceiverArrayV2(dataReceiver interface{}) ([]*privacy.PaymentInfo, int64, error)

CreateCustomTokenPrivacyReceiverArrayV2 parses data frm rpc request to create a list vout for preparing to create a custom token tx data interface is a map[paymentt-address]{transferring-amount}

func GenerateTokenID

func GenerateTokenID(network string, name string) (common.Hash, error)

func GetETHHeaderByHash

func GetETHHeaderByHash(ethBlockHash string) (*types.Header, error)

func GetErrorCode

func GetErrorCode(err int) int

func GetInputSerialnumber

func GetInputSerialnumber(inputCoins []privacy.PlainCoin) ([]string, error)

func GetKeySetFromPaymentAddressParam

func GetKeySetFromPaymentAddressParam(paymentAddressStr string) (*incognitokey.KeySet, byte, error)

GetKeySetFromPaymentAddressParam - deserialize a key string(wallet serialized) into keyWallet - this keywallet may contain

func GetKeySetFromPrivateKey

func GetKeySetFromPrivateKey(privateKey privacy.PrivateKey) (*incognitokey.KeySet, byte, error)

GetKeySetFromPrivateKeyParams - deserialize a private key string into keyWallet object and fill all keyset in keywallet with private key return key set and shard ID

func GetKeySetFromPrivateKeyParams

func GetKeySetFromPrivateKeyParams(privateKeyWalletStr string) (*incognitokey.KeySet, byte, error)

GetKeySetFromPrivateKeyParams - deserialize a private key string into keyWallet object and fill all keyset in keywallet with private key return key set and shard ID

func GetStakingAmount

func GetStakingAmount(stakingType int, stakingShardAmountParam uint64) uint64

func HashToIdenticon

func HashToIdenticon(hashStrs []interface{}) ([]string, error)

func NewPaymentInfosFromReceiversParam

func NewPaymentInfosFromReceiversParam(receiversParam map[string]interface{}) ([]*privacy.PaymentInfo, error)

Types

type BlockService

type BlockService struct {
	BlockChain *blockchain.BlockChain
	DB         map[int]incdb.Database
	TxMemPool  *mempool.TxPool
	MemCache   *memcache.MemoryCache
}

func (BlockService) BridgeAggEstimateFeeByBurntAmount

func (blockService BlockService) BridgeAggEstimateFeeByBurntAmount(unifiedTokenID, tokenID common.Hash, burntAmount uint64) (interface{}, error)

func (BlockService) BridgeAggEstimateFeeByExpectedAmount

func (blockService BlockService) BridgeAggEstimateFeeByExpectedAmount(unifiedTokenID, tokenID common.Hash, amount uint64) (interface{}, error)

func (BlockService) BridgeAggEstimateReward

func (blockService BlockService) BridgeAggEstimateReward(unifiedTokenID, tokenID common.Hash, amount uint64) (interface{}, error)

func (BlockService) CanPubkeyStake

func (blockService BlockService) CanPubkeyStake(publicKey string) (bool, error)

func (BlockService) CheckBSCHashIssued

func (blockService BlockService) CheckBSCHashIssued(data map[string]interface{}) (bool, error)

func (BlockService) CheckETHHashIssued

func (blockService BlockService) CheckETHHashIssued(data map[string]interface{}) (bool, error)

func (BlockService) CheckHashValue

func (blockService BlockService) CheckHashValue(hashStr string) (isTransaction bool, isShardBlock bool, isBeaconBlock bool, err error)

func (BlockService) CheckPRVPeggingHashIssued

func (blockService BlockService) CheckPRVPeggingHashIssued(data map[string]interface{}) (bool, error)

func (BlockService) CheckPortalExternalTxSubmitted

func (blockService BlockService) CheckPortalExternalTxSubmitted(data map[string]interface{}) (bool, error)

============================= Portal v3 ===============================

func (BlockService) GetActiveShards

func (blockService BlockService) GetActiveShards() int

func (BlockService) GetAllBridgeTokens

func (blockService BlockService) GetAllBridgeTokens() ([]*rawdbv2.BridgeTokenInfo, error)

func (BlockService) GetAllBridgeTokensByHeight

func (blockService BlockService) GetAllBridgeTokensByHeight(height uint64) ([]*rawdbv2.BridgeTokenInfo, error)

func (BlockService) GetAllCoinIDWithPRV

func (blockService BlockService) GetAllCoinIDWithPRV(shardID byte) ([]common.Hash, error)

func (BlockService) GetAmountTopUpWaitingPorting

func (blockService BlockService) GetAmountTopUpWaitingPorting(custodianAddr string, collateralTokenID string, beaconHeight uint64, stateDB *statedb.StateDB) (map[string]uint64, error)

func (BlockService) GetBeaconBestBlockHash

func (blockService BlockService) GetBeaconBestBlockHash() (*common.Hash, error)

func (BlockService) GetBeaconBestState

func (blockService BlockService) GetBeaconBestState() (*blockchain.BeaconBestState, error)

func (BlockService) GetBlockHashByHeightV2

func (blockService BlockService) GetBlockHashByHeightV2(shardID int, height uint64) ([]common.Hash, error)

func (BlockService) GetBlocks

func (blockService BlockService) GetBlocks(shardIDParam int, numBlock int) (interface{}, *RPCError)

func (BlockService) GetBlocksFromHeight

func (blockService BlockService) GetBlocksFromHeight(chainID int, fromHeight int, numBlocks int) (interface{}, *RPCError)

func (BlockService) GetBridgeAggState

func (blockService BlockService) GetBridgeAggState(
	beaconHeight uint64,
) (interface{}, error)

func (BlockService) GetBridgeReqWithStatus

func (blockService BlockService) GetBridgeReqWithStatus(txID string) (byte, error)

============================= Bridge ===============================

func (BlockService) GetBurningAddress

func (blockService BlockService) GetBurningAddress(beaconHeight uint64) string

func (BlockService) GetBurningConfirm

func (blockService BlockService) GetBurningConfirm(txID common.Hash) (uint64, bool, error)

func (BlockService) GetCustodianDepositStatus

func (blockService BlockService) GetCustodianDepositStatus(depositTxID string) (*metadata.PortalCustodianDepositStatus, error)

============================= Portal ===============================

func (BlockService) GetCustodianDepositStatusV3

func (blockService BlockService) GetCustodianDepositStatusV3(depositTxID string) (*metadata.PortalCustodianDepositStatusV3, error)

func (BlockService) GetCustodianTopupStatus

func (blockService BlockService) GetCustodianTopupStatus(txID string) (*metadata.LiquidationCustodianDepositStatusV2, error)

func (BlockService) GetCustodianTopupStatusV3

func (blockService BlockService) GetCustodianTopupStatusV3(txID string) (*metadata.LiquidationCustodianDepositStatusV3, error)

func (BlockService) GetCustodianTopupWaitingPortingStatus

func (blockService BlockService) GetCustodianTopupWaitingPortingStatus(txID string) (*metadata.PortalTopUpWaitingPortingRequestStatus, error)

func (BlockService) GetCustodianTopupWaitingPortingStatusV3

func (blockService BlockService) GetCustodianTopupWaitingPortingStatusV3(txID string) (*metadata.PortalTopUpWaitingPortingRequestStatusV3, error)

func (BlockService) GetMinerRewardFromMiningKey

func (blockService BlockService) GetMinerRewardFromMiningKey(incPublicKey []byte) (map[string]uint64, error)

func (BlockService) GetPDEContributionStatus

func (blockService BlockService) GetPDEContributionStatus(pdePrefix []byte, pdeSuffix []byte) (*metadata.PDEContributionStatus, error)

func (BlockService) GetPDEStatus

func (blockService BlockService) GetPDEStatus(pdePrefix []byte, pdeSuffix []byte) (byte, error)

func (BlockService) GetPdexv3BlockLPReward

func (blockService BlockService) GetPdexv3BlockLPReward(
	pairID string, beaconHeight uint64, stateDB, prevStateDB *statedb.StateDB,
) (map[string]uint64, error)

func (BlockService) GetPdexv3BlockStakingReward

func (blockService BlockService) GetPdexv3BlockStakingReward(
	stakingPoolID string, beaconHeight uint64, stateDB, prevStateDB *statedb.StateDB,
) (map[string]uint64, error)

func (BlockService) GetPdexv3ParamsModifyingRequestStatus

func (blockService BlockService) GetPdexv3ParamsModifyingRequestStatus(reqTxID string) (*metadataPdexv3.ParamsModifyingRequestStatus, error)

func (BlockService) GetPdexv3State

func (blockService BlockService) GetPdexv3State(
	filterParam map[string]interface{},
	beaconHeight uint64,
) (interface{}, error)

func (BlockService) GetPdexv3WithdrawalLPFeeStatus

func (blockService BlockService) GetPdexv3WithdrawalLPFeeStatus(reqTxID string) (*metadataPdexv3.WithdrawalLPFeeStatus, error)

func (BlockService) GetPdexv3WithdrawalProtocolFeeStatus

func (blockService BlockService) GetPdexv3WithdrawalProtocolFeeStatus(reqTxID string) (*metadataPdexv3.WithdrawalProtocolFeeStatus, error)

func (BlockService) GetPdexv3WithdrawalStakingRewardStatus

func (blockService BlockService) GetPdexv3WithdrawalStakingRewardStatus(reqTxID string) (*metadataPdexv3.WithdrawalStakingRewardStatus, error)

func (BlockService) GetPortalBatchUnshieldingRequestStatus

func (blockService BlockService) GetPortalBatchUnshieldingRequestStatus(batchID string) (*metadata.PortalUnshieldRequestBatchStatus, error)

func (BlockService) GetPortalConvertVaultTxStatus

func (blockService BlockService) GetPortalConvertVaultTxStatus(reqTxID string) (*metadata.PortalConvertVaultRequestStatus, error)

func (BlockService) GetPortalLiquidationCustodianStatus

func (blockService BlockService) GetPortalLiquidationCustodianStatus(redeemID string, custodianIncAddress string) (*metadata.PortalLiquidateCustodianStatus, error)

func (BlockService) GetPortalRedeemReqByTxIDStatus

func (blockService BlockService) GetPortalRedeemReqByTxIDStatus(txID string) (*metadata.PortalRedeemRequestStatus, error)

func (BlockService) GetPortalRedeemReqStatus

func (blockService BlockService) GetPortalRedeemReqStatus(redeemID string) (*metadata.PortalRedeemRequestStatus, error)

func (BlockService) GetPortalReqPTokenStatus

func (blockService BlockService) GetPortalReqPTokenStatus(reqTxID string) (*metadata.PortalRequestPTokensStatus, error)

func (BlockService) GetPortalReqReplacementFeeStatus

func (blockService BlockService) GetPortalReqReplacementFeeStatus(reqTxID string) (*metadata.PortalReplacementFeeRequestStatus, error)

func (BlockService) GetPortalReqUnlockCollateralStatus

func (blockService BlockService) GetPortalReqUnlockCollateralStatus(reqTxID string) (*metadata.PortalRequestUnlockCollateralStatus, error)

func (BlockService) GetPortalReqUnlockOverRateCollateralStatus

func (blockService BlockService) GetPortalReqUnlockOverRateCollateralStatus(reqTxID string) (*metadata.UnlockOverRateCollateralsRequestStatus, error)

func (BlockService) GetPortalRequestWithdrawRewardStatus

func (blockService BlockService) GetPortalRequestWithdrawRewardStatus(reqTxID string) (*metadata.PortalRequestWithdrawRewardStatus, error)

func (BlockService) GetPortalShieldingRequestStatus

func (blockService BlockService) GetPortalShieldingRequestStatus(reqTxID string) (*metadata.PortalShieldingRequestStatus, error)

============================= Portal v4 ===============================

func (BlockService) GetPortalSubmitConfirmedTxStatus

func (blockService BlockService) GetPortalSubmitConfirmedTxStatus(reqTxID string) (*metadata.PortalSubmitConfirmedTxStatus, error)

func (BlockService) GetPortalUnshieldingRequestStatus

func (blockService BlockService) GetPortalUnshieldingRequestStatus(unshieldID string) (*metadata.PortalUnshieldRequestStatus, error)

func (BlockService) GetRedeemReqFromLiquidationPoolByTxIDStatus

func (blockService BlockService) GetRedeemReqFromLiquidationPoolByTxIDStatus(txID string) (*metadata.RedeemLiquidateExchangeRatesStatus, error)

func (BlockService) GetRedeemReqFromLiquidationPoolByTxIDStatusV3

func (blockService BlockService) GetRedeemReqFromLiquidationPoolByTxIDStatusV3(txID string) (*metadata.PortalRedeemFromLiquidationPoolStatusV3, error)

func (BlockService) GetReqMatchingRedeemByTxIDStatus

func (blockService BlockService) GetReqMatchingRedeemByTxIDStatus(reqTxID string) (*metadata.PortalReqMatchingRedeemStatus, error)

func (BlockService) GetRewardAmount

func (blockService BlockService) GetRewardAmount(paymentAddress string) (map[string]uint64, error)

func (BlockService) GetRewardAmountByPublicKey

func (blockService BlockService) GetRewardAmountByPublicKey(publicKey string) (map[string]uint64, error)

func (BlockService) GetRewardFeatureByFeatureName

func (blockService BlockService) GetRewardFeatureByFeatureName(featureName string, epoch uint64) (map[string]uint64, error)

============================= Reward Feature ===============================

func (BlockService) GetShardBestBlockHashes

func (blockService BlockService) GetShardBestBlockHashes() map[int]common.Hash

func (BlockService) GetShardBestStateByShardID

func (blockService BlockService) GetShardBestStateByShardID(shardID byte) (*blockchain.ShardBestState, error)

func (BlockService) GetShardBestStates

func (blockService BlockService) GetShardBestStates() map[byte]*blockchain.ShardBestState

func (BlockService) GetShardBlockHeader

func (blockService BlockService) GetShardBlockHeader(getBy string, blockParam string, shardID float64) ([]*types.ShardHeader, int, []string, *RPCError)

func (BlockService) GetValidStakers

func (blockService BlockService) GetValidStakers(publicKeys []string) ([]string, *RPCError)

func (BlockService) IsBeaconBestStateNil

func (blockService BlockService) IsBeaconBestStateNil() bool

func (BlockService) IsShardBestStateNil

func (blockService BlockService) IsShardBestStateNil() bool

func (BlockService) ListPrivacyCustomToken

func (blockService BlockService) ListPrivacyCustomToken() (map[common.Hash]*statedb.TokenState, error)

func (BlockService) ListPrivacyCustomTokenWithPRVByShardID

func (blockService BlockService) ListPrivacyCustomTokenWithPRVByShardID(shardID byte) (map[common.Hash]*statedb.TokenState, error)

func (BlockService) ListPrivacyCustomTokenWithTxs

func (blockService BlockService) ListPrivacyCustomTokenWithTxs() (map[common.Hash]*statedb.TokenState, error)

func (BlockService) ListRewardAmount

func (blockService BlockService) ListRewardAmount() (map[string]map[common.Hash]uint64, error)

func (BlockService) RetrieveBeaconBlock

func (blockService BlockService) RetrieveBeaconBlock(hashString string) (*jsonresult.GetBeaconBlockResult, *RPCError)

func (BlockService) RetrieveBeaconBlockByHeight

func (blockService BlockService) RetrieveBeaconBlockByHeight(blockHeight uint64) ([]*jsonresult.GetBeaconBlockResult, *RPCError)

func (BlockService) RetrieveShardBlock

func (blockService BlockService) RetrieveShardBlock(hashString string, verbosity string) (*jsonresult.GetShardBlockResult, *RPCError)

func (BlockService) RetrieveShardBlockByHeight

func (blockService BlockService) RetrieveShardBlockByHeight(blockHeight uint64, shardId int, verbosity string) ([]*jsonresult.GetShardBlockResult, *RPCError)

type CoinService

type CoinService struct {
	BlockChain *blockchain.BlockChain
}

func (CoinService) GetOTACoinLength

func (coinService CoinService) GetOTACoinLength() (map[common.Hash]map[byte]uint64, *RPCError)

func (CoinService) GetOutputCoinByIndex

func (coinService CoinService) GetOutputCoinByIndex(tokenID common.Hash, idxList []uint64, shardID byte) (map[uint64]jsonresult.OutCoin, *RPCError)

func (CoinService) ListCachedOutputCoinsByKey

func (coinService CoinService) ListCachedOutputCoinsByKey(listKeyParams []interface{}, tokenID common.Hash) (*jsonresult.ListOutputCoins, *RPCError)

func (CoinService) ListCachedUnspentOutputCoinsByKey

func (coinService CoinService) ListCachedUnspentOutputCoinsByKey(listKeyParams []interface{}, tokenID *common.Hash, toHeight uint64) (*jsonresult.ListOutputCoins, *RPCError)

func (CoinService) ListDecryptedOutputCoinsByKeySet

func (coinService CoinService) ListDecryptedOutputCoinsByKeySet(keySet *incognitokey.KeySet, shardID byte, shardHeight uint64) ([]privacy.PlainCoin, uint64, error)

func (CoinService) ListOutputCoinsByKey

func (coinService CoinService) ListOutputCoinsByKey(listKeyParams []interface{}, tokenID common.Hash, toHeight uint64) (*jsonresult.ListOutputCoins, *RPCError)

func (CoinService) ListUnspentOutputCoinsByKey

func (coinService CoinService) ListUnspentOutputCoinsByKey(listKeyParams []interface{}, tokenID *common.Hash, toHeight uint64) (*jsonresult.ListOutputCoins, *RPCError)

func (CoinService) ListUnspentOutputTokensByKey

func (coinService CoinService) ListUnspentOutputTokensByKey(listKeyParams []interface{}) (*jsonresult.ListOutputCoins, *RPCError)

type DeBridgeLogger

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

func (*DeBridgeLogger) Init

func (self *DeBridgeLogger) Init(inst common.Logger)

type MempoolInterface

type MempoolInterface interface {
	ValidateSerialNumberHashH(serialNumber []byte) error
	MaybeAcceptTransaction(tx metadata.Transaction, beaconHeight int64) (*common.Hash, *mempool.TxDesc, error)
	GetTx(txHash *common.Hash) (metadata.Transaction, error)
	GetClonedPoolCandidate() map[common.Hash]string
	ListTxs() []string
	RemoveTx(txs []metadata.Transaction, isInBlock bool)
	RemoveStuckTx(txHash common.Hash, tx metadata.Transaction)
	TriggerCRemoveTxs(tx metadata.Transaction)
	MarkForwardedTransaction(txHash common.Hash)
	MaxFee() uint64
	ListTxsDetail() ([]common.Hash, []metadata.Transaction)
	Count() int
	Size() uint64
	SendTransactionToBlockGen()
}

type NetworkService

type NetworkService struct {
	ConnMgr *connmanager.ConnManager
}

func (NetworkService) GetConnectionCount

func (networkService NetworkService) GetConnectionCount() int

type PdexTxService

type PdexTxService struct {
	*TxService
}

PdexTxService extends TxService with wrappers to build TX with cleaner syntax

func (PdexTxService) BuildTransaction

func (svc PdexTxService) BuildTransaction(
	sel *paramSelector, md metadataCommon.Metadata,
) (metadataCommon.Transaction, *RPCError)

func (PdexTxService) GenerateOTAReceivers

func (svc PdexTxService) GenerateOTAReceivers(
	tokens []common.Hash, addr privacy.PaymentAddress,
) (map[common.Hash]privacy.OTAReceiver, error)

func (PdexTxService) ReadParamsFrom

func (svc PdexTxService) ReadParamsFrom(raw interface{}, metadataReader interface{}) (*paramSelector, error)

func (PdexTxService) ValidateTokenIDs

func (svc PdexTxService) ValidateTokenIDs(tokenToSell, tokenToBuy *common.Hash) error

type PortalService

type PortalService struct {
	BlockChain *blockchain.BlockChain
}

func (*PortalService) CalculateTopupAmountForCustodianState

func (s *PortalService) CalculateTopupAmountForCustodianState(
	stateDB *statedb.StateDB,
	custodianAddress string,
	portalTokenID string,
	collateralTokenID string,
	portalParam portalv3.PortalParams) (uint64, error)

func (*PortalService) ConvertExchangeRates

func (s *PortalService) ConvertExchangeRates(
	finalExchangeRates *statedb.FinalExchangeRatesState, portalParams portalv3.PortalParams,
	amount uint64, tokenIDFrom string, tokenIDTo string) (uint64, error)

func (*PortalService) GetCustodianWithdrawRequestStatusByTxId

func (s *PortalService) GetCustodianWithdrawRequestStatusByTxId(txId string) (jsonresult.PortalCustodianWithdrawRequest, error)

func (*PortalService) GetCustodianWithdrawRequestStatusV3ByTxId

func (s *PortalService) GetCustodianWithdrawRequestStatusV3ByTxId(txId string) (metadata.CustodianWithdrawRequestStatusV3, error)

func (*PortalService) GetFinalExchangeRates

func (s *PortalService) GetFinalExchangeRates(stateDB *statedb.StateDB, beaconHeight uint64) (jsonresult.FinalExchangeRatesResult, error)

func (*PortalService) GetLiquidateExchangeRatesPool

func (s *PortalService) GetLiquidateExchangeRatesPool(
	stateDB *statedb.StateDB,
	tokenID string,
) (jsonresult.GetLiquidateExchangeRates, error)

func (*PortalService) GetPortingFees

func (s *PortalService) GetPortingFees(finalExchangeRates *statedb.FinalExchangeRatesState, tokenID string, valuePToken uint64, portalParam portalv3.PortalParams) (uint64, error)

func (*PortalService) GetPortingRequestByByPortingId

func (s *PortalService) GetPortingRequestByByPortingId(portingId string) (jsonresult.PortalPortingRequest, error)

func (*PortalService) GetPortingRequestByByTxID

func (s *PortalService) GetPortingRequestByByTxID(txId string) (jsonresult.PortalPortingRequest, error)

func (*PortalService) GetWithdrawCollateralConfirm

func (s *PortalService) GetWithdrawCollateralConfirm(txID common.Hash) (uint64, error)

type RPCError

type RPCError struct {
	Code       int    `json:"Code,omitempty"`
	Message    string `json:"Message,omitempty"`
	StackTrace string `json:"StackTrace"`
	// contains filtered or unexported fields
}

RPCError represents an error that is used as a part of a JSON-RPC JsonResponse object.

func InternalRPCError

func InternalRPCError(errStr, context string) *RPCError

internalRPCError is a convenience function to convert an internal error to an RPC error with the appropriate Code set. It also logs the error to the RPC server subsystem since internal errors really should not occur. The context parameter is only used in the log Message and may be empty if it's not needed.

func NewBurningRequestMetadata

func NewBurningRequestMetadata(
	senderPrivateKeyStr string,
	tokenReceivers interface{},
	tokenID string,
	tokenName string,
	remoteAddress string,
	burningMetaType int,
	bcr metadata.ChainRetriever,
	beaconHeight uint64,
	version int8,
	networkID uint,
	expectedAmount uint64,
	isDepositToSC *bool,
) (metadata.Metadata, *RPCError)

func NewContractingRequestMetadata

func NewContractingRequestMetadata(senderPrivateKeyStr string, tokenReceivers interface{}, tokenID string) (*metadata.ContractingRequest, *RPCError)

func NewRPCError

func NewRPCError(key int, err error, param ...interface{}) *RPCError

NewRPCError constructs and returns a new JSON-RPC error that is suitable for use in a JSON-RPC JsonResponse object.

func (RPCError) Error

func (e RPCError) Error() string

Error returns a string describing the RPC error. This satisifies the builtin error interface.

func (RPCError) GetErr

func (e RPCError) GetErr() error

type RpcLogger

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

func (*RpcLogger) Init

func (rpcLogger *RpcLogger) Init(inst common.Logger)

type SynkerService

type SynkerService struct {
	Synker *syncker.SynckerManager
}

func (*SynkerService) GetAllViewBeaconByHash

func (s *SynkerService) GetAllViewBeaconByHash(bestHash string) []types.BlockPoolInterface

func (*SynkerService) GetAllViewShardByHash

func (s *SynkerService) GetAllViewShardByHash(bestHash string, sID int) []types.BlockPoolInterface

func (*SynkerService) GetBeaconPoolInfo

func (s *SynkerService) GetBeaconPoolInfo() []types.BlockPoolInterface

func (*SynkerService) GetCrossShardPoolInfo

func (s *SynkerService) GetCrossShardPoolInfo(toShard int) []types.BlockPoolInterface

func (*SynkerService) GetShardPoolInfo

func (s *SynkerService) GetShardPoolInfo(shardID int) []types.BlockPoolInterface

func (*SynkerService) GetSyncStats

func (s *SynkerService) GetSyncStats() syncker.SynckerStats

type TxInfo

type TxInfo struct {
	BlockHash common.Hash
	Tx        metadata.Transaction
	TxHash    string
}

type TxMemPoolService

type TxMemPoolService struct {
	TxMemPool MempoolInterface
}

func (TxMemPoolService) CheckListSerialNumbersExistedInMempool

func (txMemPoolService TxMemPoolService) CheckListSerialNumbersExistedInMempool(serialNumbers []interface{}) ([]bool, *RPCError)

CheckListSerialNumbersExistedInMempool checks list of serial numbers (base58 encoded) are existed in mempool or not

func (TxMemPoolService) FilterMemPoolPlainCoinsToSpent

func (txMemPoolService TxMemPoolService) FilterMemPoolPlainCoinsToSpent(outCoins []coin.PlainCoin) ([]coin.PlainCoin, error)

func (TxMemPoolService) GetNumberOfTxsInMempool

func (txMemPoolService TxMemPoolService) GetNumberOfTxsInMempool() int

func (TxMemPoolService) GetPoolCandidate

func (txMemPoolService TxMemPoolService) GetPoolCandidate() map[common.Hash]string

func (TxMemPoolService) MempoolEntry

func (txMemPoolService TxMemPoolService) MempoolEntry(txIDString string) (metadata.Transaction, byte, *RPCError)

func (*TxMemPoolService) RemoveTxInMempool

func (txMemPoolService *TxMemPoolService) RemoveTxInMempool(txIDString string) (bool, *RPCError)

type TxService

type TxService struct {
	BlockChain   *blockchain.BlockChain
	Wallet       *wallet.Wallet
	FeeEstimator map[byte]*mempool.FeeEstimator
	TxMemPool    MempoolInterface
}

func (TxService) BuildConvertV1ToV2Transaction

func (txService TxService) BuildConvertV1ToV2Transaction(params *bean.CreateRawTxSwitchVer1ToVer2Param) (metadata.Transaction, *RPCError)

func (TxService) BuildPrivacyCustomTokenParam

func (txService TxService) BuildPrivacyCustomTokenParam(tokenParamsRaw map[string]interface{}, senderKeySet *incognitokey.KeySet, shardIDSender byte) (*transaction.TokenParam, map[common.Hash]transaction.TransactionToken, map[common.Hash]types.CrossShardTokenPrivacyMetaData, *RPCError)

func (TxService) BuildPrivacyCustomTokenParamV2

func (txService TxService) BuildPrivacyCustomTokenParamV2(tokenParamsRaw map[string]interface{}, senderKeySet *incognitokey.KeySet, shardIDSender byte) (*transaction.TokenParam, map[common.Hash]transaction.TransactionToken, map[common.Hash]types.CrossShardTokenPrivacyMetaData, *RPCError)

func (TxService) BuildRawConvertVer1ToVer2Token

func (txService TxService) BuildRawConvertVer1ToVer2Token(params *bean.CreateRawTxTokenSwitchVer1ToVer2Param) (*common.Hash, []byte, byte, *RPCError)

func (TxService) BuildRawDefragmentAccountTransaction

func (txService TxService) BuildRawDefragmentAccountTransaction(params interface{}, meta metadata.Metadata) (metadata.Transaction, *RPCError)

func (TxService) BuildRawDefragmentPrivacyCustomTokenTransaction

func (txService TxService) BuildRawDefragmentPrivacyCustomTokenTransaction(params interface{}, metaData metadata.Metadata) (transaction.TransactionToken, *RPCError)

func (TxService) BuildRawPrivacyCustomTokenTransaction

func (txService TxService) BuildRawPrivacyCustomTokenTransaction(
	params interface{},
	metaData metadata.Metadata,
) (transaction.TransactionToken, *RPCError)

BuildRawCustomTokenTransaction ...

func (TxService) BuildRawPrivacyCustomTokenTransactionV2

func (txService TxService) BuildRawPrivacyCustomTokenTransactionV2(params interface{}, metaData metadata.Metadata) (transaction.TransactionToken, *RPCError)

BuildRawCustomTokenTransactionV2 ...

func (TxService) BuildRawTransaction

func (txService TxService) BuildRawTransaction(
	params *bean.CreateRawTxParam,
	meta metadata.Metadata,
) (metadata.Transaction, *RPCError)

func (TxService) BuildTokenParam

func (txService TxService) BuildTokenParam(tokenParamsRaw map[string]interface{}, senderKeySet *incognitokey.KeySet, shardIDSender byte) (*transaction.TokenParam, *RPCError)

func (TxService) BuildTokenParamV2

func (txService TxService) BuildTokenParamV2(tokenParamsRaw map[string]interface{}, senderKeySet *incognitokey.KeySet, shardIDSender byte) (*transaction.TokenParam, *RPCError)

func (TxService) CreateRawConvertVer1ToVer2Transaction

func (txService TxService) CreateRawConvertVer1ToVer2Transaction(params *bean.CreateRawTxSwitchVer1ToVer2Param) (*common.Hash, []byte, byte, *RPCError)

func (TxService) CreateRawTransaction

func (txService TxService) CreateRawTransaction(params *bean.CreateRawTxParam, meta metadata.Metadata) (*common.Hash, []byte, byte, *RPCError)

func (TxService) DecryptOutputCoinByKey

func (txService TxService) DecryptOutputCoinByKey(outCoins []coin.Coin, keyset *incognitokey.KeySet) ([]coin.PlainCoin, *RPCError)

func (TxService) DecryptOutputCoinByKeyByTransaction

func (txService TxService) DecryptOutputCoinByKeyByTransaction(keyParam *incognitokey.KeySet, txHashStr string) (map[string]interface{}, *RPCError)

func (TxService) EstimateFee

func (txService TxService) EstimateFee(
	version int,
	defaultFee int64,
	isGetPTokenFee bool,
	candidatePlainCoins []coin.PlainCoin,
	paymentInfos []*privacy.PaymentInfo, shardID byte,
	numBlock uint64, hasPrivacy bool,
	metadata metadata.Metadata,
	privacyCustomTokenParams *transaction.TokenParam,
	beaconHeight int64) (*jsonresult.EstimateFeeResult, error)

EstimateFee - estimate fee from tx data and return real full fee, fee per kb and real tx size if isGetPTokenFee == true: return fee for ptoken if isGetPTokenFee == false: return fee for native token

func (TxService) EstimateFeeWithEstimator

func (txService TxService) EstimateFeeWithEstimator(defaultFee int64, shardID byte, numBlock uint64, tokenId *common.Hash, beaconHeight int64) (uint64, uint64, error)

EstimateFeeWithEstimator - only estimate fee by estimator and return fee per kb if tokenID != nil: return fee per kb for pToken (return error if there is no exchange rate between pToken and native token) if tokenID == nil: return fee per kb for native token

func (TxService) GenerateOTAFromPaymentAddress

func (TxService TxService) GenerateOTAFromPaymentAddress(paymentAddressStr string) (string, string, error)

func (TxService) GetBalancePrivacyCustomToken

func (txService TxService) GetBalancePrivacyCustomToken(privateKey string, tokenIDStr string) (uint64, *RPCError)

func (TxService) GetEncodedTransactionsByHashes

func (txService TxService) GetEncodedTransactionsByHashes(txHashList []string) (map[string]string, *RPCError)

GetEncodedTransactionsByHashes returns a list of base58-encoded transactions given their hashes.

func (TxService) GetInputSerialNumberByTransaction

func (txService TxService) GetInputSerialNumberByTransaction(txHashStr string) (map[string][]string, *RPCError)

func (TxService) GetListPrivacyCustomTokenBalance deprecated

func (txService TxService) GetListPrivacyCustomTokenBalance(privateKey string) (jsonresult.ListCustomTokenBalance, *RPCError)

GetListPrivacyCustomTokenBalance returns the balance of all tokens for the given privateKey.

Deprecated: consider using GetListPrivacyCustomTokenBalanceNew for better performance.

func (TxService) GetListPrivacyCustomTokenBalanceNew

func (txService TxService) GetListPrivacyCustomTokenBalanceNew(privateKey string) (jsonresult.ListCustomTokenBalance, *RPCError)

GetListPrivacyCustomTokenBalanceNew returns the balance of all tokens given a privateKey.

func (TxService) GetPrivacyTokenWithTxs

func (txService TxService) GetPrivacyTokenWithTxs(tokenID common.Hash) (*statedb.TokenState, error)

func (TxService) GetTransactionByHash

func (txService TxService) GetTransactionByHash(txHashStr string) (*jsonresult.TransactionDetail, *RPCError)

func (TxService) GetTransactionByReceiver

func (txService TxService) GetTransactionByReceiver(keySet incognitokey.KeySet) (*jsonresult.ListReceivedTransaction, *RPCError)

GetTransactionByReceiver - from keyset of receiver, we can get list tx hash which be sent to receiver if this keyset contain payment-addr, we can detect tx hash if this keyset contain viewing key, we can detect amount in tx, but can not know output in tx is spent because this is monitoring output to get received tx -> can not know this is a returned amount tx

func (TxService) GetTransactionByReceiverV2

func (txService TxService) GetTransactionByReceiverV2(
	keySet incognitokey.KeySet,
	skip, limit uint,
	tokenIDHash common.Hash,
) (*jsonresult.ListReceivedTransactionV2, uint, *RPCError)

GetTransactionByReceiverV2 - from keyset of receiver, we can get list tx hash which be sent to receiver if this keyset contain payment-addr, we can detect tx hash if this keyset contain viewing key, we can detect amount in tx, but can not know output in tx is spent because this is monitoring output to get received tx -> can not know this is a returned amount tx

func (TxService) GetTransactionBySerialNumber

func (txService TxService) GetTransactionBySerialNumber(snList []string, shardID byte, tokenID common.Hash) (map[string]string, *RPCError)

func (TxService) GetTransactionHashByPublicKey

func (txService TxService) GetTransactionHashByPublicKey(publicKeyStrList []string) (map[string]map[byte][]common.Hash, error)

func (TxService) GetTransactionHashByReceiver

func (txService TxService) GetTransactionHashByReceiver(paymentAddressParam string) (map[byte][]common.Hash, error)

func (TxService) GetTransactionHashByReceiverV2

func (txService TxService) GetTransactionHashByReceiverV2(
	paymentAddressParam string,
	skip, limit uint,
) (map[byte][]common.Hash, error)

func (TxService) HasSerialNumbers

func (txService TxService) HasSerialNumbers(shardID byte, serialNumbersStr []interface{}, tokenID common.Hash) ([]bool, error)

HasSerialNumbers checks if a list of serial numbers have been spent. The serial number list can either be base58- or base64-encoded.

func (TxService) HasSnDerivators

func (txService TxService) HasSnDerivators(paymentAddressStr string, snDerivatorStr []interface{}, tokenID common.Hash) ([]bool, error)

func (TxService) ListCommitmentIndices

func (txService TxService) ListCommitmentIndices(tokenID common.Hash, shardID byte) (map[uint64]string, error)

func (TxService) ListCommitments

func (txService TxService) ListCommitments(tokenID common.Hash, shardID byte) (map[string]uint64, error)

func (TxService) ListPrivacyCustomToken

func (txService TxService) ListPrivacyCustomToken() (map[common.Hash]*statedb.TokenState, error)

func (TxService) ListSNDerivator

func (txService TxService) ListSNDerivator(tokenID common.Hash, shardID byte) ([]big.Int, error)

func (TxService) ListSerialNumbers

func (txService TxService) ListSerialNumbers(tokenID common.Hash, shardID byte) (map[string]struct{}, error)

func (TxService) PrivacyCustomTokenDetail

func (txService TxService) PrivacyCustomTokenDetail(tokenIDStr string) ([]common.Hash, *transaction.TxTokenData, error)

func (TxService) RandomCommitments

func (txService TxService) RandomCommitments(shardIDSender byte, outputs []interface{}, tokenID *common.Hash) ([]uint64, []uint64, [][]byte, *RPCError)

func (TxService) RandomCommitmentsAndPublicKeys

func (txService TxService) RandomCommitmentsAndPublicKeys(shardID byte, numOutputs int, tokenID *common.Hash) ([]uint64, [][]byte, [][]byte, [][]byte, *RPCError)

func (TxService) SendRawPrivacyCustomTokenTransaction

func (txService TxService) SendRawPrivacyCustomTokenTransaction(base58CheckData string) (wire.Message, transaction.TransactionToken, *RPCError)

func (TxService) SendRawTransaction

func (txService TxService) SendRawTransaction(txB58Check string) (wire.Message, *common.Hash, byte, *RPCError)

type WalletService

type WalletService struct {
	Wallet     *wallet.Wallet
	BlockChain *blockchain.BlockChain
}

func (WalletService) DumpPrivkey

func (walletService WalletService) DumpPrivkey(param string) wallet.KeySerializedData

func (WalletService) GetAccount

func (walletService WalletService) GetAccount(paymentAddrStr string) (string, error)

func (*WalletService) GetAccountAddress

func (walletService *WalletService) GetAccountAddress(accountName string) (wallet.KeySerializedData, error)

func (WalletService) GetAddressesByAccount

func (walletService WalletService) GetAddressesByAccount(accountName string) ([]wallet.KeySerializedData, error)

func (WalletService) GetBalance

func (walletService WalletService) GetBalance(accountName string) (uint64, *RPCError)

func (WalletService) GetBalanceByPaymentAddress

func (walletService WalletService) GetBalanceByPaymentAddress(paymentAddress string) (uint64, *RPCError)

func (WalletService) GetBalanceByPrivateKey

func (walletService WalletService) GetBalanceByPrivateKey(privateKey string) (uint64, *RPCError)

func (WalletService) GetReceivedByAccount

func (walletService WalletService) GetReceivedByAccount(accountName string) (uint64, *RPCError)

func (*WalletService) ImportAccount

func (walletService *WalletService) ImportAccount(privateKey string, accountName string, passPhrase string) (wallet.KeySerializedData, error)

func (WalletService) ListAccounts

func (walletService WalletService) ListAccounts() (jsonresult.ListAccounts, *RPCError)

func (*WalletService) RemoveAccount

func (walletService *WalletService) RemoveAccount(privateKey string, passPhrase string) (bool, *RPCError)

func (WalletService) SubmitKey

func (walletService WalletService) SubmitKey(keyStr string, accessToken string, isReset bool, syncFrom *uint64) (bool, *RPCError)

Jump to

Keyboard shortcuts

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