Skip to content

Commit f8e0f82

Browse files
committed
Use preferred explorer
1 parent 2de04c2 commit f8e0f82

File tree

16 files changed

+147
-36
lines changed

16 files changed

+147
-36
lines changed

app/src/app/stores/[storePda]/(auth)/earnings/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
TableRow,
1616
} from '@/components/ui/table';
1717
import { ACCEPTED_MINTS_METADATA } from '@/lib/constants';
18-
import { buildTx, getTransactionLink } from '@/lib/client/solana';
18+
import { buildTx } from '@/lib/client/solana';
1919
import { atomicToUsd } from '@/lib/utils';
2020
import { usePyth } from '@/providers/PythProvider';
2121
import { useStoreTokenAccount } from '@/providers/StoreTokenAccountProvider';
@@ -26,10 +26,12 @@ import { useMemo, useState } from 'react';
2626
import { toast } from 'sonner';
2727
import { sendTx } from '@/lib/api';
2828
import { useProgram } from '@/providers/ProgramProvider';
29+
import { useSettings } from '@/providers/SettingsProvider';
2930

3031
export default function Page() {
3132
const { publicKey, signTransaction } = useUnifiedWallet();
3233
const { splurgeClient } = useProgram();
34+
const { getTransactionLink } = useSettings();
3335
const {
3436
storeTokenAccountsData,
3537
storeTokenAccountsLoading,
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
import { truncateAddress } from '@/lib/utils';
2-
import { getAccountLink } from '@/lib/client/solana';
32
import { AccountLinkButton } from './AccountLinkButton';
43

54
export function AccountLinkText({
65
prefix,
76
subject,
7+
href,
88
}: {
99
prefix: string;
1010
subject: string;
11+
href: string;
1112
}) {
1213
return (
1314
<div className="flex items-center gap-2">
1415
<p className="text-muted-foreground">
1516
{prefix} {truncateAddress(subject)}
1617
</p>
17-
<AccountLinkButton href={getAccountLink(subject)} />
18+
<AccountLinkButton href={href} />
1819
</div>
1920
);
2021
}

app/src/components/AccountSection.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import { AccountLinkText } from './AccountLinkText';
1111
import { SectionHeader } from './SectionHeader';
1212
import { LargeImage } from './LargeImage';
13+
import { useSettings } from '@/providers/SettingsProvider';
1314

1415
export function AccountSection({
1516
header,
@@ -28,6 +29,8 @@ export function AccountSection({
2829
content: ReactNode;
2930
buttons?: ReactNode;
3031
}) {
32+
const { getAccountLink } = useSettings();
33+
3134
return (
3235
<section className="flex w-full flex-col gap-6">
3336
{header && <SectionHeader text={header} />}
@@ -37,7 +40,11 @@ export function AccountSection({
3740
<CardHeader className="flex flex-1 flex-col p-0">
3841
<CardTitle className="truncate font-medium">{title}</CardTitle>
3942
<CardDescription>
40-
<AccountLinkText prefix={prefix} subject={address} />
43+
<AccountLinkText
44+
prefix={prefix}
45+
subject={address}
46+
href={getAccountLink(address)}
47+
/>
4148
</CardDescription>
4249
<CardContent className="flex flex-1 flex-col gap-y-1 p-0">
4350
{content}

app/src/components/OrderTable.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ import { ParsedItem, ParsedOrder } from '@/types/accounts';
2626
import { InfoTooltip } from './InfoTooltip';
2727
import { TimestampTooltip } from './TimestampTooltip';
2828
import Image from 'next/image';
29-
import { getAccountLink } from '@/lib/client/solana';
3029
import { ACCEPTED_MINTS_METADATA } from '@/lib/constants';
3130
import { OrderTablePagination } from './OrderTablePagination';
3231
import { AccountLinkButton } from './AccountLinkButton';
3332
import { SortButton } from './SortButton';
3433
import { OrderTableRow } from './OrderTableRow';
3534
import { MintIcon } from './MintIcon';
35+
import { useSettings } from '@/providers/SettingsProvider';
3636

3737
const ORDER_TABS = ['all', 'pending', 'shipping', 'completed', 'cancelled'];
3838

@@ -54,6 +54,7 @@ export function OrderTable({
5454
showTotalTooltip?: boolean;
5555
statusRenderer: (order: ParsedOrder) => ReactNode;
5656
}) {
57+
const { getAccountLink } = useSettings();
5758
const [sorting, setSorting] = useState<SortingState>([
5859
{ id: 'timestamp', desc: true },
5960
]);
@@ -174,7 +175,7 @@ export function OrderTable({
174175
enableSorting: false,
175176
},
176177
],
177-
[showTotalTooltip]
178+
[showTotalTooltip, getAccountLink]
178179
);
179180

180181
// eslint-disable-next-line react-hooks/incompatible-library

app/src/components/TransactionToast.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@ export function TransactionToast({
33
link,
44
}: {
55
title: string;
6-
link?: string;
6+
link: string;
77
}) {
88
return (
99
<div className="flex flex-col">
10-
<p>{title}</p>
11-
{link && (
12-
<a href={link} target="_blank" className="text-info underline">
13-
{link}
14-
</a>
15-
)}
10+
<a href={link} target="_blank" className="text-info underline">
11+
{title}
12+
</a>
1613
</div>
1714
);
1815
}

app/src/components/formDialogs/AddItemDialog.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { WalletGuardButton } from '@/components/WalletGuardButton';
2020
import { useIrysUploader } from '@/hooks/useIrysUploader';
2121
import { toast } from 'sonner';
2222
import { TransactionToast } from '@/components/TransactionToast';
23-
import { buildTx, getTransactionLink } from '@/lib/client/solana';
23+
import { buildTx } from '@/lib/client/solana';
2424
import { Textarea } from '../ui/textarea';
2525
import { DicebearStyles, getDicebearFile } from '@/lib/client/dicebear';
2626
import { useItems } from '@/providers/ItemsProvider';
@@ -36,10 +36,12 @@ import { FormSubmitButton } from '../FormSubmitButton';
3636
import { FormCancelButton } from '../FormCancelButton';
3737
import { sendTx } from '@/lib/api';
3838
import { useProgram } from '@/providers/ProgramProvider';
39+
import { useSettings } from '@/providers/SettingsProvider';
3940

4041
export function AddItemDialog({ storePda }: { storePda: string }) {
4142
const { publicKey, signTransaction } = useUnifiedWallet();
4243
const { splurgeClient } = useProgram();
44+
const { getTransactionLink } = useSettings();
4345
const { upload } = useIrysUploader();
4446
const { itemsMutate } = useItems();
4547
const [isOpen, setIsOpen] = useState(false);
@@ -174,6 +176,7 @@ export function AddItemDialog({ storePda }: { storePda: string }) {
174176
storePda,
175177
closeAndReset,
176178
splurgeClient,
179+
getTransactionLink,
177180
]
178181
);
179182

app/src/components/formDialogs/AddReviewDialog.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { zodResolver } from '@hookform/resolvers/zod';
55
import { useCallback, useState } from 'react';
66
import { useForm } from 'react-hook-form';
77
import { TransactionToast } from '../TransactionToast';
8-
import { buildTx, getTransactionLink } from '@/lib/client/solana';
8+
import { buildTx } from '@/lib/client/solana';
99
import { toast } from 'sonner';
1010
import { PublicKey } from '@solana/web3.js';
1111
import { Plus } from 'lucide-react';
@@ -30,10 +30,12 @@ import { FormSubmitButton } from '../FormSubmitButton';
3030
import { FormCancelButton } from '../FormCancelButton';
3131
import { sendTx } from '@/lib/api';
3232
import { useProgram } from '@/providers/ProgramProvider';
33+
import { useSettings } from '@/providers/SettingsProvider';
3334

3435
export function AddReviewDialog({ orderPda }: { orderPda: string }) {
3536
const { publicKey, signTransaction } = useUnifiedWallet();
3637
const { splurgeClient } = useProgram();
38+
const { getTransactionLink } = useSettings();
3739
const { reviewsMutate } = useReviews();
3840
const [isOpen, setIsOpen] = useState(false);
3941
const [isSubmitting, setIsSubmitting] = useState(false);
@@ -131,6 +133,7 @@ export function AddReviewDialog({ orderPda }: { orderPda: string }) {
131133
signTransaction,
132134
closeAndReset,
133135
splurgeClient,
136+
getTransactionLink,
134137
]
135138
);
136139

app/src/components/formDialogs/CheckoutDialog.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useConnection } from '@solana/wallet-adapter-react';
66
import { ReactNode, useCallback, useMemo, useState } from 'react';
77
import { useForm, useWatch } from 'react-hook-form';
88
import { TransactionToast } from '../TransactionToast';
9-
import { buildTx, getTransactionLink } from '@/lib/client/solana';
9+
import { buildTx } from '@/lib/client/solana';
1010
import { toast } from 'sonner';
1111
import { PublicKey } from '@solana/web3.js';
1212
import { Dialog, DialogHeader, DialogTrigger } from '../ui/dialog';
@@ -30,7 +30,6 @@ import {
3030
} from '../ui/select';
3131
import { z } from 'zod';
3232
import { ACCEPTED_MINTS_METADATA } from '@/lib/constants';
33-
import { confirmTransaction } from '@solana-developers/helpers';
3433
import { useItems } from '@/providers/ItemsProvider';
3534
import { useShopper } from '@/providers/ShopperProvider';
3635
import { atomicToUsd, removeTrailingZeroes } from '@/lib/utils';
@@ -49,6 +48,7 @@ import { FormSubmitButton } from '../FormSubmitButton';
4948
import { FormCancelButton } from '../FormCancelButton';
5049
import { LargeImage } from '../LargeImage';
5150
import { useProgram } from '@/providers/ProgramProvider';
51+
import { useSettings } from '@/providers/SettingsProvider';
5252

5353
export function CheckoutDialog({
5454
name,
@@ -76,6 +76,7 @@ export function CheckoutDialog({
7676
const { connection } = useConnection();
7777
const { publicKey } = useUnifiedWallet();
7878
const { splurgeClient } = useProgram();
79+
const { getTransactionLink } = useSettings();
7980
const { pythSolanaReceiver, getUpdatePriceFeedTx } = usePyth();
8081
const { configData, configLoading } = useConfig();
8182
const { itemsMutate } = useItems();
@@ -170,8 +171,11 @@ export function CheckoutDialog({
170171
]);
171172

172173
// checkout transaction is the last one
173-
await confirmTransaction(
174-
connection,
174+
// await confirmTransaction(
175+
// connection,
176+
// signatures[signatures.length - 1]
177+
// );
178+
await connection.confirmTransaction(
175179
signatures[signatures.length - 1]
176180
);
177181

@@ -259,6 +263,7 @@ export function CheckoutDialog({
259263
orderSubtotal,
260264
closeAndReset,
261265
splurgeClient,
266+
getTransactionLink,
262267
]
263268
);
264269

app/src/components/formDialogs/CreateProfileDialog.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { WalletGuardButton } from '@/components/WalletGuardButton';
2020
import { useIrysUploader } from '@/hooks/useIrysUploader';
2121
import { toast } from 'sonner';
2222
import { TransactionToast } from '@/components/TransactionToast';
23-
import { buildTx, getTransactionLink } from '@/lib/client/solana';
23+
import { buildTx } from '@/lib/client/solana';
2424
import { DicebearStyles, getDicebearFile } from '@/lib/client/dicebear';
2525
import { useShopper } from '@/providers/ShopperProvider';
2626
import { ImageInputLabel } from '../ImageInputLabel';
@@ -32,10 +32,12 @@ import { FormSubmitButton } from '../FormSubmitButton';
3232
import { FormCancelButton } from '../FormCancelButton';
3333
import { sendTx } from '@/lib/api';
3434
import { useProgram } from '@/providers/ProgramProvider';
35+
import { useSettings } from '@/providers/SettingsProvider';
3536

3637
export function CreateProfileDialog() {
3738
const { publicKey, signTransaction } = useUnifiedWallet();
3839
const { splurgeClient } = useProgram();
40+
const { getTransactionLink } = useSettings();
3941
const { shopperMutate } = useShopper();
4042
const { upload } = useIrysUploader();
4143
const [isOpen, setIsOpen] = useState(false);
@@ -154,6 +156,7 @@ export function CreateProfileDialog() {
154156
publicKey,
155157
closeAndReset,
156158
splurgeClient,
159+
getTransactionLink,
157160
]
158161
);
159162

app/src/components/formDialogs/CreateStoreDialog.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { zodResolver } from '@hookform/resolvers/zod';
1818
import { ImageInput } from '@/components/ImageInput';
1919
import { useIrysUploader } from '@/hooks/useIrysUploader';
2020
import { TransactionToast } from '@/components/TransactionToast';
21-
import { buildTx, getTransactionLink } from '@/lib/client/solana';
21+
import { buildTx } from '@/lib/client/solana';
2222
import { toast } from 'sonner';
2323
import { WalletGuardButton } from '@/components/WalletGuardButton';
2424
import { DicebearStyles, getDicebearFile } from '@/lib/client/dicebear';
@@ -32,10 +32,12 @@ import { FormSubmitButton } from '../FormSubmitButton';
3232
import { FormCancelButton } from '../FormCancelButton';
3333
import { sendTx } from '@/lib/api';
3434
import { useProgram } from '@/providers/ProgramProvider';
35+
import { useSettings } from '@/providers/SettingsProvider';
3536

3637
export function CreateStoreDialog() {
3738
const { publicKey, signTransaction } = useUnifiedWallet();
3839
const { splurgeClient } = useProgram();
40+
const { getTransactionLink } = useSettings();
3941
const { personalStoreMutate } = usePersonalStore();
4042
const { upload } = useIrysUploader();
4143
const [isOpen, setIsOpen] = useState(false);
@@ -152,6 +154,7 @@ export function CreateStoreDialog() {
152154
upload,
153155
closeAndReset,
154156
splurgeClient,
157+
getTransactionLink,
155158
]
156159
);
157160

0 commit comments

Comments
 (0)