Skip to content

Commit 64ef561

Browse files
committed
feat(signature): Update tests + Docs
1 parent d010728 commit 64ef561

File tree

7 files changed

+230
-54
lines changed

7 files changed

+230
-54
lines changed

dist/web3data.min.js

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,15 +1425,15 @@ Creates an instance of Signature.
14251425

14261426
| Name | Type | Description | |
14271427
| ---- | ---- | ----------- | -------- |
1428-
| web3data | | The web3data instance. |   |
1428+
| web3data | `object` | The web3data instance. |   |
14291429

14301430

14311431

14321432

14331433
##### Examples
14341434

14351435
```javascript
1436-
1436+
new Signature(new Web3Data('API_KEY'))
14371437
```
14381438

14391439

@@ -1446,6 +1446,39 @@ Creates an instance of Signature.
14461446

14471447

14481448

1449+
#### getAudit(hash)
1450+
1451+
1452+
Alias for getSignature.
1453+
1454+
1455+
1456+
1457+
##### Parameters
1458+
1459+
| Name | Type | Description | |
1460+
| ---- | ---- | ----------- | -------- |
1461+
| hash | `string` | The (keccak 256) of the signature. |   |
1462+
1463+
1464+
1465+
1466+
##### Examples
1467+
1468+
```javascript
1469+
const signatureDetails = await web3data.signature.getAudit('0xe2f0a05a')
1470+
```
1471+
1472+
1473+
##### Returns
1474+
1475+
1476+
- `Promise.<Array>` Information pertaining to the specified signature hash.
1477+
1478+
1479+
1480+
1481+
14491482
#### getSignature(hash)
14501483

14511484

@@ -1473,7 +1506,7 @@ const signatureDetails = await web3data.signature.getSignature('0xe2f0a05a')
14731506
##### Returns
14741507

14751508

1476-
- `Promise.<array>` Information pertaining to the specified signature hash.
1509+
- `Promise.<Array>` Information pertaining to the specified signature hash.
14771510

14781511

14791512

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@
101101
"jsdoc/implements-on-classes": 1,
102102
"jsdoc/match-description": 1,
103103
"jsdoc/newline-after-description": 1,
104-
"jsdoc/no-types": 1,
105104
"jsdoc/no-undefined-types": 1,
106105
"jsdoc/require-description": 1,
107106
"jsdoc/require-description-complete-sentence": 1,

src/signature.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,29 @@ class Signature {
1111
/**
1212
* Creates an instance of Signature.
1313
*
14-
* @param web3data - The web3data instance.
15-
* @example
14+
* @param {object} web3data - The web3data instance.
15+
* @example new Signature(new Web3Data('API_KEY'))
1616
*/
1717
constructor(web3data) {
1818
this.web3data = web3data
1919
}
2020

21+
/**
22+
* Alias for getSignature.
23+
*
24+
* @param {string} hash - The (keccak 256) of the signature.
25+
* @returns {Promise<Array>} Information pertaining to the specified signature hash.
26+
* @example const signatureDetails = await web3data.signature.getAudit('0xe2f0a05a')
27+
*/
28+
getAudit(hash) {
29+
return this.getSignature(hash)
30+
}
31+
2132
/**
2233
* Retrieves detailed information about the specified signature hash.
2334
*
2435
* @param {string} hash - The (keccak 256) of the signature.
25-
* @returns {Promise<array>} Information pertaining to the specified signature hash.
36+
* @returns {Promise<Array>} Information pertaining to the specified signature hash.
2637
* @example const signatureDetails = await web3data.signature.getSignature('0xe2f0a05a')
2738
*/
2839
getSignature(hash) {

src/web3data.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const WebSocketClient = require('./websocket')
2424

2525
/**
2626
* Contains common methods used in.
27+
*
2728
* @private
2829
*/
2930
class Web3DataFactory {

test/recordings/signature_1605069165/recording.har

Lines changed: 166 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"entries": [
1010
{
11-
"_id": "4471f38f4456bcefd3a52ee0248276ba",
11+
"_id": "c1eed826d36016f8aa9bbc4ee94388c9",
1212
"_order": 0,
1313
"cache": {},
1414
"request": {
@@ -32,55 +32,198 @@
3232
"httpVersion": "HTTP/1.1",
3333
"method": "GET",
3434
"queryString": [],
35-
"url": "https://web3api.io/api/v2/signatures/0xe2f0a05a?x-api-key="
35+
"url": "https://web3api.io/api/v2/signatures/0x3d7d3f5a?x-api-key="
3636
},
3737
"response": {
38-
"bodySize": 282,
38+
"bodySize": 295,
3939
"content": {
4040
"mimeType": "application/json; charset=utf-8",
41-
"size": 282,
42-
"text": "{\"status\":200,\"title\":\"OK\",\"description\":\"Successful request\",\"payload\":[{\"fullHexadecimalSignature\":\"0xe2f0a05a7dfb6af94ccaa246f780bf8b96a0c98efb8a48e33bd347addaa71d42\",\"hexadecimalSignature\":\"0xe2f0a05a\",\"numParameters\":4,\"textSignature\":\"TokenCLC(uint256,string,uint8,string)\"}]}"
41+
"size": 295,
42+
"text": "{\"status\":200,\"title\":\"OK\",\"description\":\"Successful request\",\"payload\":[{\"fullHexadecimalSignature\":\"0x3d7d3f5ab1b3b4946cf6ce26758c354d9eb67adf6a0432ce7ec60ddc563202e4\",\"hexadecimalSignature\":\"0x3d7d3f5a\",\"numParameters\":4,\"textSignature\":\"createSaleAuction(uint256,uint256,uint256,uint256)\"}]}"
4343
},
4444
"cookies": [
4545
{
46-
"expires": "2019-10-15T06:45:36.000Z",
46+
"expires": "2019-11-14T18:46:05.000Z",
4747
"name": "AWSALB",
4848
"path": "/",
49-
"value": "+VK72WbYnnJcwg6sHAx6b0xxAG2Jj5sEupyrtxyPIcZe+b+kGU8nmQcqnENhl1lefaC8sPOssBXClKZ+Y1RQ2ZNJK2B/L41gKYA8OSZCM+7oWsd0zjrQYwMIsfhw"
49+
"value": "lEFEZkhCB7RO9ZFY9ogrxyHF6Jrp+L/gge/EPLLfz5auTEpUtbdtwdGi+LZnkDFGQsy1miErD70UxxhJDyh1HMCqnoxvWuTFUADkpB0KirJcM0tyfQHMo1f1l6NC"
5050
}
5151
],
5252
"headers": [
53+
{
54+
"name": "hasprop"
55+
},
56+
{
57+
"name": "values"
58+
},
59+
{
60+
"name": "content-type",
61+
"value": "application/json; charset=utf-8"
62+
},
63+
{
64+
"name": "content-length",
65+
"value": "295"
66+
},
67+
{
68+
"name": "connection",
69+
"value": "close"
70+
},
71+
{
72+
"name": "date",
73+
"value": "Thu, 07 Nov 2019 18:46:05 GMT"
74+
},
75+
{
76+
"name": "x-amzn-requestid",
77+
"value": "f51e2bd3-b3d4-457e-b020-f0f7e0ced776"
78+
},
79+
{
80+
"name": "access-control-allow-origin",
81+
"value": "*"
82+
},
83+
{
84+
"name": "x-response-time",
85+
"value": "20.973ms"
86+
},
87+
{
88+
"name": "x-amzn-remapped-content-length",
89+
"value": "295"
90+
},
91+
{
92+
"name": "x-amzn-remapped-connection",
93+
"value": "keep-alive"
94+
},
95+
{
96+
"_fromType": "array",
97+
"name": "set-cookie",
98+
"value": "AWSALB=lEFEZkhCB7RO9ZFY9ogrxyHF6Jrp+L/gge/EPLLfz5auTEpUtbdtwdGi+LZnkDFGQsy1miErD70UxxhJDyh1HMCqnoxvWuTFUADkpB0KirJcM0tyfQHMo1f1l6NC; Expires=Thu, 14 Nov 2019 18:46:05 GMT; Path=/"
99+
},
100+
{
101+
"name": "x-amz-apigw-id",
102+
"value": "CzTxKGOBIAMFctg="
103+
},
104+
{
105+
"name": "etag",
106+
"value": "W/\"127-B6FEkb5Db7uuTR/oTAZ2EqfORKg\""
107+
},
108+
{
109+
"name": "x-amzn-remapped-date",
110+
"value": "Thu, 07 Nov 2019 18:46:05 GMT"
111+
},
112+
{
113+
"name": "x-cache",
114+
"value": "Miss from cloudfront"
115+
},
116+
{
117+
"name": "via",
118+
"value": "1.1 030fe0607711293dda988e571617a9f3.cloudfront.net (CloudFront)"
119+
},
120+
{
121+
"name": "x-amz-cf-pop",
122+
"value": "HIO50-C1"
123+
},
124+
{
125+
"name": "x-amz-cf-id",
126+
"value": "R2mX0BNqK5hxhcowQzm1C1QGIUK9S39PsCOD6ZUbjqpjWnrcuEVbAg=="
127+
}
128+
],
129+
"headersSize": 1051,
130+
"httpVersion": "HTTP/1.1",
131+
"redirectURL": "",
132+
"status": 200,
133+
"statusText": "OK"
134+
},
135+
"startedDateTime": "2019-11-07T18:46:02.757Z",
136+
"time": 4044,
137+
"timings": {
138+
"blocked": -1,
139+
"connect": -1,
140+
"dns": -1,
141+
"receive": 0,
142+
"send": 0,
143+
"ssl": -1,
144+
"wait": 4044
145+
}
146+
},
147+
{
148+
"_id": "c1eed826d36016f8aa9bbc4ee94388c9",
149+
"_order": 1,
150+
"cache": {},
151+
"request": {
152+
"bodySize": 0,
153+
"cookies": [],
154+
"headers": [
155+
{
156+
"name": "accept",
157+
"value": "application/json, text/plain, */*"
158+
},
159+
{
160+
"name": "user-agent",
161+
"value": "axios/0.19.0"
162+
},
163+
{
164+
"name": "host",
165+
"value": "web3api.io"
166+
}
167+
],
168+
"headersSize": 199,
169+
"httpVersion": "HTTP/1.1",
170+
"method": "GET",
171+
"queryString": [],
172+
"url": "https://web3api.io/api/v2/signatures/0x3d7d3f5a?x-api-key="
173+
},
174+
"response": {
175+
"bodySize": 295,
176+
"content": {
177+
"mimeType": "application/json; charset=utf-8",
178+
"size": 295,
179+
"text": "{\"status\":200,\"title\":\"OK\",\"description\":\"Successful request\",\"payload\":[{\"fullHexadecimalSignature\":\"0x3d7d3f5ab1b3b4946cf6ce26758c354d9eb67adf6a0432ce7ec60ddc563202e4\",\"hexadecimalSignature\":\"0x3d7d3f5a\",\"numParameters\":4,\"textSignature\":\"createSaleAuction(uint256,uint256,uint256,uint256)\"}]}"
180+
},
181+
"cookies": [
182+
{
183+
"expires": "2019-11-14T18:46:15.000Z",
184+
"name": "AWSALB",
185+
"path": "/",
186+
"value": "j07B6YXkBhO/afEQp+JSRWH5MnaJ15USiUlR838FVjwEbGPt7fOPxqfysxitmXBJ+8pe3tbeQEQRzsyaETGRoeHPL7VXVPExoFK0D0igwSkoTvDn27md565yzJb0"
187+
}
188+
],
189+
"headers": [
190+
{
191+
"name": "hasprop"
192+
},
193+
{
194+
"name": "values"
195+
},
53196
{
54197
"name": "content-type",
55198
"value": "application/json; charset=utf-8"
56199
},
57200
{
58201
"name": "content-length",
59-
"value": "282"
202+
"value": "295"
60203
},
61204
{
62205
"name": "connection",
63206
"value": "close"
64207
},
65208
{
66209
"name": "date",
67-
"value": "Tue, 08 Oct 2019 06:45:36 GMT"
210+
"value": "Thu, 07 Nov 2019 18:46:15 GMT"
68211
},
69212
{
70213
"name": "x-amzn-requestid",
71-
"value": "af8f9124-8dc9-467f-b871-fda2d32251de"
214+
"value": "51b2677f-5df0-44d4-abad-6f11592768e0"
72215
},
73216
{
74217
"name": "access-control-allow-origin",
75218
"value": "*"
76219
},
77220
{
78221
"name": "x-response-time",
79-
"value": "4.530ms"
222+
"value": "36.738ms"
80223
},
81224
{
82225
"name": "x-amzn-remapped-content-length",
83-
"value": "282"
226+
"value": "295"
84227
},
85228
{
86229
"name": "x-amzn-remapped-connection",
@@ -89,53 +232,53 @@
89232
{
90233
"_fromType": "array",
91234
"name": "set-cookie",
92-
"value": "AWSALB=+VK72WbYnnJcwg6sHAx6b0xxAG2Jj5sEupyrtxyPIcZe+b+kGU8nmQcqnENhl1lefaC8sPOssBXClKZ+Y1RQ2ZNJK2B/L41gKYA8OSZCM+7oWsd0zjrQYwMIsfhw; Expires=Tue, 15 Oct 2019 06:45:36 GMT; Path=/"
235+
"value": "AWSALB=j07B6YXkBhO/afEQp+JSRWH5MnaJ15USiUlR838FVjwEbGPt7fOPxqfysxitmXBJ+8pe3tbeQEQRzsyaETGRoeHPL7VXVPExoFK0D0igwSkoTvDn27md565yzJb0; Expires=Thu, 14 Nov 2019 18:46:15 GMT; Path=/"
93236
},
94237
{
95238
"name": "x-amz-apigw-id",
96-
"value": "BOyGhFnIIAMFxNQ="
239+
"value": "CzTywEckIAMFeUQ="
97240
},
98241
{
99242
"name": "etag",
100-
"value": "W/\"11a-J/h5Ote302XQH1HQ35hHvSM3AHw\""
243+
"value": "W/\"127-B6FEkb5Db7uuTR/oTAZ2EqfORKg\""
101244
},
102245
{
103246
"name": "x-amzn-remapped-date",
104-
"value": "Tue, 08 Oct 2019 06:45:36 GMT"
247+
"value": "Thu, 07 Nov 2019 18:46:15 GMT"
105248
},
106249
{
107250
"name": "x-cache",
108251
"value": "Miss from cloudfront"
109252
},
110253
{
111254
"name": "via",
112-
"value": "1.1 5beb4c3232a40c8c6a3e48c902092760.cloudfront.net (CloudFront)"
255+
"value": "1.1 030fe0607711293dda988e571617a9f3.cloudfront.net (CloudFront)"
113256
},
114257
{
115258
"name": "x-amz-cf-pop",
116-
"value": "IAD89-C2"
259+
"value": "HIO50-C1"
117260
},
118261
{
119262
"name": "x-amz-cf-id",
120-
"value": "z-jAjdzcBZbiutQRKe5SxEbgeB1LHd5tdauNaF1sJMqv7V4kzAIzYQ=="
263+
"value": "ZyTNnRtFKFKiGAP4yhXPQoqAKDlJq8Ml-TKkatlKhwC9gQnymPEQwA=="
121264
}
122265
],
123-
"headersSize": 836,
266+
"headersSize": 1051,
124267
"httpVersion": "HTTP/1.1",
125268
"redirectURL": "",
126269
"status": 200,
127270
"statusText": "OK"
128271
},
129-
"startedDateTime": "2019-10-08T06:45:35.426Z",
130-
"time": 762,
272+
"startedDateTime": "2019-11-07T18:46:14.017Z",
273+
"time": 2422,
131274
"timings": {
132275
"blocked": -1,
133276
"connect": -1,
134277
"dns": -1,
135278
"receive": 0,
136279
"send": 0,
137280
"ssl": -1,
138-
"wait": 762
281+
"wait": 2422
139282
}
140283
}
141284
],

0 commit comments

Comments
 (0)