Skip to content

Commit 823e5d6

Browse files
authored
Merge pull request #59 from permaweb/chore/update-cu
chore: switch to cu router for defaults / af-cu for factory
2 parents 155a22f + c8effcb commit 823e5d6

File tree

5 files changed

+11
-124
lines changed

5 files changed

+11
-124
lines changed

src/api/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createDataItemSigner, message, result, results } from '@permaweb/aoconn
22

33
import { TagType } from 'helpers/types';
44
import { getTagValue } from 'helpers/utils';
5-
import { afCu } from 'providers/AOProvider';
5+
import { cu } from 'providers/AOProvider';
66

77
export async function messageResult(args: {
88
processId: string;
@@ -160,7 +160,7 @@ export async function readHandler(args: {
160160
const tags = [{ name: 'Action', value: args.action }];
161161
if (args.tags) tags.push(...args.tags);
162162

163-
const response = await afCu.dryrun({
163+
const response = await cu.dryrun({
164164
process: args.processId,
165165
tags: tags,
166166
data: JSON.stringify(args.data || {}),

src/providers/AOProvider.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ import { connect } from '@permaweb/aoconnect';
55

66
import { AO, AO_TOKEN_DENOMINATION, ENDPOINTS } from 'helpers/config';
77

8-
export const afCu = connect({
8+
export const cu = connect({
99
CU_URL: 'https://cu.ao-testnet.xyz',
1010
});
1111

12+
export const afCu = connect({
13+
CU_URL: 'https://cu-af.dataos.so',
14+
});
15+
1216
export const goldsky = new Client({
1317
url: ENDPOINTS.goldsky,
1418
exchanges: [cacheExchange, fetchExchange],

src/providers/EthereumProvider.tsx

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -256,38 +256,18 @@ export function EthereumProvider(props: EthereumProviderProps) {
256256
if (isNaN(totalUsdsDeposited)) throw new Error('Invalid totalUsdsDeposited');
257257

258258
const ethUsdFeed = new web3.eth.Contract(PRICE_FEED_ABI, ETH_CONTRACTS.ethUsdPriceFeed);
259-
// const daiUsdFeed = new web3.eth.Contract(PRICE_FEED_ABI, ETH_CONTRACTS.daiUsdPriceFeed);
260-
// const usdUsdSFeed = new web3.eth.Contract(PRICE_FEED_ABI, ETH_CONTRACTS.usdsUsdPriceFeed);
261259

262260
const ethUsdPriceData = await ethUsdFeed.methods.latestRoundData().call();
263-
// const daiUsdPriceData = await daiUsdFeed.methods.latestRoundData().call();
264261

265262
const ethUsdPrice = (ethUsdPriceData as any).answer / BigInt(Math.pow(10, 8));
266-
// const daiUsdPrice = (daiUsdPriceData as any).answer / BigInt(Math.pow(10, 8));
267263
const daiUsdPrice = 1;
268264
const usdsUsdPrice = 1;
269265

270-
// console.log('ethUsdPrice');
271-
// console.log(ethUsdPrice);
272-
// console.log('daiUsdPrice');
273-
// console.log(daiUsdPrice);
274-
// console.log('usdsUsdPrice')
275-
// console.log(usdsUsdPrice)
276-
277266
const usdStEthValue = BigInt(Math.floor(totalStEthDeposited)) * BigInt(ethUsdPrice);
278267
const usdDaiValue = BigInt(Math.floor(totalDaiDeposited)) * BigInt(daiUsdPrice);
279268
const usdUsdsValue = BigInt(Math.floor(totalUsdsDeposited)) * BigInt(usdsUsdPrice);
280269
const usdTotal = usdStEthValue + usdDaiValue + usdUsdsValue;
281270

282-
// console.log('usdStEthValue')
283-
// console.log(usdStEthValue)
284-
// console.log('usdDaiValue')
285-
// console.log(usdDaiValue)
286-
// console.log('usdUsdsValue')
287-
// console.log(usdUsdsValue)
288-
// console.log('usdTotal')
289-
// console.log(usdTotal)
290-
291271
setTotalDeposited({
292272
stEth: { value: totalStEthDeposited, display: formatDisplayAmount(totalStEthDeposited, 2) },
293273
dai: { value: totalDaiDeposited, display: formatDisplayAmount(totalDaiDeposited, 2) },
@@ -300,78 +280,6 @@ export function EthereumProvider(props: EthereumProviderProps) {
300280
})();
301281
}, []);
302282

303-
// async function sendMessage(msg, key) {
304-
// function createDataItemSigner(wallet) {
305-
// const signer = async ({ data, tags, target, anchor }) => {
306-
// const dataItem = createData(data, key, { tags, target, anchor });
307-
// return dataItem.sign(key).then(async () => ({
308-
// id: await dataItem.id,
309-
// raw: await dataItem.getRaw(),
310-
// }));
311-
// };
312-
313-
// return signer;
314-
// }
315-
316-
// const signer = createDataItemSigner(key);
317-
// const message = await connect().message({
318-
// process: AO_MINT,
319-
// signer,
320-
// data: msg.Data || Date.now().toString(),
321-
// tags: msg.Tags,
322-
// });
323-
// return await connect().result({ process: AO_MINT, message });
324-
// }
325-
326-
// const connector = config.connectors.find((c) => c.name === 'MetaMask');
327-
328-
// const provider = {
329-
// getSigner: () => ({
330-
// signMessage: async (message: any) => {
331-
// const arg = message instanceof String ? message : { raw: message };
332-
333-
// const ethAccount = getAccount(config);
334-
335-
// return await signMessage(config, {
336-
// message: arg as any,
337-
// account: ethAccount.address,
338-
// connector: connector,
339-
// });
340-
// },
341-
// }),
342-
// };
343-
344-
// const signer = new InjectedEthereumSigner(provider as any);
345-
// signer.setPublicKey = async () => {
346-
// const message = 'Sign this message to connect';
347-
// const ethAccount = getAccount(config);
348-
349-
// const signature = await signMessage(config, {
350-
// message: message,
351-
// account: ethAccount.address,
352-
// connector: connector,
353-
// });
354-
// const hash = await hashMessage(message);
355-
// const recoveredKey = await recoverPublicKey({
356-
// hash,
357-
// signature,
358-
// });
359-
// signer.publicKey = Buffer.from(toBytes(recoveredKey));
360-
// };
361-
362-
// React.useEffect(() => {
363-
// (async function () {
364-
// await signer.setPublicKey();
365-
// const TResult = await sendMessage({
366-
// Tags: [
367-
// { name: 'Action', value: 'User.Get-Tokens' },
368-
// // { name: 'Token', value: 'DAI' },
369-
// ],
370-
// }, signer);
371-
// console.log('SendMessage Result:', TResult);
372-
// })();
373-
// }, []);
374-
375283
/* StETH - DAI Balance and Deposited */
376284
React.useEffect(() => {
377285
(async function () {

src/views/Fund/Dashboard/index.tsx

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { useStore } from '@nanostores/react';
22
import { useQuery } from '@tanstack/react-query';
33
import { readHandler } from 'api';
4-
import React, { useEffect, useMemo, useState } from 'react';
4+
import { useEffect, useMemo, useState } from 'react';
55
import { ReactSVG } from 'react-svg';
66
import styled from 'styled-components';
77

88
import Modal from 'components/molecules/Modal/Modal';
99
import { AO, ASSETS, STYLING } from 'helpers/config';
1010
import { formatNumberAuto, formatTicker, parseBigIntAsNumber } from 'helpers/format';
1111
import { retryable } from 'helpers/network';
12-
import { formatAddress, formatDate } from 'helpers/utils';
12+
import { formatAddress } from 'helpers/utils';
1313
import { useArweaveProvider } from 'providers/ArweaveProvider';
1414

1515
import { getFlps, getUserDelegations } from '../../../api/fair-launch-api';
@@ -20,7 +20,6 @@ import { Skeleton } from '../components/LoadingSkeletons';
2020
import { MyFlpTableRow } from '../components/MyFlpTableRow';
2121
import { PiFavicon } from '../components/PiFavicon';
2222
import { TokenAvatar } from '../components/TokenAvatar';
23-
import { TrendChart } from '../components/TrendChart';
2423
import * as S from '../styles';
2524

2625
const DashboardContainer = styled.div`
@@ -29,29 +28,6 @@ const DashboardContainer = styled.div`
2928
gap: 40px;
3029
`;
3130

32-
const mockDelegationRecords = [
33-
{ timestamp: 1622505600000, value: 10 },
34-
{ timestamp: 1625097600000, value: 200 },
35-
{ timestamp: 1627776000000, value: 300 },
36-
{ timestamp: 1630454400000, value: 400 },
37-
{ timestamp: 1633046400000, value: 500 },
38-
];
39-
40-
const chartData = {
41-
labels: mockDelegationRecords.map((record) => formatDate(record.timestamp, 'dateString')),
42-
datasets: [
43-
{
44-
data: mockDelegationRecords.map((record) => record.value),
45-
borderColor: '#0DBD27',
46-
backgroundColor: '#0DBD2733',
47-
fill: true,
48-
tension: 0.4,
49-
pointRadius: 0,
50-
borderWidth: 1,
51-
},
52-
],
53-
};
54-
5531
export default function DashboardPage() {
5632
const { data: allFlps } = useQuery({
5733
queryKey: ['allFlps'],
@@ -164,7 +140,6 @@ export default function DashboardPage() {
164140
<TokenAvatar logo={ASSETS.pi} size="xl" />
165141
</S.StatValue>
166142
</div>
167-
{/* <TrendChart height={150} width={500} data={chartData} isLoading={!allFlps} /> */}
168143
</S.StatCard>
169144
)}
170145

@@ -291,7 +266,7 @@ export default function DashboardPage() {
291266
{!arProvider.walletAddress ? (
292267
<S.SectionTitle style={{ margin: 'auto' }}>Connect wallet to view your delegations.</S.SectionTitle>
293268
) : isLoading ? (
294-
<div>
269+
<div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
295270
{isTablet ? (
296271
[1, 2, 3].map((i) => (
297272
<div

src/views/Fund/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useQuery } from '@tanstack/react-query';
2-
import React, { useEffect, useMemo, useState } from 'react';
2+
import { useEffect, useMemo, useState } from 'react';
33
import { ReactSVG } from 'react-svg';
44

55
import { AO, ASSETS, STYLING } from 'helpers/config';

0 commit comments

Comments
 (0)