ui fixed
This commit is contained in:
@@ -20,6 +20,12 @@ export default function PlaygroundPage() {
|
||||
const [mounted, setMounted] = useState(false)
|
||||
useEffect(() => { setMounted(true) }, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (selected && !escrows.some((e) => e.pda === selected.pda)) {
|
||||
setSelected(null)
|
||||
}
|
||||
}, [escrows, selected])
|
||||
|
||||
return (
|
||||
<YStack flex={1} minHeight="100vh" backgroundColor="$background">
|
||||
{/* Header */}
|
||||
|
||||
@@ -172,7 +172,7 @@ export function ResolverPanel() {
|
||||
<Text fontWeight="600">{account.name}</Text>
|
||||
<Text fontSize={12} color="$color10">{resolverTypeLabel(account.resolverType)}</Text>
|
||||
</XStack>
|
||||
{account.description && (
|
||||
{!!account.description && (
|
||||
<Text fontSize={12} color="$color10">{account.description}</Text>
|
||||
)}
|
||||
<XStack gap="$4">
|
||||
|
||||
@@ -20,7 +20,10 @@ export async function fetchEscrowsForWallet(
|
||||
|
||||
const walletBytes = walletAddress as never;
|
||||
|
||||
const [asSeller, asBuyer] = await Promise.all([
|
||||
// Option<Pubkey> for disputeResolver: 1-byte discriminant (1=Some) at offset 80, pubkey at offset 81
|
||||
const someVariantBase64 = btoa(String.fromCharCode(1)) as never;
|
||||
|
||||
const [asSeller, asBuyer, asResolver] = await Promise.all([
|
||||
rpc
|
||||
.getProgramAccounts(DESCRO_PROGRAM_ADDRESS, {
|
||||
filters: [
|
||||
@@ -39,12 +42,22 @@ export async function fetchEscrowsForWallet(
|
||||
encoding: "base64",
|
||||
})
|
||||
.send(),
|
||||
rpc
|
||||
.getProgramAccounts(DESCRO_PROGRAM_ADDRESS, {
|
||||
filters: [
|
||||
{ memcmp: { offset: 0n, bytes: discriminatorBase64, encoding: "base64" } },
|
||||
{ memcmp: { offset: 80n, bytes: someVariantBase64, encoding: "base64" } },
|
||||
{ memcmp: { offset: 81n, bytes: walletBytes, encoding: "base58" } },
|
||||
],
|
||||
encoding: "base64",
|
||||
})
|
||||
.send(),
|
||||
]);
|
||||
|
||||
const seen = new Set<string>();
|
||||
const results: EscrowAccountWithPda[] = [];
|
||||
|
||||
for (const item of [...asSeller, ...asBuyer]) {
|
||||
for (const item of [...asSeller, ...asBuyer, ...asResolver]) {
|
||||
const pda = item.pubkey;
|
||||
if (seen.has(pda)) continue;
|
||||
seen.add(pda);
|
||||
|
||||
Reference in New Issue
Block a user