Package com.github.katenachain
Class Transactor
- java.lang.Object
-
- com.github.katenachain.Transactor
-
public class Transactor extends Object
Transactor provides helper methods to hide the complexity of Tx creation, signature and API dialog.
-
-
Constructor Summary
Constructors Constructor Description Transactor(String apiUrl)Transactor constructor.Transactor(String apiUrl, String chainId, TxSigner txSigner)Transactor constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TxDataretrieveCertificate(String companyBcId, String id)fetches the API and returns a certificate from the state.TxResultsretrieveCertificateTxs(String companyBcId, String id, int page, int txPerPage)fetches the API and returns all txs related to a certificate fqid.KeyV1[]retrieveCompanyKeys(String companyBcId, int page, int txPerPage)fetches the API and returns a list of keys for a company from the state.KeyV1retrieveKey(String companyBcId, String id)fetches the API and returns a key from the state.TxResultsretrieveKeyTxs(String companyBcId, String id, int page, int txPerPage)fetches the API and returns all txs related to a key fqid.TxResultretrieveLastCertificateTx(String companyBcId, String id)fetches the API and returns the last tx related to a certificate fqid.TxResultretrieveLastKeyTx(String companyBcId, String id)fetches the API and returns the last tx related to a key fqid.TxResultretrieveLastSecretTx(String companyBcId, String id)fetches the API and returns the last tx related to a secret fqid.TxDataretrieveSecret(String companyBcId, String id)fetches the API and returns a secret from the state.TxResultsretrieveSecretTxs(String companyBcId, String id, int page, int txPerPage)fetches the API and returns all txs related to a secret fqid.TxResultretrieveTx(String hash)fetches the API and return any tx by its hash.SendTxResultsendCertificateEd25519V1Tx(String id, PublicKey signer, byte[] signature)creates a CertificateEd25519 (V1) and sends it to the API.SendTxResultsendCertificateRawV1Tx(String id, byte[] value)creates a CertificateRaw (V1) and sends it to the API.SendTxResultsendKeyCreateV1Tx(String id, PublicKey publicKey, String role)creates a KeyCreate (V1) and sends it to the API.SendTxResultsendKeyRevokeV1Tx(String id)creates a KeyRevoke (V1) and sends it to the API.SendTxResultsendKeyRotateV1Tx(String id, PublicKey publicKey)creates a KeyRotate (V1) and sends it to the API.SendTxResultsendSecretNaclBoxV1Tx(String id, PublicKey sender, byte[] nonce, byte[] content)creates a SecretNaclBox (V1) and sends it to the API.SendTxResultsendTx(TxData txData)creates a tx from a tx data and the provided tx signer info and chain id, signs it, encodes it and sends it to the api.
-
-
-
Method Detail
-
sendCertificateRawV1Tx
public SendTxResult sendCertificateRawV1Tx(String id, byte[] value) throws ApiException, IOException, NoSuchAlgorithmException, InvalidKeyException, SignatureException, ClientException
creates a CertificateRaw (V1) and sends it to the API.
-
sendCertificateEd25519V1Tx
public SendTxResult sendCertificateEd25519V1Tx(String id, PublicKey signer, byte[] signature) throws ApiException, IOException, NoSuchAlgorithmException, InvalidKeyException, SignatureException, ClientException
creates a CertificateEd25519 (V1) and sends it to the API.
-
sendSecretNaclBoxV1Tx
public SendTxResult sendSecretNaclBoxV1Tx(String id, PublicKey sender, byte[] nonce, byte[] content) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, IOException, ApiException, ClientException
creates a SecretNaclBox (V1) and sends it to the API.
-
sendKeyCreateV1Tx
public SendTxResult sendKeyCreateV1Tx(String id, PublicKey publicKey, String role) throws ApiException, IOException, NoSuchAlgorithmException, InvalidKeyException, SignatureException, ClientException
creates a KeyCreate (V1) and sends it to the API.
-
sendKeyRotateV1Tx
public SendTxResult sendKeyRotateV1Tx(String id, PublicKey publicKey) throws ApiException, IOException, NoSuchAlgorithmException, InvalidKeyException, SignatureException, ClientException
creates a KeyRotate (V1) and sends it to the API.
-
sendKeyRevokeV1Tx
public SendTxResult sendKeyRevokeV1Tx(String id) throws ApiException, IOException, NoSuchAlgorithmException, InvalidKeyException, SignatureException, ClientException
creates a KeyRevoke (V1) and sends it to the API.
-
sendTx
public SendTxResult sendTx(TxData txData) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, IOException, ApiException, ClientException
creates a tx from a tx data and the provided tx signer info and chain id, signs it, encodes it and sends it to the api.
-
retrieveLastCertificateTx
public TxResult retrieveLastCertificateTx(String companyBcId, String id) throws IOException, ApiException
fetches the API and returns the last tx related to a certificate fqid.- Throws:
IOExceptionApiException
-
retrieveCertificateTxs
public TxResults retrieveCertificateTxs(String companyBcId, String id, int page, int txPerPage) throws IOException, ApiException
fetches the API and returns all txs related to a certificate fqid.- Throws:
IOExceptionApiException
-
retrieveLastSecretTx
public TxResult retrieveLastSecretTx(String companyBcId, String id) throws IOException, ApiException
fetches the API and returns the last tx related to a secret fqid.- Throws:
IOExceptionApiException
-
retrieveSecretTxs
public TxResults retrieveSecretTxs(String companyBcId, String id, int page, int txPerPage) throws IOException, ApiException
fetches the API and returns all txs related to a secret fqid.- Throws:
IOExceptionApiException
-
retrieveLastKeyTx
public TxResult retrieveLastKeyTx(String companyBcId, String id) throws IOException, ApiException
fetches the API and returns the last tx related to a key fqid.- Throws:
IOExceptionApiException
-
retrieveKeyTxs
public TxResults retrieveKeyTxs(String companyBcId, String id, int page, int txPerPage) throws IOException, ApiException
fetches the API and returns all txs related to a key fqid.- Throws:
IOExceptionApiException
-
retrieveTx
public TxResult retrieveTx(String hash) throws IOException, ApiException
fetches the API and return any tx by its hash.- Throws:
IOExceptionApiException
-
retrieveCertificate
public TxData retrieveCertificate(String companyBcId, String id) throws IOException, ApiException
fetches the API and returns a certificate from the state.- Throws:
IOExceptionApiException
-
retrieveSecret
public TxData retrieveSecret(String companyBcId, String id) throws IOException, ApiException
fetches the API and returns a secret from the state.- Throws:
IOExceptionApiException
-
retrieveKey
public KeyV1 retrieveKey(String companyBcId, String id) throws IOException, ApiException
fetches the API and returns a key from the state.- Throws:
IOExceptionApiException
-
retrieveCompanyKeys
public KeyV1[] retrieveCompanyKeys(String companyBcId, int page, int txPerPage) throws IOException, ApiException
fetches the API and returns a list of keys for a company from the state.- Throws:
IOExceptionApiException
-
-