pmarket-cli
Version:
CLI tool to trade on Polymarket
36 lines • 1.63 kB
JavaScript
export class InitStrategy {
configService;
constructor(configService) {
this.configService = configService;
}
async execute(options) {
const privateKey = options.init;
if (!privateKey) {
console.log('Please provide a private key: pmarket-cli -i <your-private-key>');
return;
}
// Normalize the private key (add 0x prefix if missing)
const normalizedKey = privateKey.startsWith('0x') ? privateKey : `0x${privateKey}`;
const result = this.configService.savePrivateKey(normalizedKey);
if (result.success) {
console.log('Configuration saved successfully!');
console.log('');
console.log('Wallet address:', result.address);
console.log('Config file:', this.configService.getConfigPath());
console.log('');
console.log('Next steps:');
console.log(' 1. Fund your wallet with MATIC (for gas) and USDC.e (for trading)');
console.log(' IMPORTANT: Use USDC.e (bridged USDC at 0x2791...), NOT native USDC!');
console.log(' 2. Set USDC allowance: pmarket-cli -a 500');
console.log(' 3. Refresh market cache: pmarket-cli -r');
console.log(' 4. List markets: pmarket-cli -l "Bitcoin"');
}
else {
console.error('Error:', result.error);
console.log('');
console.log('Make sure you provide a valid Ethereum private key.');
console.log('Example: pmarket-cli -i 0x1234567890abcdef...');
}
}
}
//# sourceMappingURL=init-strategy.js.map