Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send failed for NEW Address #13

Open
kunalransing opened this issue Apr 16, 2018 · 2 comments
Open

Send failed for NEW Address #13

kunalransing opened this issue Apr 16, 2018 · 2 comments

Comments

@kunalransing
Copy link

Hi,
My user can add his other NEM wallet's address which can be new, so below code is not working since not able to get public key using KeyConvertor.getPublicKeyFromAddress().

		NemAnnounceResult result = TransferTransactionBuilder
			    .sender(new Account(new KeyPair(PrivateKey.fromHexString("---private key----")))) 
			    .recipient(new Account(new KeyPair(PublicKey.fromHexString(**KeyConvertor.getPublicKeyFromAddress**("TCX3DLZ4YEJF2YRPXFG3VN6R2Y5ZEFUH32VADHXH")))))
			    .amount(Amount.fromMicroNem( amount.multiply(BigDecimal.valueOf(MICRONEMS_IN_NEM)).longValue()))
			    .fee(Amount.fromMicroNem( fee.multiply(BigDecimal.valueOf(MICRONEMS_IN_NEM)).longValue()) )
			    .buildAndSendTransaction();

How to send coins in above case ?
Please help me.
Thanks.

@kunalransing
Copy link
Author

Any update ? Please help.

@dexterslabor
Copy link

dexterslabor commented May 25, 2018

Only accounts that have already published a transaction have a public key assigned to the account. Otherwise the field is null.

See NIS1 API documentation https://nemproject.github.io/#account-related-requests

This is the reason why .getPublicKeyFromAddress cannot be used to get the public key for the account.

To send a simple transfer transaction without an encrypted message, it is not necessary to have the public key of the recipient (address is enough).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants