Skip to content
Merged
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
11 changes: 10 additions & 1 deletion contexts/stellar-wallet-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ import {
FREIGHTER_ID,
} from "@creit.tech/stellar-wallets-kit";

const network =
process.env.NEXT_PUBLIC_STELLAR_NETWORK === "pubnet"
? WalletNetwork.PUBLIC
: WalletNetwork.TESTNET;

interface StellarWalletContextType {
kit: StellarWalletsKit;
address: string | null;
publicKey: string | null;
isConnected: boolean;
Expand All @@ -26,6 +32,7 @@ interface StellarWalletContextType {
isLoading: boolean;
isConnecting: boolean;
error: string | null;
network: WalletNetwork;
}

const StellarWalletContext = createContext<
Expand All @@ -52,7 +59,7 @@ export function StellarWalletProvider({ children }: { children: ReactNode }) {
() =>
new StellarWalletsKit({
selectedWalletId: FREIGHTER_ID,
network: WalletNetwork.TESTNET,
network,
modules: allowAllModules(),
})
);
Expand Down Expand Up @@ -143,6 +150,7 @@ export function StellarWalletProvider({ children }: { children: ReactNode }) {
return (
<StellarWalletContext.Provider
value={{
kit,
address: publicKey,
publicKey,
isConnected,
Expand All @@ -152,6 +160,7 @@ export function StellarWalletProvider({ children }: { children: ReactNode }) {
isLoading: isConnecting,
isConnecting,
error,
network,
}}
>
{children}
Expand Down
Loading