ggez-banking-sdk 0.1.34 → 0.1.35

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.
@@ -60,3 +60,9 @@ export declare const StructTicketMessageDescriptionCodes: {
60
60
  Identification_Verification_Canceled: string;
61
61
  Phone_Verification: string;
62
62
  };
63
+ export declare const BlockchainActions: {
64
+ Send: string;
65
+ MultiSend: string;
66
+ Delegate: string;
67
+ Undelegate: string;
68
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StructTicketMessageDescriptionCodes = void 0;
3
+ exports.BlockchainActions = exports.StructTicketMessageDescriptionCodes = void 0;
4
4
  exports.StructTicketMessageDescriptionCodes = {
5
5
  Custom: "M000",
6
6
  Identification_Is_Being_Verified: "M100",
@@ -63,3 +63,9 @@ exports.StructTicketMessageDescriptionCodes = {
63
63
  Identification_Verification_Canceled: "M157",
64
64
  Phone_Verification: "M158",
65
65
  };
66
+ exports.BlockchainActions = {
67
+ Send: "send",
68
+ MultiSend: "multisend",
69
+ Delegate: "delegate",
70
+ Undelegate: "undelegate",
71
+ };
@@ -23,7 +23,8 @@ const useBlockchain = (token, userInfo, userId, baseUrl, lang) => {
23
23
  };
24
24
  const RequestHandler = async (data, requestType) => {
25
25
  try {
26
- const response = await restApi_1.default.restApi(baseUrl, constants_1.HTTPMethod.POST, constants_1.Endpoints.Blockchain, GetHeadersConfig(), data);
26
+ const endpoint = (0, blockchainHelper_1.GetEndpointByRequestType)(requestType);
27
+ const response = await restApi_1.default.restApi(baseUrl, constants_1.HTTPMethod.POST, endpoint, GetHeadersConfig(), data);
27
28
  const { key, functionName } = (0, blockchainHelper_1.GetKeyAndFunctionNameByRequestType)(requestType);
28
29
  const { newUserInfo } = checkGlobalResponse(key, response, functionName, key);
29
30
  return {
@@ -3,3 +3,4 @@ export declare const GetKeyAndFunctionNameByRequestType: (requestType: Blockchai
3
3
  key: string;
4
4
  functionName: string;
5
5
  };
6
+ export declare const GetEndpointByRequestType: (requestType: BlockchainRequestType) => string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetKeyAndFunctionNameByRequestType = void 0;
3
+ exports.GetEndpointByRequestType = exports.GetKeyAndFunctionNameByRequestType = void 0;
4
4
  const constants_1 = require("../constants");
5
5
  const GetKeyAndFunctionNameByRequestType = (requestType) => {
6
6
  switch (requestType) {
@@ -17,3 +17,25 @@ const GetKeyAndFunctionNameByRequestType = (requestType) => {
17
17
  }
18
18
  };
19
19
  exports.GetKeyAndFunctionNameByRequestType = GetKeyAndFunctionNameByRequestType;
20
+ const GetEndpointByRequestType = (requestType) => {
21
+ let action;
22
+ switch (requestType) {
23
+ case constants_1.BlockchainRequestType.Send:
24
+ action = constants_1.BlockchainActions.Send;
25
+ break;
26
+ case constants_1.BlockchainRequestType.Multi_Send:
27
+ action = constants_1.BlockchainActions.MultiSend;
28
+ break;
29
+ case constants_1.BlockchainRequestType.Delegate:
30
+ action = constants_1.BlockchainActions.Delegate;
31
+ break;
32
+ case constants_1.BlockchainRequestType.UnDelegate:
33
+ action = constants_1.BlockchainActions.Undelegate;
34
+ break;
35
+ default:
36
+ action = "";
37
+ break;
38
+ }
39
+ return `${constants_1.Endpoints.Blockchain}/${action}`;
40
+ };
41
+ exports.GetEndpointByRequestType = GetEndpointByRequestType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ggez-banking-sdk",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
4
4
  "description": "A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",