Skip to main content

No project description provided

Project description

Bindings for schema parsing

These bindings require maturin and Rust installed.

We've tested with Rust 1.74.

Project structure

The Rust bindings are in src/lib.rs. They are simple exports of functionality from concordium-contracts-common.

The entrypoint for Python consumers is the ccdexplorer_schema_parser package which has a single class Schema. The constructor will instantiate the schema from a deployed Wasm module.

After that the constructed object can be used to parse events or return values using the schema in the module.

f = open('/path/to/module', 'rb').read()
schema = Schema(f)
# to convert the event which is serialized as [1,2,3] for the contract "test"
# to json
event_json = s.event_to_json("test", [1,2,2])

Alternatively to construct the schema from a Wasm module and explicit version, e.g., such as the data received from GetModuleSource grpc call

resp = stub.GetModuleSource(r)
schema = None
if resp.WhichOneof('module') == 'v0':
    schema = Schema(resp.v0.value, 0)
elif resp.WhichOneof('module') == 'v1'::
    schema = Schema(resp.v1.value, 1)

Building

Run maturin build.

This will produce a python wheel in target/wheels that will contain both the compiled Rust binaries and python wrappers. The compiled package is platform specific, so a package built on, e.g., Linux will not work on Windows.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ccdexplorer_schema_parser-0.1.2.tar.gz (21.3 kB view hashes)

Uploaded Source

Built Distributions

ccdexplorer_schema_parser-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

ccdexplorer_schema_parser-0.1.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.3 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARMv7l

ccdexplorer_schema_parser-0.1.2-cp312-cp312-macosx_11_0_arm64.whl (532.3 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

ccdexplorer_schema_parser-0.1.2-cp312-cp312-macosx_10_12_x86_64.whl (558.4 kB view hashes)

Uploaded CPython 3.12 macOS 10.12+ x86-64

ccdexplorer_schema_parser-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

ccdexplorer_schema_parser-0.1.2-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.3 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARMv7l

ccdexplorer_schema_parser-0.1.2-cp311-cp311-macosx_11_0_arm64.whl (532.0 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

ccdexplorer_schema_parser-0.1.2-cp311-cp311-macosx_10_12_x86_64.whl (558.5 kB view hashes)

Uploaded CPython 3.11 macOS 10.12+ x86-64

ccdexplorer_schema_parser-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

ccdexplorer_schema_parser-0.1.2-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.3 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARMv7l

ccdexplorer_schema_parser-0.1.2-cp310-cp310-macosx_11_0_arm64.whl (532.0 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

ccdexplorer_schema_parser-0.1.2-cp310-cp310-macosx_10_12_x86_64.whl (558.5 kB view hashes)

Uploaded CPython 3.10 macOS 10.12+ x86-64

ccdexplorer_schema_parser-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

ccdexplorer_schema_parser-0.1.2-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.3 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARMv7l

ccdexplorer_schema_parser-0.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

ccdexplorer_schema_parser-0.1.2-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.3 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARMv7l

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page