Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/components/built/Auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ function getUrl(chain, network) {
return url;
}
function defaultConfiguration() {
var chain = (process.env["REACT_APP_CHAIN"] || localStorage.getItem("CHAIN") || "LTC");
var network = (process.env["REACT_APP_NETWORK"] ||
localStorage.getItem("NETWORK") ||
var chain = (localStorage.getItem("CHAIN") || process.env["REACT_APP_CHAIN"] || "LTC");
var network = (localStorage.getItem("NETWORK") ||
process.env["REACT_APP_NETWORK"] ||
"regtest");
var url = getUrl(chain, network);
return { chain: chain, network: network, url: url };
Expand Down
10 changes: 10 additions & 0 deletions packages/components/built/Drawer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
declare function ShowDrawer({ text, id }: {
text: string;
id: string;
}): import("react/jsx-runtime").JSX.Element;
declare function Component({ Content, id }: any): import("react/jsx-runtime").JSX.Element;
export declare const Drawer: {
Component: typeof Component;
ShowDrawer: typeof ShowDrawer;
};
export {};
24 changes: 24 additions & 0 deletions packages/components/built/Drawer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
function ShowDrawer(_a) {
var text = _a.text, id = _a.id;
return (_jsx("button", __assign({ "data-drawer-target": id, "data-drawer-show": id, "data-drawer-placement": "right", "aria-controls": id }, { children: text })));
}
function Component(_a) {
var Content = _a.Content, id = _a.id;
return (_jsxs("div", __assign({ id: id, className: "fixed top-0 right-0 z-40 h-screen p-4 overflow-y-auto transition-transform translate-x-full bg-white w-80 dark:bg-gray-800", tabIndex: -1, "aria-labelledby": "drawer-right-label" }, { children: [_jsxs("button", __assign({ type: "button", "data-drawer-hide": id, "aria-controls": id, className: "text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 absolute top-2.5 end-2.5 inline-flex items-center justify-center dark:hover:bg-gray-600 dark:hover:text-white" }, { children: [_jsx("svg", __assign({ className: "w-3 h-3", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 14 14" }, { children: _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" }) })), _jsx("span", __assign({ className: "sr-only" }, { children: "Close menu" }))] })), Content()] })));
}
export var Drawer = {
Component: Component,
ShowDrawer: ShowDrawer,
};
2 changes: 1 addition & 1 deletion packages/components/built/Gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/built/SmartObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
Expand Down
18 changes: 12 additions & 6 deletions packages/components/built/SmartObjectFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
Expand All @@ -49,6 +49,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
import { useState } from "react";
import { TypeSelectionDropdown } from "./common/TypeSelectionDropdown";
import { isValidRev, sleep } from "./common/utils";
import { UtilsContext } from "./UtilsContext";
export var getErrorMessage = function (error) {
var _a, _b, _c, _d, _e, _f;
if (((_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) ===
Expand Down Expand Up @@ -87,15 +88,17 @@ export var getValueForType = function (type, stringValue) {
export var SmartObjectFunction = function (_a) {
var computer = _a.computer, smartObject = _a.smartObject, functionsExist = _a.functionsExist, options = _a.options, setFunctionResult = _a.setFunctionResult, setShow = _a.setShow, setModalTitle = _a.setModalTitle;
var _b = useState({}), formState = _b[0], setFormState = _b[1];
var showLoader = UtilsContext.useUtilsComponents().showLoader;
var handleSmartObjectMethod = function (event, smartObject, fnName, params) { return __awaiter(void 0, void 0, void 0, function () {
var revMap_1, tx, res, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
event.preventDefault();
showLoader(true);
_a.label = 1;
case 1:
_a.trys.push([1, 6, , 7]);
_a.trys.push([1, 6, 7, 8]);
revMap_1 = {};
params.forEach(function (param) {
var key = "".concat(fnName, "-").concat(param);
Expand Down Expand Up @@ -133,14 +136,17 @@ export var SmartObjectFunction = function (_a) {
setFunctionResult({ _rev: res[0] });
setModalTitle("Success!");
setShow(true);
return [3 /*break*/, 7];
return [3 /*break*/, 8];
case 6:
error_1 = _a.sent();
setFunctionResult(getErrorMessage(error_1));
setModalTitle("Error!");
setShow(true);
return [3 /*break*/, 7];
case 7: return [2 /*return*/];
return [3 /*break*/, 8];
case 7:
showLoader(false);
return [7 /*endfinally*/];
case 8: return [2 /*return*/];
}
});
}); };
Expand All @@ -163,7 +169,7 @@ export var SmartObjectFunction = function (_a) {
})
.map(function (key, fnIndex) {
var paramList = getFnParamNames(Object.getPrototypeOf(smartObject)[key]);
return (_jsxs("div", __assign({ className: "mt-6 mb-6" }, { children: [_jsx("h3", __assign({ className: "mt-2 text-xl font-bold dark:text-white" }, { children: key })), _jsxs("form", __assign({ id: "fn-index-".concat(fnIndex) }, { children: [paramList.map(function (paramName, paramIndex) { return (_jsxs("div", __assign({ className: "mb-4" }, { children: [_jsx("div", __assign({ className: "mb-2" }, { children: _jsx("label", __assign({ htmlFor: "".concat(key, "-").concat(paramName), className: "block mb-2 text-sm font-medium text-gray-900 dark:text-white" }, { children: paramName })) })), _jsxs("div", __assign({ className: "flex items-center space-x-4" }, { children: [_jsx("input", { type: "text", id: "".concat(key, "-").concat(paramName), value: formState["".concat(key, "-").concat(paramName)], onChange: function (e) { return updateFormValue(e, "".concat(key, "-").concat(paramName)); }, className: "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500", placeholder: "Value", required: true }), _jsx(TypeSelectionDropdown, { id: "".concat(key).concat(paramName), dropdownList: options, onSelectMethod: function (option) {
return (_jsxs("div", __assign({ className: "mt-6 mb-6" }, { children: [_jsx("h3", __assign({ className: "mt-2 text-xl font-bold dark:text-white" }, { children: key })), _jsxs("form", __assign({ id: "fn-index-".concat(fnIndex) }, { children: [paramList.map(function (paramName, paramIndex) { return (_jsxs("div", __assign({ className: "mb-4" }, { children: [_jsx("div", __assign({ className: "mb-2" }, { children: _jsx("label", __assign({ htmlFor: "".concat(key, "-").concat(paramName), className: "block mb-2 text-sm font-medium text-gray-900 dark:text-white" }, { children: paramName })) })), _jsxs("div", __assign({ className: "flex items-center space-x-4" }, { children: [_jsx("input", { type: "text", id: "".concat(key, "-").concat(paramName), value: formState["".concat(key, "-").concat(paramName)] || "", onChange: function (e) { return updateFormValue(e, "".concat(key, "-").concat(paramName)); }, className: "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500", placeholder: "Value", required: true }), _jsx(TypeSelectionDropdown, { id: "".concat(key).concat(paramName), dropdownList: options, onSelectMethod: function (option) {
return updateTypes(option, "".concat(key, "-").concat(paramName));
} })] }))] }), paramIndex)); }), _jsx("button", __assign({ className: "mr-8 text-white bg-blue-700 hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300 font-medium rounded-md text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800", onClick: function (evt) { return handleSmartObjectMethod(evt, smartObject, key, paramList); } }, { children: "Call Function" }))] }))] }), fnIndex));
})] }));
Expand Down
2 changes: 1 addition & 1 deletion packages/components/built/Transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
Expand Down
1 change: 1 addition & 0 deletions packages/components/built/Wallet.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function Wallet(): import("react/jsx-runtime").JSX.Element;
Loading