cos-sdk-js v1.0.0
cos-sdk-js
cos-sdk-js - JavaScript SDK for accessing contentos chain.
This SDK is automatically generated by the Swagger Codegen project with contentos Swagger-apis
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 cos-sdk-js --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, that's to say your javascript file where you actually
use this library):
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 Cos = require('cos-sdk-js');
var api = new Cos.ApiServiceApi()
var body = new rpc.GrpcpbGetAccountByNameRequest();
var account_name = new rpc.PrototypeaccountName();
account_name.value = "initminer";
body.account_name = account_name;
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.getAccountByName(body, callback);
Documentation for API Endpoints
All URIs are relative to http://localhost:8080
Method | HTTP request | Description |
---|---|---|
broadcastTrx | POST /v1/broadcast_trx | |
getAccountByName | POST /v1/get_account_by_name | |
getAccountRewardByName | POST /v1/get_account_reward_by_name | |
getBlockTransactionsByNum | POST /v1/get_trx_by_num | |
getChainState | POST /v1/chain_state | |
getFollowCountByName | POST /v1/get_follow_count_by_name | |
getFollowerListByName | POST /v1/get_follower_list_by_name | |
getFollowingListByName | POST /v1/get_following_list_by_name | |
getPostListByCreated | POST /v1/get_post_list_by_created | |
getReplyListByPostId | POST /v1/get_reply_list_by_postid | |
getTrxById | POST /v1/get_trx_by_id | |
getWitnessList | POST /v1/get_witness_list |
Documentation for Models
- GrpcpbAccountResponse
- GrpcpbAccountRewardResponse
- GrpcpbBroadcastTrxRequest
- GrpcpbBroadcastTrxResponse
- GrpcpbGetAccountByNameRequest
- GrpcpbGetAccountRewardByNameRequest
- GrpcpbGetBlockTransactionsByNumRequest
- GrpcpbGetBlockTransactionsByNumResponse
- GrpcpbGetChainStateResponse
- GrpcpbGetFollowCountByNameRequest
- GrpcpbGetFollowCountByNameResponse
- GrpcpbGetFollowerListByNameRequest
- GrpcpbGetFollowerListByNameResponse
- GrpcpbGetFollowingListByNameRequest
- GrpcpbGetFollowingListByNameResponse
- GrpcpbGetPostListByCreatedRequest
- GrpcpbGetPostListByCreatedResponse
- GrpcpbGetReplyListByPostIdRequest
- GrpcpbGetReplyListByPostIdResponse
- GrpcpbGetTrxByIdRequest
- GrpcpbGetTrxByIdResponse
- GrpcpbGetWitnessListRequest
- GrpcpbGetWitnessListResponse
- GrpcpbNonParamsRequest
- GrpcpbPostResponse
- GrpcpbTableContentResponse
- GrpcpbWitnessResponse
- PrototypeaccountCreateOperation
- PrototypeaccountName
- Prototypeauthority
- PrototypebeneficiaryRouteType
- PrototypeblockHeader
- PrototypebpRegisterOperation
- PrototypebpUnregisterOperation
- PrototypebpVoteOperation
- PrototypechainProperties
- PrototypeclaimAllOperation
- PrototypeclaimOperation
- Prototypecoin
- PrototypecontractApplyOperation
- PrototypecontractDeployOperation
- PrototypecontractEstimateApplyOperation
- PrototypedynamicProperties
- PrototypeemptySignedBlock
- PrototypefollowOperation
- PrototypefollowerCreatedOrder
- PrototypefollowingCreatedOrder
- PrototypekvAccountAuth
- PrototypekvKeyAuth
- Prototypeoperation
- PrototypeoperationReceiptWithInfo
- PrototypepostCreatedOrder
- PrototypepostOperation
- PrototypepublicKeyType
- PrototypereplyCreatedOrder
- PrototypereplyOperation
- Prototypesha256
- PrototypesignatureType
- PrototypesignedBlockHeader
- PrototypesignedTransaction
- PrototypetimePointSec
- Prototypetransaction
- PrototypetransactionReceiptWithInfo
- PrototypetransferOperation
- PrototypetransferToVestingOperation
- Prototypevest
- PrototypevoteOperation
- PrototypewitnessScheduleType
- PrototypewitnessScheduleTypewitnessScheduleType
Documentation for Authorization
All endpoints do not require authorization.
5 years ago