Skip to content

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
- Fix build
- Add `to_base64` for address
  • Loading branch information
Rexagon committed Dec 27, 2024
1 parent e421396 commit 9b832da
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
platform:
- runner: ubuntu-latest
target: x86_64
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2
Expand All @@ -45,7 +45,7 @@ jobs:
platform:
- runner: windows-latest
target: x64
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -71,9 +71,9 @@ jobs:
platform:
- runner: macos-latest
target: x86_64
- runner: macos-12
- runner: macos-13
target: aarch64
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
4 changes: 2 additions & 2 deletions 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
@@ -1,6 +1,6 @@
[package]
name = "nekoton-python"
version = "0.1.20"
version = "0.1.21"
edition = "2021"

[lib]
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ classifiers = [
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dynamic = ["version"]
12 changes: 12 additions & 0 deletions python/nekoton/nekoton.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,18 @@ class Address:
"""Hash of the initial state."""
...

def to_base64(self, url_safe: bool = True, bounce: bool = False):
"""
Encodes address to a base64 format.
"""
...

def __str__(self):
"""
Encodes address to a raw format.
"""
...

def __eq__(self, other) -> Any: ...

def __ge__(self, other) -> Any: ...
Expand Down
5 changes: 5 additions & 0 deletions src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,11 @@ impl Address {
PyBytes::new(py, &bytes)
}

#[pyo3(signature = (url_safe = true, bounce = false))]
fn to_base64(&self, url_safe: bool, bounce: bool) -> PyResult<String> {
nt::utils::pack_std_smc_addr(url_safe, &self.0, bounce).handle_value_error()
}

fn __str__(&self) -> String {
self.0.to_string()
}
Expand Down
3 changes: 3 additions & 0 deletions tests/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
my_addr = Address(
'-1:d84e969feb02481933382c4544e9ff24a2f359847f8896baa86c501c3d1b00cf')
assert (my_addr.workchain == -1 and len(my_addr.account) == 32)

assert (my_addr.to_base64() == "Uf_YTpaf6wJIGTM4LEVE6f8kovNZhH-IlrqobFAcPRsAzwXV")

my_addr.workchain = 0
assert (my_addr.workchain == 0)
assert (my_addr.__hash__() == my_addr.__hash__())
Expand Down

0 comments on commit 9b832da

Please sign in to comment.