@huma-finance/widgets 0.0.42-beta.99 → 0.0.43-beta.107
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/API.md +1 -1
- package/dist/cjs/index.cjs +26 -35
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -37
- package/dist/index.js.map +1 -1
- package/package.json +8 -10
- package/src/components/ChainSupportProvider.tsx +50 -0
- package/src/index.tsx +5 -35
- package/cypress/e2e/01-invoice-factoring-borrow.test.ts +0 -62
- package/cypress/support/e2e.ts +0 -76
- package/cypress/support/ethereum.ts +0 -142
- package/cypress/tsconfig.json +0 -9
- package/cypress/utils/index.ts +0 -54
- package/cypress.config.ts +0 -20
- package/src/components/ChainNotSupportedModal.tsx +0 -33
package/dist/index.d.ts
CHANGED
|
@@ -128,7 +128,7 @@ type JsonRpcConnectionMap = {
|
|
|
128
128
|
* @typedef {Object} WidgetProps
|
|
129
129
|
* @property {desiredChainId|undefined} desiredChainId Optional desired chain id, will trigger the switch network action if different from the current chain id
|
|
130
130
|
* @property {JsonRpcConnectionMap|undefined} jsonRpcUrlMap Optional mapping of your JSON-RPC connections indexed by chainId
|
|
131
|
-
* @property {Eip1193Provider|
|
|
131
|
+
* @property {Eip1193Provider|JsonRpcProvider} provider EIP-1193 provider or JsonRpc Provider
|
|
132
132
|
*/
|
|
133
133
|
type WidgetProps = {
|
|
134
134
|
handleClose?: () => void;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { txAtom, useMQ, sendTxAtom, isTxFailed, getExplorerUrl, openInNewTab, usePoolUnderlyingTokenContract, TxStateType, useMount, decodeLogs, ERC20_ABI, downScale, formatMoney, POOL_NAME, POOL_TYPE, usePoolInfo, useAccountStats, useAuthErrorHandling, EARejectionError, EARejectMessage, EARejectReason, EAService, useCLFeeManager, useCLPoolAllowance, upScale, usePoolContract, timeUtil, getNotifiDappId, getBlockchainConfigFromChain, doesChainSupportNotifi, CreditState, toBigNumber, TRANSFER_ABI, useFeeManager, combineStyles, isEmpty, useInvoiceNFTContract, useRFPoolAllowance, useParamsSearch, IdentityService, CHAINS, configUtil, usePoolAllowance, useLenderApproved, useLenderPosition, useWithdrawlLockoutInSeconds, usePoolUnderlyingTokenBalance, useLastDepositTime, CreditEventText, useERC2612Permit, ERC2612_ABI, SuperfluidPoolProcessor_ABI, useMultiSendContract, usePoolUnderlyingToken, hasRFActiveLoan, timestampToLL, getWalletAddressAbbr, useFactoring, PoolMap, PoolSubgraphMap, CreditEvent,
|
|
1
|
+
import { txAtom, useMQ, supportedChainId, sendTxAtom, isTxFailed, getExplorerUrl, openInNewTab, usePoolUnderlyingTokenContract, TxStateType, useMount, decodeLogs, ERC20_ABI, downScale, formatMoney, POOL_NAME, POOL_TYPE, usePoolInfo, useAccountStats, useAuthErrorHandling, EARejectionError, EARejectMessage, EARejectReason, EAService, useCLFeeManager, useCLPoolAllowance, upScale, usePoolContract, timeUtil, getNotifiDappId, getBlockchainConfigFromChain, doesChainSupportNotifi, CreditState, toBigNumber, TRANSFER_ABI, useFeeManager, combineStyles, isEmpty, useInvoiceNFTContract, useRFPoolAllowance, useParamsSearch, IdentityService, CHAINS, configUtil, usePoolAllowance, useLenderApproved, useLenderPosition, useWithdrawlLockoutInSeconds, usePoolUnderlyingTokenBalance, useLastDepositTime, CreditEventText, useERC2612Permit, ERC2612_ABI, SuperfluidPoolProcessor_ABI, useMultiSendContract, usePoolUnderlyingToken, hasRFActiveLoan, timestampToLL, getWalletAddressAbbr, useFactoring, PoolMap, PoolSubgraphMap, CreditEvent, Provider as Provider$1 } from '@huma-finance/shared';
|
|
2
2
|
import { useTheme, css, Box, Typography, Tooltip, Button, Dialog, Slider, Input, Divider, InputAdornment, Snackbar, Alert, Skeleton, TablePagination, LinearProgress, createTheme, ThemeProvider } from '@mui/material';
|
|
3
3
|
import { useAtom, Provider as Provider$2 } from 'jotai';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import React__default, { useCallback, useState, useEffect, useMemo } from 'react';
|
|
6
4
|
import { useSelector, useDispatch, Provider } from 'react-redux';
|
|
7
5
|
import { useWeb3React } from '@web3-react/core';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import React__default, { useCallback, useState, useEffect, useMemo } from 'react';
|
|
8
8
|
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
|
|
9
9
|
import { useResetAtom } from 'jotai/utils';
|
|
10
10
|
import { createSlice, configureStore } from '@reduxjs/toolkit';
|
|
@@ -568,11 +568,29 @@ function HumaModalHeader(_ref) {
|
|
|
568
568
|
});
|
|
569
569
|
}
|
|
570
570
|
|
|
571
|
-
function
|
|
572
|
-
var
|
|
573
|
-
|
|
571
|
+
function ChainSupportProvider(_ref) {
|
|
572
|
+
var children = _ref.children;
|
|
573
|
+
var _useWeb3React = useWeb3React(),
|
|
574
|
+
chainId = _useWeb3React.chainId;
|
|
575
|
+
var chainSupported = !!supportedChainId(chainId);
|
|
576
|
+
var _useState = useState(false),
|
|
577
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
578
|
+
chainNotSupportedOpen = _useState2[0],
|
|
579
|
+
setChainNotSupportedOpen = _useState2[1];
|
|
580
|
+
useEffect(function () {
|
|
581
|
+
setChainNotSupportedOpen(!chainSupported);
|
|
582
|
+
}, [chainSupported]);
|
|
583
|
+
var handleClose = function handleClose() {
|
|
584
|
+
setChainNotSupportedOpen(false);
|
|
585
|
+
};
|
|
586
|
+
if (!chainId) {
|
|
587
|
+
return null;
|
|
588
|
+
}
|
|
589
|
+
if (chainSupported) {
|
|
590
|
+
return children;
|
|
591
|
+
}
|
|
574
592
|
return jsxs(HumaModal, {
|
|
575
|
-
isOpen:
|
|
593
|
+
isOpen: chainNotSupportedOpen,
|
|
576
594
|
overflowY: "auto",
|
|
577
595
|
onClose: handleClose,
|
|
578
596
|
width: "480px",
|
|
@@ -6327,42 +6345,15 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6327
6345
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6328
6346
|
function Widget(props) {
|
|
6329
6347
|
var children = props.children;
|
|
6330
|
-
var _useWeb3React = useWeb3React(),
|
|
6331
|
-
chainId = _useWeb3React.chainId;
|
|
6332
|
-
var chainSupported = !!supportedChainId(chainId);
|
|
6333
|
-
var _useState = useState(false),
|
|
6334
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
6335
|
-
chainNotSupportedOpen = _useState2[0],
|
|
6336
|
-
setChainNotSupportedOpen = _useState2[1];
|
|
6337
|
-
useEffect(function () {
|
|
6338
|
-
if (chainSupported) {
|
|
6339
|
-
setChainNotSupportedOpen(false);
|
|
6340
|
-
} else {
|
|
6341
|
-
setChainNotSupportedOpen(true);
|
|
6342
|
-
}
|
|
6343
|
-
}, [chainSupported]);
|
|
6344
|
-
var handleCloseCallback = useCallback(function () {
|
|
6345
|
-
setChainNotSupportedOpen(false);
|
|
6346
|
-
}, []);
|
|
6347
|
-
if (!chainSupported) {
|
|
6348
|
-
return jsx(ThemeProvider, {
|
|
6349
|
-
theme: themeHuma,
|
|
6350
|
-
children: jsx(Provider, {
|
|
6351
|
-
store: store,
|
|
6352
|
-
children: jsx(ChainNotSupportedModal, {
|
|
6353
|
-
isOpen: chainNotSupportedOpen,
|
|
6354
|
-
handleClose: handleCloseCallback
|
|
6355
|
-
})
|
|
6356
|
-
})
|
|
6357
|
-
});
|
|
6358
|
-
}
|
|
6359
6348
|
return jsx(ThemeProvider, {
|
|
6360
6349
|
theme: themeHuma,
|
|
6361
6350
|
children: jsx(Provider, {
|
|
6362
6351
|
store: store,
|
|
6363
6352
|
children: jsx(Provider$1, _objectSpread(_objectSpread({}, props), {}, {
|
|
6364
6353
|
children: jsx(Provider$2, {
|
|
6365
|
-
children:
|
|
6354
|
+
children: jsx(ChainSupportProvider, {
|
|
6355
|
+
children: children
|
|
6356
|
+
})
|
|
6366
6357
|
})
|
|
6367
6358
|
}))
|
|
6368
6359
|
})
|