-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v6.0.5-alpha
- Loading branch information
Showing
24 changed files
with
489 additions
and
75 deletions.
There are no files selected for viewing
This file contains 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,4 +1,5 @@ | ||
NEXT_PUBLIC_PROVIDER_ID=INFURA | ||
NEXT_PUBLIC_INFURA_PROJECT_ID="INFURA_PROJECT_ID" | ||
NEXT_PUBLIC_BLASTAPI_PROJECT_ID="BLASTAPI_PROJECT_ID" | ||
NEXT_PUBLIC_COMPETITION_ACTIVE=false | ||
NEXT_PUBLIC_COMPETITION_ACTIVE=false | ||
NEXT_PUBLIC_SOCKET_API_KEY="SOCKET_API_KEY" |
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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,85 @@ | ||
import { Bridge } from '@socket.tech/plugin'; | ||
import { useCallback } from 'react'; | ||
import styled, { useTheme } from 'styled-components'; | ||
import { chain } from 'wagmi'; | ||
|
||
import ArrowIcon from 'assets/svg/app/arrow-down.svg'; | ||
import Connector from 'containers/Connector'; | ||
import { fetchBalances } from 'state/balances/actions'; | ||
import { useAppDispatch } from 'state/hooks'; | ||
import { | ||
customizeSocket, | ||
socketDefaultChains, | ||
SOCKET_DEST_TOKEN_ADDRESS, | ||
SOCKET_SOURCE_TOKEN_ADDRESS, | ||
} from 'utils/socket'; | ||
|
||
const SocketBridge = () => { | ||
const { activeChain, signer } = Connector.useContainer(); | ||
const dispatch = useAppDispatch(); | ||
const customize = customizeSocket(useTheme()); | ||
const onBridgeSuccess = useCallback(() => { | ||
dispatch(fetchBalances()); | ||
}, [dispatch]); | ||
|
||
return ( | ||
<BridgeContainer> | ||
<Bridge | ||
provider={signer?.provider} | ||
API_KEY={process.env.NEXT_PUBLIC_SOCKET_API_KEY ?? ''} | ||
sourceNetworks={socketDefaultChains} | ||
destNetworks={[chain.optimism.id]} | ||
defaultSourceToken={SOCKET_SOURCE_TOKEN_ADDRESS} | ||
defaultDestToken={SOCKET_DEST_TOKEN_ADDRESS} | ||
defaultSourceNetwork={ | ||
socketDefaultChains.includes(activeChain?.id ?? chain.mainnet.id) | ||
? activeChain?.id | ||
: chain.mainnet.id | ||
} | ||
customize={customize} | ||
enableSameChainSwaps={true} | ||
onBridgeSuccess={onBridgeSuccess} | ||
/> | ||
<StyledDiv> | ||
<ArrowIcon /> | ||
</StyledDiv> | ||
</BridgeContainer> | ||
); | ||
}; | ||
|
||
export const BridgeContainer = styled.div` | ||
p:empty { | ||
display: none; | ||
} | ||
.mt-3 { | ||
margin-top: 0.25rem; | ||
} | ||
.mt-6 { | ||
margin-top: 0.5rem; | ||
} | ||
.bg-widget-primary { | ||
border: ${(props) => props.theme.colors.selectedTheme.border}; | ||
} | ||
span.ml-2 { | ||
font-size: 17px; | ||
font-family: ${(props) => props.theme.fonts.regular}; | ||
} | ||
`; | ||
|
||
export const StyledDiv = styled.div` | ||
svg { | ||
height: 15px; | ||
width: 15px; | ||
path { | ||
fill: ${(props) => props.theme.colors.selectedTheme.button.text.primary}; | ||
} | ||
} | ||
text-align: center; | ||
padding-top: 20px; | ||
`; | ||
|
||
export default SocketBridge; |
This file contains 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 @@ | ||
export { default } from './SocketBridge'; |
This file contains 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,20 @@ | ||
export type RGB = { | ||
r: number; | ||
g: number; | ||
b: number; | ||
}; | ||
|
||
export type SocketCustomizationProps = { | ||
width?: number; // Width of the widget in px | ||
responsiveWidth?: boolean; // Widget is responsive relative to the parent element | ||
borderRadius?: number; // Radius of all borders in widget, takes values between 0 - 1 | ||
accent?: string; // Background color of buttons | ||
onAccent?: string; // Color of text in buttons | ||
primary?: string; // Background color of widget and modals | ||
secondary?: string; // Foreground color of info section, hover hightlights, cards | ||
text?: string; // Color of all text, headings and emphasised font on widget | ||
secondaryText?: string; // Color of labels, icons, footer text on widget | ||
interactive?: string; // Background color of dropdown elements | ||
onInteractive?: string; // Color of text in dropdowns | ||
fontFamily?: string; // Font of the widget | ||
}; |
This file contains 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 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.