{
    "docs": [
        {
            "location": "/", 
            "text": "gex-client-js\n\n\n\n    \n\n    \n\n    \n\n    \n\n\n\n\n\n\nGalactic Exchange client tools.\n\nYou can use this library to develop browser and Node.js applications that use Galactic Exchange.\n\n\n\n\nWarning\n\n\nLibrary is still at a very early stage, so API may change significantly between minor releases (like 0.2 -\n 0.3)\n\n\n\n\n\n\nInfo\n\n\nAPI for early versions (0.1 - 0.1.27) could be found in GitHub README \n\n\n\n\nGetting Started\n\n\nInstallation\n\n\nNPM\n\n\nnpm install @galacticexchange/gex-client-js\n\n\n\n\n\nYarn\n\n\nyarn add @galacticexchange/gex-client-js\n\n\n\n\n\nInitialization\n\n\nThe package includes both non-minified version and a minified version.\nFor web browsers you will typycally use non-minified version for development and minified version for production mode.\n\nFor Node.js projects you will need to use non-minified version.\n\n\nRequire library (minified)\n\n\nconst\n \ngex\n \n=\n \nrequire\n(\n@galacticexchange/gex-client-js\n);\n\n\n\n\n\n\nRequire library (non-minified)\n\n\nconst\n \ngex\n \n=\n \nrequire\n(\n@galacticexchange/gex-client-js/src/index\n);\n\n\n\n\n\n\nInit library\n\n\nInit with web socket\n\n\nFind out the IP addess and port of the Ethereum blockchain node that you want to connect to.\n\nNote that the standard port is \n8546\n. Use the address and the port to init the library as illustrated in the example below.\n\n\nNote: your blockchain node needs to have WebSockets enabled.  \n\n\nlet\n \nip\n \n=\n \n51.0.1.99\n;\n\n\nlet\n \nport\n \n=\n \n8546\n;\n\n\ngex\n.\ninit\n(\nip\n,\n \nport\n);\n\n\n\n\n\n\nInit with web3Provider\n\n\nIf you wanna use custom web3 provider (like Metamask)\n\n\ngex\n.\ninitWithProvider\n(\nweb3Provider\n);\n\n\n\n\n\n\nInit with 2 providers (node + custom)\n\n\n\n\nWarning\n\n\nThis is temporary solution to use Metamask \n receive blockchain events at the same time. See \nAPI Specification -\n Events\n for more details.\n\n\n\n\nlet\n \nip\n \n=\n \n51.0.1.99\n;\n\n\nlet\n \nport\n \n=\n \n8546\n;\n\n\ngex\n.\ninitBothProviders\n(\nip\n,\n \nport\n,\n \nweb3Provider\n);", 
            "title": "About & Getting started"
        }, 
        {
            "location": "/#gex-client-js", 
            "text": "Galactic Exchange client tools. \nYou can use this library to develop browser and Node.js applications that use Galactic Exchange.   Warning  Library is still at a very early stage, so API may change significantly between minor releases (like 0.2 -  0.3)    Info  API for early versions (0.1 - 0.1.27) could be found in GitHub README", 
            "title": "gex-client-js"
        }, 
        {
            "location": "/#getting-started", 
            "text": "", 
            "title": "Getting Started"
        }, 
        {
            "location": "/#installation", 
            "text": "", 
            "title": "Installation"
        }, 
        {
            "location": "/#npm", 
            "text": "npm install @galacticexchange/gex-client-js", 
            "title": "NPM"
        }, 
        {
            "location": "/#yarn", 
            "text": "yarn add @galacticexchange/gex-client-js", 
            "title": "Yarn"
        }, 
        {
            "location": "/#initialization", 
            "text": "The package includes both non-minified version and a minified version.\nFor web browsers you will typycally use non-minified version for development and minified version for production mode. \nFor Node.js projects you will need to use non-minified version.", 
            "title": "Initialization"
        }, 
        {
            "location": "/#require-library-minified", 
            "text": "const   gex   =   require ( @galacticexchange/gex-client-js );", 
            "title": "Require library (minified)"
        }, 
        {
            "location": "/#require-library-non-minified", 
            "text": "const   gex   =   require ( @galacticexchange/gex-client-js/src/index );", 
            "title": "Require library (non-minified)"
        }, 
        {
            "location": "/#init-library", 
            "text": "", 
            "title": "Init library"
        }, 
        {
            "location": "/#init-with-web-socket", 
            "text": "Find out the IP addess and port of the Ethereum blockchain node that you want to connect to. \nNote that the standard port is  8546 . Use the address and the port to init the library as illustrated in the example below.  Note: your blockchain node needs to have WebSockets enabled.    let   ip   =   51.0.1.99 ;  let   port   =   8546 ;  gex . init ( ip ,   port );", 
            "title": "Init with web socket"
        }, 
        {
            "location": "/#init-with-web3provider", 
            "text": "If you wanna use custom web3 provider (like Metamask)  gex . initWithProvider ( web3Provider );", 
            "title": "Init with web3Provider"
        }, 
        {
            "location": "/#init-with-2-providers-node-custom", 
            "text": "Warning  This is temporary solution to use Metamask   receive blockchain events at the same time. See  API Specification -  Events  for more details.   let   ip   =   51.0.1.99 ;  let   port   =   8546 ;  gex . initBothProviders ( ip ,   port ,   web3Provider );", 
            "title": "Init with 2 providers (node + custom)"
        }, 
        {
            "location": "/breaking-changes/", 
            "text": "Breaking changes\n\n\nUpcoming\n\n\n// gexWeb3 object\n\n- gex.gexWeb3\n\n\n+ gex.w3\n\n\n\n\n\n\nv0.0.13 -\n v0.0.14\n\n\n// lib init\n\n-let wsAddr = \nws://0.0.0.0:8546\n;\n\n\n-gex.init(wsAddr);\n\n\n+let ip = \n0.0.0.0\n;\n\n\n+let port = \n8546\n;\n\n\n+gex.init(ip, port);\n\n\n// contract objects \n\n-gex.tokenContract()\n\n\n+gex.token()\n\n\n\n-gex.managerContract()\n\n\n+gex.manager()\n\n\n// name parameter for createMchain, createAggregationMchain, basicMchain =\n mChain\n\n-gex.managerContract().createBasicMchain(98764, 6000, 12345, 4444);\n\n\n+gex.manager().createMchain(98764, 6000, 12345, 4444, \ntest\n);\n\n\n\n-gex.managerContract().createAggregationMchain(98764, 6000, 12345, 4444);\n\n\n+gex.manager().createAggregationMchain(98764, 6000, 12345, 4444, \ntest\n);\n\n\n// event names updated\n\n-gex.managerContract().events.BasicChannelCreated()\n\n\n+gex.manager().events.MchainCreated()\n\n\n\n-gex.managerContract().events.AggregationChannelCreated()\n\n\n+gex.manager().events.AggregationMchainCreated()\n\n\n// mChain \n aggregationChain getters\n\n-gex.managerContract().getBasicChannelList()\n\n\n+gex.manager().getMchainList()\n\n\n\n-gex.managerContract().getBasicChannelListInfo()\n\n\n+gex.manager().getBasicChannelListInfo()\n\n\n\n-gex.managerContract().getAggregationChannelListInfo()\n\n\n+gex.manager().getAggregationMchainListInfo()\n\n\n\n-gex.managerContract().getBasicChannel(id)\n\n\n+gex.manager().getMchain(id)", 
            "title": "Breaking changes"
        }, 
        {
            "location": "/breaking-changes/#breaking-changes", 
            "text": "", 
            "title": "Breaking changes"
        }, 
        {
            "location": "/breaking-changes/#upcoming", 
            "text": "// gexWeb3 object - gex.gexWeb3  + gex.w3", 
            "title": "Upcoming"
        }, 
        {
            "location": "/breaking-changes/#v0013-v0014", 
            "text": "// lib init -let wsAddr =  ws://0.0.0.0:8546 ;  -gex.init(wsAddr);  +let ip =  0.0.0.0 ;  +let port =  8546 ;  +gex.init(ip, port); \n\n// contract objects  -gex.tokenContract()  +gex.token()  -gex.managerContract()  +gex.manager() \n\n// name parameter for createMchain, createAggregationMchain, basicMchain =  mChain -gex.managerContract().createBasicMchain(98764, 6000, 12345, 4444);  +gex.manager().createMchain(98764, 6000, 12345, 4444,  test );  -gex.managerContract().createAggregationMchain(98764, 6000, 12345, 4444);  +gex.manager().createAggregationMchain(98764, 6000, 12345, 4444,  test ); \n\n// event names updated -gex.managerContract().events.BasicChannelCreated()  +gex.manager().events.MchainCreated()  -gex.managerContract().events.AggregationChannelCreated()  +gex.manager().events.AggregationMchainCreated() \n\n// mChain   aggregationChain getters -gex.managerContract().getBasicChannelList()  +gex.manager().getMchainList()  -gex.managerContract().getBasicChannelListInfo()  +gex.manager().getBasicChannelListInfo()  -gex.managerContract().getAggregationChannelListInfo()  +gex.manager().getAggregationMchainListInfo()  -gex.managerContract().getBasicChannel(id)  +gex.manager().getMchain(id)", 
            "title": "v0.0.13 -&gt; v0.0.14"
        }, 
        {
            "location": "/v0.2/node-manager/", 
            "text": "Node manager API\n\n\nModule: \ngex.manager()\n\n\nCreate mChain\n\n\nmChain is used to execute transactions and smart contracts.  \n\n\nMethod: \ncreateMchain(storageBytes, lifetime, maxNodes, deposit, name)\n\nType: transaction  \n\n\nParams: \n\n- storage bytes\n- lifetime of the chain (in seconds)\n- number of nodes in chain\n- deposit\n\n\nUsage: \n\n\nlet\n \nstorageBytes\n \n=\n \n1111\n;\n\n\nlet\n \nlifetime\n \n=\n \n355\n;\n\n\nlet\n \nmaxNodes\n \n=\n \n123\n;\n\n\nlet\n \ndeposit\n \n=\n \n4444\n;\n\n\nlet\n \nname\n \n=\n \ntest\n;\n\n\ngex\n.\nmanager\n().\ncreateMchain\n(\nstorageBytes\n,\n \nlifetime\n,\n \nmaxNodes\n,\n \ndeposit\n);\n\n\n\n\n\n\nCreate aggregation mChain\n\n\nMethod: \ncreateAggregationMchain(storageBytes, lifetime, maxNodes, deposit, name)\n\nType: transaction  \n\n\nParams: \n\n- storage bytes\n- lifetime of the chain (in seconds)\n- number of nodes in chain\n- deposit  \n\n\nUsage: \n\n\nlet\n \nstorageBytes\n \n=\n \n245678\n;\n\n\nlet\n \nlifetime\n \n=\n \n3456789\n;\n\n\nlet\n \nmaxNodes\n \n=\n \n444\n;\n\n\nlet\n \ndeposit\n \n=\n \n8909\n;\n\n\nlet\n \nname\n \n=\n \ntest\n;\n\n\ngex\n.\nmanager\n().\ncreateAggregationMchain\n(\nstorageBytes\n,\n \nlifetime\n,\n \nmaxNodes\n,\n \ndeposit\n,\n \nname\n);\n\n\n\n\n\n\nGet basic mChain\n\n\nGet info for basic Mchain by id\n\n\nMethod: \ngetMchain(id)\n\nType: call \n\n\nParams:\n\n- id: mChain id (integer) \n\n\nUsage: \n\n\nasync\n \nfunction\n \ntest\n()\n \n{\n\n  \nlet\n \nMchain\n \n=\n \nawait\n \ngex\n.\nmanager\n().\ngetMchain\n(\n2\n);\n\n  \nconsole\n.\nlog\n(\nMchain\n);\n\n\n}\n\n\n\n\n\n\nGet basic mChain list (with info)\n\n\nGet an array of basic mChains for current account (with info)\n\n\nMethod: \ngetMchainListInfo()\n\nType: call \n\n\nUsage: \n\n\nasync\n \nfunction\n \ntest\n()\n \n{\n\n  \nlet\n \nMchainsInfo\n \n=\n \nawait\n \ngex\n.\nmanager\n().\ngetMchainListInfo\n();\n\n  \nconsole\n.\nlog\n(\nMchainsInfo\n);\n\n\n}\n\n\n\n\n\n\nGet basic mChain list (id only)\n\n\nasync\n \nfunction\n \ntest\n()\n \n{\n\n  \nlet\n \nMchainsIds\n \n=\n \nawait\n \ngex\n.\nmanager\n().\ngetMchainList\n();\n\n  \nconsole\n.\nlog\n(\nMchainsIds\n);\n\n\n}\n\n\n\n\n\n\nSame for aggregation mChains:\n\n\nasync\n \nfunction\n \ntest\n()\n \n{\n\n  \nlet\n \naggrMchainsIds\n \n=\n \nawait\n \ngex\n.\nmanager\n().\ngetAggregationMchainList\n();\n\n  \nlet\n \naggrMchain\n \n=\n \nawait\n \ngex\n.\nmanager\n().\ngetAggregationMchain\n(\n2\n);\n\n  \nlet\n \naggrMchains\n \n=\n \nawait\n \ngex\n.\nmanager\n().\ngetAggregationMchainListInfo\n();\n\n\n}\n\n\n\n\n\n\nGet list of mChains for aggregation mChain\n\n\nMethod: \ngetMchainListInfoFromAggregationMchain(id)\n\nType: call  \n\n\nParams: \n\n- id: id of aggregation mChain\n\n\nReturns:\n\n- Array of \nmChain\n objects: \n\n\n{\n\n  \nmChainID\n:\n \nString\n;\n\n  \nowner\n:\n \nString\n;\n\n  \nname\n:\n \nString\n;\n\n  \nstorageBytes\n:\n \nString\n;\n\n  \nlifetime\n:\n \nString\n;\n \n// in seconds\n\n  \ncreationDate\n:\n \nString\n;\n \n// in seconds\n\n  \nmaxNodes\n:\n \nString\n;\n\n  \ndeposit\n:\n \nString\n\n\n}\n\n\n\n\n\n\nUsage: \n\n\nlet\n \nmChains\n \n=\n \nawait\n \ngex\n.\nmanager\n().\ngetMchainListInfoFromAggregationMchain\n(\nid\n);\n\n\n\n\n\n\nWithdraw from mChain\n\n\nMethod: \nwithdrawFromMchain()\n\nType: transaction\n\n\nParams: \n-  index: Index of mchain in the mchains list\n\n\nUsage:\n\n\ngex\n.\nmanager\n().\nwithdrawFromMchain\n(\n4\n);\n\n\n\n\n\n\nWithdraw from aggregation mChain\n\n\nMethod: \nwithdrawFromAggregationMchain()\n\nType: transaction\n\n\nParams: \n-  index: Index of aggregation mchain in the aggregationMchain list\n\n\nUsage:\n\n\ngex\n.\nmanager\n().\nwithdrawFromAggregationMchain\n(\n4\n);\n\n\n\n\n\n\nNode functions (dev only)\n\n\nCreate node\n\n\nMethod: \ncreateNode()\n\nType: transaction\n\n\nParams: \n-  ip (integer)\n- port (integer)\n\n\nUsage:\n\n\n// lib init, then:\n\n\nlet\n \nip\n \n=\n \n255.255.255.255\n;\n\n\nlet\n \nport\n \n=\n \n6000\n;\n\n\ngex\n.\nmanager\n().\ncreateNode\n(\nip\n,\n \nport\n);", 
            "title": "Node manager API"
        }, 
        {
            "location": "/v0.2/node-manager/#node-manager-api", 
            "text": "Module:  gex.manager()", 
            "title": "Node manager API"
        }, 
        {
            "location": "/v0.2/node-manager/#create-mchain", 
            "text": "mChain is used to execute transactions and smart contracts.    Method:  createMchain(storageBytes, lifetime, maxNodes, deposit, name) \nType: transaction    Params:  \n- storage bytes\n- lifetime of the chain (in seconds)\n- number of nodes in chain\n- deposit  Usage:   let   storageBytes   =   1111 ;  let   lifetime   =   355 ;  let   maxNodes   =   123 ;  let   deposit   =   4444 ;  let   name   =   test ;  gex . manager (). createMchain ( storageBytes ,   lifetime ,   maxNodes ,   deposit );", 
            "title": "Create mChain"
        }, 
        {
            "location": "/v0.2/node-manager/#create-aggregation-mchain", 
            "text": "Method:  createAggregationMchain(storageBytes, lifetime, maxNodes, deposit, name) \nType: transaction    Params:  \n- storage bytes\n- lifetime of the chain (in seconds)\n- number of nodes in chain\n- deposit    Usage:   let   storageBytes   =   245678 ;  let   lifetime   =   3456789 ;  let   maxNodes   =   444 ;  let   deposit   =   8909 ;  let   name   =   test ;  gex . manager (). createAggregationMchain ( storageBytes ,   lifetime ,   maxNodes ,   deposit ,   name );", 
            "title": "Create aggregation mChain"
        }, 
        {
            "location": "/v0.2/node-manager/#get-basic-mchain", 
            "text": "Get info for basic Mchain by id  Method:  getMchain(id) \nType: call   Params: \n- id: mChain id (integer)   Usage:   async   function   test ()   { \n   let   Mchain   =   await   gex . manager (). getMchain ( 2 ); \n   console . log ( Mchain );  }", 
            "title": "Get basic mChain"
        }, 
        {
            "location": "/v0.2/node-manager/#get-basic-mchain-list-with-info", 
            "text": "Get an array of basic mChains for current account (with info)  Method:  getMchainListInfo() \nType: call   Usage:   async   function   test ()   { \n   let   MchainsInfo   =   await   gex . manager (). getMchainListInfo (); \n   console . log ( MchainsInfo );  }", 
            "title": "Get basic mChain list (with info)"
        }, 
        {
            "location": "/v0.2/node-manager/#get-basic-mchain-list-id-only", 
            "text": "async   function   test ()   { \n   let   MchainsIds   =   await   gex . manager (). getMchainList (); \n   console . log ( MchainsIds );  }", 
            "title": "Get basic mChain list (id only)"
        }, 
        {
            "location": "/v0.2/node-manager/#same-for-aggregation-mchains", 
            "text": "async   function   test ()   { \n   let   aggrMchainsIds   =   await   gex . manager (). getAggregationMchainList (); \n   let   aggrMchain   =   await   gex . manager (). getAggregationMchain ( 2 ); \n   let   aggrMchains   =   await   gex . manager (). getAggregationMchainListInfo ();  }", 
            "title": "Same for aggregation mChains:"
        }, 
        {
            "location": "/v0.2/node-manager/#get-list-of-mchains-for-aggregation-mchain", 
            "text": "Method:  getMchainListInfoFromAggregationMchain(id) \nType: call    Params:  \n- id: id of aggregation mChain  Returns: \n- Array of  mChain  objects:   { \n   mChainID :   String ; \n   owner :   String ; \n   name :   String ; \n   storageBytes :   String ; \n   lifetime :   String ;   // in seconds \n   creationDate :   String ;   // in seconds \n   maxNodes :   String ; \n   deposit :   String  }   Usage:   let   mChains   =   await   gex . manager (). getMchainListInfoFromAggregationMchain ( id );", 
            "title": "Get list of mChains for aggregation mChain"
        }, 
        {
            "location": "/v0.2/node-manager/#withdraw-from-mchain", 
            "text": "Method:  withdrawFromMchain() \nType: transaction  Params: \n-  index: Index of mchain in the mchains list  Usage:  gex . manager (). withdrawFromMchain ( 4 );", 
            "title": "Withdraw from mChain"
        }, 
        {
            "location": "/v0.2/node-manager/#withdraw-from-aggregation-mchain", 
            "text": "Method:  withdrawFromAggregationMchain() \nType: transaction  Params: \n-  index: Index of aggregation mchain in the aggregationMchain list  Usage:  gex . manager (). withdrawFromAggregationMchain ( 4 );", 
            "title": "Withdraw from aggregation mChain"
        }, 
        {
            "location": "/v0.2/node-manager/#node-functions-dev-only", 
            "text": "", 
            "title": "Node functions (dev only)"
        }, 
        {
            "location": "/v0.2/node-manager/#create-node", 
            "text": "Method:  createNode() \nType: transaction  Params: \n-  ip (integer)\n- port (integer)  Usage:  // lib init, then:  let   ip   =   255.255.255.255 ;  let   port   =   6000 ;  gex . manager (). createNode ( ip ,   port );", 
            "title": "Create node"
        }, 
        {
            "location": "/v0.2/exchange-bot/", 
            "text": "Exchange bot API\n\n\nModule: \ngex.bot()\n\n\nExchange\n\n\nExchange \neth\n to \ngex\n\n\nMethod: \ndepositEth(value)\n\nType: transaction\n\n\nParams: \n\n- value: \neth\n value (in \nwei\n) that you want to change to \ngex\n tokens.  \n\n\nReturns:\n\n- Promise: Javascript promise object.\n\n\nUsage: \n\n\n    \nlet\n \nethVal\n \n=\n \n10\n;\n\n    \nlet\n \nweiVal\n \n=\n \ngex\n.\nw3\n.\nweb3\n.\nutils\n.\ntoWei\n(\nethVal\n);\n\n    \nlet\n \npromiseRes\n \n=\n \ngex\n.\nbot\n().\ndepositEth\n(\nweiVal\n);\n\n\n\n\n\n\nExchange \ngex\n to \neth\n\n\nMethod: \ndepositGex(value)\n\nType: transaction\n\n\nParams: \n\n- value: \ngex\n tokens amount that you want to change to \neth\n.  \n\n\nReturns:\n\n- Promise: Javascript promise object.\n\n\nUsage: \n\n\n    \nlet\n \ngexTokensToChange\n \n=\n \n100\n;\n\n    \nlet\n \nweiGexVal\n \n=\n \ngex\n.\nw3\n.\nweb3\n.\nutils\n.\ntoWei\n(\ngexTokensToChange\n);\n\n    \nlet\n \npromiseRes\n \n=\n \ngex\n.\nbot\n().\ndepositGex\n(\nweiGexVal\n);\n\n\n\n\n\n\nReturn \neth\n from bot balance\n\n\nMethod: \nreturnEth()\n\nType: transaction\n\n\nReturns:\n\n- Promise: Javascript promise object.\n\n\nUsage: \n\n\n    \nlet\n \npromiseRes\n \n=\n \ngex\n.\nbot\n().\nreturnEth\n();\n\n\n\n\n\n\nReturn \ngex\n from bot balance\n\n\nMethod: \nreturnGex()\n\nType: transaction\n\n\nReturns:\n\n- Promise: Javascript promise object.\n\n\nUsage: \n\n\n    \nlet\n \npromiseRes\n \n=\n \ngex\n.\nbot\n().\nreturnGex\n();\n\n\n\n\n\n\nInfo\n\n\nGet info for account\n\n\nMethod: \ngetInfoForAccount(account)\n\nType: call\n\n\nParams: \n\n- account: Ethereum account address in format \n'0x000....\n.  (optional)\n\nIf you don't send account param, \naccounts[0]\n from your web3 provider will be taken\n\n\nReturns:\n\n- Promise that resolves in Object: \n\n\n{ \n    active: bool,\n    amountEth: string,\n    amountGex: string,\n    loanEth: \nstring,\n    loanGex: string,\n    sendEth: string,\n    sendGex: string \n}\n\n\n\n\n\nUsage: \n\n\n    \nlet\n \naccount\n \n=\n \n0x0000...\n;\n\n    \nlet\n \naccountInfo\n \n=\n \nawait\n \ngex\n.\nbot\n().\ngetInfoForAccount\n(\naccount\n);\n\n\n    \n// or\n\n    \nlet\n \ndefaultAccountInfo\n \n=\n \nawait\n \ngex\n.\nbot\n().\ngetInfoForAccount\n();\n\n\n\n\n\n\nEvents\n\n\nMessage\n\n\nMessage event is used for most call results.\n\n\nStructure:\n\n\nevent Message(\n    string inf,\n    address sender,\n    uint88 value\n)", 
            "title": "Exchange bot API"
        }, 
        {
            "location": "/v0.2/exchange-bot/#exchange-bot-api", 
            "text": "Module:  gex.bot()", 
            "title": "Exchange bot API"
        }, 
        {
            "location": "/v0.2/exchange-bot/#exchange", 
            "text": "", 
            "title": "Exchange"
        }, 
        {
            "location": "/v0.2/exchange-bot/#exchange-eth-to-gex", 
            "text": "Method:  depositEth(value) \nType: transaction  Params:  \n- value:  eth  value (in  wei ) that you want to change to  gex  tokens.    Returns: \n- Promise: Javascript promise object.  Usage:        let   ethVal   =   10 ; \n     let   weiVal   =   gex . w3 . web3 . utils . toWei ( ethVal ); \n     let   promiseRes   =   gex . bot (). depositEth ( weiVal );", 
            "title": "Exchange eth to gex"
        }, 
        {
            "location": "/v0.2/exchange-bot/#exchange-gex-to-eth", 
            "text": "Method:  depositGex(value) \nType: transaction  Params:  \n- value:  gex  tokens amount that you want to change to  eth .    Returns: \n- Promise: Javascript promise object.  Usage:        let   gexTokensToChange   =   100 ; \n     let   weiGexVal   =   gex . w3 . web3 . utils . toWei ( gexTokensToChange ); \n     let   promiseRes   =   gex . bot (). depositGex ( weiGexVal );", 
            "title": "Exchange gex to eth"
        }, 
        {
            "location": "/v0.2/exchange-bot/#return-eth-from-bot-balance", 
            "text": "Method:  returnEth() \nType: transaction  Returns: \n- Promise: Javascript promise object.  Usage:        let   promiseRes   =   gex . bot (). returnEth ();", 
            "title": "Return eth from bot balance"
        }, 
        {
            "location": "/v0.2/exchange-bot/#return-gex-from-bot-balance", 
            "text": "Method:  returnGex() \nType: transaction  Returns: \n- Promise: Javascript promise object.  Usage:        let   promiseRes   =   gex . bot (). returnGex ();", 
            "title": "Return gex from bot balance"
        }, 
        {
            "location": "/v0.2/exchange-bot/#info", 
            "text": "", 
            "title": "Info"
        }, 
        {
            "location": "/v0.2/exchange-bot/#get-info-for-account", 
            "text": "Method:  getInfoForAccount(account) \nType: call  Params:  \n- account: Ethereum account address in format  '0x000.... .  (optional) \nIf you don't send account param,  accounts[0]  from your web3 provider will be taken  Returns: \n- Promise that resolves in Object:   { \n    active: bool,\n    amountEth: string,\n    amountGex: string,\n    loanEth:  string,\n    loanGex: string,\n    sendEth: string,\n    sendGex: string \n}  Usage:        let   account   =   0x0000... ; \n     let   accountInfo   =   await   gex . bot (). getInfoForAccount ( account ); \n\n     // or \n     let   defaultAccountInfo   =   await   gex . bot (). getInfoForAccount ();", 
            "title": "Get info for account"
        }, 
        {
            "location": "/v0.2/exchange-bot/#events", 
            "text": "", 
            "title": "Events"
        }, 
        {
            "location": "/v0.2/exchange-bot/#message", 
            "text": "Message event is used for most call results.  Structure:  event Message(\n    string inf,\n    address sender,\n    uint88 value\n)", 
            "title": "Message"
        }, 
        {
            "location": "/v0.2/events/", 
            "text": "Bug\n\n\nIMPORTANT: web3js listeners doesn't work with Metamask web3 provider.\n\n- web3 events/logs don't work properly with Metamask (\nGitHub issue\n)  \n\n- web3js v. 1.0 isn't supported yet (\nGitHub issue\n)\n\n\n\n\nFull example of nodeCreated listener usage\n\n\nconst\n \ngex\n \n=\n \nrequire\n(\n../src/index\n);\n\n\n\nclass\n \nTest\n \n{\n\n\n  \nconstructor\n(){\n\n    \nthis\n.\nval\n \n=\n \n0\n;\n\n    \nlet\n \nwsAddr\n \n=\n \nws://51.0.1.99:8546\n;\n\n    \ngex\n.\ninit\n(\nwsAddr\n);\n\n    \nthis\n.\ninitListener\n();\n\n  \n}\n\n\n  \ninitListener\n(){\n\n    \nlet\n \nself\n \n=\n \nthis\n;\n\n    \nlet\n \nlistener\n \n=\n \nnew\n \ngex\n.\nlistener\n(\ngex\n.\nmanagerContract\n().\nevents\n.\nNodeCreated\n(),\n \nfunction\n \n(\nevent\n)\n \n{\n\n      \nconsole\n.\nlog\n(\nevent\n.\nreturnValues\n);\n\n      \nself\n.\nval\n \n=\n \nevent\n.\nreturnValues\n.\nnodeID\n;\n\n      \nself\n.\ncheckValue\n();\n\n    \n});\n\n  \n}\n\n\n  \ncreateNode\n(){\n\n    \ngex\n.\ncreateNode\n(\n255.255.255.255\n,\n \n6000\n);\n\n  \n}\n\n\n  \ncheckValue\n(){\n\n    \nconsole\n.\nlog\n(\nCheck value: \n);\n\n    \nconsole\n.\nlog\n(\nthis\n.\nval\n)\n\n  \n}\n\n\n\n}\n\n\n\nlet\n \nts\n \n=\n \nnew\n \nTest\n();\n\n\nts\n.\ncreateNode\n();\n\n\n\n\n\n\nAvailable events\n\n\nUpdated for v. 0.0.14\n\nUsage example:\n\n\n// gex v. 0.0.14\n\n\nlet\n \nlistener\n \n=\n \nnew\n \ngex\n.\nlistener\n(\ngex\n.\nmanager\n().\nevents\n.\nMchainCreated\n(),\n \nfunction\n \n(\nevent\n)\n \n{\n\n   \nconsole\n.\nlog\n(\nEVENT\n);\n\n   \nconsole\n.\nlog\n(\nevent\n.\nreturnValues\n);\n\n\n});\n\n\n\n\n\n\nManager contact\n\n\n\n\nNodeCreated\n\n\nMchainCreated\n\n\nAggregationMchainCreated\n\n\nMchainAdded\n\n\n\n\nToken contact\n\n\n// todo", 
            "title": "Event listeners"
        }, 
        {
            "location": "/v0.2/events/#full-example-of-nodecreated-listener-usage", 
            "text": "const   gex   =   require ( ../src/index );  class   Test   { \n\n   constructor (){ \n     this . val   =   0 ; \n     let   wsAddr   =   ws://51.0.1.99:8546 ; \n     gex . init ( wsAddr ); \n     this . initListener (); \n   } \n\n   initListener (){ \n     let   self   =   this ; \n     let   listener   =   new   gex . listener ( gex . managerContract (). events . NodeCreated (),   function   ( event )   { \n       console . log ( event . returnValues ); \n       self . val   =   event . returnValues . nodeID ; \n       self . checkValue (); \n     }); \n   } \n\n   createNode (){ \n     gex . createNode ( 255.255.255.255 ,   6000 ); \n   } \n\n   checkValue (){ \n     console . log ( Check value:  ); \n     console . log ( this . val ) \n   }  }  let   ts   =   new   Test ();  ts . createNode ();", 
            "title": "Full example of nodeCreated listener usage"
        }, 
        {
            "location": "/v0.2/events/#available-events", 
            "text": "Updated for v. 0.0.14 \nUsage example:  // gex v. 0.0.14  let   listener   =   new   gex . listener ( gex . manager (). events . MchainCreated (),   function   ( event )   { \n    console . log ( EVENT ); \n    console . log ( event . returnValues );  });", 
            "title": "Available events"
        }, 
        {
            "location": "/v0.2/events/#manager-contact", 
            "text": "NodeCreated  MchainCreated  AggregationMchainCreated  MchainAdded", 
            "title": "Manager contact"
        }, 
        {
            "location": "/v0.2/events/#token-contact", 
            "text": "// todo", 
            "title": "Token contact"
        }, 
        {
            "location": "/other/", 
            "text": "Other stuff\n\n\nContribution\n\n\nRequirements\n\n\n\n\nNode.js\n\n\nnpm\n\n\n\n\nBuild\n\n\nnpm run build\n\n\n\n\n\nTesting (mocha)\n\n\nnpm run \ntest", 
            "title": "Other"
        }, 
        {
            "location": "/other/#other-stuff", 
            "text": "", 
            "title": "Other stuff"
        }, 
        {
            "location": "/other/#contribution", 
            "text": "", 
            "title": "Contribution"
        }, 
        {
            "location": "/other/#requirements", 
            "text": "Node.js  npm", 
            "title": "Requirements"
        }, 
        {
            "location": "/other/#build", 
            "text": "npm run build", 
            "title": "Build"
        }, 
        {
            "location": "/other/#testing-mocha", 
            "text": "npm run  test", 
            "title": "Testing (mocha)"
        }
    ]
}