@xswap-link/sdk 0.12.1 → 0.12.2
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/CHANGELOG.md +6 -0
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.global.js +332 -336
- package/dist/index.js +33 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/TxConfigForm/index.tsx +8 -2
- package/src/components/TxWidgetWCWrapped/index.tsx +6 -0
- package/src/config/wagmiConfig.ts +2 -1
- package/src/context/SwapProvider.tsx +16 -14
- package/src/models/payloads/ModalIntegrationPayload.ts +2 -0
- package/src/models/payloads/WidgetIntegrationPayload.ts +2 -0
- package/src/services/integrations/transactions.ts +2 -0
- package/src/types/global.d.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -22149,15 +22149,20 @@ var SwapProvider = ({
|
|
|
22149
22149
|
setIsFetchingBalance(true);
|
|
22150
22150
|
let balance = "0";
|
|
22151
22151
|
if (srcChain?.ecosystem === "evm" /* EVM */ && evmAddress) {
|
|
22152
|
-
const
|
|
22153
|
-
|
|
22154
|
-
|
|
22155
|
-
|
|
22156
|
-
|
|
22157
|
-
|
|
22158
|
-
|
|
22159
|
-
|
|
22160
|
-
|
|
22152
|
+
const balanceFromBackend = tokenBalances[srcChain?.chainId]?.[srcToken.address];
|
|
22153
|
+
if (balanceFromBackend === void 0) {
|
|
22154
|
+
const balanceUI = await getBalanceOf(
|
|
22155
|
+
evmAddress,
|
|
22156
|
+
srcToken.address,
|
|
22157
|
+
srcChain?.publicRpcUrls[0]
|
|
22158
|
+
);
|
|
22159
|
+
balance = humanReadableToWei({
|
|
22160
|
+
amount: balanceUI,
|
|
22161
|
+
decimals: srcToken.decimals
|
|
22162
|
+
});
|
|
22163
|
+
} else {
|
|
22164
|
+
balance = balanceFromBackend;
|
|
22165
|
+
}
|
|
22161
22166
|
} else if (srcChain?.ecosystem === "solana" /* SOLANA */ && solanaAddress) {
|
|
22162
22167
|
const solanaPublicKey = new import_web35.PublicKey(solanaAddress);
|
|
22163
22168
|
const connection = new import_web35.Connection(srcChain.publicRpcUrls[0]);
|
|
@@ -22194,7 +22199,7 @@ var SwapProvider = ({
|
|
|
22194
22199
|
}
|
|
22195
22200
|
setSrcTokenBalanceWei(balance);
|
|
22196
22201
|
setIsFetchingBalance(false);
|
|
22197
|
-
}, [evmAddress, solanaAddress, srcChain, srcToken]);
|
|
22202
|
+
}, [evmAddress, solanaAddress, srcChain, srcToken, tokenBalances]);
|
|
22198
22203
|
const findTokenDataByAddressAndChain = (0, import_react11.useCallback)(
|
|
22199
22204
|
(tokenAddress, chainId) => {
|
|
22200
22205
|
return supportedTokens[chainId]?.[tokenAddress];
|
|
@@ -25127,6 +25132,7 @@ var getWagmiConfig = (supportedChains) => {
|
|
|
25127
25132
|
chains,
|
|
25128
25133
|
transports,
|
|
25129
25134
|
connectors: [
|
|
25135
|
+
(0, import_connectors.injected)(),
|
|
25130
25136
|
(0, import_connectors.walletConnect)({
|
|
25131
25137
|
projectId: "c392898b45ac587a280b5eb33e92aeb0",
|
|
25132
25138
|
showQrModal: true
|
|
@@ -28892,7 +28898,8 @@ var TxConfigForm = (props) => {
|
|
|
28892
28898
|
override,
|
|
28893
28899
|
integratorFee,
|
|
28894
28900
|
integratorFeeReceiverAddress,
|
|
28895
|
-
highlightedDstTokens
|
|
28901
|
+
highlightedDstTokens,
|
|
28902
|
+
wagmiConfig: providedWagmiConfig
|
|
28896
28903
|
} = normalizedProps;
|
|
28897
28904
|
const onBackdropClick = (e) => {
|
|
28898
28905
|
e.stopPropagation();
|
|
@@ -28902,8 +28909,8 @@ var TxConfigForm = (props) => {
|
|
|
28902
28909
|
}
|
|
28903
28910
|
};
|
|
28904
28911
|
const wagmiConfig = (0, import_react45.useMemo)(
|
|
28905
|
-
() => getWagmiConfig(supportedChains),
|
|
28906
|
-
[supportedChains]
|
|
28912
|
+
() => providedWagmiConfig ?? window.xPayWagmiConfig ?? getWagmiConfig(supportedChains),
|
|
28913
|
+
[providedWagmiConfig, supportedChains]
|
|
28907
28914
|
);
|
|
28908
28915
|
(0, import_react45.useEffect)(() => {
|
|
28909
28916
|
changeHostVariableColor(lightTheme, styles);
|
|
@@ -28993,7 +29000,8 @@ var openTxConfigForm = async ({
|
|
|
28993
29000
|
dstChainLocked,
|
|
28994
29001
|
srcTokenLocked,
|
|
28995
29002
|
srcChainLocked,
|
|
28996
|
-
override
|
|
29003
|
+
override,
|
|
29004
|
+
wagmiConfig
|
|
28997
29005
|
}) => {
|
|
28998
29006
|
try {
|
|
28999
29007
|
if (xpayRoot === null) {
|
|
@@ -29036,7 +29044,8 @@ var openTxConfigForm = async ({
|
|
|
29036
29044
|
dstChainLocked,
|
|
29037
29045
|
srcTokenLocked,
|
|
29038
29046
|
srcChainLocked,
|
|
29039
|
-
override
|
|
29047
|
+
override,
|
|
29048
|
+
wagmiConfig
|
|
29040
29049
|
}
|
|
29041
29050
|
)
|
|
29042
29051
|
);
|
|
@@ -29572,8 +29581,12 @@ var TxWidgetWCWrapped = ({
|
|
|
29572
29581
|
override,
|
|
29573
29582
|
integratorFee,
|
|
29574
29583
|
integratorFeeReceiverAddress,
|
|
29575
|
-
highlightedDstTokens
|
|
29584
|
+
highlightedDstTokens,
|
|
29585
|
+
wagmiConfig
|
|
29576
29586
|
}) => {
|
|
29587
|
+
if (typeof window !== "undefined") {
|
|
29588
|
+
window.xPayWagmiConfig = wagmiConfig;
|
|
29589
|
+
}
|
|
29577
29590
|
(0, import_react50.useEffect)(() => {
|
|
29578
29591
|
window.xPayOnPendingTransactionsChange = onPendingTransactionsChange;
|
|
29579
29592
|
window.xPayOnDstTokenChange = onDstTokenChange;
|
|
@@ -29812,7 +29825,8 @@ var openTransactionModal = async ({
|
|
|
29812
29825
|
onSrcTokenChange,
|
|
29813
29826
|
onSrcChainChange,
|
|
29814
29827
|
bridge,
|
|
29815
|
-
highlightedDstTokens
|
|
29828
|
+
highlightedDstTokens,
|
|
29829
|
+
wagmiConfig
|
|
29816
29830
|
}) => {
|
|
29817
29831
|
const supportedChains = (await getChains()).filter(
|
|
29818
29832
|
({ web3Environment, swapSupported, bridgeSupported }) => web3Environment === "mainnet" /* MAINNET */ && (swapSupported || bridgeSupported)
|
|
@@ -29848,7 +29862,8 @@ var openTransactionModal = async ({
|
|
|
29848
29862
|
onSrcTokenChange,
|
|
29849
29863
|
onSrcChainChange,
|
|
29850
29864
|
bridge,
|
|
29851
|
-
highlightedDstTokens
|
|
29865
|
+
highlightedDstTokens,
|
|
29866
|
+
wagmiConfig
|
|
29852
29867
|
});
|
|
29853
29868
|
};
|
|
29854
29869
|
var validateSwapTxData = (integratorId, supportedChains, dstChain, dstToken, srcChain, srcToken) => {
|