backpack icon indicating copy to clipboard operation
backpack copied to clipboard

Support for Compression for NFTs

Open jnwng opened this issue 1 year ago β€’ 3 comments

this is a preliminary take on integrating the Metaplex Read API to power the "collectibles" tab in Backpack. here's more information about the Read API along with the specifications.

critically, the Read API serves both compressed and uncompressed NFTs all in the same interface, which we're using here when a custom RPC supports the Read API.

one can try this out by:

  1. setting BACKPACK_FEATURE_READ_API=true when running the initial yarn build
  2. setting the "custom" Solana connection URL in the Backpack interface to an RPC URL that supports the Read API (https://rpc-devnet.aws.metaplex.com/ works!). the Read API is served on the same URL as the Solana RPC

caveats

  • the initial set of indexers that support the Read API are currently only targeting devnet
  • while compressed NFTs will be visible in the Backpack collectibles interface, things like transfers are not yet supported here. i expect a fast-follow there!

review notes there's a lot of TODOs here because i have some questions for the Backpack team.

  1. the Read API provides "pagination", but i don't think the Backpack interface does. should i go ahead and retrieve as much as possible + automatically paginate, or are there plans to provide pagination / filter controls?
  2. some assets will be "compressed", and while the "read" flow is identical to uncompressed NFTs, the transfer is not. is it critical to surface that these assets are compressed in the UI, or just in the transfer process?

jnwng avatar Oct 28 '22 03:10 jnwng

@jnwng is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Oct 28 '22 03:10 vercel[bot]

this code is super rough, but i decided to send the PR to get early feedback rather than over-optimize. the Metaplex Read API in devnet is also not 100% ready so this won't work (yet) out of the box, but the code can be evaluated beforehand while the final touches get sorted out on the API side

jnwng avatar Oct 28 '22 03:10 jnwng

@jnwng on your two questions. I think the immediate solution (though something we should come back to) is to

  1. Fetch everything you can and automatically paginate
  2. Treat compressed and uncompressed as the same in the UI. I'm not married to this and would be interested in arguments against this.

armaniferrante avatar Oct 30 '22 23:10 armaniferrante

  1. Fetch everything you can and automatically paginate

added in automatic pagination. surfaced a couple of issues in the Read API from this front, but basically i'll keep calling their API until we have the entire list of assets and optimize for true pagination down the road.

  1. Treat compressed and uncompressed as the same in the UI. I'm not married to this and would be interested in arguments against this.

i'm onboard with this as well. the only semantic differences between the two kinds of NFTs come on the backend when you're doing transfers (compressed NFTs require a proof from the API), but other than that the rest of the UI elements should be the same

jnwng avatar Nov 01 '22 18:11 jnwng

if the code structure looks roughly okay, the next step would be to verify the end-to-end behavior once the Read API is returning the correct informationβ€”right now it's missing the off-chain metadata as well as some pagination elements

regarding feature flags, this is currently going to be a compile-time flag which is suitable for the short-term

jnwng avatar Nov 01 '22 18:11 jnwng

any help needed here?

Gajesh2007 avatar Feb 02 '23 16:02 Gajesh2007

i've revived this code and prepping it for an initial round of review. ETA later today , although it will not be a finished product

On Thu, Feb 02, 2023 at 11:54 AM, Gajesh Naik < @.*** > wrote:

any help needed here?

β€” Reply to this email directly, view it on GitHub ( https://github.com/coral-xyz/backpack/pull/1311#issuecomment-1414058582 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AAIRCRRGMSYM5I66KX7NXP3WVPRFLANCNFSM6AAAAAARQU7GS4 ). You are receiving this because you were mentioned. Message ID: <coral-xyz/backpack/pull/1311/c1414058582 @ github. com>

jnwng avatar Feb 02 '23 17:02 jnwng

@Gajesh2007 @armaniferrante ready for another pass. mostly want to get feedback on where all the code is right now and whether there are better places for the code, the subsequent types, etc

work im starting now:

  • [ ] paginating through all NFTs (only retrieving 5 right now)
  • [ ] trying to get a minimal amount of the transfer logic into another SDK so Backpack doesn't have to have so much. what's here should work, provided the RPC returns the correct information!
  • [ ] add a remote feature flag / feature detection on the connection to see if it responds to Read API methods
  • [ ] will flag this entire feature on Developer Mode

jnwng avatar Feb 03 '23 02:02 jnwng

New dependency changes detected. Learn more about Socket for GitHub β†—οΈŽ


πŸ‘ No new dependency issues detected in pull request

Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore [email protected] bar@* or ignore all packages with @SocketSecurity ignore-all

⚠️ Please accept the latest app permissions to ensure bot commands work properly. Accept the new permissions here.

Pull request alert summary
Issue Status
Install scripts βœ… 0 issues
Native code βœ… 0 issues
Bin script shell injection βœ… 0 issues
Unresolved require βœ… 0 issues
Invalid package.json βœ… 0 issues
HTTP dependency βœ… 0 issues
Git dependency βœ… 0 issues
Potential typo squat βœ… 0 issues
Known Malware βœ… 0 issues
Telemetry βœ… 0 issues
Protestware/Troll package βœ… 0 issues

πŸ“Š Modified Dependency Overview:

βž• Added Package Capability Access +/- Transitive Count Publisher
@metaplex-foundation/[email protected] None +6 lorisleiva

socket-security[bot] avatar May 12 '23 01:05 socket-security[bot]