Package com.sdk.accumulate.service
Class Client
java.lang.Object
com.sdk.accumulate.service.Client
- Direct Known Subclasses:
LocalDevNetClient
,TestNetClient
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddCredits
(AddCreditsArg addCreditsArg, OriginSigner originSigner) Method used to Add credits to an accountburnTokens
(BurnTokensArg burnTokensArg, OriginSigner originSigner) Method used to burn specified tokens from an accountcreateDataAccount
(CreateDataAccountArg createDataAccountArg, OriginSigner originSigner) Method used to Create a Data AccountcreateIdentity
(CreateIdentityArg createIdentityArg, OriginSigner originSigner) Method used to create an ADIcreateKeyBook
(CreateKeyBookArg createKeyBookArg, OriginSigner originSigner) Method used to create Key bookcreateKeyPage
(CreateKeyPageArg createKeyPageArg, OriginSigner originSigner) Method used to create key pagecreateToken
(CreateTokenArg createTokenArg, OriginSigner originSigner) Method used to create TokenscreateTokenAccount
(CreateTokenAccountArg createTokenAccountArg, OriginSigner originSigner) Method used to create a token accountMethod used to Get faucet for an account.Method used to query about a lite account.getQueryChain
(String chainId) Method used to get the transaction based on chain IDgetQueryData
(String accUrl) Method used to query the Data based on AccountgetQueryKeyIndex
(String accUrl) Method used query the Key index based on AccountgetTransaction
(String txid) Method used to get the transaction details based on transaction IDgetTransactionHistory
(String accUrl, int count) Method used to get the transaction history based on accountissueTokens
(IssueTokensArg issueTokensArg, OriginSigner originSigner) Method used to Issue tokens to a specific accountsendToken
(SendTokensArg sendTokensArg, OriginSigner originSigner) Method used to Send tokens to a specific accountupdateKeyPage
(UpdateKeyPageArg updateKeyPageArg, OriginSigner originSigner) Method used to update an existing Key pagewriteData
(WriteDataArg writeDataArg, OriginSigner originSigner) Method used to write Data
-
Field Details
-
baseUrl
Accumulate network Url (That may be a test net or Main net or local Devnet)
-
-
Constructor Details
-
Client
- Parameters:
baseUrl
- If you are connecting other than test net you have to provide the Accumulate network URL
-
Client
public Client()It will directly connect with Accumulate public test net (https://testnet.accumulatenetwork.io/v2)
-
-
Method Details
-
getQuery
Method used to query about a lite account. It will return the details of a specific account- Parameters:
accUrl
- Account URL- Returns:
- Returns RPC Call Response { "jsonrpc": "2.0", "result": { "type": "liteTokenAccount", "merkleState": { "count": 1, "roots": [ "c7e59bfea5029963ee07c27a09e5e7467e30cd4ebc1822e16ebbb173a8ff685c" ] }, "data": { "type": "liteTokenAccount", "url": "acc://5fd54e898c2c60e9757d2cd36f3a14b6df895b237690afb1/ACME", "keyBook": "0000000000000000000000000000000000000000000000000000000000000000", "managerKeyBook": "", "tokenUrl": "acc://ACME", "balance": 1000000000, "txCount": 1, "creditBalance": 0 } }, "id": 0 }
- Throws:
IOException
- Throws IOExceptionException
-
getTransactionHistory
Method used to get the transaction history based on account- Parameters:
accUrl
- Account URLcount
- Transaction history count- Returns:
- Returns RPC Call Response { "jsonrpc": "2.0", "result": { "type": "txHistory", "items": [ { "type": "syntheticDepositTokens", "data": { "cause": "395caba8d27056614abf991ab40a1b53a8b8babc4919d34ababa24f603f8a1a3", "token": "ACME", "amount": "1000000000" }, "origin": "acc://09bca3fcd7e28434f4fb5a3c7317d64e955acbc102e45df5/ACME", "sponsor": "acc://09bca3fcd7e28434f4fb5a3c7317d64e955acbc102e45df5/ACME", "keyPage": { "height": 1, "index": 0 }, "transactionHash": "2bd403d477d70b87e35e88b0aa316242d89aa41db5b5dea6df5a1c470e424671", "txid": "2bd403d477d70b87e35e88b0aa316242d89aa41db5b5dea6df5a1c470e424671", "signatures": [ { "Nonce": 390, "PublicKey": "Kdjx5D4pOOIrd/gNV3S+21DF5g93dR6IZ1ZfwfDi94g=", "Signature": "tyKHXcPWzJBwkNJOTljvYmRQdzi9eJROgfIVJkcIJ6+HnmrYZnTtCKz5jE/Q5mKfvqiquAfEvUWw4nXHjpEMAA==" } ], "status": { "delivered": true, "result": {} } }, { "type": "syntheticDepositTokens", "data": { "cause": "4d253e95399ccbd6b7044d1fff85a6a7d6dd83ab209cdd25a416dd2c70c21e9d", "token": "ACME", "amount": "1000000000" }, "origin": "acc://09bca3fcd7e28434f4fb5a3c7317d64e955acbc102e45df5/ACME", "sponsor": "acc://09bca3fcd7e28434f4fb5a3c7317d64e955acbc102e45df5/ACME", "keyPage": { "height": 1, "index": 0 }, "transactionHash": "bc573897d25828887b393a54ba8378d6af20298738dc909af4fb86c553689c9c", "txid": "bc573897d25828887b393a54ba8378d6af20298738dc909af4fb86c553689c9c", "signatures": [ { "Nonce": 516, "PublicKey": "Kdjx5D4pOOIrd/gNV3S+21DF5g93dR6IZ1ZfwfDi94g=", "Signature": "y02cNToZnoqabkIY8V2v3UjQvdh47JNQzjlFHpsdYVsFQUtYIWZDJKzS8nahTcTfdoPH0SR4dEZ373W+AeAiAQ==" } ], "status": { "delivered": true, "result": {} } } ], "start": 0, "count": 2, "total": 40 }, "id": 0 }
- Throws:
IOException
- Throws IOExceptionException
-
getTransaction
Method used to get the transaction details based on transaction ID- Parameters:
txid
- Transaction Reference ID- Returns:
- Returns RPC Call Response { "jsonrpc": "2.0", "result": { "type": "syntheticDepositTokens", "data": { "cause": "395caba8d27056614abf991ab40a1b53a8b8babc4919d34ababa24f603f8a1a3", "token": "ACME", "amount": "1000000000" }, "origin": "acc://09bca3fcd7e28434f4fb5a3c7317d64e955acbc102e45df5/ACME", "sponsor": "acc://09bca3fcd7e28434f4fb5a3c7317d64e955acbc102e45df5/ACME", "keyPage": { "height": 1, "index": 0 }, "transactionHash": "2bd403d477d70b87e35e88b0aa316242d89aa41db5b5dea6df5a1c470e424671", "txid": "2bd403d477d70b87e35e88b0aa316242d89aa41db5b5dea6df5a1c470e424671", "signatures": [ { "Nonce": 390, "PublicKey": "Kdjx5D4pOOIrd/gNV3S+21DF5g93dR6IZ1ZfwfDi94g=", "Signature": "tyKHXcPWzJBwkNJOTljvYmRQdzi9eJROgfIVJkcIJ6+HnmrYZnTtCKz5jE/Q5mKfvqiquAfEvUWw4nXHjpEMAA==" } ], "status": { "delivered": true, "result": {} } }, "id": 0 }
- Throws:
IOException
- Throws IOExceptionException
-
getQueryChain
Method used to get the transaction based on chain ID- Parameters:
chainId
- Transaction chain ID- Returns:
- Returns RPC Call Response { "jsonrpc": "2.0", "result": { "type": "keyPage", "merkleState": { "count": 1, "roots": [ "cb0d7ccf124390693628c86cbb31cba64cee6c56b9086403f22c805b6bdf06d8" ] }, "data": { "type": "keyPage", "url": "acc://kg1/prishth", "keyBook": "4b6fdf9d3e4ca631a0d1ca92eef528b7cfcd16a953efbe5e70811cd3841e88da", "managerKeyBook": "", "creditBalance": 0, "keys": [ { "publicKey": "57ddf8f09ddaaf28656fcca6ef1d4bb028c02ed31584c36df1e0ffcacc14d90c" } ] } }, "id": 0 }
- Throws:
IOException
- Throws IOExceptionException
-
getQueryData
Method used to query the Data based on Account- Parameters:
accUrl
- Account URL- Returns:
- Returns RPC Call Response { "jsonrpc": "2.0", "result": { "type": "dataEntry", "merkleState": { "count": 2, "roots": [ null, "87c5cc4a4f86accac328b5773c3e6fe29e8af23cbaa5a14f154011e2e71af4d2" ] }, "data": { "entryHash": "b45fa53718dbc5bf31f2f6134d1ff84fe22b3760face9c2ab012fd66d16d1808", "entry": { "data": "61646974776f64617461" } } }, "id": 0 }
- Throws:
IOException
- Throws IOExceptionException
-
getFaucet
Method used to Get faucet for an account. It also activates an account with the network- Parameters:
accUrl
- Account URL- Returns:
- Returns RPC Call Response { "jsonrpc": "2.0", "result": { "hash": "be347539c19cb0d5e1b396b4142a637ff94aec795e6e81442d37fe73469bc5dd", "message": "CheckTx", "txid": "7ec47e5a48e7b6e38040748885a9702ef1949b45325ac5eafd0f616457e92cda" }, "id": 0 }
- Throws:
IOException
- Throws IOExceptionException
-
getQueryKeyIndex
Method used query the Key index based on Account- Parameters:
accUrl
- Account URL- Returns:
- Returns RPC Call Response { "jsonrpc": "2.0", "result": { "type": "key-page-index", "data": { "keyBook": "acc://adione/book0", "keyPage": "acc://adione/page0", "index": 0 } }, "id": 0 }
- Throws:
IOException
- Throws IOExceptionException
-
addCredits
Method used to Add credits to an account- Parameters:
addCreditsArg
- Add Credits Payload ParametersoriginSigner
- Signer of the transaction (That maybe a lite account or an ADI or a Data account or a Token Account)- Returns:
- Response Json which is sent by Acccumulate network { "jsonrpc": "2.0", "result": { "transactionHash": "1e6c539958603c0281df4831d2e7633db4fe32d0678c6bf60246d3f0597dbcdb", "txid": "1e6c539958603c0281df4831d2e7633db4fe32d0678c6bf60246d3f0597dbcdb", "envelopeHash": "6b776939deaf76f0a6568565e89c71d063a8a608c5437ce733226f344a55848e", "simpleHash": "7adda8c51d3edc39e6bb4abe3392ac528203387ed63290e338001fbe3b8b4ba1", "hash": "7adda8c51d3edc39e6bb4abe3392ac528203387ed63290e338001fbe3b8b4ba1" }, "id": 1647927131154 }
- Throws:
Exception
- Throws Exception in the case of RPC call failure or Parse failure
-
burnTokens
Method used to burn specified tokens from an account- Parameters:
burnTokensArg
- Burn tokens Payload argumentsoriginSigner
- Signer of the transaction (That maybe a lite account or an ADI or a Data account or a Token Account)- Returns:
- Response Json which is sent by Acccumulate network { "jsonrpc": "2.0", "result": { "transactionHash": "ecaa4ee1711818d556dac1d19f11210b9f485e82c32d448a9ced7fcdb5f3b853", "txid": "ecaa4ee1711818d556dac1d19f11210b9f485e82c32d448a9ced7fcdb5f3b853", "envelopeHash": "3d88e4cb2f4b67867b6d7bd539044622031c0619e309cd8fa7758bc11bef9556", "simpleHash": "4206f202d01ea0a71c515cad863bd28eaa6e38d7bc05337266de2c3407d58bf2", "hash": "4206f202d01ea0a71c515cad863bd28eaa6e38d7bc05337266de2c3407d58bf2" }, "id": 1647927356568 }
- Throws:
Exception
- Throws Exception in the case of RPC call failure or Parse failure
-
createDataAccount
public String createDataAccount(CreateDataAccountArg createDataAccountArg, OriginSigner originSigner) throws Exception Method used to Create a Data Account- Parameters:
createDataAccountArg
- Create data account payload argumentsoriginSigner
- Signer of the transaction (That maybe a lite account or an ADI or a Data account or a Token Account)- Returns:
- Response Json which is sent by Acccumulate network { "jsonrpc": "2.0", "result": { "transactionHash": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "txid": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "envelopeHash": "4c129f458aa27df0f0d990b077ba213f7ba6767466e50fb02e48ea135c050ebe", "simpleHash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401", "hash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401" }, "id": 1647927432541 }
- Throws:
Exception
- Throws Exception in the case of RPC call failure or Parse failure
-
createIdentity
public String createIdentity(CreateIdentityArg createIdentityArg, OriginSigner originSigner) throws Exception Method used to create an ADI- Parameters:
createIdentityArg
- Create ADI Payload ArgumentsoriginSigner
- Signer of the transaction (That maybe a lite account or an ADI or a Data account or a Token Account)- Returns:
- Response Json which is sent by Acccumulate network { "jsonrpc": "2.0", "result": { "transactionHash": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "txid": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "envelopeHash": "4c129f458aa27df0f0d990b077ba213f7ba6767466e50fb02e48ea135c050ebe", "simpleHash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401", "hash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401" }, "id": 1647927432541 }
- Throws:
Exception
- Throws Exception in the case of RPC call failure or Parse failure
-
createKeyBook
public String createKeyBook(CreateKeyBookArg createKeyBookArg, OriginSigner originSigner) throws Exception Method used to create Key book- Parameters:
createKeyBookArg
- Create key book payload argumentsoriginSigner
- Signer of the transaction (That maybe a lite account or an ADI or a Data account or a Token Account)- Returns:
- Response Json which is sent by Acccumulate network { "jsonrpc": "2.0", "result": { "transactionHash": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "txid": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "envelopeHash": "4c129f458aa27df0f0d990b077ba213f7ba6767466e50fb02e48ea135c050ebe", "simpleHash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401", "hash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401" }, "id": 1647927432541 }
- Throws:
Exception
- Throws Exception in the case of RPC call failure or Parse failure
-
createKeyPage
public String createKeyPage(CreateKeyPageArg createKeyPageArg, OriginSigner originSigner) throws Exception Method used to create key page- Parameters:
createKeyPageArg
- Create Key Page payload argumentsoriginSigner
- Signer of the transaction (That maybe a lite account or an ADI or a Data account or a Token Account)- Returns:
- Response Json which is sent by Acccumulate network { "jsonrpc": "2.0", "result": { "transactionHash": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "txid": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "envelopeHash": "4c129f458aa27df0f0d990b077ba213f7ba6767466e50fb02e48ea135c050ebe", "simpleHash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401", "hash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401" }, "id": 1647927432541 }
- Throws:
Exception
- Throws Exception in the case of RPC call failure or Parse failure
-
createTokenAccount
public String createTokenAccount(CreateTokenAccountArg createTokenAccountArg, OriginSigner originSigner) throws Exception Method used to create a token account- Parameters:
createTokenAccountArg
- Create token account payload argumentsoriginSigner
- Signer of the transaction (That maybe a lite account or an ADI or a Data account or a Token Account)- Returns:
- Response Json which is sent by Acccumulate network { "jsonrpc": "2.0", "result": { "transactionHash": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "txid": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "envelopeHash": "4c129f458aa27df0f0d990b077ba213f7ba6767466e50fb02e48ea135c050ebe", "simpleHash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401", "hash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401" }, "id": 1647927432541 }
- Throws:
Exception
- Throws Exception in the case of RPC call failure or Parse failure
-
createToken
public String createToken(CreateTokenArg createTokenArg, OriginSigner originSigner) throws Exception Method used to create Tokens- Parameters:
createTokenArg
- Create token payload argumentsoriginSigner
- Signer of the transaction (That maybe a lite account or an ADI or a Data account or a Token Account)- Returns:
- Response Json which is sent by Acccumulate network { "jsonrpc": "2.0", "result": { "transactionHash": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "txid": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "envelopeHash": "4c129f458aa27df0f0d990b077ba213f7ba6767466e50fb02e48ea135c050ebe", "simpleHash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401", "hash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401" }, "id": 1647927432541 }
- Throws:
Exception
- Throws Exception in the case of RPC call failure or Parse failure
-
issueTokens
public String issueTokens(IssueTokensArg issueTokensArg, OriginSigner originSigner) throws Exception Method used to Issue tokens to a specific account- Parameters:
issueTokensArg
- Issue tokens Payload argumentsoriginSigner
- Signer of the transaction (That maybe a lite account or an ADI or a Data account or a Token Account)- Returns:
- Response Json which is sent by Acccumulate network { "jsonrpc": "2.0", "result": { "transactionHash": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "txid": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "envelopeHash": "4c129f458aa27df0f0d990b077ba213f7ba6767466e50fb02e48ea135c050ebe", "simpleHash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401", "hash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401" }, "id": 1647927432541 }
- Throws:
Exception
- Throws Exception in the case of RPC call failure or Parse failure
-
sendToken
Method used to Send tokens to a specific account- Parameters:
sendTokensArg
- Send tokens Payload ArgumentsoriginSigner
- Signer of the transaction (That maybe a lite account or an ADI or a Data account or a Token Account)- Returns:
- Response Json which is sent by Acccumulate network { "jsonrpc": "2.0", "result": { "transactionHash": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "txid": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "envelopeHash": "4c129f458aa27df0f0d990b077ba213f7ba6767466e50fb02e48ea135c050ebe", "simpleHash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401", "hash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401" }, "id": 1647927432541 }
- Throws:
Exception
- Throws Exception in the case of RPC call failure or Parse failure
-
updateKeyPage
public String updateKeyPage(UpdateKeyPageArg updateKeyPageArg, OriginSigner originSigner) throws Exception Method used to update an existing Key page- Parameters:
updateKeyPageArg
- Update Key page payload argumentsoriginSigner
- Signer of the transaction (That maybe a lite account or an ADI or a Data account or a Token Account)- Returns:
- Response Json which is sent by Acccumulate network { "jsonrpc": "2.0", "result": { "transactionHash": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "txid": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "envelopeHash": "4c129f458aa27df0f0d990b077ba213f7ba6767466e50fb02e48ea135c050ebe", "simpleHash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401", "hash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401" }, "id": 1647927432541 }
- Throws:
Exception
- Throws Exception in the case of RPC call failure or Parse failure
-
writeData
Method used to write Data- Parameters:
writeDataArg
- Write Data Payload argumentsoriginSigner
- Signer of the transaction (That maybe a lite account or an ADI or a Data account or a Token Account)- Returns:
- Response Json which is sent by Acccumulate network { "jsonrpc": "2.0", "result": { "transactionHash": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "txid": "0348c88f3ea52021625ef872ff2be961d39b4b4d78fd9c76070f6a08da15fbbf", "envelopeHash": "4c129f458aa27df0f0d990b077ba213f7ba6767466e50fb02e48ea135c050ebe", "simpleHash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401", "hash": "0c7c5ff7c865afb7c488eba3e3fa389f79bd4a956c49b026257ea9b31bbe2401" }, "id": 1647927432541 }
- Throws:
Exception
- Throws Exception in the case of RPC call failure or Parse failure
-