Skip to content

Commit

Permalink
added default pair env
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor committed Jan 26, 2024
1 parent 0769c94 commit 98894c2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
NEXT_PUBLIC_NETWORK=stokenet # Options: mainnet or stokenet
NEXT_PUBLIC_DAPP_DEFINITION_ADDRESS=account_tdx_2_129kev9w27tsl7qjg0dlyze70kxnlzycs8v2c85kzec40gg8mt73f7y
NEXT_PUBLIC_DAPP_DEFINITION_ADDRESS=account_tdx_2_129kev9w27tsl7qjg0dlyze70kxnlzycs8v2c85kzec40gg8mt73f7y
NEXT_PUBLIC_DEFAULT_PAIR_ADDRESS=
12 changes: 10 additions & 2 deletions src/app/components/PairSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useAppSelector, useAppDispatch } from "../hooks";
import { selectPairAddress } from "../state/pairSelectorSlice";
import { orderInputSlice } from "../state/orderInputSlice";
import { useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";

interface PairInfo {
name: string;
address: string;
}
function displayName(name?: string) {
return name?.replace("/", " - ");
return name?.replace("/", " - ").toUpperCase();
}

export function PairSelector() {
Expand All @@ -18,6 +18,14 @@ export function PairSelector() {
const options = pairSelector.pairsList;
const id = "pairOption";

useEffect(() => {
if (process.env.NEXT_PUBLIC_DEFAULT_PAIR_ADDRESS != "") {
dispatch(
selectPairAddress(process.env.NEXT_PUBLIC_DEFAULT_PAIR_ADDRESS || "")
);
}
}, [dispatch]);

const handleChange = (val: PairInfo | null) => {
if (val == null) return;

Expand Down

0 comments on commit 98894c2

Please sign in to comment.