filecoin-saturn / contracts

contracts
6 stars 0 forks source link

feat: claim cmd for cli #17

Closed alexander-camuto closed 1 year ago

alexander-camuto commented 1 year ago

Some more sophisticated users may want access to simple tools for programmatic claiming of funds (eg. if have multiple wallets or want to cron it).

This PR introduces a claim command on the cli.

/// Claims all available funds for a given address
    #[command(arg_required_else_help = true)]
    Claim {
        /// Path to the wallet mnemonic
        #[arg(short = 'S', long)]
        secret: PathBuf,
        /// RPC Url
        #[arg(short = 'U', long)]
        rpc_url: String,
        /// Path to the wallet mnemonic
        #[arg(short = 'F', long)]
        factory_addr: String,
        // Address to claim for
        #[arg(short = 'A', long)]
        addr_to_claim: String,
        // Num of retries when attempting to make a transaction.
        #[arg(long, default_value = "10")]
        retries: usize,
    },

It is used as such:

saturn-contracts claim  -S ./secrets/.secret -U $RPC_URL -F $FACTORY_ADDRESS -A $CLAIM_ADDRESS --retries=10