public class AuthManager
extends java.lang.Object
| 构造器和说明 |
|---|
AuthManager(Client client,
CryptoKeyPair credential) |
AuthManager(Client client,
CryptoKeyPair credential,
java.math.BigInteger blockNumberInterval) |
| 限定符和类型 | 方法和说明 |
|---|---|
java.lang.Boolean |
accountAvailable(java.lang.String accountAddress)
check account is available, if normal then return true
|
void |
asyncRevokeProposal(java.math.BigInteger proposalId,
TransactionCallback callback)
async revoke proposal, only governor can call it
|
void |
asyncSetAccountStatus(java.lang.String account,
AccessStatus status,
PrecompiledCallback callback)
async set account status, only governor can call it.
|
void |
asyncSetContractStatus(java.lang.String contractAddress,
AccessStatus status,
PrecompiledCallback callback)
async set a contract status, only contract manager can call
|
void |
asyncSetContractStatus(java.lang.String contractAddress,
boolean isFreeze,
PrecompiledCallback callback)
async set a contract status, freeze or normal, only contract manager can call
|
void |
asyncSetMethodAuth(java.lang.String contractAddress,
byte[] func,
java.lang.String account,
boolean isOpen,
PrecompiledCallback callback)
async set a specific contract's method ACL, only contract admin can call it
|
void |
asyncSetMethodAuthType(java.lang.String contractAddress,
byte[] func,
AuthType authType,
PrecompiledCallback callback)
async set a specific contract's method auth type, only contract admin can call it
|
void |
asyncVoteProposal(java.math.BigInteger proposalId,
java.lang.Boolean agree,
TransactionCallback callback)
async unified vote, only governor can call it
|
java.lang.Boolean |
checkDeployAuth(java.lang.String account)
check the account whether this account can deploy contract
|
java.lang.Boolean |
checkMethodAuth(java.lang.String contractAddress,
byte[] func,
java.lang.String account)
check the contract interface func whether this account can call
|
java.lang.Boolean |
contractAvailable(java.lang.String contractAddress)
check contract is available, if normal then return true
|
java.math.BigInteger |
createRmNodeProposal(java.lang.String node)
submit a proposal of remove consensus node, only governor can call it
|
java.math.BigInteger |
createSetConsensusWeightProposal(java.lang.String node,
java.math.BigInteger weight,
boolean addFlag)
submit a proposal of set consensus node weight, only governor can call it
|
java.math.BigInteger |
createSetSysConfigProposal(java.lang.String key,
java.lang.String value)
submit a proposal of set system config, only governor can call it
|
java.math.BigInteger |
createUpgradeVoteComputerProposal(java.lang.String address)
submit a proposal of upgrade vote computer logic contract, only governor can call it
|
AccountManager |
getAccountManager() |
java.lang.String |
getAdmin(java.lang.String contractAddress)
get a specific contract admin
|
java.lang.String |
getCommitteeAddress() |
CommitteeInfo |
getCommitteeInfo()
get Committee info
|
CommitteeManager |
getCommitteeManager() |
ContractAuthPrecompiled |
getContractAuthPrecompiled() |
java.math.BigInteger |
getDeployAuthType()
get global deploy auth type
|
Tuple3<AuthType,java.util.List<java.lang.String>,java.util.List<java.lang.String>> |
getMethodAuth(java.lang.String contractAddress,
byte[] func)
get auth of specific contract's method func
|
ProposalInfo |
getProposalInfo(java.math.BigInteger proposalId)
get proposal info
|
java.util.List<ProposalInfo> |
getProposalInfoList(java.math.BigInteger from,
java.math.BigInteger to)
get proposal info list, range in [from,to]
|
java.lang.String |
getProposalManagerAddress() |
RetCode |
initAuth(java.lang.String admin)
init committee system for old version chain which not open auth check NOTE: this method only
can be used when chain version >= 3.3.0
|
java.math.BigInteger |
modifyDeployAuth(java.lang.String account,
java.lang.Boolean openFlag)
submit a proposal of adding deploy contract auth for account, only governor can call it
|
java.math.BigInteger |
proposalCount()
get proposal count
|
java.math.BigInteger |
resetAdmin(java.lang.String newAdmin,
java.lang.String contractAddr)
submit a proposal of resetting contract admin, only governor can call it
|
TransactionReceipt |
revokeProposal(java.math.BigInteger proposalId)
revoke proposal, only governor can call it
|
RetCode |
setAccountStatus(java.lang.String account,
AccessStatus status)
Set account status, only governor can call it.
|
RetCode |
setContractStatus(java.lang.String contractAddress,
AccessStatus status)
set a contract status, only contract manager can call
|
RetCode |
setContractStatus(java.lang.String contractAddress,
boolean isFreeze)
set a contract status, freeze or normal, only contract manager can call
|
java.math.BigInteger |
setDeployAuthType(AuthType deployAuthType)
submit a proposal of setting deploy contract auth type, only governor can call it
|
RetCode |
setMethodAuth(java.lang.String contractAddress,
byte[] func,
java.lang.String account,
boolean isOpen)
set a specific contract's method ACL, only contract admin can call it
|
RetCode |
setMethodAuthType(java.lang.String contractAddress,
byte[] func,
AuthType authType)
set a specific contract's method auth type, only contract admin can call it
|
java.math.BigInteger |
setRate(java.math.BigInteger participatesRate,
java.math.BigInteger winRate)
apply set participate rate and win rate. only governor can call it
|
java.math.BigInteger |
updateGovernor(java.lang.String account,
java.math.BigInteger weight)
apply for update governor, only governor can call it
|
TransactionReceipt |
voteProposal(java.math.BigInteger proposalId,
java.lang.Boolean agree)
unified vote, only governor can call it
|
public AuthManager(Client client, CryptoKeyPair credential)
public AuthManager(Client client, CryptoKeyPair credential, java.math.BigInteger blockNumberInterval)
public CommitteeManager getCommitteeManager()
public ContractAuthPrecompiled getContractAuthPrecompiled()
public AccountManager getAccountManager()
public java.lang.String getCommitteeAddress()
throws ContractException
public java.lang.String getProposalManagerAddress()
throws ContractException
public java.math.BigInteger updateGovernor(java.lang.String account,
java.math.BigInteger weight)
throws ContractException
account - new governor addressweight - 0 == delete, bigger than 0 == update or insertContractException - throw when contract exec exceptionpublic java.math.BigInteger setRate(java.math.BigInteger participatesRate,
java.math.BigInteger winRate)
throws ContractException
participatesRate - [0,100]. if 0, always succeed.winRate - [0,100].ContractException - throw when contract exec exceptionpublic java.math.BigInteger setDeployAuthType(AuthType deployAuthType) throws ContractException
deployAuthType - 1-whitelist; 2-blacklistContractException - throw when contract exec exceptionpublic java.math.BigInteger getDeployAuthType()
throws ContractException
ContractException - throw when contract exec exceptionpublic java.math.BigInteger modifyDeployAuth(java.lang.String account,
java.lang.Boolean openFlag)
throws ContractException
account - account address stringopenFlag - true-open; false-closeContractException - throw when contract exec exceptionpublic java.math.BigInteger resetAdmin(java.lang.String newAdmin,
java.lang.String contractAddr)
throws ContractException
newAdmin - admin addresscontractAddr - the address of contract which will propose to reset adminContractException - throw when contract exec exceptionpublic java.math.BigInteger createRmNodeProposal(java.lang.String node)
throws ContractException
node - node IDContractException - throw when contract exec exceptionpublic java.math.BigInteger createSetConsensusWeightProposal(java.lang.String node,
java.math.BigInteger weight,
boolean addFlag)
throws ContractException
node - node IDweight - consensus weight: weigh bigger than 0, sealer; weight = 0, observeraddFlag - flag to distinguish add a node or set node's weight,ContractException - throw when contract exec exceptionpublic java.math.BigInteger createSetSysConfigProposal(java.lang.String key,
java.lang.String value)
throws ContractException
key - system config key, only support
(tx_gas_limit,tx_count_limit,consensus_leader_period)value - system config value, notice that tx_gas_limit bigger than 100,000,
tx_count_limit bigger than 1, consensus_leader_period bigger than 1ContractException - throw when contract exec exceptionpublic java.math.BigInteger createUpgradeVoteComputerProposal(java.lang.String address)
throws ContractException
address - vote computer addressContractException - throw when contract exec exceptionpublic TransactionReceipt revokeProposal(java.math.BigInteger proposalId)
proposalId - idpublic void asyncRevokeProposal(java.math.BigInteger proposalId,
TransactionCallback callback)
proposalId - idcallback - callback when get receiptpublic TransactionReceipt voteProposal(java.math.BigInteger proposalId, java.lang.Boolean agree)
proposalId - idagree - true or falsepublic void asyncVoteProposal(java.math.BigInteger proposalId,
java.lang.Boolean agree,
TransactionCallback callback)
proposalId - idagree - true or falsecallback - callback when get receiptpublic ProposalInfo getProposalInfo(java.math.BigInteger proposalId) throws ContractException
proposalId - proposal idContractException - throw when contract exec exceptionpublic java.util.List<ProposalInfo> getProposalInfoList(java.math.BigInteger from, java.math.BigInteger to) throws ContractException
from - begin proposal idto - end proposal idContractException - throw when contract exec exceptionpublic CommitteeInfo getCommitteeInfo() throws ContractException
ContractException - throw when contract exec exceptionpublic java.lang.Boolean checkDeployAuth(java.lang.String account)
throws ContractException
account - the account to checkContractException - throw when contract exec exceptionpublic java.lang.Boolean checkMethodAuth(java.lang.String contractAddress,
byte[] func,
java.lang.String account)
throws ContractException
contractAddress - the contractAddressfunc - interface func selector of contract, 4 bytesaccount - the account to checkContractException - throw when contract exec exceptionpublic Tuple3<AuthType,java.util.List<java.lang.String>,java.util.List<java.lang.String>> getMethodAuth(java.lang.String contractAddress, byte[] func) throws ContractException
contractAddress - contract addressfunc - method interface func selector, contains 4 bytes: hash(selector()).getBytes(0,4)ContractException - AuthType.valueOf will throw this exceptionpublic java.lang.String getAdmin(java.lang.String contractAddress)
throws ContractException
contractAddress - the contract to get adminContractException - throw when contract exec exceptionpublic RetCode setMethodAuthType(java.lang.String contractAddress, byte[] func, AuthType authType) throws ContractException
contractAddress - the contract address to set authfunc - interface func selector of contract, 4 bytesauthType - white_list or black_listContractException - throw when contract exec exceptionpublic void asyncSetMethodAuthType(java.lang.String contractAddress,
byte[] func,
AuthType authType,
PrecompiledCallback callback)
contractAddress - the contract address to set authfunc - interface func selector of contract, 4 bytesauthType - white_list or black_listcallback - callback when get receiptpublic RetCode setMethodAuth(java.lang.String contractAddress, byte[] func, java.lang.String account, boolean isOpen) throws ContractException
contractAddress - the contract address to set aclfunc - interface func selector of contract, 4 bytesaccount - the account to setisOpen - if open, then white_list type is true, black_list is false; if close, then
white_list type is false, black_list is true;ContractException - throw when contract exec exceptionpublic void asyncSetMethodAuth(java.lang.String contractAddress,
byte[] func,
java.lang.String account,
boolean isOpen,
PrecompiledCallback callback)
contractAddress - the contract address to set aclfunc - interface func selector of contract, 4 bytesaccount - the account to setisOpen - if open, then white_list type is true, black_list is false; if close, then
white_list type is false, black_list is true;callback - callback when get receiptpublic RetCode setContractStatus(java.lang.String contractAddress, boolean isFreeze) throws ContractException
contractAddress - contract addressisFreeze - is freeze or normalContractException - throw when contract exec exceptionpublic void asyncSetContractStatus(java.lang.String contractAddress,
boolean isFreeze,
PrecompiledCallback callback)
contractAddress - contract addressisFreeze - is freeze or normalcallback - callback when get receiptpublic RetCode setContractStatus(java.lang.String contractAddress, AccessStatus status) throws ContractException
contractAddress - contract addressstatus - 0 - normal, 1 - freeze, 2 - abolishContractException - throw when contract exec exceptionpublic void asyncSetContractStatus(java.lang.String contractAddress,
AccessStatus status,
PrecompiledCallback callback)
contractAddress - contract addressstatus - 0 - normal, 1 - freeze, 2 - abolishcallback - callback when get receiptpublic java.lang.Boolean contractAvailable(java.lang.String contractAddress)
throws ContractException
contractAddress - contract addressContractException - throw when contract exec exceptionpublic RetCode setAccountStatus(java.lang.String account, AccessStatus status) throws ContractException
account - account addressstatus - account statusContractException - throw when contract exec exceptionpublic void asyncSetAccountStatus(java.lang.String account,
AccessStatus status,
PrecompiledCallback callback)
account - account addressstatus - account statuspublic java.lang.Boolean accountAvailable(java.lang.String accountAddress)
throws ContractException
accountAddress - account addressContractException - throw when contract exec exceptionpublic java.math.BigInteger proposalCount()
throws ContractException
ContractException - throw when contract exec exceptionpublic RetCode initAuth(java.lang.String admin) throws ContractException
admin - committee first adminContractException - throw when check failed or contract exec exception