Skip to content
Open
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: 9 additions & 2 deletions stablepay-sdk/src/core/Wallet.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { createWalletClient, custom } from 'viem';
import { mainnet, sepolia } from 'viem/chains';

export class Wallet {
constructor(chainId) {
this.chainId = chainId;
Expand Down Expand Up @@ -34,7 +37,11 @@ export class Wallet {
11155111: sepolia,
// Add other chains as needed
};
return chains[chainId];
const chain = chains[chainId];
if (!chain) {
throw new Error(`Unsupported chainId: ${chainId}`);
}
return chain;
}

async disconnect() {
Expand All @@ -49,4 +56,4 @@ export class Wallet {
getAccount() {
return this.account;
}
}
}