@multiversx/sdk-dapp-liquidity 2.3.0-alpha.3 → 2.3.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.3.0-alpha.3",
6
+ "version": "2.3.0-alpha.4",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/multiversx/mx-sdk-dapp-liquidity.git"
@@ -16,6 +16,7 @@ export type InitOptions = {
16
16
  suiFeaturedWalletIds?: string[];
17
17
  expectedSuiAddress?: string;
18
18
  disableInjectedDiscoveryInMobileDapp?: boolean;
19
+ disableSuiAutoReconnect?: boolean;
19
20
  };
20
21
  export declare enum SuiMethods {
21
22
  SIGN_TRANSACTION = "sui_signTransaction",
@@ -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"),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;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@reown/appkit/networks"),x=require("@reown/appkit/react"),h=require("@reown/appkit-adapter-wagmi"),N=require("viem/chains"),C=require("./isMobileInjectedDappBrowser.js"),U=require("../../constants/index.js"),k=require("../../store/inMemoryStore.js"),E=require("../adapters/SuiAdapter.js");function _(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 y=_(N),j=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"}),D=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"}),O=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"}),b={mainnet:j,testnet:D,devnet:O};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 M(e){var m,I,f,S,v;const n=k.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={...y},c=Object.values(i).filter(t=>e.acceptedChainIDs.includes(t.id.toString())&&!U.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=b[e.suiEnvironment];o.push(t)}const u=!!e.disableInjectedDiscoveryInMobileDapp&&C.isMobileInjectedDappBrowser(),A=u||!!e.disableSuiAutoReconnect,l=new h.WagmiAdapter({...e.adapterConfig,ssr:e.adapterConfig.ssr??!0,projectId:e.appKitOptions.projectId,networks:d,...u?{multiInjectedProviderDiscovery:!1}:{}}),p=[l];if(e.suiEnvironment){const t=b[e.suiEnvironment],r=t.caipNetworkId??`sui:${t.id}`;p.push(new E.SuiAdapter({explicitCaipChains:[r],expectedSuiAddress:e.expectedSuiAddress}))}const s=x.createAppKit({...e.appKitOptions,adapters:p,networks:[o[0],...o.slice(1)],...u?{enableEIP6963:!1,enableInjected:!1}:{}});if(await s.ready(),e.suiEnvironment&&!A){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 w=(S=r.accounts[0])==null?void 0:S.split(":").pop();(!e.expectedSuiAddress||w===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=g;exports.init=M;
@@ -1,12 +1,12 @@
1
- import { defineChain as c, mainnet as U, bsc as w, bscTestnet as N } from "@reown/appkit/networks";
1
+ import { defineChain as c, mainnet as w, bsc as N, bscTestnet as h } from "@reown/appkit/networks";
2
2
  import { createAppKit as C } from "@reown/appkit/react";
3
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({
4
+ import * as g from "viem/chains";
5
+ import { isMobileInjectedDappBrowser as k } from "./isMobileInjectedDappBrowser.mjs";
6
+ import { MVX_CHAIN_IDS as b } from "../../constants/index.mjs";
7
+ import { InMemoryStore as y } from "../../store/inMemoryStore.mjs";
8
+ import { SuiAdapter as _ } from "../adapters/SuiAdapter.mjs";
9
+ const D = c({
10
10
  id: "mainnet",
11
11
  name: "SUI Mainnet",
12
12
  nativeCurrency: { name: "SUI", symbol: "SUI", decimals: 9 },
@@ -18,7 +18,7 @@ const _ = c({
18
18
  },
19
19
  chainNamespace: "sui",
20
20
  caipNetworkId: "sui:mainnet"
21
- }), D = c({
21
+ }), R = c({
22
22
  id: "testnet",
23
23
  name: "SUI Testnet",
24
24
  nativeCurrency: { name: "SUI", symbol: "SUI", decimals: 9 },
@@ -48,29 +48,29 @@ const _ = c({
48
48
  },
49
49
  chainNamespace: "sui",
50
50
  caipNetworkId: "sui:devnet"
51
- }), v = {
52
- mainnet: _,
53
- testnet: D,
51
+ }), S = {
52
+ mainnet: D,
53
+ testnet: R,
54
54
  devnet: T
55
55
  };
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();
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);
61
- const S = { ...h }, x = Object.values(S).filter(
62
- (t) => e.acceptedChainIDs.includes(t.id.toString()) && !k.includes(t.id.toString())
56
+ var j = /* @__PURE__ */ ((e) => (e.SIGN_TRANSACTION = "sui_signTransaction", e.SIGN_AND_EXECUTE_TRANSACTION = "sui_signAndExecuteTransaction", e.SIGN_PERSONAL_MESSAGE = "sui_signPersonalMessage", e))(j || {});
57
+ async function W(e) {
58
+ var l, m, p, I, f;
59
+ const i = y.getInstance();
60
+ i.setItem("apiURL", e.apiURL), i.setItem("bridgeURL", e.bridgeURL), i.setItem("mvxApiURL", e.mvxApiURL), i.setItem("mvxExplorerAddress", e.mvxExplorerAddress), i.setItem("mvxChainId", e.mvxChainId);
61
+ const v = { ...g }, x = Object.values(v).filter(
62
+ (t) => e.acceptedChainIDs.includes(t.id.toString()) && !b.includes(t.id.toString())
63
63
  ).map((t) => t), o = [
64
- U,
65
64
  w,
66
65
  N,
66
+ h,
67
67
  ...x
68
68
  ], r = [...o];
69
69
  if (e.suiEnvironment) {
70
- const t = v[e.suiEnvironment];
70
+ const t = S[e.suiEnvironment];
71
71
  r.push(t);
72
72
  }
73
- const a = !!e.disableInjectedDiscoveryInMobileDapp && g(), d = new E({
73
+ const a = !!e.disableInjectedDiscoveryInMobileDapp && k(), A = a || !!e.disableSuiAutoReconnect, d = new E({
74
74
  ...e.adapterConfig,
75
75
  ssr: e.adapterConfig.ssr ?? !0,
76
76
  projectId: e.appKitOptions.projectId,
@@ -78,10 +78,10 @@ async function K(e) {
78
78
  ...a ? { multiInjectedProviderDiscovery: !1 } : {}
79
79
  }), u = [d];
80
80
  if (e.suiEnvironment) {
81
- const t = v[e.suiEnvironment], i = t.caipNetworkId ?? `sui:${t.id}`;
81
+ const t = S[e.suiEnvironment], n = t.caipNetworkId ?? `sui:${t.id}`;
82
82
  u.push(
83
- new y({
84
- explicitCaipChains: [i],
83
+ new _({
84
+ explicitCaipChains: [n],
85
85
  expectedSuiAddress: e.expectedSuiAddress
86
86
  })
87
87
  );
@@ -90,13 +90,13 @@ async function K(e) {
90
90
  ...e.appKitOptions,
91
91
  adapters: u,
92
92
  networks: [r[0], ...r.slice(1)],
93
- ...a ? { enableEIP6963: !1 } : {}
93
+ ...a ? { enableEIP6963: !1, enableInjected: !1 } : {}
94
94
  });
95
- if (await s.ready(), e.suiEnvironment) {
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));
95
+ if (await s.ready(), e.suiEnvironment && !A) {
96
+ const t = await s.getUniversalProvider(), n = (m = (l = t == null ? void 0 : t.session) == null ? void 0 : l.namespaces) == null ? void 0 : m.sui;
97
+ if ((p = n == null ? void 0 : n.accounts) != null && p.length && !s.getCaipAddress("sui")) {
98
+ const U = (I = n.accounts[0]) == null ? void 0 : I.split(":").pop();
99
+ (!e.expectedSuiAddress || U === e.expectedSuiAddress) && await ((f = s.syncWalletConnectAccount) == null ? void 0 : f.call(s));
100
100
  }
101
101
  }
102
102
  return {
@@ -108,6 +108,6 @@ async function K(e) {
108
108
  };
109
109
  }
110
110
  export {
111
- R as SuiMethods,
112
- K as init
111
+ j as SuiMethods,
112
+ W as init
113
113
  };