Skip to content

Commit

Permalink
Fix product details page
Browse files Browse the repository at this point in the history
  • Loading branch information
yurushao committed Jan 12, 2025
1 parent 1d978dc commit af56ef8
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 33 deletions.
6 changes: 3 additions & 3 deletions anchor/src/client/marinade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,12 @@ export class MarinadeClient {
}

public async liquidUnstakeTx(
fund: PublicKey,
statePda: PublicKey,
amount: BN,
txOptions: TxOptions,
): Promise<VersionedTransaction> {
const signer = txOptions.signer || this.base.getSigner();
const vault = this.base.getVaultPda(fund);
const vault = this.base.getVaultPda(statePda);
const marinadeState = this.getMarinadeState();
const treasuryMsolAta = getAssociatedTokenAddressSync(
marinadeState.msolMintAddress,
Expand All @@ -390,7 +390,7 @@ export class MarinadeClient {
const tx = await this.base.program.methods
.marinadeLiquidUnstake(amount)
.accountsPartial({
state: fund,
state: statePda,
vault,
signer,
marinadeState: marinadeState.marinadeStateAddress,
Expand Down
18 changes: 9 additions & 9 deletions anchor/tests/glam_policy_hook.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ describe("glam_policy_hook", () => {
} as any;

const statePda = glamClient.getStatePda(stateModel);
const sharePDA = glamClient.getShareClassPda(statePda, 0);
const sharePda = glamClient.getShareClassPda(statePda, 0);

const connection = glamClient.provider.connection;
const commitment = "confirmed";

// manager
const managerSharesAta = getAssociatedTokenAddressSync(
sharePDA,
sharePda,
wallet.publicKey,
false,
TOKEN_2022_PROGRAM_ID,
Expand All @@ -77,7 +77,7 @@ describe("glam_policy_hook", () => {

// alice
const aliceSharesAta = getAssociatedTokenAddressSync(
sharePDA,
sharePda,
alice.publicKey,
false,
TOKEN_2022_PROGRAM_ID,
Expand Down Expand Up @@ -168,7 +168,7 @@ describe("glam_policy_hook", () => {
const state = await glamClient.fetchState(statePda);
expect(state.mints[0]?.lockUpPeriodInSeconds).toEqual(5);
expect(state.mints[0]?.symbol).toEqual("GBS");
expect(state.mints[0]?.permanentDelegate).toEqual(sharePDA);
expect(state.mints[0]?.permanentDelegate).toEqual(sharePda);
} catch (e) {
console.error(e);
throw e;
Expand All @@ -188,7 +188,7 @@ describe("glam_policy_hook", () => {

const shares = await getMint(
connection,
sharePDA,
sharePda,
commitment,
TOKEN_2022_PROGRAM_ID,
);
Expand Down Expand Up @@ -218,13 +218,13 @@ describe("glam_policy_hook", () => {
wallet.publicKey,
aliceSharesAta,
alice.publicKey,
sharePDA,
sharePda,
TOKEN_2022_PROGRAM_ID,
),
await createTransferCheckedWithTransferHookInstruction(
connection,
managerSharesAta,
sharePDA,
sharePda,
aliceSharesAta,
wallet.publicKey,
amount,
Expand Down Expand Up @@ -262,13 +262,13 @@ describe("glam_policy_hook", () => {
wallet.publicKey,
aliceSharesAta,
alice.publicKey,
sharePDA,
sharePda,
TOKEN_2022_PROGRAM_ID,
),
await createTransferCheckedWithTransferHookInstruction(
connection,
managerSharesAta,
sharePDA,
sharePda,
aliceSharesAta,
wallet.publicKey,
amount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ import { useRouter, useParams } from "next/navigation";
import { useEffect, useMemo, useRef, useState } from "react";
import { PublicKey } from "@solana/web3.js";
import Sparkle from "@/utils/Sparkle";
import SparkleColorMatcher, {
getColorInfo,
ColorInfo,
} from "@/utils/SparkleColorMatcher";
import { getColorInfo, ColorInfo } from "@/utils/SparkleColorMatcher";
import TruncateAddress from "@/utils/TruncateAddress";
import PageContentWrapper from "@/components/PageContentWrapper";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
Expand Down Expand Up @@ -449,7 +446,6 @@ export default function ProductPage() {
animate={{ opacity: 1 }}
transition={{ ease: "easeInOut", duration: 0 }}
>
{/*<SparkleBackground rows={6} cols={6} size={24} gap={5} static={false} visibleCount={252} fadeInSpeed={1}/>*/}
<SparkleBackground
fadeOut={true}
rows={6}
Expand Down Expand Up @@ -547,7 +543,7 @@ export default function ProductPage() {
ref={sparkleContainerRef}
>
<Sparkle
address={stateModel?.mints[0]?.fundId?.toBase58()!}
address={stateModel.shareClassMints[0].toBase58()}
size={105}
onColorGenerated={handleColorGenerated}
/>
Expand Down Expand Up @@ -1012,20 +1008,24 @@ export default function ProductPage() {
</ul>
</div>
<Separator className="my-4" />
<div className="grid gap-2">
<div className="font-medium">Share Class Accounts</div>
<dl className="grid gap-2">
<div className="flex items-center justify-between">
<dt className="text-muted-foreground">
Share Class 1 {stateModel?.mints[0]?.symbol}
</dt>
<ExplorerLink
path={`/account/${stateModel?.shareClassMints[0]}`}
label={stateModel?.shareClassMints[0].toBase58()}
/>
{stateModel.shareClassMints.length > 0 && (
<div className="grid gap-2">
<div className="font-medium">
Share Class Accounts
</div>
</dl>
</div>
<dl className="grid gap-2">
<div className="flex items-center justify-between">
<dt className="text-muted-foreground">
Share Class 1 {stateModel?.mints[0]?.symbol}
</dt>
<ExplorerLink
path={`/account/${stateModel?.shareClassMints[0]}`}
label={stateModel?.shareClassMints[0].toBase58()}
/>
</div>
</dl>
</div>
)}
</TabsContent>
</Tabs>
</CardContent>
Expand Down
8 changes: 6 additions & 2 deletions playground/src/app/(shared)/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,13 @@ const SettingsPage: React.FC = () => {
setCluster(clusterEndpoint);
}
toast({
title: "Endpoint changed",
description: `Active endpoint set to ${selectedEndpoint.label}`,
title: "RPC endpoint changed",
description: `Active RPC endpoint set to ${selectedEndpoint.label}`,
});
// Reload the page to force refreshing account menu
window.setTimeout(() => {
window.location.reload();
}, 1000);
}
};

Expand Down
3 changes: 3 additions & 0 deletions playground/src/components/access/data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ export function DataTable<TData extends KeyData>({
key={row.id}
open={activeRow === row.original.pubkey}
onOpenChange={(open) => {
if (row.original.label === "Owner") {
return; // Prevent modifying owner permissions
}
if (open) {
setActiveRow(row.original.pubkey);
const currentPermissions = row.original.tags;
Expand Down

0 comments on commit af56ef8

Please sign in to comment.