Welcome to Makkii's Javascript Libraries.
Makkiijs is a javascript library which provides:
@makkii/makkii-core generic interfaces
@makkii/app-aion aion application client
@makkii/app-btc bitcoin application client
@makkii/app-eth ethereum application client
@makkii/app-tron tron application client
For detailed Api documentation, please refer to Makkiijs API References.
Method | Aion | BTC | ETH | LTC | TRON |
---|---|---|---|---|---|
getBlockByNumber | √ | √ | √ | √ | √ |
getBlockNumber | √ | √ | √ | √ | √ |
getCoinPrices | √ | √ | √ | √ | √ |
getBalance | √ | √ | √ | √ | √ |
getTransactionsByAddress | √ | √ | √ | √ | √ |
getTransactionStatus | √ | √ | √ | √ | √ |
getTransactionExplorerUrl | √ | √ | √ | √ | √ |
buildTransaction | √ | √ | √ | √ | √ |
sendTransaction | √ | √ | √ | (only support LocalSigner) | (only support LocalSigner) |
getTokenIconUrl | √ | ||||
getTokenDetail | √ | √ | |||
getAccountTokenTransferHistory | √ | √ | |||
getAccountTokens | √ | √ | |||
getAccountTokenBalance | √ | √ | |||
getTopTokens | √ | √ | |||
searchTokens | √ | √ | |||
sameAddress | √ | √ | √ | √ | √ |
method | Aion | BTC | ETH | LTC | TRON |
---|---|---|---|---|---|
generateMnemonic | √ | √ | √ | √ | √ |
getAccountFromMnemonic | √ | √ | √ | √ | √ |
getAccountFromHardware | √ | √ | √ | ||
recoverKeyPairByPrivateKey | √ | √ | √ | √ | √ |
signTransaction | √ | √ | √ | (only support LocalSigner) | (only support LocalSigner) |
validateAddress | √ | √ | √ | √ | √ |
validatePrivateKey | √ | √ | √ | √ | √ |
$ yarn add https://github.com/makkii-dev/makkii-js
$ npm install @makkii/makkii-core
$ npm install @makkii/app-<coin symbol>
import { AionApiClient, AionKeystoreClient, AionLocalSigner } from '@makkii/app-aion';
const api_client = new AionApiClient({
network: 'mainnet',
jsonrpc: '***'
});
api_client.getBalance('0x...')
.then(console.log)
.catch(error=>console.log(error));
const keystore_client = new AionKeystoreClient();
api_client.buildTransaction(
'0x...', // from address
'0x...', // to address
0, // amount
{
gasPrice: 10,
gasLimit: 21000,
isTokenTransfer: false
}
).then(function(unsignedTx) {
keystore_client.signTransaction(unsignedTx, new AionLocalSigner(), {
private_key: '***'
}).then(function(signedTx) {
console.log(signedTx);
});
});
import { ApiClient, KeystoreClient } from '@makkii/makkii-core';
import { AionApiClient, AionKeystoreClient, AionLocalSigner } from '@makkii/app-aion';
import { BtcApiClient, BtcKeystoreClient } from '@makkii/app-btc';
// api client usage
const api_client = new ApiClient();
api_client.addCoin('aion', new AionApiClient({
network: 'mainnet',
jsonrpc: '***'
}));
api_client.addCoin('btc', new BtcApiClient({
network: 'BTC',
insight_api: '***'
}));
api_client.getBalance('aion', '0x...')
.then(console.log)
.catch(error=>console.log(error));
// keystore client usage
const keystore_client = new KeystoreClient();
keystore_client.addCoin('aion', new AionKeystoreClient());
keystore_client.addCoin('btc', new BtcKeystoreClient('BTC'));
api_client.buildTransaction(
'aion',
'0x...', // from address
'0x...', // to address
0, // amount
{
gasPrice: 10,
gasLimit: 21000,
isTokenTransfer: false
}
).then(function(unsignedTx) {
keystore_client.signTransaction('aion', unsignedTx, new AionLocalSigner(), {
private_key: '***'
}).then(function(signedTx) {
console.log(signedTx);
});
});
Aion ledger implementation replies on ledger hw-transport interface
import Transport from '@ledgerhq/hw-transport-u2f';
import { AionLedger } from '@makkii/app-aion';
const aion_ledger = new AionLedger();
Transport.create().then(function(transport) {
aion_ledger.setLedgerTransport(transport);
aion_ledger.getHardwareStatus().then(status=> {
if (status) {
aion_ledger.getAccount(0).then(account => {
console.log(account.address);
console.log(account.index);
});
}
});
})
You need to have a recent Node.js and Yarn installed.
You also need to install lerna globally.
$ lerna bootstrap
yarn compile
yarn lint
yarn test
yarn doc
It will generate all API references documentation in folder './html'
This will automatically generate Api section in README.md under all packages.
- Make sure you have right in Chaion org on NPM
- Login NPM
$ npm login
$ npm whoami
- Publish to npm repository
$ yarn publish
- Tag and release with change logs
If you want to contribute new coins, please refer to Add Coin Guideline