diff --git a/.env.sample b/.env.sample index ab48665..018a382 100644 --- a/.env.sample +++ b/.env.sample @@ -3,8 +3,9 @@ VITE_RPC_URL="" VITE_API_BASE_URL="https://florin.bitcoinos.build" VITE_EXPIRATION_HOURS=24 VITE_MIN_AMOUNT="0.0004" -VITE_MAX_AMOUT="3" +VITE_MAX_AMOUNT="3" VITE_EVM_CONFIRMATIONS_LOW=1 VITE_EVM_CONFIRMATIONS_HIGH=10 VITE_EVM_CONFIRMATIONS_USD_AMOUNT=100 -VITE_BTC_CONFIRMATIONS=6 \ No newline at end of file +VITE_BTC_CONFIRMATIONS=6 +VITE_DEFAULT_POSITION_ID= \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b92e82c..6d23bbf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,7 @@ jobs: VITE_EVM_CONFIRMATIONS_HIGH: ${{ secrets.VITE_EVM_CONFIRMATIONS_HIGH }} VITE_EVM_CONFIRMATIONS_USD_AMOUNT: ${{ secrets.VITE_EVM_CONFIRMATIONS_USD_AMOUNT }} VITE_BTC_CONFIRMATIONS: ${{ secrets.VITE_BTC_CONFIRMATIONS }} + VITE_DEFAULT_POSITION_ID: ${{ secrets.VITE_DEFAULT_POSITION_ID }} - name: Build run: npm run build @@ -54,4 +55,5 @@ jobs: VITE_EVM_CONFIRMATIONS_LOW: ${{ secrets.VITE_EVM_CONFIRMATIONS_LOW }} VITE_EVM_CONFIRMATIONS_HIGH: ${{ secrets.VITE_EVM_CONFIRMATIONS_HIGH }} VITE_EVM_CONFIRMATIONS_USD_AMOUNT: ${{ secrets.VITE_EVM_CONFIRMATIONS_USD_AMOUNT }} - VITE_BTC_CONFIRMATIONS: ${{ secrets.VITE_BTC_CONFIRMATIONS }} \ No newline at end of file + VITE_BTC_CONFIRMATIONS: ${{ secrets.VITE_BTC_CONFIRMATIONS }} + VITE_DEFAULT_POSITION_ID: ${{ secrets.VITE_DEFAULT_POSITION_ID }} \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ee611ed..bebd886 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -42,6 +42,7 @@ jobs: VITE_EVM_CONFIRMATIONS_HIGH: ${{ secrets.VITE_EVM_CONFIRMATIONS_HIGH }} VITE_EVM_CONFIRMATIONS_USD_AMOUNT: ${{ secrets.VITE_EVM_CONFIRMATIONS_USD_AMOUNT }} VITE_BTC_CONFIRMATIONS: ${{ secrets.VITE_BTC_CONFIRMATIONS }} + VITE_DEFAULT_POSITION_ID: ${{ secrets.VITE_DEFAULT_POSITION_ID }} - name: Deploy to Netlify run: | DEPLOY_COMMAND="netlify deploy \ diff --git a/README.md b/README.md index 701807e..e84cc22 100644 --- a/README.md +++ b/README.md @@ -64,12 +64,53 @@ yarn preview The application uses environment variables for configuration. Create a `.env` file in the root directory with the following variables: ```env +# WalletConnect project ID for wallet connection functionality VITE_WALLETCONNECT_PROJECT_ID="" + +# RPC URL for connecting to the Ethereum network VITE_RPC_URL="" -VITE_API_BASE_URL="" + +# Base URL for the Florin API endpoints +VITE_API_BASE_URL="https://florin.bitcoinos.build" + +# Number of hours until a transaction expires VITE_EXPIRATION_HOURS=24 + +# Minimum amount allowed for transactions (in BTC) +VITE_MIN_AMOUNT="0.0004" + +# Maximum amount allowed for transactions (in BTC) +VITE_MAX_AMOUNT="3" + +# Number of confirmations required for low-value related to VITE_EVM_CONFIRMATIONS_USD_AMOUNT EVM transactions +VITE_EVM_CONFIRMATIONS_LOW=1 + +# Number of confirmations required for high-value EVM transactions +VITE_EVM_CONFIRMATIONS_HIGH=10 + +# USD amount threshold that determines when to use high confirmations +VITE_EVM_CONFIRMATIONS_USD_AMOUNT=100 + +# Number of confirmations required for Bitcoin transactions +VITE_BTC_CONFIRMATIONS=6 + +# Default position id for reservation +VITE_DEFAULT_POSITION_ID= ``` +## Contract Addresses Configuration +The application uses different contract addresses for different networks. These addresses are configured in `src/constants/contracts.ts`. To modify the contract addresses: + +1. Navigate to `src/constants/contracts.ts` +2. Update the addresses in the `CONTRACTS_ADDRESS` object for the desired network: + - `ammExchange`: AMM Exchange contract address + - `marketMakerProxy`: Market Maker Proxy contract address + - `florinForwarder`: Florin Forwarder contract address + - `erc20BitSnark`: ERC20 BitSnark token contract address + - `contractRegistry`: Contract Registry address + +The file supports multiple networks, Sepolia testnet (chain ID: 11155111) and local development (chain ID: 31337). + ## Main Scripts - `npm run dev` - Start development server - `npm run build` - Create production build diff --git a/src/config/env.ts b/src/config/env.ts index b5895d9..10f7d14 100644 --- a/src/config/env.ts +++ b/src/config/env.ts @@ -31,7 +31,10 @@ const envSchema = z.object({ }), VITE_BTC_CONFIRMATIONS: z.string().transform((val) => Number(val)).refine((val) => val > 0, { message: 'VITE_BTC_CONFIRMATIONS must be greater than 0', - }) + }), + VITE_DEFAULT_POSITION_ID: z.string().min(1, { + message: 'VITE_DEFAULT_POSITION_ID is required', + }), }); const parsed = envSchema.safeParse(import.meta.env); diff --git a/src/constants/index.ts b/src/constants/index.ts index 92b40b4..e3fce42 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -1,6 +1,7 @@ +import { env } from "@/config/env"; import { PositionStatus, ReservationStatus } from "@/types"; -export const DEFAULT_POSITION_ID = '0xf0e94d3b55389b66f693bf6a4ae0eec46a1e61342c9efeaa96ba6ada1d555ca2'; +export const DEFAULT_POSITION_ID = env.VITE_DEFAULT_POSITION_ID; export const ETHERSCAN_URL = 'https://sepolia.etherscan.io'; export const BITCOIN_TESTNET_URL = 'https://mempool.space/testnet4';