Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(): Unify API name with RPC #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions lib/blockchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Blockchain {
* @param {boolean}complete - 是否获取完整的block
* @returns {promise}
*/
getBlockByNum(num, complete) {
getBlockByNumber(num, complete) {
const api = 'getBlockByNumber/' + num + '/' + complete;
return this._provider.send('get', api);
}
Expand All @@ -44,7 +44,7 @@ class Blockchain {
* @param useLongestChain
* @returns {promise}
*/
getBalance(address, tokenSymbol = "iost", useLongestChain = 0)
getTokenBalance(address, tokenSymbol = "iost", useLongestChain = 0)
{
const api = 'getTokenBalance/' + address + '/' + tokenSymbol + '/' + useLongestChain;
return this._provider.send('get', api);
Expand Down Expand Up @@ -144,10 +144,10 @@ class Blockchain {
/**
* 获取account信息
* @param {string}id - 用户名
* @param {boolean}reversible - 是否从可逆链上查询
* @param {boolean}reversible - 是否从可逆链上查询(即最长链)
* @returns {promise}
*/
getAccountInfo(id, reversible) {
getAccount(id, reversible) {
const api = 'getAccount/' + id + '/' + (reversible? 1: 0);
return this._provider.send('get', api);
}
Expand All @@ -167,9 +167,9 @@ class Blockchain {
getGasUsage(actionName) {
switch (actionName) {
case "transfer":
return 7800;
return Promise.resolve(7800);
case "newAccount":
return 115000;
return Promise.resolve(115000);
}
}

Expand All @@ -178,13 +178,13 @@ class Blockchain {
* @returns {object}
*/
getExchangeContractInfo() {
return {
return Promise.resolve({
"contractID": "ContractZGVqhY3c65xRs8aoC4dUdACVCKSwhMMsg2negSFxpr3",
"minAmount": 100,
"initialRAM": 1000,
"initialGasPledged": 10
}
})
}
}

module.exports = Blockchain;
module.exports = Blockchain;