Skip to content

Commit cc7697b

Browse files
authored
Add newline at end of README.md (#19) (#21)
* Add newline at end of README.md Fix formatting issue by adding a newline at the end of the file. * fix query * fix data ci * fix data ci * fix ci
1 parent 319b0ab commit cc7697b

File tree

4 files changed

+29
-23
lines changed

4 files changed

+29
-23
lines changed

service/node.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class LightClient {
1616
async start(): Promise<boolean> {
1717
if (checkLightClientWasm()){
1818
await request(1,this.url,"start",[])
19+
await sleep(5*1000)
1920
return true
2021
}
2122
await sh("cd " + this.dirPath + "/target/release && RUST_LOG=info,ckb_light_client=trace ./ckb-light-client run --config-file ./config.toml > node.log 2>&1 &")

service/txService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export async function getCkbTransactionList(scriptObject: Script, script_type: S
122122

123123
},
124124
"asc",
125-
BI.from(3000).toHexString(), lastCursor
125+
BI.from(1000).toHexString(), lastCursor
126126
)
127127
if (result.objects.length == 0) {
128128
return txList
@@ -158,7 +158,7 @@ export async function getLightTransactionList(scriptObject: Script, script_type:
158158

159159
},
160160
"asc",
161-
BI.from(3000).toHexString(),lastCursor
161+
BI.from(1000).toHexString(),lastCursor
162162
)
163163
if (result.objects.length == 0) {
164164
return txList
@@ -193,7 +193,7 @@ export async function getTransactionsLength(scriptObject: Script, script_type: S
193193

194194
},
195195
"asc",
196-
BI.from(3000).toHexString()
196+
BI.from(1000).toHexString()
197197
)
198198
if (result.objects.length == 0) {
199199
break
@@ -216,7 +216,7 @@ export async function getCellsByRange(scriptObject: Script, script_type: ScriptT
216216
filter: {
217217
blockRange: block_range
218218
}
219-
}, "asc", "0xfff", lastCursor)
219+
}, "asc", "0x1ff", lastCursor)
220220
if (result.objects.length == 0) {
221221
break
222222
}

test/get_header.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import {waitScriptsUpdate} from "../service/lightService";
99
describe('get_header', function () {
1010

1111
this.timeout(600_000)
12-
12+
it("dd",async ()=>{
13+
let acc = generateAccountFromPrivateKey(ACCOUNT_PRIVATE)
14+
console.log(acc)
15+
})
1316
it("query the hash that does not exist on the ckb chain,should return null", async () => {
1417
let response = await getHeader("0x1d7c6f92fa3335bf01c3f43f8970cb586d2dee81b90d363169dbe1bba98d6c11")
1518
console.log('response:', response)
@@ -20,7 +23,7 @@ describe('get_header', function () {
2023
let script = generateAccountFromPrivateKey(ACCOUNT_PRIVATE).lockScript
2124
let cells = await indexerMockLightRpc.getCells({
2225
script:script,scriptType:"lock"
23-
}, "asc","0xfff")
26+
}, "asc","0x1ff")
2427

2528
// set scripts :( account,cells[0].height -1 ) ,want to collected cells that not used ;
2629
await lightClientRPC.setScripts([{script: script,scriptType:"lock", blockNumber: BI.from(cells.objects[0].blockNumber).sub(1).toHexString()}])
@@ -32,7 +35,7 @@ describe('get_header', function () {
3235
let response = await lightClientRPC.getCells({
3336
script:script,
3437
scriptType:"lock"
35-
}, "asc", "0xfff")
38+
}, "asc", "0x1ff")
3639

3740
let block = await rpcCLient.getBlockByNumber(response.objects[0].blockNumber.toString())
3841
if (block == undefined) {

test/get_transactions.spec.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('get_transactions', function () {
2626
let txs = await rpcCLient.getTransactions({
2727
"script": test_scripts[0].script, "scriptType": test_scripts[0].scriptType,
2828
"groupByTransaction": true
29-
}, "asc", "0xfff")
29+
}, "asc", "0x1ff")
3030
console.log(txs.objects[0].blockNumber)
3131
console.log(txs.objects[txs.objects.length - 1].blockNumber)
3232
await lightClientRPC.setScripts([
@@ -51,28 +51,28 @@ describe('get_transactions', function () {
5151
filter: {
5252
blockRange: [BI.from(12112687).sub(1).toHexString(), BI.from(12116260).toHexString()],
5353
}
54-
}, "asc", "0xfff", lightAfterCursor
54+
}, "asc", "0x1ff", lightAfterCursor
5555
)
5656
let ckbTxs = await rpcCLient.getTransactions({
5757
"script": test_scripts[0].script, "scriptType": test_scripts[0].scriptType,
5858
// "groupByTransaction": true
5959
filter: {
6060
blockRange: [BI.from(12112687).sub(1).toHexString(), BI.from(12116260).toHexString()],
6161
}
62-
}, "asc", "0xfff", ckbAfterCursor)
62+
}, "asc", "0x1ff", ckbAfterCursor)
6363

6464
console.log("lightTxs.objects.length:", lightTxs.objects.length)
6565
console.log("ckbTxs.objects.length:", ckbTxs.objects.length)
66-
expect(lightTxs.objects.length == ckbTxs.objects.length, "light txs length not equal ckb txs length")
66+
expect(lightTxs.objects.length ).to.be.equal( ckbTxs.objects.length, "light txs length not equal ckb txs length")
6767
for (let i = 0; i < lightTxs.objects.length; i++) {
6868
let lightTx = lightTxs.objects[i]
6969
let ckbTx = ckbTxs.objects[i]
7070
// console.log("lightTx:", lightTx)
7171
// console.log("ckbTx:", ckbTx)
72-
expect(lightTx.transaction.hash == ckbTx.txHash, "light tx hash not equal ckb tx hash")
73-
expect(lightTx.blockNumber == ckbTx.blockNumber, "light block number not equal ckb tx hash")
74-
expect(lightTx.ioIndex == ckbTx.ioIndex, "light block number not equal ckb tx hash")
75-
expect(lightTx.txIndex == ckbTx.txIndex, "light block number not equal ckb tx hash")
72+
expect(lightTx.transaction.hash).to.be.equal(ckbTx.txHash, "light tx hash not equal ckb tx hash")
73+
expect(lightTx.blockNumber ).to.be.equal( ckbTx.blockNumber, "light block number not equal ckb tx hash")
74+
expect(lightTx.ioIndex ).to.be.equal( ckbTx.ioIndex, "light block number not equal ckb tx hash")
75+
expect(lightTx.txIndex ).to.be.equal( ckbTx.txIndex, "light block number not equal ckb tx hash")
7676
}
7777
lightAfterCursor = lightTxs.lastCursor
7878
ckbAfterCursor = ckbTxs.lastCursor
@@ -93,7 +93,7 @@ describe('get_transactions', function () {
9393
filter: {
9494
blockRange: [BI.from(12112687).sub(1).toHexString(), BI.from(12116260).toHexString()],
9595
}
96-
}, "asc", BI.from(5000).toHexString(), lightAfterCursor
96+
}, "asc", BI.from(1000).toHexString(), lightAfterCursor
9797
)
9898
if(lightTxs.objects.length == 0){
9999
return
@@ -105,18 +105,20 @@ describe('get_transactions', function () {
105105
filter: {
106106
blockRange: [BI.from(12112687).sub(1).toHexString(), BI.from(12116260).toHexString()],
107107
}
108-
}, "asc", BI.from(5000).toHexString(), ckbAfterCursor)
108+
}, "asc", BI.from(1000).toHexString(), ckbAfterCursor)
109109

110110
console.log("lightTxs.objects.length:", lightTxs.objects.length)
111111
console.log("ckbTxs.objects.length:", ckbTxs.objects.length)
112-
expect(lightTxs.objects.length == ckbTxs.objects.length, "light txs length not equal ckb txs length")
112+
expect(lightTxs.objects.length ).to.be.equal( ckbTxs.objects.length, "light txs length not equal ckb txs length")
113113
for (let i = 0; i < lightTxs.objects.length; i++) {
114114
let lightTx = lightTxs.objects[i]
115115
let ckbTx = ckbTxs.objects[i]
116-
expect(lightTx.transaction.hash == ckbTx.txHash, "light tx hash not equal ckb tx hash")
117-
expect(lightTx.blockNumber == ckbTx.blockNumber, "light block number not equal ckb tx hash")
118-
expect(lightTx.cells == ckbTx.cells, "light block number not equal ckb tx hash")
119-
expect(lightTx.txIndex == ckbTx.txIndex, "light block number not equal ckb tx hash")
116+
// console.log("index:",i," lightTx:", lightTx.transaction.hash,JSON.stringify(lightTx.cells) )
117+
// console.log("ckbTx:", ckbTx.txHash)
118+
expect(lightTx.transaction.hash ).to.be.equal( ckbTx.txHash, "light tx hash not equal ckb tx hash")
119+
expect(lightTx.blockNumber ).to.be.equal( ckbTx.blockNumber, "light block number not equal ckb tx hash")
120+
expect(JSON.stringify(lightTx.cells) ).to.be.equal( JSON.stringify(ckbTx.cells), "light block number not equal ckb tx hash")
121+
expect(lightTx.txIndex ).to.be.equal( ckbTx.txIndex, "light block number not equal ckb tx hash")
120122
}
121123
lightAfterCursor = lightTxs.lastCursor
122124
ckbAfterCursor = ckbTxs.lastCursor
@@ -125,4 +127,4 @@ describe('get_transactions', function () {
125127
}
126128
})
127129

128-
});
130+
});

0 commit comments

Comments
 (0)