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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ yarn-error.log*
# Sentry
.sentryclirc

.vscode/settings.json
.vscode/settings.json
.claude
.claude.local
37 changes: 27 additions & 10 deletions components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { useAsync } from 'react-async-hook'
import { useVsrClient } from '../VoterWeightPlugins/useVsrClient'
import { useRealmVoterWeightPlugins } from '@hooks/useRealmVoterWeightPlugins'
import TermsPopupModal from './TermsPopup'
import V2PromoModal from './V2PromoModal'
import PlausibleProvider from 'next-plausible'

const Notifications = dynamic(() => import('../components/Notification'), {
Expand Down Expand Up @@ -326,16 +327,31 @@ export function AppContents(props: Props) {
<ErrorBoundary>
<ThemeProvider defaultTheme="Dark">
<GatewayProvider>
<div className="relative color-white z-10 text-center w-full py-2">
Faster. Sharper. More. Yours.{' '}
<a
href="https://v2.realms.today"
rel="noreferrer"
target="_blank"
className="underline"
>
Try Realms v2
</a>
<div className="v2-banner relative z-10 text-center w-full py-3">
<div className="relative z-10 flex items-center justify-center gap-2 text-white font-medium">
<span className="text-white/90">Faster. Sharper. More. Yours.</span>
<a
href="https://v2.realms.today"
rel="noreferrer"
target="_blank"
className="inline-flex items-center gap-1 bg-white/20 hover:bg-white/30 px-3 py-1 rounded-full text-white font-semibold transition-all duration-200"
>
Try Realms v2
<svg
className="w-4 h-4"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M13 7l5 5m0 0l-5 5m5-5H6"
/>
</svg>
</a>
</div>
</div>
<Telemetry></Telemetry>
<NavBar />
Expand All @@ -346,6 +362,7 @@ export function AppContents(props: Props) {
<DefiProvider>{props.children}</DefiProvider>
</PageBodyContainer>
<TermsPopupModal />
<V2PromoModal />
</GatewayProvider>
</ThemeProvider>
</ErrorBoundary>
Expand Down
103 changes: 91 additions & 12 deletions components/TermsPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Button, { SecondaryButton } from './Button'
import { useEffect, useState } from 'react'
import { useRouter } from 'next/router'

const V2_PROMO_DISMISSED_KEY = 'v2-promo-dismissed'

const TermsPopupModal = () => {
const [openModal, setOpenModal] = useState(true)
const [isClient, setIsClient] = useState(false)
Expand All @@ -25,8 +27,16 @@ const TermsPopupModal = () => {
}
})

const acceptTerms = () => {
const acceptAndGoToV2 = () => {
localStorage.setItem('accept-terms', 'true')
localStorage.setItem(V2_PROMO_DISMISSED_KEY, 'true')
window.open('https://v2.realms.today', '_blank')
setOpenModal(false)
}

const acceptAndStay = () => {
localStorage.setItem('accept-terms', 'true')
localStorage.setItem(V2_PROMO_DISMISSED_KEY, 'true')
setOpenModal(false)
}

Expand All @@ -43,18 +53,87 @@ const TermsPopupModal = () => {
onClose={() => setOpenModal(false)}
bgClickClose={false}
hideClose={true}
sizeClassName="sm:max-w-lg"
>
<p className="text-justify">
The operating entity of this site and owner of the related
intellectual property has changed. The new operator is Realms Today
Ltd. (the New Operator). We have accordingly amended the Terms and
the Private Policy governing the relationship between our users and
the New Operator. By clicking "accept", you represent and warrant
that you agree to the revised Terms and Private Policy.
</p>
<div className="flex gap-4 mt-4 justify-center">
<Button onClick={acceptTerms}>Accept</Button>
<SecondaryButton onClick={rejectTerms}>Reject</SecondaryButton>
{/* V2 Promo Section */}
<div className="text-center mb-6 pb-6 border-b border-bkg-4">
<div className="inline-flex items-center justify-center w-14 h-14 rounded-full bg-gradient-to-br from-[#7c3aed] to-[#6366f1] mb-3">
<svg
className="w-7 h-7 text-white"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M13 10V3L4 14h7v7l9-11h-7z"
/>
</svg>
</div>
<h2 className="text-xl font-bold text-fgd-1 mb-1">
Realms v2 is here
</h2>
<p className="text-fgd-3 text-sm mb-3">
Faster, sharper, and built for you
</p>
<div className="flex flex-wrap justify-center gap-2">
<div className="inline-flex items-center gap-2 text-sm text-green-400 bg-green-400/10 px-3 py-1.5 rounded-full">
<svg className="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path fillRule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clipRule="evenodd" />
</svg>
Treasury prices now available
</div>
<div className="inline-flex items-center gap-2 text-sm text-green-400 bg-green-400/10 px-3 py-1.5 rounded-full">
<svg className="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path fillRule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clipRule="evenodd" />
</svg>
All DAOs are there
</div>
</div>
</div>

{/* Terms Section */}
<div className="mb-6">
<h3 className="text-sm font-semibold text-fgd-2 mb-2">Terms & Privacy Policy</h3>
<p className="text-sm text-fgd-3 text-justify">
The operating entity of this site and owner of the related
intellectual property has changed. The new operator is Realms Today
Ltd. (the New Operator). We have accordingly amended the Terms and
the Private Policy governing the relationship between our users and
the New Operator. By clicking &quot;accept&quot;, you represent and warrant
that you agree to the revised Terms and Private Policy.
</p>
</div>

{/* CTA Buttons */}
<div className="space-y-3">
<Button
className="w-full bg-gradient-to-r from-[#7c3aed] to-[#6366f1] hover:from-[#6d31d4] hover:to-[#5558e0]"
onClick={acceptAndGoToV2}
>
<span className="flex items-center justify-center gap-2 text-white">
Accept & Try Realms v2
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M13 7l5 5m0 0l-5 5m5-5H6" />
</svg>
</span>
</Button>
<div className="flex gap-3">
<SecondaryButton
className="flex-1"
onClick={acceptAndStay}
>
Accept & Stay on v1
</SecondaryButton>
<SecondaryButton
className="flex-1 !text-red-400 hover:!text-red-300"
onClick={rejectTerms}
>
Reject
</SecondaryButton>
</div>
</div>
</Modal>
) : null}
Expand Down
129 changes: 129 additions & 0 deletions components/V2PromoModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import Modal from './Modal'
import Button, { SecondaryButton } from './Button'
import { useEffect, useState } from 'react'

const STORAGE_KEY = 'v2-promo-dismissed'

const V2PromoModal = () => {
const [isOpen, setIsOpen] = useState(false)
const [isClient, setIsClient] = useState(false)

useEffect(() => {
setIsClient(true)
}, [])

useEffect(() => {
if (typeof window !== 'undefined' && localStorage) {
const isDismissed = localStorage.getItem(STORAGE_KEY) === 'true'
const hasAcceptedTerms = localStorage.getItem('accept-terms') === 'true'

// Only show to existing users who already accepted terms
// New users will see the combined Terms + V2 promo popup instead
if (!isDismissed && hasAcceptedTerms) {
// Small delay to not overwhelm user immediately
const timer = setTimeout(() => setIsOpen(true), 1500)
return () => clearTimeout(timer)
}
}
}, [])

const dismissModal = () => {
localStorage.setItem(STORAGE_KEY, 'true')
setIsOpen(false)
}

const goToV2 = () => {
localStorage.setItem(STORAGE_KEY, 'true')
window.open('https://v2.realms.today', '_blank')
setIsOpen(false)
}

if (!isClient || !isOpen) return null

return (
<Modal
isOpen={isOpen}
onClose={dismissModal}
sizeClassName="sm:max-w-lg"
bgClickClose={true}
>
<div className="text-center">
{/* Header with gradient */}
<div className="mb-6">
<div className="inline-flex items-center justify-center w-16 h-16 rounded-full bg-gradient-to-br from-[#7c3aed] to-[#6366f1] mb-4">
<svg
className="w-8 h-8 text-white"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M13 10V3L4 14h7v7l9-11h-7z"
/>
</svg>
</div>
<h2 className="text-2xl font-bold text-fgd-1 mb-2">
Realms v2 is here
</h2>
<p className="text-fgd-3">
Experience the next generation of DAO governance
</p>
</div>

{/* Benefits list */}
<div className="text-left space-y-3 mb-6">
<div className="flex items-start gap-3">
<div className="flex-shrink-0 w-5 h-5 rounded-full bg-green-500/20 flex items-center justify-center mt-0.5">
<svg className="w-3 h-3 text-green-400" fill="currentColor" viewBox="0 0 20 20">
<path fillRule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clipRule="evenodd" />
</svg>
</div>
<span className="text-fgd-2">Treasury prices now available</span>
</div>
<div className="flex items-start gap-3">
<div className="flex-shrink-0 w-5 h-5 rounded-full bg-green-500/20 flex items-center justify-center mt-0.5">
<svg className="w-3 h-3 text-green-400" fill="currentColor" viewBox="0 0 20 20">
<path fillRule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clipRule="evenodd" />
</svg>
</div>
<span className="text-fgd-2">All DAOs are there</span>
</div>
<div className="flex items-start gap-3">
<div className="flex-shrink-0 w-5 h-5 rounded-full bg-green-500/20 flex items-center justify-center mt-0.5">
<svg className="w-3 h-3 text-green-400" fill="currentColor" viewBox="0 0 20 20">
<path fillRule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clipRule="evenodd" />
</svg>
</div>
<span className="text-fgd-2">Faster performance and improved UX</span>
</div>
</div>

{/* CTA buttons */}
<div className="flex flex-col sm:flex-row gap-3 justify-center">
<Button
className="w-full sm:w-auto bg-gradient-to-r from-[#7c3aed] to-[#6366f1] hover:from-[#6d31d4] hover:to-[#5558e0]"
onClick={goToV2}
>
<span className="flex items-center justify-center gap-2 text-white">
Go to Realms v2
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M13 7l5 5m0 0l-5 5m5-5H6" />
</svg>
</span>
</Button>
<SecondaryButton
className="w-full sm:w-auto"
onClick={dismissModal}
>
Maybe later
</SecondaryButton>
</div>
</div>
</Modal>
)
}

export default V2PromoModal
42 changes: 42 additions & 0 deletions components/instructions/programs/mangoV4.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,48 @@ const instructions = () => ({
}
},
},
7395: {
name: 'Withdraw Insurance Fund',
accounts: [
{ name: 'Group' },
{ name: 'Admin' },
{ name: 'Insurance Vault' },
{ name: 'Destination' },
{ name: 'Token Program' },
],
getDataUI: async (
connection: Connection,
data: Uint8Array,
accounts: AccountMetaData[],
) => {
const args = await getDataObjectFlattened<any>(connection, data)
const group = accounts[0].pubkey
const client = await getClient(connection)
const mangoGroup = await getGroupForClient(client, group)
const insuranceMint = mangoGroup.insuranceMint
const mintInfo = await tryGetMint(connection, insuranceMint)
const tokenInfo = tokenPriceService.getTokenInfo(insuranceMint.toBase58())

try {
return (
<div>
<div>
Amount:{' '}
{mintInfo?.account.decimals
? formatNumber(
toUiDecimals(args.amount, mintInfo?.account.decimals),
)
: args.amount}{' '}
{tokenInfo?.symbol || 'tokens'}
</div>
</div>
)
} catch (e) {
console.log(e)
return <div>{JSON.stringify(data)}</div>
}
},
},
})

export const MANGO_V4_INSTRUCTIONS = {
Expand Down
15 changes: 14 additions & 1 deletion components/instructions/tools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,24 @@ const MNGO_AUXILIARY_TOKEN_ACCOUNTS = [
owner: 'FRYXAjyVnvXja8chgdq47qL3CKoyBjUg4ro7M7QQn1aD',
accounts: ['24frxVoDzo7bAimBU6rDhB1McxWNvzX9qddPMSv9VACZ'],
},
//
//v3 reimbursement - empty accounts array means include all token accounts from this owner
{
owner: 'D3SMRX2tBq5MYRuis3i4kbVt1fdQ5TkX1xfxhUpZ2pN3',
accounts: [],
},
]

// v3 reimbursement accounts - shared across Mango realms
const MNGO_V3_REIMBURSEMENT_ACCOUNTS = [
{
owner: 'D3SMRX2tBq5MYRuis3i4kbVt1fdQ5TkX1xfxhUpZ2pN3',
accounts: [],
},
]

export const AUXILIARY_TOKEN_ACCOUNTS = {
Mango: MNGO_AUXILIARY_TOKEN_ACCOUNTS,
'Mango Developer Council v2': MNGO_V3_REIMBURSEMENT_ACCOUNTS,
}

export const HIDDEN_TREASURES = [...HIDDEN_MNGO_TREASURES]
Expand Down
Loading
Loading