Skip to content

Conversation

@Blu-J
Copy link
Contributor

@Blu-J Blu-J commented May 1, 2025

About

So this is to solve the figma case for the nft and the solana: https://www.figma.com/design/5iS6Lk5eer9WFYJRni2Hn1/UI-Demo-App?node-id=7685-7245&p=f&t=iQyWRlxsizSVMjBx-0

Closes : https://app.asana.com/1/1129441638109975/project/1209791905088814/task/1210059561435500

Proof that it works

2025-05-01_14-10-40.mp4

Pull Request Checklist


PR-Codex overview

This PR focuses on enhancing the Solana integration in the application by updating configurations, adding new hooks, and introducing a new component for NFT transactions.

Detailed summary

  • Changed policyId in examples/ui-demo/src/app/config.tsx to NEXT_PUBLIC_SOLANA_POLICY_ID.
  • Added useSolanaConnection and SolanaConnection types in account-kit/react/src/hooks/useSolanaConnection.ts.
  • Exported useSolanaConnection from account-kit/react/src/hooks/index.ts.
  • Introduced SolanaNftCard component in examples/ui-demo/src/components/small-cards/SolanaNftCard.tsx for NFT transactions.
  • Updated SmallCardsWrapper to include SolanaNftCard.
  • Added documentation for useSolanaConnection in site/pages/reference/account-kit/react/hooks/useSolanaConnection.mdx and docs/pages/reference/account-kit/react/hooks/useSolanaConnection.mdx.
  • Modified useSolanaTransaction to support a preSend function for transactions.
  • Updated dependencies in examples/ui-demo/package.json for Solana libraries.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@vercel
Copy link

vercel bot commented May 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
aa-sdk-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2025 3:09pm
aa-sdk-ui-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2025 3:09pm

@github-actions
Copy link

github-actions bot commented May 1, 2025

🌿 Documentation Preview

Name Status Preview Updated (UTC)
Alchemy Docs ✅ Ready 🔗 Visit Preview May 2, 2025, 3:06 PM

@blakecduncan
Copy link
Collaborator

Looking good! One thought on the design. After you collect an NFT, there is no visual indicator that the nft was actually collected. In the EVM component we add a link to the txn on the block explorer. I'm wondering if it's worth adding something like that.

See in the completed state, I think we need at least a link to the txn
Screenshot 2025-05-02 at 9 56 45 AM

this is the link from the evm card
Screenshot 2025-05-02 at 9 57 36 AM

blakecduncan
blakecduncan previously approved these changes May 2, 2025
Copy link
Collaborator

@blakecduncan blakecduncan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome! None of my comments are blocking.

I know it's not in the figma design but I think it could be worth discussing with design to add a link to the txn in the block explorer.

if (!solanaSigner) throw new Error("No signer found");
if (!connection) throw new Error("No connection found");
setTransactionState("signing");
setTransactionState("sponsoring");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These states are fired back to back. I don't think we will ever see the signing state in the ui

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On purpose, designers should know

mint: stakeAccount.publicKey,
name: "Alchemy Duck",
symbol: "ALCHDUCK",
uri: "https://bafybeigtvzjqalevyw67xdhr7am5r3jxe5kjbg4pi2jv3nxvhelptwksoe.ipfs.dweb.link?filename=duckImage.png",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! You added the image to ipfs 💯

);

const mint = stakeAccount.publicKey;
const tx = await sendTransactionAsync({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'm not a big fan of mixing using the async function with the callbacks in the hook (I know we do this other places in this demo app so not an issue). If using the async function I prefer to wrap it in a try/catch and handle the error there. In this example, the onError callback will be called if there is an error but we will still get an unhandled error in this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But in this case, this is a middleware that one can add. Ad we expect a transform, like map
And the mutation is the mutation pattern since we use it https://tanstack.com/query/v4/docs/framework/react/reference/useMutation.
As for the onError, sure, in this case it makes alot more sense to use a try catch

],
});

console.log(`Created transaction: ${tx.hash}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this isn't in the design, but I think it would be really useful to link to this in the demo. Could be worth talking to design about this

@Blu-J
Copy link
Contributor Author

Blu-J commented May 2, 2025

Looking good! One thought on the design. After you collect an NFT, there is no visual indicator that the nft was actually collected. In the EVM component we add a link to the txn on the block explorer. I'm wondering if it's worth adding something like that.

See in the completed state, I think we need at least a link to the txn Screenshot 2025-05-02 at 9 56 45 AM

this is the link from the evm card Screenshot 2025-05-02 at 9 57 36 AM

Agreed

Copy link
Collaborator

@blakecduncan blakecduncan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@Blu-J Blu-J merged commit 7ad9c20 into main May 2, 2025
8 checks passed
@Blu-J Blu-J deleted the bluj/solana-nft-demo branch May 2, 2025 15:34
Blu-J pushed a commit that referenced this pull request May 2, 2025
Blu-J pushed a commit that referenced this pull request May 2, 2025
Blu-J added a commit that referenced this pull request May 2, 2025
Blu-J pushed a commit that referenced this pull request May 2, 2025
@Blu-J Blu-J mentioned this pull request May 2, 2025
7 tasks
Blu-J added a commit that referenced this pull request May 8, 2025
* Revert "feat: solana nft demo (#1578)"

This reverts commit 7ad9c20.

* Revert "Revert "feat: solana nft demo (#1578)""

This reverts commit 9b84edc.

* Revert "Revert "feat: solana nft demo (#1578)" (#1582)"

This reverts commit 4691730.

* fix: pr changes

* chore: fix test that has a timing issue maybe

* fix: allow the one card to do all

* Update examples/ui-demo/src/components/small-cards/SolanaNftCard.tsx

* feat: do auto from airdrop

* chore: refactor to invert logic to injectable (#1584)

* chore: refactor to invert logic to injectable

* feat: do auto from airdrop

* feat: make it so the adding self signer is automatically

* chore: adding in the other transaction filtering based on the keys

* fix: edge case on key may not be signer

* feat: remove the address from the solana card

* fix: link to transaction needs three lines for card

* chore: remove old new badges for other cards

* fix: imports are not .js

* chore: undo stage change

* fix: weird bug on import

* chore: change the function

* chore: add in the doc build

* chore: change the sponsoring to include rent

* fix: styling in card to match comments made in pr
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

Successfully merging this pull request may close these issues.

2 participants