Skip to content

Commit

Permalink
Merge branch 'main' into pedro/grwth-3233-add-zksync-to-explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromcunha committed Oct 6, 2023
2 parents cec69fd + 2af1ea4 commit a1c70cb
Show file tree
Hide file tree
Showing 45 changed files with 611 additions and 846 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/sync-dev-branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Sync dev branches

on:
push:
branches:
- dev

jobs:
sync-branches:
runs-on: ubuntu-latest
name: Syncing branches
steps:
- uses: actions/checkout@v2
- name: Set Git config
run: |
git config --local user.email "[email protected]"
git config --local user.name "Github Actions"
- name: Sync vpn with dev
run: |
git fetch --unshallow
git checkout vpn
git pull
git merge --no-ff dev -m "Auto-merge dev into vpn"
git push
- name: Report Status
uses: ravsamhq/notify-slack-action@v1
if: always()
with:
status: ${{ job.status }}
notify_when: 'failure'
notification_title: 'Syncing Explorer Dev Branches failed'
message_format: '{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>'
footer: 'Linked to Repo <{repo_url}|{repo}>'
env:
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }}
2 changes: 1 addition & 1 deletion .github/workflows/sync-env-branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
with:
status: ${{ job.status }}
notify_when: 'failure'
notification_title: 'Syncing Marketplace Branches failed'
notification_title: 'Syncing Explorer Branches failed'
message_format: '{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>'
footer: 'Linked to Repo <{repo_url}|{repo}>'
env:
Expand Down
25 changes: 3 additions & 22 deletions components/buttons/AcceptBid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ import {
import { CSS } from '@stitches/react'
import { SWRResponse } from 'swr'
import { Button } from 'components/primitives'
import {
useAccount,
useNetwork,
useWalletClient,
useSwitchNetwork,
} from 'wagmi'
import { useAccount, useWalletClient } from 'wagmi'
import { useConnectModal } from '@rainbow-me/rainbowkit'
import { ToastContext } from '../../context/ToastContextProvider'
import { useMarketplaceChain } from 'hooks'
Expand Down Expand Up @@ -48,16 +43,8 @@ const AcceptBid: FC<Props> = ({
const { addToast } = useContext(ToastContext)

const marketplaceChain = useMarketplaceChain()
const { switchNetworkAsync } = useSwitchNetwork({
chainId: marketplaceChain.id,
})

const { data: signer } = useWalletClient()
const { chain: activeChain } = useNetwork()

const isInTheWrongNetwork = Boolean(
signer && marketplaceChain.id !== activeChain?.id
)

const trigger = (
<Button css={buttonCss} color="gray3" disabled={disabled} {...buttonProps}>
Expand All @@ -77,16 +64,9 @@ const AcceptBid: FC<Props> = ({
: []
}, [collectionId, tokenId, bidId])

if (isDisconnected || isInTheWrongNetwork) {
if (isDisconnected) {
return cloneElement(trigger, {
onClick: async () => {
if (switchNetworkAsync && activeChain) {
const chain = await switchNetworkAsync(marketplaceChain.id)
if (chain.id !== marketplaceChain.id) {
return false
}
}

if (!signer) {
openConnectModal?.()
}
Expand All @@ -98,6 +78,7 @@ const AcceptBid: FC<Props> = ({
trigger={trigger}
openState={openState}
tokens={tokens}
chainId={marketplaceChain.id}
onClose={(data, stepData, currentStep) => {
if (mutate && currentStep == AcceptBidStep.Complete) {
mutate()
Expand Down
27 changes: 4 additions & 23 deletions components/buttons/Bid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ import {
} from 'react'
import { CSS } from '@stitches/react'
import { SWRResponse } from 'swr'
import {
useAccount,
useNetwork,
useWalletClient,
mainnet,
useSwitchNetwork,
} from 'wagmi'
import { useAccount, useWalletClient, mainnet } from 'wagmi'
import { useConnectModal } from '@rainbow-me/rainbowkit'
import { ToastContext } from 'context/ToastContextProvider'
import { useMarketplaceChain } from 'hooks'
Expand Down Expand Up @@ -48,16 +42,8 @@ const Bid: FC<Props> = ({
const { openConnectModal } = useConnectModal()
const { addToast } = useContext(ToastContext)
const marketplaceChain = useMarketplaceChain()
const { switchNetworkAsync } = useSwitchNetwork({
chainId: marketplaceChain.id,
})

const { data: signer } = useWalletClient()
const { chain: activeChain } = useNetwork()

const isInTheWrongNetwork = Boolean(
signer && marketplaceChain.id !== activeChain?.id
)

const trigger = (
<Button css={buttonCss} disabled={disabled} {...buttonProps} color="gray3">
Expand All @@ -83,16 +69,9 @@ const Bid: FC<Props> = ({
]
}

if (isDisconnected || isInTheWrongNetwork) {
if (isDisconnected) {
return cloneElement(trigger, {
onClick: async () => {
if (switchNetworkAsync && activeChain) {
const chain = await switchNetworkAsync(marketplaceChain.id)
if (chain.id !== marketplaceChain.id) {
return false
}
}

if (!signer) {
openConnectModal?.()
}
Expand All @@ -107,6 +86,8 @@ const Bid: FC<Props> = ({
openState={openState}
feesBps={orderFees}
currencies={bidCurrencies}
oracleEnabled={marketplaceChain.oracleBidsEnabled}
chainId={marketplaceChain.id}
onClose={(data, stepData, currentStep) => {
if (mutate && currentStep == BidStep.Complete) mutate()
}}
Expand Down
53 changes: 11 additions & 42 deletions components/buttons/BuyNow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import React, {
useContext,
} from 'react'
import { SWRResponse } from 'swr'
import { useNetwork, useWalletClient } from 'wagmi'
import { BuyModal, BuyStep } from '@reservoir0x/reservoir-kit-ui'
import { useSwitchNetwork } from 'wagmi'
import { Button } from 'components/primitives'
import { useConnectModal } from '@rainbow-me/rainbowkit'
import { CSS } from '@stitches/react'
import { useMarketplaceChain, useRKModalPrepareDeeplink } from 'hooks'
import { useMarketplaceChain } from 'hooks'
import { ReferralContext } from '../../context/ReferralContextProvider'

type Props = {
Expand All @@ -36,59 +34,30 @@ const BuyNow: FC<Props> = ({
buttonChildren,
openState,
}) => {
const { data: signer } = useWalletClient()
const { openConnectModal } = useConnectModal()
const { chain: activeChain } = useNetwork()
const marketplaceChain = useMarketplaceChain()
const { switchNetworkAsync } = useSwitchNetwork({
chainId: marketplaceChain.id,
})
const { feesOnTop } = useContext(ReferralContext)
useRKModalPrepareDeeplink(marketplaceChain.id, openState ? true : false)
const isInTheWrongNetwork = Boolean(
signer && activeChain?.id !== marketplaceChain.id
)

const trigger = (
<Button css={buttonCss} color="primary" {...buttonProps}>
{buttonChildren}
</Button>
)
const canBuy = signer && tokenId && collectionId && !isInTheWrongNetwork

return !canBuy ? (
<Button
css={buttonCss}
aria-haspopup="dialog"
color="primary"
onClick={async () => {
if (isInTheWrongNetwork && switchNetworkAsync) {
const chain = await switchNetworkAsync(marketplaceChain.id)
if (chain.id !== marketplaceChain.id) {
return false
}
}

if (!signer) {
openConnectModal?.()
}
}}
{...buttonProps}
>
{buttonChildren}
</Button>
) : (
return (
<BuyModal
trigger={trigger}
trigger={
<Button css={buttonCss} color="primary" {...buttonProps}>
{buttonChildren}
</Button>
}
tokenId={tokenId}
collectionId={collectionId}
orderId={orderId}
openState={openState}
onConnectWallet={() => {
openConnectModal?.()
}}
//CONFIGURABLE: set any fees on top of orders, note that these will only
// apply to native orders (using the reservoir order book) and not to external orders (opensea, blur etc)
// Refer to our docs for more info: https://docs.reservoir.tools/reference/sweepmodal-1
// feesOnTopBps={["0xabc:50"]}
feesOnTopUsd={feesOnTop}
chainId={marketplaceChain.id}
onClose={(data, stepData, currentStep) => {
if (mutate && currentStep == BuyStep.Complete) mutate()
}}
Expand Down
20 changes: 3 additions & 17 deletions components/buttons/CancelBid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useConnectModal } from '@rainbow-me/rainbowkit'
import { CancelBidModal, CancelBidStep } from '@reservoir0x/reservoir-kit-ui'
import { FC, ReactElement, cloneElement, useContext } from 'react'
import { SWRResponse } from 'swr'
import { useNetwork, useWalletClient, useSwitchNetwork } from 'wagmi'
import { useWalletClient } from 'wagmi'
import { ToastContext } from '../../context/ToastContextProvider'
import { useMarketplaceChain } from 'hooks'

Expand All @@ -17,27 +17,12 @@ const CancelBid: FC<Props> = ({ bidId, openState, trigger, mutate }) => {
const { addToast } = useContext(ToastContext)
const { openConnectModal } = useConnectModal()
const marketplaceChain = useMarketplaceChain()
const { switchNetworkAsync } = useSwitchNetwork({
chainId: marketplaceChain.id,
})

const { data: signer } = useWalletClient()
const { chain: activeChain } = useNetwork()

const isInTheWrongNetwork = Boolean(
signer && marketplaceChain.id !== activeChain?.id
)

if (isInTheWrongNetwork) {
if (!signer) {
return cloneElement(trigger, {
onClick: async () => {
if (switchNetworkAsync && activeChain) {
const chain = await switchNetworkAsync(marketplaceChain.id)
if (chain.id !== marketplaceChain.id) {
return false
}
}

if (!signer) {
openConnectModal?.()
}
Expand All @@ -50,6 +35,7 @@ const CancelBid: FC<Props> = ({ bidId, openState, trigger, mutate }) => {
bidId={bidId}
trigger={trigger}
openState={openState}
chainId={marketplaceChain.id}
onCancelComplete={(data: any) => {
addToast?.({
title: 'User canceled bid',
Expand Down
20 changes: 3 additions & 17 deletions components/buttons/CancelListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@reservoir0x/reservoir-kit-ui'
import { FC, ReactElement, useContext, cloneElement } from 'react'
import { SWRResponse } from 'swr'
import { useNetwork, useWalletClient, useSwitchNetwork } from 'wagmi'
import { useWalletClient } from 'wagmi'
import { ToastContext } from '../../context/ToastContextProvider'
import { useMarketplaceChain } from 'hooks'

Expand All @@ -25,27 +25,12 @@ const CancelListing: FC<Props> = ({
const { addToast } = useContext(ToastContext)
const { openConnectModal } = useConnectModal()
const marketplaceChain = useMarketplaceChain()
const { switchNetworkAsync } = useSwitchNetwork({
chainId: marketplaceChain.id,
})

const { data: signer } = useWalletClient()
const { chain: activeChain } = useNetwork()

const isInTheWrongNetwork = Boolean(
signer && activeChain && activeChain.id !== marketplaceChain.id
)

if (isInTheWrongNetwork) {
if (!signer) {
return cloneElement(trigger, {
onClick: async () => {
if (switchNetworkAsync && activeChain) {
const chain = await switchNetworkAsync(marketplaceChain.id)
if (chain.id !== marketplaceChain.id) {
return false
}
}

if (!signer) {
openConnectModal?.()
}
Expand All @@ -58,6 +43,7 @@ const CancelListing: FC<Props> = ({
listingId={listingId}
openState={openState}
trigger={trigger}
chainId={marketplaceChain.id}
onCancelComplete={(data: any) => {
addToast?.({
title: 'User canceled listing',
Expand Down
Loading

0 comments on commit a1c70cb

Please sign in to comment.