Skip to content

Commit 83f2050

Browse files
committed
update dependencies
1 parent 776423e commit 83f2050

7 files changed

Lines changed: 69 additions & 76 deletions

File tree

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@
1010
"bignumber.js": "^2.4.0",
1111
"chainsql-keypairs": "^0.11.1",
1212
"chainsql-lib": "^1.0.3",
13-
"co": "^4.6.0",
1413
"elliptic": "^5.1.0",
1514
"hash.js": "^1.0.3",
1615
"lodash": "^4.17.21",
1716
"protobufjs": "^6.8.0",
1817
"sjcl": "~1.0.3",
1918
"web3-core-helpers": "1.0.0-beta.36",
2019
"web3-eth-abi": "1.0.0-beta.36",
21-
"web3-utils": "1.0.0-beta.36",
22-
"ws": "^7.4.4"
20+
"web3-utils": "1.0.0-beta.36"
2321
},
2422
"devDependencies": {
2523
"mocha": "~2.3.3",

src/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const Table = require('./table');
2020
const Contract = require('./smartContract');
2121
const util = require('../lib/util');
2222
const { utils } = require('elliptic');
23-
const co = require('co');
2423
const opType = require('../lib/config').opType;
2524
const convertStringToHex = util.convertStringToHex;
2625
const getCryptAlgTypeFromAccout = util.getCryptAlgTypeFromAccout;

test/server-test.js

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict'
22

33

4-
const co = require('co')
54
const ChainsqlAPI = require('../src/index');
65
const r = new ChainsqlAPI();
76
var path = require('path');
@@ -27,11 +26,11 @@ describe('server', () => {
2726
// //字段级加密
2827
// console.log("multi encrypt test:");
2928
// var listPublic = ["cBP7JPfSVPgqGfGXVJVw168sJU5HhQfPbvDRZyriyKNeYjYLVL8M", "cBPaLRSCwtsJbz4Rq4K2NvoiDZWJyL2RnfdGv5CQ2UFWqyJ7ekHM"];
30-
// var cip = yield crypto.encryptText("test",listPublic);
29+
// var cip = await crypto.encryptText("test",listPublic);
3130
// console.log("cipher:" + cip);
32-
// var text = yield crypto.decryptText(cip,"xpvPjSRCtmQ3G99Pfu1VMDMd9ET3W");
31+
// var text = await crypto.decryptText(cip,"xpvPjSRCtmQ3G99Pfu1VMDMd9ET3W");
3332
// console.log("plain text:" + text);
34-
// var text2 = yield crypto.decryptText(cip,"xnHAcvtn1eVLDskhxPKNrhTsYKqde");
33+
// var text2 = await crypto.decryptText(cip,"xnHAcvtn1eVLDskhxPKNrhTsYKqde");
3534
// console.log("plain text2:" + text2);
3635

3736
// console.log("AesPadding Test");
@@ -41,7 +40,7 @@ describe('server', () => {
4140
// console.log(aesDecrypted);
4241

4342
// // 创建表
44-
// let rs = yield r.createTable("abc", [{
43+
// let rs = await r.createTable("abc", [{
4544
// "field": "id",
4645
// "type": "int",
4746
// "length": 11,
@@ -59,47 +58,47 @@ describe('server', () => {
5958
// console.log(rs)
6059

6160
// 删除表
62-
// let rs = yield r.drop(tb);
61+
// let rs = await r.drop(tb);
6362

6463
// 重命名
65-
// let rs = yield r.rename(tb,'users');
64+
// let rs = await r.rename(tb,'users');
6665
// 授权权限
67-
// let rs = yield r.assign(tb, 'rETMNdu2UgPhLZzbnDUVRHhB6NEDahj53c', [r.perm.insert],'0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02');
66+
// let rs = await r.assign(tb, 'rETMNdu2UgPhLZzbnDUVRHhB6NEDahj53c', [r.perm.insert],'0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02');
6867
// console.log(rs)
6968
//取消授权
70-
// let rs = yield r.assignCancle('users', 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh', ['lsfUpdate']);
69+
// let rs = await r.assignCancle('users', 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh', ['lsfUpdate']);
7170
// 插入数据
72-
//let rs = yield r.table(tb).insert({name:'xiaopeng'}).submit();
73-
// let rs = yield r.table(tb).insert({name:'feipeng1'}).submit();
71+
//let rs = await r.table(tb).insert({name:'xiaopeng'}).submit();
72+
// let rs = await r.table(tb).insert({name:'feipeng1'}).submit();
7473
//删除数据
75-
// let rs = yield r.table(tb).get({id:1}).delete().submit();
74+
// let rs = await r.table(tb).get({id:1}).delete().submit();
7675
// 获取数据
77-
//let rs = yield r.table(tb).get(['id','name']).submit();
76+
//let rs = await r.table(tb).get(['id','name']).submit();
7877

7978
// 测试一个条件的情况
80-
//let rs = yield r.table(tb).get({id:{$ge:1}}).withFields(['id','name']).submit();
79+
//let rs = await r.table(tb).get({id:{$ge:1}}).withFields(['id','name']).submit();
8180

8281
// // 测试 or 条件
83-
//let rs = yield r.table(tb).get({id:{$eq:1}},{name:'feipeng1'}).withFields(['id','name']).submit();
84-
//let rs = yield r.table(tb).get({id:{$eq:1}},{name:{$eq:'feipeng1'}}).withFields(['id','name']).submit();
85-
//let rs = yield r.table(tb).get({$or:[{id:{$ge:1}},{name:'feipeng1'}]}).withFields(['id','name']).submit();
82+
//let rs = await r.table(tb).get({id:{$eq:1}},{name:'feipeng1'}).withFields(['id','name']).submit();
83+
//let rs = await r.table(tb).get({id:{$eq:1}},{name:{$eq:'feipeng1'}}).withFields(['id','name']).submit();
84+
//let rs = await r.table(tb).get({$or:[{id:{$ge:1}},{name:'feipeng1'}]}).withFields(['id','name']).submit();
8685

8786
// 测试 and 条件
88-
//let rs = yield r.table(tb).get({$and:[{id:{$ge:1}},{name:'feipeng1'}]}).withFields(['id','name']).submit();
89-
//let rs = yield r.table(tb).get([{id:{$ge:1},name:'feipeng1'}]).withFields(['id','name']).submit();
90-
//let rs = yield r.table(tb).get([{id:{$ge:1},name:{$eq:'feipeng1'}}]).withFields(['id','name']).submit();
87+
//let rs = await r.table(tb).get({$and:[{id:{$ge:1}},{name:'feipeng1'}]}).withFields(['id','name']).submit();
88+
//let rs = await r.table(tb).get([{id:{$ge:1},name:'feipeng1'}]).withFields(['id','name']).submit();
89+
//let rs = await r.table(tb).get([{id:{$ge:1},name:{$eq:'feipeng1'}}]).withFields(['id','name']).submit();
9190

9291
// 测试 limit
93-
//let rs = yield r.table(tb).get({id:{$eq:1}},{name:'feipeng1'},{$limit:{index:0,total:1}}).withFields(['id','name']).submit();
92+
//let rs = await r.table(tb).get({id:{$eq:1}},{name:'feipeng1'},{$limit:{index:0,total:1}}).withFields(['id','name']).submit();
9493
// order by asc
95-
//let rs = yield r.table(tb).get({id:{$eq:1}},{name:'feipeng1'},{$limit:{index:0,total:2},$order:[{id:1}]}).withFields(['id','name']).submit();
94+
//let rs = await r.table(tb).get({id:{$eq:1}},{name:'feipeng1'},{$limit:{index:0,total:2},$order:[{id:1}]}).withFields(['id','name']).submit();
9695
// order by desc
97-
// let rs = yield r.table(tb).get({id:{$eq:1}},{name:'feipeng1'},{$limit:{index:0,total:2},$order:[{id:-1}]}).withFields(['id','name']).submit();
96+
// let rs = await r.table(tb).get({id:{$eq:1}},{name:'feipeng1'},{$limit:{index:0,total:2},$order:[{id:-1}]}).withFields(['id','name']).submit();
9897

9998
//更新数据
100-
// let rs = yield r.table(tb).update({name:'xiaopeng'},{id:2}).submit();
99+
// let rs = await r.table(tb).update({name:'xiaopeng'},{id:2}).submit();
101100
// 获取所有交易
102-
// let rs = yield r.getTransactions({limit:10,types:['sqlStatement']});
101+
// let rs = await r.getTransactions({limit:10,types:['sqlStatement']});
103102
//
104103
// console.log(rs)
105104
// 事务操作
@@ -127,7 +126,7 @@ describe('server', () => {
127126
// }],{confidential:true});
128127
// r.table(tb).insert({id:33,name:'xiaopeng454'});
129128
// r.table(tb).insert({id:34,name:'feipeng14544'});
130-
// var data = yield r.commit();
129+
// var data = await r.commit();
131130
// console.log('data',data)
132131
} catch (e) {
133132
console.log(e)

test/server.js

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33

4-
const co = require('co')
4+
55
const ChainsqlAPI = require('../src/index');
66
const r = new ChainsqlAPI();
77
var path = require('path');
@@ -10,11 +10,12 @@ var common = require(basePath);
1010
var crypto = require('../lib/crypto');
1111
const keypairs = require('chainsql-keypairs-test');
1212

13-
co(function*() {
13+
main();
14+
async function main(){
1415
try {
15-
// yield r.connect('ws://127.0.0.1:6007');
16-
//yield r.connect('ws://139.198.11.189:6006');
17-
yield r.connect('ws://192.168.0.14:6006');
16+
// await r.connect('ws://127.0.0.1:6007');
17+
//await r.connect('ws://139.198.11.189:6006');
18+
await r.connect('ws://192.168.0.14:6006');
1819
// console.log('连接成功')
1920
// var tb = 'test13323333';
2021

@@ -24,7 +25,7 @@ co(function*() {
2425
// });
2526
// r.setRestrict(true);
2627

27-
// // var data = yield r.api.getLedger();
28+
// // var data = await r.api.getLedger();
2829
// // console.log(data);
2930
// r.api.getLedger({ledgerVersion:1732000}).then(function(data){
3031
// console.log(data);
@@ -41,11 +42,11 @@ co(function*() {
4142
//字段级加密
4243
console.log("multi encrypt test:");
4344
var listPublic = ["cBP7JPfSVPgqGfGXVJVw168sJU5HhQfPbvDRZyriyKNeYjYLVL8M", "cBPaLRSCwtsJbz4Rq4K2NvoiDZWJyL2RnfdGv5CQ2UFWqyJ7ekHM"];
44-
var cip = yield crypto.encryptText("test",listPublic);
45+
var cip = await crypto.encryptText("test",listPublic);
4546
console.log("cipher:" + cip);
46-
var text = yield crypto.decryptText(cip,"xpvPjSRCtmQ3G99Pfu1VMDMd9ET3W");
47+
var text = await crypto.decryptText(cip,"xpvPjSRCtmQ3G99Pfu1VMDMd9ET3W");
4748
console.log("plain text:" + text);
48-
var text2 = yield crypto.decryptText(cip,"xnHAcvtn1eVLDskhxPKNrhTsYKqde");
49+
var text2 = await crypto.decryptText(cip,"xnHAcvtn1eVLDskhxPKNrhTsYKqde");
4950
console.log("plain text2:" + text2);
5051

5152

@@ -57,7 +58,7 @@ co(function*() {
5758

5859

5960
// 创建表
60-
let rs = yield r.createTable("abc", [{
61+
let rs = await r.createTable("abc", [{
6162
"field": "id",
6263
"type": "int",
6364
"length": 11,
@@ -75,47 +76,47 @@ co(function*() {
7576
// console.log(rs)
7677

7778
// 删除表
78-
// let rs = yield r.drop(tb);
79+
// let rs = await r.drop(tb);
7980

8081
// 重命名
81-
// let rs = yield r.rename(tb,'users');
82+
// let rs = await r.rename(tb,'users');
8283
// 授权权限
83-
// let rs = yield r.assign(tb, 'rETMNdu2UgPhLZzbnDUVRHhB6NEDahj53c', [r.perm.insert],'0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02');
84+
// let rs = await r.assign(tb, 'rETMNdu2UgPhLZzbnDUVRHhB6NEDahj53c', [r.perm.insert],'0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02');
8485
// console.log(rs)
8586
//取消授权
86-
// let rs = yield r.assignCancle('users', 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh', ['lsfUpdate']);
87+
// let rs = await r.assignCancle('users', 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh', ['lsfUpdate']);
8788
// 插入数据
88-
//let rs = yield r.table(tb).insert({name:'xiaopeng'}).submit();
89-
// let rs = yield r.table(tb).insert({name:'feipeng1'}).submit();
89+
//let rs = await r.table(tb).insert({name:'xiaopeng'}).submit();
90+
// let rs = await r.table(tb).insert({name:'feipeng1'}).submit();
9091
//删除数据
91-
// let rs = yield r.table(tb).get({id:1}).delete().submit();
92+
// let rs = await r.table(tb).get({id:1}).delete().submit();
9293
// 获取数据
93-
//let rs = yield r.table(tb).get(['id','name']).submit();
94+
//let rs = await r.table(tb).get(['id','name']).submit();
9495

9596
// 测试一个条件的情况
96-
//let rs = yield r.table(tb).get({id:{$ge:1}}).withFields(['id','name']).submit();
97+
//let rs = await r.table(tb).get({id:{$ge:1}}).withFields(['id','name']).submit();
9798

9899
// // 测试 or 条件
99-
//let rs = yield r.table(tb).get({id:{$eq:1}},{name:'feipeng1'}).withFields(['id','name']).submit();
100-
//let rs = yield r.table(tb).get({id:{$eq:1}},{name:{$eq:'feipeng1'}}).withFields(['id','name']).submit();
101-
//let rs = yield r.table(tb).get({$or:[{id:{$ge:1}},{name:'feipeng1'}]}).withFields(['id','name']).submit();
100+
//let rs = await r.table(tb).get({id:{$eq:1}},{name:'feipeng1'}).withFields(['id','name']).submit();
101+
//let rs = await r.table(tb).get({id:{$eq:1}},{name:{$eq:'feipeng1'}}).withFields(['id','name']).submit();
102+
//let rs = await r.table(tb).get({$or:[{id:{$ge:1}},{name:'feipeng1'}]}).withFields(['id','name']).submit();
102103

103104
// 测试 and 条件
104-
//let rs = yield r.table(tb).get({$and:[{id:{$ge:1}},{name:'feipeng1'}]}).withFields(['id','name']).submit();
105-
//let rs = yield r.table(tb).get([{id:{$ge:1},name:'feipeng1'}]).withFields(['id','name']).submit();
106-
//let rs = yield r.table(tb).get([{id:{$ge:1},name:{$eq:'feipeng1'}}]).withFields(['id','name']).submit();
105+
//let rs = await r.table(tb).get({$and:[{id:{$ge:1}},{name:'feipeng1'}]}).withFields(['id','name']).submit();
106+
//let rs = await r.table(tb).get([{id:{$ge:1},name:'feipeng1'}]).withFields(['id','name']).submit();
107+
//let rs = await r.table(tb).get([{id:{$ge:1},name:{$eq:'feipeng1'}}]).withFields(['id','name']).submit();
107108

108109
// 测试 limit
109-
//let rs = yield r.table(tb).get({id:{$eq:1}},{name:'feipeng1'},{$limit:{index:0,total:1}}).withFields(['id','name']).submit();
110+
//let rs = await r.table(tb).get({id:{$eq:1}},{name:'feipeng1'},{$limit:{index:0,total:1}}).withFields(['id','name']).submit();
110111
// order by asc
111-
//let rs = yield r.table(tb).get({id:{$eq:1}},{name:'feipeng1'},{$limit:{index:0,total:2},$order:[{id:1}]}).withFields(['id','name']).submit();
112+
//let rs = await r.table(tb).get({id:{$eq:1}},{name:'feipeng1'},{$limit:{index:0,total:2},$order:[{id:1}]}).withFields(['id','name']).submit();
112113
// order by desc
113-
// let rs = yield r.table(tb).get({id:{$eq:1}},{name:'feipeng1'},{$limit:{index:0,total:2},$order:[{id:-1}]}).withFields(['id','name']).submit();
114+
// let rs = await r.table(tb).get({id:{$eq:1}},{name:'feipeng1'},{$limit:{index:0,total:2},$order:[{id:-1}]}).withFields(['id','name']).submit();
114115

115116
//更新数据
116-
// let rs = yield r.table(tb).update({name:'xiaopeng'},{id:2}).submit();
117+
// let rs = await r.table(tb).update({name:'xiaopeng'},{id:2}).submit();
117118
// 获取所有交易
118-
// let rs = yield r.getTransactions({limit:10,types:['sqlStatement']});
119+
// let rs = await r.getTransactions({limit:10,types:['sqlStatement']});
119120
//
120121
// console.log(rs)
121122
// 事务操作
@@ -143,11 +144,9 @@ co(function*() {
143144
// }],{confidential:true});
144145
// r.table(tb).insert({id:33,name:'xiaopeng454'});
145146
// r.table(tb).insert({id:34,name:'feipeng14544'});
146-
// var data = yield r.commit();
147+
// var data = await r.commit();
147148
// console.log('data',data)
148149
} catch (e) {
149150
console.log(e)
150151
}
151-
})
152-
153-
console.log("llls")
152+
}

test/test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict'
22

33
const fs = require("fs");
4-
const co = require('co')
54

65
const ChainsqlAPI = require('../src/index');
76
// ChainsqlAPI.prototype.callback2Promise = require('./callback2Promise');

test/testSchema.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict'
22

33
const fs = require("fs");
4-
const co = require('co')
54
const ChainsqlAPI = require('../src/index');
65

76
const c = new ChainsqlAPI();

test/testSign.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
// const api = new RippleAPI({server: ""});
55
const ChainsqlAPI = require('../src/index');
66
const c = new ChainsqlAPI();
7-
const co = require('co')
87

98
var user = {
109
secret: "snoPBrXtMeMyMHUVTgbuqAfg1SUTb",
1110
address: "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
1211
publickKey: "aBQG8RQAzjs1eTKFEAQXr2gS4utcDiEC9wmi7pfUPTi27VCahwgw"
1312
};
1413

15-
co(function*(){
14+
main();
15+
async function main(){
1616

17-
// yield c.connect('ws://139.198.11.189:6006');
18-
yield c.connect('ws://127.0.0.1:6007');
17+
// await c.connect('ws://139.198.11.189:6006');
18+
await c.connect('ws://127.0.0.1:6007');
1919
console.log('连接成功')
2020

21-
let info = yield c.api.getAccountInfo("rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh");
21+
let info = await c.api.getAccountInfo("rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh");
2222
console.log(info);
2323
c.getLedgerVersion(function(err,data){
2424
var payment = {
@@ -59,7 +59,7 @@ co(function*(){
5959

6060

6161
// return;
62-
// info = yield c.api.getAccountInfo("rsM2GxUgR6jhEDijLTymqrwKZqtGSKj7RQ");
62+
// info = await c.api.getAccountInfo("rsM2GxUgR6jhEDijLTymqrwKZqtGSKj7RQ");
6363
// var signerListSet = {
6464
// "TransactionType": "SignerListSet",
6565
// "Account": "rsM2GxUgR6jhEDijLTymqrwKZqtGSKj7RQ",
@@ -91,11 +91,11 @@ co(function*(){
9191
// signedRet = c.sign(signerListSet,"snfAitAq37xgeBMBv8YHNsWiczoBP");
9292
// console.log("SignerListSet:");
9393
// console.log(signedRet);
94-
// subRet = yield c.api.submit(signedRet.signedTransaction);
94+
// subRet = await c.api.submit(signedRet.signedTransaction);
9595
// console.log("submit SignerListSet:");
9696
// console.log(subRet);
9797

98-
// info = yield c.api.getAccountInfo("rB8A3mG8ZarktJte6vnHuDPv9bp3N6Jh42");
98+
// info = await c.api.getAccountInfo("rB8A3mG8ZarktJte6vnHuDPv9bp3N6Jh42");
9999
// var trustSet = {
100100
// "TransactionType": "TrustSet",
101101
// "Account": "rB8A3mG8ZarktJte6vnHuDPv9bp3N6Jh42",
@@ -111,7 +111,7 @@ co(function*(){
111111
// };
112112
// var option = {signAs:"rDsFXt1KRDNNckSh3exyTqkQeBKQCXawb2"};
113113
// let signForRet = c.signFor(trustSet,"saNWbrQwrZa9F24zeYZnnK4dPqWkw",option);
114-
// subRet = yield c.api.submit(signedRet.signedTransaction);
114+
// subRet = await c.api.submit(signedRet.signedTransaction);
115115
// console.log("submit multisign:");
116116
// console.log(subRet);
117-
})
117+
}

0 commit comments

Comments
 (0)