GithubHelp home page GithubHelp logo

leonardocustodio / polkadart Goto Github PK

View Code? Open in Web Editor NEW
21.0 6.0 13.0 200.46 MB

Polkadart provides developers the ability to query a node and interact with the Polkadot or Substrate chains using Dart.

License: Apache License 2.0

Dart 99.98% Dockerfile 0.02%
dart flutter polkadot substrate polkadart

polkadart's Introduction

Polkadart

Star on Github Test Coverage Build and Tests License: Apache 2.0

This library provides a clean wrapper around all the methods exposed by a Polkadot/Substrate network client and defines all the types exposed by a node, this API provides developers the ability to query a node and interact with the Polkadot or Substrate chains using Dart.

This library is funded by Web3 Foundation via their Open Grants Program

Packages

This repo is a monorepo for polkadart and related packages.

Packages
____________________
Description
___________
version The core package that provides tools to connect and interact with the Polkadot or Substrate chains. It abstracts the complexities of the network protocols and offers straightforward APIs.
version A command-line interface tool that generates dart language types and corresponding definitions by interpreting the chain's metadata.
version Manages keys and addresses for Polkadot/Substrate accounts. Contains cryptographic functions related to creating keys, signing transactions, and managing user identities on the blockchain.
version SCALE (Simple Concatenated Aggregate Little-Endian) is a codec used by Substrate to efficiently encode and decode data. Contains a dart implementation of this codec.
version Implementation of the SECP256k1 elliptic curve used in the ECDSA (Elliptic Curve Digital Signature Algorithm) for cryptographic operations, which is widely used in various blockchain platforms.
version Implementation of Schnorrkel-based signature scheme used in Substrate. Contains functionalities related to this scheme, such as key generation and signing.
version SS58 is a cryptocurrency address format used by Substrate. This package includes utilities to encode and decode these addresses.
version BIP39 (Bitcoin Improvement Proposal 39) pertains to the generation of mnemonic phrases for cryptographic keys. Creates human-readable phrases that map to the keys used on Substrate-based chains.
version Provides the necessary tools to decode the metadata provided by a Substrate blockchain node. And can be used to easily decode constants, extrinsics, events, and other data written in the chain.

Documentation and Tests

You can run all tests from the library by running docker compose up;

Or if you have Melos installed globally you can run melos test.

Contributors

License

This repository is licensed under Apache 2.0 license

polkadart's People

Contributors

avive avatar burnww avatar clangenb avatar dependabot[bot] avatar gabrielokura avatar justkawal avatar leonardocustodio avatar lohann avatar pastre avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

polkadart's Issues

Document about gen_html in code_coverage.sh file

Document about code_coverage.sh file:

  • Command to install dependencies used to run code_coverage.sh
  • How to run the sh ?
  • How to give chmod permission to sh file when error: `permission denied comes.

Test _enum

Tasks:

  • Test type: "_enum"

Acceptance Criteria:

  • Edge Cases
  • Encode / Decode
  • Bad Cases where code breaks:
    • Passing different type to encode/decode function
    • Passing wrong value to encode/decode function

Test "Vec"

Tasks:

  • Make directory "Vec_test" and put the below test cases in separate files in that directory.
  • Test "Vec" ( Text, Str, String all are same aliases )
  • Test "Vec" ( u8 to u256 )
  • Test "Vec" ( i8 to i256)
  • Test "Vec"
  • Test "Vec<Option>"
  • Test "Vec<Option>"
  • Test "Vec<Option>"
  • Test "Vec<Option>"

Acceptance Criteria:

  • Edge Cases
  • Encode / Decode
  • Bad Cases where code breaks:
    • Passing different type to encode/decode function
    • Passing wrong value to encode/decode function

Implementation of class decoding

4/4 related to #13

Description

Implementation of the method 'decode' on any class by creating a new dart file and without writing this method on each one

Acceptance Criteria

  • must create a new .g.dart file with the class extension, including decode function.

Re-write Unit Tests for BigInt

For functions file re-write BigInt Unit Test-Cases:

  • Remove for loops.
  • Remove Random() values usage.
  • Proper Description of test cases with readability being the most important.
  • Separately test Happy and Bad cases in different groups.

Test "Tuple"

Tasks:

  • Test "Tuple"

Acceptance Criteria:

  • Edge Cases
  • Encode / Decode
  • Bad Cases where code breaks:
    • Passing different type to encode/decode function
    • Passing wrong value to encode/decode function

Implementation of code generator using annotations

1/4 related to #13

Description

Implementation of scale-codec decorators with dart code generator and annotations. The main concept is about generating classes with the right scale codec methods.

Acceptance Criteria

  • must create a new .g.dart file with the class extension when user writes the decorator above class name.

Test Cases refactoring and refining.

Test Cases re-factoring:

  • Improve readability of test-cases by different objects and proper variable names.
  • Change test description to GWT convention
  • Re-check the expect statements
  • Check for following BDD style.

Test "Balance"

Tasks:

  • Test "Balance"

Acceptance Criteria:

  • Edge Cases
  • Encode / Decode
  • Bad Cases where code breaks:
    • Passing different type to encode/decode function
    • Passing wrong value to encode/decode function

Test "_struct"

Tasks:

  • Test "_struct"

Acceptance Criteria:

  • Edge Cases
  • Encode / Decode
  • Bad Cases where code breaks:
    • Passing different type to encode/decode function
    • Passing wrong value to encode/decode function

Remove abbreviations from Scale-Codec

Remove abbreviations from Scale-Codec package:

  • packages/polkadart_scale_codec/lib/src/core/polkadart_scale_codec_base.dart
  • packages/polkadart_scale_codec/lib/src/core/sink.dart

Optimise CI Actions

Optimise the CI Actions by:

  • Create Code Coverage on very 1st run of test cases.
  • Use the previously create code-coverage to upload it to code-conv.
  • Avoid re-running of test-cases again and again as we're currently doing.

Unit Test Source

Unit Test for Compact Functionality:

  • Happy Cases
  • Edge Cases
  • Bad Cases
  • Testing with different types

100% testing coverage for Scale-Codec

  • Test Constants Encode/Decode
  • Test Events Encode/Decode
  • Test Extrinsic Encode/Decode
  • Edge case scenarios where exception must occur.
  • Types testing

Requirements:

  • At least 99% of the code coverage is needed to close this issue.
  • Well documented code.

Refactor checkInt and checkBigInt

This sort of function is called clamp. We could rename it to isClamped or isBetween.

Another improvement would be to extend Comparable so that we get this syntax: aComparable.isBetween(min, max).

Addition of substrate primitive types on Polkadart code generator

2/4 Related to issue #13

Description

Implementation of scale-codec decorators with dart code generator and annotations.
In this step we need to add new decorators types that match substrate datatypes and will be used on class encode and decode methods

Acceptance Criteria

  • when user writes the decorator of some type before variable declaration, the package must create a new .g.dart file with that variable parsed

Test "Address"

Tasks:

  • Test "Address"

Acceptance Criteria:

  • Edge Cases
  • Encode / Decode
  • Bad Cases where code breaks:
    • Passing different type to encode/decode function
    • Passing wrong value to encode/decode function

Test Cases for scale-codec to test all chains with Scale-Codec functions

Description

Test Cases for Scale-Codec function must process and verify all the chains data easily and quickly.
Proper cache implementation should be used both in scale_codec and testing source code where decoding and encoding of same block or spec-version could be used by multiple tests.

Acceptance Criteria

  • CI must check lint
  • CI must run tests and generate code-coverage
  • CI must pass at least 99%
  • All Test Cases must be passing.
  • CI must check if it compiles

Sink Unit Test

  • Unit Test Sink

Acceptance Criteria:

  • Edge Cases
  • Happy cases
  • Bad Cases where code breaks

Implementation of class encoding

3/4 related to #13

Description

Implementation of the method 'encode' on any class by creating a new dart file and without writing this method on each one

Acceptance Criteria

  • must create a new .g.dart file with the class extension, including encode function.

Parse Substrate's Metadata V14

Description

Metadata parsing impl and type-conversion from network json schema to Types Model.

Tasks:

  • Substrate Metadata definitions: (base and v9 - v14)
  • Xcm Encode / Decode
  • Test Cases for verifying chain data
  • Chain specific schemas definitions
  • Testing Old Type Registry and Type Exp
  • More Test cases to reach code coverage of minimum 99%

Acceptance Criteria:

  • Minimum 99% Code Coverage Required.
  • Parsing of all chain blocks and events without any hiccups

100% testing coverage for SS58-Codec

Description

Achieve 100% coverage with test-cases to have every possible edge and corner cases.

Acceptance Criteria

  • 100% Testing Coverage should be available.

CI-CD Setup

Description

To make sure multiple formatting of files via dprint and test cases passes.

Acceptance Criteria

  • CI must check lint
  • CI must run tests
  • Analyze Dart Code
  • dart formatting --> no-change should be found

Unit Tests for Codec - (Scale Codec)

#Unit-Tests for Codec class can be achieved by testing different types and its mixed combination with each other.

  • Test Integer Types ( i, u ) + ( 8, 16, 32, 64, 128, 256 )
  • Test ( Text ) ( Note: Text ~ String ~ Str )
  • Test Bool
  • Test _enum
  • Test _struct
  • Test _set
  • Test Compact<T>
  • Test Vec<T>
  • Test Option<T>
  • Test Tuple: (K, V, T .....)
  • BTreeMap
  • Test Bytes
  • Test BitVec
  • Test Result

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.