@multiversx/sdk-dapp-liquidity 2.3.0-alpha.6 → 2.3.0
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.
|
@@ -9,7 +9,7 @@ const c = /^erd1[0-9a-z]{58}$/, u = /^0x[0-9a-fA-F]{64}$/, a = /* @__PURE__ */ n
|
|
|
9
9
|
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
10
10
|
// MultiversX dead address
|
|
11
11
|
"erd1deaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaqtv0gag",
|
|
12
|
-
// BTC
|
|
12
|
+
// BTC
|
|
13
13
|
"1111111111111111111114oLvT2"
|
|
14
14
|
]), i = (e) => {
|
|
15
15
|
const r = e.toLowerCase();
|
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
|
|
6
|
+
"version": "2.3.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/multiversx/mx-sdk-dapp-liquidity.git"
|
package/reactjs/init/init.d.ts
CHANGED
|
@@ -16,7 +16,6 @@ export type InitOptions = {
|
|
|
16
16
|
suiFeaturedWalletIds?: string[];
|
|
17
17
|
expectedSuiAddress?: string;
|
|
18
18
|
disableInjectedDiscoveryInMobileDapp?: boolean;
|
|
19
|
-
disableSuiAutoReconnect?: boolean;
|
|
20
19
|
};
|
|
21
20
|
export declare enum SuiMethods {
|
|
22
21
|
SIGN_TRANSACTION = "sui_signTransaction",
|
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"),A=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 b=(e=>(e.SIGN_TRANSACTION="sui_signTransaction",e.SIGN_AND_EXECUTE_TRANSACTION="sui_signAndExecuteTransaction",e.SIGN_PERSONAL_MESSAGE="sui_signPersonalMessage",e))(b||{});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),u=[a.mainnet,a.bsc,a.bscTestnet,...c],o=[...u];if(e.suiEnvironment){const t=g[e.suiEnvironment];o.push(t)}const d=!!e.disableInjectedDiscoveryInMobileDapp&&h.isMobileInjectedDappBrowser(),l=new x.WagmiAdapter({...e.adapterConfig,ssr:e.adapterConfig.ssr??!0,projectId:e.appKitOptions.projectId,networks:u,...d?{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=A.createAppKit({...e.appKitOptions,adapters:p,networks:[o[0],...o.slice(1)],...d?{enableEIP6963:!1,enableInjected:!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 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:!d}}exports.SuiMethods=b;exports.init=O;
|
package/reactjs/init/init.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineChain as c, mainnet as
|
|
1
|
+
import { defineChain as c, mainnet as U, bsc as w, bscTestnet as N } 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
|
|
5
|
-
import { isMobileInjectedDappBrowser as
|
|
6
|
-
import { MVX_CHAIN_IDS as
|
|
7
|
-
import { InMemoryStore as
|
|
8
|
-
import { SuiAdapter as
|
|
9
|
-
const
|
|
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({
|
|
10
10
|
id: "mainnet",
|
|
11
11
|
name: "SUI Mainnet",
|
|
12
12
|
nativeCurrency: { name: "SUI", symbol: "SUI", decimals: 9 },
|
|
@@ -18,7 +18,7 @@ const D = c({
|
|
|
18
18
|
},
|
|
19
19
|
chainNamespace: "sui",
|
|
20
20
|
caipNetworkId: "sui:mainnet"
|
|
21
|
-
}),
|
|
21
|
+
}), D = c({
|
|
22
22
|
id: "testnet",
|
|
23
23
|
name: "SUI Testnet",
|
|
24
24
|
nativeCurrency: { name: "SUI", symbol: "SUI", decimals: 9 },
|
|
@@ -48,29 +48,29 @@ const D = c({
|
|
|
48
48
|
},
|
|
49
49
|
chainNamespace: "sui",
|
|
50
50
|
caipNetworkId: "sui:devnet"
|
|
51
|
-
}),
|
|
52
|
-
mainnet:
|
|
53
|
-
testnet:
|
|
51
|
+
}), v = {
|
|
52
|
+
mainnet: _,
|
|
53
|
+
testnet: D,
|
|
54
54
|
devnet: T
|
|
55
55
|
};
|
|
56
|
-
var
|
|
57
|
-
async function
|
|
58
|
-
var l,
|
|
59
|
-
const i =
|
|
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 l, p, m, I, f;
|
|
59
|
+
const i = b.getInstance();
|
|
60
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
|
|
62
|
-
(t) => e.acceptedChainIDs.includes(t.id.toString()) && !
|
|
61
|
+
const S = { ...h }, x = Object.values(S).filter(
|
|
62
|
+
(t) => e.acceptedChainIDs.includes(t.id.toString()) && !k.includes(t.id.toString())
|
|
63
63
|
).map((t) => t), o = [
|
|
64
|
+
U,
|
|
64
65
|
w,
|
|
65
66
|
N,
|
|
66
|
-
h,
|
|
67
67
|
...x
|
|
68
68
|
], r = [...o];
|
|
69
69
|
if (e.suiEnvironment) {
|
|
70
|
-
const t =
|
|
70
|
+
const t = v[e.suiEnvironment];
|
|
71
71
|
r.push(t);
|
|
72
72
|
}
|
|
73
|
-
const a = !!e.disableInjectedDiscoveryInMobileDapp &&
|
|
73
|
+
const a = !!e.disableInjectedDiscoveryInMobileDapp && g(), d = new E({
|
|
74
74
|
...e.adapterConfig,
|
|
75
75
|
ssr: e.adapterConfig.ssr ?? !0,
|
|
76
76
|
projectId: e.appKitOptions.projectId,
|
|
@@ -78,9 +78,9 @@ async function W(e) {
|
|
|
78
78
|
...a ? { multiInjectedProviderDiscovery: !1 } : {}
|
|
79
79
|
}), u = [d];
|
|
80
80
|
if (e.suiEnvironment) {
|
|
81
|
-
const t =
|
|
81
|
+
const t = v[e.suiEnvironment], n = t.caipNetworkId ?? `sui:${t.id}`;
|
|
82
82
|
u.push(
|
|
83
|
-
new
|
|
83
|
+
new y({
|
|
84
84
|
explicitCaipChains: [n],
|
|
85
85
|
expectedSuiAddress: e.expectedSuiAddress
|
|
86
86
|
})
|
|
@@ -92,11 +92,11 @@ async function W(e) {
|
|
|
92
92
|
networks: [r[0], ...r.slice(1)],
|
|
93
93
|
...a ? { enableEIP6963: !1, enableInjected: !1 } : {}
|
|
94
94
|
});
|
|
95
|
-
if (await s.ready(), e.suiEnvironment
|
|
96
|
-
const t = await s.getUniversalProvider(), n = (
|
|
97
|
-
if ((
|
|
98
|
-
const
|
|
99
|
-
(!e.expectedSuiAddress ||
|
|
95
|
+
if (await s.ready(), e.suiEnvironment) {
|
|
96
|
+
const t = await s.getUniversalProvider(), n = (p = (l = t == null ? void 0 : t.session) == null ? void 0 : l.namespaces) == null ? void 0 : p.sui;
|
|
97
|
+
if ((m = n == null ? void 0 : n.accounts) != null && m.length && !s.getCaipAddress("sui")) {
|
|
98
|
+
const A = (I = n.accounts[0]) == null ? void 0 : I.split(":").pop();
|
|
99
|
+
(!e.expectedSuiAddress || A === 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 W(e) {
|
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
export {
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
R as SuiMethods,
|
|
112
|
+
K as init
|
|
113
113
|
};
|
package/types/errors.d.ts
CHANGED
|
@@ -2,16 +2,14 @@ export declare class RateConfirmationMismatchError extends Error {
|
|
|
2
2
|
constructor(message: string);
|
|
3
3
|
}
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* calling confirmRate. Generic message — not shown verbatim to end users.
|
|
5
|
+
* Generic message - not shown verbatim to end users.
|
|
7
6
|
*/
|
|
8
7
|
export declare class ConfirmRateError extends Error {
|
|
9
8
|
constructor(message: string);
|
|
10
9
|
}
|
|
11
10
|
/**
|
|
12
11
|
* Thrown when a required form field (fromChainId, toChainId, sender, receiver) is
|
|
13
|
-
* missing or empty before calling confirmRate.
|
|
14
|
-
* can be displayed to the user.
|
|
12
|
+
* missing or empty before calling confirmRate.
|
|
15
13
|
*/
|
|
16
14
|
export declare class MissingConfirmRateDataError extends Error {
|
|
17
15
|
constructor(message: string);
|