Please help me understand the parameters used in below RPCs

Hello @daniel @trungtin2qn1 @Support
I understand that the team is really busy so my apologies for frequent posting. I have been trying to get clarity on the parameters used in the below mentioned rpcs for over a week now
Please help me with this

  • getallviewdetail, uses one parameter, is the parameter shard id?
  • retrievebeaconblock, uses two parameters, are the parameters hash and shard id?
  • retrievebeaconblockbyheight, uses two parameters, are the parameters height & shard id?

Also, I found two RPC calls related to privacycustomtokens

  • listprivacycustomtoken
  • listprivacycustomtokenbyshard

The “listprivacycustomtoken” RPC doesn’t work on the mainnet ie couldn’t post it on mainnet
The listprivacycustomtokenbyshard- works on mainnet
Which one is the updated RPC Call ? Are they both functional/working?

  • listprivacycustomtokenbyshard uses one parameters, is the paramerter shard id?
  • privacycustomtoken RPC uses one parameter, is the parameter token id?
  • getlistprivacycustomtokenbalance uses one paramerter? can you name the parameter used by it?

@sid @Gaurav_Saini

Hi @anirudh.chauhan,

Sorry for the late response. Please find the answers to your questions in the following.

For getallviewdetail, the only parameter is the CHAIN_ID, where CHAIN_ID = -1 is for the Beacon chain, CHAIN_ID = 0...7 for each shard.

{
	"jsonrpc": "1.0",
    "method": "getallviewdetail",
    "params": [
        CHAIN_ID
    ],
    "id": 1
}

This RPC returns the detail of a beacon block. The only parameter is the BEACON_BLOCK_HASH.

{
	"jsonrpc": "1.0",
    "method": "retrievebeaconblock",
    "params": [
        "6756a330277a9a2f7161acd2c25f5364b8c5675835ecae855f7c521b724e1b05"
    ],
    "id": 1
}

This RPC returns the detail of beacon blocks at a specific height. The only parameter is BEACON_BLOCK_HEIGHT.

{
	"jsonrpc": "1.0",
    "method": "retrievebeaconblockbyheight",
    "params": [
        1803138
    ],
    "id": 1
}

This RPC is an old RPC and still working (we’ve just tested out). Due the the fast growing data, this RPC might not provide a very good experience, sometimes you’ll get a time-out error message. Instead, you can use the alternative listprivacycustomtokenids to list just the privacy token IDs.

{
	"jsonrpc": "1.0",
    "method": "listprivacycustomtokenids",
    "params": [],
    "id": 1
}

This is the same as the listprivacycustomtoken. We don’t recommend users/developers use this RPC. Instead, try using listprivacycustomtoken or listprivacycustomtokenids.

The only parameter is your PRIVATE_KEY.

{
	"jsonrpc": "1.0",
    "method": "getlistprivacycustomtokenbalance",
    "params": [
        "YOUR_PRIVATE_KEY"
    ],
    "id": 1
}
3 Likes

Thank you Daniel. This will help alot

Hello @daniel is there an RPC to get PRV CIRCULATING SUPPLY number which is 23,735,116 ? or does the team use some other calculation?

There’s no RPC available for this purpose. We monitor the network and calculate at our backend.

1 Like

Hello @daniel
I need your help to understand how does the team calculate the below-mentioned values displayed on explorer.incognito.org

  • Shielded ($)
  • Liquidity ($)
  • Trading Volume ($)
  • Active Validators

Are there any direct RPCs that will help us get these values or do we extract these values using some kind of calculation at the backend? It would be of great help if you can list relevant/related RPCs that can help me get these values.

Also can you please let me know the parameters we are using for the following pdexv3 RPC calls

  • pdexv3_getTradeStatus
  • pdexv3_getContributionStatus

I found the RPC calls on the following link: https://documenter.getpostman.com/view/14057699/Tzm8EvGf#6ec2fc88-d764-4c05-91cf-4afbb2b3c989
However, I am not sure about the parameters that go in the method? @sid @Gaurav_Saini

1 Like

I have just forwarded your inquiry to the respected devs and will get back to you soon.

The solely parameter is the hash of the trade request. Here is the description of the response:

type DEXTradeStatus struct {
	// Status represents the status of the trade, and should be understood as follows:
	// 	- 0: the trade request is refunded;
	//	- 1: the trade request is accepted.
	Status int `json:"Status"`

	// BuyAmount is the receiving amount of the trade (in case of failure, it equals to 0).
	BuyAmount uint64 `json:"BuyAmount"`

	// TokenToBuy is the buying tokenId.
	TokenToBuy string `json:"TokenToBuy"`
}

Same paramters as in pdexv3_getTradeStatus, with the following response description:

type DEXAddLiquidityStatus struct {
	// Status represents the status of the transaction, and should be understood as follows:
	//	- 1: the contribution is in the waiting pool;
	//	- 2: the contribution is fully accepted;
	//	- 3: the contribution failed and is refunded;
	//	- 4: the contribution is partially accepted.
	Status int `json:"Status"`

	// Token0ID is the ID of the first token.
	Token0ID string `json:"Token0ID"`

	// Token0ContributedAmount is the contributed amount of the first tokenID.
	Token0ContributedAmount uint64 `json:"Token0ContributedAmount"`

	// Token0ReturnedAmount is the returned amount (in case of over-amount) of the first tokenID.
	Token0ReturnedAmount uint64 `json:"Token0ReturnedAmount"`

	// Token1ID is the ID of the second token.
	Token1ID string `json:"Token1ID"`

	// Token1ContributedAmount is the contributed amount of the second tokenID.
	Token1ContributedAmount uint64 `json:"Token1ContributedAmount"`

	// Token1ReturnedAmount is the returned amount (in case of over-amount) of the second tokenID.
	Token1ReturnedAmount uint64 `json:"Token1ReturnedAmount"`

	// PoolPairID is the pool pair ID of the contribution.
	PoolPairID string `json:"PoolPairID"`
}
4 Likes

Thank you @daniel . This will help a lot. Also, I will be looking forward to the response from the dev team

1 Like

Hi @anirudh.chauhan

I need your help to understand how does the team calculate the below-mentioned values displayed on explorer.incognito.org

  • Shielded ($)
  • Liquidity ($)
  • Trading Volume ($)
  • Active Validators

Are there any direct RPCs that will help us get these values or do we extract these values using some kind of calculation at the backend? It would be of great help if you can list relevant/related RPCs that can help me get these values.

Currently we don’t have direct RPCs or APIs to retrieve these value. They are all calculated on the backend side. You can parse the tx data and do the calculation:

  • Total Shielded in USD: Get sum of every token shielding * token price in USD SUM(TokenAShiedlingAmount * TokenAUSDPrice, TokenBShiedlingAmount * TokenBUSDPrice, ...)

  • Liquidity in USD: Sum of every token liquidity amount * token price in USD
    SUM(TokenALiquidity * TokenAUSDPrice, TokenBLiquidity * TokenBUSDPrice, ...)

  • Trading Volume: Sum of every tx sell token amount * sell token price in USD
    SUM(TokenASellAmount * TokenAUSDPrice, TokenBSellAmount * TokenBUSDPrice, ...)

  • For activalidator:

func (a *AppMetrics) getTotalValidator() (int, error) {
   fmt.Printf("start totalValidator\n")

   beaconBestState, err := shared.GetBeaconBestState(a.client)
   if err != nil {
   	return 0, err
   }

   var totalValidator int
   totalValidator = len(beaconBestState.BeaconCommittee)
   totalValidator += len(beaconBestState.BeaconPendingValidator)

   for shardId, node := range beaconBestState.ShardCommittee {
   	fmt.Println("ShardCommittee", shardId, len(node))
   	totalValidator += len(node)
   }

   for shardId, node := range beaconBestState.ShardPendingValidator {
   	fmt.Println("ShardPendingValidator", shardId, len(node))
   	totalValidator += len(node)
   }

   for shardId, node := range beaconBestState.SyncingValidators {
   	fmt.Println("SyncingValidators", shardId, len(node))
   	totalValidator += len(node)
   }

   return totalValidator, nil
}

let me know if you want more information.

4 Likes

Are the prices the values at the shielding time or now? @Corncob

1 Like

They are calculated with the current prices @abduraman

2 Likes