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(NearService nearService, 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 usingNearService.sendTransactionAwait(String)static 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 usingNearService.sendTransactionAwait(String)static EncodedHashcreateNamedAccountAsync(NearService nearService, 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 usingNearService.sendTransactionAsync(String)with the needed actions to generate a named account and waits for result usingNearService.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 usingNearService.sendTransactionAsync(String)with the needed actions to generate a named account and waits for result usingNearService.sendTransactionAwait(String)static TransactionAwaitcreateSubAccount(NearService nearService, 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 usingNearService.sendTransactionAwait(String)static EncodedHashcreateSubAccountAsync(NearService nearService, java.lang.String newAccountId, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey)Sends aTransferActiontransaction async usingNearService.sendTransactionAsync(String)with the needed actions to generate a sub account and waits for result usingNearService.sendTransactionAwait(String)
-
-
-
Method Detail
-
createNamedAccount
public static TransactionAwait createNamedAccount(NearService nearService, 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, NearServiceException
Sends aTransferActiontransaction calling a contract to create_account and waits for result usingNearService.sendTransactionAwait(String)- Parameters:
nearService- 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 transactionNearServiceException- 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 usingNearService.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 transactionNearServiceException- any NEAR-RPC exception
-
createNamedAccountAsync
public static EncodedHash createNamedAccountAsync(NearService nearService, 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, NearServiceException
Sends aTransferActiontransaction async usingNearService.sendTransactionAsync(String)with the needed actions to generate a named account and waits for result usingNearService.sendTransactionAwait(String)- Parameters:
nearService- 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 transactionNearServiceException- 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, NearServiceException
Sends aTransferActiontransaction async usingNearService.sendTransactionAsync(String)with the needed actions to generate a named account and waits for result usingNearService.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 transactionNearServiceException- any NEAR-RPC exception
-
createSubAccount
public static TransactionAwait createSubAccount(NearService nearService, 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 usingNearService.sendTransactionAwait(String)- Parameters:
nearService- 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(NearService nearService, java.lang.String newAccountId, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey) throws java.security.GeneralSecurityException
Sends aTransferActiontransaction async usingNearService.sendTransactionAsync(String)with the needed actions to generate a sub account and waits for result usingNearService.sendTransactionAwait(String)- Parameters:
nearService- 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 NearServiceExceptionMethod to check that the human-readable account id follows the naming convention- Parameters:
accountId- human-readable account id- Throws:
NearServiceException- thows if the name deviates from the regex pattern
-
-