diff --git a/djed-sdk/src/constants.js b/djed-sdk/src/constants.js index 2b676f5..6bc8671 100644 --- a/djed-sdk/src/constants.js +++ b/djed-sdk/src/constants.js @@ -1,23 +1,50 @@ 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: 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: null, // Developers should provide their RPC endpoint + djedAddress: null, // DJED contract address for Mainnet + oracleAddress: null // Oracle contract address for Mainnet + } +}; + +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