bittensor-wallet
Advanced tools
@@ -35,3 +35,3 @@ name: Build wheels | ||
| - uses: actions/setup-python@v5 | ||
| - uses: actions/setup-python@v6 | ||
| with: | ||
@@ -41,3 +41,3 @@ python-version: "3.10" | ||
| - name: Build wheels | ||
| uses: PyO3/maturin-action@v1.44.0 | ||
| uses: PyO3/maturin-action@v1.49.4 | ||
| with: | ||
@@ -48,8 +48,20 @@ target: ${{ matrix.platform.target }} | ||
| --out dist | ||
| --interpreter python3.9 python3.10 python3.11 python3.12 python3.13 | ||
| --interpreter python3.9 python3.10 python3.11 python3.12 python3.13 python3.14 | ||
| ${{ matrix.platform.target == 'aarch64' && '--features vendored-openssl' || '' }} | ||
| sccache: 'true' | ||
| manylinux: auto | ||
| before-script-linux: (apt-get update && apt-get install -y apt-utils && apt-get install -y pkg-config libssl-dev) || (yum install openssl openssl-devel -y) | ||
| before-script-linux: | | ||
| if command -v yum &> /dev/null; then | ||
| yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic | ||
| # If we're running on i686 we need to symlink libatomic | ||
| # in order to build openssl with -latomic flag. | ||
| if [[ ! -d "/usr/lib64" ]]; then | ||
| ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so | ||
| fi | ||
| else | ||
| # If we're running on debian-based system. | ||
| apt update -y && apt-get install -y libssl-dev openssl pkg-config | ||
| fi | ||
| - name: Upload wheels | ||
@@ -73,10 +85,10 @@ uses: actions/upload-artifact@v4 | ||
| - uses: actions/setup-python@v5 | ||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: "3.10" | ||
| - name: Build wheels | ||
| uses: PyO3/maturin-action@v1.44.0 | ||
| uses: PyO3/maturin-action@v1.49.4 | ||
| with: | ||
| target: ${{ matrix.platform.target }} | ||
| args: --release --out dist --interpreter python3.9 python3.10 python3.11 python3.12 python3.13 | ||
| args: --release --out dist --interpreter python3.9 python3.10 python3.11 python3.12 python3.13 python3.14 | ||
| sccache: 'true' | ||
@@ -95,3 +107,3 @@ - name: Upload wheels | ||
| - name: Build sdist | ||
| uses: PyO3/maturin-action@v1.44.0 | ||
| uses: PyO3/maturin-action@v1.49.4 | ||
| with: | ||
@@ -127,5 +139,5 @@ command: sdist | ||
| if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} | ||
| uses: PyO3/maturin-action@v1.44.0 | ||
| uses: PyO3/maturin-action@v1.49.4 | ||
| with: | ||
| command: upload | ||
| args: --non-interactive --skip-existing wheels-*/* |
+0
-8
@@ -81,3 +81,2 @@ # Byte-compiled / optimized / DLL files | ||
| # Django stuff: | ||
| *.log | ||
| local_settings.py | ||
@@ -181,3 +180,2 @@ db.sqlite3 | ||
| # misc | ||
| .DS_Store | ||
| .env.local | ||
@@ -201,3 +199,2 @@ .env.development.local | ||
| **/env/* | ||
| **/data/* | ||
| **/.data/* | ||
@@ -216,7 +213,2 @@ **/tmp/* | ||
| # Notebooks | ||
| *.ipynb | ||
| tests/zombienet/bin/**/* | ||
| Cargo.lock |
+2
-2
| [package] | ||
| name = "bittensor_wallet" | ||
| version = "4.0.0" | ||
| version = "4.0.1" | ||
| edition = "2021" | ||
@@ -14,3 +14,3 @@ readme = "README.md" | ||
| sp-core = "34.0.0" | ||
| pyo3 = { version = "0.22.4", features = ["gil-refs"] } | ||
| pyo3 = { version = "0.26.0", features = ["generate-import-lib"] } | ||
| bip39 = { version = "2.0.0", features = ["rand"] } | ||
@@ -17,0 +17,0 @@ hex = "0.4.3" |
+10
-1
| # Changelog | ||
| ## 4.0.0 | ||
| ## 4.0.1 /2025-1028 | ||
| ## What's Changed | ||
| * Support Python 3.14 by @thewhaleking in https://github.com/opentensor/btwallet/pull/166 | ||
| **Full Changelog**: https://github.com/opentensor/btwallet/compare/v4.0.0...v4.0.1 | ||
| ## 4.0.0 /2025-08-06 | ||
| ## What's Changed | ||
| * make when_created field optional for json file import by @camfairchild in https://github.com/opentensor/btwallet/pull/160 | ||
@@ -5,0 +14,0 @@ * Fix hotkeypub by @thewhaleking in https://github.com/opentensor/btwallet/pull/161 |
+1
-1
| Metadata-Version: 2.4 | ||
| Name: bittensor-wallet | ||
| Version: 4.0.0 | ||
| Version: 4.0.1 | ||
| Classifier: Development Status :: 5 - Production/Stable | ||
@@ -5,0 +5,0 @@ Classifier: Intended Audience :: Developers |
+48
-43
@@ -1,2 +0,2 @@ | ||
| use std::{borrow::Cow, env, str}; | ||
| use std::{borrow::Cow, env, ffi::CString, str}; | ||
@@ -269,5 +269,6 @@ use crate::constants::{BT_WALLET_HOTKEY, BT_WALLET_NAME, BT_WALLET_PATH}; | ||
| #[pyo3(signature = (data))] | ||
| fn sign(&self, data: PyObject, py: Python) -> PyResult<Cow<[u8]>> { | ||
| fn sign(&self, data: Py<PyAny>, py: Python) -> PyResult<Cow<[u8]>> { | ||
| // Convert data to bytes (data can be a string, hex, or bytes) | ||
| let data_bytes = if let Ok(s) = data.extract::<String>(py) { | ||
| let data_bound = data.bind(py); | ||
| let data_bytes = if let Ok(s) = data_bound.extract::<String>() { | ||
| if s.starts_with("0x") { | ||
@@ -280,9 +281,7 @@ hex::decode(s.trim_start_matches("0x")).map_err(|e| { | ||
| } | ||
| } else if let Ok(bytes) = data.extract::<Vec<u8>>(py) { | ||
| } else if let Ok(bytes) = data_bound.extract::<Vec<u8>>() { | ||
| bytes | ||
| } else if let Ok(py_scale_bytes) = data.extract::<&PyAny>(py) { | ||
| let scale_data: &PyAny = py_scale_bytes.getattr("data")?; | ||
| } else if let Ok(scale_data) = data_bound.getattr("data") { | ||
| let scale_data_bytes: Vec<u8> = scale_data.extract()?; | ||
| scale_data_bytes.to_vec() | ||
| scale_data_bytes | ||
| } else { | ||
@@ -301,5 +300,6 @@ return Err(PyErr::new::<PyConfigurationError, _>( | ||
| #[pyo3(signature = (data, signature))] | ||
| fn verify(&self, data: PyObject, signature: PyObject, py: Python) -> PyResult<bool> { | ||
| fn verify(&self, data: Py<PyAny>, signature: Py<PyAny>, py: Python) -> PyResult<bool> { | ||
| // Convert data to bytes (data can be a string, hex, or bytes) | ||
| let data_bytes = if let Ok(s) = data.extract::<String>(py) { | ||
| let data_bound = data.bind(py); | ||
| let data_bytes = if let Ok(s) = data_bound.extract::<String>() { | ||
| if s.starts_with("0x") { | ||
@@ -312,9 +312,7 @@ hex::decode(s.trim_start_matches("0x")).map_err(|e| { | ||
| } | ||
| } else if let Ok(bytes) = data.extract::<Vec<u8>>(py) { | ||
| } else if let Ok(bytes) = data_bound.extract::<Vec<u8>>() { | ||
| bytes | ||
| } else if let Ok(py_scale_bytes) = data.extract::<&PyAny>(py) { | ||
| let scale_data: &PyAny = py_scale_bytes.getattr("data")?; | ||
| } else if let Ok(scale_data) = data_bound.getattr("data") { | ||
| let scale_data_bytes: Vec<u8> = scale_data.extract()?; | ||
| scale_data_bytes.to_vec() | ||
| scale_data_bytes | ||
| } else { | ||
@@ -327,3 +325,4 @@ return Err(PyErr::new::<PyConfigurationError, _>( | ||
| // Convert signature to bytes | ||
| let signature_bytes = if let Ok(s) = signature.extract::<String>(py) { | ||
| let signature_bound = signature.bind(py); | ||
| let signature_bytes = if let Ok(s) = signature_bound.extract::<String>() { | ||
| if s.starts_with("0x") { | ||
@@ -338,3 +337,3 @@ hex::decode(s.trim_start_matches("0x")).map_err(|e| { | ||
| } | ||
| } else if let Ok(bytes) = signature.extract::<Vec<u8>>(py) { | ||
| } else if let Ok(bytes) = signature_bound.extract::<Vec<u8>>() { | ||
| bytes | ||
@@ -402,7 +401,9 @@ } else { | ||
| impl IntoPy<PyObject> for KeyFileError { | ||
| fn into_py(self, py: Python<'_>) -> PyObject { | ||
| Py::new(py, PyKeyFileError { inner: self }) | ||
| .unwrap() | ||
| .into_any() | ||
| impl<'py> IntoPyObject<'py> for KeyFileError { | ||
| type Target = PyAny; | ||
| type Output = Bound<'py, Self::Target>; | ||
| type Error = PyErr; | ||
| fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> { | ||
| Ok(Bound::new(py, PyKeyFileError { inner: self })?.into_any()) | ||
| } | ||
@@ -471,7 +472,9 @@ } | ||
| impl IntoPy<PyObject> for WalletError { | ||
| fn into_py(self, py: Python<'_>) -> PyObject { | ||
| Py::new(py, PyWalletError { inner: self }) | ||
| .unwrap() | ||
| .into_any() | ||
| impl<'py> IntoPyObject<'py> for WalletError { | ||
| type Target = PyAny; | ||
| type Output = Bound<'py, Self::Target>; | ||
| type Error = PyErr; | ||
| fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> { | ||
| Ok(Bound::new(py, PyWalletError { inner: self })?.into_any()) | ||
| } | ||
@@ -505,3 +508,3 @@ } | ||
| fn register_config_module(main_module: &Bound<'_, PyModule>) -> PyResult<()> { | ||
| let config_module = PyModule::new_bound(main_module.py(), "config")?; | ||
| let config_module = PyModule::new(main_module.py(), "config")?; | ||
| config_module.add_class::<Config>()?; | ||
@@ -512,3 +515,3 @@ main_module.add_submodule(&config_module) | ||
| fn register_errors_module(main_module: &Bound<'_, PyModule>) -> PyResult<()> { | ||
| let errors_module = PyModule::new_bound(main_module.py(), "errors")?; | ||
| let errors_module = PyModule::new(main_module.py(), "errors")?; | ||
| // Register the WalletError exception | ||
@@ -524,5 +527,5 @@ errors_module.add_class::<PyWalletError>()?; | ||
| #[pyo3(signature = (keypair))] | ||
| fn py_serialized_keypair_to_keyfile_data(py: Python, keypair: &PyKeypair) -> PyResult<PyObject> { | ||
| fn py_serialized_keypair_to_keyfile_data(py: Python, keypair: &PyKeypair) -> PyResult<Py<PyAny>> { | ||
| keyfile::serialized_keypair_to_keyfile_data(&keypair.inner) | ||
| .map(|bytes| PyBytes::new_bound(py, &bytes).into_py(py)) | ||
| .map(|bytes| PyBytes::new(py, &bytes).unbind().into_any()) | ||
| .map_err(|e| PyErr::new::<PyKeyFileError, _>(e)) | ||
@@ -586,3 +589,3 @@ } | ||
| fn register_keyfile_module(main_module: &Bound<'_, PyModule>) -> PyResult<()> { | ||
| let keyfile_module = PyModule::new_bound(main_module.py(), "keyfile")?; | ||
| let keyfile_module = PyModule::new(main_module.py(), "keyfile")?; | ||
| keyfile_module.add_function(wrap_pyfunction!( | ||
@@ -633,3 +636,3 @@ py_serialized_keypair_to_keyfile_data, | ||
| fn register_keypair_module(main_module: &Bound<'_, PyModule>) -> PyResult<()> { | ||
| let keypair_module = PyModule::new_bound(main_module.py(), "keypair")?; | ||
| let keypair_module = PyModule::new(main_module.py(), "keypair")?; | ||
| keypair_module.add_class::<PyKeypair>()?; | ||
@@ -646,3 +649,3 @@ main_module.add_submodule(&keypair_module) | ||
| fn py_is_valid_ed25519_pubkey(public_key: &Bound<'_, PyAny>) -> PyResult<bool> { | ||
| Python::with_gil(|_py| { | ||
| Python::attach(|_py| { | ||
| if public_key.is_instance_of::<PyString>() { | ||
@@ -666,3 +669,3 @@ Ok(crate::utils::is_string_valid_ed25519_pubkey( | ||
| fn py_is_valid_bittensor_address_or_public_key(address: &Bound<'_, PyAny>) -> bool { | ||
| Python::with_gil(|_py| { | ||
| Python::attach(|_py| { | ||
| if address.is_instance_of::<PyString>() { | ||
@@ -688,3 +691,3 @@ let Ok(address_str) = address.extract() else { | ||
| fn register_utils_module(main_module: &Bound<'_, PyModule>) -> PyResult<()> { | ||
| let utils_module = PyModule::new_bound(main_module.py(), "utils")?; | ||
| let utils_module = PyModule::new(main_module.py(), "utils")?; | ||
| utils_module.add_function(wrap_pyfunction!( | ||
@@ -710,3 +713,3 @@ crate::utils::is_valid_ss58_address, | ||
| fn register_wallet_module(main_module: &Bound<'_, PyModule>) -> PyResult<()> { | ||
| let wallet_module = PyModule::new_bound(main_module.py(), "wallet")?; | ||
| let wallet_module = PyModule::new(main_module.py(), "wallet")?; | ||
| wallet_module.add_function(wrap_pyfunction!( | ||
@@ -759,3 +762,3 @@ crate::wallet::display_mnemonic_msg, | ||
| path: Option<String>, | ||
| config: Option<PyObject>, | ||
| config: Option<Py<PyAny>>, | ||
| py: Python, | ||
@@ -811,3 +814,3 @@ ) -> PyResult<Self> { | ||
| py: Python, | ||
| ) -> PyResult<PyObject> { | ||
| ) -> PyResult<Py<PyAny>> { | ||
| let default_name = | ||
@@ -855,8 +858,10 @@ env::var("BT_WALLET_NAME").unwrap_or_else(|_| BT_WALLET_NAME.to_string()); | ||
| py.run_bound( | ||
| &code, | ||
| Some(&[("parser", parser)].into_py_dict_bound(py)), | ||
| let code_cstr = CString::new(code).map_err(|e| PyErr::new::<PyValueError, _>(e.to_string()))?; | ||
| let dict = [("parser", parser.as_any())].into_py_dict(py)?; | ||
| py.run( | ||
| &code_cstr, | ||
| Some(&dict), | ||
| None, | ||
| )?; | ||
| Ok(parser.to_object(py)) | ||
| Ok(parser.clone().unbind()) | ||
| } | ||
@@ -863,0 +868,0 @@ |
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
379516
0.32%