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

Dev #53

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Dev #53

Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions source/zh-cn/api/fibosjs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ console.log(getInfo);
```js
fibos_client.getInfo().then(getInfo => {
console.log(getInfo);
}
}
```

#### 返回值
Expand Down Expand Up @@ -130,7 +130,7 @@ console.log(getBlock);
```js
fibos_client.getBlock(1).then(getInfo => {
console.log(getInfo);
}
}
```

#### 返回值
Expand Down Expand Up @@ -381,7 +381,7 @@ FO83msFTj6yv5U91KkiRxHcDZUXJkR6xwC9EjbqqwFqhFa1nxMYx
异步:

```js
fibos.modules.ecc.privateToPublic(PrivateKey).then(privatetopublic={
fibos.modules.ecc.privateToPublic(PrivateKey).then(privatetopublic=>{
console.log(privatetopublic);
})
/*
Expand Down Expand Up @@ -786,7 +786,7 @@ console.log(sha256);
```js
fibos.modules.ecc.sha256(data).then(recover_hash => {
console.log(recover_hash);
}
})
/*
运行结果:
8a72914b5c615a7d1f23298c7efa9d404d69f79e580de122cf0685bc0e9b45ab
Expand Down Expand Up @@ -858,7 +858,7 @@ fibos_client.getAccount(account_name);
同步:

```js
var getAccount = fibos.getAccountSync("Account Name");//账户名
var getAccount = fibos_client.getAccountSync("Account Name");//账户名
console.log(getAccount);
```

Expand All @@ -867,7 +867,7 @@ console.log(getAccount);
```js
fibos_client.getAccount("Account Name").then(getAccount => {//账户名
console.log(getAccount);
}
})
```

#### 返回值
Expand Down
8 changes: 4 additions & 4 deletions source/zh-cn/api/smartcontract/Table.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Table.lowerbound(id);

```JavaScript
exports.hi1 = v => {
var players = db.players1(action.account, action.account);
var players = db.players(action.account, action.account);
var data = players.lowerbound(123);
console.log(data.data, data1.data);
};
Expand All @@ -194,7 +194,7 @@ Table.upperbound(id);

```JavaScript
exports.hi1 = v => {
var players = db.players1(action.account, action.account);
var players = db.players(action.account, action.account);
var data1 = players.upperbound(123);
console.log(data.data, data1.data);
};
Expand All @@ -217,7 +217,7 @@ Table.toString();

```javascript
exports.hi1 = v => {
var players = db.players1(action.account, action.account);
var players = db.players(action.account, action.account);
console.log(players.toString());
};
```
Expand All @@ -244,7 +244,7 @@ Table.toJSON(key);

```javascript
exports.hi1 = key => {
var players = db.players1(action.account, action.account);
var players = db.players(action.account, action.account);
console.log(players.toJSON(key));
};
```
Expand Down
2 changes: 1 addition & 1 deletion source/zh-cn/api/smartcontract/console.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ console.error(...args);

```JavaScript
exports.hi = v => {
console.warn('hello FIBOS')
console.error('hello FIBOS')
};
```

Expand Down
2 changes: 1 addition & 1 deletion source/zh-cn/api/smartcontract/db.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ db.table(scope,code,indexes);

使用 db 模块首先我们需要在 abi 文件中定义数据表的表名、表结构和主键等信息,如下所示:
```
var db_abi = {
{
"version": "eosio::abi/1.0",
"types": [{
"new_type_name": "my_account_name",
Expand Down
14 changes: 7 additions & 7 deletions source/zh-cn/api/smartcontract/dbiterator.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exports.hi1 = v => {
var players = db.players(action.account, action.account);
var itr = players.find(v);
console.log(itr.data);
}
};
```

## 成员函数
Expand All @@ -44,7 +44,7 @@ exports.hi1 = v => {
var players = db.players(action.account, action.account);
var itr = players.find(v);
console.log(itr.is_begin());
}
};
```


Expand All @@ -64,7 +64,7 @@ exports.hi1 = v => {
var players = db.players(action.account, action.account);
var itr = players.find(v);
console.log(itr.is_end());
}
};
```


Expand All @@ -83,7 +83,7 @@ exports.hi1 = v => {
var itr = players.find(v);
var itr1 = itr.next();
console.log(itr1.toJSON());
}
};
```


Expand All @@ -103,7 +103,7 @@ exports.hi1 = v => {
var itr1 = itr.next();
var itr2 = itr1.previous();
console.log(itr2.toJSON());
}
};
```


Expand All @@ -121,7 +121,7 @@ exports.hi1 = v => {
var players = db.players(action.account, action.account);
var itr = players.find(v);
itr.remove();
}
};
```


Expand All @@ -143,7 +143,7 @@ exports.hi1 = v => {
var itr = players.find(v);
itr.data.age = 18;
itr.update(action.account);
}
};
```


Expand Down
2 changes: 1 addition & 1 deletion source/zh-cn/api/smartcontract/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ action.has_auth(name);

```JavaScript
exports.hi = v => {
if (action.has_auth(account));
if (action.has_auth(account))
console.notice("action be authed");
};
```
Expand Down
2 changes: 1 addition & 1 deletion source/zh-cn/guide/smart-contract-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exports.hi = account => {

```javascript
exports.hi = account => {
if (action.has_auth(account)){
){
console.notice("action be authed");
}
};
Expand Down
2 changes: 1 addition & 1 deletion source/zh-cn/guide/token-wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,6 @@ exports.settle = (user, minutes) => {

关于 JavaScript 合约如何发布,请参考 [快速入门](./start.html)。

通过上面的 JavaScript 合约,我们可以看到,`assert.isTrue(minutes > 0, 'minutes must be positive');`用于判断骑行时间的正确性。然后我们根据骑行时长计算出用户所需支付的通证数量,构造了一个`extended_asset`对象,作为参数,使用`send_inline`的方式调用`eosio.token`合约的`ctxtransfer`,将用户的子钱包资产转账至合约的发布者(fobikeissuer)的子钱包资产中。(关于合约之间的调用,下一期的文档我们会详细介绍,敬请期待!)
通过上面的 JavaScript 合约,我们可以看到,`assert.isTrue(minutes > 0, 'minutes must be positive');`用于判断骑行时间的正确性。然后我们根据骑行时长计算出用户所需支付的通证数量,构造了一个`extended_asset`对象,作为参数,使用`send_inline`的方式调用`eosio.token`合约的`ctxtransfer`,将用户的子钱包资产转账至合约的发布者(fobikeissuer)的子钱包资产中。

这样,一个最简单的用于扣费的 JavaScript 合约就完成了。关于合约子钱包,还有很多有趣的玩法,欢迎大家踊跃发言,让我们共同进步!
2 changes: 1 addition & 1 deletion source/zh-cn/guide/tutorials-testcase.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ todos# 1n removed
[(todolistdapp,destory)->todolistdapp]: CONSOLE OUTPUT END =====================
√ user delete record (211ms)

5 tests completed (3709ms)
4 tests completed (3709ms)
```

本文 GitHub 源码:<https://github.com/fengluo/fibos-todomvc> 下的 `test` 文件夹。
Expand Down