Giter Club home page Giter Club logo

protobuf3-solidity-lib's Introduction

protobuf3-solidity-lib

NPM Package GitHub release (latest SemVer) Node.js CI GitHub

Codec library for protobuf3 in Solidity. This library provides encoding and decoding functions for core protobuf3 types.

Overview

Installation

npm install --save @lazyledger/protobuf3-solidity-lib

Usage

Import the library in Solidity:

pragma solidity >=0.8.4 <0.9.0;

import "@lazyledger/protobuf3-solidity-lib/contracts/ProtobufLib.sol";

Building from source

Install dependencies:

npm install

Build:

npm run build

Test:

npm run test

Supported Features

type decode encode
key ✔️ ✔️
varint ✔️ ✔️
int32 ✔️ ✔️
int64 ✔️ ✔️
uint32 ✔️ ✔️
uint64 ✔️ ✔️
sint32 ✔️ ✔️
sint64 ✔️ ✔️
fixed32 ✔️ ✔️
sfixed32 ✔️ ✔️
fixed64 ✔️ ✔️
sfixed64 ✔️ ✔️
bool ✔️ ✔️
enum ✔️ ✔️
string ✔️ ✔️
bytes ✔️ ✔️
embedded messages ✔️ ✔️
packed repeated ✔️ ✔️

Unsupported Features

Start and end group deprecated wire types, float, double field types.

protobuf3-solidity-lib's People

Contributors

adlerjohn avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

protobuf3-solidity-lib's Issues

Seems like doesn't compile with 0.8.4 solidity.

Compiling 2 files with 0.8.4
TypeError: Unary operator - cannot be applied to type uint64
   --> @lazyledger/protobuf3-solidity-lib/contracts/ProtobufLib.sol:255:43:
    |
255 |         uint64 zigzag_val = (val >> 1) ^ (-(val & 1));
    |                                           ^^^^^^^^^^


TypeError: Unary operator - cannot be applied to type uint64
   --> @lazyledger/protobuf3-solidity-lib/contracts/ProtobufLib.sol:281:43:
    |
281 |         uint64 zigzag_val = (val >> 1) ^ (-(val & 1));
    |                                           ^^^^^^^^^^


TypeError: Explicit type conversion not allowed from "int32" to "uint64".
   --> @lazyledger/protobuf3-solidity-lib/contracts/ProtobufLib.sol:658:30:
    |
658 |         return encode_varint(uint64(n));
    |                              ^^^^^^^^^


Error HH600: Compilation failed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.