Package com.syntifi.near.api.rpc.service
Class AccountService
- java.lang.Object
-
- com.syntifi.near.api.rpc.service.AccountService
-
public class AccountService extends java.lang.ObjectAccount service provides methods to easily work with the creation of accounts- Since:
- 0.2.0
- Author:
- Alexandre Carvalho, Andre Bertolace
-
-
Constructor Summary
Constructors Constructor Description AccountService()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckAccountId(java.lang.String accountId)Method to check that the human-readable account id follows the naming conventionstatic TransactionAwaitcreateNamedAccount(Network network, java.lang.String newAccountId, PublicKey newAccountPublicKey, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey)Sends aTransferActiontransaction calling a contract to create_account and waits for result usingNearClient.sendTransactionAwait(String)static TransactionAwaitcreateNamedAccount(NearClient nearClient, java.lang.String mainDomain, java.lang.String newAccountId, PublicKey newAccountPublicKey, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey)Sends aTransferActiontransaction calling a contract to create_account and waits for result usingNearClient.sendTransactionAwait(String)static EncodedHashcreateNamedAccountAsync(Network network, java.lang.String newAccountId, PublicKey newAccountPublicKey, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey)Sends aTransferActiontransaction async usingNearClient.sendTransactionAsync(String)with the needed actions to generate a named account and waits for result usingNearClient.sendTransactionAwait(String)static EncodedHashcreateNamedAccountAsync(NearClient nearClient, java.lang.String mainDomain, java.lang.String newAccountId, PublicKey newAccountPublicKey, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey)Sends aTransferActiontransaction async usingNearClient.sendTransactionAsync(String)with the needed actions to generate a named account and waits for result usingNearClient.sendTransactionAwait(String)static TransactionAwaitcreateSubAccount(NearClient nearClient, java.lang.String newAccountId, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey)Sends aTransferActiontransaction with the needed actions to generate a sub account and waits for result usingNearClient.sendTransactionAwait(String)static EncodedHashcreateSubAccountAsync(NearClient nearClient, java.lang.String newAccountId, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey)Sends aTransferActiontransaction async usingNearClient.sendTransactionAsync(String)with the needed actions to generate a sub account and waits for result usingNearClient.sendTransactionAwait(String)
-
-
-
Method Detail
-
createNamedAccount
public static TransactionAwait createNamedAccount(NearClient nearClient, java.lang.String mainDomain, java.lang.String newAccountId, PublicKey newAccountPublicKey, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey) throws java.security.GeneralSecurityException, NearException
Sends aTransferActiontransaction calling a contract to create_account and waits for result usingNearClient.sendTransactionAwait(String)- Parameters:
nearClient- the near service instance to usemainDomain- network main domain (eg. near, testnet, ...)newAccountId- human-readable id of new accountnewAccountPublicKey- public key of new accountamountToNewAccount- the amount to transfercreatorAccountId- human-readable id of creatot accountcreatorPublicKey- signer/account creator public keycreatorPrivateKey- signer/account creator privatekey- Returns:
TransactionAwaitobject with the result- Throws:
java.security.GeneralSecurityException- thrown if failed to sign the transactionNearException- any NEAR-RPC exception
-
createNamedAccount
public static TransactionAwait createNamedAccount(Network network, java.lang.String newAccountId, PublicKey newAccountPublicKey, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey) throws java.security.GeneralSecurityException
Sends aTransferActiontransaction calling a contract to create_account and waits for result usingNearClient.sendTransactionAwait(String)- Parameters:
network- Near network of choicenewAccountId- human-readable id of new accountnewAccountPublicKey- public key of new accountamountToNewAccount- the amount to transfercreatorAccountId- human-readable id of creatot accountcreatorPublicKey- signer/account creator public keycreatorPrivateKey- signer/account creator privatekey- Returns:
TransactionAwaitobject with the result- Throws:
java.security.GeneralSecurityException- thrown if failed to sign the transactionNearException- any NEAR-RPC exception
-
createNamedAccountAsync
public static EncodedHash createNamedAccountAsync(NearClient nearClient, java.lang.String mainDomain, java.lang.String newAccountId, PublicKey newAccountPublicKey, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey) throws java.security.GeneralSecurityException
Sends aTransferActiontransaction async usingNearClient.sendTransactionAsync(String)with the needed actions to generate a named account and waits for result usingNearClient.sendTransactionAwait(String)- Parameters:
nearClient- the near service instance to usemainDomain- network main domain (eg. near, testnet, ...)newAccountId- human-readable id of new accountnewAccountPublicKey- public key of new accountamountToNewAccount- the amount to transfercreatorAccountId- human-readable id of creatot accountcreatorPublicKey- signer/account creator public keycreatorPrivateKey- signer/account creator privatekey- Returns:
- transaction hash
- Throws:
java.security.GeneralSecurityException- thrown if failed to sign the transactionNearException- any NEAR-RPC exception
-
createNamedAccountAsync
public static EncodedHash createNamedAccountAsync(Network network, java.lang.String newAccountId, PublicKey newAccountPublicKey, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey) throws java.security.GeneralSecurityException, NearException
Sends aTransferActiontransaction async usingNearClient.sendTransactionAsync(String)with the needed actions to generate a named account and waits for result usingNearClient.sendTransactionAwait(String)- Parameters:
network- Near network of choicenewAccountId- human-readable id of new accountnewAccountPublicKey- public key of new accountamountToNewAccount- the amount to transfercreatorAccountId- human-readable id of creatot accountcreatorPublicKey- signer/account creator public keycreatorPrivateKey- signer/account creator privatekey- Returns:
- transaction hash
- Throws:
java.security.GeneralSecurityException- thrown if failed to sign the transactionNearException- any NEAR-RPC exception
-
createSubAccount
public static TransactionAwait createSubAccount(NearClient nearClient, java.lang.String newAccountId, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey) throws java.security.GeneralSecurityException
Sends aTransferActiontransaction with the needed actions to generate a sub account and waits for result usingNearClient.sendTransactionAwait(String)- Parameters:
nearClient- the near service instance to usenewAccountId- human-readable id of new accountamountToNewAccount- the amount to transfercreatorAccountId- human-readable id of creatot accountcreatorPublicKey- signer/account creator public keycreatorPrivateKey- signer/account creator privatekey- Returns:
TransactionAwaitobject with the result- Throws:
java.security.GeneralSecurityException- thrown if failed to sign the transaction
-
createSubAccountAsync
public static EncodedHash createSubAccountAsync(NearClient nearClient, java.lang.String newAccountId, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey) throws java.security.GeneralSecurityException
Sends aTransferActiontransaction async usingNearClient.sendTransactionAsync(String)with the needed actions to generate a sub account and waits for result usingNearClient.sendTransactionAwait(String)- Parameters:
nearClient- the near service instance to usenewAccountId- human-readable id of new accountamountToNewAccount- the amount to transfercreatorAccountId- human-readable id of creatot accountcreatorPublicKey- signer/account creator public keycreatorPrivateKey- signer/account creator privatekey- Returns:
- transatcion hash
- Throws:
java.security.GeneralSecurityException- thrown if failed to sign the transaction
-
checkAccountId
public static void checkAccountId(java.lang.String accountId) throws NearExceptionMethod to check that the human-readable account id follows the naming convention- Parameters:
accountId- human-readable account id- Throws:
NearException- thows if the name deviates from the regex pattern
-
-