diff --git a/app/app/stream/[id]/page.tsx b/app/app/stream/[id]/page.tsx
index de7e40e..0b13863 100644
--- a/app/app/stream/[id]/page.tsx
+++ b/app/app/stream/[id]/page.tsx
@@ -51,7 +51,8 @@ import {
shortenAddress,
formatRate,
} from '@/lib/stream-utils'
-import { NETWORK, STREAM_CONTRACT_ID, explorerUrl } from '@/lib/stellar'
+import { explorerUrl } from '@/lib/stellar'
+import { useNetwork } from '@/components/providers/network-provider'
import { useAutoWithdraw } from '@/hooks/use-auto-withdraw'
import { UnlockChart } from '@/components/streams/unlock-chart'
import { bumpStreamTtl } from '@/lib/contract'
@@ -120,6 +121,7 @@ function WithdrawDialog({
token: { symbol: string; decimals: number; address: string }
}) {
const { withdraw, pending, error } = useContract()
+ const { network } = useNetwork()
const [inputAmount, setInputAmount] = useState('')
const [showFeeEstimate, setShowFeeEstimate] = useState(false)
@@ -140,7 +142,7 @@ function WithdrawDialog({
...(hash && {
action: {
label: 'View transaction',
- onClick: () => window.open(explorerUrl('tx', hash), '_blank'),
+ onClick: () => window.open(explorerUrl(network, 'tx', hash), '_blank'),
},
}),
})
@@ -242,6 +244,7 @@ function CancelDialog({
streamId: string
}) {
const { cancel, pending, error } = useContract()
+ const { network } = useNetwork()
const router = useRouter()
const [showFeeEstimate, setShowFeeEstimate] = useState(false)
@@ -257,7 +260,7 @@ function CancelDialog({
...(hash && {
action: {
label: 'View transaction',
- onClick: () => window.open(explorerUrl('tx', hash), '_blank'),
+ onClick: () => window.open(explorerUrl(network, 'tx', hash), '_blank'),
},
}),
})
@@ -534,6 +537,7 @@ function estimateDaysSinceLastWrite(stream: import('@/types/stream').StreamData,
function TtlWarning({ stream, nowSeconds }: { stream: import('@/types/stream').StreamData; nowSeconds: number }) {
const { address } = useWallet()
+ const { network } = useNetwork()
const [bumping, setBumping] = useState(false)
const [bumped, setBumped] = useState(false)
@@ -546,7 +550,7 @@ function TtlWarning({ stream, nowSeconds }: { stream: import('@/types/stream').S
if (!address) return
setBumping(true)
try {
- await bumpStreamTtl(stream.id, address)
+ await bumpStreamTtl(network, stream.id, address)
setBumped(true)
toast.success('Storage TTL extended by 30 days')
} catch {
@@ -698,6 +702,7 @@ function ConnectPrompt() {
function StreamDetail({ id }: { id: string }) {
const { stream, loading } = useStream(id)
const { address, isConnected } = useWallet()
+ const { network, config } = useNetwork()
const now = useNow(1000)
const [withdrawOpen, setWithdrawOpen] = useState(false)
const [cancelOpen, setCancelOpen] = useState(false)
@@ -884,25 +889,25 @@ function StreamDetail({ id }: { id: string }) {
Details
-
+
-
+
{stream.token.symbol}
- {STREAM_CONTRACT_ID && (
+ {config.streamContractId && (
)}
@@ -937,7 +942,7 @@ function StreamDetail({ id }: { id: string }) {
{formatDateTime(stream.endTime)}
- {NETWORK.name}
+ {network}
diff --git a/components/streams/stream-templates.tsx b/components/streams/stream-templates.tsx
new file mode 100644
index 0000000..e05e9e6
--- /dev/null
+++ b/components/streams/stream-templates.tsx
@@ -0,0 +1,113 @@
+'use client'
+
+import { Briefcase, Lock, Gift, CreditCard } from 'lucide-react'
+
+export interface StreamTemplate {
+ id: string
+ name: string
+ description: string
+ icon: React.ComponentType<{ className?: string }>
+ durationSeconds: number
+ cliffSeconds: number
+ cliffPercent: number
+ badge: string
+}
+
+export const STREAM_TEMPLATES: StreamTemplate[] = [
+ {
+ id: 'payroll',
+ name: 'Payroll',
+ description: 'Monthly salary streaming',
+ icon: Briefcase,
+ durationSeconds: 30 * 24 * 3600,
+ cliffSeconds: 0,
+ cliffPercent: 0,
+ badge: '1 month',
+ },
+ {
+ id: 'vesting',
+ name: 'Token Vesting',
+ description: 'Standard vesting schedule',
+ icon: Lock,
+ durationSeconds: 2 * 365 * 24 * 3600,
+ cliffSeconds: 365 * 24 * 3600,
+ cliffPercent: 25,
+ badge: '2yr / 1yr cliff',
+ },
+ {
+ id: 'grant',
+ name: 'Grant / Sponsorship',
+ description: 'Milestone-based grant',
+ icon: Gift,
+ durationSeconds: 90 * 24 * 3600,
+ cliffSeconds: 30 * 24 * 3600,
+ cliffPercent: 10,
+ badge: '3 months',
+ },
+ {
+ id: 'subscription',
+ name: 'Subscription',
+ description: 'Continuous subscription payment',
+ icon: CreditCard,
+ durationSeconds: 30 * 24 * 3600,
+ cliffSeconds: 0,
+ cliffPercent: 0,
+ badge: '1 month',
+ },
+]
+
+interface StreamTemplatesProps {
+ onSelect: (template: StreamTemplate) => void
+ selectedId?: string
+}
+
+export function StreamTemplates({ onSelect, selectedId }: StreamTemplatesProps) {
+ return (
+