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

TokenAccountNotFoundError #182

Open
tolgaand opened this issue Dec 12, 2022 · 5 comments
Open

TokenAccountNotFoundError #182

tolgaand opened this issue Dec 12, 2022 · 5 comments

Comments

@tolgaand
Copy link

It uses this package to send tokens to users and verify transactions.
But when I send tokens to a user who has never had a token account, I get a "TokenAccountNotFoundError" error.

To solve this problem, the createTransfer file used in;
How to convert the function "getAssociatedTokenAddress" to the function "getOrCreateAssociatedTokenAccount"?

@flodef
Copy link
Contributor

flodef commented Dec 13, 2022

I understand your point... However, I disagree on the way to solve the problem.

Let's say there is a merchant receiving the token. It has first to create the token he wants to receive, once and for all.
When the customer is paying, he only needs to pay his own transaction fee, not to create the token for the merchant.

Otherwise, it could be like a tax if after receiving a payment, the merchant delete his token account (and receive some sol for closing the account). Then next customer create again the merchant token account, etc.

@tolgaand
Copy link
Author

I understand your point... However, I disagree on the way to solve the problem.

Let's say there is a merchant receiving the token. It has first to create the token he wants to receive, once and for all.

When the customer is paying, he only needs to pay his own transaction fee, not to create the token for the merchant.

Otherwise, it could be like a tax if after receiving a payment, the merchant delete his token account (and receive some sol for closing the account). Then next customer create again the merchant token account, etc.

I hadn't thought of that, thank you.

@flodef
Copy link
Contributor

flodef commented Dec 15, 2022

You're welcome. Happy to have been of some help :-)

@yamijuan
Copy link

What if the merchant provides a TokenAccount instead of a wallet address? this is our case and it fails since the recipient is already a token account

@flodef
Copy link
Contributor

flodef commented Feb 28, 2023

Hey There, great question!
My advice would be that you go on Solscan (or any other Solana explorer) by typing https://solscan.io/account/MerchantTokenAccount.
From there, you can easily spot the account owner and set it up.
(eg : https://solscan.io/account/AAhtuv3wpwNSQFzBCKGnb4fhSxX4LY4VgRjEH9tqK52k where the account owner is [BNnncdQZ9YokyQJX8of4K2YGw3pvLt2SVkXK131E1nFy])
Hope it helps :-)

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

3 participants