onchain storage#8
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThe changes extend the deposit flow to accept market question and expiry parameters, integrate on-chain Memo instruction storage for deposit context, and refactor position loading from localStorage to on-chain history fetching via transaction signature polling. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Hook as useDeposit Hook
participant TxBuilder as Deposit TX Builder
participant Solana as Solana Network
participant Memo as Memo Program
participant Token as Token Program
User->>Hook: deposit(amount, marketId, marketQuestion, expiry, position)
Hook->>TxBuilder: buildDepositTransaction(params with marketQuestion, expiry)
TxBuilder->>TxBuilder: Create Memo instruction with deposit context
TxBuilder->>Solana: Send transaction with Memo + Token instructions
Solana->>Memo: Execute Memo instruction (store context)
Solana->>Token: Execute USDC transfer
Memo->>Solana: ✓ On-chain storage confirmed
Token->>Solana: ✓ Transfer confirmed
Solana->>Hook: Transaction signature
Hook->>User: Return signature / success
sequenceDiagram
actor User
participant Hook as usePositions Hook
participant Wallet as Wallet Adapter
participant RPC as Solana RPC
participant Parser as Memo Parser
User->>Hook: Load/Poll positions
Hook->>Wallet: Get user public key
Wallet->>Hook: Public key
Hook->>RPC: Fetch last 20 signatures
RPC->>Hook: Transaction signatures
Hook->>RPC: Fetch parsed transactions
RPC->>Hook: Transaction details with Memo instructions
Hook->>Parser: Extract & parse Memo payloads
Parser->>Hook: UserPosition objects
Hook->>Hook: Update state & recalculate totals
Hook->>User: Positions ready
Note over Hook: Repeat poll every 15 seconds
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
✨ Finishing touches
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.