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.Object
Account 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 void
checkAccountId(java.lang.String accountId)
Method to check that the human-readable account id follows the naming conventionstatic 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)
Sends aTransferAction
transaction calling a contract to create_account and waits for result usingNearService.sendTransactionAwait(String)
static TransactionAwait
createNamedAccount(Network network, java.lang.String newAccountId, PublicKey newAccountPublicKey, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey)
Sends aTransferAction
transaction calling a contract to create_account and waits for result usingNearService.sendTransactionAwait(String)
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)
Sends aTransferAction
transaction async usingNearService.sendTransactionAsync(String)
with the needed actions to generate a named account and waits for result usingNearService.sendTransactionAwait(String)
static EncodedHash
createNamedAccountAsync(Network network, java.lang.String newAccountId, PublicKey newAccountPublicKey, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey)
Sends aTransferAction
transaction async usingNearService.sendTransactionAsync(String)
with the needed actions to generate a named account and waits for result usingNearService.sendTransactionAwait(String)
static TransactionAwait
createSubAccount(NearService nearService, java.lang.String newAccountId, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey)
Sends aTransferAction
transaction with the needed actions to generate a sub account and waits for result usingNearService.sendTransactionAwait(String)
static EncodedHash
createSubAccountAsync(NearService nearService, java.lang.String newAccountId, java.math.BigInteger amountToNewAccount, java.lang.String creatorAccountId, PublicKey creatorPublicKey, PrivateKey creatorPrivateKey)
Sends aTransferAction
transaction 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 aTransferAction
transaction 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:
TransactionAwait
object 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 aTransferAction
transaction 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:
TransactionAwait
object 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 aTransferAction
transaction 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 aTransferAction
transaction 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 aTransferAction
transaction 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:
TransactionAwait
object 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 aTransferAction
transaction 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 NearServiceException
Method 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
-
-