From 440e87974193a76618e0bd17c78a2f3fe2892f34 Mon Sep 17 00:00:00 2001 From: RaviChauhan <1chauhanravi0@gmail.com> Date: Wed, 11 Mar 2026 18:53:18 +0530 Subject: [PATCH 1/2] feat: enhance Djed-SDK by shipping pre-configured network variables --- djed-sdk/src/constants.js | 54 +++++++++++++++++++++++++++++---------- djed-sdk/src/index.js | 3 +++ 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/djed-sdk/src/constants.js b/djed-sdk/src/constants.js index 2b676f5..e9b7a32 100644 --- a/djed-sdk/src/constants.js +++ b/djed-sdk/src/constants.js @@ -1,23 +1,49 @@ export const BC_DECIMALS = 18; export const SCALING_DECIMALS = 24; export const TRANSACTION_USD_LIMIT = 10000; -export const FEE_UI=0.01; +export const FEE_UI = 0.01; export const REFRESH_PERIOD = 4000; export const CONFIRMATION_WAIT_PERIOD = REFRESH_PERIOD + 1000; export const TRANSACTION_VALIDITY = { - OK: "Transaction is valid.", - WALLET_NOT_CONNECTED: "Wallet not connected", - WRONG_NETWORK: "Wallet connected to the wrong network", - NONNUMERIC_INPUT: "Amount has to be a number", - NEGATIVE_INPUT: "Amount cannot be negative", - ZERO_INPUT: "Amount cannot be zero", - INSUFFICIENT_BC: "Insufficient balance", - INSUFFICIENT_SC: "Insufficient StableCoin balance", - INSUFFICIENT_RC: "Insufficient ReserveCoin balance", - RESERVE_RATIO_LOW: "Reserve ratio would drop below the minimum", - RESERVE_RATIO_HIGH: "Reserve ratio would rise above the maximum", - TRANSACTION_LIMIT_REACHED: "Transaction limit reached" - }; + OK: "Transaction is valid.", + WALLET_NOT_CONNECTED: "Wallet not connected", + WRONG_NETWORK: "Wallet connected to the wrong network", + NONNUMERIC_INPUT: "Amount has to be a number", + NEGATIVE_INPUT: "Amount cannot be negative", + ZERO_INPUT: "Amount cannot be zero", + INSUFFICIENT_BC: "Insufficient balance", + INSUFFICIENT_SC: "Insufficient StableCoin balance", + INSUFFICIENT_RC: "Insufficient ReserveCoin balance", + RESERVE_RATIO_LOW: "Reserve ratio would drop below the minimum", + RESERVE_RATIO_HIGH: "Reserve ratio would rise above the maximum", + TRANSACTION_LIMIT_REACHED: "Transaction limit reached" +}; +export const NETWORKS = { + sepolia: { + name: "Sepolia", + chainId: 11155111, + rpcUrl: "https://sepolia.infura.io/v3/", + djedAddress: "0xSEPOLIA_DJED_ADDRESS", + oracleAddress: "0xSEPOLIA_ORACLE_ADDRESS" + }, + mainnet: { + name: "Ethereum Mainnet", + chainId: 1, + rpcUrl: "https://mainnet.infura.io/v3/", + djedAddress: "0xMAINNET_DJED_ADDRESS", + oracleAddress: "0xMAINNET_ORACLE_ADDRESS" + } +}; + +export const getNetworkConfig = (networkName = "sepolia") => { + const config = NETWORKS[networkName]; + + if (!config) { + throw new Error(`Unsupported network: ${networkName}`); + } + + return config; +}; \ No newline at end of file diff --git a/djed-sdk/src/index.js b/djed-sdk/src/index.js index 9c2cbc2..71844a4 100644 --- a/djed-sdk/src/index.js +++ b/djed-sdk/src/index.js @@ -1,4 +1,5 @@ export { getWeb3 } from "./web3"; + export { calculateBcUsdEquivalent, calculateRcUsdEquivalent, @@ -9,3 +10,5 @@ export { export * from "./djed/index"; export * from "./oracle"; + +export * from "./constants"; \ No newline at end of file From a4f72508629dfe20a2c4507dfa8712dcd2ec2c2a Mon Sep 17 00:00:00 2001 From: RaviChauhan <1chauhanravi0@gmail.com> Date: Wed, 11 Mar 2026 19:15:02 +0530 Subject: [PATCH 2/2] fix: remove placeholder addresses from network configuration --- djed-sdk/src/constants.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/djed-sdk/src/constants.js b/djed-sdk/src/constants.js index e9b7a32..6bc8671 100644 --- a/djed-sdk/src/constants.js +++ b/djed-sdk/src/constants.js @@ -25,16 +25,17 @@ export const NETWORKS = { sepolia: { name: "Sepolia", chainId: 11155111, - rpcUrl: "https://sepolia.infura.io/v3/", - djedAddress: "0xSEPOLIA_DJED_ADDRESS", - oracleAddress: "0xSEPOLIA_ORACLE_ADDRESS" + rpcUrl: null, // Developers should provide their RPC endpoint + djedAddress: null, // DJED contract address for Sepolia + oracleAddress: null // Oracle contract address for Sepolia }, + mainnet: { name: "Ethereum Mainnet", chainId: 1, - rpcUrl: "https://mainnet.infura.io/v3/", - djedAddress: "0xMAINNET_DJED_ADDRESS", - oracleAddress: "0xMAINNET_ORACLE_ADDRESS" + rpcUrl: null, // Developers should provide their RPC endpoint + djedAddress: null, // DJED contract address for Mainnet + oracleAddress: null // Oracle contract address for Mainnet } };