Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { PoolTypeButton } from "./PoolTypeButton";
import { type SupportedPoolTypes, poolTypeMap } from "~~/utils/constants";

export function ChooseType() {
const poolTypes = Object.keys(poolTypeMap).slice(0, 4) as SupportedPoolTypes[];
const poolTypes = Object.keys(poolTypeMap).slice(0, 3) as SupportedPoolTypes[];

return (
<>
<div className="flex flex-col justify-center h-full gap-10 mt-10">
<div className="text-xl">Choose a pool type:</div>
<div className="grid grid-cols-2 gap-4 ">
<div className="grid grid-cols-3 gap-4 ">
{poolTypes.map((type: SupportedPoolTypes) => (
<PoolTypeButton key={type} selectedPoolType={type} />
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ export function ChooseTokenAmount({ index, tokenConfig }: { index: number; token
const { poolSpotPrice } = useEclpSpotPrice();

const handleAmountChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const referenceAmount = Number(e.target.value.trim());
if (referenceAmount >= 0) {
if (Number(e.target.value) >= 0) {
if (poolType === PoolType.GyroE) {
// app forces tokens to be sorted before offering init amounts inputs
const isReferenceAmountForTokenA = index === 0;
Expand All @@ -70,13 +69,14 @@ export function ChooseTokenAmount({ index, tokenConfig }: { index: number; token
});
if (!initAmountsRatio) return;

const referenceAmount = Number(e.target.value);
const otherTokenAmount = isReferenceAmountForTokenA
? referenceAmount / initAmountsRatio // If entering tokenA, divide to get tokenB amount
: referenceAmount * initAmountsRatio; // If entering tokenB, multiply to get tokenA amount

updateTokenConfig(otherIndex, { amount: Math.abs(otherTokenAmount).toString() });
}
updateTokenConfig(index, { amount: referenceAmount.toString() });
updateTokenConfig(index, { amount: e.target.value });
} else {
updateTokenConfig(index, { amount: "" });
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/hooks/hyperliquid/useIsHyperEvm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { usePublicClient } from "wagmi";
export const useIsHyperEvm = () => {
const publicClient = usePublicClient();

return publicClient?.chain.id === ChainId.HYPER_EVM;
return publicClient?.chain.id === ChainId.HYPEREVM;
};
2 changes: 1 addition & 1 deletion packages/nextjs/hooks/hyperliquid/useIsUsingBigBlocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const useIsUsingBigBlocks = () => {
queryKey: ["isUsingBigBlocks", publicClient?.chain.id, address],
queryFn: async () => {
if (!publicClient || !address) return false;
if (publicClient.chain.id !== ChainId.HYPER_EVM) return false;
if (publicClient.chain.id !== ChainId.HYPEREVM) return false;

const isUsingBigBlocks: boolean = await publicClient.transport.request({
method: "eth_usingBigBlocks",
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"@balancer-labs/balancer-maths": "^0.0.25",
"@balancer/sdk": "4.4.0",
"@balancer/sdk": "4.8.0",
"@heroicons/react": "^2.0.11",
"@nktkas/hyperliquid": "^0.23.1",
"@rainbow-me/rainbowkit": "2.1.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/nextjs/scaffold.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { hyperEVM } from "./utils/constants";
import { hyperEVM, plasma } from "./utils/constants";
import * as chains from "viem/chains";

export type ScaffoldConfig = {
Expand All @@ -24,6 +24,7 @@ const scaffoldConfig = {
chains.optimism,
chains.sonic,
hyperEVM,
plasma,
],

// If using chains.foundry as your targetNetwork, you must specify a network to fork
Expand Down
29 changes: 29 additions & 0 deletions packages/nextjs/utils/constants/customChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,32 @@ export const hyperEVM = /*#__PURE__*/ defineChain({
},
testnet: false,
});

export const plasma = /*#__PURE__*/ defineChain({
id: 9745,
name: "Plasma",
nativeCurrency: {
name: "XPL",
symbol: "XPL",
decimals: 18,
},
rpcUrls: {
default: {
http: ["https://rpc.plasma.to/"],
webSocket: ["wss://rpc.plasma.to/"],
},
},
blockExplorers: {
default: {
name: "Plasma Explorer",
url: "https://plasmascan.to/",
apiUrl: "https://api.routescan.io/v2/network/mainnet/evm/9745/etherscan/api?",
},
},
contracts: {
multicall3: {
address: "0xcA11bde05977b3631167028862bE2a173976CA11",
blockCreated: 1,
},
},
});
6 changes: 5 additions & 1 deletion packages/nextjs/utils/scaffold-eth/networks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// import { hyperEVM } from "../constants";
import { hyperEVM } from "../constants";
import { hyperEVM, plasma } from "../constants";
import * as chains from "viem/chains";
import scaffoldConfig from "~~/scaffold.config";

Expand Down Expand Up @@ -145,6 +145,10 @@ export const NETWORKS_EXTRA_DATA: Record<string, ChainAttributes> = {
export function getBlockExplorerTxLink(chainId: number | undefined, txnHash: string | undefined) {
if (!chainId || !txnHash) return undefined;

if (chainId === plasma.id) {
return `https://plasmascan.to/tx/${txnHash}`;
}

const chainNames = Object.keys(chains);

const targetChainArr = chainNames.filter(chainName => {
Expand Down
13 changes: 11 additions & 2 deletions packages/nextjs/utils/supportedNetworks.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { hyperEVM } from "./constants";
import { hyperEVM, plasma } from "./constants";
import * as chains from "viem/chains";

export const supportedNetworks = {
balancerV3: [chains.mainnet, chains.arbitrum, chains.base, hyperEVM, chains.gnosis, chains.avalanche, chains.sepolia],
balancerV3: [
chains.mainnet,
chains.arbitrum,
chains.base,
chains.gnosis,
chains.avalanche,
hyperEVM,
plasma,
chains.sepolia,
],
beets: [chains.sonic, chains.optimism],
cowAmm: [chains.mainnet, chains.arbitrum, chains.base, chains.gnosis, chains.sepolia],
};
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,16 @@ __metadata:
languageName: node
linkType: hard

"@balancer/sdk@npm:4.4.0":
version: 4.4.0
resolution: "@balancer/sdk@npm:4.4.0"
"@balancer/sdk@npm:4.8.0":
version: 4.8.0
resolution: "@balancer/sdk@npm:4.8.0"
dependencies:
"@balancer-labs/balancer-maths": 0.0.27
"@types/big.js": 6.2.2
big.js: 6.2.2
decimal.js-light: 2.5.1
viem: 2.27.0
checksum: 0cc3d4cd67c225d5f1cbbe72398976d921d59e52462d27933a7eb76c02fbc11f62c8efd17321ce81c0571c880359c6178f4c14b23b6cbd0467ad36b0fd90e639
checksum: fa4f4540af1a96f1dd7cb1bd495d3e8980e0f0f3427bcb45801d2700b66600681385fd3653107c6fab193b400d5941ed3b6315f0a478e644d62a217fad222c07
languageName: node
linkType: hard

Expand Down Expand Up @@ -1465,7 +1465,7 @@ __metadata:
resolution: "@se-2/nextjs@workspace:packages/nextjs"
dependencies:
"@balancer-labs/balancer-maths": ^0.0.25
"@balancer/sdk": 4.4.0
"@balancer/sdk": 4.8.0
"@heroicons/react": ^2.0.11
"@nktkas/hyperliquid": ^0.23.1
"@rainbow-me/rainbowkit": 2.1.2
Expand Down