Skip to content

Commit ba17432

Browse files
committed
feat: changed to base chain and added swap link to navigation
1 parent 70e2ee0 commit ba17432

File tree

7 files changed

+43
-10
lines changed

7 files changed

+43
-10
lines changed

package-lock.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"sharp": "^0.33.5",
3636
"simple-zustand-devtools": "^1.1.0",
3737
"wagmi": "^2.14.8",
38-
"zustand": "^4.3.8"
38+
"zustand": "^4.3.8",
39+
"bignumber.js": "^9.0.1"
3940
},
4041
"devDependencies": {
4142
"@types/lodash.merge": "^4.6.9",

src/config/apolloConfig/apollo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { HttpLink } from 'apollo-link-http'
55

66
export const client = new ApolloClient({
77
link: new HttpLink({
8-
uri: process.env.NEXT_PUBLIC_UNISWAP_SUBGRAPH_URL ?? 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2',
8+
uri: process.env.NEXT_PUBLIC_UNISWAP_BASE_SUBGRAPH_URL ?? 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2',
99
}),
1010
cache: new InMemoryCache(),
1111
})

src/config/contractsTestnet.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ import {
2020
export const ROUTER_ABI = routerABI;
2121

2222
export const COIN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
23+
export const COIN_DECIMALS = 18;
24+
export const COIN_NAME = "ether";
25+
export const COIN_SYMBOL = "ETH";
26+
2327

2428
export const MULTICALL_ADDRESS = '0x091e99cb1C49331a94dD62755D168E941AbD0693';
2529

src/lib/constants/navigation.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ export const navLinks = [
77
label: 'Website',
88
href: '',
99
},
10+
{
11+
label: 'Swap',
12+
href: '/swap',
13+
},
1014
];
1115

1216
// Footer social links

src/lib/constants/wagmiConfig.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ const projectId = process.env.NEXT_PUBLIC_WALLETCONNECT_ID || '';
3030
* @description Default RPC endpoints with fallbacks
3131
*/
3232
const RPC_URLS = {
33+
BASE: [
34+
base.rpcUrls.default.http[0], // Default RPC
35+
'https://base-rpc.publicnode.com', // Public Node
36+
'https://base.llamarpc.com', // Llama
37+
],
3338
MAINNET: [
3439
mainnet.rpcUrls.default.http[0], // Default RPC
3540
'https://rpc.ankr.com/eth', // Ankr
@@ -40,11 +45,6 @@ const RPC_URLS = {
4045
'https://rpc.ankr.com/arbitrum', // Ankr
4146
'https://arbitrum.llamarpc.com', // Llama
4247
],
43-
BASE: [
44-
base.rpcUrls.default.http[0], // Default RPC
45-
'https://base-rpc.publicnode.com', // Public Node
46-
'https://base.llamarpc.com', // Llama
47-
],
4848
} as const;
4949

5050
/**

src/store/baseAssetsStore.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,37 @@ interface BaseAssetState {
1616
setBaseAsset: (token: Token) => void;
1717
};
1818
}
19-
const BASE_URL = process.env.NEXT_PUBLIC_UNISWAP_SUBGRAPH_URL ?? 'https://localhost:8000';
19+
const BASE_URL = process.env.NEXT_PUBLIC_UNISWAP_BASE_SUBGRAPH_URL ?? 'https://localhost:8000';
2020

2121
export const useBaseAssetStore = create<BaseAssetState>()(
2222
devtools((set, get) => ({
2323
baseAssets: [],
2424
isLoading: false,
2525
actions: {
2626
initBaseAssets: async () => {
27-
console.log(process.env.NEXT_PUBLIC_UNISWAP_SUBGRAPH_URL);
27+
console.log(process.env.NEXT_PUBLIC_UNISWAP_BASE_SUBGRAPH_URL);
2828
set({ isLoading: true });
2929
await fetchTokenData()
3030
.then(result => {
3131
let baseAssets = result?.data.tokens;
32-
console.log('Fetched tokens:', result);
32+
// baseAssets.add(CONTRACTS.COIN_ADDRESS);
33+
34+
console.log('Fetched tokens:', baseAssets);
3335
baseAssets = mapToken(baseAssets);
3436

37+
baseAssets.unshift(
38+
{
39+
address: CONTRACTS.COIN_ADDRESS,
40+
decimals: CONTRACTS.COIN_DECIMALS,
41+
name: CONTRACTS.COIN_NAME,
42+
symbol: CONTRACTS.COIN_SYMBOL,
43+
stable: false,
44+
price: 0,
45+
liquidStakedAddress: "",
46+
balance: 0.0,
47+
}
48+
);
49+
3550
set({ baseAssets });
3651
})
3752
.catch(error => console.log(error));

0 commit comments

Comments
 (0)