rpcclient

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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddStakingParam

type AddStakingParam struct {
	BurnAddr  string
	StakerPrk string
	MinerPrk  string
	AddAmount uint64
}

type ClientInterface

type ClientInterface interface {
	GetBalanceByPrivateKey(privateKey string) (uint64, error)
	GetListPrivacyCustomTokenBalance(privateKey string) (jsonresult.ListCustomTokenBalance, error)
	GetRewardAmount(paymentAddress string) (map[string]uint64, error)
	GetRewardAmountByPublicKey(publicKey string) (map[string]uint64, error)
	GetAllRewardAmount() (res map[string]map[string]uint64, err error)
	WithdrawReward(privateKey string, receivers map[string]interface{}, amount float64, privacy float64, info map[string]interface{}) (jsonresult.CreateTransactionResult, error)
	CreateAndSendStakingTransaction(privateKey string, receivers map[string]interface{}, fee float64, privacy float64, stakeInfo map[string]interface{}) (jsonresult.CreateTransactionResult, error)
	CreateAndSendStopAutoStakingTransaction(privateKey string, receivers map[string]interface{}, fee float64, privacy float64, stopStakeInfo map[string]interface{}) (jsonresult.CreateTransactionResult, error)
	CreateAndSendAddStakingTransaction(privateKey string, receivers map[string]interface{}, fee float64, privacy float64, addStakeInfo map[string]interface{}) (jsonresult.CreateTransactionResult, error)
	CreateAndSendUnStakingTransaction(privateKey string, receivers map[string]interface{}, fee float64, privacy float64, stopStakeInfo map[string]interface{}) (res jsonresult.CreateTransactionResult, err error)
	CreateAndSendReDelegateTransaction(privateKey string, receivers map[string]interface{}, fee float64, privacy float64, redelegateInfo map[string]interface{}) (res jsonresult.CreateTransactionResult, err error)
	CreateAndSendTransaction(privateKey string, receivers map[string]interface{}, fee float64, privacy float64) (jsonresult.CreateTransactionResult, error)
	CreateAndSendPrivacyCustomTokenTransaction(privateKey string, receivers map[string]interface{}, fee float64, privacy float64, tokenInfo map[string]interface{}, p1 string, pPrivacy float64) (jsonresult.CreateTransactionTokenResult, error)
	CreateAndSendTxWithWithdrawalReqV2(privateKey string, receivers map[string]interface{}, fee float64, privacy float64, reqInfo map[string]interface{}) (jsonresult.CreateTransactionResult, error)
	CreateAndSendTxWithPDEFeeWithdrawalReq(privateKey string, receivers map[string]interface{}, fee float64, privacy float64, reqInfo map[string]interface{}) (jsonresult.CreateTransactionResult, error)
	CreateAndSendTxWithPTokenTradeReq(privateKey string, receivers map[string]interface{}, fee float64, privacy float64, reqInfo map[string]interface{}, p1 string, pPrivacy float64) (jsonresult.CreateTransactionTokenResult, error)
	CreateAndSendTxWithPTokenCrossPoolTradeReq(privateKey string, receivers map[string]interface{}, fee float64, privacy float64, reqInfo map[string]interface{}, p1 string, pPrivacy float64) (jsonresult.CreateTransactionTokenResult, error)
	CreateAndSendTxWithPRVTradeReq(privateKey string, receivers map[string]interface{}, fee float64, privacy float64, reqInfo map[string]interface{}) (jsonresult.CreateTransactionResult, error)
	CreateAndSendTxWithPRVCrossPoolTradeReq(privateKey string, receivers map[string]interface{}, fee float64, privacy float64, reqInfo map[string]interface{}) (jsonresult.CreateTransactionResult, error)
	CreateAndSendTxWithPTokenContributionV2(privateKey string, receivers map[string]interface{}, fee float64, privacy float64, reqInfo map[string]interface{}, p1 string, pPrivacy float64) (jsonresult.CreateTransactionTokenResult, error)
	CreateAndSendTxWithPRVContributionV2(privateKey string, receivers map[string]interface{}, fee float64, privacy float64, reqInfo map[string]interface{}) (jsonresult.CreateTransactionResult, error)
	GetPDEState(data map[string]interface{}) (jsonresult.CurrentPDEState, error)
	GetBeaconBestState() (jsonresult.GetBeaconBestState, error)
	GetShardBestState(sid int) (jsonresult.GetShardBestState, error)
	GetTransactionByHash(transactionHash string) (*jsonresult.TransactionDetail, error)
	GetPrivacyCustomToken(tokenStr string) (*jsonresult.GetCustomToken, error)
	GetBurningAddress(beaconHeight float64) (string, error)
	GetPublicKeyRole(publicKey string, detail bool) (interface{}, error)
	GetBlockChainInfo() (*jsonresult.GetBlockChainInfoResult, error)
	GetCandidateList() (*jsonresult.CandidateListsResult, error)
	GetCommitteeList() (*jsonresult.CommitteeListsResult, error)
	GetBlockHash(chainID float64, height float64) ([]common.Hash, error)
	RetrieveBlock(hash string, verbosity string) (*jsonresult.GetShardBlockResult, error)
	RetrieveBlockByHeight(shardID float64, height float64, verbosity string) ([]*jsonresult.GetShardBlockResult, error)
	RetrieveBeaconBlock(hash string) (*jsonresult.GetBeaconBlockResult, error)
	RetrieveBeaconBlockByHeight(height float64) ([]*jsonresult.GetBeaconBlockResult, error)
	GetRewardAmountByEpoch(shard float64, epoch float64) (uint64, error)
	DefragmentAccount(privateKey string, maxValue float64, fee float64, privacy float64) (jsonresult.CreateTransactionResult, error)
	DefragmentAccountToken(privateKey string, receiver map[string]interface{}, fee float64, privacy float64, reqInfo map[string]interface{}, p1 string, pPrivacy float64) (jsonresult.CreateTransactionTokenResult, error)

	SubmitKey(privateKey string) (bool, error)
	CreateConvertCoinVer1ToVer2Transaction(privateKey string) error
	SendFinishSync(mining, cpk string, sid float64) error
	GetMempoolInfo() (res *jsonresult.GetMempoolInfo, err error)
	CreateAndSendTXShieldingRequest(privateKey string, incAddr string, tokenID string, proof string) (res jsonresult.CreateTransactionResult, err error)
	GetPortalShieldingRequestStatus(tx string) (res *metadata.PortalShieldingRequestStatus, err error)
	CreateAndSendTxWithPortalV4UnshieldRequest(privatekey string, tokenID string, amount string, paymentAddress string, remoteAddress string) (res jsonresult.CreateTransactionTokenResult, err error)
	GetPortalUnshieldRequestStatus(tx string) (res *metadata.PortalUnshieldRequestStatus, err error)

	//pdex v3
	CreateAndSendTokenInitTransaction(param PdexV3InitTokenParam) (jsonresult.CreateTransactionTokenResult, error)
	Pdexv3_TxMintNft(privatekeys string) error
	//Pdexv3_GetState(data map[string]interface{}) (*jsonresult.Pdexv3State, error)
	Pdexv3_TxAddLiquidity(privatekey string, param PdexV3AddLiquidityParam) error
	Pdexv3_TxWithdrawLiquidity(privatekey, poolairID, nftID, shareAmount string) error
	Pdexv3_TxModifyParams(privatekey string, newParams PdexV3Params)
	Pdexv3_TxStake(privatekey, stakingPoolID, nftID, amount string) error
	Pdexv3_TxUnstake(privatekey, stakingPoolID, nftID, amount string) error
	Pdexv3_TxAddTrade(privatekey string, param PdexV3TradeParam) error
	Pdexv3_TxAddOrder(privatekey string, params PdexV3AddOrderParam) error
}

type PdexV3AddLiquidityParam

type PdexV3AddLiquidityParam struct {
	NftID             string
	TokenID           string
	PoolPairID        string
	PairHash          string
	ContributedAmount string
	Amplifier         string
}

type PdexV3AddOrderParam

type PdexV3AddOrderParam struct {
	PoolPairID          string `json:"PoolPairID"`
	TokenToSell         string `json:"TokenToSell"`
	TokenToBuy          string `json:"TokenToBuy"`
	NftID               string `json:"NftID"`
	SellAmount          string `json:"SellAmount"`
	MinAcceptableAmount string `json:"MinAcceptableAmount"`
}

type PdexV3InitTokenParam

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

type PdexV3Params

type PdexV3Params struct {
	DefaultFeeRateBPS               string            `json:"DefaultFeeRateBPS"`
	FeeRateBPS                      map[string]string `json:"FeeRateBPS"`
	PRVDiscountPercent              string            `json:"PRVDiscountPercent"`
	TradingProtocolFeePercent       string            `json:"TradingProtocolFeePercent"`
	TradingStakingPoolRewardPercent string            `json:"TradingStakingPoolRewardPercent"`
	PDEXRewardPoolPairsShare        map[string]string `json:"PDEXRewardPoolPairsShare"`
	StakingPoolsShare               map[string]string `json:"StakingPoolsShare"`
	StakingRewardTokens             []string          `json:"StakingRewardTokens"`
	MintNftRequireAmount            string            `json:"MintNftRequireAmount"`
	MaxOrdersPerNft                 string            `json:"MaxOrdersPerNft"`
}

type PdexV3TradeParam

type PdexV3TradeParam struct {
	TradePath           []string `json:"TradePath"`
	TokenToSell         string   `json:"TokenToSell"`
	TokenToBuy          string   `json:"TokenToBuy"`
	SellAmount          string   `json:"SellAmount"`
	MinAcceptableAmount string   `json:"MinAcceptableAmount"`
	TradingFee          uint64   `json:"TradingFee"`
	FeeInPRV            bool     `json:"FeeInPRV"`
}

type RPCClient

type RPCClient struct {
	Client ClientInterface
}

func NewRPCClient

func NewRPCClient(client ClientInterface) *RPCClient

func (*RPCClient) API_CreateAndSendTokenInitTransaction

func (r *RPCClient) API_CreateAndSendTokenInitTransaction(privateKey, tokenName, tokenSymbol string, amount uint64) (jsonresult.CreateTransactionTokenResult, error)

func (*RPCClient) API_CreateConvertCoinVer1ToVer2Transaction

func (r *RPCClient) API_CreateConvertCoinVer1ToVer2Transaction(privateKey string) error

func (*RPCClient) API_DefragmentAccountPRV

func (r *RPCClient) API_DefragmentAccountPRV(privateKey string, maxValue uint64, fee uint64, privacy bool) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) API_DefragmentAccountToken

func (r *RPCClient) API_DefragmentAccountToken(privateKey string, tokenID string, fee uint64, privacy bool) (*jsonresult.CreateTransactionTokenResult, error)

func (*RPCClient) API_GetBalance

func (r *RPCClient) API_GetBalance(acc account.Account) (map[string]uint64, error)

func (*RPCClient) API_GetBeaconBestState

func (r *RPCClient) API_GetBeaconBestState() (jsonresult.GetBeaconBestState, error)

func (*RPCClient) API_GetBlockChainInfo

func (r *RPCClient) API_GetBlockChainInfo() (*jsonresult.GetBlockChainInfoResult, error)

func (*RPCClient) API_GetBlockHash

func (r *RPCClient) API_GetBlockHash(chainID int, height uint64) ([]common.Hash, error)

func (*RPCClient) API_GetCandidateList

func (r *RPCClient) API_GetCandidateList() (*jsonresult.CandidateListsResult, error)

func (*RPCClient) API_GetCommitteeList

func (r *RPCClient) API_GetCommitteeList() (*jsonresult.CommitteeListsResult, error)

func (*RPCClient) API_GetPDEState

func (r *RPCClient) API_GetPDEState(beaconHeight float64) (jsonresult.CurrentPDEState, error)

func (*RPCClient) API_GetPrivacyCustomToken

func (r *RPCClient) API_GetPrivacyCustomToken(h string) (*jsonresult.GetCustomToken, error)

func (*RPCClient) API_GetPublicKeyRole

func (r *RPCClient) API_GetPublicKeyRole(miningPublicKey string) (role string, chainID int)

func (*RPCClient) API_GetRewardAmount

func (r *RPCClient) API_GetRewardAmount(paymentAddress string) (map[string]float64, error)

func (*RPCClient) API_GetRewardAmountByEpoch

func (r *RPCClient) API_GetRewardAmountByEpoch(shardID byte, epoch uint64) (uint64, error)

func (*RPCClient) API_GetShardBestState

func (r *RPCClient) API_GetShardBestState(sid int) (jsonresult.GetShardBestState, error)

func (*RPCClient) API_GetTransactionHash

func (r *RPCClient) API_GetTransactionHash(h string) (jsonresult.TransactionDetail, error)

func (*RPCClient) API_MintNFT

func (r *RPCClient) API_MintNFT(privateKey string) error

func (*RPCClient) API_PdexV3AddLiquididty

func (r *RPCClient) API_PdexV3AddLiquididty(privatekey, nftID, tokenID, poolPairID, pairHash, contributedAmount, amplifier string) error

func (*RPCClient) API_Pdexv3AddOrder

func (r *RPCClient) API_Pdexv3AddOrder(
	privatekey, poolPairID, tokenToSell, tokenToBuy, nftID, sellAmount, min string,
) error

func (*RPCClient) API_Pdexv3Trade

func (r *RPCClient) API_Pdexv3Trade(privatekey string, param PdexV3TradeParam) error

func (*RPCClient) API_RetrieveBeaconBlock

func (r *RPCClient) API_RetrieveBeaconBlock(hash string) (*jsonresult.GetBeaconBlockResult, error)

func (*RPCClient) API_RetrieveBeaconBlockByHeight

func (r *RPCClient) API_RetrieveBeaconBlockByHeight(height uint64) ([]*jsonresult.GetBeaconBlockResult, error)

func (*RPCClient) API_RetrieveShardBlock

func (r *RPCClient) API_RetrieveShardBlock(hash string, verbosity string) (*jsonresult.GetShardBlockResult, error)

func (*RPCClient) API_RetrieveShardBlockByHeight

func (r *RPCClient) API_RetrieveShardBlockByHeight(shardID byte, height uint64, verbosity string) ([]*jsonresult.GetShardBlockResult, error)

func (*RPCClient) API_SendTxAddStake

func (r *RPCClient) API_SendTxAddStake(addStakeMeta AddStakingParam) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) API_SendTxCreateCustomToken

func (r *RPCClient) API_SendTxCreateCustomToken(privateKey string, receiverPaymentAddress string, privacy bool, tokenName string, tokenSymbol string, tokenAmount uint64) (*jsonresult.CreateTransactionTokenResult, error)

func (*RPCClient) API_SendTxCustomToken

func (r *RPCClient) API_SendTxCustomToken(privateKey string, tokenID string, receivers map[string]uint64, fee int64, privacy bool) (*jsonresult.CreateTransactionTokenResult, error)

func (*RPCClient) API_SendTxPRV

func (r *RPCClient) API_SendTxPRV(privateKey string, receivers map[string]uint64, fee int64, privacy bool) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) API_SendTxReDelegate

func (r *RPCClient) API_SendTxReDelegate(redelegateMeta ReDelegateParam) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) API_SendTxStaking

func (r *RPCClient) API_SendTxStaking(stakeMeta StakingTxParam) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) API_SendTxStopAutoStake

func (r *RPCClient) API_SendTxStopAutoStake(stopStakeMeta StopStakingParam) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) API_SendTxUnStake

func (r *RPCClient) API_SendTxUnStake(stopStakeMeta StopStakingParam) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) API_SendTxWithPDEFeeWithdrawalReq

func (r *RPCClient) API_SendTxWithPDEFeeWithdrawalReq(privateKey string, receivers map[string]uint64, fee int64, privacy bool, reqInfo map[string]interface{}) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) API_SendTxWithPRVContributionV2

func (r *RPCClient) API_SendTxWithPRVContributionV2(account account.Account, prvAmount int, pairID string) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) API_SendTxWithPRVCrossPoolTradeReq

func (r *RPCClient) API_SendTxWithPRVCrossPoolTradeReq(account account.Account, buyTokenID string, sellAmount int, miniumBuyAmount int) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) API_SendTxWithPRVTradeReq

func (r *RPCClient) API_SendTxWithPRVTradeReq(privateKey string, receivers map[string]uint64, fee int64, privacy bool, reqInfo map[string]interface{}) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) API_SendTxWithPTokenContributionV2

func (r *RPCClient) API_SendTxWithPTokenContributionV2(account account.Account, tokenID string, tokenAmount int, pairID string) (*jsonresult.CreateTransactionTokenResult, error)

func (*RPCClient) API_SendTxWithPTokenCrossPoolTradeReq

func (r *RPCClient) API_SendTxWithPTokenCrossPoolTradeReq(acount account.Account, tokenID string, buyTokenID string, sellAmount int, miniumBuyAmount int) (*jsonresult.CreateTransactionTokenResult, error)

func (*RPCClient) API_SendTxWithPTokenTradeReq

func (r *RPCClient) API_SendTxWithPTokenTradeReq(privateKey string, receivers map[string]uint64, fee int64, privacy bool, reqInfo map[string]interface{}) (*jsonresult.CreateTransactionTokenResult, error)

func (*RPCClient) API_SendTxWithWithdrawalReqV2

func (r *RPCClient) API_SendTxWithWithdrawalReqV2(privateKey string, receivers map[string]uint64, fee int64, privacy bool, reqInfo map[string]interface{}) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) API_SendTxWithdrawReward

func (r *RPCClient) API_SendTxWithdrawReward(privateKey string, paymentAddress string) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) API_SubmitKey

func (r *RPCClient) API_SubmitKey(privateKey string) (bool, error)

func (*RPCClient) AddStake

func (*RPCClient) ReDelegate

func (r *RPCClient) ReDelegate(acc account.Account, newDelegate string) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) SendPRV

func (sim *RPCClient) SendPRV(args ...interface{}) (string, error)

func (*RPCClient) ShowBalance

func (sim *RPCClient) ShowBalance(acc account.Account)

func (*RPCClient) Stake

func (*RPCClient) StakeNew

func (r *RPCClient) StakeNew(acc account.Account, delegate string, autoStake bool) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) StakeNewBeacon

func (r *RPCClient) StakeNewBeacon(acc account.Account) (*jsonresult.CreateTransactionResult, error)

func (*RPCClient) StopAutoStake

func (*RPCClient) UnStake

type ReDelegateParam

type ReDelegateParam struct {
	BurnAddr           string
	StakerPrk          string
	CommitteePublicKey string
	NewDelegate        string
}

type StakingTxParam

type StakingTxParam struct {
	CommitteeKey *incognitokey.CommitteePublicKey
	BurnAddr     string
	StakerPrk    string
	MinerPrk     string
	RewardAddr   string
	StakeShard   bool
	AutoRestake  bool
	Name         string
}

type StopStakingParam

type StopStakingParam struct {
	BurnAddr  string
	StakerPrk string
	MinerPrk  string
}

Jump to

Keyboard shortcuts

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