-
Notifications
You must be signed in to change notification settings - Fork 19
Feature/recent escrow events #51
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
Open
bitstarkbridge
wants to merge
5
commits into
Trustless-Work:main
Choose a base branch
from
bitstarkbridge:feature/recent-escrow-events
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7e0508b
Add Recent Contract Events section
bitstarkbridge a2c0006
Force push frontend code
bitstarkbridge d64cb4c
Force push frontend codes
bitstarkbridge 338b2de
Force push backend code
bitstarkbridge 0e55ccc
Merge branch 'main' into feature/recent-escrow-events
bitstarkbridge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { NextRequest, NextResponse } from 'next/server'; | ||
| import { getNetworkConfig } from '@/lib/network-config'; | ||
|
|
||
| export async function POST(request: NextRequest) { | ||
| try { | ||
| const { network, ...body } = await request.json(); | ||
|
|
||
| if (!network || !['testnet', 'mainnet'].includes(network)) { | ||
| return NextResponse.json({ error: 'Invalid network' }, { status: 400 }); | ||
| } | ||
|
|
||
| const networkConfig = getNetworkConfig(network as 'testnet' | 'mainnet'); | ||
|
|
||
| const response = await fetch(networkConfig.rpcUrl, { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify(body), | ||
| }); | ||
|
|
||
| if (!response.ok) { | ||
| return NextResponse.json( | ||
| { error: `RPC error: ${response.status}` }, | ||
| { status: response.status } | ||
| ); | ||
| } | ||
|
|
||
| const data = await response.json(); | ||
| return NextResponse.json(data); | ||
| } catch (error) { | ||
| console.error('RPC proxy error:', error); | ||
| return NextResponse.json( | ||
| { error: 'Internal server error' }, | ||
| { status: 500 } | ||
| ); | ||
| } | ||
| } |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,79 @@ | ||
| import { motion, AnimatePresence } from "framer-motion" | ||
| import { AlertCircle } from "lucide-react" | ||
| import { AlertCircle, RefreshCw } from "lucide-react" | ||
| import { Button } from "@/components/ui/button" | ||
|
|
||
| interface ErrorDisplayProps { | ||
| error: string | null | ||
| onSwitchNetwork?: (network: 'testnet' | 'mainnet') => void | ||
| onRetry?: () => void | ||
| } | ||
|
|
||
| export const ErrorDisplay = ({ error }: ErrorDisplayProps) => { | ||
| export const ErrorDisplay = ({ error, onSwitchNetwork, onRetry }: ErrorDisplayProps) => { | ||
| if (!error) return null; | ||
|
|
||
| const parts = error.split('•').map(part => part.trim()).filter(part => part); | ||
|
|
||
| // Check if error suggests switching networks | ||
| const switchSuggestion = parts.find(part => part.includes('Try switching to')); | ||
| let targetNetwork: 'testnet' | 'mainnet' | null = null; | ||
| if (switchSuggestion) { | ||
| if (switchSuggestion.includes('mainnet')) { | ||
| targetNetwork = 'mainnet'; | ||
| } else if (switchSuggestion.includes('testnet')) { | ||
| targetNetwork = 'testnet'; | ||
| } | ||
| } | ||
|
|
||
| return ( | ||
| <AnimatePresence> | ||
| {error && ( | ||
| <motion.div | ||
| initial={{ opacity: 0, y: -10 }} | ||
| animate={{ opacity: 1, y: 0 }} | ||
| exit={{ opacity: 0, y: -10 }} | ||
| className="max-w-2xl mx-auto mb-6 p-4 bg-red-50 text-red-800 rounded-md flex items-center gap-2 shadow-sm border border-red-100" | ||
| > | ||
| <AlertCircle size={18} /> | ||
| <p>{error}</p> | ||
| </motion.div> | ||
| )} | ||
| <motion.div | ||
| initial={{ opacity: 0, y: -10 }} | ||
| animate={{ opacity: 1, y: 0 }} | ||
| exit={{ opacity: 0, y: -10 }} | ||
| className="max-w-2xl mx-auto mb-6 p-4 bg-red-50 text-red-800 rounded-md shadow-sm border border-red-100" | ||
| > | ||
| <div className="flex items-start gap-2"> | ||
| <AlertCircle size={18} className="mt-0.5 flex-shrink-0" /> | ||
| <div className="flex-1"> | ||
| {parts.length > 1 ? ( | ||
| <div> | ||
| <p className="font-medium mb-2">{parts[0]}</p> | ||
| <ul className="list-disc list-inside space-y-1 text-sm"> | ||
| {parts.slice(1).map((line, index) => ( | ||
| <li key={index}>{line}</li> | ||
| ))} | ||
| </ul> | ||
| </div> | ||
| ) : ( | ||
| <p>{error}</p> | ||
| )} | ||
| {/* Action buttons */} | ||
| <div className="flex gap-2 mt-3"> | ||
| {targetNetwork && onSwitchNetwork && ( | ||
| <Button | ||
| onClick={() => onSwitchNetwork(targetNetwork!)} | ||
| size="sm" | ||
| variant="outline" | ||
| className="bg-white hover:bg-gray-50 border-red-200 text-red-700" | ||
| > | ||
| Switch to {targetNetwork === 'testnet' ? 'Testnet' : 'Mainnet'} | ||
| </Button> | ||
| )} | ||
| {onRetry && ( | ||
| <Button | ||
| onClick={onRetry} | ||
| size="sm" | ||
| variant="outline" | ||
| className="bg-white hover:bg-gray-50 border-red-200 text-red-700" | ||
| > | ||
| <RefreshCw size={14} className="mr-1" /> | ||
| Retry | ||
| </Button> | ||
| )} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </motion.div> | ||
| </AnimatePresence> | ||
| ) | ||
| } | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.