Documentation ¶
Overview ¶
Package incclient provides a client for the Incognito RPC API.
Package incclient provides access to almost all functions needed to create transactions, become a node validator, retrieve information from full-nodes, shield or un-shield access, etc. It is the main focus of this sdk.
Index ¶
- Constants
- Variables
- func AssertPaymentAddressAndTxVersion(paymentAddress interface{}, version int8) (key.PaymentAddress, error)
- func BuildPDEPoolKey(token1ID string, token2ID string) string
- func BuildPDEShareKey(beaconHeight uint64, token1ID string, token2ID string, ...) ([]byte, error)
- func GenerateOTAFromPaymentAddress(paymentAddressStr string) (string, string, error)
- func GetListDecryptedCoins(privateKey string, listOutputCoins []jsonresult.ICoinInfo) ([]coin.PlainCoin, []string, error)
- func GetShardIDFromPaymentAddress(addrStr string) (byte, error)
- func GetShardIDFromPrivateKey(privateKey string) byte
- func NewCachedOutCoins() *cachedOutCoins
- func NewOutCoinKeyFromPrivateKey(privateKey string) (*rpc.OutCoinKey, error)
- func ParseCoinFromJsonResponse(b []byte) ([]jsonresult.ICoinInfo, []*big.Int, error)
- func PrivateKeyToMiningKey(privateKey string) string
- func PrivateKeyToPaymentAddress(privateKey string, keyType int) string
- func PrivateKeyToPrivateOTAKey(privateKey string) string
- func PrivateKeyToPublicKey(privateKey string) []byte
- func PrivateKeyToReadonlyKey(privateKey string) string
- func SaveTxHistory(txHistory *TxHistory, filePath string) error
- type BTCPortalV4Params
- type BridgeTokenInfo
- type BurnProof
- type CustomToken
- type EVMDepositProof
- type IncClient
- func NewIncClient(fullNode, ethNode string, version int, networks ...string) (*IncClient, error)
- func NewIncClientWithCache(fullNode, ethNode string, version int, networks ...string) (*IncClient, error)
- func NewLocalClient(port string) (*IncClient, error)
- func NewLocalClientWithCache() (*IncClient, error)
- func NewMainNetClient() (*IncClient, error)
- func NewMainNetClientWithCache() (*IncClient, error)
- func NewTestNet1Client() (*IncClient, error)
- func NewTestNet1ClientWithCache() (*IncClient, error)
- func NewTestNetClient() (*IncClient, error)
- func NewTestNetClientWithCache() (*IncClient, error)
- func (client *IncClient) AuthorizedSubmitKey(otaKey string, accessToken string, fromHeight uint64, isReset bool) error
- func (client *IncClient) CheckCoinsSpent(shardID byte, tokenID string, snList []string) ([]bool, error)
- func (client *IncClient) CheckPrice(tokenToSell, TokenToBuy string, sellAmount uint64) (uint64, error)
- func (client *IncClient) CheckShieldStatus(txHash string) (int, error)
- func (client *IncClient) CheckTradeStatus(txHash string) (int, error)
- func (client *IncClient) CheckTxInBlock(txHash string) (bool, error)
- func (client *IncClient) CheckXPrice(tokenToSell, TokenToBuy string, sellAmount uint64) (uint64, error)
- func (client *IncClient) Consolidate(privateKey, tokenIDStr string, version int8, numThreads int) ([]string, error)
- func (client *IncClient) ConsolidatePRVs(privateKey string, version int8, numThreads int) ([]string, error)
- func (client *IncClient) ConsolidateTokenV1s(privateKey, tokenIDStr string, numThreads int) ([]string, error)
- func (client *IncClient) ConsolidateTokenV2s(privateKey, tokenIDStr string, numThreads int) ([]string, error)
- func (client *IncClient) ConvertAllUTXOs(privateKey, tokenIDStr string, numThreads int) ([]string, error)
- func (client *IncClient) CreateAndSendBurningPRVPeggingRequestTransaction(privateKey, remoteAddress string, burnedAmount uint64, isBSC ...bool) (string, error)
- func (client *IncClient) CreateAndSendBurningRequestTransaction(privateKey, remoteAddress, tokenIDStr string, burnedAmount uint64, ...) (string, error)
- func (client *IncClient) CreateAndSendIssuingEVMRequestTransaction(privateKey, tokenIDStr string, proof EVMDepositProof, isBSC ...bool) (string, error)
- func (client *IncClient) CreateAndSendIssuingPRVPeggingRequestTransaction(privateKey string, proof EVMDepositProof, isBSC ...bool) (string, error)
- func (client *IncClient) CreateAndSendPDEContributeTransaction(privateKey, pairID, tokenID string, amount uint64, version int8) (string, error)
- func (client *IncClient) CreateAndSendPDETradeTransaction(privateKey, tokenIDToSell, tokenIDToBuy string, ...) (string, error)
- func (client *IncClient) CreateAndSendPDEWithdrawalTransaction(privateKey, tokenID1, tokenID2 string, sharedAmount uint64, version int8) (string, error)
- func (client *IncClient) CreateAndSendPortalConvertVaultTransaction(privateKey, tokenID, paymentAddr, convertingProof string, ...) (string, error)
- func (client *IncClient) CreateAndSendPortalRelayHeaderTransaction(privateKey, paymentAddr, header string, blockHeight uint64, ...) (string, error)
- func (client *IncClient) CreateAndSendPortalReplaceByFeeTransaction(privateKey, tokenID, batchID string, fee uint, inputCoins []coin.PlainCoin, ...) (string, error)
- func (client *IncClient) CreateAndSendPortalShieldTransaction(privateKey, tokenID, paymentAddr, shieldingProof string, ...) (string, error)
- func (client *IncClient) CreateAndSendPortalSubmitConfirmationTransaction(privateKey, tokenID, unShieldProof, batchID string, ...) (string, error)
- func (client *IncClient) CreateAndSendPortalUnShieldTransaction(privateKey, tokenID, remoteAddr string, unShieldingAmount uint64, ...) (string, error)
- func (client *IncClient) CreateAndSendRawConversionTransaction(privateKey string, tokenID string) (string, error)
- func (client *IncClient) CreateAndSendRawTokenTransaction(privateKey string, addrList []string, amountList []uint64, tokenID string, ...) (string, error)
- func (client *IncClient) CreateAndSendRawTransaction(privateKey string, addrList []string, amountList []uint64, version int8, ...) (string, error)
- func (client *IncClient) CreateAndSendShardStakingTransaction(privateKey, privateSeed, candidateAddr, rewardReceiverAddr string, ...) (string, error)
- func (client *IncClient) CreateAndSendUnStakingTransaction(privateKey, privateSeed, candidateAddr string) (string, error)
- func (client *IncClient) CreateAndSendWithDrawRewardTransaction(privateKey, addr, tokenIDStr string, version int8) (string, error)
- func (client *IncClient) CreateBurningPRVPeggingRequestTransaction(privateKey, remoteAddress string, burnedAmount uint64, isBSC ...bool) ([]byte, string, error)
- func (client *IncClient) CreateBurningRequestTransaction(privateKey, remoteAddress, tokenIDStr string, burnedAmount uint64, ...) ([]byte, string, error)
- func (client *IncClient) CreateConversionTransactionWithInputCoins(privateKey string, coinV1List []coin.PlainCoin) ([]byte, string, error)
- func (client *IncClient) CreateIssuingEVMRequestTransaction(privateKey, tokenIDStr string, proof EVMDepositProof, isBSC ...bool) ([]byte, string, error)
- func (client *IncClient) CreateIssuingPRVPeggingRequestTransaction(privateKey string, proof EVMDepositProof, isBSC ...bool) ([]byte, string, error)
- func (client *IncClient) CreatePDEContributeTransaction(privateKey, pairID, tokenID string, amount uint64, version int8) ([]byte, string, error)
- func (client *IncClient) CreatePDETradeTransaction(privateKey, tokenIDToSell, tokenIDToBuy string, ...) ([]byte, string, error)
- func (client *IncClient) CreatePDETradeTransactionVer1(privateKey, tokenIDToSell, tokenIDToBuy string, ...) ([]byte, string, error)
- func (client *IncClient) CreatePDETradeTransactionVer2(privateKey, tokenIDToSell, tokenIDToBuy string, amount uint64, ...) ([]byte, string, error)
- func (client *IncClient) CreatePDEWithdrawalTransaction(privateKey, tokenID1, tokenID2 string, sharedAmount uint64, version int8) ([]byte, string, error)
- func (client *IncClient) CreatePortalConvertVaultTransaction(privateKey, tokenID, paymentAddr, convertingProof string, ...) ([]byte, string, error)
- func (client *IncClient) CreatePortalRelayHeaderTransaction(privateKey, paymentAddr, header string, blockHeight uint64, ...) ([]byte, string, error)
- func (client *IncClient) CreatePortalReplaceByFeeTransaction(privateKey, tokenID, batchID string, fee uint, inputCoins []coin.PlainCoin, ...) ([]byte, string, error)
- func (client *IncClient) CreatePortalShieldTransaction(privateKey, tokenID, paymentAddr, shieldingProof string, ...) ([]byte, string, error)
- func (client *IncClient) CreatePortalSubmitConfirmationTransaction(privateKey, tokenID, unShieldProof, batchID string, ...) ([]byte, string, error)
- func (client *IncClient) CreatePortalUnShieldTransaction(privateKey, tokenID, remoteAddr string, unShieldingAmount uint64, ...) ([]byte, string, error)
- func (client *IncClient) CreateRawConversionTransaction(privateKey string) ([]byte, string, error)
- func (client *IncClient) CreateRawTokenConversionTransaction(privateKey, tokenIDStr string) ([]byte, string, error)
- func (client *IncClient) CreateRawTokenTransaction(txParam *TxParam, version int8) ([]byte, string, error)
- func (client *IncClient) CreateRawTokenTransactionVer1(txParam *TxParam) ([]byte, string, error)
- func (client *IncClient) CreateRawTokenTransactionVer2(txParam *TxParam) ([]byte, string, error)
- func (client *IncClient) CreateRawTokenTransactionWithInputCoins(txParam *TxParam, tokenInCoins []coin.PlainCoin, tokenIndices []uint64, ...) ([]byte, string, error)
- func (client *IncClient) CreateRawTransaction(param *TxParam, version int8) ([]byte, string, error)
- func (client *IncClient) CreateRawTransactionVer1(param *TxParam) ([]byte, string, error)
- func (client *IncClient) CreateRawTransactionVer2(param *TxParam) ([]byte, string, error)
- func (client *IncClient) CreateRawTransactionWithInputCoins(param *TxParam, inputCoins []coin.PlainCoin, coinIndices []uint64) ([]byte, string, error)
- func (client *IncClient) CreateShardStakingTransaction(privateKey, privateSeed, candidateAddr, rewardReceiverAddr string, ...) ([]byte, string, error)
- func (client *IncClient) CreateTokenConversionTransactionWithInputCoins(privateKey, tokenIDStr string, tokenInCoins []coin.PlainCoin, ...) ([]byte, string, error)
- func (client *IncClient) CreateTokenInitTransaction(privateKey, tokenName, tokenSymbol string, amount uint64, version int) ([]byte, string, error)
- func (client *IncClient) CreateTokenInitTransactionV1(privateKey, _, _ string, amount uint64) ([]byte, string, error)
- func (client *IncClient) CreateTokenInitTransactionV2(privateKey, tokenName, tokenSymbol string, amount uint64) ([]byte, string, error)
- func (client *IncClient) CreateUnStakingTransaction(privateKey, privateSeed, candidateAddr string) ([]byte, string, error)
- func (client *IncClient) CreateWithDrawRewardTransaction(privateKey, addr, tokenIDStr string, version int8) ([]byte, string, error)
- func (client *IncClient) GeneratePortalShieldingAddress(paymentAddressStr, tokenIDStr string) (string, error)
- func (client *IncClient) GetActiveShard() (int, error)
- func (client *IncClient) GetAllAssetTags() (map[string]*common.Hash, error)
- func (client *IncClient) GetAllPDEPoolPairs(beaconHeight uint64) (map[string]*jsonresult.PoolInfo, error)
- func (client *IncClient) GetAllShares(beaconHeight uint64, paymentAddress string) ([]*Share, error)
- func (client *IncClient) GetAndCacheOutCoins(outCoinKey *rpc.OutCoinKey, tokenID string) ([]jsonresult.ICoinInfo, []*big.Int, error)
- func (client *IncClient) GetBalance(privateKey, tokenID string) (uint64, error)
- func (client *IncClient) GetBeaconBestState(shardID int) (*jsonresult.BeaconBestState, error)
- func (client *IncClient) GetBestBlock() (map[int]uint64, error)
- func (client *IncClient) GetBridgeTokens() ([]*BridgeTokenInfo, error)
- func (client *IncClient) GetBurnPRVPeggingProof(txHash string, isBSC ...bool) (*jsonresult.InstructionProof, error)
- func (client *IncClient) GetBurnProof(txHash string, isBSC ...bool) (*jsonresult.InstructionProof, error)
- func (client *IncClient) GetCommitteeStateByShard(shardID int, shardRootHash string) (*jsonresult.ShardCommitteeState, error)
- func (client *IncClient) GetEVMBlockByHash(blockHash string, isOnBSC ...bool) (map[string]interface{}, error)
- func (client *IncClient) GetEVMDepositProof(txHash string, isOnBSC ...bool) (*EVMDepositProof, uint64, error)
- func (client *IncClient) GetEVMTransactionStatus(txHash string, isOnBSC ...bool) (int, error)
- func (client *IncClient) GetEVMTxByHash(txHash string, isOnBSC ...bool) (map[string]interface{}, error)
- func (client *IncClient) GetEVMTxReceipt(txHash string, isOnBSC ...bool) (*types.Receipt, error)
- func (client *IncClient) GetKeySubmissionStatus(otaKey string) (int, error)
- func (client *IncClient) GetListDecryptedOutCoin(privateKey string, tokenID string, height uint64) (map[string]coin.PlainCoin, error)
- func (client *IncClient) GetListToken() (map[string]CustomToken, error)
- func (client *IncClient) GetListTxsIn(privateKey string, tokenIDStr string) ([]TxIn, error)
- func (client *IncClient) GetListTxsInV1(privateKey string, tokenIDStr string) ([]TxIn, error)
- func (client *IncClient) GetListTxsInV2(privateKey string, tokenIDStr string) ([]TxIn, error)
- func (client *IncClient) GetListTxsOut(privateKey string, tokenIDStr string) ([]TxOut, error)
- func (client *IncClient) GetListTxsOutV1(privateKey string, tokenIDStr string) ([]TxOut, error)
- func (client *IncClient) GetListTxsOutV2(privateKey string, tokenIDStr string) ([]TxOut, error)
- func (client *IncClient) GetMiningInfo() (*jsonresult.MiningInfoResult, error)
- func (client *IncClient) GetMostRecentEVMBlockNumber(isOnBSC ...bool) (uint64, error)
- func (client *IncClient) GetOTACoinLength() (map[string]map[byte]uint64, error)
- func (client *IncClient) GetOTACoinLengthByShard(shardID byte, tokenID string) (uint64, error)
- func (client *IncClient) GetOTACoinsByIndices(shardID byte, tokenID string, idxList []uint64) (map[uint64]jsonresult.ICoinInfo, error)
- func (client *IncClient) GetOutputCoins(outCoinKey *rpc.OutCoinKey, tokenID string, height uint64, isFromCache ...bool) ([]jsonresult.ICoinInfo, []*big.Int, error)
- func (client *IncClient) GetOutputCoinsV1(outCoinKey *rpc.OutCoinKey, tokenID string, height uint64) ([]jsonresult.ICoinInfo, []*big.Int, error)
- func (client *IncClient) GetOutputCoinsV2(outCoinKey *rpc.OutCoinKey, tokenID string, upToHeight uint64) ([]jsonresult.ICoinInfo, []*big.Int, error)
- func (client *IncClient) GetPDEPoolPair(beaconHeight uint64, tokenID1, tokenID2 string) (*jsonresult.PoolInfo, error)
- func (client *IncClient) GetPDEState(beaconHeight uint64) (*jsonresult.CurrentPDEState, error)
- func (client *IncClient) GetPortalShieldingRequestStatus(shieldID string) (*metadata.PortalShieldingRequestStatus, error)
- func (client *IncClient) GetPortalUnShieldingRequestStatus(unShieldID string) (*metadata.PortalUnshieldRequestStatus, error)
- func (client *IncClient) GetRawMemPool() ([]string, error)
- func (client *IncClient) GetReceivingInfo(txHash string, otaKey string, readonlyKey ...string) (received bool, mapResult map[string]uint64, err error)
- func (client *IncClient) GetRewardAmount(paymentAddress string) (map[string]uint64, error)
- func (client *IncClient) GetShardBestState(shardID int) (*jsonresult.ShardBestState, error)
- func (client *IncClient) GetShareAmount(beaconHeight uint64, tokenID1, tokenID2, paymentAddress string) (uint64, error)
- func (client *IncClient) GetSpentOutputCoins(privateKey, tokenID string, height uint64) ([]coin.PlainCoin, []*big.Int, error)
- func (client *IncClient) GetSyncStats() (*jsonresult.SyncStats, error)
- func (client *IncClient) GetTokenFee(shardID byte, tokenIDStr string) (uint64, error)
- func (client *IncClient) GetTotalSharesAmount(beaconHeight uint64, tokenID1, tokenID2 string) (uint64, error)
- func (client *IncClient) GetTransactionHashesByReceiver(paymentAddress string) ([]string, error)
- func (client *IncClient) GetTransactionsByPublicKeys(publicKeys []string) (map[string]map[string]metadata.Transaction, error)
- func (client *IncClient) GetTransactionsByReceiver(paymentAddress string) (map[string]metadata.Transaction, error)
- func (client *IncClient) GetTx(txHash string) (metadata.Transaction, error)
- func (client *IncClient) GetTxDetail(txHash string) (*jsonresult.TransactionDetail, error)
- func (client *IncClient) GetTxHashByPublicKeys(publicKeys []string) (map[string][]string, error)
- func (client *IncClient) GetTxHashBySerialNumbers(snList []string, tokenIDStr string, shardID byte) (map[string]string, error)
- func (client *IncClient) GetTxHistoryV1(privateKey string, tokenIDStr string) (*TxHistory, error)
- func (client *IncClient) GetTxHistoryV2(privateKey string, tokenIDStr string) (*TxHistory, error)
- func (client *IncClient) GetTxs(txHashList []string, hashReCheck ...bool) (map[string]metadata.Transaction, error)
- func (client *IncClient) GetUnspentOutputCoins(privateKey, tokenID string, height uint64) ([]coin.PlainCoin, []*big.Int, error)
- func (client *IncClient) GetUnspentOutputCoinsFromCache(privateKey, tokenID string, height uint64, reSync ...bool) ([]coin.PlainCoin, []*big.Int, error)
- func (client *IncClient) ImportAccount(mnemonic string) ([]*wallet.KeyWallet, error)
- func (client *IncClient) ListReward() (map[string]map[common.Hash]uint64, error)
- func (client *IncClient) NewRPCCall(jsonRPC, method string, params []interface{}, id interface{}) ([]byte, error)
- func (client *IncClient) SendRawTokenTx(encodedTx []byte) error
- func (client *IncClient) SendRawTx(encodedTx []byte) error
- func (client *IncClient) SubmitKey(otaKey string) error
- type IncLogger
- type KeyInfo
- type Share
- type TxHistory
- type TxHistoryInterface
- type TxHistoryProcessor
- func (p *TxHistoryProcessor) GetTokenHistory(privateKey string, tokenIDStr string) (*TxHistory, error)
- func (p *TxHistoryProcessor) GetTxsIn(privateKey string, tokenIDStr string, version int8) ([]TxIn, error)
- func (p *TxHistoryProcessor) GetTxsOut(privateKey string, tokenIDStr string, version int8) ([]TxOut, error)
- type TxHistoryWorker
- type TxIn
- type TxOut
- type TxParam
- type TxTokenParam
Constants ¶
const ( MainNetETHContractAddressStr = "0x43D037A562099A4C2c95b1E2120cc43054450629" MainNetBSCContractAddressStr = "0x43D037A562099A4C2c95b1E2120cc43054450629" MainNetPRVERC20ContractAddressStr = "0xB64fde8f199F073F41c132B9eC7aD5b61De0B1B7" MainNetPRVBEP20ContractAddressStr = "0xB64fde8f199F073F41c132B9eC7aD5b61De0B1B7" MainNetFullNode = "https://beta-fullnode.incognito.org/fullnode" MainNetETHHost = "https://mainnet.infura.io/v3/34918000975d4374a056ed78fe21c517" MainNetBSCHost = "https://bsc-dataseed.binance.org" MainNetPrivacyVersion = 2 )
MainNet config
const ( TestNetETHContractAddressStr = "0x2f6F03F1b43Eab22f7952bd617A24AB46E970dF7" TestNetBSCContractAddressStr = "0x2f6F03F1b43Eab22f7952bd617A24AB46E970dF7" TestNetPRVERC20ContractAddressStr = "0xaE61fEFD69BacF3951F1C86c9A4D3F006810Ac21" TestNetPRVBEP20ContractAddressStr = "0xB49E8844a72CF1ce885aEf13F82BeeAEEFc01527" TestNetFullNode = "https://testnet.incognito.org/fullnode" TestNetETHHost = "https://kovan.infura.io/v3/93fe721349134964aa71071a713c5cef" TestNetBSCHost = "https://data-seed-prebsc-2-s1.binance.org:8545" TestNetPrivacyVersion = 2 )
TestNet config
const ( TestNet1ETHContractAddressStr = "0xE0D5e7217c6C4bc475404b26d763fAD3F14D2b86" TestNet1BSCContractAddressStr = "0x1ce57B254DC2DBB41e1aeA296Dc7dBD6fb549241" TestNet1PRVERC20ContractAddressStr = "0x917637E3E1ee531231747690189e22C5FA38D88C" TestNet1PRVBEP20ContractAddressStr = "0x3d2E0c1b0b2d81D1A76544E6cC08670af9b86531" TestNet1FullNode = "https://testnet1.incognito.org/fullnode" TestNet1ETHHost = "https://kovan.infura.io/v3/93fe721349134964aa71071a713c5cef" TestNet1BSCHost = "https://data-seed-prebsc-2-s1.binance.org:8545" TestNet1PrivacyVersion = 2 )
TestNet1 config
const ( LocalETHContractAddressStr = "0x2f6F03F1b43Eab22f7952bd617A24AB46E970dF7" LocalFullNode = "http://127.0.0.1:8334" LocalETHHost = "https://kovan.infura.io/v3/93fe721349134964aa71071a713c5cef" LocalPrivacyVersion = 2 )
Local config
const ( DefaultPRVFee = uint64(100) MaxInputSize = 30 MaxOutputSize = 30 )
const ( DefaultTxIn = "txIn_history.csv" DefaultTxOut = "txOut_history.csv" DefaultTxHistory = "txHistory.csv" )
Variables ¶
var Logger = NewLogger(false)
Logger prints necessary information during the use of the IncClient. Set Logger.IsEnable to true to print all the logs of this instance while using it. By default, it is disabled. For testing purposes, it should be enabled for devs to understand the running path of active functions.
Functions ¶
func AssertPaymentAddressAndTxVersion ¶
func AssertPaymentAddressAndTxVersion(paymentAddress interface{}, version int8) (key.PaymentAddress, error)
AssertPaymentAddressAndTxVersion checks if a string payment address is supported by the underlying transaction.
func BuildPDEPoolKey ¶
BuildPDEPoolKey constructs a key for a pool in pDEX.
func BuildPDEShareKey ¶
func BuildPDEShareKey(beaconHeight uint64, token1ID string, token2ID string, contributorAddress string) ([]byte, error)
BuildPDEShareKey constructs a key for retrieving contributed shares in pDEX.
func GenerateOTAFromPaymentAddress ¶
GenerateOTAFromPaymentAddress generates a random one-time address, and TxRandom from a payment address.
func GetListDecryptedCoins ¶
func GetListDecryptedCoins(privateKey string, listOutputCoins []jsonresult.ICoinInfo) ([]coin.PlainCoin, []string, error)
GetListDecryptedCoins decrypts a list of ICoinInfo's using the given private key.
func GetShardIDFromPaymentAddress ¶
GetShardIDFromPaymentAddress returns the shardID where the payment address resides in.
If the private key is invalid, it returns 255.
func GetShardIDFromPrivateKey ¶
GetShardIDFromPrivateKey returns the shardID where the private key resides in.
If the private key is invalid, it returns 255.
func NewCachedOutCoins ¶
func NewCachedOutCoins() *cachedOutCoins
func NewOutCoinKeyFromPrivateKey ¶
func NewOutCoinKeyFromPrivateKey(privateKey string) (*rpc.OutCoinKey, error)
NewOutCoinKeyFromPrivateKey creates a new rpc.OutCoinKey given the private key.
func ParseCoinFromJsonResponse ¶
ParseCoinFromJsonResponse parses raw coin data returned from an RPC request into a list of ICoinInfo.
func PrivateKeyToMiningKey ¶
PrivateKeyToMiningKey returns the mining key of a private key.
func PrivateKeyToPaymentAddress ¶
PrivateKeyToPaymentAddress returns the payment address for its private key corresponding to the key type. KeyType should be -1, 0, 1 where
- -1: payment address of version 2
- 0: payment address of version 1 with old encoding
- 1: payment address of version 1 with new encoding
func PrivateKeyToPrivateOTAKey ¶
PrivateKeyToPrivateOTAKey returns the private OTA key of a private key.
If the private key is invalid, it returns an empty string.
func PrivateKeyToPublicKey ¶
PrivateKeyToPublicKey returns the public key of a private key.
If the private key is invalid, it returns nil.
func PrivateKeyToReadonlyKey ¶
PrivateKeyToReadonlyKey returns the readonly key of a private key.
If the private key is invalid, it returns an empty string.
func SaveTxHistory ¶
SaveTxHistory saves a TxHistory in a csv file.
Types ¶
type BTCPortalV4Params ¶
type BTCPortalV4Params struct { MasterPubKeys [][]byte NumRequiredSigs uint MinUnshieldAmount uint64 ChainParams *chaincfg.Params TokenID string }
BTCPortalV4Params is a simplified version of the corresponding v4 portal param used in the Incognito network for the BTC token.
type BridgeTokenInfo ¶
type BridgeTokenInfo struct { TokenID *common.Hash `json:"tokenId"` Amount uint64 `json:"amount"` ExternalTokenID []byte `json:"externalTokenId"` Network string `json:"network"` IsCentralized bool `json:"isCentralized"` }
BridgeTokenInfo describes the information of a bridge token.
type BurnProof ¶
type BurnProof struct { Instruction []byte Heights [2]*big.Int InstPaths [2][][32]byte InstPathIsLefts [2][]bool InstRoots [2][32]byte BlkData [2][32]byte SigIndices [2][]*big.Int SigVs [2][]uint8 SigRs [2][][32]byte SigSs [2][][32]byte }
BurnProof represents a proof object submitted to smart contracts for the sake of un-shielding.
func DecodeBurnProof ¶
func DecodeBurnProof(r *jsonresult.InstructionProof) (*BurnProof, error)
DecodeBurnProof decodes a burn proof from the Incognito chain into a BurnProof.
type CustomToken ¶
type CustomToken struct {
// contains filtered or unexported fields
}
CustomToken represents information of a token.
func (CustomToken) ToString ¶
func (ct CustomToken) ToString() string
ToString returns the string-representation of a CustomToken.
type EVMDepositProof ¶
type EVMDepositProof struct {
// contains filtered or unexported fields
}
EVMDepositProof represents a proof for depositing tokens to the smart contracts.
func NewETHDepositProof ¶
func NewETHDepositProof(blockNumber uint, blockHash ethCommon.Hash, txIdx uint, nodeList []string) *EVMDepositProof
NewETHDepositProof creates a new EVMDepositProof with the given parameters.
func (EVMDepositProof) BlockHash ¶
func (E EVMDepositProof) BlockHash() ethCommon.Hash
BlockHash returns the block hash of an EVMDepositProof.
func (EVMDepositProof) BlockNumber ¶
func (E EVMDepositProof) BlockNumber() uint
BlockNumber returns the block number of an EVMDepositProof.
func (EVMDepositProof) NodeList ¶
func (E EVMDepositProof) NodeList() []string
NodeList returns the node list of an EVMDepositProof.
func (EVMDepositProof) TxIdx ¶
func (E EVMDepositProof) TxIdx() uint
TxIdx returns the transaction index of an EVMDepositProof.
type IncClient ¶
type IncClient struct {
// contains filtered or unexported fields
}
IncClient defines the environment with which users want to interact.
func NewIncClient ¶
NewIncClient creates a new IncClient from given parameters.
Specify which network the client is interacting with by the parameter `networks`. A valid network is one of the following: mainnet, testnet, testnet1, local. By default, this function will initialize a main-net client if no value is assigned to `networks`. Note that only the first value passed to `networks` is processed.
func NewIncClientWithCache ¶
func NewIncClientWithCache(fullNode, ethNode string, version int, networks ...string) (*IncClient, error)
NewIncClientWithCache creates a new IncClient from given parameters. It also creates a cache instance for locally saving UTXOs.
Specify which network the client is interacting with by the parameter `networks`. A valid network is one of the following: mainnet, testnet, testnet1, local. By default, this function will initialize a main-net client if no value is assigned to `networks`. Note that only the first value passed to `networks` is processed.
func NewLocalClient ¶
NewLocalClient creates a new IncClient with the local environment.
func NewLocalClientWithCache ¶
NewLocalClientWithCache creates a new IncClient with the local environment. It also creates a cache instance for locally saving UTXOs.
func NewMainNetClient ¶
NewMainNetClient creates a new IncClient with the main-net environment.
func NewMainNetClientWithCache ¶
NewMainNetClientWithCache creates a new IncClient with the main-net environment. It also creates a cache instance for locally saving UTXOs.
func NewTestNet1Client ¶
NewTestNet1Client creates a new IncClient with the test-net 1 environment.
func NewTestNet1ClientWithCache ¶
NewTestNet1ClientWithCache creates a new IncClient with the test-net-1 environment. It also creates a cache instance for locally saving UTXOs.
func NewTestNetClient ¶
NewTestNetClient creates a new IncClient with the test-net environment.
func NewTestNetClientWithCache ¶
NewTestNetClientWithCache creates a new IncClient with the test-net environment. It also creates a cache instance for locally saving UTXOs.
func (*IncClient) AuthorizedSubmitKey ¶
func (client *IncClient) AuthorizedSubmitKey(otaKey string, accessToken string, fromHeight uint64, isReset bool) error
AuthorizedSubmitKey handles submitting OTA keys in an authorized manner.
func (*IncClient) CheckCoinsSpent ¶
func (client *IncClient) CheckCoinsSpent(shardID byte, tokenID string, snList []string) ([]bool, error)
CheckCoinsSpent checks if the provided serial numbers have been spent or not.
Returned result in boolean list.
func (*IncClient) CheckPrice ¶
func (client *IncClient) CheckPrice(tokenToSell, TokenToBuy string, sellAmount uint64) (uint64, error)
CheckPrice gets the remote server to check price for trading things.
func (*IncClient) CheckShieldStatus ¶
CheckShieldStatus returns the status of an eth-shielding request.
- -1: error
- 0: tx not found
- 1: tx is pending
- 2: tx is accepted
- 3: tx is rejected
func (*IncClient) CheckTradeStatus ¶
CheckTradeStatus checks the status of a trading transaction. It returns
- -1: if an error occurred;
- 1: if the trade is accepted;
- 2: if the trade is not accepted.
func (*IncClient) CheckTxInBlock ¶
CheckTxInBlock checks if a transaction has been included in a block or not.
func (*IncClient) CheckXPrice ¶
func (client *IncClient) CheckXPrice(tokenToSell, TokenToBuy string, sellAmount uint64) (uint64, error)
CheckXPrice gets the remote server to check cross price for trading things (for cross-pool tokens).
func (*IncClient) Consolidate ¶
func (client *IncClient) Consolidate(privateKey, tokenIDStr string, version int8, numThreads int) ([]string, error)
Consolidate consolidates the list of UTXOs of an account for the given tokenIDStr. It uses a number of threads working simultaneously to boost up the consolidating speed.
func (*IncClient) ConsolidatePRVs ¶
func (client *IncClient) ConsolidatePRVs(privateKey string, version int8, numThreads int) ([]string, error)
ConsolidatePRVs consolidates the list of UTXOs of an account, with the given version into a smaller group whose size is at most 10.
func (*IncClient) ConsolidateTokenV1s ¶
func (client *IncClient) ConsolidateTokenV1s(privateKey, tokenIDStr string, numThreads int) ([]string, error)
ConsolidateTokenV1s consolidates the list of token UTXOs V1 of an account, with the given version into a smaller group whose size is at most 10.
func (*IncClient) ConsolidateTokenV2s ¶
func (client *IncClient) ConsolidateTokenV2s(privateKey, tokenIDStr string, numThreads int) ([]string, error)
ConsolidateTokenV2s consolidates the list of token UTXOs V2 of an account, with the given version into a smaller group whose size is at most 10.
func (*IncClient) ConvertAllUTXOs ¶
func (client *IncClient) ConvertAllUTXOs(privateKey, tokenIDStr string, numThreads int) ([]string, error)
ConvertAllUTXOs converts all UTXOs of an account for the given tokenIDStr. It uses a number of threads working simultaneously to boost up the speed. All of UTXOs v1 will be converted into UTXOs v2, therefore, this process is time-consuming and should be run with care. In case you only want to run a single conversion transaction at a time, consider using CreateAndSendRawConversionTransaction for better performance.
Parameters:
- privateKey: your private key.
- tokenIDStr: the id of the asset being converted.
- numThreads: the number of workers working simultaneously to convert UTXOs.
func (*IncClient) CreateAndSendBurningPRVPeggingRequestTransaction ¶
func (client *IncClient) CreateAndSendBurningPRVPeggingRequestTransaction( privateKey, remoteAddress string, burnedAmount uint64, isBSC ...bool, ) (string, error)
CreateAndSendBurningPRVPeggingRequestTransaction creates a PRV pegging burning transaction for exiting the Incognito network, and submits it to the network.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendBurningRequestTransaction ¶
func (client *IncClient) CreateAndSendBurningRequestTransaction(privateKey, remoteAddress, tokenIDStr string, burnedAmount uint64, isBSC ...bool) (string, error)
CreateAndSendBurningRequestTransaction creates an EVM burning transaction for exiting the Incognito network, and submits it to the network.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendIssuingEVMRequestTransaction ¶
func (client *IncClient) CreateAndSendIssuingEVMRequestTransaction(privateKey, tokenIDStr string, proof EVMDepositProof, isBSC ...bool) (string, error)
CreateAndSendIssuingEVMRequestTransaction creates an EVM shielding transaction, and submits it to the Incognito network.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendIssuingPRVPeggingRequestTransaction ¶
func (client *IncClient) CreateAndSendIssuingPRVPeggingRequestTransaction( privateKey string, proof EVMDepositProof, isBSC ...bool) (string, error)
CreateAndSendIssuingPRVPeggingRequestTransaction creates a PRV pegging shielding transaction, and submits it to the Incognito network.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendPDEContributeTransaction ¶
func (client *IncClient) CreateAndSendPDEContributeTransaction(privateKey, pairID, tokenID string, amount uint64, version int8) (string, error)
CreateAndSendPDEContributeTransaction creates a contributing transaction which contributes an amount of tokenID to the pDEX, and then submits it to the Incognito network. Version = -1 indicates that whichever version is accepted.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendPDETradeTransaction ¶
func (client *IncClient) CreateAndSendPDETradeTransaction(privateKey, tokenIDToSell, tokenIDToBuy string, amount, expectedBuy, tradingFee uint64) (string, error)
CreateAndSendPDETradeTransaction creates a trading transaction with the provided version, and submits it to the Incognito network.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendPDEWithdrawalTransaction ¶
func (client *IncClient) CreateAndSendPDEWithdrawalTransaction(privateKey, tokenID1, tokenID2 string, sharedAmount uint64, version int8) (string, error)
CreateAndSendPDEWithdrawalTransaction creates a withdrawing transaction which withdraws a pair of tokenIDs from the pDEX, and submits it to the Incognito network. Version = -1 indicates that whichever version is accepted.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendPortalConvertVaultTransaction ¶
func (client *IncClient) CreateAndSendPortalConvertVaultTransaction( privateKey, tokenID, paymentAddr, convertingProof string, inputCoins []coin.PlainCoin, coinIndices []uint64, ) (string, error)
CreateAndSendPortalConvertVaultTransaction creates a Portal V4 vault conversion transaction, and submits it to the Incognito network. This transaction SHOULD only be created only one time when migrating centralized bridge to portal v4.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendPortalRelayHeaderTransaction ¶
func (client *IncClient) CreateAndSendPortalRelayHeaderTransaction( privateKey, paymentAddr, header string, blockHeight uint64, inputCoins []coin.PlainCoin, coinIndices []uint64, ) (string, error)
CreateAndSendPortalRelayHeaderTransaction creates block header-relaying transaction used in the Portal V4 protocol, and submits it to the Incognito network.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendPortalReplaceByFeeTransaction ¶
func (client *IncClient) CreateAndSendPortalReplaceByFeeTransaction( privateKey, tokenID, batchID string, fee uint, inputCoins []coin.PlainCoin, coinIndices []uint64, ) (string, error)
CreateAndSendPortalReplaceByFeeTransaction creates a Portal V4 replace-by-fee transaction, and submits it to the Incognito network.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendPortalShieldTransaction ¶
func (client *IncClient) CreateAndSendPortalShieldTransaction( privateKey, tokenID, paymentAddr, shieldingProof string, inputCoins []coin.PlainCoin, coinIndices []uint64, ) (string, error)
CreateAndSendPortalShieldTransaction creates a Portal V4 shielding transaction, and submits it to the Incognito network.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendPortalSubmitConfirmationTransaction ¶
func (client *IncClient) CreateAndSendPortalSubmitConfirmationTransaction( privateKey, tokenID, unShieldProof, batchID string, inputCoins []coin.PlainCoin, coinIndices []uint64, ) (string, error)
CreateAndSendPortalSubmitConfirmationTransaction creates a Portal V4 confirmation submission transaction, and submits it to the Incognito network.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendPortalUnShieldTransaction ¶
func (client *IncClient) CreateAndSendPortalUnShieldTransaction( privateKey, tokenID, remoteAddr string, unShieldingAmount uint64, inputCoins []coin.PlainCoin, coinIndices []uint64, ) (string, error)
CreateAndSendPortalUnShieldTransaction creates a Portal V4 un-shielding transaction, and submits it to the Incognito network.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendRawConversionTransaction ¶
func (client *IncClient) CreateAndSendRawConversionTransaction(privateKey string, tokenID string) (string, error)
CreateAndSendRawConversionTransaction creates a PRV transaction that converts PRV coins version 1 to version 2 and broadcasts it to the network. This type of transactions is non-private by default.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendRawTokenTransaction ¶
func (client *IncClient) CreateAndSendRawTokenTransaction(privateKey string, addrList []string, amountList []uint64, tokenID string, version int8, md metadata.Metadata) (string, error)
CreateAndSendRawTokenTransaction creates a token transaction with the provided version, and submits it to the Incognito network. Version = -1 indicates that whichever version is accepted.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendRawTransaction ¶
func (client *IncClient) CreateAndSendRawTransaction(privateKey string, addrList []string, amountList []uint64, version int8, md metadata.Metadata) (string, error)
CreateAndSendRawTransaction creates a PRV transaction with the provided version, and submits it to the Incognito network. Version = -1 indicates that whichever version is accepted.
It returns the transaction's hash, and an error (if any).
func (*IncClient) CreateAndSendShardStakingTransaction ¶
func (client *IncClient) CreateAndSendShardStakingTransaction(privateKey, privateSeed, candidateAddr, rewardReceiverAddr string, autoStake bool) (string, error)
CreateAndSendShardStakingTransaction creates a raw staking transaction and broadcasts it to the blockchain.
func (*IncClient) CreateAndSendUnStakingTransaction ¶
func (client *IncClient) CreateAndSendUnStakingTransaction(privateKey, privateSeed, candidateAddr string) (string, error)
CreateAndSendUnStakingTransaction creates a raw un-staking transaction and broadcasts it to the blockchain.
func (*IncClient) CreateAndSendWithDrawRewardTransaction ¶
func (client *IncClient) CreateAndSendWithDrawRewardTransaction(privateKey, addr, tokenIDStr string, version int8) (string, error)
CreateAndSendWithDrawRewardTransaction creates a raw reward-withdrawing transaction and broadcasts it to the blockchain.
func (*IncClient) CreateBurningPRVPeggingRequestTransaction ¶
func (client *IncClient) CreateBurningPRVPeggingRequestTransaction( privateKey, remoteAddress string, burnedAmount uint64, isBSC ...bool, ) ([]byte, string, error)
CreateBurningPRVPeggingRequestTransaction creates a PRV pegging burning transaction for exiting the Incognito network.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateBurningRequestTransaction ¶
func (client *IncClient) CreateBurningRequestTransaction(privateKey, remoteAddress, tokenIDStr string, burnedAmount uint64, isBSC ...bool) ([]byte, string, error)
CreateBurningRequestTransaction creates an EVM burning transaction for exiting the Incognito network.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateConversionTransactionWithInputCoins ¶
func (client *IncClient) CreateConversionTransactionWithInputCoins(privateKey string, coinV1List []coin.PlainCoin) ([]byte, string, error)
CreateConversionTransactionWithInputCoins convert a list of PRV UTXOs V1 into PRV UTXOs v2. Parameters:
- privateKey: the private key of the user.
- inputCoins: a list of decrypted, unspent PRV output coins (with the same version).
This function uses the DefaultPRVFee to pay the transaction fee.
NOTE: this servers PRV transactions only.
func (*IncClient) CreateIssuingEVMRequestTransaction ¶
func (client *IncClient) CreateIssuingEVMRequestTransaction(privateKey, tokenIDStr string, proof EVMDepositProof, isBSC ...bool) ([]byte, string, error)
CreateIssuingEVMRequestTransaction creates an EVM shielding trading transaction. By EVM, it means either ETH or BSC.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateIssuingPRVPeggingRequestTransaction ¶
func (client *IncClient) CreateIssuingPRVPeggingRequestTransaction( privateKey string, proof EVMDepositProof, isBSC ...bool, ) ([]byte, string, error)
CreateIssuingPRVPeggingRequestTransaction creates a shielding trading transaction. By EVM, it means either ETH or BSC.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreatePDEContributeTransaction ¶
func (client *IncClient) CreatePDEContributeTransaction(privateKey, pairID, tokenID string, amount uint64, version int8) ([]byte, string, error)
CreatePDEContributeTransaction creates a contributing transaction which contributes an amount of tokenID to the pDEX. Version = -1 indicates that whichever version is accepted.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreatePDETradeTransaction ¶
func (client *IncClient) CreatePDETradeTransaction(privateKey, tokenIDToSell, tokenIDToBuy string, amount, expectedBuy, tradingFee uint64, version int8) ([]byte, string, error)
CreatePDETradeTransaction creates a trading transaction with the provided version. Version = -1 indicates that whichever version is accepted.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreatePDETradeTransactionVer1 ¶
func (client *IncClient) CreatePDETradeTransactionVer1(privateKey, tokenIDToSell, tokenIDToBuy string, amount, expectedBuy, tradingFee uint64) ([]byte, string, error)
CreatePDETradeTransactionVer1 creates a trading transaction version 1.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreatePDETradeTransactionVer2 ¶
func (client *IncClient) CreatePDETradeTransactionVer2(privateKey, tokenIDToSell, tokenIDToBuy string, amount uint64, expectedBuy, tradingFee uint64) ([]byte, string, error)
CreatePDETradeTransactionVer2 creates a trading transaction version 2.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreatePDEWithdrawalTransaction ¶
func (client *IncClient) CreatePDEWithdrawalTransaction(privateKey, tokenID1, tokenID2 string, sharedAmount uint64, version int8) ([]byte, string, error)
CreatePDEWithdrawalTransaction creates a withdrawing transaction which withdraws a pair of tokenIDs from the pDEX. Version = -1 indicates that whichever version is accepted.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreatePortalConvertVaultTransaction ¶
func (client *IncClient) CreatePortalConvertVaultTransaction( privateKey, tokenID, paymentAddr, convertingProof string, inputCoins []coin.PlainCoin, coinIndices []uint64, ) ([]byte, string, error)
CreatePortalConvertVaultTransaction creates a Portal V4 vault conversion transaction. This transaction SHOULD only be created only one time when migrating centralized bridge to portal v4.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreatePortalRelayHeaderTransaction ¶
func (client *IncClient) CreatePortalRelayHeaderTransaction( privateKey, paymentAddr, header string, blockHeight uint64, inputCoins []coin.PlainCoin, coinIndices []uint64, ) ([]byte, string, error)
CreatePortalRelayHeaderTransaction creates block header-relaying transaction used in the Portal V4 protocol.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreatePortalReplaceByFeeTransaction ¶
func (client *IncClient) CreatePortalReplaceByFeeTransaction( privateKey, tokenID, batchID string, fee uint, inputCoins []coin.PlainCoin, coinIndices []uint64, ) ([]byte, string, error)
CreatePortalReplaceByFeeTransaction creates a Portal V4 replace-by-fee transaction.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreatePortalShieldTransaction ¶
func (client *IncClient) CreatePortalShieldTransaction( privateKey, tokenID, paymentAddr, shieldingProof string, inputCoins []coin.PlainCoin, coinIndices []uint64, ) ([]byte, string, error)
CreatePortalShieldTransaction creates a Portal V4 shielding transaction.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreatePortalSubmitConfirmationTransaction ¶
func (client *IncClient) CreatePortalSubmitConfirmationTransaction( privateKey, tokenID, unShieldProof, batchID string, inputCoins []coin.PlainCoin, coinIndices []uint64, ) ([]byte, string, error)
CreatePortalSubmitConfirmationTransaction creates a Portal V4 confirmation submission transaction.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreatePortalUnShieldTransaction ¶
func (client *IncClient) CreatePortalUnShieldTransaction( privateKey, tokenID, remoteAddr string, unShieldingAmount uint64, inputCoins []coin.PlainCoin, coinIndices []uint64, ) ([]byte, string, error)
CreatePortalUnShieldTransaction creates a Portal V4 un-shielding transaction.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateRawConversionTransaction ¶
CreateRawConversionTransaction creates a PRV transaction that converts PRV coins version 1 to version 2. This type of transactions is non-private by default.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateRawTokenConversionTransaction ¶
func (client *IncClient) CreateRawTokenConversionTransaction(privateKey, tokenIDStr string) ([]byte, string, error)
CreateRawTokenConversionTransaction creates a token transaction that converts token UTXOs version 1 to version 2. This type of transactions is non-private by default.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateRawTokenTransaction ¶
func (client *IncClient) CreateRawTokenTransaction(txParam *TxParam, version int8) ([]byte, string, error)
CreateRawTokenTransaction creates a token transaction with the provided version. Version = -1 indicates that whichever version is accepted.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateRawTokenTransactionVer1 ¶
CreateRawTokenTransactionVer1 creates a token transaction version 1.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateRawTokenTransactionVer2 ¶
CreateRawTokenTransactionVer2 creates a token transaction version 2.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateRawTokenTransactionWithInputCoins ¶
func (client *IncClient) CreateRawTokenTransactionWithInputCoins(txParam *TxParam, tokenInCoins []coin.PlainCoin, tokenIndices []uint64, prvInCoins []coin.PlainCoin, prvIndices []uint64, ) ([]byte, string, error)
CreateRawTokenTransactionWithInputCoins creates a raw token transaction from the provided input coins. Parameters:
- txParam: a regular TxParam.
- tokenInCoins: a list of decrypted, unspent token output coins (with the same version).
- tokenIndices: a list of corresponding indices for the token input coins. This value must not be `nil` if the caller is creating a transaction v2.
- prvInCoins: a list of decrypted, unspent PRV output coins for paying the transaction fee (if have).
- prvIndices: a list of corresponding indices for the prv input coins. This value must not be `nil` if the caller is creating a transaction v2.
For transaction with metadata, callers must make sure other values of `param` are valid.
NOTE: this servers PRV transactions only.
func (*IncClient) CreateRawTransaction ¶
CreateRawTransaction creates a PRV transaction with the provided version. Version = -1 indicates that whichever version is accepted.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateRawTransactionVer1 ¶
CreateRawTransactionVer1 creates a PRV transaction version 1.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateRawTransactionVer2 ¶
CreateRawTransactionVer2 creates a PRV transaction version 2.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateRawTransactionWithInputCoins ¶
func (client *IncClient) CreateRawTransactionWithInputCoins(param *TxParam, inputCoins []coin.PlainCoin, coinIndices []uint64) ([]byte, string, error)
CreateRawTransactionWithInputCoins creates a raw PRV transaction from the provided input coins. Parameters:
- param: a regular TxParam.
- inputCoins: a list of decrypted, unspent PRV output coins (with the same version).
- coinIndices: a list of corresponding indices for the input coins. This value must not be `nil` if the caller is creating a transaction v2.
For transaction with metadata, callers must make sure other values of `param` are valid.
NOTE: this servers PRV transactions only.
func (*IncClient) CreateShardStakingTransaction ¶
func (client *IncClient) CreateShardStakingTransaction(privateKey, privateSeed, candidateAddr, rewardReceiverAddr string, autoStake bool) ([]byte, string, error)
CreateShardStakingTransaction creates a raw staking transaction.
func (*IncClient) CreateTokenConversionTransactionWithInputCoins ¶
func (client *IncClient) CreateTokenConversionTransactionWithInputCoins(privateKey, tokenIDStr string, tokenInCoins []coin.PlainCoin, prvInCoins []coin.PlainCoin, prvIndices []uint64, ) ([]byte, string, error)
CreateTokenConversionTransactionWithInputCoins convert a list of token UTXOs V1 into PRV UTXOs v2. Parameters:
- privateKey: the private key of the user.
- tokenIDStr: the id of the asset being converted.
- tokenInCoins: a list of decrypted, unspent token output coins v1.
- prvInCoins: a list of decrypted, unspent PRV output coins v2 for paying the transaction fee.
- prvIndices: a list of corresponding indices for the prv input coins.
This function uses the DefaultPRVFee to pay the transaction fee. Callers must make sure the PRV input coins have enough value to cover the transaction fee.
func (*IncClient) CreateTokenInitTransaction ¶
func (client *IncClient) CreateTokenInitTransaction(privateKey, tokenName, tokenSymbol string, amount uint64, version int) ([]byte, string, error)
CreateTokenInitTransaction creates a token init transaction with the provided version. Version = -1 indicates that whichever version is accepted.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateTokenInitTransactionV1 ¶
func (client *IncClient) CreateTokenInitTransactionV1(privateKey, _, _ string, amount uint64) ([]byte, string, error)
CreateTokenInitTransactionV1 inits a new token version 1. In version 1, users are free to choose the tokenID of their own as long as it does not collide with any existing token in the Incognito network.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateTokenInitTransactionV2 ¶
func (client *IncClient) CreateTokenInitTransactionV2(privateKey, tokenName, tokenSymbol string, amount uint64) ([]byte, string, error)
CreateTokenInitTransactionV2 inits a new token version 2. In version 2, to ensure that no collision happens between the initialized tokenID and the existing ones. The new tokenID will be generated by the shard committee based on information given in the requesting transaction.
Note: that this transaction is a PRV transaction.
It returns the base58-encoded transaction, the transaction's hash, and an error (if any).
func (*IncClient) CreateUnStakingTransaction ¶
func (client *IncClient) CreateUnStakingTransaction(privateKey, privateSeed, candidateAddr string) ([]byte, string, error)
CreateUnStakingTransaction creates a raw un-staking transaction.
func (*IncClient) CreateWithDrawRewardTransaction ¶
func (client *IncClient) CreateWithDrawRewardTransaction(privateKey, addr, tokenIDStr string, version int8) ([]byte, string, error)
CreateWithDrawRewardTransaction creates a raw reward-withdrawing transaction.
func (*IncClient) GeneratePortalShieldingAddress ¶
func (client *IncClient) GeneratePortalShieldingAddress(paymentAddressStr, tokenIDStr string) (string, error)
GeneratePortalShieldingAddress returns the multi-sig shielding address for a given payment address and a tokenID.
func (*IncClient) GetActiveShard ¶
GetActiveShard returns the number of active shards on the Incognito network.
func (*IncClient) GetAllAssetTags ¶
GetAllAssetTags computes a mapping from raw assetTags to tokenIds (e.g, HashToPoint(PRV) => PRV).
func (*IncClient) GetAllPDEPoolPairs ¶
func (client *IncClient) GetAllPDEPoolPairs(beaconHeight uint64) (map[string]*jsonresult.PoolInfo, error)
GetAllPDEPoolPairs retrieves all pools in pDEX at the provided beacon height. If the beacon height is set to 0, it returns the latest pDEX pool pairs.
func (*IncClient) GetAllShares ¶
GetAllShares retrieves all shares in pDEX a user has contributed.
func (*IncClient) GetAndCacheOutCoins ¶
func (client *IncClient) GetAndCacheOutCoins(outCoinKey *rpc.OutCoinKey, tokenID string) ([]jsonresult.ICoinInfo, []*big.Int, error)
GetAndCacheOutCoins retrieves the list of output coins and caches them for faster retrieval later. This function should only be called after the cache is initialized.
func (*IncClient) GetBalance ¶
GetBalance retrieves the current tokenID balance of a private key.
func (*IncClient) GetBeaconBestState ¶
func (client *IncClient) GetBeaconBestState(shardID int) (*jsonresult.BeaconBestState, error)
GetBeaconBestState returns the latest state of the beacon chain.
func (*IncClient) GetBestBlock ¶
GetBestBlock returns the best blocks of the beacon chain and each shard.
func (*IncClient) GetBridgeTokens ¶
func (client *IncClient) GetBridgeTokens() ([]*BridgeTokenInfo, error)
GetBridgeTokens returns all bridge tokens in the network.
func (*IncClient) GetBurnPRVPeggingProof ¶
func (client *IncClient) GetBurnPRVPeggingProof(txHash string, isBSC ...bool) (*jsonresult.InstructionProof, error)
GetBurnPRVPeggingProof retrieves the burning proof for the Incognito network for submitting to the smart contract later.
func (*IncClient) GetBurnProof ¶
func (client *IncClient) GetBurnProof(txHash string, isBSC ...bool) (*jsonresult.InstructionProof, error)
GetBurnProof retrieves the burning proof for the Incognito network for submitting to the smart contract later.
func (*IncClient) GetCommitteeStateByShard ¶
func (client *IncClient) GetCommitteeStateByShard(shardID int, shardRootHash string) (*jsonresult.ShardCommitteeState, error)
GetCommitteeStateByShard retrieves the committee state of the shardID at the provided root hash, usually used for debugging purposes.
func (*IncClient) GetEVMBlockByHash ¶
func (client *IncClient) GetEVMBlockByHash(blockHash string, isOnBSC ...bool) (map[string]interface{}, error)
GetEVMBlockByHash retrieves an EVM block from its hash.
func (*IncClient) GetEVMDepositProof ¶
func (client *IncClient) GetEVMDepositProof(txHash string, isOnBSC ...bool) (*EVMDepositProof, uint64, error)
GetEVMDepositProof retrieves an EVM-depositing proof of a transaction hash.
func (*IncClient) GetEVMTransactionStatus ¶
GetEVMTransactionStatus returns the status of an EVM transaction.
func (*IncClient) GetEVMTxByHash ¶
func (client *IncClient) GetEVMTxByHash(txHash string, isOnBSC ...bool) (map[string]interface{}, error)
GetEVMTxByHash retrieves an EVM transaction from its hash.
func (*IncClient) GetEVMTxReceipt ¶
GetEVMTxReceipt retrieves an EVM transaction receipt from its hash.
func (*IncClient) GetKeySubmissionStatus ¶
GetKeySubmissionStatus returns the status of a submitted OTAKey. The returned state could be:
- 0: StatusNotSubmitted or ErrorOccurred
- 1: StatusIndexing
- 2: StatusKeySubmittedUsual
- 3: StatusIndexingFinished
func (*IncClient) GetListDecryptedOutCoin ¶
func (client *IncClient) GetListDecryptedOutCoin(privateKey string, tokenID string, height uint64) (map[string]coin.PlainCoin, error)
GetListDecryptedOutCoin retrieves and decrypts all the output tokens for a private key. It returns
- a map from the serial number to the output coin;
- error (if any).
func (*IncClient) GetListToken ¶
func (client *IncClient) GetListToken() (map[string]CustomToken, error)
GetListToken returns all tokens currently on the Incognito network.
func (*IncClient) GetListTxsIn ¶
GetListTxsIn returns a list of all in-coming tokenIDStr transactions to a private key.
func (*IncClient) GetListTxsInV1 ¶
GetListTxsInV1 returns a list of all in-coming tokenIDStr transactions (V1) to a private key.
func (*IncClient) GetListTxsInV2 ¶
GetListTxsInV2 returns a list of all in-coming tokenIDStr transactions (V2) to a private key.
func (*IncClient) GetListTxsOut ¶
GetListTxsOut returns a list of all out-coming tokenIDStr transactions of a private key.
func (*IncClient) GetListTxsOutV1 ¶
GetListTxsOutV1 returns a list of all out-going tokenIDStr transactions (V1) of a private key.
func (*IncClient) GetListTxsOutV2 ¶
GetListTxsOutV2 returns a list of all out-going tokenIDStr transactions (V2) of a private key.
func (*IncClient) GetMiningInfo ¶
func (client *IncClient) GetMiningInfo() (*jsonresult.MiningInfoResult, error)
GetMiningInfo returns the mining information of a node.
Create an IncClient instance pointing to your node and call this function to gather the node's mining information.
func (*IncClient) GetMostRecentEVMBlockNumber ¶
GetMostRecentEVMBlockNumber retrieves the most recent EVM block number.
func (*IncClient) GetOTACoinLength ¶
GetOTACoinLength returns the current sizes (number of output coins) of PRV and tokens for each shard.
Sample output: map[
0000000000000000000000000000000000000000000000000000000000000004:map[0:43635 1:14775 2:11407 3:20724 4:12613 5:10165 6:18216 7:15629] 0000000000000000000000000000000000000000000000000000000000000005:map[0:37831 1:7379 2:2349 3:11310 4:2218 5:2247 6:8416 7:8601]
]
func (*IncClient) GetOTACoinLengthByShard ¶
GetOTACoinLengthByShard returns the number of output coins of a shard w.r.t to the given tokenID.
Note that all tokens' output coins are grouped together (except PRV), there for it will return the same result for two different tokenIDs (jus use the common.ConfidentialAssetID for token retrieval).
func (*IncClient) GetOTACoinsByIndices ¶
func (client *IncClient) GetOTACoinsByIndices(shardID byte, tokenID string, idxList []uint64) (map[uint64]jsonresult.ICoinInfo, error)
GetOTACoinsByIndices retrieves output coins given the shardID, tokenID, and a list of indices. Callers must make sure the input indices are within the range of output coins ([0 : OTALength - 1]) of the given shard. Otherwise, it will throw an error.
func (*IncClient) GetOutputCoins ¶
func (client *IncClient) GetOutputCoins(outCoinKey *rpc.OutCoinKey, tokenID string, height uint64, isFromCache ...bool) ([]jsonresult.ICoinInfo, []*big.Int, error)
GetOutputCoins calls the remote server to get all the output tokens for an output coin key. `isFromCache` indicates whether the client should retrieve output tokens from the local cache. In case this value is set to `false`, the client uses the regular `GetOutputCoins` method. If multiple values are passed to `isFromCache`, only the first one is used.
For better user experience, if the cache is not running and isFromCache holds true, the client still automatically switches to the non-cache method.
The returned result consists of
- A list of output coins
- A list of corresponding indices. For an output coin v1, its index is -1.
func (*IncClient) GetOutputCoinsV1 ¶
func (client *IncClient) GetOutputCoinsV1(outCoinKey *rpc.OutCoinKey, tokenID string, height uint64) ([]jsonresult.ICoinInfo, []*big.Int, error)
GetOutputCoinsV1 calls the remote server to get all the output tokens for an output coin key using the old RPC.
func (*IncClient) GetOutputCoinsV2 ¶
func (client *IncClient) GetOutputCoinsV2(outCoinKey *rpc.OutCoinKey, tokenID string, upToHeight uint64) ([]jsonresult.ICoinInfo, []*big.Int, error)
GetOutputCoinsV2 calls the remote server to get all the output tokens for an output coin key using the new RPC.
For this function, it is required that the caller has submitted the OTA key to the remote full-node.
func (*IncClient) GetPDEPoolPair ¶
func (client *IncClient) GetPDEPoolPair(beaconHeight uint64, tokenID1, tokenID2 string) (*jsonresult.PoolInfo, error)
GetPDEPoolPair retrieves the pDEX pool information for pair tokenID1-tokenID2 at the provided beacon height. If the beacon height is set to 0, it returns the latest information.
func (*IncClient) GetPDEState ¶
func (client *IncClient) GetPDEState(beaconHeight uint64) (*jsonresult.CurrentPDEState, error)
GetPDEState retrieves the state of pDEX at the provided beacon height. If the beacon height is set to 0, it returns the latest pDEX state.
func (*IncClient) GetPortalShieldingRequestStatus ¶
func (client *IncClient) GetPortalShieldingRequestStatus(shieldID string) (*metadata.PortalShieldingRequestStatus, error)
GetPortalShieldingRequestStatus retrieves the status of a port shielding request.
func (*IncClient) GetPortalUnShieldingRequestStatus ¶
func (client *IncClient) GetPortalUnShieldingRequestStatus(unShieldID string) (*metadata.PortalUnshieldRequestStatus, error)
GetPortalUnShieldingRequestStatus retrieves the status of a port un-shielding request.
func (*IncClient) GetRawMemPool ¶
GetRawMemPool returns a list of transaction hashes currently in the pool.
func (*IncClient) GetReceivingInfo ¶
func (client *IncClient) GetReceivingInfo( txHash string, otaKey string, readonlyKey ...string, ) (received bool, mapResult map[string]uint64, err error)
GetReceivingInfo verifies if a transaction is sent to the given `otaKey` and the transacted tokenIds. Furthermore, in case a read-only key is given, it will decrypt the received output coins and return the total amounts. If there are multiple read-only keys, only the first one is used.
func (*IncClient) GetRewardAmount ¶
GetRewardAmount returns the current reward for a base58-encoded payment address. The returned results is a mapping from a tokenID to the corresponding reward amount.
An example result (marshalled):
{ "0000000000000000000000000000000000000000000000000000000000000004": 9918708109355, "002ffd86f6b6d0342ebb641e7b89748ba44075db1765173b7d4e77289fbf28fd": 48000, "0fa3e49c7d01a3df067c55293705844ae7d41befd3dfc2f231ab763e9c7daa04": 5, "42f4bee6e1c14f94697fb35b0b0bd7e08da1b3ab8a0311563a6793175e31e93b": 70714, "4946b16a08a9d4afbdf416edf52ef15073db0fc4a63e78eb9de80f94f6c0852a": 2, "5c562893dc38c3c2899143ec32cf67051912fc5b6cf8a8c8c7f8d7397fa64418": 29032, "880ea0787f6c1555e59e3958a595086b7802fc7a38276bcd80d4525606557fbc": 4, "8ba3466c61cbcdd895be8ccbdcc74e7f56a764d6bf390a9abdc8bfe1322e67d6": 4, "961179e5a1c6b354e3544cb7e3c74d1cd1625e59d1138fdafca7b0f9c0c9eaad": 54545, "96d4ee94024abb55c0f000978f73dee078682f94b93a9fa67afdcdc11b79e4ef": 189000, "a37469618aa6e768e6d511db6414fcfe8668b914651976b9509a01ce9e855f58": 94500, "f6c3b18679aff8d307b08d4724697bb8dca123a536b863cbe55dc59c110f5c10": 27272, "ffd8d42dc40a8d166ea4848baf8b5f6e9fe0e9c30d60062eb7d44a8df9e00854": 9 }
func (*IncClient) GetShardBestState ¶
func (client *IncClient) GetShardBestState(shardID int) (*jsonresult.ShardBestState, error)
GetShardBestState returns the latest state of a shard chain.
func (*IncClient) GetShareAmount ¶
func (client *IncClient) GetShareAmount(beaconHeight uint64, tokenID1, tokenID2, paymentAddress string) (uint64, error)
GetShareAmount retrieves the share amount of a payment address in pDEX pool of tokenID1 and tokenID2.
func (*IncClient) GetSpentOutputCoins ¶
func (client *IncClient) GetSpentOutputCoins(privateKey, tokenID string, height uint64) ([]coin.PlainCoin, []*big.Int, error)
GetSpentOutputCoins retrieves all spent coins of a private key, without sending the private key to the remote full node.
func (*IncClient) GetSyncStats ¶
func (client *IncClient) GetSyncStats() (*jsonresult.SyncStats, error)
GetSyncStats returns the statistics of data-synchronizing status.
Create an IncClient instance pointing to your node and call this function to get the statistics.
func (*IncClient) GetTokenFee ¶
GetTokenFee returns the token fee per kb.
func (*IncClient) GetTotalSharesAmount ¶
func (client *IncClient) GetTotalSharesAmount(beaconHeight uint64, tokenID1, tokenID2 string) (uint64, error)
GetTotalSharesAmount retrieves the total shares' amount of a pDEX pool.
func (*IncClient) GetTransactionHashesByReceiver ¶
GetTransactionHashesByReceiver retrieves the list of all transactions received by a payment address.
func (*IncClient) GetTransactionsByPublicKeys ¶
func (client *IncClient) GetTransactionsByPublicKeys(publicKeys []string) (map[string]map[string]metadata.Transaction, error)
GetTransactionsByPublicKeys retrieves the list of all transactions (in object) sent to a list of base58-encoded public keys.
Notice that this function is time-consuming since it has to parse every single transaction into an object.
func (*IncClient) GetTransactionsByReceiver ¶
func (client *IncClient) GetTransactionsByReceiver(paymentAddress string) (map[string]metadata.Transaction, error)
GetTransactionsByReceiver retrieves the list of all transactions (in object) received by a payment address.
Notice that this function is time-consuming since it has to parse every single transaction into an object.
func (*IncClient) GetTx ¶
func (client *IncClient) GetTx(txHash string) (metadata.Transaction, error)
GetTx retrieves the transaction detail and parses it to a transaction object.
func (*IncClient) GetTxDetail ¶
func (client *IncClient) GetTxDetail(txHash string) (*jsonresult.TransactionDetail, error)
GetTxDetail retrieves the transaction detail from its hash.
func (*IncClient) GetTxHashByPublicKeys ¶
GetTxHashByPublicKeys retrieves the list of all transactions' hash sent to a list of public keys.
func (*IncClient) GetTxHashBySerialNumbers ¶
func (client *IncClient) GetTxHashBySerialNumbers(snList []string, tokenIDStr string, shardID byte) (map[string]string, error)
GetTxHashBySerialNumbers retrieves the list of tokenIDStr transactions in which serial numbers have been spent.
Set shardID = 255 to retrieve in all shards.
func (*IncClient) GetTxHistoryV1 ¶
GetTxHistoryV1 retrieves the history (V1) of a private key w.r.t a tokenID.
func (*IncClient) GetTxHistoryV2 ¶
GetTxHistoryV2 retrieves the history (V2) of a private key w.r.t a tokenID.
func (*IncClient) GetTxs ¶
func (client *IncClient) GetTxs(txHashList []string, hashReCheck ...bool) (map[string]metadata.Transaction, error)
GetTxs retrieves transactions and parses them to transaction objects given their hashes. By default, it will not re-calculate the hashes of the transactions. Set `hashReCheck` to true to re-check the hashes.
func (*IncClient) GetUnspentOutputCoins ¶
func (client *IncClient) GetUnspentOutputCoins(privateKey, tokenID string, height uint64) ([]coin.PlainCoin, []*big.Int, error)
GetUnspentOutputCoins retrieves all unspent coins of a private key, without sending the private key to the remote full-node.
func (*IncClient) GetUnspentOutputCoinsFromCache ¶
func (client *IncClient) GetUnspentOutputCoinsFromCache(privateKey, tokenID string, height uint64, reSync ...bool) ([]coin.PlainCoin, []*big.Int, error)
GetUnspentOutputCoinsFromCache retrieves all unspent coins from the local cache (if possible).
func (*IncClient) ImportAccount ¶
ImportAccount imports a BIP39 mnemonic string and finds all child keys derived from the mnemonic. The first return KeyWallet is the master wallet, which is used to derive the rest of child KeyWallet. For child KeyWallets, we start with childIdx = 1 and stops at the index when there is no transaction found for the child key.
func (*IncClient) ListReward ¶
ListReward returns the staking rewards on the blockchain. The returned results is a mapping from a public key to a tokenID-reward mapping.
An example result (marshalled):
"117XEowF5Y4eYs6mTQPkZxaK3H9GSwGHdcuv6emK7NVV698XSq": { "0000000000000000000000000000000000000000000000000000000000000004": 9792062854956, "002ffd86f6b6d0342ebb641e7b89748ba44075db1765173b7d4e77289fbf28fd": 48000, "15aeb4c4ea24a50695a0cb425b711a49cc9b7ab2e56af8184a570db8c3e34ff8": 122916, "2d04e28959cf3767734d9a7adbe639f8818d32c4531e467108c07e2254a6e4eb": 242314, "42f4bee6e1c14f94697fb35b0b0bd7e08da1b3ab8a0311563a6793175e31e93b": 24827, "4946b16a08a9d4afbdf416edf52ef15073db0fc4a63e78eb9de80f94f6c0852a": 3, "880ea0787f6c1555e59e3958a595086b7802fc7a38276bcd80d4525606557fbc": 0, "961179e5a1c6b354e3544cb7e3c74d1cd1625e59d1138fdafca7b0f9c0c9eaad": 45000, "9abfda385c6700656778da12c21b36698bdf9fff250d94314d53c6069c5c45a4": 34758, "9fca0a0947f4393994145ef50eecd2da2aa15da2483b310c2c0650301c59b17d": 0, "f6c3b18679aff8d307b08d4724697bb8dca123a536b863cbe55dc59c110f5c10": 88306, "ffd8d42dc40a8d166ea4848baf8b5f6e9fe0e9c30d60062eb7d44a8df9e00854": 0 }
func (*IncClient) NewRPCCall ¶
func (client *IncClient) NewRPCCall(jsonRPC, method string, params []interface{}, id interface{}) ([]byte, error)
NewRPCCall creates and sends a new RPC request based on the given method and parameters to the RPC server.
Example call: NewRPCCall("1.0", "getbeaconbeststate", nil, 1)
func (*IncClient) SendRawTokenTx ¶
SendRawTokenTx sends submits a raw token transaction to the Incognito blockchain.
type IncLogger ¶
IncLogger implements a logger for the incclient package.
func NewLogger ¶
NewLogger creates a new IncLogger. If isEnable = true, it will do logging. If logFile is set, it will store logging information into the given logFile.
func (IncLogger) Fatalln ¶
func (l IncLogger) Fatalln(v ...interface{})
Fatalln overrides log.Fatalln.
type KeyInfo ¶
type KeyInfo struct { PrivateKey string PublicKey string PaymentAddress string ReadOnlyKey string OTAPrivateKey string MiningKey string MiningPublicKey string ShardID byte }
KeyInfo contains all key-related information of an account.
func GetAccountInfoFromPrivateKey ¶
GetAccountInfoFromPrivateKey returns all fields related to a private key.
type TxHistoryInterface ¶
type TxHistoryInterface interface { GetLockTime() int64 GetAmount() uint64 String() string GetTxHash() string }
TxHistoryInterface implements necessary methods for a history action.
type TxHistoryProcessor ¶
type TxHistoryProcessor struct {
// contains filtered or unexported fields
}
TxHistoryProcessor implements a processor for retrieving transaction history in a parallel manner.
Each TxHistoryProcessor consists of several TxHistoryWorker's that help retrieve transaction history faster.
func NewTxHistoryProcessor ¶
func NewTxHistoryProcessor(client *IncClient, numWorkers int) *TxHistoryProcessor
NewTxHistoryProcessor creates a TxHistoryProcess with a number of TxHistoryWorker's.
func (*TxHistoryProcessor) GetTokenHistory ¶
func (p *TxHistoryProcessor) GetTokenHistory(privateKey string, tokenIDStr string) (*TxHistory, error)
GetTokenHistory returns the history of a private key w.r.t a tokenID in a parallel manner.
type TxHistoryWorker ¶
type TxHistoryWorker struct {
// contains filtered or unexported fields
}
TxHistoryWorker implements a worker for retrieving transaction history.
func NewTxHistoryWorker ¶
func NewTxHistoryWorker(id int, client *IncClient) *TxHistoryWorker
NewTxHistoryWorker creates a new TxHistoryWorker.
type TxIn ¶
type TxIn struct { Version int8 LockTime int64 TxHash string Amount uint64 TokenID string Metadata metadata.Metadata }
TxIn is an in-coming transaction. A transaction is considered to be a TxIn if
- it receives at least 1 output coin; and
- the input coins are does not belong to the receivers.
In case a user A sends some coins to a user B and A receives a sent-back output coin, this is not considered to be a TxIn.
type TxOut ¶
type TxOut struct { Version int8 LockTime int64 TxHash string Amount uint64 TokenID string SpentCoins map[string]uint64 Receivers []string PRVFee uint64 TokenFee uint64 Metadata metadata.Metadata }
TxOut is an out-going transaction. A transaction is considered to be a TxOut if it spends input coins.
func (TxOut) GetLockTime ¶
GetLockTime returns the lock-time.
type TxParam ¶
type TxParam struct {
// contains filtered or unexported fields
}
TxParam describes the parameters needed to create a transaction in general.
For creating a token transaction, txTokenParam must not be nil. Otherwise, it should be nil.
type TxTokenParam ¶
type TxTokenParam struct {
// contains filtered or unexported fields
}
TxTokenParam describes the parameters needed for creating a token transaction.
func NewTxTokenParam ¶
func NewTxTokenParam(tokenID string, tokenType int, receiverList []string, amountList []uint64, hasTokenFee bool, tokenFee uint64, kArgs map[string]interface{}) *TxTokenParam
NewTxTokenParam creates a new TxTokenParam.
Source Files ¶
- account.go
- account_common.go
- blockchain.go
- bridge.go
- bridge_burning_proof.go
- bridge_utils.go
- coin.go
- coin_cache.go
- coin_cache_utils.go
- common.go
- constants.go
- general.go
- incclient.go
- logger.go
- pdex.go
- pdex_utils.go
- portal.go
- portal_param.go
- portal_utils.go
- prv_pegging.go
- staking.go
- staking_utils.go
- tx.go
- tx_consolidate.go
- tx_consolidate_utils.go
- tx_convert.go
- tx_convert_enhanced.go
- tx_history.go
- tx_history_utils.go
- tx_history_worker.go
- tx_utils.go
- txtoken.go