Dapp node sdk with metrics configuration
npm install fabric-ca-client
-
Before installing, download and install Node.js.
-
Grant access permission for registry https://npm.pkg.github.com/
Create file .npmrc
// Linux/MacOS command touch .npmrc
Config registry to install akaChain SDK
// Linux/MacOS command echo "registry=https://npm.pkg.github.com/Akachain" >> .npmrc
Get your personal access token on github: Access to gibhub, choose settings at right-top of page. Click on Developer settings, Personal access tokens then generate your token. Copy it to replace your_token in the following command
// Linux/MacOS command echo "//npm.pkg.github.com/:_authToken=your_token" >> .npmrc
-
Installation is done using the
npm install
command:npm install @akachain/akc-node-sdk
// import sdk
const akcSdk = require('@akachain/akc-node-sdk');
...
// invoke example
const invokeResult = await akcSdk.invoke(peerNames, channelName, chaincodeName, fcn, args, orgName, userName);
Function | Parameters | Note |
---|---|---|
registerUser |
user: { orgname, username, enrollmentSecret (optional), role (optional), affiliation (optional), maxEnrollments (optional), attrs (optional) } | |
enrollUser |
user: { orgname, username } | |
tlsEnroll |
client | |
getClientForOrg |
orgName, userName (optional), isRefresh (optional) | |
getChannel |
orgName, userName (optional), channelName, isRefresh (optional) | |
invoke |
peerNames, channelName, chaincodeName, fcn, args, orgName, userName | |
query |
peerNames, channelName, chaincodeName, fcn, args, orgName, userName | |
getBlockByNumber |
peerName, channelName, blockNumber, orgName, userName | |
getTransactionByID |
peerName, channelName, trxnID, orgName, userName | |
getBlockByHash |
peerName, channelName, hash, orgName, userName | |
getChainInfo |
peerName, channelName, orgName, userName | |
getInstalledChaincodes |
peerName, channelName, type, orgName, userName | |
getLogger |
moduleName | |
crawlBlock |
blockNumberOrHash, option | |
installChaincode |
orgName, request: { chaincodePath, chaincodeId, metadataPath, chaincodeVersion, chaincodeType } | |
initChaincode |
orgName, channelName, request: { chaincodeId, chaincodeVersion, chaincodeType, args } | |
upgradeChaincode |
orgName, channelName, request { chaincodeId, chaincodeVersion, chaincodeType, args } |