test-ahaan-v2-4 1.1.8 → 1.1.10

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
@@ -858,6 +858,126 @@ var import_public = require("wagmi/providers/public");
858
858
  var import_metaMask = require("wagmi/connectors/metaMask");
859
859
  var import_walletConnect = require("wagmi/connectors/walletConnect");
860
860
  var import_coinbaseWallet = require("wagmi/connectors/coinbaseWallet");
861
+
862
+ // src/connect/utils/constants.ts
863
+ var eventTypes = {
864
+ logIn: "Log in",
865
+ triaSignUp: "Tria Sign up",
866
+ socialSignUp: "Social Sign up",
867
+ signMessage: "Sign Message",
868
+ send: "Send",
869
+ disconnect: "Disconnect",
870
+ switchChain: "Switch chain"
871
+ };
872
+
873
+ // src/connect/controllers/iframe.controller.ts
874
+ var IframeController = class {
875
+ constructor({ parentUrl, walletUrl }) {
876
+ this.parentUrl = parentUrl;
877
+ this.walletUrl = walletUrl;
878
+ }
879
+ getVault({
880
+ triaName,
881
+ password,
882
+ userId
883
+ }) {
884
+ const encodedParams = btoa(
885
+ JSON.stringify({
886
+ op: "getVault",
887
+ triaName,
888
+ password,
889
+ userId
890
+ })
891
+ );
892
+ const iframeUrl = `${this.walletUrl}/login?params=${encodedParams}`;
893
+ const eventType = eventTypes.logIn;
894
+ return { iframeUrl, eventType };
895
+ }
896
+ createAccount({ triaName, password }) {
897
+ const encodedParams = btoa(
898
+ JSON.stringify({
899
+ op: "createAccount",
900
+ triaName,
901
+ password
902
+ })
903
+ );
904
+ const iframeUrl = `${this.walletUrl}/login?params=${encodedParams}`;
905
+ const eventType = eventTypes.triaSignUp;
906
+ return { iframeUrl, eventType };
907
+ }
908
+ socialogin({
909
+ triaName,
910
+ password,
911
+ platform,
912
+ userId,
913
+ isPasswordLess
914
+ }) {
915
+ const encodedParams = btoa(
916
+ JSON.stringify({
917
+ op: "socialogin",
918
+ triaName,
919
+ password,
920
+ userId,
921
+ platform,
922
+ isPasswordLess
923
+ })
924
+ );
925
+ const iframeUrl = `${this.walletUrl}/login?params=${encodedParams}`;
926
+ const eventType = eventTypes.socialSignUp;
927
+ return { iframeUrl, eventType };
928
+ }
929
+ signMessage(chainName, message, loginType, triaName, socialName, userId, input, appDomain, appLogo) {
930
+ return __async(this, null, function* () {
931
+ const encodedParams = btoa(
932
+ JSON.stringify({
933
+ chainName,
934
+ message,
935
+ loginType,
936
+ triaName,
937
+ socialName,
938
+ userId,
939
+ input,
940
+ appDomain,
941
+ appLogo
942
+ })
943
+ );
944
+ const iframeUrl = `${this.walletUrl}/sign?params=${encodedParams}`;
945
+ const signWindow = window.open(iframeUrl, "_blank", `popup,width=400,height=500`);
946
+ const eventType = eventTypes.signMessage;
947
+ return { iframeUrl, eventType };
948
+ });
949
+ }
950
+ send(chainName, payload) {
951
+ return __async(this, null, function* () {
952
+ const encodedParams = btoa(
953
+ JSON.stringify({
954
+ chainName,
955
+ payload
956
+ })
957
+ );
958
+ const iframeUrl = `${this.walletUrl}/send?params=${encodedParams}`;
959
+ const sendWindow = window.open(iframeUrl, "_blank", `popup,width=400,height=500`);
960
+ const eventType = eventTypes.send;
961
+ return { iframeUrl, eventType };
962
+ });
963
+ }
964
+ approve(triaName, chainName, tokenAddress, amount) {
965
+ const encodedParams = btoa(
966
+ JSON.stringify({
967
+ chainName,
968
+ triaName,
969
+ tokenAddress,
970
+ amount
971
+ })
972
+ );
973
+ const iframeUrl = `${this.walletUrl}/approve?params=${encodedParams}`;
974
+ const approveWindow = window.open(iframeUrl, "_blank", `popup,width=400,height=500`);
975
+ const eventType = "Approve";
976
+ return { iframeUrl, eventType };
977
+ }
978
+ };
979
+
980
+ // src/index.tsx
861
981
  var import_jsx_runtime16 = require("react/jsx-runtime");
862
982
  window.Buffer = window.Buffer || require("buffer").Buffer;
863
983
  var { chains, publicClient, webSocketPublicClient } = (0, import_wagmi2.configureChains)(
@@ -904,6 +1024,11 @@ var { connectors } = getDefaultWallets({
904
1024
  projectId: "bd38d3892c8fd8bc9dabf6fced0bd3c6",
905
1025
  chains
906
1026
  });
1027
+ var iframe = new IframeController(
1028
+ "https://opensea.com",
1029
+ "https://wallet.tria.so"
1030
+ );
1031
+ console.log("ifrome", iframe);
907
1032
  var wagmiConfig = (0, import_wagmi2.createConfig)({
908
1033
  autoConnect: true,
909
1034
  connectors,
@@ -911,9 +1036,9 @@ var wagmiConfig = (0, import_wagmi2.createConfig)({
911
1036
  webSocketPublicClient
912
1037
  });
913
1038
  var Application = ({ dappName, logo }) => {
914
- const [showWallet, setShowWallet] = (0, import_react10.useState)(true);
915
1039
  const [view, setView] = (0, import_react10.useState)("Home");
916
- const [triaName, setTriaName] = (0, import_react10.useState)("");
1040
+ const [triaName, setTriaName] = (0, import_react10.useState)("dev@tria");
1041
+ const [showWallet, setShowWallet] = setState(false);
917
1042
  const nav_context_object = {
918
1043
  view,
919
1044
  setView,
@@ -922,15 +1047,40 @@ var Application = ({ dappName, logo }) => {
922
1047
  dappName,
923
1048
  logo
924
1049
  };
925
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_wagmi2.WagmiConfig, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(NavContext_default.Provider, { value: nav_context_object, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_router_dom10.BrowserRouter, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "absolute", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "", children: [
926
- view === "Home" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Home, {}) : null,
927
- view === "Sign Up" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SignUp, {}) : null,
928
- view === "Confirm Email" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(index, {}) : null,
929
- view === "Sign In Password" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SignInPassword, {}) : null,
930
- view === "Welcome" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Welcome, {}) : null,
931
- view === "Onboarding" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Onboarding, {}) : null,
932
- view === "Create A Wallet" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(index2, {}) : null
933
- ] }) }) }) }) }) });
1050
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_wagmi2.WagmiConfig, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(NavContext_default.Provider, { value: nav_context_object, children: [
1051
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_router_dom10.BrowserRouter, { children: [
1052
+ showWallet && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "bg flex justify-between bg-black", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mb-4 mr-2 fixed right-2 bottom-24 bg-black", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("iframe", { width: "450", height: "840", src: "https://reliable-semifreddo-e8e93e.netlify.app/" }) }) }),
1053
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "absolute border shadow-md rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "", children: [
1054
+ view === "Home" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Home, {}) : null,
1055
+ view === "Sign Up" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SignUp, {}) : null,
1056
+ view === "Confirm Email" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(index, {}) : null,
1057
+ view === "Sign In Password" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SignInPassword, {}) : null,
1058
+ view === "Welcome" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Welcome, {}) : null,
1059
+ view === "Onboarding" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Onboarding, {}) : null,
1060
+ view === "Create A Wallet" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(index2, {}) : null
1061
+ ] }) })
1062
+ ] }),
1063
+ triaName && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1064
+ "div",
1065
+ {
1066
+ className: "wallet_icon fixed w-[80px] bottom-4 right-8 cursor-pointer",
1067
+ onClick: () => {
1068
+ setShowWallet(!showWallet);
1069
+ },
1070
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "relative ", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "left-[15.49px] top-[15.49px]", children: [
1071
+ " ",
1072
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1073
+ "img",
1074
+ {
1075
+ className: "wallet_icon ",
1076
+ src: "/images/wallet.png",
1077
+ alt: "wallet"
1078
+ }
1079
+ )
1080
+ ] }) })
1081
+ }
1082
+ )
1083
+ ] }) }) });
934
1084
  };
935
1085
  var src_default = Application;
936
1086
  // Annotate the CommonJS export names for ESM import in node: