Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
Release v0.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier committed Dec 30, 2023
1 parent a4e7b4d commit 073c52a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "GPL-3.0"
name = "atomicalsir"
readme = "README.md"
repository = "https://github.com/hack-ink/atomicalsir"
version = "0.1.6"
version = "0.1.7"

[profile.ci-dev]
incremental = false
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ Options:
[default: 150]
--no-unconfirmed-txs-check
Disable the unconfirmed transaction count check.
This will disable the multi-wallet feature.
--stash <ALIAS>
Specify the alias of the stash wallet.
The name should be able to find in `wallets/x.json`. And it will be passed to atomicals-js's `--initialowner` flag.
The name should be able to find in `wallets/x.json`.
And it will be passed to atomicals-js's `--initialowner` flag.
--electrumx <URI>
Specify the URI of the electrumx proxy electrumx.
Expand All @@ -42,7 +48,7 @@ Options:
--strategy <STRATEGY>
Mining strategy
[default: average-first]
[default: wallet-first]
[possible values: average-first, wallet-first]
-h, --help
Expand Down Expand Up @@ -72,7 +78,7 @@ cargo build --release
```

#### Step-by-step setup
1. Follow the installation steps for [`atomicals-js`](https://github.com/atomicals/atomicals-js).
1. Follow the installation steps for [`atomicals-js`](https://github.com/atomicals/atomicals-js#install).
2. Follow the installation steps for [`atomicalsir`](#installation).
3. Run the following command: `atomicalsir --max-fee 150 <PATH to the atomicals-js folder>`

Expand All @@ -87,7 +93,7 @@ cargo build --release

- **How to use one stash address in multi-wallet mining?**

Add a wallet with a <NAME> under the `imported` field of your `atomicals-js/wallets/x.json` file.
Add a wallet with a `<NAME>` under the `imported` field of your `atomicals-js/wallets/x.json` file.

Then, run the command `atomicalsir --stash <NAME> ..`.

Expand Down
34 changes: 23 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ async fn main() -> Result<()> {
color_eyre::install().unwrap();
tracing_subscriber::fmt::init();

let Cli { atomicals_js_dir, max_fee, stash, electrumx, strategy } = Cli::parse();
let Cli { atomicals_js_dir, max_fee, no_unconfirmed_txs_check, stash, electrumx, strategy } =
Cli::parse();
let wallets = Wallet::load_wallets(&atomicals_js_dir.join("wallets"));

tracing::info!("");
Expand All @@ -52,17 +53,23 @@ async fn main() -> Result<()> {
tracing::info!("");

match strategy {
Strategy::AverageFirst =>
for _ in loop_query(
async || query_unconfirmed_tx_count(&w.address).await,
"unconfirmed transaction count",
)
.await..=12
{
Strategy::AverageFirst => {
let i = if no_unconfirmed_txs_check {
0
} else {
loop_query(
async || query_unconfirmed_tx_count(&w.address).await,
"unconfirmed transaction count",
)
.await
};

for _ in i..=12 {
w.mine(max_fee, stash.as_deref(), electrumx.as_deref()).await?;

sleep = false;
},
}
},
Strategy::WalletFirst => 'inner: loop {
if loop_query(
async || { query_unconfirmed_tx_count(&w.address) }.await,
Expand Down Expand Up @@ -116,11 +123,16 @@ struct Cli {
/// priority fee is larger then this value.
#[arg(long, value_name = "VALUE", default_value_t = 150)]
max_fee: u32,
/// Disable the unconfirmed transaction count check.
///
/// This will disable the multi-wallet feature.
#[arg(long, default_value_t = false)]
no_unconfirmed_txs_check: bool,
/// Specify the alias of the stash wallet.
///
/// The name should be able to find in `wallets/x.json`.
/// And it will be passed to atomicals-js's `--initialowner` flag.
#[arg(long, value_name = "ALIAS")]
#[arg(verbatim_doc_comment, long, value_name = "ALIAS")]
stash: Option<String>,
/// Specify the URI of the electrumx proxy electrumx.
///
Expand Down Expand Up @@ -338,7 +350,7 @@ where
return f;
}

tracing::warn!("failed to query {target}; retrying in 3 seconds");
tracing::warn!("failed to query {target}; retrying in 60 seconds");

thread::sleep(Duration::from_secs(3));
}
Expand Down

0 comments on commit 073c52a

Please sign in to comment.