@@ -9,9 +9,9 @@ A `Promise<?>` based design is used as async/await implementation are very matur
9
9
life to modern development.
10
10
11
11
``` js
12
- import { JsonRpcClient } from " @defichain/jellyfish-api-jsonrpc" ;
12
+ import { JsonRpcClient } from ' @defichain/jellyfish-api-jsonrpc' ;
13
13
14
- const client = new JsonRpcClient (" http://foo:bar@localhost:8554" );
14
+ const client = new JsonRpcClient (' http://foo:bar@localhost:8554' );
15
15
const { blocks } = await client .mining .getMiningInfo ();
16
16
```
17
17
@@ -21,10 +21,10 @@ Due to the dynamic nature of the JavaScript language, it forces all number to be
21
21
cause precision to be lost. [ JellyfishSDK/jellyfish/issues/18] ( https://github.com/JellyfishSDK/jellyfish/issues/18 )
22
22
23
23
``` js
24
- it (" lost precision converting DFI 😥" , () => {
24
+ it (' lost precision converting DFI 😥' , () => {
25
25
const n = 1200000000.00000001 ;
26
26
const a = JSON .parse (JSON .stringify (n)) * 1.0e8 ;
27
- expect (a .toString ()).toStrictEqual (" 120000000000000001" );
27
+ expect (a .toString ()).toStrictEqual (' 120000000000000001' );
28
28
});
29
29
```
30
30
@@ -51,15 +51,8 @@ wallet or transaction related operations. While IEEE-754 number is used for all
51
51
52
52
``` ts {3}
53
53
export class Wallet {
54
- async getBalance(
55
- minimumConfirmation : number = 0 ,
56
- includeWatchOnly : boolean = false
57
- ): Promise <BigNumber > {
58
- return await this .client .call (
59
- " getbalance" ,
60
- [" *" , minimumConfirmation , includeWatchOnly ],
61
- " bignumber"
62
- );
54
+ async getBalance(minimumConfirmation : number = 0 , includeWatchOnly : boolean = false ): Promise <BigNumber > {
55
+ return await this .client .call (' getbalance' , [' *' , minimumConfirmation , includeWatchOnly ], ' bignumber' );
63
56
}
64
57
}
65
58
```
@@ -72,19 +65,12 @@ export interface MiningInfo {
72
65
}
73
66
74
67
export class Mining {
75
- async getNetworkHashPerSecond(
76
- nblocks : number = 120 ,
77
- height : number = - 1
78
- ): Promise <number > {
79
- return await this .client .call (
80
- " getnetworkhashps" ,
81
- [nblocks , height ],
82
- " number"
83
- );
68
+ async getNetworkHashPerSecond(nblocks : number = 120 , height : number = - 1 ): Promise <number > {
69
+ return await this .client .call (' getnetworkhashps' , [nblocks , height ], ' number' );
84
70
}
85
71
86
72
async getMiningInfo(): Promise <MiningInfo > {
87
- return await this .client .call (" getmininginfo" , [], " number" );
73
+ return await this .client .call (' getmininginfo' , [], ' number' );
88
74
}
89
75
}
90
76
```
@@ -116,10 +102,6 @@ export abstract class ApiClient {
116
102
* @throws RpcApiError
117
103
* @throws ClientApiError
118
104
*/
119
- abstract call<T >(
120
- method : string ,
121
- params : any [],
122
- precision : Precision
123
- ): Promise <T >;
105
+ abstract call<T >(method : string , params : any [], precision : Precision ): Promise <T >;
124
106
}
125
107
```
0 commit comments