@volare.defi/mercury.js v1.0.15
mercury_api
MercuryApi - JavaScript client for mercury_api The Mercury API description This SDK is automatically generated by the OpenAPI Generator project:
- API version: 1.0
- Package version: 1.0
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
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 mercury_api --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 mercury_api 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 MercuryApi = require('mercury_api');
var api = new MercuryApi.DefaultApi()
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
};
api.appControllerHello(callback);
Documentation for API Endpoints
All URIs are relative to http://localhost
Class | Method | HTTP request | Description |
---|---|---|---|
MercuryApi.DefaultApi | appControllerHello | GET / | |
MercuryApi.EthApi | ethControllerCountFtTransfersByContract | POST /eth/ft/{contract}/transfers/count | Get amount of FT transfers. |
MercuryApi.EthApi | ethControllerFindBlkByHash | GET /eth/blks/{hash} | Get a block by hash. |
MercuryApi.EthApi | ethControllerFindBlks | POST /eth/blks | Get all blocks. |
MercuryApi.EthApi | ethControllerFindContractByAddress | POST /eth/contracts/{address} | Get a contract by address. |
MercuryApi.EthApi | ethControllerFindContracts | POST /eth/contracts | Get all contracts. |
MercuryApi.EthApi | ethControllerFindERC20 | POST /eth/contracts/erc20 | Get all ERC20. |
MercuryApi.EthApi | ethControllerFindERC20ByAddress | POST /eth/contracts/erc20/{address} | Get an ERC20 by address. |
MercuryApi.EthApi | ethControllerFindERC721 | POST /eth/contracts/erc721 | Get all ERC721. |
MercuryApi.EthApi | ethControllerFindERC721ByAddress | POST /eth/contracts/erc721/{address} | Get an ERC721 by address. |
MercuryApi.EthApi | ethControllerFindFtBalancesByContract | POST /eth/ft/{contract}/balances | Get contract's all FT balances by the owner's address. |
MercuryApi.EthApi | ethControllerFindFtTransferStats | POST /eth/ft/transfers/stats | Get all FT transfers stats. |
MercuryApi.EthApi | ethControllerFindFtTransferStatsByContract | POST /eth/ft/{contract}/transfers/stats | Get all FT transfers stats. |
MercuryApi.EthApi | ethControllerFindFtTransfers | POST /eth/ft/transfers | Get all FT transfers by the transaction hash. |
MercuryApi.EthApi | ethControllerFindFtTransfersByContract | POST /eth/ft/{contract}/transfers | Get all FT transfers. |
MercuryApi.EthApi | ethControllerFindLogs | POST /eth/logs | Get all logs. |
MercuryApi.EthApi | ethControllerFindLogsByContract | POST /eth/{contract}/logs | Get contract's all logs. |
MercuryApi.EthApi | ethControllerFindSpecificLogsByContract | POST /eth/{contract}/logs/{name} | Get contract's all logs by the event name. |
MercuryApi.EthApi | ethControllerFindTxByHash | GET /eth/txs/{hash} | Get a transaction by hash. |
MercuryApi.EthApi | ethControllerFindTxs | POST /eth/txs | Get all transactions. |
MercuryApi.EthApi | ethControllerHoldFtBalancesByContract | POST /eth/ft/{contract}/balances/hold | Get contract's all FT balances holds. |
MercuryApi.EthApi | ethControllerInsightFtBalancesByContract | POST /eth/ft/{contract}/balances/insight | Get contract's all FT balances insight. |
MercuryApi.EthApi | ethControllerNftCountMints | POST /eth/nft/mints/count | Get amount of mint NFT transfers. |
MercuryApi.EthApi | ethControllerNftCountMintsByContract | POST /eth/nft/{contract}/mints/count | Get amount of contract's mint NFT transfers. |
MercuryApi.EthApi | ethControllerNftCountTransfersByContract | POST /eth/nft/{contract}/transfers/count | Get amount of NFT transfers. |
MercuryApi.EthApi | ethControllerNftFindMetadataByContract | GET /eth/nft/{contract}/metadata/{tokenId} | Get token's metadata in the contract. |
MercuryApi.EthApi | ethControllerNftFindMints | POST /eth/nft/mints | Get all mint NFT transfers. |
MercuryApi.EthApi | ethControllerNftFindMintsByContract | POST /eth/nft/{contract}/mints | Get contract's all mint NFT transfers. |
MercuryApi.EthApi | ethControllerNftFindTokensByContract | POST /eth/nft/{contract}/tokens | Get all NFT tokens. |
MercuryApi.EthApi | ethControllerNftFindTransfersByContract | POST /eth/nft/{contract}/transfers | Get all NFT transfers. |
MercuryApi.EthApi | ethControllerNftSignClaim | POST /eth/nft/claims/sign | Sign data. |
MercuryApi.EthApi | ethControllerTrackFtBalancesByContract | POST /eth/ft/{contract}/balances/track | Get contract's all FT balances track by the owner's address. |
MercuryApi.EthApi | ethControllerUniCountSwapsByPair | POST /eth/uni/pairs/{pair}/swaps/count | Get amount of pair swaps. |
MercuryApi.EthApi | ethControllerUniFindLiquidityByPair | POST /eth/uni/pairs/{pair}/liquidity | Get all pairs liquidity. |
MercuryApi.EthApi | ethControllerUniFindPairs | POST /eth/uni/pairs | Get all pairs by the factory contract address. |
MercuryApi.EthApi | ethControllerUniFindSwapsByPair | POST /eth/uni/pairs/{pair}/swaps | Get all pair swaps. |
Documentation for Models
- MercuryApi.AttributeDto
- MercuryApi.Block
- MercuryApi.ClaimDto
- MercuryApi.Contract
- MercuryApi.Count
- MercuryApi.ERC20
- MercuryApi.ERC721
- MercuryApi.FilterDto
- MercuryApi.FtBalance
- MercuryApi.FtBalanceHold
- MercuryApi.FtBalanceInsight
- MercuryApi.FtBalanceTrack
- MercuryApi.FtTransfer
- MercuryApi.FtTransferStats
- MercuryApi.Log
- MercuryApi.Metadata
- MercuryApi.NftToken
- MercuryApi.NftTransfer
- MercuryApi.Transaction
- MercuryApi.UniswapLiquidity
- MercuryApi.UniswapPair
- MercuryApi.UniswapSwap
Documentation for Authorization
All endpoints do not require authorization.