Skip to content

Conversation

@Blu-J
Copy link
Contributor

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

Pull Request Checklist


PR-Codex overview

This PR focuses on refactoring the transaction handling in the SolanaNftCard component and the useSolanaTransaction hook to improve the transaction flow and introduce new capabilities for pre-processing transactions.

Detailed summary

  • Removed the PK function from SolanaNftCard.
  • Updated the sendTransactionAsync to include transactionComponents for pre-send handling.
  • Introduced PreSend and TransformInstruction types in useSolanaTransaction.
  • Modified useSolanaTransaction to handle transaction preparation and signing more flexibly.
  • Added getInstructions and needsSignerToSign helper functions in useSolanaTransaction.
  • Enhanced error handling with a missing function for better clarity.

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

@vercel
Copy link

vercel bot commented May 3, 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 6, 2025 5:46pm
aa-sdk-ui-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2025 5:46pm

@Blu-J Blu-J force-pushed the bluj/sleep/better-use-solana-transaction branch from e10a1ec to 046dc9c Compare May 5, 2025 16:31
@Blu-J Blu-J force-pushed the bluj/re-do-solana-demo branch 2 times, most recently from 000d716 to eda07aa Compare May 5, 2025 16:39
@Blu-J Blu-J force-pushed the bluj/re-do-solana-demo branch 2 times, most recently from 0c607c8 to a8a7491 Compare May 5, 2025 17:04
Comment on lines 102 to 108
transactionComponents: {
preSend: async (transaction) => {
if ("version" in transaction) {
transaction.sign([stakeAccount]);
}
return signers.fromSigner(transaction);
},
Copy link
Contributor

Choose a reason for hiding this comment

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

this is something that app devs need to know about?

is this not something that our hook can do to simplify things?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is in the case we want to over write the sending, for example on this one we have one more signer, and then we need the logic for the previous. It will fail on the simulation for the send transaction if we forgot the original from signer

And in the case of poke the duck, there is no signer except the sponsor, so the overwrite is just an identity 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.

So, the components of the sendSolanaTransaction
(transfer? ) -> instructions --transactionBuilder-> Transaction --preSend-> Broadcast
And now as params are the components that make up this function in the cases we want custom logic, it is easy for a one off change now.

Copy link
Contributor Author

@Blu-J Blu-J May 5, 2025

Choose a reason for hiding this comment

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

stateDiagram-v2
[*] --> instructions
[*] --> transfer
transfer --> instructions
instructions --> Transaction : transformInstruction
Transaction --> broadcastedResult : preSend
Loading

Copy link
Contributor Author

@Blu-J Blu-J May 5, 2025

Choose a reason for hiding this comment

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

Could have also been

 preSend: async (transaction) => {
            if ("version" in transaction) {
              transaction.sign([stakeAccount]);
            }
            await solanaSigner.addSignature(transaction);
            return transaction
          },
     

Copy link
Contributor

@moldy530 moldy530 left a comment

Choose a reason for hiding this comment

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

LGMT with one small nit

Comment on lines 147 to 149
transaction.message.staticAccountKeys.find(
(key) => key.toBase58() === signer?.address
)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this should also check that transaction.message.isSigner(idx) is true

@Blu-J Blu-J merged commit cb02dad into bluj/re-do-solana-demo May 6, 2025
4 of 7 checks passed
@Blu-J Blu-J deleted the bluj/sleep/better-use-solana-transaction branch May 6, 2025 17:43
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