Skip to content
Draft
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
2 changes: 1 addition & 1 deletion apps/ai-credits-web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="Buy AI credits with G$ and use them through Antseed in Claude Code, Codex, and compatible agent workflows."
content="Buy AI credits with G$ and get an API key for Claude Code, Codex and other AI tools. No install needed."
/>
<meta name="theme-color" content="#13151C" />
<title>AI Credits with G$ | GoodDollar × Antseed</title>
Expand Down
124 changes: 17 additions & 107 deletions apps/ai-credits-web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,9 @@ import {
useAppKitProvider,
useDisconnect,
} from '@goodwidget/embed/appkit-provider'
import {
ExternalLink,
KeyRound,
LockKeyhole,
Network,
ShieldCheck,
ShoppingCart,
} from '@tamagui/lucide-icons'
import { KeyRound, ShieldCheck, ShoppingCart } from '@tamagui/lucide-icons'
import {
Accordion,
Anchor,
Card,
GlowCard,
Heading,
Expand All @@ -39,9 +31,6 @@ import { TamaguiProvider } from '@tamagui/core'
const SWITCH_CHAIN_MANUAL_SELECTION_ERROR =
'Select the network in the wallet dialog, then try again.'

const ANTSEED_API_DOCS = 'https://antseed.com/docs/guides/using-the-api/'
const ANTSEED_SECURITY_DOCS = 'https://antseed.com/docs/security/'

function envAddress(value: string | undefined): `0x${string}` | undefined {
return value ? (value as `0x${string}`) : undefined
}
Expand Down Expand Up @@ -236,7 +225,7 @@ function PurchaseFrame() {
enableInjected
metadata={{
name: 'GoodDollar AI Credits',
description: 'Buy AI credits with G$ and use them through Antseed.',
description: 'Buy AI credits with G$ and get an API key for Claude Code, Codex and other AI tools.',
}}
>
<ReownAiCreditsWidget />
Expand Down Expand Up @@ -268,57 +257,21 @@ function PurchaseFrame() {
)
}

// Gateway-model disclosures: what the key is, and what bounds the risk if it leaks.
function SecurityDetails() {
return (
<YStack gap="$7" paddingTop="$3" $sm={{ gap: "$5" }}>
<XStack gap="$7" alignItems="flex-start" $md={{ flexDirection: 'column' }}>
<TrustItem icon={<Network size={24} color="$primary" />} title="Local, explicit routing">
The signer proxy runs locally. It will not auto-select a peer: browse the network, inspect
the services and pricing, then pin the peer you choose.
</TrustItem>
<TrustItem
icon={<LockKeyhole size={24} color="$primary" />}
title="Protected transport, visible to providers"
>
WebRTC transport protects requests in transit to the selected peer. The provider serving a
request still receives its contents, so do not send secrets in prompts.
</TrustItem>
</XStack>

<YStack gap="$7" paddingTop="$3" $sm={{ gap: '$5' }}>
<XStack gap="$7" alignItems="flex-start" $md={{ flexDirection: 'column' }}>
<TrustItem icon={<KeyRound size={24} color="$primary" />} title="Separated identity">
The signer signing identity is separate from the funding wallet. A compromised signer
identity cannot access that wallet, and its exposure is bounded by deposited credits.
<TrustItem icon={<KeyRound size={24} color="$primary" />} title="Your API key is a secret">
Treat your API key like a password. It is shown once, right after you buy credits, and
anyone who has it can spend your credits. If it leaks or gets lost, rotate it from the API
Key tab.
</TrustItem>
<TrustItem icon={<ShieldCheck size={24} color="$primary" />} title="Keys are secrets">
Treat ANTSEED_IDENTITY_HEX as a private key. The CLI may store a plaintext identity.key in
its Antseed data directory unless you supply the identity securely, such as through a
secrets manager.
<TrustItem icon={<ShieldCheck size={24} color="$primary" />} title="Spend is capped">
Your key has a monthly spend limit, so a leaked key can only use the credits you bought.
It cannot move funds out of your wallet.
</TrustItem>
</XStack>

<Card backgroundColor="$background" padding="$5" outlined>
<XStack gap="$4" alignItems="flex-start" $sm={{ flexDirection: 'column' }}>
<IconFrame>
<ShieldCheck size={24} color="$primary" />
</IconFrame>
<YStack gap="$2" flex={1}>
<Text bold variant="large">
GoodDollar operator role on Base
</Text>
<Text tone="soft">
Your one-time wallet authorization lets the GoodDollar operator fund your credits and
handle Base-side credit actions, including moving credit funds, without requiring you
to pay Base gas. It cannot access your payer wallet or your G$ on Celo. This is a
trusted role for the Base credit account.
</Text>
<XStack gap="$2" alignItems="center" marginTop="$1">
<Anchor href={ANTSEED_SECURITY_DOCS}>Read the Antseed security documentation</Anchor>
<ExternalLink size={16} color="$primary" aria-hidden />
</XStack>
</YStack>
</XStack>
</Card>
</YStack>
)
}
Expand Down Expand Up @@ -351,32 +304,15 @@ function LandingPage() {
backgroundSize: 'auto, auto, auto, auto, 24px 24px, 24px 24px, 24px 24px',
}}
>
<YStack
tag="section"
width="100%"
maxWidth={1120}
marginHorizontal="auto"
paddingHorizontal="$6"
paddingTop="$10"
paddingBottom="$7"
gap="$5"
alignItems="center"
$sm={{ paddingHorizontal: '$4', paddingTop: '$8', paddingBottom: '$6' }}
>
<XStack gap="$2" alignItems="center" padding="$2">
<Anchor href={ANTSEED_API_DOCS}>Read the Antseed API docs</Anchor>
<ExternalLink size={16} color="$primary" aria-hidden />
</XStack>
</YStack>

<YStack
tag="section"
id="purchase"
width="100%"
paddingHorizontal="$6"
paddingTop="$10"
paddingBottom="$10"
style={{ scrollMarginTop: 16 }}
$sm={{ paddingHorizontal: '$3', paddingBottom: '$8' }}
$sm={{ paddingHorizontal: '$3', paddingTop: '$6', paddingBottom: '$8' }}
>
<PurchaseFrame />
</YStack>
Expand All @@ -394,15 +330,15 @@ function LandingPage() {
<YStack width="100%" maxWidth={1080} marginHorizontal="auto" gap="$6">
<SectionHeading
eyebrow="Transparent by design"
title="Know what runs, who can see it, and what is at risk"
description="The local proxy and separated identities reduce exposure, but they do not remove the need to choose providers carefully and protect your keys."
title="Know what your API key can do and what is at risk"
description="A spend limit bounds the damage if your key leaks, but it does not replace keeping the key private."
/>

<Accordion
items={[
{
id: 'security',
title: 'How routing, identity, and the operator role work',
title: 'How your API key and spend limit work',
content: <SecurityDetails />,
},
]}
Expand Down Expand Up @@ -431,36 +367,10 @@ function LandingPage() {
)
}

// Widget-only view for partner integrations (e.g. AntSeed) that embed the purchase flow
// directly without the hero and security sections around it.
function PurchaseOnlyView() {
return (
<YStack
tag="main"
width="100%"
minHeight="100vh"
backgroundColor="$background"
justifyContent="center"
alignItems="center"
padding="$6"
data-testid="ai-credits-purchase-only"
>
<PurchaseFrame />
</YStack>
)
}

function readSourceParam(): string | null {
if (typeof window === 'undefined') return null
return new URLSearchParams(window.location.search).get('source')
}

export function App() {
const isWidgetOnlySource = readSourceParam() === 'antseed'

return (
<TamaguiProvider config={defaultConfig} defaultTheme="dark">
{isWidgetOnlySource ? <PurchaseOnlyView /> : <LandingPage />}
<LandingPage />
</TamaguiProvider>
)
}
44 changes: 12 additions & 32 deletions apps/ai-credits-web/tests/landing-page.spec.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
import { expect, test } from '@playwright/test'

const heroHeading = 'Get up to 20% more AI credits with GoodID'

test.beforeEach(async ({ page }) => {
await page.goto('/')
})

test('renders the hero, purchase widget, and security section without an injected wallet', async ({
test('renders the purchase widget and security section without an injected wallet', async ({
page,
}) => {
await expect(page.getByRole('heading', { level: 1, name: heroHeading })).toBeVisible()
await expect(page.getByTestId('wallet-fallback')).toBeVisible()
await expect(page.getByText('Know what runs, who can see it, and what is at risk')).toBeVisible()
await expect(page.getByText('Know what your API key can do and what is at risk')).toBeVisible()
})

const apiDocsLink = page.getByRole('link', {
name: 'Read the Antseed API docs',
exact: true,
})
await expect(apiDocsLink).toHaveAttribute(
'href',
'https://antseed.com/docs/guides/using-the-api/',
)
await expect(apiDocsLink).toHaveAttribute('target', '_blank')
await expect(apiDocsLink).toHaveAttribute('rel', /noopener/)
await expect(apiDocsLink).toHaveAttribute('rel', /noreferrer/)
test('drops the Antseed desktop copy and docs links', async ({ page }) => {
await expect(page.getByRole('link', { name: 'Read the Antseed API docs' })).toHaveCount(0)
await expect(page.getByText('signer', { exact: false })).toHaveCount(0)
await expect(page.getByText('Antseed Desktop', { exact: false })).toHaveCount(0)
})

test('drops the marketing sections that the widget now covers itself', async ({ page }) => {
Expand All @@ -39,24 +30,13 @@ test('drops the marketing sections that the widget now covers itself', async ({
).toHaveCount(0)
})

test('keeps the security disclosures that have no widget equivalent', async ({ page }) => {
// The section heading stays on the page; the detail sits behind a collapsed
// disclosure, so it has to be expanded before any of it is visible.
await expect(page.getByText('Know what runs, who can see it, and what is at risk')).toBeVisible()
await expect(page.getByText('Separated identity')).toHaveCount(0)

await page.getByText('How routing, identity, and the operator role work').click()
test('keeps the API key security disclosures behind a collapsed disclosure', async ({ page }) => {
await expect(page.getByText('Your API key is a secret')).toHaveCount(0)

await expect(page.getByText('GoodDollar operator role on Base')).toBeVisible()
await expect(page.getByText('Local, explicit routing')).toBeVisible()
await expect(page.getByText('Separated identity')).toBeVisible()
await page.getByText('How your API key and spend limit work').click()

const securityDocsLink = page.getByRole('link', {
name: 'Read the Antseed security documentation',
exact: true,
})
await expect(securityDocsLink).toHaveAttribute('href', 'https://antseed.com/docs/security/')
await expect(securityDocsLink).toHaveAttribute('target', '_blank')
await expect(page.getByText('Your API key is a secret')).toBeVisible()
await expect(page.getByText('Spend is capped')).toBeVisible()
})

test('keeps the portrait purchase frame inside the viewport without horizontal overflow', async ({
Expand Down
34 changes: 0 additions & 34 deletions apps/ai-credits-web/tests/purchase-only.spec.ts

This file was deleted.

Loading
Loading