Skip to content

Binancep - #58

Closed
Erkansukgen wants to merge 30 commits into
developfrom
master
Closed

Binancep#58
Erkansukgen wants to merge 30 commits into
developfrom
master

Conversation

@Erkansukgen

Copy link
Copy Markdown

S

@Erkansukgen

Copy link
Copy Markdown
Author

S

Sam McHardy added 6 commits July 31, 2026 10:26
Keeps build artifacts, virtualenvs and caches out of the repo.
The old stub was generated with protoc < 3.19 and built its descriptors
via _descriptor.FieldDescriptor(). protobuf 4 and up rejects that, so
importing binance_chain.messages or binance_chain.http died with
"TypeError: Descriptors cannot be created directly". requirements.txt
asked for protobuf>=3.6.1, so a fresh install pulled protobuf 7 and the
package was unusable on install.

Only the generated file was ever committed, no .proto source, so I
recovered the schema from the descriptor embedded in the old stub and
checked it in as dex.proto. The regenerated stub serialises to a
byte-identical FileDescriptorProto, so the wire format and signing are
unchanged. test_messages.py asserts exact signed transaction hex and
still passes.

Generated with protoc 4.25 on purpose. protoc 7 output adds a runtime
version gate that would force everyone onto protobuf 7, while the 4.25
builder output works on 4.x through 7.x.

Also adds ujson to requirements.txt. It was already in setup.py
install_requires but missing here, so installing from requirements.txt
alone gave "No module named 'ujson'". Thanks @ArturDevico for flagging
that in #56.
HD_PATH is "44'/714'/0'/0/{id}" and the {id} was never substituted, so
subkey_for_path() got a literal "{id}" and pycoin raised "ValueError:
invalid literal for int() with base 10: '{id}'". Every call failed,
including create_random_wallet(), and the child argument did nothing.
Fixes #61, same fix as @MansooreSoltani's #51.

Also zero pads the private key to 64 hex chars. format(exponent, 'x')
drops leading zeros, so roughly 1 in 256 keys came out short and
bytearray.fromhex() then choked on an odd length string.

test_initialise_from_mnemonic already pinned the expected key for this
mnemonic and it passes, so child 0 still derives what it always did.
Added vectors for children 1 and 2 and a padding check over 25 children.
Current flake8 flagged 11 issues. Dropped an unused math import, removed
the redundant f prefix on four plain '?sync=1' strings, changed del(x) to
del x, added the missing space in return{, and switched the type()
equality comparisons to is / is not as E721 suggests. Used is rather than
isinstance to keep the exact type checks behaving the same.
travis-ci.org has been gone for years so the badge and the build were
both dead. Runs the unit tests on 3.9 through 3.12 plus a flake8 job.

Two things had to change to make the suite runnable at all. pytest-pep8
has been unmaintained since 2014 and now breaks pytest on import with a
PluginValidationError, so nothing ran while it was installed. Dropped it
and python-coveralls, which went with travis.

Most of the suite needs a live Binance Chain node and those tests fail
now, either on "APIError(code=500): No nodes available" or on the
event_loop fixture that pytest-asyncio removed in 1.0. Marked them
integration and excluded them from CI, which leaves 39 unit tests
covering amino encoding, message building, wallets and the depth cache.
Run the lot with pytest tests/ if you have a node.

Also removed two @pytest.mark.asyncio decorators sitting on fixtures.
They never did anything and modern pytest errors on them.
Points the urls at mchardysam, swaps the dead travis and coveralls badges
for the actions one, and documents how to regenerate dex_pb2.py from
dex.proto so the source does not go missing again.

setup.py claimed 3.6 and 3.7, now 3.9 to 3.12 with python_requires to
match. Adds long_description from the README so the PyPI page renders,
excludes tests from the wheel, and drops universal=1 so the wheel stops
tagging itself py2.py3. Bumps the protobuf floor to 4.21 to match
requirements.txt, since the regenerated stub needs the builder API.

Left the python-binance and python-kucoin links alone for now.
python-binance and python-kucoin still sit on the old sammchardy account
which is not mine any more, so the "check out my library" framing is
wrong and I do not control what those links point at. Removed both.
@mchardysam

Copy link
Copy Markdown
Owner

This branch is my own old develop, and it's behind master now, so merging it would roll back the wallet and README changes that are already in. Closing it.

@mchardysam mchardysam closed this Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants