ggez-banking-sdk
Version:
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.
42 lines (41 loc) • 1.81 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetEndpointByRequestType = exports.GetKeyAndFunctionNameByRequestType = void 0;
const constants_1 = require("../constants");
const GetKeyAndFunctionNameByRequestType = (requestType) => {
switch (requestType) {
case constants_1.BlockchainRequestType.Send:
return { key: "send", functionName: "SendRequest" };
case constants_1.BlockchainRequestType.Multi_Send:
return { key: "multiSend", functionName: "MultiSendRequest" };
case constants_1.BlockchainRequestType.Delegate:
return { key: "delegate", functionName: "DelegateRequest" };
case constants_1.BlockchainRequestType.Undelegate:
return { key: "undelegate", functionName: "UndelegateRequest" };
default:
return { key: "", functionName: "" };
}
};
exports.GetKeyAndFunctionNameByRequestType = GetKeyAndFunctionNameByRequestType;
const GetEndpointByRequestType = (requestType) => {
let action;
switch (requestType) {
case constants_1.BlockchainRequestType.Send:
action = constants_1.BlockchainActions.Send;
break;
case constants_1.BlockchainRequestType.Multi_Send:
action = constants_1.BlockchainActions.MultiSend;
break;
case constants_1.BlockchainRequestType.Delegate:
action = constants_1.BlockchainActions.Delegate;
break;
case constants_1.BlockchainRequestType.Undelegate:
action = constants_1.BlockchainActions.Undelegate;
break;
default:
action = "";
break;
}
return `${constants_1.Endpoints.Blockchain}/${action}`;
};
exports.GetEndpointByRequestType = GetEndpointByRequestType;