Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
.swagger-codegen
docs
src
test
.swagger-codegen-ignore
.travis.yml
README.md
git_push.sh
mocha.opts
package.json

README.md

hydrogen-molecule-api

molecule_api - JavaScript client for hydrogen-molecule-api

The Hydrogen Molecule API

Full documentation: Molecule

This SDK is automatically generated by the Swagger Codegen project:

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install hydrogen-molecule-api --save

Optionally, install client-oauth2 for easier authentication (see Method 1 in Getting Started):

npm install --save client-oauth2
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

Finally, switch to the directory you want to use your hydrogen-molecule-api from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('hydrogen-molecule-api') in javascript files from the directory you ran the last command above from.

git

If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Full usage documentation is available: Nucleus | Electron | Proton

Please follow the installation instructions and execute the following JS code:

var molecule_api = require('hydrogen-molecule-api');

var defaultClient = molecule_api.ApiClient.instance;

// (Optional) Set the Molecule environment you wish to use (defaults to sandbox)
// This changes the URL for requests to [environment].hydrogenplatform.com
defaultClient.basePath = "https://sandbox.hydrogenplatform.com";


// Configure OAuth2 access token for authorization: oauth
// Ensure the token is from the same environment as the defaultClient.basePath above
var oauth = defaultClient.authentications['oauth'];
oauth.accessToken = "YOUR ACCESS TOKEN";

var api = new molecule_api.MoleculeApi();

var tokenId = "tokenId_example"; // {String} UUID of a token


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.deleteToken(tokenId, callback);

Documentation for API Endpoints

Full usage documentation is available: Nucleus | Electron | Proton

All URIs are relative to https://api.hydrogenplatform.com

Class Method HTTP request Description
molecule_api.MoleculeApi deleteToken DELETE /molecule/v1/token/{token_id}/ Delete a token
molecule_api.MoleculeApi getCurrencyBalance GET /molecule/v1/currency_balance/{currency_balance_id} Retrieve a currency balance
molecule_api.MoleculeApi getCurrencyBalances GET /molecule/v1/currency_balance Get information for all currency balances defined for your application.
molecule_api.MoleculeApi getToken GET /molecule/v1/token/{token_id}/ Retrieve a token
molecule_api.MoleculeApi getTokenBalance GET /molecule/v1/token_balance/{token_balance_id} Retrieve a token balance
molecule_api.MoleculeApi getTokenBalances GET /molecule/v1/token_balance Get information for all token balances defined for your application.
molecule_api.MoleculeApi getTokenSupplies GET /molecule/v1/token_supply Get information for all token supplies defined for your application.
molecule_api.MoleculeApi getTokenSupply GET /molecule/v1/token_supply/{token_supply_id} Retrieve a token supply
molecule_api.MoleculeApi getTokens GET /molecule/v1/token Get information for all tokens defined for your firm
molecule_api.MoleculeApi getWallet GET /molecule/v1/wallet/{wallet_id}/ Retrieve a wallet
molecule_api.MoleculeApi getWalletKey GET /molecule/v1/wallet_key/{wallet_key_id}/ Retrieve a wallet key
molecule_api.MoleculeApi getWalletKeys GET /molecule/v1/wallet_key Get all wallet keys associated with wallets defined for your firm.
molecule_api.MoleculeApi getWallets GET /molecule/v1/wallet Get information for all wallets defined for your firm
molecule_api.MoleculeApi postToken POST /molecule/v1/token Create a token under your firm.
molecule_api.MoleculeApi postTokenCrowdsale POST /molecule/v1/token/crowdsale Transfer tokens to a token's crowdsale address.
molecule_api.MoleculeApi postTokenDeploy POST /molecule/v1/token/deploy Deploy a secuirty token contract and its crowdsale contract to blockchain.
molecule_api.MoleculeApi postTokenPurchase POST /molecule/v1/token/purchase Participate in a token's crowdsale and purchase tokens.
molecule_api.MoleculeApi postTokenWhitelist POST /molecule/v1/token/whitelist Add an investor to a token's whitelist
molecule_api.MoleculeApi postWallet POST /molecule/v1/wallet Create a wallet under your firm.
molecule_api.MoleculeApi postWalletKey POST /molecule/v1/wallet_key Associate an existing key pair with a wallet defined for your firm.
molecule_api.MoleculeApi postWalletKeyGenerator POST /molecule/v1/wallet_key/generator Generate a wallet key using the Key Service and associate with a wallet defined for your firm.
molecule_api.MoleculeApi updateToken PUT /molecule/v1/token/{token_id}/ Update a token
molecule_api.MoleculeApi updateWallet PUT /molecule/v1/wallet/{wallet_id}/ Update a wallet

Documentation for Models

Documentation for Authorization

Please see this page for additional authorization information.

oauth

Author

https://www.hydrogenplatform.com/

You can’t perform that action at this time.