gamemoney 4.1.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +3 -0
- package/index.js +8 -1
- package/package.json +11 -11
package/index.d.ts
CHANGED
|
@@ -343,6 +343,9 @@ export interface TransferNotification {
|
|
|
343
343
|
signature: string;
|
|
344
344
|
}
|
|
345
345
|
declare type Payload = Record<string, unknown>;
|
|
346
|
+
export declare class GameMoneyError extends Error {
|
|
347
|
+
constructor(message: string);
|
|
348
|
+
}
|
|
346
349
|
export default class GameMoney {
|
|
347
350
|
private readonly config;
|
|
348
351
|
private readonly got;
|
package/index.js
CHANGED
|
@@ -5,6 +5,12 @@ export var SignType;
|
|
|
5
5
|
SignType["HMAC"] = "HMAC";
|
|
6
6
|
SignType["RSA"] = "RSA";
|
|
7
7
|
})(SignType || (SignType = {}));
|
|
8
|
+
export class GameMoneyError extends Error {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = 'GameMoneyError';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
8
14
|
export default class GameMoney {
|
|
9
15
|
config;
|
|
10
16
|
got = got.extend({
|
|
@@ -13,6 +19,7 @@ export default class GameMoney {
|
|
|
13
19
|
});
|
|
14
20
|
constructor(config) {
|
|
15
21
|
this.config = config;
|
|
22
|
+
this.config = config;
|
|
16
23
|
}
|
|
17
24
|
async request(url, payload = {}, signType = SignType.HMAC) {
|
|
18
25
|
const form = {
|
|
@@ -41,7 +48,7 @@ export default class GameMoney {
|
|
|
41
48
|
throw new Error(`Wrong rand parameter: ${response.rand}`);
|
|
42
49
|
}
|
|
43
50
|
if (response.state === 'error') {
|
|
44
|
-
throw new
|
|
51
|
+
throw new GameMoneyError(response.error);
|
|
45
52
|
}
|
|
46
53
|
return response;
|
|
47
54
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gamemoney",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "GameMoney API wrapper for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gamemoney",
|
|
@@ -67,19 +67,19 @@
|
|
|
67
67
|
"@onmoon/tsconfigs": "^2.0.0",
|
|
68
68
|
"@types/body-parser": "^1.19.2",
|
|
69
69
|
"@types/express": "^4.17.13",
|
|
70
|
-
"@types/jest": "^27.
|
|
71
|
-
"@types/node": "^17.0.
|
|
70
|
+
"@types/jest": "^27.5.1",
|
|
71
|
+
"@types/node": "^17.0.35",
|
|
72
72
|
"@types/uuid": "^8.3.4",
|
|
73
|
-
"body-parser": "^1.
|
|
74
|
-
"express": "^4.
|
|
75
|
-
"husky": "^
|
|
76
|
-
"lint-staged": "^12.
|
|
77
|
-
"ts-jest": "^
|
|
78
|
-
"typescript": "^4.
|
|
73
|
+
"body-parser": "^1.20.0",
|
|
74
|
+
"express": "^4.18.1",
|
|
75
|
+
"husky": "^8.0.1",
|
|
76
|
+
"lint-staged": "^12.4.1",
|
|
77
|
+
"ts-jest": "^28.0.2",
|
|
78
|
+
"typescript": "^4.6.4",
|
|
79
79
|
"uuid": "^8.3.2",
|
|
80
|
-
"xo": "^0.
|
|
80
|
+
"xo": "^0.49.0"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"got": "^12.0.
|
|
83
|
+
"got": "^12.0.4"
|
|
84
84
|
}
|
|
85
85
|
}
|