Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

KIN SDK randomly picks token #2 over token #1 #8

Open
skyf0xx opened this issue May 1, 2021 · 2 comments
Open

KIN SDK randomly picks token #2 over token #1 #8

skyf0xx opened this issue May 1, 2021 · 2 comments

Comments

@skyf0xx
Copy link

skyf0xx commented May 1, 2021

The token account returned by the SDKs is changing sometimes.

token_accounts = client2.resolve_token_accounts(PublicKey.from_string(public_key_address))
token_account = token_accounts[0]
balance = client2.get_balance(token_account)

Most of the time, the correct account is returned, but on some edge cases, the zero balance account is returned.

@skyf0xx
Copy link
Author

skyf0xx commented May 3, 2021

An update on the issue - It's being tracked, and an option will be available to merge token accounts (probably by default unless the developer opts out).

This is part of issue 2 in the technical roadmap

A short term stop gap is to check the 2nd account balance if the first one returns zero

@showered
Copy link

showered commented May 3, 2021

As far as I can tell there are two things that cause multiple token accounts:

  1. Botched migration. An account is migrated twice or more during the "on demand migration" process. For these accounts, the resolveTokenAccounts() method does work, but it's unreliable. There seems to be some caching. Sometimes it only returns one account.

  2. Depositing kin from outside of agora. It looks like senderCreate ends up creating a new Kin token account in the Solana owner account. Bryan mentioned something to do with derivation paths. This makes the kin totally inaccessible and hidden from the resolveTokenAccounts method.

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

No branches or pull requests

2 participants