Skip to content

Commit f4a54f5

Browse files
authored
Merge pull request #3 from 0xjojo1/main
update
2 parents 42008a2 + 2432fbd commit f4a54f5

File tree

71 files changed

+4614
-912
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+4614
-912
lines changed

app/assets/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
'use client';
22

33
import { PageContainer } from '@/components/Layout/PageContainer';
4-
import { useSelectedSafeAddress } from '@/features/safe-account/providers/safe-account-provider';
54
import { Card, CardContent } from '@/components/ui/card';
65
import { Coins } from 'lucide-react';
76
import { AssetsHeader, AssetsList, TopAssets } from '@/components/Assets';
7+
import { useSafeAccount } from '@/features/safe-sdk/hooks/use-safe-account';
88

99
export default function AssertPage() {
10-
const { selectedSafeAddress } = useSelectedSafeAddress();
10+
const { selectedAddress } = useSafeAccount();
1111

12-
if (!selectedSafeAddress) {
12+
if (!selectedAddress) {
1313
return (
1414
<PageContainer>
1515
<Card>

app/client-layout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { Toaster } from 'sonner';
44
import { SidebarProvider, SidebarTrigger } from '@/components/ui/sidebar';
55
import { AppSidebar } from '@/components/Sidebar/AppSiderbar';
66
import { AppBreadcrumb } from '@/components/Breadcrumb/AppBreadcrumb';
7-
import { SafeAccountProvider } from '@/features/safe-account/providers/safe-account-provider';
7+
import { SafeSdkProvider } from '@/features/safe-sdk/providers/safe-sdk-provider';
88
import AuthLayout from './auth-layout';
99
import Web3Layout from './web3-layout';
1010

1111
const ClientRootLayout = ({ children }: { children: React.ReactNode }) => {
1212
return (
1313
<div className='h-full'>
1414
<Web3Layout>
15-
<SafeAccountProvider>
15+
<SafeSdkProvider>
1616
<SidebarProvider>
1717
<AppSidebar />
1818
<main className='flex flex-col w-full h-full overflow-hidden relative'>
@@ -26,7 +26,7 @@ const ClientRootLayout = ({ children }: { children: React.ReactNode }) => {
2626
</main>
2727
</SidebarProvider>
2828
<Toaster />
29-
</SafeAccountProvider>
29+
</SafeSdkProvider>
3030
</Web3Layout>
3131
</div>
3232
);

app/transactions/history/page.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
'use client';
22

3-
import { useCurrentSafeClient, useSelectedSafeAddress } from '@/features/safe-account/providers/safe-account-provider';
43
import { useEffect, useState, useCallback } from 'react';
54
import { DataTable } from '@/components/DataTable/data-table';
65
import { transactionColumns } from '@/components/DataTable/transaction-columns';
76
import { PageContainer } from '@/components/Layout/PageContainer';
87
import { TransactionService } from '@/services/transactions/TransactionService';
9-
import { UnifiedTransaction } from '@/types/transactions';
8+
import { UnifiedTransaction } from '@/features/safe-sdk/types/transactions';
109
import { Alert, AlertDescription } from '@/components/ui/alert';
1110
import { Loader2, AlertCircle } from 'lucide-react';
11+
import { useSafeAccount } from '@/features/safe-sdk/hooks/use-safe-account';
12+
import { useSafeClient } from '@/features/safe-sdk/hooks/use-safe-client';
1213

1314
export default function TransactionsPage() {
1415
// State for transaction data, loading, error, and pagination
@@ -21,20 +22,20 @@ export default function TransactionsPage() {
2122
total: 0,
2223
});
2324

24-
const safeClient = useCurrentSafeClient();
25-
const { selectedSafeAddress } = useSelectedSafeAddress();
25+
const safeClient = useSafeClient();
26+
const { selectedSafeAccountAddress } = useSafeAccount();
2627

2728
// Fetch transactions from the API
2829
const fetchTransactions = useCallback(async () => {
29-
if (!safeClient?.apiKit || !selectedSafeAddress) {
30+
if (!safeClient?.apiKit || !selectedSafeAccountAddress) {
3031
return;
3132
}
3233

3334
setIsLoading(true);
3435
setError(null);
3536

3637
try {
37-
const response = await TransactionService.getAllTransactions(safeClient.apiKit, selectedSafeAddress, {
38+
const response = await TransactionService.getAllTransactions(safeClient.apiKit, selectedSafeAccountAddress, {
3839
limit: pagination.limit,
3940
offset: pagination.offset,
4041
});
@@ -51,7 +52,7 @@ export default function TransactionsPage() {
5152
} finally {
5253
setIsLoading(false);
5354
}
54-
}, [safeClient?.apiKit, selectedSafeAddress, pagination.limit, pagination.offset]);
55+
}, [safeClient?.apiKit, selectedSafeAccountAddress, pagination.limit, pagination.offset]);
5556

5657
// Refetch transactions when dependencies change
5758
useEffect(() => {
@@ -61,10 +62,10 @@ export default function TransactionsPage() {
6162
// Reset pagination offset when Safe address changes
6263
useEffect(() => {
6364
setPagination((prev) => ({ ...prev, offset: 0 }));
64-
}, [selectedSafeAddress]);
65+
}, [selectedSafeAccountAddress]);
6566

6667
// Show alert if no Safe wallet is selected
67-
if (!selectedSafeAddress) {
68+
if (!selectedSafeAccountAddress) {
6869
return (
6970
<PageContainer>
7071
<Alert>

app/transactions/new/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import { PageContainer } from '@/components/Layout/PageContainer';
44
import { Card, CardContent } from '@/components/ui/card';
55
import { Coins } from 'lucide-react';
6-
import { useSelectedSafeAddress } from '@/features/safe-account/providers/safe-account-provider';
76
import TransactionStepper from '@/features/transactions/components/TransactionStepper';
7+
import { useSafeAccount } from '@/features/safe-sdk/hooks/use-safe-account';
88

99
export default function NewTransactionPage() {
10-
const { selectedSafeAddress } = useSelectedSafeAddress();
10+
const { selectedSafeAccountAddress } = useSafeAccount();
1111

12-
if (!selectedSafeAddress) {
12+
if (!selectedSafeAccountAddress) {
1313
return (
1414
<PageContainer>
1515
<Card className='max-w-md mx-auto'>

app/transactions/queue/page.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22

33
import { PageContainer } from '@/components/Layout/PageContainer';
44
import { TransactionsQueue } from '@/components/Transactions/TransactionsQueue';
5-
import { useSelectedSafeAddress } from '@/features/safe-account/providers/safe-account-provider';
65
import { Card, CardContent } from '@/components/ui/card';
76
import { Clock } from 'lucide-react';
87
import { useRouter } from 'next/navigation';
98
import { SafeMultisigTransactionResponse } from '@safe-global/types-kit';
9+
import { useSafeAccount } from '@/features/safe-sdk/hooks/use-safe-account';
1010

1111
export default function TransactionsQueuePage() {
1212
const router = useRouter();
13-
const { selectedSafeAddress } = useSelectedSafeAddress();
1413

15-
if (!selectedSafeAddress) {
14+
const { selectedSafeAccountAddress } = useSafeAccount();
15+
16+
if (!selectedSafeAccountAddress) {
1617
return (
1718
<PageContainer>
1819
<Card>

app/web3-layout.tsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
'use client';
22

3-
import onboard from '@/lib/onboard';
4-
import { Web3OnboardProvider } from '@web3-onboard/react';
3+
import onboard from '@/features/onboard/lib';
4+
import { useWagmiConfig, Web3OnboardProvider } from '@web3-onboard/react';
55
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
66
import { Config, WagmiProvider } from 'wagmi';
7+
import { config } from '@/lib/wagmi-config';
78

89
const queryClient = new QueryClient();
910

10-
export default function Web3Layout({ children }: { children: React.ReactNode }) {
11-
const wagmiConfig = onboard.state.get().wagmiConfig as Config;
12-
11+
function WagmiGate({ children }: { children: React.ReactNode }) {
12+
const cfg = useWagmiConfig();
13+
const finalCfg = cfg ?? config;
14+
const key = cfg ? 'onboard' : 'readonly';
1315
return (
14-
<WagmiProvider config={wagmiConfig}>
15-
<QueryClientProvider client={queryClient}>
16-
<Web3OnboardProvider web3Onboard={onboard}>{children}</Web3OnboardProvider>
17-
</QueryClientProvider>
16+
<WagmiProvider key={key} config={finalCfg as Config}>
17+
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
1818
</WagmiProvider>
1919
);
2020
}
21+
22+
export default function Web3Layout({ children }: { children: React.ReactNode }) {
23+
return (
24+
<Web3OnboardProvider web3Onboard={onboard}>
25+
<WagmiGate>{children}</WagmiGate>
26+
</Web3OnboardProvider>
27+
);
28+
}

components/AccountSelect/AccountSelectDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, SelectSe
99
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
1010
import { Loader2, Search, Eye, EyeOff, AlertTriangle, Wallet, X } from 'lucide-react';
1111
import { AccountTable } from '@/components/AccountSelect/AccountTable';
12-
import { weiToEth } from '@/services/onboard/account/utils';
12+
import { weiToEth } from '@/features/onboard/services/account/utils';
1313

1414
import type { ScanAccountsOptions, SelectAccountOptions, Account, AccountsList } from '@web3-onboard/hw-common';
1515

components/AccountSelect/AccountTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Button } from '@/components/ui/button';
66
import { Badge } from '@/components/ui/badge';
77
import { ScrollArea } from '@/components/ui/scroll-area';
88
import { Check, Copy, ExternalLink, Circle, CheckCircle2 } from 'lucide-react';
9-
import { weiToEth } from '@/services/onboard/account/utils';
9+
import { weiToEth } from '@/features/onboard/services/account/utils';
1010
import type { Account } from '@web3-onboard/hw-common';
1111

1212
interface AccountTableProps {

components/Assets/AssetCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
22
import { Badge } from '@/components/ui/badge';
3-
import { SafeBalance } from '@/types/extendedSafeTransactionServiceTypes';
3+
import { SafeBalance } from '@/features/safe-sdk/types/extendedSafeTransactionServiceTypes';
44
import { formatBalance, getTokenSymbol, getTokenName, getTokenIcon } from './utils';
55
import { ReactNode } from 'react';
66

components/Assets/AssetsHeader.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
import { Button } from '@/components/ui/button';
44
import { RefreshCw } from 'lucide-react';
5-
import { useSelectedSafeAddress } from '@/features/safe-account/providers/safe-account-provider';
6-
import { useBalance } from '@/hooks/safe/useBalance';
5+
import { useBalance } from '@/features/safe-sdk/hooks/use-safe-account-balance';
6+
import { useSafeAccount } from '@/features/safe-sdk/hooks/use-safe-account';
77

88
export function AssetsHeader() {
9-
const { selectedSafeAddress } = useSelectedSafeAddress();
9+
const { selectedSafeAccountAddress } = useSafeAccount();
1010
const { loading, fetchBalances } = useBalance();
1111

1212
return (
1313
<div className='flex items-center justify-between'>
1414
<div>
1515
<h1 className='text-2xl font-bold'>Assets</h1>
16-
<p className='text-muted-foreground'>Safe: {selectedSafeAddress}</p>
16+
<p className='text-muted-foreground'>Safe: {selectedSafeAccountAddress}</p>
1717
</div>
1818
<Button variant='outline' size='sm' onClick={fetchBalances} disabled={loading}>
1919
<RefreshCw className={`h-4 w-4 mr-2 ${loading ? 'animate-spin' : ''}`} />

0 commit comments

Comments
 (0)