@multiversx/sdk-dapp-liquidity 2.1.0-alpha.2 → 2.1.0-alpha.4

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "MultiversX",
4
4
  "description": "A complete toolkit for bridging assets between MultiversX, Ethereum, BNB Chain and Sui",
5
5
  "license": "MIT",
6
- "version": "2.1.0-alpha.2",
6
+ "version": "2.1.0-alpha.4",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/multiversx/mx-sdk-dapp-liquidity.git"
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../../../types/chainType.js"),c=require("../../../constants/index.js"),d=require("../../../utils/getCompletePathname.js"),f=({firstTokenId:e,secondTokenId:r,callbackRoute:s,isTokensLoading:n,onNavigate:t})=>{if(n)return;const i=d.getCompletePathname(),u=new URLSearchParams(c.safeWindow.location.search);e&&u.set("firstToken",e),r&&u.set("secondToken",r);const a=`${s}?${u.toString()}`};function m(e,r){var s,n;return(s=e.suiParams)!=null&&s.transactionBytes&&((n=e.suiParams)!=null&&n.sender)?o.ChainType.sui:e.instructions&&e.feePayer?o.ChainType.sol:e.bitcoinParams?o.ChainType.btc:e.to&&e.data!==void 0?o.ChainType.evm:r==null?void 0:r.chainType}const y=(e,r,s)=>{if(s){const t=r==null?void 0:r.find(i=>i.symbol.toLowerCase()===s.toLowerCase());return t?[t]:[]}if(!(e!=null&&e.availableTokens))return[];const n=[];for(const t of e.availableTokens){const i=r==null?void 0:r.find(u=>u.address.toLowerCase()===t.address.toLowerCase());i&&n.push(i)}return n},l=(e,r)=>e.find(s=>s.symbol.toLowerCase().includes("usdc"))??(r==null?void 0:r.find(s=>s.symbol.toLowerCase().includes("usdc")));exports.getAvailableTokens=y;exports.getDefaultReceivingToken=l;exports.resolveSigningChainType=m;exports.updateUrlParams=f;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../../types/chainType.js"),f=require("../../../constants/index.js"),l=require("../../../utils/getCompletePathname.js"),y=({firstTokenId:e,secondTokenId:r,callbackRoute:s,isTokensLoading:n,onNavigate:i})=>{var o,a;if(n)return;const u=l.getCompletePathname(),t=new URLSearchParams(f.safeWindow.location.search);e&&t.set("firstToken",e),r&&t.set("secondToken",r);const d=`${s}?${t.toString()}`;u!==d&&((a=(o=f.safeWindow.history)==null?void 0:o.replaceState)==null||a.call(o,null,"",d),i==null||i(d,{replace:!0}))};function m(e,r){var s,n;return(s=e.suiParams)!=null&&s.transactionBytes&&((n=e.suiParams)!=null&&n.sender)?c.ChainType.sui:e.instructions&&e.feePayer?c.ChainType.sol:e.bitcoinParams?c.ChainType.btc:e.to&&e.data!==void 0?c.ChainType.evm:r==null?void 0:r.chainType}const p=(e,r,s)=>{if(s){const i=r==null?void 0:r.find(u=>u.symbol.toLowerCase()===s.toLowerCase());return i?[i]:[]}if(!(e!=null&&e.availableTokens))return[];const n=[];for(const i of e.availableTokens){const u=r==null?void 0:r.find(t=>t.address.toLowerCase()===i.address.toLowerCase());u&&n.push(u)}return n},h=(e,r)=>e.find(s=>s.symbol.toLowerCase().includes("usdc"))??(r==null?void 0:r.find(s=>s.symbol.toLowerCase().includes("usdc")));exports.getAvailableTokens=p;exports.getDefaultReceivingToken=h;exports.resolveSigningChainType=m;exports.updateUrlParams=y;
@@ -1,44 +1,46 @@
1
1
  import { ChainType as t } from "../../../../types/chainType.mjs";
2
- import { safeWindow as d } from "../../../constants/index.mjs";
3
- import { getCompletePathname as m } from "../../../utils/getCompletePathname.mjs";
4
- const a = ({
2
+ import { safeWindow as c } from "../../../constants/index.mjs";
3
+ import { getCompletePathname as w } from "../../../utils/getCompletePathname.mjs";
4
+ const p = ({
5
5
  firstTokenId: e,
6
6
  secondTokenId: r,
7
7
  callbackRoute: s,
8
8
  isTokensLoading: i,
9
- onNavigate: o
9
+ onNavigate: u
10
10
  }) => {
11
+ var n, m;
11
12
  if (i)
12
13
  return;
13
- const u = m(), n = new URLSearchParams(d.location.search);
14
- e && n.set("firstToken", e), r && n.set("secondToken", r);
15
- const f = `${s}?${n.toString()}`;
14
+ const o = w(), f = new URLSearchParams(c.location.search);
15
+ e && f.set("firstToken", e), r && f.set("secondToken", r);
16
+ const d = `${s}?${f.toString()}`;
17
+ o !== d && ((m = (n = c.history) == null ? void 0 : n.replaceState) == null || m.call(n, null, "", d), u == null || u(d, { replace: !0 }));
16
18
  };
17
- function P(e, r) {
19
+ function L(e, r) {
18
20
  var s, i;
19
21
  return (s = e.suiParams) != null && s.transactionBytes && ((i = e.suiParams) != null && i.sender) ? t.sui : e.instructions && e.feePayer ? t.sol : e.bitcoinParams ? t.btc : e.to && e.data !== void 0 ? t.evm : r == null ? void 0 : r.chainType;
20
22
  }
21
- const y = (e, r, s) => {
23
+ const h = (e, r, s) => {
22
24
  if (s) {
23
- const o = r == null ? void 0 : r.find(
24
- (u) => u.symbol.toLowerCase() === s.toLowerCase()
25
+ const u = r == null ? void 0 : r.find(
26
+ (o) => o.symbol.toLowerCase() === s.toLowerCase()
25
27
  );
26
- return o ? [o] : [];
28
+ return u ? [u] : [];
27
29
  }
28
30
  if (!(e != null && e.availableTokens))
29
31
  return [];
30
32
  const i = [];
31
- for (const o of e.availableTokens) {
32
- const u = r == null ? void 0 : r.find(
33
- (n) => n.address.toLowerCase() === o.address.toLowerCase()
33
+ for (const u of e.availableTokens) {
34
+ const o = r == null ? void 0 : r.find(
35
+ (f) => f.address.toLowerCase() === u.address.toLowerCase()
34
36
  );
35
- u && i.push(u);
37
+ o && i.push(o);
36
38
  }
37
39
  return i;
38
- }, L = (e, r) => e.find((s) => s.symbol.toLowerCase().includes("usdc")) ?? (r == null ? void 0 : r.find((s) => s.symbol.toLowerCase().includes("usdc")));
40
+ }, C = (e, r) => e.find((s) => s.symbol.toLowerCase().includes("usdc")) ?? (r == null ? void 0 : r.find((s) => s.symbol.toLowerCase().includes("usdc")));
39
41
  export {
40
- y as getAvailableTokens,
41
- L as getDefaultReceivingToken,
42
- P as resolveSigningChainType,
43
- a as updateUrlParams
42
+ h as getAvailableTokens,
43
+ C as getDefaultReceivingToken,
44
+ L as resolveSigningChainType,
45
+ p as updateUrlParams
44
46
  };
@@ -12,6 +12,7 @@ export type Web3AppContextProps = {
12
12
  supportedChains: AppKitNetwork[];
13
13
  nativeAuthToken: string;
14
14
  bridgeOnly?: boolean;
15
+ reconnectOnMount?: boolean;
15
16
  signMvxTransactions?: (transactions: IPlainTransactionObject[]) => Promise<{
16
17
  error?: string;
17
18
  batchId?: string;
@@ -23,5 +24,5 @@ export declare const Web3AppContext: import('react').Context<Web3AppContextProps
23
24
  type Web3AppProviderType = Omit<Web3AppContextProps, 'supportedChains'> & {
24
25
  supportedChains?: AppKitNetwork[];
25
26
  };
26
- export declare function Web3AppProvider({ children, config, appKit, options, supportedChains, nativeAuthToken, bridgeOnly, signMvxTransactions, latestMvxTransactionHash, resetMvxTransactionHash }: PropsWithChildren<Web3AppProviderType>): import("react/jsx-runtime").JSX.Element;
27
+ export declare function Web3AppProvider({ children, config, appKit, options, supportedChains, nativeAuthToken, bridgeOnly, reconnectOnMount, signMvxTransactions, latestMvxTransactionHash, resetMvxTransactionHash }: PropsWithChildren<Web3AppProviderType>): import("react/jsx-runtime").JSX.Element;
27
28
  export {};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),c=require("@tanstack/react-query"),e=require("react"),y=require("wagmi"),d=e.createContext(void 0);function C({children:l,config:r,appKit:u,options:n,supportedChains:a=[],nativeAuthToken:t,bridgeOnly:b=!1,signMvxTransactions:o,latestMvxTransactionHash:v,resetMvxTransactionHash:p}){const[s]=e.useState(()=>new c.QueryClient);e.useEffect(()=>{s.invalidateQueries()},[t]);const x=e.useMemo(()=>({config:r,appKit:u,options:n,supportedChains:a,nativeAuthToken:t,bridgeOnly:b,signMvxTransactions:o,latestMvxTransactionHash:v,resetMvxTransactionHash:p}),[r,u,n,t,o]);return i.jsx(d.Provider,{value:x,children:i.jsx(y.WagmiProvider,{config:r,children:i.jsx(c.QueryClientProvider,{client:s,children:l})})})}exports.Web3AppContext=d;exports.Web3AppProvider=C;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),c=require("@tanstack/react-query"),e=require("react"),C=require("wagmi"),d=e.createContext(void 0);function P({children:l,config:r,appKit:i,options:n,supportedChains:a=[],nativeAuthToken:t,bridgeOnly:b=!1,reconnectOnMount:v=!0,signMvxTransactions:o,latestMvxTransactionHash:p,resetMvxTransactionHash:x}){const[s]=e.useState(()=>new c.QueryClient);e.useEffect(()=>{s.invalidateQueries()},[t]);const y=e.useMemo(()=>({config:r,appKit:i,options:n,supportedChains:a,nativeAuthToken:t,bridgeOnly:b,signMvxTransactions:o,latestMvxTransactionHash:p,resetMvxTransactionHash:x}),[r,i,n,t,o]);return u.jsx(d.Provider,{value:y,children:u.jsx(C.WagmiProvider,{config:r,reconnectOnMount:v,children:u.jsx(c.QueryClientProvider,{client:s,children:l})})})}exports.Web3AppContext=d;exports.Web3AppProvider=P;
@@ -1,27 +1,28 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import { QueryClient as s, QueryClientProvider as C } from "@tanstack/react-query";
3
- import { createContext as v, useState as P, useEffect as x, useMemo as y } from "react";
4
- import { WagmiProvider as Q } from "wagmi";
5
- const W = v(
2
+ import { QueryClient as C, QueryClientProvider as v } from "@tanstack/react-query";
3
+ import { createContext as P, useState as x, useEffect as y, useMemo as Q } from "react";
4
+ import { WagmiProvider as W } from "wagmi";
5
+ const a = P(
6
6
  void 0
7
7
  );
8
- function w({
9
- children: u,
8
+ function E({
9
+ children: l,
10
10
  config: e,
11
11
  appKit: o,
12
12
  options: i,
13
13
  supportedChains: d = [],
14
14
  nativeAuthToken: r,
15
15
  bridgeOnly: n = !1,
16
+ reconnectOnMount: c = !0,
16
17
  signMvxTransactions: m,
17
- latestMvxTransactionHash: c,
18
- resetMvxTransactionHash: f
18
+ latestMvxTransactionHash: f,
19
+ resetMvxTransactionHash: p
19
20
  }) {
20
- const [l] = P(() => new s());
21
- x(() => {
22
- l.invalidateQueries();
21
+ const [u] = x(() => new C());
22
+ y(() => {
23
+ u.invalidateQueries();
23
24
  }, [r]);
24
- const p = y(() => ({
25
+ const s = Q(() => ({
25
26
  config: e,
26
27
  appKit: o,
27
28
  options: i,
@@ -29,12 +30,12 @@ function w({
29
30
  nativeAuthToken: r,
30
31
  bridgeOnly: n,
31
32
  signMvxTransactions: m,
32
- latestMvxTransactionHash: c,
33
- resetMvxTransactionHash: f
33
+ latestMvxTransactionHash: f,
34
+ resetMvxTransactionHash: p
34
35
  }), [e, o, i, r, m]);
35
- return /* @__PURE__ */ t(W.Provider, { value: p, children: /* @__PURE__ */ t(Q, { config: e, children: /* @__PURE__ */ t(C, { client: l, children: u }) }) });
36
+ return /* @__PURE__ */ t(a.Provider, { value: s, children: /* @__PURE__ */ t(W, { config: e, reconnectOnMount: c, children: /* @__PURE__ */ t(v, { client: u, children: l }) }) });
36
37
  }
37
38
  export {
38
- W as Web3AppContext,
39
- w as Web3AppProvider
39
+ a as Web3AppContext,
40
+ E as Web3AppProvider
40
41
  };
@@ -15,6 +15,7 @@ export type InitOptions = {
15
15
  suiEnvironment?: 'mainnet' | 'testnet' | 'devnet';
16
16
  suiFeaturedWalletIds?: string[];
17
17
  expectedSuiAddress?: string;
18
+ disableInjectedDiscoveryInMobileDapp?: boolean;
18
19
  };
19
20
  export declare enum SuiMethods {
20
21
  SIGN_TRANSACTION = "sui_signTransaction",
@@ -26,4 +27,5 @@ export declare function init(options: InitOptions): Promise<{
26
27
  appKit: any;
27
28
  options: InitOptions;
28
29
  supportedChains: AppKitNetwork[];
30
+ reconnectOnMount: boolean;
29
31
  }>;
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@reown/appkit/networks"),x=require("@reown/appkit/react"),w=require("@reown/appkit-adapter-wagmi"),N=require("viem/chains"),C=require("../../constants/index.js"),U=require("../../store/inMemoryStore.js"),h=require("../adapters/SuiAdapter.js");function k(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const i in e)if(i!=="default"){const c=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,c.get?c:{enumerable:!0,get:()=>e[i]})}}return n.default=e,Object.freeze(n)}const b=k(N),E=a.defineChain({id:"mainnet",name:"SUI Mainnet",nativeCurrency:{name:"SUI",symbol:"SUI",decimals:9},rpcUrls:{default:{http:["https://fullnode.mainnet.sui.io:443"]}},blockExplorers:{default:{name:"SUI Explorer",url:"https://explorer.sui.io/"}},chainNamespace:"sui",caipNetworkId:"sui:mainnet"}),_=a.defineChain({id:"testnet",name:"SUI Testnet",nativeCurrency:{name:"SUI",symbol:"SUI",decimals:9},rpcUrls:{default:{http:["https://fullnode.testnet.sui.io:443"]}},blockExplorers:{default:{name:"SUI Explorer",url:"https://explorer.sui.io/?network=testnet"}},chainNamespace:"sui",caipNetworkId:"sui:testnet"}),y=a.defineChain({id:"devnet",name:"SUI Devnet",nativeCurrency:{name:"SUI",symbol:"SUI",decimals:9},rpcUrls:{default:{http:["https://fullnode.devnet.sui.io:443"]}},blockExplorers:{default:{name:"SUI Explorer",url:"https://explorer.sui.io/?network=devnet"}},chainNamespace:"sui",caipNetworkId:"sui:devnet"}),v={mainnet:E,testnet:_,devnet:y};var g=(e=>(e.SIGN_TRANSACTION="sui_signTransaction",e.SIGN_AND_EXECUTE_TRANSACTION="sui_signAndExecuteTransaction",e.SIGN_PERSONAL_MESSAGE="sui_signPersonalMessage",e))(g||{});async function O(e){var p,m,S,f,I;const n=U.InMemoryStore.getInstance();n.setItem("apiURL",e.apiURL),n.setItem("bridgeURL",e.bridgeURL),n.setItem("mvxApiURL",e.mvxApiURL),n.setItem("mvxExplorerAddress",e.mvxExplorerAddress),n.setItem("mvxChainId",e.mvxChainId);const i={...b},c=Object.values(i).filter(t=>e.acceptedChainIDs.includes(t.id.toString())&&!C.MVX_CHAIN_IDS.includes(t.id.toString())).map(t=>t),o=[a.mainnet,a.bsc,a.bscTestnet,...c],u=[...o];if(e.suiEnvironment){const t=v[e.suiEnvironment];u.push(t)}const d=new w.WagmiAdapter({...e.adapterConfig,ssr:e.adapterConfig.ssr??!0,projectId:e.appKitOptions.projectId,networks:o}),l=[d];if(e.suiEnvironment){const t=v[e.suiEnvironment],r=t.caipNetworkId??`sui:${t.id}`;l.push(new h.SuiAdapter({explicitCaipChains:[r],expectedSuiAddress:e.expectedSuiAddress}))}const s=x.createAppKit({...e.appKitOptions,adapters:l,networks:[u[0],...u.slice(1)]});if(await s.ready(),e.suiEnvironment){const t=await s.getUniversalProvider(),r=(m=(p=t==null?void 0:t.session)==null?void 0:p.namespaces)==null?void 0:m.sui;if((S=r==null?void 0:r.accounts)!=null&&S.length&&!s.getCaipAddress("sui")){const A=(f=r.accounts[0])==null?void 0:f.split(":").pop();(!e.expectedSuiAddress||A===e.expectedSuiAddress)&&await((I=s.syncWalletConnectAccount)==null?void 0:I.call(s))}}return{config:d.wagmiConfig,appKit:s,options:e,supportedChains:u}}exports.SuiMethods=g;exports.init=O;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@reown/appkit/networks"),b=require("@reown/appkit/react"),x=require("@reown/appkit-adapter-wagmi"),N=require("viem/chains"),h=require("./isMobileInjectedDappBrowser.js"),C=require("../../constants/index.js"),U=require("../../store/inMemoryStore.js"),k=require("../adapters/SuiAdapter.js");function E(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const i in e)if(i!=="default"){const c=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,c.get?c:{enumerable:!0,get:()=>e[i]})}}return n.default=e,Object.freeze(n)}const _=E(N),y=a.defineChain({id:"mainnet",name:"SUI Mainnet",nativeCurrency:{name:"SUI",symbol:"SUI",decimals:9},rpcUrls:{default:{http:["https://fullnode.mainnet.sui.io:443"]}},blockExplorers:{default:{name:"SUI Explorer",url:"https://explorer.sui.io/"}},chainNamespace:"sui",caipNetworkId:"sui:mainnet"}),j=a.defineChain({id:"testnet",name:"SUI Testnet",nativeCurrency:{name:"SUI",symbol:"SUI",decimals:9},rpcUrls:{default:{http:["https://fullnode.testnet.sui.io:443"]}},blockExplorers:{default:{name:"SUI Explorer",url:"https://explorer.sui.io/?network=testnet"}},chainNamespace:"sui",caipNetworkId:"sui:testnet"}),D=a.defineChain({id:"devnet",name:"SUI Devnet",nativeCurrency:{name:"SUI",symbol:"SUI",decimals:9},rpcUrls:{default:{http:["https://fullnode.devnet.sui.io:443"]}},blockExplorers:{default:{name:"SUI Explorer",url:"https://explorer.sui.io/?network=devnet"}},chainNamespace:"sui",caipNetworkId:"sui:devnet"}),g={mainnet:y,testnet:j,devnet:D};var w=(e=>(e.SIGN_TRANSACTION="sui_signTransaction",e.SIGN_AND_EXECUTE_TRANSACTION="sui_signAndExecuteTransaction",e.SIGN_PERSONAL_MESSAGE="sui_signPersonalMessage",e))(w||{});async function O(e){var m,I,f,S,v;const n=U.InMemoryStore.getInstance();n.setItem("apiURL",e.apiURL),n.setItem("bridgeURL",e.bridgeURL),n.setItem("mvxApiURL",e.mvxApiURL),n.setItem("mvxExplorerAddress",e.mvxExplorerAddress),n.setItem("mvxChainId",e.mvxChainId);const i={..._},c=Object.values(i).filter(t=>e.acceptedChainIDs.includes(t.id.toString())&&!C.MVX_CHAIN_IDS.includes(t.id.toString())).map(t=>t),d=[a.mainnet,a.bsc,a.bscTestnet,...c],o=[...d];if(e.suiEnvironment){const t=g[e.suiEnvironment];o.push(t)}const u=!!e.disableInjectedDiscoveryInMobileDapp&&h.isMobileInjectedDappBrowser(),l=new x.WagmiAdapter({...e.adapterConfig,ssr:e.adapterConfig.ssr??!0,projectId:e.appKitOptions.projectId,networks:d,...u?{multiInjectedProviderDiscovery:!1}:{}}),p=[l];if(e.suiEnvironment){const t=g[e.suiEnvironment],r=t.caipNetworkId??`sui:${t.id}`;p.push(new k.SuiAdapter({explicitCaipChains:[r],expectedSuiAddress:e.expectedSuiAddress}))}const s=b.createAppKit({...e.appKitOptions,adapters:p,networks:[o[0],...o.slice(1)],...u?{enableEIP6963:!1}:{}});if(await s.ready(),e.suiEnvironment){const t=await s.getUniversalProvider(),r=(I=(m=t==null?void 0:t.session)==null?void 0:m.namespaces)==null?void 0:I.sui;if((f=r==null?void 0:r.accounts)!=null&&f.length&&!s.getCaipAddress("sui")){const A=(S=r.accounts[0])==null?void 0:S.split(":").pop();(!e.expectedSuiAddress||A===e.expectedSuiAddress)&&await((v=s.syncWalletConnectAccount)==null?void 0:v.call(s))}}return{config:l.wagmiConfig,appKit:s,options:e,supportedChains:o,reconnectOnMount:!u}}exports.SuiMethods=w;exports.init=O;
@@ -1,11 +1,12 @@
1
- import { defineChain as a, mainnet as A, bsc as U, bscTestnet as N } from "@reown/appkit/networks";
2
- import { createAppKit as w } from "@reown/appkit/react";
3
- import { WagmiAdapter as C } from "@reown/appkit-adapter-wagmi";
4
- import * as E from "viem/chains";
5
- import { MVX_CHAIN_IDS as g } from "../../constants/index.mjs";
6
- import { InMemoryStore as h } from "../../store/inMemoryStore.mjs";
7
- import { SuiAdapter as k } from "../adapters/SuiAdapter.mjs";
8
- const b = a({
1
+ import { defineChain as c, mainnet as U, bsc as w, bscTestnet as N } from "@reown/appkit/networks";
2
+ import { createAppKit as C } from "@reown/appkit/react";
3
+ import { WagmiAdapter as E } from "@reown/appkit-adapter-wagmi";
4
+ import * as h from "viem/chains";
5
+ import { isMobileInjectedDappBrowser as g } from "./isMobileInjectedDappBrowser.mjs";
6
+ import { MVX_CHAIN_IDS as k } from "../../constants/index.mjs";
7
+ import { InMemoryStore as b } from "../../store/inMemoryStore.mjs";
8
+ import { SuiAdapter as y } from "../adapters/SuiAdapter.mjs";
9
+ const _ = c({
9
10
  id: "mainnet",
10
11
  name: "SUI Mainnet",
11
12
  nativeCurrency: { name: "SUI", symbol: "SUI", decimals: 9 },
@@ -17,7 +18,7 @@ const b = a({
17
18
  },
18
19
  chainNamespace: "sui",
19
20
  caipNetworkId: "sui:mainnet"
20
- }), _ = a({
21
+ }), D = c({
21
22
  id: "testnet",
22
23
  name: "SUI Testnet",
23
24
  nativeCurrency: { name: "SUI", symbol: "SUI", decimals: 9 },
@@ -32,7 +33,7 @@ const b = a({
32
33
  },
33
34
  chainNamespace: "sui",
34
35
  caipNetworkId: "sui:testnet"
35
- }), y = a({
36
+ }), T = c({
36
37
  id: "devnet",
37
38
  name: "SUI Devnet",
38
39
  nativeCurrency: { name: "SUI", symbol: "SUI", decimals: 9 },
@@ -47,63 +48,66 @@ const b = a({
47
48
  },
48
49
  chainNamespace: "sui",
49
50
  caipNetworkId: "sui:devnet"
50
- }), f = {
51
- mainnet: b,
52
- testnet: _,
53
- devnet: y
51
+ }), v = {
52
+ mainnet: _,
53
+ testnet: D,
54
+ devnet: T
54
55
  };
55
- var T = /* @__PURE__ */ ((e) => (e.SIGN_TRANSACTION = "sui_signTransaction", e.SIGN_AND_EXECUTE_TRANSACTION = "sui_signAndExecuteTransaction", e.SIGN_PERSONAL_MESSAGE = "sui_signPersonalMessage", e))(T || {});
56
- async function j(e) {
57
- var u, m, p, l, I;
58
- const n = h.getInstance();
56
+ var R = /* @__PURE__ */ ((e) => (e.SIGN_TRANSACTION = "sui_signTransaction", e.SIGN_AND_EXECUTE_TRANSACTION = "sui_signAndExecuteTransaction", e.SIGN_PERSONAL_MESSAGE = "sui_signPersonalMessage", e))(R || {});
57
+ async function K(e) {
58
+ var p, m, l, I, f;
59
+ const n = b.getInstance();
59
60
  n.setItem("apiURL", e.apiURL), n.setItem("bridgeURL", e.bridgeURL), n.setItem("mvxApiURL", e.mvxApiURL), n.setItem("mvxExplorerAddress", e.mvxExplorerAddress), n.setItem("mvxChainId", e.mvxChainId);
60
- const S = { ...E }, v = Object.values(S).filter(
61
- (t) => e.acceptedChainIDs.includes(t.id.toString()) && !g.includes(t.id.toString())
62
- ).map((t) => t), c = [
63
- A,
61
+ const S = { ...h }, x = Object.values(S).filter(
62
+ (t) => e.acceptedChainIDs.includes(t.id.toString()) && !k.includes(t.id.toString())
63
+ ).map((t) => t), o = [
64
64
  U,
65
+ w,
65
66
  N,
66
- ...v
67
- ], r = [...c];
67
+ ...x
68
+ ], r = [...o];
68
69
  if (e.suiEnvironment) {
69
- const t = f[e.suiEnvironment];
70
+ const t = v[e.suiEnvironment];
70
71
  r.push(t);
71
72
  }
72
- const o = new C({
73
+ const a = !!e.disableInjectedDiscoveryInMobileDapp && g(), d = new E({
73
74
  ...e.adapterConfig,
74
75
  ssr: e.adapterConfig.ssr ?? !0,
75
76
  projectId: e.appKitOptions.projectId,
76
- networks: c
77
- }), d = [o];
77
+ networks: o,
78
+ ...a ? { multiInjectedProviderDiscovery: !1 } : {}
79
+ }), u = [d];
78
80
  if (e.suiEnvironment) {
79
- const t = f[e.suiEnvironment], i = t.caipNetworkId ?? `sui:${t.id}`;
80
- d.push(
81
- new k({
81
+ const t = v[e.suiEnvironment], i = t.caipNetworkId ?? `sui:${t.id}`;
82
+ u.push(
83
+ new y({
82
84
  explicitCaipChains: [i],
83
85
  expectedSuiAddress: e.expectedSuiAddress
84
86
  })
85
87
  );
86
88
  }
87
- const s = w({
89
+ const s = C({
88
90
  ...e.appKitOptions,
89
- adapters: d,
90
- networks: [r[0], ...r.slice(1)]
91
+ adapters: u,
92
+ networks: [r[0], ...r.slice(1)],
93
+ ...a ? { enableEIP6963: !1 } : {}
91
94
  });
92
95
  if (await s.ready(), e.suiEnvironment) {
93
- const t = await s.getUniversalProvider(), i = (m = (u = t == null ? void 0 : t.session) == null ? void 0 : u.namespaces) == null ? void 0 : m.sui;
94
- if ((p = i == null ? void 0 : i.accounts) != null && p.length && !s.getCaipAddress("sui")) {
95
- const x = (l = i.accounts[0]) == null ? void 0 : l.split(":").pop();
96
- (!e.expectedSuiAddress || x === e.expectedSuiAddress) && await ((I = s.syncWalletConnectAccount) == null ? void 0 : I.call(s));
96
+ const t = await s.getUniversalProvider(), i = (m = (p = t == null ? void 0 : t.session) == null ? void 0 : p.namespaces) == null ? void 0 : m.sui;
97
+ if ((l = i == null ? void 0 : i.accounts) != null && l.length && !s.getCaipAddress("sui")) {
98
+ const A = (I = i.accounts[0]) == null ? void 0 : I.split(":").pop();
99
+ (!e.expectedSuiAddress || A === e.expectedSuiAddress) && await ((f = s.syncWalletConnectAccount) == null ? void 0 : f.call(s));
97
100
  }
98
101
  }
99
102
  return {
100
- config: o.wagmiConfig,
103
+ config: d.wagmiConfig,
101
104
  appKit: s,
102
105
  options: e,
103
- supportedChains: r
106
+ supportedChains: r,
107
+ reconnectOnMount: !a
104
108
  };
105
109
  }
106
110
  export {
107
- T as SuiMethods,
108
- j as init
111
+ R as SuiMethods,
112
+ K as init
109
113
  };
@@ -0,0 +1 @@
1
+ export declare function isMobileInjectedDappBrowser(): boolean;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../constants/index.js");function i(){if(!e.safeWindow.navigator.userAgent)return!1;const n=/Android|iPhone|iPad|iPod|Mobile/i.test(e.safeWindow.navigator.userAgent)&&!/Windows Phone/i.test(e.safeWindow.navigator.userAgent),o=!!e.safeWindow.ethereum;return n&&o}exports.isMobileInjectedDappBrowser=i;
@@ -0,0 +1,10 @@
1
+ import { safeWindow as e } from "../constants/index.mjs";
2
+ function t() {
3
+ if (!e.navigator.userAgent)
4
+ return !1;
5
+ const o = /Android|iPhone|iPad|iPod|Mobile/i.test(e.navigator.userAgent) && !/Windows Phone/i.test(e.navigator.userAgent), i = !!e.ethereum;
6
+ return o && i;
7
+ }
8
+ export {
9
+ t as isMobileInjectedDappBrowser
10
+ };