@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 +1 -1
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.js +1 -1
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.mjs +23 -21
- package/reactjs/context/Web3AppProvider.d.ts +2 -1
- package/reactjs/context/Web3AppProvider.js +1 -1
- package/reactjs/context/Web3AppProvider.mjs +18 -17
- package/reactjs/init/init.d.ts +2 -0
- package/reactjs/init/init.js +1 -1
- package/reactjs/init/init.mjs +46 -42
- package/reactjs/init/isMobileInjectedDappBrowser.d.ts +1 -0
- package/reactjs/init/isMobileInjectedDappBrowser.js +2 -0
- package/reactjs/init/isMobileInjectedDappBrowser.mjs +10 -0
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.
|
|
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
|
|
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
|
|
3
|
-
import { getCompletePathname as
|
|
4
|
-
const
|
|
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:
|
|
9
|
+
onNavigate: u
|
|
10
10
|
}) => {
|
|
11
|
+
var n, m;
|
|
11
12
|
if (i)
|
|
12
13
|
return;
|
|
13
|
-
const
|
|
14
|
-
e &&
|
|
15
|
-
const
|
|
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
|
|
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
|
|
23
|
+
const h = (e, r, s) => {
|
|
22
24
|
if (s) {
|
|
23
|
-
const
|
|
24
|
-
(
|
|
25
|
+
const u = r == null ? void 0 : r.find(
|
|
26
|
+
(o) => o.symbol.toLowerCase() === s.toLowerCase()
|
|
25
27
|
);
|
|
26
|
-
return
|
|
28
|
+
return u ? [u] : [];
|
|
27
29
|
}
|
|
28
30
|
if (!(e != null && e.availableTokens))
|
|
29
31
|
return [];
|
|
30
32
|
const i = [];
|
|
31
|
-
for (const
|
|
32
|
-
const
|
|
33
|
-
(
|
|
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
|
-
|
|
37
|
+
o && i.push(o);
|
|
36
38
|
}
|
|
37
39
|
return i;
|
|
38
|
-
},
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
|
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
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { WagmiProvider as
|
|
5
|
-
const
|
|
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
|
|
9
|
-
children:
|
|
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:
|
|
18
|
-
resetMvxTransactionHash:
|
|
18
|
+
latestMvxTransactionHash: f,
|
|
19
|
+
resetMvxTransactionHash: p
|
|
19
20
|
}) {
|
|
20
|
-
const [
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const [u] = x(() => new C());
|
|
22
|
+
y(() => {
|
|
23
|
+
u.invalidateQueries();
|
|
23
24
|
}, [r]);
|
|
24
|
-
const
|
|
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:
|
|
33
|
-
resetMvxTransactionHash:
|
|
33
|
+
latestMvxTransactionHash: f,
|
|
34
|
+
resetMvxTransactionHash: p
|
|
34
35
|
}), [e, o, i, r, m]);
|
|
35
|
-
return /* @__PURE__ */ t(
|
|
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
|
-
|
|
39
|
-
|
|
39
|
+
a as Web3AppContext,
|
|
40
|
+
E as Web3AppProvider
|
|
40
41
|
};
|
package/reactjs/init/init.d.ts
CHANGED
|
@@ -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
|
}>;
|
package/reactjs/init/init.js
CHANGED
|
@@ -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"),
|
|
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;
|
package/reactjs/init/init.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { defineChain as
|
|
2
|
-
import { createAppKit as
|
|
3
|
-
import { WagmiAdapter as
|
|
4
|
-
import * as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
51
|
-
mainnet:
|
|
52
|
-
testnet:
|
|
53
|
-
devnet:
|
|
51
|
+
}), v = {
|
|
52
|
+
mainnet: _,
|
|
53
|
+
testnet: D,
|
|
54
|
+
devnet: T
|
|
54
55
|
};
|
|
55
|
-
var
|
|
56
|
-
async function
|
|
57
|
-
var
|
|
58
|
-
const n =
|
|
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 = { ...
|
|
61
|
-
(t) => e.acceptedChainIDs.includes(t.id.toString()) && !
|
|
62
|
-
).map((t) => t),
|
|
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
|
-
...
|
|
67
|
-
], r = [...
|
|
67
|
+
...x
|
|
68
|
+
], r = [...o];
|
|
68
69
|
if (e.suiEnvironment) {
|
|
69
|
-
const t =
|
|
70
|
+
const t = v[e.suiEnvironment];
|
|
70
71
|
r.push(t);
|
|
71
72
|
}
|
|
72
|
-
const
|
|
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:
|
|
77
|
-
|
|
77
|
+
networks: o,
|
|
78
|
+
...a ? { multiInjectedProviderDiscovery: !1 } : {}
|
|
79
|
+
}), u = [d];
|
|
78
80
|
if (e.suiEnvironment) {
|
|
79
|
-
const t =
|
|
80
|
-
|
|
81
|
-
new
|
|
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 =
|
|
89
|
+
const s = C({
|
|
88
90
|
...e.appKitOptions,
|
|
89
|
-
adapters:
|
|
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 = (
|
|
94
|
-
if ((
|
|
95
|
-
const
|
|
96
|
-
(!e.expectedSuiAddress ||
|
|
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:
|
|
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
|
-
|
|
108
|
-
|
|
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
|
+
};
|