Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmaayan committed Apr 29, 2024
1 parent bb530e3 commit c8bde46
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion apps/nextjs-example/components/AlertProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const AlertProvider: FC<{ children: ReactNode }> = ({ children }) => {
const setSuccessAlertHash = useCallback(
(hash: string, network: NetworkInfo | null) => {
if (isAptosNetwork(network)) {
const explorerLink = `https://explorer.aptoslabs.com/txn/${hash}${network?.name ? `?network=${network.name.toLowerCase()}` : ""}`;
const explorerLink = `https://explorer.aptoslabs.com/txn/${hash}${network?.name ? `?network=${network.name}` : ""}`;
return setSuccessAlertMessage(
<>
View on Explorer:{" "}
Expand Down
8 changes: 4 additions & 4 deletions apps/nextjs-example/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ const WalletSelectorAntDesign = dynamic(
}
);

const isSendableNetwork = (connected: boolean, network?: string): boolean => {
return connected && !isMainnet(connected, network);
const isSendableNetwork = (connected: boolean): boolean => {
return connected && !isMainnet(connected);
};

const isMainnet = (connected: boolean, network?: string): boolean => {
return connected && network?.toLowerCase() === Network.MAINNET.toLowerCase();
const isMainnet = (connected: boolean, networkName?: string): boolean => {
return connected && networkName === Network.MAINNET;
};

export default function App() {
Expand Down
6 changes: 3 additions & 3 deletions apps/nextjs-example/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
import { NetworkInfo } from "@aptos-labs/wallet-adapter-core";

export const aptosClient = (network?: NetworkInfo | null) => {
if (network?.name.toLowerCase() === Network.DEVNET.toLowerCase()) {
if (network?.name === Network.DEVNET) {
return DEVNET_CLIENT;
} else if (network?.name.toLowerCase() === Network.TESTNET.toLowerCase()) {
} else if (network?.name === Network.TESTNET) {
return TESTNET_CLIENT;
} else if (network?.name.toLowerCase() === Network.MAINNET.toLowerCase()) {
} else if (network?.name === Network.MAINNET) {
throw new Error("Please use devnet or testnet for testing");
} else {
const CUSTOM_CONFIG = new AptosConfig({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { NetworkInfo } from "./types";
export function convertNetwork(
networkInfo: NetworkInfo | StandardNetworkInfo | null
): Network {
switch (networkInfo?.name.toLowerCase()) {
switch (networkInfo?.name) {
case "mainnet" as Network:
return Network.MAINNET;
case "testnet" as Network:
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet-adapter-core/src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,5 @@ export const isAptosNetwork = (
if (!networkInfo) {
throw new Error("Undefined network");
}
return NetworkToNodeAPI[networkInfo.name] ? true : false;
return NetworkToNodeAPI[networkInfo.name] !== undefined;
};

0 comments on commit c8bde46

Please # to comment.