Skip to content

Commit 83c8dc2

Browse files
committed
init
0 parents  commit 83c8dc2

24 files changed

+897
-0
lines changed

.github/workflows/publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI and Publish
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags:
7+
- 'v*'
8+
9+
jobs:
10+
publish:
11+
needs: test
12+
runs-on: ubuntu-latest
13+
14+
permissions:
15+
id-token: write
16+
contents: read
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- uses: actions/setup-python@v4
22+
with:
23+
python-version: '3.12'
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
python -m pip install poetry
29+
30+
- name: Build package
31+
run: poetry build
32+
33+
- name: Rebuild package with version tag
34+
if: startsWith(github.ref, 'refs/tags/v')
35+
run: |
36+
VERSION=${GITHUB_REF#refs/tags/v}
37+
poetry version $VERSION
38+
poetry build
39+
40+
- name: Publish to PyPI
41+
if: startsWith(github.ref, 'refs/tags/v')
42+
uses: pypa/gh-action-pypi-publish@release/v1
43+
with:
44+
packages-dir: dist/
45+
skip-existing: true
46+
verify-metadata: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/dist

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 PyWaves-CE
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# PyWaves-Protobuf
2+
3+
**Python Protobuf bindings for Waves blockchain.**
4+
5+
## Installation
6+
7+
```bash
8+
pip install pywaves-protobuf
9+
```
10+
11+
## Regenerating Bindings
12+
13+
If schema updates require regenerating Python modules:
14+
15+
```bat
16+
generate.bat
17+
```
18+
19+
This will download `protoc` and Waves `.proto` definitions, compile them into the `waves/` package, and perform a verification count.
20+
21+
## License
22+
23+
MIT License — see [LICENSE](LICENSE) for details.

generate.bat

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
cd /d %~dp0
2+
set PROTOC_VERSION=25.7
3+
set PROTO_WAVES_VERSION=1.5.2
4+
5+
set PROTOC_URL=https://github.com/protocolbuffers/protobuf/releases/download/v%PROTOC_VERSION%/
6+
set PROTOC_ARCH=protoc-%PROTOC_VERSION%-win32.zip
7+
set PROTO_WAVES_URL=https://github.com/wavesplatform/protobuf-schemas/archive/
8+
set PROTO_WAVES_ARCH=v%PROTO_WAVES_VERSION%.zip
9+
10+
set PROTO_OUT=out
11+
set PROTO_TEMP=protobuf-%random%%random%
12+
set PROTO_FINAL=waves
13+
14+
mkdir %PROTO_TEMP%
15+
cd %PROTO_TEMP%
16+
17+
curl -fsSL -o %PROTOC_ARCH% %PROTOC_URL%%PROTOC_ARCH%
18+
7z x %PROTOC_ARCH% -aoa
19+
20+
curl -fsSL -o %PROTO_WAVES_ARCH% %PROTO_WAVES_URL%%PROTO_WAVES_ARCH%
21+
7z x %PROTO_WAVES_ARCH% -aoa
22+
23+
mkdir %PROTO_OUT%
24+
FOR /R "protobuf-schemas-%PROTO_WAVES_VERSION%\proto\%PROTO_FINAL%" %%f IN (*.proto) DO (
25+
bin\protoc --proto_path="%CD%\protobuf-schemas-%PROTO_WAVES_VERSION%\proto" --python_out=%PROTO_OUT% "%%f"
26+
)
27+
28+
rmdir /s /q %PROTO_FINAL%
29+
xcopy /s /y %PROTO_OUT%\%PROTO_FINAL% ..\%PROTO_FINAL%\
30+
type nul > ..\%PROTO_FINAL%\__init__.py
31+
cd ..
32+
for /f %%n in ('dir /b /s "%PROTO_TEMP%\protobuf-schemas-%PROTO_WAVES_VERSION%\proto\%PROTO_FINAL%\*.proto" ^| find /c /v ""') do set PROTO_COUNT=%%n
33+
for /f %%n in ('dir /b /s "%PROTO_FINAL%\*_pb2.py" ^| find /c /v ""') do set PY_COUNT=%%n
34+
if NOT "%PROTO_COUNT%"=="%PY_COUNT%" (
35+
echo Error: Expected %PROTO_COUNT% compiled python files, but found %PY_COUNT%.
36+
pause
37+
exit /B 1
38+
)
39+
echo Success: All %PROTO_COUNT% protobuf files compiled successfully
40+
timeout 10
41+
rmdir /s /q %PROTO_TEMP%
42+
pause

pyproject.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[tool.poetry]
2+
name = "PyWaves-Protobuf"
3+
version = "0.0.0"
4+
description = "Waves Protobufs to interact with the blockchain"
5+
authors = ["PyWaves-CE Contributors"]
6+
license = "MIT"
7+
readme = "README.md"
8+
packages = [
9+
{include = "waves"},
10+
]
11+
classifiers = [
12+
"Programming Language :: Python :: 3",
13+
"License :: OSI Approved :: MIT License",
14+
"Operating System :: OS Independent",
15+
]
16+
17+
[tool.poetry.dependencies]
18+
protobuf = "^4.25.1"
19+
python = "^3.6"
20+
21+
[build-system]
22+
requires = ["poetry-core"]
23+
build-backend = "poetry.core.masonry.api"

waves/__init__.py

Whitespace-only changes.

waves/amount_pb2.py

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

waves/block_pb2.py

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)