Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
"@dicebear/core": "^9.2.2",
"@headlessui/react": "^1.7.19",
"@headlessui/tailwindcss": "^0.2.1",
"@reown/appkit": "^1.6.0",
"@reown/appkit-adapter-wagmi": "^1.6.0",
"@safe-global/safe-apps-sdk": "^9.1.0",
"@sentry/nextjs": "^8.39.0",
"@squirrel-labs/peanut-sdk": "^0.5.11",
"@tanstack/react-query": "^5.61.0",
"@tanstack/react-query": "5.8.4",
"@typeform/embed-react": "^3.20.0",
"@vercel/analytics": "^1.4.1",
"@wagmi/core": "^2.14.6",
"@web3modal/wagmi": "^5.1.11",
"@wagmi/core": "2.14.3",
"auto-text-size": "^0.2.3",
"autoprefixer": "^10.4.20",
"axios": "^1.7.7",
Expand Down Expand Up @@ -114,5 +115,10 @@
"**/__tests__/**/*.test.[jt]s?(x)",
"**/?(*.)+(spec|test).[jt]s?(x)"
]
},
"resolutions": {
"@wagmi/core": "2.14.3",
"viem": "^2.21.48",
"wagmi": "2.8.6"
}
}
6,616 changes: 2,958 additions & 3,658 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions src/app/api/peanut/submit-cashout-link/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export async function POST(request: NextRequest) {
externalAccountId,
chainId,
tokenName,
promoCode,
trackParam,
} = await request.json()

const apiKey = process.env.PEANUT_API_KEY!
Expand All @@ -24,13 +26,15 @@ export async function POST(request: NextRequest) {
'api-key': apiKey,
},
body: JSON.stringify({
bridgeCustomerId: bridgeCustomerId,
liquidationAddressId: liquidationAddressId,
cashoutTransactionHash: cashoutTransactionHash,
externalAccountId: externalAccountId,
chainId: chainId,
tokenName: tokenName,
pubKey: pubKey,
bridgeCustomerId,
liquidationAddressId,
cashoutTransactionHash,
externalAccountId,
chainId,
tokenName,
pubKey,
promoCode,
trackParam,
}),
})

Expand Down
5 changes: 4 additions & 1 deletion src/components/Cashout/Cashout.consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as views from './Components'
import { interfaces as peanutInterfaces } from '@squirrel-labs/peanut-sdk'
import * as consts from '@/constants'
import { OfframpConfirmView, OfframpSuccessView } from '../Offramp'
import { OfframpType } from '../Offramp/Offramp.consts'
type CashoutScreens = 'INITIAL' | 'CONFIRM' | 'SUCCESS'

export type CashoutType = 'bank_transfer' | undefined
Expand All @@ -19,7 +20,7 @@ export const INIT_VIEW_STATE: ICashoutScreenState = {

export const CASHOUT_SCREEN_FLOW: CashoutScreens[] = ['INITIAL', 'CONFIRM', 'SUCCESS']

export const CASHOUT_SCREEN_MAP: { [key in CashoutScreens]: { comp: React.FC<any> } } = {
export const CASHOUT_SCREEN_MAP: { [key in CashoutScreens]: { comp: React.FC<ICashoutScreenProps> } } = {
INITIAL: { comp: views.InitialCashoutView },
CONFIRM: { comp: OfframpConfirmView },
SUCCESS: { comp: OfframpSuccessView },
Expand Down Expand Up @@ -64,4 +65,6 @@ export interface ICashoutScreenProps {
transactionHash: string
setTransactionHash: (hash: string) => void
crossChainDetails: []
appliedPromoCode?: string | null
offrampType: OfframpType
}
4 changes: 2 additions & 2 deletions src/components/Cashout/Components/Initial.view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import TokenAmountInput from '@/components/Global/TokenAmountInput'
import TokenSelector from '@/components/Global/TokenSelector/TokenSelector'
import ValidatedInput from '@/components/Global/ValidatedInput'
import { useAccount } from 'wagmi'
import { useWeb3Modal } from '@web3modal/wagmi/react'
import { useAppKit } from '@reown/appkit/react'
import { useState, useContext, useEffect, useMemo } from 'react'
import * as _consts from '../Cashout.consts'
import * as context from '@/context'
Expand Down Expand Up @@ -71,7 +71,7 @@ export const InitialCashoutView = ({
const { prepareCreateLinkWrapper } = useCreateLink()

const { isConnected } = useAccount()
const { open } = useWeb3Modal()
const { open } = useAppKit()

const handleConnectWallet = async () => {
open()
Expand Down
5 changes: 3 additions & 2 deletions src/components/Claim/Link/FlowManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const FlowManager = ({
}: {
recipientType: interfaces.RecipientType
step: _consts.IClaimScreenState
props: _consts.IClaimScreenProps
props: _consts.IClaimScreenProps & { appliedPromoCode?: string | null }
}) => {
const viewComponents: _consts.IFlowManagerClaimComponents = {
INITIAL: InitialClaimLinkView,
Expand All @@ -33,7 +33,8 @@ const FlowManager = ({
if (recipientType === 'iban' || recipientType === 'us') {
componentProps = {
...props,
offrampType: OfframpType.CLAIM, // adds an additional required type on the props
offrampType: OfframpType.CLAIM,
appliedPromoCode: props.appliedPromoCode,
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/Claim/Link/Initial.view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as _consts from '../Claim.consts'
import { useContext, useEffect, useState, useMemo } from 'react'
import Icon from '@/components/Global/Icon'
import { useAccount } from 'wagmi'
import { useWeb3Modal } from '@web3modal/wagmi/react'
import { useAppKit } from '@reown/appkit/react'
import useClaimLink from '../useClaimLink'
import * as context from '@/context'
import Loading from '@/components/Global/Loading'
Expand Down Expand Up @@ -84,7 +84,7 @@ export const InitialClaimLinkView = ({
supportedSquidChainsAndTokens,
} = useContext(context.tokenSelectorContext)
const { claimLink } = useClaimLink()
const { open } = useWeb3Modal()
const { open } = useAppKit()
const { isConnected, address } = useAccount()
const { user } = useAuth()

Expand Down
4 changes: 2 additions & 2 deletions src/components/Create/Link/Input.view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import TokenAmountInput from '@/components/Global/TokenAmountInput'
import TokenSelector from '@/components/Global/TokenSelector/TokenSelector'
import { useAccount } from 'wagmi'
import { useWeb3Modal } from '@web3modal/wagmi/react'
import { useAppKit } from '@reown/appkit/react'
import { useState, useContext, useEffect, useMemo } from 'react'
import { useCreateLink } from '../useCreateLink'

Expand Down Expand Up @@ -69,7 +69,7 @@ export const CreateLinkInputView = ({
)

const { isConnected, address } = useAccount()
const { open } = useWeb3Modal()
const { open } = useAppKit()

const handleConnectWallet = async () => {
open()
Expand Down
3 changes: 1 addition & 2 deletions src/components/Global/AddressInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ const AddressInput = ({ placeholder = 'Enter a valid address', value, onUpdate,
const resolvedAddress = await resolveFromEnsName(recipient.toLowerCase())
return !!resolvedAddress
} else {
return isAddress(recipient, { strict: false })
return isAddress(recipient)
}
} catch (error) {
console.error('Error while validating recipient input field:', error)
return false
}
}

return (
<ValidatedInput
placeholder={placeholder}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Global/GeneralRecipientInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const GeneralRecipientInput = ({
}
} else {
type = 'address'
isValid = isAddress(trimmedInput, { strict: false })
isValid = isAddress(trimmedInput)
if (!isValid) errorMessage.current = 'Invalid Ethereum address'
}
recipientType.current = type
Expand Down
11 changes: 6 additions & 5 deletions src/components/Global/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import Link from 'next/link'

import { PEANUTMAN_LOGO, HAMBURGER_LOTTIE } from '@/assets'
import { shortenAddress } from '@/utils'
import { useWeb3Modal } from '@web3modal/wagmi/react'
import { useAppKit } from '@reown/appkit/react'

import { useAccount } from 'wagmi'
import { useRouter } from 'next/navigation'
import { breakpoints, emToPx } from '@/styles/theme'
Expand Down Expand Up @@ -221,7 +222,7 @@ const ToolsDropdown = () => {
}

const MenuLinks = () => {
const { open: web3modalOpen } = useWeb3Modal()
const { open: walletModal } = useAppKit()
const { address, isConnected } = useAccount()

return (
Expand Down Expand Up @@ -258,7 +259,7 @@ const MenuLinks = () => {
<NavItemBox>
<button
onClick={() => {
web3modalOpen()
walletModal()
}}
className="flex h-full w-full items-center justify-start px-8 py-2 uppercase sm:hidden sm:w-max sm:justify-center lg:px-4 xl:px-8"
>
Expand All @@ -274,7 +275,7 @@ const MenuLinks = () => {
}

const SocialLinks = () => {
const { open: web3modalOpen } = useWeb3Modal()
const { open: walletModal } = useAppKit()
const { address, isConnected } = useAccount()

return (
Expand All @@ -285,7 +286,7 @@ const SocialLinks = () => {
<button
className="btn btn-large text-nowrap bg-white px-2"
onClick={() => {
web3modalOpen()
walletModal()
}}
>
{isConnected ? shortenAddress(address ?? '') : 'Connect'}
Expand Down
2 changes: 2 additions & 0 deletions src/components/Global/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ const icons: IconsType = {
external:
'M 9 2 L 9 3 L 12.292969 3 L 6.023438 9.273438 L 6.726563 9.976563 L 13 3.707031 L 13 7 L 14 7 L 14 2 Z M 4 4 C 2.894531 4 2 4.894531 2 6 L 2 12 C 2 13.105469 2.894531 14 4 14 L 10 14 C 11.105469 14 12 13.105469 12 12 L 12 7 L 11 8 L 11 12 C 11 12.550781 10.550781 13 10 13 L 4 13 C 3.449219 13 3 12.550781 3 12 L 3 6 C 3 5.449219 3.449219 5 4 5 L 8 5 L 9 4 Z',
token_placeholder: 'M8 0c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8z',
ticket: 'M13 5.995v-2c0-.552-.453-1-1.01-1H3.01C2.453 2.995 2 3.443 2 3.995v2c.552 0 1 .453 1 1.01s-.448 1.01-1 1.01v2c0 .552.453 1 1.01 1h8.98c.557 0 1.01-.448 1.01-1v-2c-.552 0-1-.453-1-1.01s.448-1.01 1-1.01zM4 9.995v-4h7v4H4z',
'chevron-up': 'M4.938 10.438L8 7.376l3.062 3.062.938-.937-4-4-4 4z',
}

type IconProps = {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Global/TokenSelector/TokenSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { IUserBalance, IToken } from '@/interfaces'

import { TokenSelectorProps } from './TokenSelector.consts'
import { useAccount } from 'wagmi'
import { useWeb3Modal } from '@web3modal/wagmi/react'
import { useAppKit } from '@reown/appkit/react'
import { useWalletType } from '@/hooks/useWalletType'
import Icon from '../Icon'
import { CrispButton } from '@/components/CrispChat'
Expand Down Expand Up @@ -186,7 +186,7 @@ const TokenSelector = ({
supportedSquidChainsAndTokens,
} = useContext(context.tokenSelectorContext)
const { isConnected } = useAccount()
const { open } = useWeb3Modal()
const { open } = useAppKit()
const { safeInfo, walletType } = useWalletType()

const selectedChainTokens = useMemo(() => {
Expand Down
Loading
Loading