Skip to content

Commit

Permalink
Allow to customize the proxy URL
Browse files Browse the repository at this point in the history
  • Loading branch information
lcswillems committed Nov 30, 2024
1 parent be0af45 commit 911854f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions website/app/data-converter/pageClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { FaPlus, FaArrowLeft, FaArrowRight, FaArrowDown } from "react-icons/fa";
import { FaXmark } from "react-icons/fa6";
import { LuClipboard } from "react-icons/lu";
import { e, d, B64 } from "xsuite/data";
import { mainnetPublicProxyUrl } from "xsuite/dist/interact/envChain";

Check failure on line 35 in website/app/data-converter/pageClient.tsx

View workflow job for this annotation

GitHub Actions / build-and-test

Unable to resolve path to module 'xsuite/dist/interact/envChain'
import { Proxy } from "xsuite/proxy";

export default function PageClient() {
Expand All @@ -47,9 +48,10 @@ export default function PageClient() {
const DataConverter = () => {
const converters = useConverters();
const [address, setAddress] = useState("");
const [proxyUrl, setProxyUrl] = useState(mainnetPublicProxyUrl);
const query = useQuery({
queryKey: ["address", address],
queryFn: () => proxy.getSerializableAccount(address),
queryKey: ["proxyUrl", proxyUrl, "address", address],
queryFn: () => new Proxy(proxyUrl).getSerializableAccount(address),
});
const addressMainnetState = JSON.stringify(query.data, null, 2);

Expand Down Expand Up @@ -78,12 +80,19 @@ const DataConverter = () => {
))}
</Box>
<Box mb="8" />
<Heading>Get address mainnet state</Heading>
<Heading>Get address state</Heading>
<Box mb="8" />
<Input
placeholder="Address"
value={address}
onChange={(e) => setAddress(e.currentTarget.value)}
/>
<Box mb="4" />
<Input
placeholder="Proxy URL"
value={proxyUrl}
onChange={(e) => setProxyUrl(e.currentTarget.value)}
/>
<Box mb="8" />
<Clipboard.Root value={addressMainnetState}>
<Clipboard.Trigger asChild>
Expand Down Expand Up @@ -399,8 +408,6 @@ const genId = () => Math.random();

const queryClient = new QueryClient();

const proxy = Proxy.newMainnet();

const dataTypes = {
hex: "Hex",
base64: "Base64",
Expand Down

0 comments on commit 911854f

Please sign in to comment.