Skip to content

Commit e60f1d2

Browse files
feat!: Upgrade to casper-js-sdk 5.x (#27)
* feat!: Upgrade to casper-js-sdk 5.x * fix: Fixed bugs for parsing events * fix: Fix lint errors and upgrade casper-js-sdk * fix: Fix tests and code * chore: Refactored schema parsing logic * chore: Updated examples
1 parent 8dc0d5c commit e60f1d2

File tree

12 files changed

+672
-1421
lines changed

12 files changed

+672
-1421
lines changed

README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,22 @@ The library is built on top of the [casper-js-sdk](https://github.com/casper-eco
1818
Here is an example of parsing CES events using `ces-js-parser` from a real Testnet deploy loaded with `casper-js-sdk`:
1919

2020
```typescript
21-
import { CasperServiceByJsonRPC } from 'casper-js-sdk';
21+
import { HttpHandler, RpcClient } from 'casper-js-sdk';
2222
import { Parser } from '@make-software/ces-js-parser';
23-
import { ExecutionResult } from "./casper/types";
2423

2524
(async() => {
26-
const rpcClient = new CasperServiceByJsonRPC(
27-
`http://${process.env.NODE_ADDRESS}:7777/rpc`
25+
const rpcHandler = new HttpHandler('http://${process.env.NODE_ADDRESS}:7777/rpc');
26+
27+
const rpcClient = new RpcClient(rpcHandler);
28+
29+
const transaction = await rpcClient.getTransactionByDeployHash(
30+
'c1bb9ae27877f5ecf4ef71307e7ee3c403bcace065565c3645b81ec0a9bc8978'
2831
);
2932

3033
const parser = await Parser.create(rpcClient, [
3134
'0640eb43bd95d5c88b799862bc9fb42d7a241f1a8aae5deaa03170a27ee8eeaa'
3235
]);
3336

34-
const deploy = await rpcClient.getDeployInfo(
35-
'c1bb9ae27877f5ecf4ef71307e7ee3c403bcace065565c3645b81ec0a9bc8978'
36-
);
37-
3837
const events = parser.parseExecutionResult(
3938
deploy.execution_results[0].result as ExecutionResult
4039
);
@@ -82,12 +81,12 @@ Parser that accepts a list of observed contracts and provides possibility to par
8281
**Example**
8382

8483
```typescript
85-
import { CasperServiceByJsonRPC } from 'casper-js-sdk';
84+
import { HttpHandler, RpcClient } from 'casper-js-sdk';
8685
import { Parser } from '@make-software/ces-js-parser';
8786

88-
const rpcClient = new CasperServiceByJsonRPC(
89-
`http://${process.env.NODE_ADDRESS}:7777/rpc`
90-
);
87+
const rpcHandler = new HttpHandler('http://${process.env.NODE_ADDRESS}:7777/rpc');
88+
89+
const rpcClient = new RpcClient(rpcHandler);
9190

9291
const parser = await Parser.create(rpcClient, [
9392
'214a0e730e14501d1e3e03504d3a2f940ef32830b13fa47f9d85a40f73b78161'

0 commit comments

Comments
 (0)