-
Notifications
You must be signed in to change notification settings - Fork 86
Binance Chain Staking API
-
- Get Validator Info
- Query Top Validators
- Query Delegation
- Query Delegations
- Query Redelegation by delegator
- Query Redelegations
- Query Unbonding Delegation by delegator
- Query Unbonding Delegations
- Query Unbonding Delegation by validator
- Query Redelegation by a validator
- Query Binding Pool Info
- Query Validator Count
https://github.com/binance-chain/java-sdk/tree/bsc_support
Prepare a create validator
transaction
//create and set description
Description validatorDescription = new Description();
createSideChainValidator.setDescription(validatorDescription);
//create and set commission
Commission commission = new Commission();
createSideChainValidator.setCommission(commission);
//set delegator address, here use self address
createSideChainValidator.setDelegatorAddr(wallet.getAddress());
//set delegation token, here use 1000000 BNB
Token delegationToken = new Token();
delegationToken.setDenom("BNB");
delegationToken.setAmount(1000000000000L);
createSideChainValidator.setDelegation(delegationToken);
//set side-chain id
createSideChainValidator.setSideChainId(SideChainIds.RIALTO);
//set side-chain validator cons address
createSideChainValidator.setSideConsAddr("0x9fB29AAc15b9A4B7F17c3385939b007540f4d791");
//set side-chain validator fee address
createSideChainValidator.setSideFeeAddr("0xd1B22dCC24C55f4d728E7aaA5c9b5a22e1512C08");
TransactionOption options = new TransactionOption("", 0, null);
Broadcast a create validator
transaction in sync manner
List<TransactionMetadata> transactionMetadatas = nodeClient.createSideChainValidator(createSideChainValidator, wallet, options, true);
Broadcast a create validator
transaction in sync manner
List<TransactionMetadata> transactionMetadatas = nodeClient.editSideChainValidator(editSideChainValidator, wallet, createTransactionOptionForTest(), true);
Broadcast a delegate
transaction in sync manner
List<TransactionMetadata> transactionMetadatas = nodeClient.sideChainDelegate(sideChainDelegate, wallet, createTransactionOptionForTest(), true);
Broadcast a redelegate
transaction in sync manner
List<TransactionMetadata> transactionMetadatas = nodeClient.sideChainRedelagate(redelegate, wallet, createTransactionOptionForTest(), true);
Broadcast a unbond
transaction in sync manner
List<TransactionMetadata> transactionMetadatas = nodeClient.sideChainUnbond(sideChainUndelegate, wallet, createTransactionOptionForTest(), true);
This function will query /abci_query
RPC endpoint with the input of /stake
and the key of validator's public key
SideChainValidator validator = nodeClient.getSideChainValidator(SideChainIds.RIALTO, jackValidator);
This function will return the top validators
List<SideChainValidator> validators = nodeClient.getSideChainTopValidators(SideChainIds.RIALTO, 5);
This function will return the delegation amount of a delegator on a validator
SideChainDelegation delegation = nodeClient.getSideChainDelegation(SideChainIds.RIALTO, wallet.getAddress(), roseValidator);
This function will return the delegation amount of a delegator on all the validators
List<SideChainDelegation> delegations = nodeClient.getSideChainDelegations(SideChainIds.RIALTO, wallet.getAddress());
This function will return the redelegation amounts of a delegator on a validator
SideChainRedelegation redelegation = nodeClient.getSideChainRedelegation(SideChainIds.RIALTO, wallet.getAddress(), jackValidator, roseValidator);
This function will return the redelegation amounts of a delegator on all the validators
List<SideChainRedelegation> redelegations = nodeClient.getSideChainRedelegations(SideChainIds.RIALTO, wallet.getAddress());
This function will return the unbonding delegation amount of a delegator on a validator
UnBondingDelegation unBondingDelegation = nodeClient.getSideChainUnBondingDelegation(SideChainIds.RIALTO, wallet.getAddress(), jackValidator);
This function will return the unbonding delegation amounts of a delegator on all the validators
List<UnBondingDelegation> unBondingDelegations = nodeClient.getSideChainUnBondingDelegations(SideChainIds.RIALTO, wallet.getAddress());
This function will return the unbonding delegation amount of a validator
List<UnBondingDelegation> unBondingDelegations = nodeClient.getSideChainUnBondingDelegationsByValidator(SideChainIds.RIALTO, jackValidator);
This function will return the redelegation amounts of a validator
List<SideChainRedelegation> redelegations = nodeClient.getSideChainRedelegationsByValidator(SideChainIds.RIALTO, jackValidator);
This function will return the binding status
Pool{
private long looseTokens;
private long bondedTokens;
}
Pool pool = nodeClient.getSideChainPool(SideChainIds.RIALTO);
This function will return the total validator count.
- sideChainId string , "rialto" for current testnet
- jailInvolved bool, if true, it will return the total validator count(unjailed and jailed); if false, it will return the unjailed validator count.
long count = nodeClient.getAllSideChainValidatorsCount(SideChainIds.RIALTO, false);