test-ahaan-v2-4 1.1.45 → 1.1.50

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/dist/index.js CHANGED
@@ -1,8 +1,25 @@
1
1
  "use strict";
2
2
  var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6
23
  var __export = (target, all) => {
7
24
  for (var name in all)
8
25
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -41,7 +58,8 @@ var __async = (__this, __arguments, generator) => {
41
58
  var src_exports = {};
42
59
  __export(src_exports, {
43
60
  default: () => src_default,
44
- getDefaultWallets: () => getDefaultWallets
61
+ getDefaultWallets: () => getDefaultWallets,
62
+ triaSendTransaction: () => triaSendTransaction
45
63
  });
46
64
  module.exports = __toCommonJS(src_exports);
47
65
  var import_react8 = require("react");
@@ -210,7 +228,7 @@ function EmailAndSocial(props) {
210
228
  localStorage.setItem("socialNetwork", socialNetwork);
211
229
  try {
212
230
  setOpenFrame(true);
213
- window.open(`${baseUrl}/api/v1/auth/oauth/${socialNetwork}?origin=${window == null ? void 0 : window.origin}`, "SSO", `width=${500},height=${600},left=${0},top=${top}`);
231
+ window.open(`${baseUrl}/api/v1/auth/oauth/${socialNetwork}`, "SSO", `width=${500},height=${600},left=${0},top=${top}`);
214
232
  } catch (err) {
215
233
  console.log(err);
216
234
  }
@@ -759,7 +777,7 @@ function SignUp() {
759
777
  var import_react5 = require("react");
760
778
  var import_jsx_runtime11 = require("react/jsx-runtime");
761
779
  function SignInPassword() {
762
- const { triaName, setView, setShowOnboarding, setTriaName, email, setEmail } = (0, import_react5.useContext)(NavContext_default);
780
+ const { triaName: triaName2, setView, setShowOnboarding, setTriaName, email, setEmail } = (0, import_react5.useContext)(NavContext_default);
763
781
  const [password, setPassword] = (0, import_react5.useState)("");
764
782
  const [loader, setLoader] = (0, import_react5.useState)(false);
765
783
  (0, import_react5.useEffect)(() => {
@@ -991,14 +1009,14 @@ var IframeController = class {
991
1009
  this.walletUrl = walletUrl;
992
1010
  }
993
1011
  getVault({
994
- triaName,
1012
+ triaName: triaName2,
995
1013
  password,
996
1014
  userId
997
1015
  }) {
998
1016
  const encodedParams = btoa(
999
1017
  JSON.stringify({
1000
1018
  op: "getVault",
1001
- triaName,
1019
+ triaName: triaName2,
1002
1020
  password,
1003
1021
  userId
1004
1022
  })
@@ -1007,11 +1025,11 @@ var IframeController = class {
1007
1025
  const eventType = eventTypes.logIn;
1008
1026
  return { iframeUrl, eventType };
1009
1027
  }
1010
- createAccount({ triaName, password }) {
1028
+ createAccount({ triaName: triaName2, password }) {
1011
1029
  const encodedParams = btoa(
1012
1030
  JSON.stringify({
1013
1031
  op: "createAccount",
1014
- triaName,
1032
+ triaName: triaName2,
1015
1033
  password
1016
1034
  })
1017
1035
  );
@@ -1020,7 +1038,7 @@ var IframeController = class {
1020
1038
  return { iframeUrl, eventType };
1021
1039
  }
1022
1040
  socialogin({
1023
- triaName,
1041
+ triaName: triaName2,
1024
1042
  password,
1025
1043
  platform,
1026
1044
  userId,
@@ -1029,7 +1047,7 @@ var IframeController = class {
1029
1047
  const encodedParams = btoa(
1030
1048
  JSON.stringify({
1031
1049
  op: "socialogin",
1032
- triaName,
1050
+ triaName: triaName2,
1033
1051
  password,
1034
1052
  userId,
1035
1053
  platform,
@@ -1040,14 +1058,14 @@ var IframeController = class {
1040
1058
  const eventType = eventTypes.socialSignUp;
1041
1059
  return { iframeUrl, eventType };
1042
1060
  }
1043
- signMessage(chainName, message, loginType, triaName, socialName, userId, input, appDomain, appLogo) {
1061
+ signMessage(chainName, message, loginType, triaName2, socialName, userId, input, appDomain, appLogo) {
1044
1062
  return __async(this, null, function* () {
1045
1063
  const encodedParams = btoa(
1046
1064
  JSON.stringify({
1047
1065
  chainName,
1048
1066
  message,
1049
1067
  loginType,
1050
- triaName,
1068
+ triaName: triaName2,
1051
1069
  socialName,
1052
1070
  userId,
1053
1071
  input,
@@ -1075,11 +1093,11 @@ var IframeController = class {
1075
1093
  return { iframeUrl, eventType };
1076
1094
  });
1077
1095
  }
1078
- approve(triaName, chainName, tokenAddress, amount) {
1096
+ approve(triaName2, chainName, tokenAddress, amount) {
1079
1097
  const encodedParams = btoa(
1080
1098
  JSON.stringify({
1081
1099
  chainName,
1082
- triaName,
1100
+ triaName: triaName2,
1083
1101
  tokenAddress,
1084
1102
  amount
1085
1103
  })
@@ -1152,14 +1170,62 @@ var wagmiConfig = (0, import_wagmi2.createConfig)({
1152
1170
  publicClient,
1153
1171
  webSocketPublicClient
1154
1172
  });
1173
+ var createEncodedData = (data) => {
1174
+ const encodedParams = btoa(
1175
+ JSON.stringify(data)
1176
+ );
1177
+ return encodedParams;
1178
+ };
1179
+ var iframeurl;
1180
+ var createWalletiframe = ({ appDomain, appLogo }) => {
1181
+ const loginData = { loginType: "native", triaName, socialName: localStorage == null ? void 0 : localStorage.getItem("socialNetwork"), userId: "", input: "" };
1182
+ const res = createEncodedData({
1183
+ triaName: loginData.triaName,
1184
+ appName: "",
1185
+ darkMode: true,
1186
+ appDomain,
1187
+ defaultChain: "",
1188
+ allowedChains: [],
1189
+ appLogo,
1190
+ accessToken: "",
1191
+ loginType: loginData.loginType,
1192
+ socialName: loginData.socialName,
1193
+ userId: loginData.userId
1194
+ });
1195
+ const walletIframe = `https://reliable-semifreddo-e8e93e.netlify.app/${res}`;
1196
+ iframeurl = walletIframe;
1197
+ };
1198
+ var triaSendTransaction = ({ appDomain, appLogo }) => {
1199
+ const sendTransaction = (sendDataFromDapp) => __async(void 0, null, function* () {
1200
+ const loginData = { loginType: "native", triaName, socialName: localStorage == null ? void 0 : localStorage.getItem("socialNetwork"), userId: "", input: "" };
1201
+ const iframeEncodedData = createEncodedData(__spreadProps(__spreadValues(__spreadValues({}, sendDataFromDapp), loginData), { appDomain, appLogo }));
1202
+ const sendIframeUrl = { authURL } / send / iframeEncodedData;
1203
+ setIframeURL(sendIframeUrl);
1204
+ iframeurl = sendIframeUrl;
1205
+ });
1206
+ const signMessage = (message) => __async(void 0, null, function* () {
1207
+ const loginData = { loginType: "native", triaName, socialName: localStorage == null ? void 0 : localStorage.getItem("socialNetwork"), userId: "", input: "" };
1208
+ const iframeEncodedData = createEncodedData(__spreadProps(__spreadValues(__spreadValues({}, message), loginData), { appDomain, appLogo }));
1209
+ const signIframeUrl = { authURL } / signMessage / iframeEncodedData;
1210
+ setIframeURL(signIframeUrl);
1211
+ iframeurl = signIframeUrl;
1212
+ });
1213
+ return {
1214
+ sendTransaction,
1215
+ signMessage
1216
+ };
1217
+ };
1155
1218
  var Application = ({ dappName, logo }) => {
1156
1219
  const [view, setView] = (0, import_react9.useState)("Home");
1157
- const [triaName, setTriaName] = (0, import_react9.useState)("");
1220
+ const [triaName2, setTriaName] = (0, import_react9.useState)("");
1158
1221
  const [email, setEmail] = (0, import_react9.useState)("");
1159
1222
  const [showWallet, setShowWallet] = (0, import_react9.useState)(false);
1160
1223
  const [isDarkMode, setIsDarkMode] = (0, import_react9.useState)(true);
1161
1224
  const [showOnboarding, setShowOnboarding] = (0, import_react9.useState)(false);
1162
1225
  const { account } = (0, import_connect.useAccount)();
1226
+ (0, import_react8.useEffect)(() => {
1227
+ createWalletiframe({ appDomain: dappName, appLogo: logo });
1228
+ }, []);
1163
1229
  (0, import_react8.useEffect)(() => {
1164
1230
  setInterval(() => {
1165
1231
  var _a;
@@ -1175,7 +1241,7 @@ var Application = ({ dappName, logo }) => {
1175
1241
  const nav_context_object = {
1176
1242
  view,
1177
1243
  setView,
1178
- triaName,
1244
+ triaName: triaName2,
1179
1245
  setTriaName,
1180
1246
  dappName,
1181
1247
  logo,
@@ -1187,7 +1253,12 @@ var Application = ({ dappName, logo }) => {
1187
1253
  };
1188
1254
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_wagmi2.WagmiConfig, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(NavContext_default.Provider, { value: nav_context_object, children: [
1189
1255
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_router_dom5.BrowserRouter, { children: [
1190
- showWallet && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "bg flex justify-between bg-black", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mb-4 mr-2 fixed right-2 rounded-[20px] bottom-40 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("iframe", { width: "450", height: "840", src: "https://reliable-semifreddo-e8e93e.netlify.app/" }) }) }),
1256
+ showWallet && // <div className="bg flex justify-between bg-black">
1257
+ // <div className="mb-4 mr-2 absolute right-0 bottom-40 bg-black">
1258
+ // <iframe width="450" height="840" src="https://reliable-semifreddo-e8e93e.netlify.app/" />
1259
+ // </div>
1260
+ // </div>
1261
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "bg flex justify-between bg-black", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mr-2 fixed right-2 bottom-16 rounded-[20px] overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("iframe", { width: "314", height: "588", className: "", src: iframeurl }) }) }),
1191
1262
  showOnboarding && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 shadow-md border border-gray-800 rounded-xl ${isDarkMode ? "dark" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "", children: [
1192
1263
  view === "Home" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Home, {}) : null,
1193
1264
  view === "Sign Up" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SignUp, {}) : null,
@@ -1198,7 +1269,7 @@ var Application = ({ dappName, logo }) => {
1198
1269
  view === "Create A Wallet" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(index2, {}) : null
1199
1270
  ] }) })
1200
1271
  ] }),
1201
- triaName && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1272
+ triaName2 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1202
1273
  "div",
1203
1274
  {
1204
1275
  className: "wallet_icon fixed w-[80px] bottom-4 right-8 cursor-pointer",
@@ -1251,6 +1322,7 @@ var Application = ({ dappName, logo }) => {
1251
1322
  var src_default = Application;
1252
1323
  // Annotate the CommonJS export names for ESM import in node:
1253
1324
  0 && (module.exports = {
1254
- getDefaultWallets
1325
+ getDefaultWallets,
1326
+ triaSendTransaction
1255
1327
  });
1256
1328
  //# sourceMappingURL=index.js.map