use of com.hedera.hashgraph.sdk.crypto.ed25519.Ed25519PrivateKey in project hedera-sdk-java by hashgraph.
the class PrivateKeyFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
privateKey = view.findViewById(R.id.privateKey);
publicKey = view.findViewById(R.id.publicKey);
view.findViewById(R.id.button).setOnClickListener(v -> {
final Ed25519PrivateKey key = Ed25519PrivateKey.generate();
privateKey.setText(key.toString());
publicKey.setText(key.publicKey.toString());
});
}
use of com.hedera.hashgraph.sdk.crypto.ed25519.Ed25519PrivateKey in project hedera-sdk-java by hashgraph.
the class AccountBalanceFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
accountBalance = view.findViewById(R.id.accountBalance);
accountId = view.findViewById(R.id.accountId);
view.findViewById(R.id.button).setOnClickListener(v -> {
try {
final AccountId operatorId = AccountId.fromString(view.getResources().getString(R.string.operator_id));
final Ed25519PrivateKey operatorKey = Ed25519PrivateKey.fromString(view.getResources().getString(R.string.operator_key));
Client client = Client.forTestnet().setOperator(operatorId, operatorKey);
final AccountId id = AccountId.fromString(accountId.getText().toString());
new AccountBalanceAsyncTask(id).execute(client);
} catch (IllegalArgumentException e) {
accountBalance.setText("Error: " + e.getMessage());
}
});
}
use of com.hedera.hashgraph.sdk.crypto.ed25519.Ed25519PrivateKey in project hedera-sdk-java by hashgraph.
the class CryptoTransferFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
recipientAccountId = view.findViewById(R.id.recipientAccountId);
amountToSend = view.findViewById(R.id.amountToSend);
resultText = view.findViewById(R.id.transferResult);
view.findViewById(R.id.sendHbar).setOnClickListener(v -> {
try {
final AccountId operatorId = AccountId.fromString(view.getResources().getString(R.string.operator_id));
final Ed25519PrivateKey operatorKey = Ed25519PrivateKey.fromString(view.getResources().getString(R.string.operator_key));
Client client = Client.forTestnet().setOperator(operatorId, operatorKey);
final AccountId recipientId = AccountId.fromString(recipientAccountId.getText().toString());
final Hbar amount = new Hbar(new BigDecimal(amountToSend.getText().toString()).longValueExact());
new TransferAsyncTask(operatorId, recipientId, amount).execute(client);
} catch (Throwable e) {
resultText.setText("Error: " + e.getMessage());
}
});
}
Aggregations