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
2 changes: 1 addition & 1 deletion src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub const RPC_URL: &str = "https://polygon.drpc.org";

fn parse_signature_type(s: &str) -> SignatureType {
match s {
config::DEFAULT_SIGNATURE_TYPE => SignatureType::Proxy,
"proxy" => SignatureType::Proxy,
"gnosis-safe" => SignatureType::GnosisSafe,
_ => SignatureType::Eoa,
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::str::FromStr;
use anyhow::{Context, Result};
use polymarket_client_sdk::auth::{LocalSigner, Signer as _};
use polymarket_client_sdk::types::Address;
use polymarket_client_sdk::{POLYGON, derive_proxy_wallet};
use polymarket_client_sdk::{POLYGON, derive_safe_wallet};

use super::wallet::normalize_key;
use crate::config;
Expand Down Expand Up @@ -156,7 +156,7 @@ fn finish_setup(address: Address) -> Result<()> {

step_header(2, total, "Proxy Wallet");

let proxy = derive_proxy_wallet(address, POLYGON);
let proxy = derive_safe_wallet(address, POLYGON);
match proxy {
Some(proxy) => {
println!(" ✓ Proxy wallet derived");
Expand Down
16 changes: 8 additions & 8 deletions src/commands/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use anyhow::{Context, Result, bail};
use clap::{Args, Subcommand};
use polymarket_client_sdk::auth::LocalSigner;
use polymarket_client_sdk::auth::Signer as _;
use polymarket_client_sdk::{POLYGON, derive_proxy_wallet};
use polymarket_client_sdk::{POLYGON, derive_safe_wallet};

use crate::config;
use crate::output::OutputFormat;
Expand All @@ -23,8 +23,8 @@ pub enum WalletCommand {
/// Overwrite existing wallet
#[arg(long)]
force: bool,
/// Signature type: eoa, proxy (default), or gnosis-safe
#[arg(long, default_value = "proxy")]
/// Signature type: eoa, proxy, or gnosis-safe (default)
#[arg(long, default_value = "gnosis-safe")]
signature_type: String,
},
/// Import an existing private key
Expand All @@ -34,8 +34,8 @@ pub enum WalletCommand {
/// Overwrite existing wallet
#[arg(long)]
force: bool,
/// Signature type: eoa, proxy (default), or gnosis-safe
#[arg(long, default_value = "proxy")]
/// Signature type: eoa, proxy, or gnosis-safe (default)
#[arg(long, default_value = "gnosis-safe")]
signature_type: String,
},
/// Show the address of the configured wallet
Expand Down Expand Up @@ -103,7 +103,7 @@ fn cmd_create(output: &OutputFormat, force: bool, signature_type: &str) -> Resul

config::save_wallet(&key_hex, POLYGON, signature_type)?;
let config_path = config::config_path()?;
let proxy_addr = derive_proxy_wallet(address, POLYGON);
let proxy_addr = derive_safe_wallet(address, POLYGON);

match output {
OutputFormat::Json => {
Expand Down Expand Up @@ -144,7 +144,7 @@ fn cmd_import(key: &str, output: &OutputFormat, force: bool, signature_type: &st

config::save_wallet(&normalized, POLYGON, signature_type)?;
let config_path = config::config_path()?;
let proxy_addr = derive_proxy_wallet(address, POLYGON);
let proxy_addr = derive_safe_wallet(address, POLYGON);

match output {
OutputFormat::Json => {
Expand Down Expand Up @@ -195,7 +195,7 @@ fn cmd_show(output: &OutputFormat, private_key_flag: Option<&str>) -> Result<()>
let address = signer.as_ref().map(|s| s.address().to_string());
let proxy_addr = signer
.as_ref()
.and_then(|s| derive_proxy_wallet(s.address(), POLYGON))
.and_then(|s| derive_safe_wallet(s.address(), POLYGON))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proxy mode derivation is ignored

Medium Severity

derive_safe_wallet is now used unconditionally in wallet and setup, so derived proxy output no longer follows the configured signature_type. When users intentionally use proxy (Magic Link), proxy_address and deposit guidance can point to the wrong derived wallet despite --signature-type proxy being set.

Additional Locations (2)

Fix in Cursor Fix in Web

.map(|a| a.to_string());

let sig_type = config::resolve_signature_type(None);
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};

const ENV_VAR: &str = "POLYMARKET_PRIVATE_KEY";
const SIG_TYPE_ENV_VAR: &str = "POLYMARKET_SIGNATURE_TYPE";
pub const DEFAULT_SIGNATURE_TYPE: &str = "proxy";
pub const DEFAULT_SIGNATURE_TYPE: &str = "gnosis-safe";

pub const NO_WALLET_MSG: &str =
"No wallet configured. Run `polymarket wallet create` or `polymarket wallet import <key>`";
Expand Down