Giter Club home page Giter Club logo

commercio-sdk.dart's Introduction

Commercio SDK - Dart

Release Compatible

This repository contains the code of the official Commercio.network Dart SDK, entirely based on Sacco.dart.

The main features are:

  • Entirely made in Dart
  • Completely stateless

Thanks to these characteristics, you can use this SDK inside any pure Dart project or even any Flutter application.

You can find the official documentation here.

Helper methods

Inside the SDK you will find the following helper methods that will help you with almost any operation that you might want to perform on the Commercio.network blockchain.

Please note that you can find usage examples of the following methods inside the sdk documentation. We highly suggest you checking it out to have a complete reference of the SDK.

Crypto

  • Create HD wallet
  • Generate AES key
  • Generate RSA key

Docs

  • Share document
  • Send receipt
  • List documents
  • List receipts

Id

  • Create Did Document
  • Associate Did Document
  • Request power up

CommercioMint

  • Mint CCC
  • Burn CCC

CommercioKYC

  • Invite user
  • Buy membership
  • Deposit into reward pool

commercio-sdk.dart's People

Contributors

zenit70 avatar pasqenr avatar leobragaz avatar marcotradenet avatar riccardom avatar dependabot[bot] avatar

Stargazers

ivantan avatar  avatar Matt Slaton avatar Michalis Ioak avatar Ravindra Kumar avatar Abhimanyu Shekhawat avatar

Watchers

James Cloos avatar  avatar  avatar Rick avatar  avatar  avatar Matt Slaton avatar  avatar

commercio-sdk.dart's Issues

Adjustment of Id module

Adapting the Id module to the new version of the chain:

  • Setting field limits for 'MsgSetIdentity';
  • Removing fields that should not be submitted:
  • Possible other differences.

Help PAdES Sign

does anyone have any example code for signing pdf PAdES?

For what I can't understand ...

Do i have to have my public key for signing (taken from smart card or usb token or any other certification body)?
Must the signature, in .pem format, be completed with all the authorities that issued the certificate? how can I do ? is there simply a structure for the pem file?

In the notes, I see that in the end I have to combine my .pem file with my public signature taken from my wallet? it's right ?

I can not understand, on the examples of Kotlin I have some instructions that I do not find in the examples in dart.

Small docs fixes

Reviewing the documentation I've found just some small adjustment that should be done:

  • docs/lib/id/id_helper.md
    • The line 64 has a typo error (diDocument instead of didDocument), should be:
      await IdHelper.setDidDocument(didDocument, wallet);
  • Strings in Dart are usually declared with single quotes but double quotes are not an error
  • Tips are not in GitHub markdown syntax. For example:
    :::tip Some tip :::
    is not processed by GitHub. Maybe should we use a quote block instead?
  • docs/lib/membership/membership_helper.md lines 10-13 the correct method signature is:
    static Future<TransactionResult> inviteUser(
      String userDid, 
      Wallet wallet,
      {StdFee fee}
    ) async
    with the optional fee parameter.
  • docs/lib/mint/mint_helper.md at lines 10-14 the openCdp signature should be:
    static Future<TransactionResult> openCdp(
      int amount, 
      Wallet wallet,
      {StdFee fee}
    )
    with amount instead of commercioTokenAmount.
  • docs/lib/tx/tx_helper.md lines 13-18, the fee parameter is now assigned inside the method body and thus the signature become:
    static Future<TransactionResult> createSignAndSendTx(
    List<StdMsg> msgs,
    Wallet wallet, {
    StdFee fee,
    }) async
  • docs/lib/crypto/sign_helper.md the method signSorted() should have the signature:
    static Uint8List signSorted(dynamic data, Wallet wallet)
  • docs/lib/crypto/encryption_helper.md line 54 should be:
    static Future<RSAPublicKey> getGovernmentRsaPubKey(String lcdUrl) async
    with RSAPublicKey instead of RSAPubKey.
  • docs/lib/crypto/keys_helper.md
    • line 12 should be:
       static Future<KeyPair<RSAPublicKey, RSAPrivateKey>> generateRsaKeyPair({
         int bytes = 2048,
         String type,
       }) async
      with the optional type parameter.
    • line 18 should be:
       static Future<Key> generateAesKey({int length = 256}) async
      with length 256 instead of 356.

Fees amount

In the 'TxHelper' class the current amount of fees (100) will not be enough to successfully complete a transaction (required 10000).

Current code:

StdFee fee = const StdFee(
        gas: "200000",
        amount: [const StdCoin(denom: "ucommercio", amount: "100")]),

Verify crypto utility helpers

  • Keys helpers; move the method parseKeyFromPem from RSAKeyParser to KeysHelper class, then remove RSAKeyParser class.
  • Encryption helpers; check if the generateRandomNonceUtf8 method of class EncryptionHelper is actually useful or if it can be replaced by an existing method and then removed.

@pasqenr @marcotradenet

Sha256 Algorithm missing

ShareDoocument transaction with a sha256 digest as checksum value is not allowed although chain accepts that.

Adjustment of CommercioMint module

Adapting the CommercioMint module to the new version of the chain:

  • Update message 'openCDP' to mintCCC, verification of the possibility of making several mintCCs in one transaction;
  • Update message 'closeCDP' to burnCCC;
  • Possible other differences.

Docs update

Check that the documentation is aligned with the current code.

Add optional fee parameter to helper methods

The class DocsHelper currently supports a custom list of fees only in the method shareDocument(). Because the SDK is built to support different types of StdCoin also the other methods should take a fee parameter. For retro compatibility the new parameter should be optional with a default value.

List of methods that should be updated:

  • DocsHelper.sendDocumentReceipt()
  • MembershipHelper.inviteUser()
  • MembershipHelper.buyMembership()
  • MintHelper.openCdp()
    Note: the call to MsgOpenCdp() should also be updated with the custom fee list
  • MintHelper.closeCdp()
  • IdHelper.setDidDocument()
  • IdHelper.requestDidPowerUp()
  • IdHelper.MsgRequestDidPowerUp()

The optional parameter should be like those examples:

  • Where only the amount is required:
    fun({List<StdCoin> amount = const [StdCoin(denom: "ucommercio", amount: 10000)]})
  • Where a fee is required:
    fun({StdFee fee = const StdFee(
       gas: "200000",
       amount: [StdCoin(denom: "ucommercio", amount: 10000)]
    )})

The changes also needs to be reflected on the documentation and the examples.

Adjustment of Docs module

Adapting the Docs module to the new version of the chain:

  • Setting field limits for 'MsgShareDocument';
  • Removing fields that should not be submitted:
  • Addition of receipt endpoints not yet implemented;
  • Possible other differences.

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.