public class CasperSdk extends Object
| Modifier and Type | Method and Description |
|---|---|
Deploy |
deployFromJson(InputStream jsonStream)
Converts a JSON object to a
Deploy. |
Deploy |
deployFromJson(String json)
Converts a JSON object to a
Deploy. |
String |
deployToJson(Deploy deploy)
Converts a Casper type object ot a JSON string
|
String |
getAccountBalance(String accountKey) |
String |
getAccountHash(String accountKey) |
String |
getAccountInfo(String accountKey) |
String |
getAccountMainPurseURef(String accountKey) |
String |
getAuctionInfo() |
ContractHash |
getContractHash(String accountKey) |
String |
getNodePeers() |
String |
getNodeStatus() |
String |
getStateRootHash() |
org.bouncycastle.crypto.AsymmetricCipherKeyPair |
loadKeyPair(InputStream publicKeyIn,
InputStream privateKeyIn)
Loads the key pair from the provided streams
|
Deploy |
makeDeploy(DeployParams deployParams,
DeployExecutable session,
DeployExecutable payment)
Construct new unsigned deploy.
|
Deploy |
makeTransferDeploy(DeployParams deployParams,
DeployExecutable session,
DeployExecutable payment)
Construct new unsigned deploy for transfer purpose.
|
Transfer |
newTransfer(Number amount,
PublicKey target,
Number id)
Creates a new Transfer to the target account of the specified amount
|
Digest |
putDeploy(Deploy signedDeploy)
Send deploy to network
|
Deploy |
signDeploy(Deploy deploy,
org.bouncycastle.crypto.AsymmetricCipherKeyPair signKeyPair)
Sign the deploy with the specified signKeyPair.
|
ModuleBytes |
standardPayment(Number paymentAmount)
Creates a new standard payment
|
public CasperSdk(String url, int port)
public ContractHash getContractHash(String accountKey) throws Exception
Exceptionpublic String getAccountBalance(String accountKey) throws Exception
Exceptionpublic String getAccountMainPurseURef(String accountKey) throws Exception
Exceptionpublic String getAccountHash(String accountKey) throws NoSuchAlgorithmException
NoSuchAlgorithmExceptionpublic Deploy deployFromJson(InputStream jsonStream) throws IOException
Deploy.jsonStream - the input stream to read the JSON object fromDeployIOException - - if there was an error reading the streampublic Deploy deployFromJson(String json) throws IOException
Deploy.json - the input JSON to read tDeployIOException - - if there was an error reading the jsonpublic Deploy makeTransferDeploy(DeployParams deployParams, DeployExecutable session, DeployExecutable payment)
deployParams - the deployment parameterssession - the session/transferpayment - the paymentpublic Deploy makeDeploy(DeployParams deployParams, DeployExecutable session, DeployExecutable payment)
deployParams - the deployment parameterssession - the session/transferpayment - the paymentpublic Deploy signDeploy(Deploy deploy, org.bouncycastle.crypto.AsymmetricCipherKeyPair signKeyPair)
deploy - unsigned Deploy objectsignKeyPair - the keypair to sign the Deploy objectpublic Digest putDeploy(Deploy signedDeploy) throws Exception
signedDeploy - Signed deploy objectExceptionpublic org.bouncycastle.crypto.AsymmetricCipherKeyPair loadKeyPair(InputStream publicKeyIn, InputStream privateKeyIn) throws IOException
publicKeyIn - the public key .pem file input streamprivateKeyIn - the private key .pem file input streamIOException - if there is a problem loading the filespublic ModuleBytes standardPayment(Number paymentAmount)
paymentAmount - the number of notes paying to execution enginepublic Transfer newTransfer(Number amount, PublicKey target, Number id)
amount - the amount to transfertarget - the public key of the target accountid - the optional ID name argument valuepublic String deployToJson(Deploy deploy) throws IOException
deploy - the type object to writeIOException - - on write errorCopyright © 2021. All rights reserved.