File tree Expand file tree Collapse file tree 2 files changed +38
-4
lines changed Expand file tree Collapse file tree 2 files changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import { ClientBase } from './ClientBase'
9
9
/**
10
10
* Client for the account balance
11
11
*/
12
- export class ClientGetminedblocks extends ClientBase implements IClientAccountGetminedblocks {
12
+ export class ClientAccountGetminedblocks extends ClientBase implements IClientAccountGetminedblocks {
13
13
14
14
/**
15
15
* ApiKey to use the service
@@ -49,4 +49,29 @@ export class ClientGetminedblocks extends ClientBase implements IClientAccountGe
49
49
this . action = action
50
50
this . type = type
51
51
}
52
+
53
+ /**
54
+ * Returns the serice url
55
+ * @returns url
56
+ */
57
+ toUrl ( ) : string {
58
+
59
+ const params = {
60
+ address : this . address . toString ( ) ,
61
+ apiKey : this . apiKey . toString ( ) ,
62
+ type : this . type . toString ( ) ,
63
+ }
64
+
65
+ return requestBuilder ( this . module , this . action , params )
66
+ }
67
+ /**
68
+ * Dies the actual request to the server
69
+ */
70
+ async request ( ) : Promise < any > {
71
+ const options = {
72
+ uri : this . toUrl ( ) ,
73
+ }
74
+ const res = await request . get ( options )
75
+ return this . processResult ( res )
76
+ }
52
77
}
Original file line number Diff line number Diff line change 1
1
import test from 'ava'
2
- import { ClientAccountBalance } from '../../src/client/ClientAccountBalance'
2
+ import { ClientAccountGetminedblocks } from '../../src/client/ClientAccountGetminedblocks'
3
+ import { ApiKey } from '../../src/entities/Apikey' ;
3
4
// import { decode } from 'querystring'
4
5
// const nock = require('nock')
5
6
// import { parse } from 'url'
6
7
// import { readFile } from 'fs'
7
8
// import { promisify } from 'util'
8
9
//const _readFile = promisify(readFile)
9
10
11
+ const type = 'block'
12
+ const apiKey = 'TRU5Z5MNWIEYP4F6DPH2T53IJWZIZ5GT1W'
13
+
10
14
test ( 'exists' , t => {
11
- t . truthy ( ClientAccountBalance )
12
- } )
15
+ t . truthy ( ClientAccountGetminedblocks )
16
+ } )
17
+
18
+ test ( 'can be instantiated' , t => {
19
+ const oApiKey = new ApiKey ( apiKey )
20
+ t . pass ( )
21
+ } )
You can’t perform that action at this time.
0 commit comments