Skip to content
Open
Show file tree
Hide file tree
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
55 changes: 41 additions & 14 deletions djed-sdk/src/constants.js
Original file line number Diff line number Diff line change
@@ -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
}
};
Comment thread
coderabbitai[bot] marked this conversation as resolved.

export const getNetworkConfig = (networkName = "sepolia") => {
const config = NETWORKS[networkName];

if (!config) {
throw new Error(`Unsupported network: ${networkName}`);
}

return config;
};
3 changes: 3 additions & 0 deletions djed-sdk/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { getWeb3 } from "./web3";

export {
calculateBcUsdEquivalent,
calculateRcUsdEquivalent,
Expand All @@ -9,3 +10,5 @@ export {

export * from "./djed/index";
export * from "./oracle";

export * from "./constants";