Code Monkey home page Code Monkey logo

assetid's Introduction

AssetID-Encoder

Build Status Coverage Status npm version npm version

js-standard-style

Issuance-Encoder provides the encode/decode functions between a Colored Coins issuance Object to buffer

Installation

$ npm install cc-assetid-encoder

Encode Asset ID

Params: - BitcoinTransaction - An Object with contains at least the following properties:

{
  'ccdata': [{
    'type': 'issuance',
    'lockStatus': false,
  }],
  'vin': [{
    'txid': '0f45f38a8bcd8331877267e0f3f5f8a4b3c716165e40db4eee34d52759ad954f',
    'vout': 2,

    // The following properties are optional but at least one is required in
    // case 'lockStatus' is FALSE
    'scriptSig': {
      'asm': '3045022100daf8f8d65ea908a28d90f700dc932ecb3b68f402b04ba92f987e8abd7080fcad02205ce81b698b8013b86813c9edafc9e79997610626c9dd1bfb49f60abee9daa43801 029b622e5f0f87f2be9f23c4d82f818a73e258a11c26f01f73c8b595042507a574',
    }
    'address': 'mxNTyQ3WdFMQE7SGVpSQGXnSDevGMLq7dg'
  }]
}

Returns a new Buffer holding the encoded issuance.

Example:
var assetIdEncoder = require('cc-assetid-encoder')

var bitcoinTransaction = {
  'ccdata': [{
    'type': 'issuance',
    'lockStatus': false,
  }],
  'vin': [{
    'txid': '0f45f38a8bcd8331877267e0f3f5f8a4b3c716165e40db4eee34d52759ad954f',
    'vout': 2,
    'scriptSig': {
      'asm': '3045022100daf8f8d65ea908a28d90f700dc932ecb3b68f402b04ba92f987e8abd7080fcad02205ce81b698b8013b86813c9edafc9e79997610626c9dd1bfb49f60abee9daa43801 029b622e5f0f87f2be9f23c4d82f818a73e258a11c26f01f73c8b595042507a574',
    }
  }]
}

assetIdEncoder(bitcoinTransaction)
// Will print 'Ua3Kt8WJtsx61VC8DUJiRmseQ45NfW2dwLbG6s'

Testing

In order to test you need to install mocha globaly on your machine

$ cd /"module-path"/cc-assetid-Encoder
$ mocha

License

Apache-2.0

assetid's People

Contributors

thehobbit85 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  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.