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

Add an section for SPL Token integration to the exchange integration guide #12281

Closed
mvines opened this issue Sep 16, 2020 · 13 comments · Fixed by #12303
Closed

Add an section for SPL Token integration to the exchange integration guide #12281

mvines opened this issue Sep 16, 2020 · 13 comments · Fixed by #12303
Assignees
Milestone

Comments

@mvines
Copy link
Member

mvines commented Sep 16, 2020

Considerations:

  1. The spl-token program is distributed as a source crate only. We might need to add binary release artifacts, perhaps include spl-token in the standard Solana release artifacts?
  2. The per-user deposit address will require the exchange to establish a token account (ie. spl-token create-account). This requires a pinch of Sol per user for rent, and is not quite as convenient as the native token deposit workflow. The user will need to "register their intent" in the Exchange UI. There may be other alternatives such as using the SPL Token delegate facility (but sollet.io doesn't do delegates yet), "memo field" for transfers into a common exchange SPL Token deposit address, etc.
  3. For withdrawals, some exchanges use solana transfer --no-wait to avoid blocking their withdrawal pipeline. spl-token transfer may be fast enough since it only waits for single confirmation, but if not then we'll need a --no-wait option here as well.
  4. Highlight the mint-level freeze authority to Exchanges. When they integrate an SPL Token with Some freeze authority, an external party has the power to freeze tokens under their custody. This is something they need to be aware of
@mvines mvines added this to the v1.3.12 milestone Sep 16, 2020
@mvines mvines changed the title Add an section for SPL Token integrations to the exchange integration guide Add an section for SPL Token integration to the exchange integration guide Sep 16, 2020
@t-nelson
Copy link
Contributor

Seems like we're going to want to add an spl-token account or similar that returns a specific account. It'd be useful for verifying withdraw addresses

@mvines
Copy link
Member Author

mvines commented Sep 16, 2020

Seems like we're going to want to add an spl-token account or similar that returns a specific account. It'd be useful for verifying withdraw addresses

What would this do over spl-token balance?

@t-nelson
Copy link
Contributor

Display the mint

@mvines
Copy link
Member Author

mvines commented Sep 16, 2020

Ok, so like spl-token accounts but not so much?

eg, some of my tokens:

$ spl-token accounts 
Account                                      Token                                        Balance
-------------------------------------------------------------------------------------------------
bobJGLnym1T78DkSz3fr8gT3mZ4aKCEw6AfehEHyFuW  TESTpKgj42ya3st2SQTKiANjTBmncQSCqLAZGcSPLGM  0.21
kaiPYrDEEbdEySemfudkmJjgqDzyhircGMa9k7fanxT  TESTpKgj42ya3st2SQTKiANjTBmncQSCqLAZGcSPLGM  41.58

@t-nelson
Copy link
Contributor

Right. User want's to withdraw their Wrapped SOL to bobJGLnym1T78DkSz3fr8gT3mZ4aKCEw6AfehEHyFuW. Exchange queries bobJGLnym1T78DkSz3fr8gT3mZ4aKCEw6AfehEHyFuW and if it exists, that the mint is So11111111111111111111111111111111111111112 before proceeding

@t-nelson
Copy link
Contributor

I suppose we'll also need to plumb the offline flags

@mvines
Copy link
Member Author

mvines commented Sep 17, 2020

Ah, I see. We could just add the token mint to getTokenAccountBalance (https://docs.solana.com/apps/jsonrpc-api#gettokenaccountbalance). Then spl-token balance --verbose kaiPYrDEEbdEySemfudkmJjgqDzyhircGMa9k7fanxT could output the mint as well.

@mvines
Copy link
Member Author

mvines commented Sep 17, 2020

I suppose we'll also need to plumb the offline flags

I think we can do this later, on demand. These aren't widely used 🙈

@CriesofCarrots
Copy link
Contributor

Ah, I see. We could just add the token mint to getTokenAccountBalance (https://docs.solana.com/apps/jsonrpc-api#gettokenaccountbalance). Then spl-token balance --verbose kaiPYrDEEbdEySemfudkmJjgqDzyhircGMa9k7fanxT could output the mint as well.

We could easily add a RpcClient::getTokenAccount method that queries getAccountInfo for a jsonParsed-encoded response, which spl-token balance could use to get balance plus optional mint.

@t-nelson
Copy link
Contributor

We could easily add a RpcClient::getTokenAccount method that queries getAccountInfo for a jsonParsed-encoded response, which spl-token balance could use to get balance plus optional mint.

This feels like the more flexible way to go to me. It'd replace the getTokenAccountBalance endpoint, right?

@CriesofCarrots
Copy link
Contributor

The rpc plumbing is already there. It would just be a different client method for spl-token to call: RpcClient::get_token_account_with_commitment() instead of RpcClient::get_token_account_balance_with_commitment()

@t-nelson
Copy link
Contributor

Yep, perfect!

@t-nelson
Copy link
Contributor

FYI, this issue could perhaps be repurposed to cover the new RPC call

@mergify mergify bot closed this as completed in #12303 Sep 18, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants