Update poly_merger configuration and documentation

- Update RPC endpoint from llamarpc to polygon-rpc.com for better reliability
- Improve .env file loading to check both local and parent directory
- Update README example to use proper condition_id format (0x...) instead of numeric
- Clarify that condition_id should be hex format in documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
warproxxx
2025-06-22 10:37:08 -07:00
co-authored by Claude
parent 652e330424
commit a3ba8b7fca
2 changed files with 8 additions and 4 deletions
+2 -2
View File
@@ -20,10 +20,10 @@ node merge.js [amount_to_merge] [condition_id] [is_neg_risk_market]
Example: Example:
``` ```
node merge.js 1000000 1234567 true node merge.js 1000000 0xasdasda true
``` ```
This would merge 1 USDC worth of opposing positions in market 1234567, which is a negative risk market. This would merge 1 USDC worth of opposing positions in market 0xasdasda, which is a negative risk market. 0xasdasda should be condition_id
## Prerequisites ## Prerequisites
+6 -2
View File
@@ -15,14 +15,18 @@
const { ethers } = require('ethers'); const { ethers } = require('ethers');
const { resolve } = require('path'); const { resolve } = require('path');
const { existsSync } = require('fs');
const { signAndExecuteSafeTransaction } = require('./safe-helpers'); const { signAndExecuteSafeTransaction } = require('./safe-helpers');
const { safeAbi } = require('./safeAbi'); const { safeAbi } = require('./safeAbi');
// Load environment variables // Load environment variables
require('dotenv').config() const localEnvPath = resolve(__dirname, '.env');
const parentEnvPath = resolve(__dirname, '../.env');
const envPath = existsSync(localEnvPath) ? localEnvPath : parentEnvPath;
require('dotenv').config({ path: envPath })
// Connect to Polygon network // Connect to Polygon network
const provider = new ethers.providers.JsonRpcProvider("https://polygon.llamarpc.com"); const provider = new ethers.providers.JsonRpcProvider("https://polygon-rpc.com");
const privateKey = process.env.PK; const privateKey = process.env.PK;
const wallet = new ethers.Wallet(privateKey, provider); const wallet = new ethers.Wallet(privateKey, provider);