From 46ceb08e1f50a4957abcf1004a6415b479217e9b Mon Sep 17 00:00:00 2001 From: Aniket Date: Tue, 27 Jan 2026 17:27:20 +0530 Subject: [PATCH 1/2] Import wallet client and chains from viem --- stablepay-sdk/src/core/Wallet.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stablepay-sdk/src/core/Wallet.js b/stablepay-sdk/src/core/Wallet.js index 0c666ef..5c728d3 100644 --- a/stablepay-sdk/src/core/Wallet.js +++ b/stablepay-sdk/src/core/Wallet.js @@ -1,3 +1,6 @@ +import { createWalletClient, custom } from 'viem'; +import { mainnet, sepolia } from 'viem/chains'; + export class Wallet { constructor(chainId) { this.chainId = chainId; @@ -49,4 +52,4 @@ export class Wallet { getAccount() { return this.account; } -} \ No newline at end of file +} From c2bf80fb7eb53892874da5f2260b887cde1b9a2e Mon Sep 17 00:00:00 2001 From: Aniket Date: Tue, 27 Jan 2026 17:41:07 +0530 Subject: [PATCH 2/2] Implement error handling for unsupported chain IDs Add error handling for unsupported chain IDs in Wallet.js --- stablepay-sdk/src/core/Wallet.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stablepay-sdk/src/core/Wallet.js b/stablepay-sdk/src/core/Wallet.js index 5c728d3..f4a410a 100644 --- a/stablepay-sdk/src/core/Wallet.js +++ b/stablepay-sdk/src/core/Wallet.js @@ -37,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() {