@aurora-is-near/intents-swap-widget 3.17.1 → 3.17.3
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/dist/{config-CQ4V08as.js → config-VpsP2eLV.js} +959 -880
- package/dist/config-VpsP2eLV.js.map +1 -0
- package/dist/config.js +2 -2
- package/dist/errors.js +1 -1
- package/dist/ext/alchemy/index.js +1 -1
- package/dist/ext/index.js +1 -1
- package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
- package/dist/features/BalanceRpcLoader/index.js +1 -1
- package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
- package/dist/features/ChainsDropdown/index.js +1 -1
- package/dist/features/DepositMethodSwitcher.js +1 -1
- package/dist/features/ErrorBoundary.js +1 -1
- package/dist/features/ExternalDeposit.js +2 -2
- package/dist/features/SendAddress/index.js +1 -1
- package/dist/features/SendAddress/useNotification.js +1 -1
- package/dist/features/SubmitButton/index.js +1 -1
- package/dist/features/SuccessScreen/index.js +1 -1
- package/dist/features/SwapDirectionSwitcher.js +1 -1
- package/dist/features/SwapQuote/SwapQuote.js +1 -1
- package/dist/features/SwapQuote/index.js +1 -1
- package/dist/features/TokenInput/TokenInput.js +1 -1
- package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
- package/dist/features/TokenInput/TokenInputSource.js +1 -1
- package/dist/features/TokenInput/TokenInputTarget.js +1 -1
- package/dist/features/TokenInput/WalletBalance.js +1 -1
- package/dist/features/TokenInput/hooks/index.js +1 -1
- package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
- package/dist/features/TokenInput/index.js +1 -1
- package/dist/features/TokensList/TokenItem.d.ts +2 -2
- package/dist/features/TokensList/TokenItem.js +1 -2
- package/dist/features/TokensList/TokensList.js +10 -2
- package/dist/features/TokensList/TokensList.js.map +1 -1
- package/dist/features/TokensList/constants.d.ts +4 -0
- package/dist/features/TokensList/constants.js +8 -0
- package/dist/features/TokensList/constants.js.map +1 -0
- package/dist/features/TokensList/hooks/index.d.ts +1 -0
- package/dist/features/TokensList/hooks/index.js +5 -0
- package/dist/features/TokensList/hooks/index.js.map +1 -0
- package/dist/features/TokensList/hooks/useFocusOnList.d.ts +9 -0
- package/dist/features/TokensList/hooks/useFocusOnList.js +33 -0
- package/dist/features/TokensList/hooks/useFocusOnList.js.map +1 -0
- package/dist/features/TokensList/index.d.ts +2 -1
- package/dist/features/TokensList/index.js +1 -1
- package/dist/features/TokensList/types.d.ts +14 -0
- package/dist/features/TokensList/types.js +2 -0
- package/dist/features/TokensList/types.js.map +1 -0
- package/dist/features/TokensList/utils/getFirstGroupItemTotalIndex.d.ts +9 -0
- package/dist/features/TokensList/utils/getFirstGroupItemTotalIndex.js +8 -0
- package/dist/features/TokensList/utils/getFirstGroupItemTotalIndex.js.map +1 -0
- package/dist/features/TokensList/utils/getGroupHeadersTotalIndexes.d.ts +8 -0
- package/dist/features/TokensList/utils/getGroupHeadersTotalIndexes.js +5 -0
- package/dist/features/TokensList/utils/getGroupHeadersTotalIndexes.js.map +1 -0
- package/dist/features/TokensList/utils/getListItemsTotalCount.d.ts +8 -0
- package/dist/features/TokensList/utils/getListItemsTotalCount.js +8 -0
- package/dist/features/TokensList/utils/getListItemsTotalCount.js.map +1 -0
- package/dist/features/TokensList/utils/getListState.d.ts +9 -0
- package/dist/features/TokensList/utils/getListState.js +5 -0
- package/dist/features/TokensList/utils/getListState.js.map +1 -0
- package/dist/features/TokensList/utils/getListTotalHeight.d.ts +8 -0
- package/dist/features/TokensList/utils/getListTotalHeight.js +12 -0
- package/dist/features/TokensList/utils/getListTotalHeight.js.map +1 -0
- package/dist/features/TokensList/utils/getTokenByTotalIndex.d.ts +9 -0
- package/dist/features/TokensList/utils/getTokenByTotalIndex.js +7 -0
- package/dist/features/TokensList/utils/getTokenByTotalIndex.js.map +1 -0
- package/dist/features/TokensList/utils/index.d.ts +6 -0
- package/dist/features/TokensList/utils/index.js +15 -0
- package/dist/features/TokensList/utils/index.js.map +1 -0
- package/dist/features/TokensModal.js +2 -2
- package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +2 -2
- package/dist/features/WalletCompatibilityCheck/index.js +1 -1
- package/dist/features/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useAllTokens.js +1 -1
- package/dist/hooks/useChains.js +1 -1
- package/dist/hooks/useCompatibilityCheck.js +1 -1
- package/dist/hooks/useDefaultToken.js +1 -1
- package/dist/hooks/useExternalDepositStatus/index.js +1 -1
- package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
- package/dist/hooks/useIntentsBalance.js +1 -1
- package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
- package/dist/hooks/useMakeDepositAddress.js +1 -1
- package/dist/hooks/useMakeIntentsTransfer.js +4 -3
- package/dist/hooks/useMakeIntentsTransfer.js.map +1 -1
- package/dist/hooks/useMakeNEARFtTransferCall.js +4 -2
- package/dist/hooks/useMakeNEARFtTransferCall.js.map +1 -1
- package/dist/hooks/useMakeQuote.js +1 -1
- package/dist/hooks/useMakeQuoteTransfer.js +3 -2
- package/dist/hooks/useMakeQuoteTransfer.js.map +1 -1
- package/dist/hooks/useMakeSolanaTransfer.js +1 -1
- package/dist/hooks/useMakeTransfer.js +1 -1
- package/dist/hooks/useMergedBalance.js +1 -1
- package/dist/hooks/useSwitchChain.js +1 -1
- package/dist/hooks/useTheme.js +1 -1
- package/dist/hooks/useTokenInputPair.js +1 -1
- package/dist/hooks/useTokens.js +1 -1
- package/dist/hooks/useTokensFiltered.js +1 -1
- package/dist/hooks/useTokensIntentsUnique.js +1 -1
- package/dist/{index-Ce9bzNHX.js → index-JGjxyZXI.js} +70 -70
- package/dist/index-JGjxyZXI.js.map +1 -0
- package/dist/index.browser.esm-COWShN0a.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/machine/effects/index.js +1 -1
- package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
- package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
- package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
- package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
- package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
- package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
- package/dist/machine/effects/useWalletConnEffect.js +1 -1
- package/dist/machine/events/index.js +1 -1
- package/dist/machine/events/tokenSelect.js +1 -1
- package/dist/machine/events/validateInputAndMoveTo.js +1 -1
- package/dist/machine/events/validateInputs.js +1 -1
- package/dist/machine/index.js +1 -1
- package/dist/machine/snap.js +1 -1
- package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
- package/dist/machine/subscriptions/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme/ThemeProvider.js +1 -1
- package/dist/utils/checkers/isUserDeniedSigning.d.ts +2 -1
- package/dist/utils/checkers/isUserDeniedSigning.js +6 -4
- package/dist/utils/checkers/isUserDeniedSigning.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +26 -24
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/intents/signers/near.d.ts +1 -1
- package/dist/utils/intents/signers/near.js +2 -2
- package/dist/utils/intents/signers/privy.d.ts +1 -1
- package/dist/utils/intents/signers/privy.js +1 -1
- package/dist/utils/intents/signers/solana.d.ts +1 -1
- package/dist/utils/intents/signers/solana.js.map +1 -1
- package/dist/utils/isErrorLikeObject.d.ts +4 -0
- package/dist/utils/isErrorLikeObject.js +5 -0
- package/dist/utils/isErrorLikeObject.js.map +1 -0
- package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +2 -2
- package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js +2 -2
- package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +2 -2
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
- package/package.json +2 -2
- package/src/features/TokensList/TokenItem.tsx +7 -3
- package/src/features/TokensList/TokensList.tsx +151 -57
- package/src/features/TokensList/constants.ts +4 -0
- package/src/features/TokensList/hooks/index.ts +1 -0
- package/src/features/TokensList/hooks/useFocusOnList.ts +56 -0
- package/src/features/TokensList/types.ts +28 -0
- package/src/features/TokensList/utils/getFirstGroupItemTotalIndex.ts +28 -0
- package/src/features/TokensList/utils/getGroupHeadersTotalIndexes.ts +21 -0
- package/src/features/TokensList/utils/getListItemsTotalCount.ts +14 -0
- package/src/features/TokensList/utils/getListState.ts +16 -0
- package/src/features/TokensList/utils/getListTotalHeight.ts +25 -0
- package/src/features/TokensList/utils/getTokenByTotalIndex.ts +19 -0
- package/src/features/TokensList/utils/index.ts +6 -0
- package/src/hooks/useMakeIntentsTransfer.ts +40 -29
- package/src/hooks/useMakeNEARFtTransferCall.ts +10 -0
- package/src/hooks/useMakeQuoteTransfer.ts +2 -1
- package/src/utils/checkers/isUserDeniedSigning.ts +11 -3
- package/src/utils/index.ts +1 -0
- package/src/utils/intents/signers/near.ts +1 -1
- package/src/utils/intents/signers/privy.ts +1 -1
- package/src/utils/intents/signers/solana.ts +1 -1
- package/src/utils/isErrorLikeObject.ts +11 -0
- package/dist/config-CQ4V08as.js.map +0 -1
- package/dist/index-Ce9bzNHX.js.map +0 -1
|
@@ -5,6 +5,8 @@ import { getNearNep141StorageBalance } from '../utils/near/getNearNep141StorageB
|
|
|
5
5
|
import { getNearNep141MinStorageBalance } from '../utils/near/getNearNep141MinStorageBalance';
|
|
6
6
|
import { logger } from '@/logger';
|
|
7
7
|
import { TransferError } from '@/errors';
|
|
8
|
+
import { isErrorLikeObject } from '@/utils/isErrorLikeObject';
|
|
9
|
+
import { isUserDeniedSigning } from '@/utils/checkers/isUserDeniedSigning';
|
|
8
10
|
import { useComputedSnapshot, useUnsafeSnapshot } from '@/machine/snap';
|
|
9
11
|
import { NATIVE_NEAR_DUMB_ASSET_ID, WNEAR_ASSET_ID } from '@/constants/tokens';
|
|
10
12
|
import type { TransferResult } from '@/types/transfer';
|
|
@@ -139,6 +141,10 @@ export function useMakeNEARFtTransferCall(
|
|
|
139
141
|
code: 'NO_DEPOSIT_RESULT',
|
|
140
142
|
});
|
|
141
143
|
} catch (err: unknown) {
|
|
144
|
+
if (isErrorLikeObject(err) && isUserDeniedSigning(err)) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
142
148
|
logger.error('[TRANSFER ERROR]', err);
|
|
143
149
|
throw new TransferError({
|
|
144
150
|
code: 'DIRECT_TRANSFER_ERROR',
|
|
@@ -214,6 +220,10 @@ export function useMakeNEARFtTransferCall(
|
|
|
214
220
|
code: 'NO_DEPOSIT_RESULT',
|
|
215
221
|
});
|
|
216
222
|
} catch (err: unknown) {
|
|
223
|
+
if (isErrorLikeObject(err) && isUserDeniedSigning(err)) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
|
|
217
227
|
logger.error('[TRANSFER ERROR]', err);
|
|
218
228
|
throw new TransferError({
|
|
219
229
|
code: 'DIRECT_TRANSFER_ERROR',
|
|
@@ -12,6 +12,7 @@ import { logger } from '@/logger';
|
|
|
12
12
|
import { TransferError } from '@/errors';
|
|
13
13
|
import { useUnsafeSnapshot } from '@/machine/snap';
|
|
14
14
|
import { NATIVE_NEAR_DUMB_ASSET_ID } from '@/constants/tokens';
|
|
15
|
+
import { isErrorLikeObject } from '@/utils/isErrorLikeObject';
|
|
15
16
|
import { isUserDeniedSigning } from '@/utils/checkers/isUserDeniedSigning';
|
|
16
17
|
import type { MakeTransferArgs, TransferResult } from '@/types/transfer';
|
|
17
18
|
|
|
@@ -139,7 +140,7 @@ export const useMakeQuoteTransfer = ({
|
|
|
139
140
|
let errorMessage = 'Failed to make a transfer. Please try again.';
|
|
140
141
|
|
|
141
142
|
const userCancelledTx =
|
|
142
|
-
error
|
|
143
|
+
isErrorLikeObject(error) && isUserDeniedSigning(error);
|
|
143
144
|
|
|
144
145
|
if (userCancelledTx) {
|
|
145
146
|
return;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ErrorLikeObject } from '../isErrorLikeObject';
|
|
2
|
+
|
|
1
3
|
const errorVariations = [
|
|
2
4
|
'user denied',
|
|
3
5
|
'user closed',
|
|
@@ -6,8 +8,14 @@ const errorVariations = [
|
|
|
6
8
|
'user declined',
|
|
7
9
|
];
|
|
8
10
|
|
|
9
|
-
export const isUserDeniedSigning = (
|
|
10
|
-
return
|
|
11
|
-
|
|
11
|
+
export const isUserDeniedSigning = (error: ErrorLikeObject) => {
|
|
12
|
+
return (
|
|
13
|
+
errorVariations.some((variation) =>
|
|
14
|
+
error.message.toLowerCase().includes(variation),
|
|
15
|
+
) ||
|
|
16
|
+
('cause' in error &&
|
|
17
|
+
errorVariations.some((variation) =>
|
|
18
|
+
`${error.cause}`.toLowerCase().includes(variation),
|
|
19
|
+
))
|
|
12
20
|
);
|
|
13
21
|
};
|
package/src/utils/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { utils } from '@defuse-protocol/internal-utils';
|
|
2
|
-
import { createIntentSignerViem } from '@defuse-protocol/
|
|
2
|
+
import { createIntentSignerViem } from '@defuse-protocol/intents-sdk';
|
|
3
3
|
|
|
4
4
|
import { EvmProvider } from '@/types';
|
|
5
5
|
import { WidgetError } from '@/errors';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { utils } from '@defuse-protocol/internal-utils';
|
|
2
|
-
import { createIntentSignerViem } from '@defuse-protocol/
|
|
2
|
+
import { createIntentSignerViem } from '@defuse-protocol/intents-sdk';
|
|
3
3
|
import bs58 from 'bs58';
|
|
4
4
|
import { SolanaProvider } from '../../../types/providers';
|
|
5
5
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ErrorLikeObject = Error | { message: string };
|
|
2
|
+
|
|
3
|
+
export const isErrorLikeObject = (error: unknown): error is ErrorLikeObject => {
|
|
4
|
+
return (
|
|
5
|
+
error instanceof Error ||
|
|
6
|
+
(typeof error === 'object' &&
|
|
7
|
+
error !== null &&
|
|
8
|
+
'message' in error &&
|
|
9
|
+
typeof error.message === 'string')
|
|
10
|
+
);
|
|
11
|
+
};
|