GithubHelp home page GithubHelp logo

bhanditz / abieos Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eosio/abieos

0.0 2.0 0.0 344 KB

Binary <> JSON conversion using ABIs. Compatible with languages which can interface to C

License: MIT License

CMake 0.76% C++ 82.94% C 1.38% TypeScript 14.67% JavaScript 0.24%

abieos's Introduction

abieos

Binary <> JSON conversion using ABIs. Compatible with languages which can interface to C; see src/abieos.h.

Alpha release. Feedback requested.

Packing transactions

  1. Create a context: abieos_create
  2. Use abieos_set_abi to load eosjs2/src/transaction.abi into contract 0.
  3. Use abieos_set_abi to load the contract's ABI.
  4. Use abieos_json_to_bin and abieos_get_bin_hex to convert action data to hex. Use abieos_get_type_for_action to get the action's type.
  5. Use abieos_json_to_bin and abieos_get_bin_hex to convert transaction to hex. Use contract = 0 and type = abieos_string_to_name(context, "transaction").
  6. Destroy the context: abieos_destroy

Usage note

abieos expects object attributes to be in order. It will complain about missing attributes if they are out of order.

Example data

Example action data for abieos_json_to_bin:

{
    "from": "useraaaaaaaa",
    "to": "useraaaaaaab",
    "quantity": "0.0001 SYS",
    "memo": ""
}

Example transaction data for abieos_json_to_bin:

{
    "expiration": "2018-06-27T20:33:54.000",
    "ref_block_num": 45323,
    "ref_block_prefix": 2628749070,
    "max_net_usage_words": 0,
    "max_cpu_usage_ms": 0,
    "delay_sec": 0,
    "context_free_actions": [],
    "actions": [{
        "account": "eosio.token",
        "name": "transfer",
        "authorization":[{
            "actor":"useraaaaaaaa",
            "permission":"active"
        }],
        "data":"608C31C6187315D6708C31C6187315D60100000000000000045359530000000000"
    }],
    "transaction_extensions":[]
}

Ubuntu 16.04 with gcc 8.1.0

  • Install these. You may have to build them yourself from source or find a PPA. Make them the default.
    • gcc 8.1.0
    • cmake 3.11.3
  • sudo apt install libboost-dev libboost-date-time-dev
  • remove this from CMakeLists.txt (2 places): -fsanitize=address,undefined
mkdir build
cd build
cmake ..
make
./test

abieos's People

Contributors

tbfleming avatar

Watchers

 avatar  avatar

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.