Skip to content

Commit 083279e

Browse files
committed
Drop once_cell dependency
1 parent 85c485e commit 083279e

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cosmos/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ prost = "0.13.3"
1717
prost-types = "0.13.3"
1818
bech32 = "0.11.0"
1919
bitcoin = "0.32.4"
20-
once_cell = "1.20.2"
2120
rand = "0.8.5"
2221
tracing = "0.1.40"
2322
fs-err = "3.0.0"

packages/cosmos/src/address.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ use std::{
22
collections::HashSet,
33
fmt::{Debug, Display},
44
str::FromStr,
5-
sync::Arc,
5+
sync::{Arc, OnceLock},
66
};
77

88
use bech32::{Bech32, Hrp};
99
use bitcoin::bip32::DerivationPath;
10-
use once_cell::sync::OnceCell;
1110
use parking_lot::RwLock;
1211
use serde::de::Visitor;
1312

@@ -299,7 +298,7 @@ impl Display for AddressHrp {
299298
}
300299

301300
type AddressHrpSet = RwLock<HashSet<&'static str>>;
302-
static ADDRESS_HRPS: OnceCell<AddressHrpSet> = OnceCell::new();
301+
static ADDRESS_HRPS: OnceLock<AddressHrpSet> = OnceLock::new();
303302
impl AddressHrp {
304303
fn get_set() -> &'static AddressHrpSet {
305304
ADDRESS_HRPS.get_or_init(|| RwLock::new(HashSet::new()))

packages/cosmos/src/wallet.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::HashMap;
22
use std::fmt::Display;
33
use std::str::FromStr;
4-
use std::sync::Arc;
4+
use std::sync::{Arc, LazyLock, OnceLock};
55

66
use bitcoin::bip32::{DerivationPath, Xpriv, Xpub};
77
use bitcoin::hashes::{ripemd160, sha256, Hash};
@@ -10,7 +10,6 @@ use bitcoin::secp256k1::{All, Message, Secp256k1};
1010
use cosmos_sdk_proto::cosmos::bank::v1beta1::MsgSend;
1111
use cosmos_sdk_proto::cosmos::base::abci::v1beta1::TxResponse;
1212
use cosmos_sdk_proto::cosmos::base::v1beta1::Coin;
13-
use once_cell::sync::{Lazy, OnceCell};
1413
use parking_lot::Mutex;
1514
use rand::Rng;
1615
use tiny_keccak::{Hasher, Keccak};
@@ -238,8 +237,8 @@ impl DerivationPathConfig {
238237

239238
pub fn as_derivation_path(&self) -> Arc<DerivationPath> {
240239
type DerivationPathMap = HashMap<DerivationPathConfig, Arc<DerivationPath>>;
241-
static PATHS: Lazy<Arc<Mutex<DerivationPathMap>>> =
242-
Lazy::new(|| Arc::new(Mutex::new(HashMap::new())));
240+
static PATHS: LazyLock<Arc<Mutex<DerivationPathMap>>> =
241+
LazyLock::new(|| Arc::new(Mutex::new(HashMap::new())));
243242
let mut guard = PATHS.lock();
244243
match guard.get(self) {
245244
Some(s) => s.clone(),
@@ -302,7 +301,7 @@ pub(crate) enum WalletPublicKey {
302301
}
303302

304303
fn global_secp() -> &'static Secp256k1<All> {
305-
static CELL: OnceCell<Secp256k1<All>> = OnceCell::new();
304+
static CELL: OnceLock<Secp256k1<All>> = OnceLock::new();
306305
CELL.get_or_init(Secp256k1::new)
307306
}
308307

0 commit comments

Comments
 (0)