/dex-api-nodejs

CoinEx DEX API for Node.js

Primary LanguageJavaScript

dex-api-nodejs

DexApiNodejs - JavaScript client for dex-api-nodejs A REST interface for state queries, transaction generation and broadcasting. This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 3.0
  • Package version: 3.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen

Run example

First install dependencies:

npm install

Then change node_module/ffi-napi/lib/librarys EXT

const EXT = Library.EXT = {
  'linux':  '.so',
  'linux2': '.so',
  'sunos':  '.so',
  'solaris':'.so',
  'freebsd':'.so',
  'openbsd':'.so',
  // 'darwin': '.dylib',
  // 'mac':    '.dylib',
  'darwin': '.so', // .dylib -> .so
  'mac':    '.so', // .dylib -> .so
  'win32':  '.dll'
}[process.platform];

Next, run babel (es6 -> es5):

npm run build

Finally, run example:

npm start

Installation

npm

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

Then install it via:

npm install dex-api-nodejs --save

Finally, you need to build the module:

npm run build
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

To use the link you just defined in your project, switch to the directory you want to use your dex-api-nodejs from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

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):

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

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

var DexApiNodejs = require('dex-api-nodejs');


var api = new DexApiNodejs.AliasApi()
var alias = superman; // {String} The alias to be queried
api.getAddressFromAlias(alias).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Documentation for API Endpoints

All URIs are relative to https://dex-api.coinex.org

Class Method HTTP request Description
DexApiNodejs.AliasApi getAddressFromAlias GET /alias/address-of-alias/{alias} Given an alias, query the corresponding address
DexApiNodejs.AliasApi getAliasParams GET /alias/parameters Get the current alias parameters
DexApiNodejs.AliasApi getAliasesFromAddress GET /alias/aliases-of-address/{address} Given an account's address, query all the corresponding aliases
DexApiNodejs.AliasApi updateAlias POST /alias/update Add or remove alias for an address
DexApiNodejs.AssetApi addWhitelist POST /asset/tokens/{symbol}/forbidden/whitelist Add forbid whitelist
DexApiNodejs.AssetApi burnToken POST /asset/tokens/{symbol}/burns Burn token
DexApiNodejs.AssetApi forbidAddr POST /asset/tokens/{symbol}/forbidden/addresses Forbid address
DexApiNodejs.AssetApi forbidToken POST /asset/tokens/{symbol}/forbids Forbid token
DexApiNodejs.AssetApi getAssetParams GET /asset/parameters Get the current asset parameters
DexApiNodejs.AssetApi getForbiddenAddresses GET /asset/tokens/{symbol}/forbidden/addresses query forbidden addresses
DexApiNodejs.AssetApi getReservedSymbols GET /asset/tokens/reserved/symbols List reserved symbols
DexApiNodejs.AssetApi getToken GET /asset/tokens/{symbol} queryToken
DexApiNodejs.AssetApi getTokenList GET /asset/tokens List tokens
DexApiNodejs.AssetApi getWhitelist GET /asset/tokens/{symbol}/forbidden/whitelist queryWhitelist
DexApiNodejs.AssetApi issueToken POST /asset/tokens Issue token
DexApiNodejs.AssetApi mintToken POST /asset/tokens/{symbol}/mints Mint token
DexApiNodejs.AssetApi modifyTokenInfo POST /asset/tokens/{symbol}/infos Modify token info
DexApiNodejs.AssetApi removeWhitelist POST /asset/tokens/{symbol}/unforbidden/whitelist Remove forbid whitelist
DexApiNodejs.AssetApi transferOwnership POST /asset/tokens/{symbol}/ownerships Transfer ownership
DexApiNodejs.AssetApi unForbidAddr POST /asset/tokens/{symbol}/unforbidden/addresses UnForbid address
DexApiNodejs.AssetApi unFrobidToken POST /asset/tokens/{symbol}/unforbids UnForbid token
DexApiNodejs.AuthApi getAccount GET /auth/accounts/{address} Get the account information on blockchain
DexApiNodejs.AuthApi getAuthParams GET /auth/parameters Get the current auth parameters
DexApiNodejs.AuthApi setReferee POST /auth/accounts/{address}/referee Set referee for account
DexApiNodejs.BancorApi queryBancorDeal GET /bancorlite/deals Query bancor market deal
DexApiNodejs.BancorliteApi bancorCancel POST /bancorlite/bancor-cancel cancel bancor
DexApiNodejs.BancorliteApi bancorInit POST /bancorlite/bancor-init create bancor
DexApiNodejs.BancorliteApi bancorTrade POST /bancorlite/bancor-trade trade with bancor
DexApiNodejs.BancorliteApi getBancorInfo GET /bancorlite/pools/{symbol} get the bancor pool info
DexApiNodejs.BancorliteApi getBancorInfos GET /bancorlite/infos get all bancor infos
DexApiNodejs.BancorliteApi getBancorliteParams GET /bancorlite/parameters Get the current bancorlite parameters
DexApiNodejs.BankApi getAddressBalances GET /bank/balances/{address} Get the account balances
DexApiNodejs.BankApi getBankParams GET /bank/parameters Get the current bankx parameters
DexApiNodejs.BankApi sendCoins POST /bank/accounts/{address}/transfers Send coins from one account to another
DexApiNodejs.BankApi setMemoRequired POST /bank/accounts/memo Mark if memo is required to receive coins
DexApiNodejs.BankApi transferSupervisedCoins POST /bank/accounts/{address}/supervised_transfers Operate a supervised transfer
DexApiNodejs.CommentApi followupComment POST /comment/followup-comment Post a follow-up comment under some thread
DexApiNodejs.CommentApi newThread POST /comment/new-thread Post a new comment to open a new thread
DexApiNodejs.CommentApi queryComment GET /comment/comments Query token comment
DexApiNodejs.CommentApi rewardComments POST /comment/reward-comments reward some comments with coins
DexApiNodejs.DistributionApi donateToCommunityPool POST /distribution/{accAddress}/donates Donate to the community pool
DexApiNodejs.DistributionApi getAllRewards GET /distribution/delegators/{delegatorAddr}/rewards Get the total rewards balance from all delegations
DexApiNodejs.DistributionApi getCommunityPool GET /distribution/community_pool Community pool parameters
DexApiNodejs.DistributionApi getDistributionInfo GET /distribution/validators/{validatorAddr} Validator distribution information
DexApiNodejs.DistributionApi getDistributionParams GET /distribution/parameters Fee distribution parameters
DexApiNodejs.DistributionApi getOutstandingRewards GET /distribution/validators/{validatorAddr}/outstanding_rewards Fee distribution outstanding rewards of a single validator
DexApiNodejs.DistributionApi getRewardByValidator GET /distribution/delegators/{delegatorAddr}/rewards/{validatorAddr} Query a delegation reward
DexApiNodejs.DistributionApi getValidatorRewards GET /distribution/validators/{validatorAddr}/rewards Commission and self-delegation rewards of a single validator
DexApiNodejs.DistributionApi getWithdrawAddress GET /distribution/delegators/{delegatorAddr}/withdraw_address Get the rewards withdrawal address
DexApiNodejs.DistributionApi setWithdrawAddress POST /distribution/delegators/{delegatorAddr}/withdraw_address Replace the rewards withdrawal address
DexApiNodejs.DistributionApi withdrawAllRewards POST /distribution/delegators/{delegatorAddr}/rewards Withdraw all the delegator's delegation rewards
DexApiNodejs.DistributionApi withdrawAllValidatorRewards POST /distribution/validators/{validatorAddr}/rewards Withdraw the validator's rewards
DexApiNodejs.DistributionApi withdrawRewardsByValidator POST /distribution/delegators/{delegatorAddr}/rewards/{validatorAddr} Withdraw a delegation reward
DexApiNodejs.ExpiryApi queryRedelegation GET /expiry/redelegations Query redelegation
DexApiNodejs.ExpiryApi queryUnbonding GET /expiry/unbondings Query Unbonding
DexApiNodejs.ExpiryApi queryUnlock GET /expiry/unlocks Query Unlock
DexApiNodejs.ExpiryApi querylocked GET /expiry/lockeds Query lock tx
DexApiNodejs.GovernanceApi depositToProposal POST /gov/proposals/{proposalId}/deposits Deposit tokens to a proposal
DexApiNodejs.GovernanceApi getDepositByAddr GET /gov/proposals/{proposalId}/deposits/{depositor} Query deposit
DexApiNodejs.GovernanceApi getDepositParameters GET /gov/parameters/deposit Query governance deposit parameters
DexApiNodejs.GovernanceApi getDeposits GET /gov/proposals/{proposalId}/deposits Query deposits
DexApiNodejs.GovernanceApi getProposalByID GET /gov/proposals/{proposalId} Query a proposal
DexApiNodejs.GovernanceApi getProposals GET /gov/proposals Query proposals
DexApiNodejs.GovernanceApi getProposer GET /gov/proposals/{proposalId}/proposer Query proposer
DexApiNodejs.GovernanceApi getTally GET /gov/proposals/{proposalId}/tally Get a proposal's tally result at the current time
DexApiNodejs.GovernanceApi getTallyingParameters GET /gov/parameters/tallying Query governance tally parameters
DexApiNodejs.GovernanceApi getVoterByAddr GET /gov/proposals/{proposalId}/votes/{voter} Query vote
DexApiNodejs.GovernanceApi getVoters GET /gov/proposals/{proposalId}/votes Query voters
DexApiNodejs.GovernanceApi getVotingParameters GET /gov/parameters/voting Query governance voting parameters
DexApiNodejs.GovernanceApi submitCommunityPoolSpendProposal POST /gov/proposals/community_pool_spend Generate a community pool spend proposal transaction
DexApiNodejs.GovernanceApi submitParameterChangeProposal POST /gov/proposals/param_change Generate a parameter change proposal transaction
DexApiNodejs.GovernanceApi submitProposal POST /gov/proposals Submit a proposal
DexApiNodejs.GovernanceApi voteProposal POST /gov/proposals/{proposalId}/votes Vote a proposal
DexApiNodejs.IncentiveApi getIncentiveParams GET /incentive/parameters Get the current incentive parameters
DexApiNodejs.MarketApi cancelOrder POST /market/cancel-order Cancel the order
DexApiNodejs.MarketApi cancelTradingPair POST /market/cancel-trading-pair Cancel the trading-pair
DexApiNodejs.MarketApi createGteOrder POST /market/gte-orders Create GTE order in blockchain
DexApiNodejs.MarketApi createIocOrder POST /market/ioc-orders Create IOC order in blockchain
DexApiNodejs.MarketApi createTradingPair POST /market/trading-pairs Create trading-pair in blockchain
DexApiNodejs.MarketApi getMarketParams GET /market/parameters Get the current market parameters
DexApiNodejs.MarketApi getOrder GET /market/orders/{order-id} Query order info
DexApiNodejs.MarketApi getOrders GET /market/orders/account/{address} Query user order-id list
DexApiNodejs.MarketApi getOrdersInMarket GET /market/orderbook/{stock}/{money} Query trading-pair's orderbook
DexApiNodejs.MarketApi getTradingPair GET /market/trading-pairs/{stock}/{money} Query trading-pair info
DexApiNodejs.MarketApi modifyPricePrecision POST /market/price-precision Modify the price precision of the trading pair in the dex
DexApiNodejs.MarketApi queryCandleStick GET /market/candle-sticks Query market candleStick
DexApiNodejs.MarketApi queryDeal GET /market/deals Query market deal
DexApiNodejs.MarketApi queryDepth GET /market/depths Query market depth
DexApiNodejs.MarketApi queryOrder GET /market/user-orders Query account's order
DexApiNodejs.MarketApi queryTickers GET /market/tickers Query market tickers
DexApiNodejs.MarketApi queryTradingPairs GET /market/exist-trading-pairs Query all trading-pair infos in blockchain
DexApiNodejs.MiscApi queryBlockTimes GET /misc/block-times Query block time
DexApiNodejs.MiscApi queryDonation GET /misc/donations Query donations info
DexApiNodejs.MiscApi queryLastBlock GET /misc/height Query least block info
DexApiNodejs.SlashApi querySlash GET /slash/slashings Query validator slash info
DexApiNodejs.SlashingApi getSigningInfo GET /slashing/validators/{validatorPubKey}/signing_info Get sign info of given validator
DexApiNodejs.SlashingApi getSigningInfos GET /slashing/signing_infos Get sign info of given all validators
DexApiNodejs.SlashingApi getSlashingParams GET /slashing/parameters Get the current slashing parameters
DexApiNodejs.SlashingApi unjailValidator POST /slashing/validators/{validatorAddr}/unjail Unjail a jailed validator
DexApiNodejs.StakingApi getDelegations GET /staking/delegators/{delegatorAddr}/delegations Get all delegations from a delegator
DexApiNodejs.StakingApi getDelegationsOfValidator GET /staking/validators/{validatorAddr}/delegations Get all delegations from a validator
DexApiNodejs.StakingApi getDelegationsToValidator GET /staking/delegators/{delegatorAddr}/delegations/{validatorAddr} Query the current delegation between a delegator and a validator
DexApiNodejs.StakingApi getDelegatorTxs GET /staking/delegators/{delegatorAddr}/txs Get all staking txs (i.e msgs) from a delegator
DexApiNodejs.StakingApi getRedelegations GET /staking/redelegations Get all redelegations (filter by query params)
DexApiNodejs.StakingApi getStakingParameters GET /staking/parameters Get the current staking parameter values
DexApiNodejs.StakingApi getStakingPool GET /staking/pool Get the current state of the staking pool
DexApiNodejs.StakingApi getUndelegationsBetween GET /staking/delegators/{delegatorAddr}/unbonding_delegations/{validatorAddr} Query all unbonding delegations between a delegator and a validator
DexApiNodejs.StakingApi getUndelegationsOfDelegator GET /staking/delegators/{delegatorAddr}/unbonding_delegations Get all unbonding delegations from a delegator
DexApiNodejs.StakingApi getUndelegationsOfValidator GET /staking/validators/{validatorAddr}/unbonding_delegations Get all unbonding delegations from a validator
DexApiNodejs.StakingApi getValidator GET /staking/validators/{validatorAddr} Query the information from a single validator
DexApiNodejs.StakingApi getValidatorOfDelegator GET /staking/delegators/{delegatorAddr}/validators/{validatorAddr} Query a validator that a delegator is bonded to
DexApiNodejs.StakingApi getValidators GET /staking/validators Get all validator candidates. By default it returns only the bonded validators.
DexApiNodejs.StakingApi getValidatorsOfDelegator GET /staking/delegators/{delegatorAddr}/validators Query all validators that a delegator is bonded to
DexApiNodejs.StakingApi submitDelegation POST /staking/delegators/{delegatorAddr}/delegations Submit delegation
DexApiNodejs.StakingApi submitRedelegation POST /staking/delegators/{delegatorAddr}/redelegations Submit a redelegation
DexApiNodejs.StakingApi undelegate POST /staking/delegators/{delegatorAddr}/unbonding_delegations Submit an unbonding delegation
DexApiNodejs.TendermintApi getBlock GET /blocks/{height} Get a block at a certain height
DexApiNodejs.TendermintApi getLatestBlock GET /blocks/latest Get the latest block
DexApiNodejs.TendermintApi getLatestValidatorSet GET /validatorsets/latest Get the latest validator set
DexApiNodejs.TendermintApi getNodeInfo GET /node_info The properties of the connected node
DexApiNodejs.TendermintApi getSyncing GET /syncing Syncing state of node
DexApiNodejs.TendermintApi getValidatorSet GET /validatorsets/{height} Get a validator set a certain height
DexApiNodejs.TransactionsApi broadcastTx POST /txs Broadcast a signed tx
DexApiNodejs.TransactionsApi encodeTx POST /txs/encode Encode a transaction to the Amino wire format
DexApiNodejs.TransactionsApi getTxByHash GET /txs/{hash} Get a Tx by hash
DexApiNodejs.TransactionsApi searchTx GET /txs Search transactions
DexApiNodejs.TxApi getTxFromTradeServer GET /tx/txs/{hash} Get a Tx from trade server by hash
DexApiNodejs.TxApi queryIncome GET /tx/incomes Query account all income until to given time
DexApiNodejs.TxApi queryTx GET /tx/txs Query transactions

Documentation for Models

Documentation for Authorization

kms

  • Type: HTTP basic authentication