@aurora-is-near/intents-swap-widget 3.17.1 → 3.17.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/dist/{config-CQ4V08as.js → config-BVaLnxO9.js} +803 -788
- package/dist/config-BVaLnxO9.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.js +1 -1
- package/dist/features/TokensList/TokensList.js +1 -1
- package/dist/features/TokensList/index.js +1 -1
- 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/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/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
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as o, M as t, Q as s, S as a, o as n, p, T as f, q as m, w as i, W as u, v as x, x as d, r as c, t as l, e as S, d as k, u as T, f as g, g as h, h as B, j as C, i as E, k as M, a as I, c as W, l as w, n as D, m as A, b as v } from "./config-
|
|
1
|
+
import { B as o, M as t, Q as s, S as a, o as n, p, T as f, q as m, w as i, W as u, v as x, x as d, r as c, t as l, e as S, d as k, u as T, f as g, g as h, h as B, j as C, i as E, k as M, a as I, c as W, l as w, n as D, m as A, b as v } from "./config-BVaLnxO9.js";
|
|
2
2
|
import { DEFAULT_RPCS as b } from "./rpcs.js";
|
|
3
3
|
import { Accordion as L } from "./components/Accordion.js";
|
|
4
4
|
import { Badge as R } from "./components/Badge.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import "../../logger.js";
|
|
3
3
|
import "../guards/checks/isDryQuote.js";
|
|
4
|
-
import { P as a } from "../../config-
|
|
4
|
+
import { P as a } from "../../config-BVaLnxO9.js";
|
|
5
5
|
import "../guards/index.js";
|
|
6
6
|
import "../machine.js";
|
|
7
7
|
import "../events/utils/fireEvent.js";
|
|
@@ -2,7 +2,7 @@ import "react";
|
|
|
2
2
|
import "../../utils/solana/isSolanaAddress.js";
|
|
3
3
|
import "../../utils/evm/isEvmAddress.js";
|
|
4
4
|
import "../../utils/near/isNearAddress.js";
|
|
5
|
-
import { R as l } from "../../config-
|
|
5
|
+
import { R as l } from "../../config-BVaLnxO9.js";
|
|
6
6
|
import "../../utils/tokens/getMainTokenByChain.js";
|
|
7
7
|
import "../../utils/tokens/getDefaultIntentsToken.js";
|
|
8
8
|
import "../../utils/tokens/getTokenWithHighBalance.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import "../../hooks/useWalletAddressForToken.js";
|
|
3
|
-
import { I as f } from "../../config-
|
|
3
|
+
import { I as f } from "../../config-BVaLnxO9.js";
|
|
4
4
|
import "../guards/index.js";
|
|
5
5
|
import "../machine.js";
|
|
6
6
|
import "../events/utils/fireEvent.js";
|
|
@@ -3,7 +3,7 @@ import "./tokenSelectRotate.js";
|
|
|
3
3
|
import "./errorSet.js";
|
|
4
4
|
import "./quoteSet.js";
|
|
5
5
|
import "./addressSet.js";
|
|
6
|
-
import { _ as b } from "../../config-
|
|
6
|
+
import { _ as b } from "../../config-BVaLnxO9.js";
|
|
7
7
|
import "./tokenSetAmount.js";
|
|
8
8
|
import "./quoteSetStatus.js";
|
|
9
9
|
import "./depositTypeSet.js";
|
|
@@ -3,7 +3,7 @@ import "../../utils/near/checkNearAccountExists.js";
|
|
|
3
3
|
import "../../utils/checkers/isNotEmptyAmount.js";
|
|
4
4
|
import "../../utils/checkers/isValidBigint.js";
|
|
5
5
|
import "../../utils/near/isNearAddress.js";
|
|
6
|
-
import { K as I, L as d, N as u } from "../../config-
|
|
6
|
+
import { K as I, L as d, N as u } from "../../config-BVaLnxO9.js";
|
|
7
7
|
import "../guards/index.js";
|
|
8
8
|
import "../machine.js";
|
|
9
9
|
import "../guards/checks/isBalanceSufficient.js";
|
package/dist/machine/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as o, u as t, a as r, c as a, b as f } from "../config-
|
|
1
|
+
import { r as o, u as t, a as r, c as a, b as f } from "../config-BVaLnxO9.js";
|
|
2
2
|
import { guardStates as S } from "./guards/index.js";
|
|
3
3
|
import { machine as n, moveTo as u } from "./machine.js";
|
|
4
4
|
import { fireEvent as i } from "./events/utils/fireEvent.js";
|
package/dist/machine/snap.js
CHANGED
|
@@ -2,7 +2,7 @@ import "valtio";
|
|
|
2
2
|
import "derive-valtio";
|
|
3
3
|
import "./computed/getIsNativeNearDeposit.js";
|
|
4
4
|
import "./computed/getIsDirectTokenOnNearDeposit.js";
|
|
5
|
-
import { u as h, a as b, b as d } from "../config-
|
|
5
|
+
import { u as h, a as b, b as d } from "../config-BVaLnxO9.js";
|
|
6
6
|
import "./machine.js";
|
|
7
7
|
import "./guards/index.js";
|
|
8
8
|
import "./computed/getUsdTradeDelta.js";
|
|
@@ -5,7 +5,7 @@ import "./checkers/isOnlyErrorChanged.js";
|
|
|
5
5
|
import "./checkers/isValidInitialState.js";
|
|
6
6
|
import "./checkers/isWalletDisconnected.js";
|
|
7
7
|
import "./checkers/isSendAddressForbidden.js";
|
|
8
|
-
import { X as g, Y as u } from "../../config-
|
|
8
|
+
import { X as g, Y as u } from "../../config-BVaLnxO9.js";
|
|
9
9
|
import "./checkers/isAmountChangedFromQuote.js";
|
|
10
10
|
import "ethers";
|
|
11
11
|
import "../machine.js";
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { ErrorLikeObject } from '../isErrorLikeObject';
|
|
2
|
+
export declare const isUserDeniedSigning: (error: ErrorLikeObject) => boolean;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
const
|
|
1
|
+
const n = [
|
|
2
2
|
"user denied",
|
|
3
3
|
"user closed",
|
|
4
4
|
"user rejected",
|
|
5
5
|
"user cancelled",
|
|
6
6
|
"user declined"
|
|
7
|
-
],
|
|
8
|
-
(
|
|
7
|
+
], c = (e) => n.some(
|
|
8
|
+
(s) => e.message.toLowerCase().includes(s)
|
|
9
|
+
) || "cause" in e && n.some(
|
|
10
|
+
(s) => `${e.cause}`.toLowerCase().includes(s)
|
|
9
11
|
);
|
|
10
12
|
export {
|
|
11
|
-
|
|
13
|
+
c as isUserDeniedSigning
|
|
12
14
|
};
|
|
13
15
|
//# sourceMappingURL=isUserDeniedSigning.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUserDeniedSigning.js","sources":["../../../src/utils/checkers/isUserDeniedSigning.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"isUserDeniedSigning.js","sources":["../../../src/utils/checkers/isUserDeniedSigning.ts"],"sourcesContent":["import type { ErrorLikeObject } from '../isErrorLikeObject';\n\nconst errorVariations = [\n 'user denied',\n 'user closed',\n 'user rejected',\n 'user cancelled',\n 'user declined',\n];\n\nexport const isUserDeniedSigning = (error: ErrorLikeObject) => {\n return (\n errorVariations.some((variation) =>\n error.message.toLowerCase().includes(variation),\n ) ||\n ('cause' in error &&\n errorVariations.some((variation) =>\n `${error.cause}`.toLowerCase().includes(variation),\n ))\n );\n};\n"],"names":["errorVariations","isUserDeniedSigning","error","variation"],"mappings":"AAEA,MAAMA,IAAkB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEaC,IAAsB,CAACC,MAEhCF,EAAgB;AAAA,EAAK,CAACG,MACpBD,EAAM,QAAQ,YAAA,EAAc,SAASC,CAAS;AAAA,KAE/C,WAAWD,KACVF,EAAgB;AAAA,EAAK,CAACG,MACpB,GAAGD,EAAM,KAAK,GAAG,YAAA,EAAc,SAASC,CAAS;AAAA;"}
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,43 +1,45 @@
|
|
|
1
1
|
import { isDebug as e } from "./checkers/isDebug.js";
|
|
2
2
|
import { isNotEmptyAmount as m } from "./checkers/isNotEmptyAmount.js";
|
|
3
|
-
import { isValidChain as
|
|
3
|
+
import { isValidChain as p } from "./checkers/isValidChain.js";
|
|
4
4
|
import { isEth as x } from "./evm/isEth.js";
|
|
5
5
|
import { isEvmChain as i } from "./evm/isEvmChain.js";
|
|
6
6
|
import { isEvmToken as T } from "./evm/isEvmToken.js";
|
|
7
|
-
import { isEvmBaseToken as
|
|
8
|
-
import { getEvmTokenBalance as
|
|
9
|
-
import { getEvmMainTokenBalance as
|
|
7
|
+
import { isEvmBaseToken as c } from "./evm/isEvmBaseToken.js";
|
|
8
|
+
import { getEvmTokenBalance as u } from "./evm/getEvmTokenBalance.js";
|
|
9
|
+
import { getEvmMainTokenBalance as l } from "./evm/getEvmMainTokenBalance.js";
|
|
10
10
|
import { formatBigToHuman as v } from "./formatters/formatBigToHuman.js";
|
|
11
|
-
import { formatHumanToBig as
|
|
11
|
+
import { formatHumanToBig as b } from "./formatters/formatHumanToBig.js";
|
|
12
12
|
import { formatTinyNumber as A } from "./formatters/formatTinyNumber.js";
|
|
13
13
|
import { formatTxHash as y } from "./formatters/formatTxHash.js";
|
|
14
|
-
import { formatUsdAmount as
|
|
15
|
-
import { getExplorerUrl as
|
|
16
|
-
import { getTransactionLink as
|
|
17
|
-
import { formatAddressTruncate as
|
|
18
|
-
import { cn as
|
|
19
|
-
import { noop as
|
|
20
|
-
import { notReachable as
|
|
14
|
+
import { formatUsdAmount as L } from "./formatters/formatUsdAmount.js";
|
|
15
|
+
import { getExplorerUrl as U } from "./formatters/getExplorerUrl.js";
|
|
16
|
+
import { getTransactionLink as D } from "./formatters/getTransactionLink.js";
|
|
17
|
+
import { formatAddressTruncate as O } from "./formatters/formatAddressTruncate.js";
|
|
18
|
+
import { cn as V } from "./cn.js";
|
|
19
|
+
import { noop as w } from "./noop.js";
|
|
20
|
+
import { notReachable as F } from "./notReachable.js";
|
|
21
|
+
import { isErrorLikeObject as I } from "./isErrorLikeObject.js";
|
|
21
22
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
V as cn,
|
|
24
|
+
O as formatAddressTruncate,
|
|
24
25
|
v as formatBigToHuman,
|
|
25
|
-
|
|
26
|
+
b as formatHumanToBig,
|
|
26
27
|
A as formatTinyNumber,
|
|
27
28
|
y as formatTxHash,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
L as formatUsdAmount,
|
|
30
|
+
l as getEvmMainTokenBalance,
|
|
31
|
+
u as getEvmTokenBalance,
|
|
32
|
+
U as getExplorerUrl,
|
|
33
|
+
D as getTransactionLink,
|
|
33
34
|
e as isDebug,
|
|
35
|
+
I as isErrorLikeObject,
|
|
34
36
|
x as isEth,
|
|
35
|
-
|
|
37
|
+
c as isEvmBaseToken,
|
|
36
38
|
i as isEvmChain,
|
|
37
39
|
T as isEvmToken,
|
|
38
40
|
m as isNotEmptyAmount,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
p as isValidChain,
|
|
42
|
+
w as noop,
|
|
43
|
+
F as notReachable
|
|
42
44
|
};
|
|
43
45
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createIntentSignerNEP413 } from '@defuse-protocol/
|
|
1
|
+
import { createIntentSignerNEP413 } from '@defuse-protocol/intents-sdk';
|
|
2
2
|
import { NearWalletBase as NearWallet } from '@hot-labs/near-connect/build/types/wallet';
|
|
3
3
|
type Args = {
|
|
4
4
|
getProvider: () => NearWallet;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../../index-DEq3oXQF.js";
|
|
2
|
-
import "@defuse-protocol/
|
|
3
|
-
import { a2 as o } from "../../../config-
|
|
2
|
+
import "@defuse-protocol/intents-sdk";
|
|
3
|
+
import { a2 as o } from "../../../config-BVaLnxO9.js";
|
|
4
4
|
export {
|
|
5
5
|
o as createNearWalletSigner
|
|
6
6
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createIntentSignerViem } from '@defuse-protocol/
|
|
1
|
+
import { createIntentSignerViem } from '@defuse-protocol/intents-sdk';
|
|
2
2
|
import { EvmProvider } from '../../../types';
|
|
3
3
|
type SignIntentResult = ReturnType<ReturnType<typeof createIntentSignerViem>['signIntent']>;
|
|
4
4
|
type SignIntentPayload = Parameters<ReturnType<typeof createIntentSignerViem>['signIntent']>[0];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createIntentSignerViem } from '@defuse-protocol/
|
|
1
|
+
import { createIntentSignerViem } from '@defuse-protocol/intents-sdk';
|
|
2
2
|
import { SolanaProvider } from '../../../types/providers';
|
|
3
3
|
type SignIntentResult = ReturnType<ReturnType<typeof createIntentSignerViem>['signIntent']>;
|
|
4
4
|
type SignIntentPayload = Parameters<ReturnType<typeof createIntentSignerViem>['signIntent']>[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solana.js","sources":["../../../../src/utils/intents/signers/solana.ts"],"sourcesContent":["import { utils } from '@defuse-protocol/internal-utils';\nimport { createIntentSignerViem } from '@defuse-protocol/
|
|
1
|
+
{"version":3,"file":"solana.js","sources":["../../../../src/utils/intents/signers/solana.ts"],"sourcesContent":["import { utils } from '@defuse-protocol/internal-utils';\nimport { createIntentSignerViem } from '@defuse-protocol/intents-sdk';\nimport bs58 from 'bs58';\nimport { SolanaProvider } from '../../../types/providers';\n\ntype SignIntentResult = ReturnType<\n ReturnType<typeof createIntentSignerViem>['signIntent']\n>;\ntype SignIntentPayload = Parameters<\n ReturnType<typeof createIntentSignerViem>['signIntent']\n>[0];\n\nexport class IntentSignerSolana\n implements ReturnType<typeof createIntentSignerViem>\n{\n constructor(\n private account: { walletAddress: string },\n private solanaWallet: SolanaProvider,\n ) {}\n\n async signIntent(intent: SignIntentPayload): SignIntentResult {\n const message = JSON.stringify({\n verifying_contract: intent.verifying_contract,\n deadline: intent.deadline,\n nonce: intent.nonce,\n intents: intent.intents,\n signer_id:\n intent.signer_id ??\n utils.authHandleToIntentsUserId({\n identifier: this.account.walletAddress,\n method: 'solana',\n }),\n });\n\n const signature = await this.solanaWallet.signMessage({\n message: new TextEncoder().encode(message),\n });\n\n return {\n payload: message,\n public_key: this.account.walletAddress,\n standard: 'raw_ed25519',\n signature: bs58.encode(signature),\n };\n }\n}\n"],"names":["IntentSignerSolana","account","solanaWallet","intent","message","utils","signature","bs58"],"mappings":";;AAYO,MAAMA,EAEb;AAAA,EACE,YACUC,GACAC,GACR;AAFQ,SAAA,UAAAD,GACA,KAAA,eAAAC;AAAA,EACP;AAAA,EAEH,MAAM,WAAWC,GAA6C;AAC5D,UAAMC,IAAU,KAAK,UAAU;AAAA,MAC7B,oBAAoBD,EAAO;AAAA,MAC3B,UAAUA,EAAO;AAAA,MACjB,OAAOA,EAAO;AAAA,MACd,SAASA,EAAO;AAAA,MAChB,WACEA,EAAO,aACPE,EAAM,0BAA0B;AAAA,QAC9B,YAAY,KAAK,QAAQ;AAAA,QACzB,QAAQ;AAAA,MAAA,CACT;AAAA,IAAA,CACJ,GAEKC,IAAY,MAAM,KAAK,aAAa,YAAY;AAAA,MACpD,SAAS,IAAI,cAAc,OAAOF,CAAO;AAAA,IAAA,CAC1C;AAED,WAAO;AAAA,MACL,SAASA;AAAA,MACT,YAAY,KAAK,QAAQ;AAAA,MACzB,UAAU;AAAA,MACV,WAAWG,EAAK,OAAOD,CAAS;AAAA,IAAA;AAAA,EAEpC;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isErrorLikeObject.js","sources":["../../src/utils/isErrorLikeObject.ts"],"sourcesContent":["export type ErrorLikeObject = Error | { message: string };\n\nexport const isErrorLikeObject = (error: unknown): error is ErrorLikeObject => {\n return (\n error instanceof Error ||\n (typeof error === 'object' &&\n error !== null &&\n 'message' in error &&\n typeof error.message === 'string')\n );\n};\n"],"names":["isErrorLikeObject","error"],"mappings":"AAEO,MAAMA,IAAoB,CAACC,MAE9BA,aAAiB,SAChB,OAAOA,KAAU,YAChBA,MAAU,QACV,aAAaA,KACb,OAAOA,EAAM,WAAY;"}
|
|
@@ -3,7 +3,7 @@ import { useState as y, useEffect as l, useCallback as B } from "react";
|
|
|
3
3
|
import { useTokenModal as R } from "../../hooks/useTokenModal.js";
|
|
4
4
|
import { useTypedTranslation as A } from "../../localisation.js";
|
|
5
5
|
import { WidgetDepositSkeleton as b } from "./WidgetDepositSkeleton.js";
|
|
6
|
-
import { b as F, u as q, y as j, n as N, c as O, p as Q, o as U, S as K } from "../../config-
|
|
6
|
+
import { b as F, u as q, y as j, n as N, c as O, p as Q, o as U, S as K } from "../../config-BVaLnxO9.js";
|
|
7
7
|
import "@tanstack/react-query";
|
|
8
8
|
import "@headlessui/react";
|
|
9
9
|
import "framer-motion";
|
|
@@ -32,7 +32,7 @@ import "../../components/Notes.js";
|
|
|
32
32
|
import "zod";
|
|
33
33
|
import "../../utils/near/rpc.js";
|
|
34
34
|
import "../../index-DEq3oXQF.js";
|
|
35
|
-
import "@defuse-protocol/
|
|
35
|
+
import "@defuse-protocol/intents-sdk";
|
|
36
36
|
import "change-case";
|
|
37
37
|
import "@defuse-protocol/internal-utils";
|
|
38
38
|
import "bs58";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import a from "clsx";
|
|
3
3
|
import { SkeletonBox as s } from "../../components/SkeletonBox.js";
|
|
4
|
-
import { y as i } from "../../config-
|
|
4
|
+
import { y as i } from "../../config-BVaLnxO9.js";
|
|
5
5
|
const p = () => {
|
|
6
6
|
const { hideTokenInputHeadings: l } = i();
|
|
7
7
|
return /* @__PURE__ */ o("div", { className: "w-full gap-sw-xl relative flex flex-col", children: [
|
|
@@ -3,7 +3,7 @@ import { useState as b, useEffect as y } from "react";
|
|
|
3
3
|
import { useTokenModal as R } from "../../hooks/useTokenModal.js";
|
|
4
4
|
import { WidgetSwapSkeleton as S } from "./WidgetSwapSkeleton.js";
|
|
5
5
|
import { useTypedTranslation as D } from "../../localisation.js";
|
|
6
|
-
import { b as N, u as O, y as Q, n as j, c as q, p as w, o as F, S as U } from "../../config-
|
|
6
|
+
import { b as N, u as O, y as Q, n as j, c as q, p as w, o as F, S as U } from "../../config-BVaLnxO9.js";
|
|
7
7
|
import "@tanstack/react-query";
|
|
8
8
|
import "@headlessui/react";
|
|
9
9
|
import "framer-motion";
|
|
@@ -26,7 +26,7 @@ import { fireEvent as H } from "../../machine/events/utils/fireEvent.js";
|
|
|
26
26
|
import "zod";
|
|
27
27
|
import "../../utils/near/rpc.js";
|
|
28
28
|
import "../../index-DEq3oXQF.js";
|
|
29
|
-
import "@defuse-protocol/
|
|
29
|
+
import "@defuse-protocol/intents-sdk";
|
|
30
30
|
import "change-case";
|
|
31
31
|
import "@defuse-protocol/internal-utils";
|
|
32
32
|
import "bs58";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as a, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import o from "clsx";
|
|
3
3
|
import { SkeletonBox as s } from "../../components/SkeletonBox.js";
|
|
4
|
-
import { y as i } from "../../config-
|
|
4
|
+
import { y as i } from "../../config-BVaLnxO9.js";
|
|
5
5
|
const m = () => {
|
|
6
6
|
const { hideTokenInputHeadings: e } = i();
|
|
7
7
|
return /* @__PURE__ */ a("div", { className: "w-full gap-sw-lg relative flex flex-col", children: [
|
|
@@ -3,7 +3,7 @@ import { useState as w, useEffect as b } from "react";
|
|
|
3
3
|
import { useTokenModal as B } from "../../hooks/useTokenModal.js";
|
|
4
4
|
import { WidgetWithdrawSkeleton as y } from "./WidgetWithdrawSkeleton.js";
|
|
5
5
|
import { useTypedTranslation as D } from "../../localisation.js";
|
|
6
|
-
import { b as N, u as O, y as Q, n as j, c as q, p as S, o as F, S as U } from "../../config-
|
|
6
|
+
import { b as N, u as O, y as Q, n as j, c as q, p as S, o as F, S as U } from "../../config-BVaLnxO9.js";
|
|
7
7
|
import "@tanstack/react-query";
|
|
8
8
|
import "@headlessui/react";
|
|
9
9
|
import "framer-motion";
|
|
@@ -26,7 +26,7 @@ import "viem";
|
|
|
26
26
|
import "zod";
|
|
27
27
|
import "../../utils/near/rpc.js";
|
|
28
28
|
import "../../index-DEq3oXQF.js";
|
|
29
|
-
import "@defuse-protocol/
|
|
29
|
+
import "@defuse-protocol/intents-sdk";
|
|
30
30
|
import "change-case";
|
|
31
31
|
import "@defuse-protocol/internal-utils";
|
|
32
32
|
import "bs58";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import o from "clsx";
|
|
3
3
|
import { SkeletonBox as l } from "../../components/SkeletonBox.js";
|
|
4
|
-
import { y as x } from "../../config-
|
|
4
|
+
import { y as x } from "../../config-BVaLnxO9.js";
|
|
5
5
|
const p = () => {
|
|
6
6
|
const { hideTokenInputHeadings: s } = x();
|
|
7
7
|
return /* @__PURE__ */ a("div", { className: "w-full gap-sw-xl relative flex flex-col", children: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aurora-is-near/intents-swap-widget",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.2",
|
|
4
4
|
"description": "Provides components and hooks to build your own Intents swap widget",
|
|
5
5
|
"author": "Maksim Vashchuk",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@aurora-is-near/eslint-config": "^1.5.3",
|
|
58
|
-
"@defuse-protocol/
|
|
58
|
+
"@defuse-protocol/intents-sdk": "^0.43.3",
|
|
59
59
|
"@defuse-protocol/internal-utils": "^0.13.0",
|
|
60
60
|
"@defuse-protocol/one-click-sdk-typescript": "^0.1.5",
|
|
61
61
|
"@headlessui/react": "^2.2.4",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
BridgeSDK,
|
|
3
2
|
createIntentSignerNEP413,
|
|
4
3
|
createInternalTransferRoute,
|
|
5
4
|
createNearWithdrawalRoute,
|
|
6
5
|
FeeExceedsAmountError,
|
|
6
|
+
IntentsSDK,
|
|
7
7
|
MinWithdrawalAmountError,
|
|
8
8
|
type RouteConfig,
|
|
9
|
-
} from '@defuse-protocol/
|
|
9
|
+
} from '@defuse-protocol/intents-sdk';
|
|
10
10
|
import type { NearWalletBase as NearWallet } from '@hot-labs/near-connect/build/types/wallet';
|
|
11
11
|
import { snakeCase } from 'change-case';
|
|
12
12
|
import { generateRandomBytes } from '../utils/near/getRandomBytes';
|
|
@@ -18,6 +18,7 @@ import { TransferError } from '@/errors';
|
|
|
18
18
|
import { INTENTS_CONTRACT } from '@/constants';
|
|
19
19
|
import { CHAIN_IDS_MAP } from '@/constants/chains';
|
|
20
20
|
import { notReachable } from '@/utils/notReachable';
|
|
21
|
+
import { isErrorLikeObject } from '@/utils/isErrorLikeObject';
|
|
21
22
|
import { localStorageTyped } from '@/utils/localstorage';
|
|
22
23
|
import { queryContract } from '@/utils/near/queryContract';
|
|
23
24
|
import { IntentSignerPrivy } from '@/utils/intents/signers/privy';
|
|
@@ -245,7 +246,7 @@ export const useMakeIntentsTransfer = ({ providers }: IntentsTransferArgs) => {
|
|
|
245
246
|
notReachable(intentsAccountType);
|
|
246
247
|
}
|
|
247
248
|
|
|
248
|
-
const sdk = new
|
|
249
|
+
const sdk = new IntentsSDK({ referral: snakeCase(appName) });
|
|
249
250
|
|
|
250
251
|
sdk.setIntentSigner(signer);
|
|
251
252
|
|
|
@@ -261,35 +262,48 @@ export const useMakeIntentsTransfer = ({ providers }: IntentsTransferArgs) => {
|
|
|
261
262
|
routeConfig = createInternalTransferRoute();
|
|
262
263
|
}
|
|
263
264
|
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
265
|
+
const withdrawalParams = {
|
|
266
|
+
assetId: ctx.sourceToken.assetId,
|
|
267
|
+
amount: BigInt(ctx.sourceTokenAmount),
|
|
268
|
+
destinationAddress: getDestinationAddress(
|
|
269
|
+
ctx,
|
|
270
|
+
isDirectNearTokenWithdrawal || isDirectNonNearWithdrawal,
|
|
271
|
+
),
|
|
272
|
+
destinationMemo: undefined,
|
|
273
|
+
feeInclusive: false,
|
|
274
|
+
routeConfig,
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
onPending('WAITING_CONFIRMATION');
|
|
277
278
|
|
|
278
279
|
try {
|
|
279
|
-
await
|
|
280
|
+
const feeEstimation = await sdk.estimateWithdrawalFee({
|
|
281
|
+
withdrawalParams,
|
|
282
|
+
});
|
|
280
283
|
|
|
281
|
-
|
|
282
|
-
|
|
284
|
+
const { intentHash } = await sdk.signAndSendWithdrawalIntent({
|
|
285
|
+
withdrawalParams,
|
|
286
|
+
feeEstimation,
|
|
287
|
+
});
|
|
283
288
|
|
|
284
289
|
onPending('PROCESSING');
|
|
285
|
-
const
|
|
290
|
+
const intentTx = await sdk.waitForIntentSettlement({ intentHash });
|
|
286
291
|
|
|
287
|
-
await
|
|
292
|
+
const completionResult = await sdk.waitForWithdrawalCompletion({
|
|
293
|
+
withdrawalParams,
|
|
294
|
+
intentTx,
|
|
295
|
+
});
|
|
288
296
|
|
|
289
297
|
return {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
298
|
+
intent: intentTx.hash,
|
|
299
|
+
// no hash means completion not trackable for this bridge
|
|
300
|
+
hash: completionResult.hash ?? '',
|
|
301
|
+
transactionLink: completionResult.hash
|
|
302
|
+
? getTransactionLink(
|
|
303
|
+
CHAIN_IDS_MAP[ctx.targetToken.blockchain],
|
|
304
|
+
completionResult.hash,
|
|
305
|
+
)
|
|
306
|
+
: '',
|
|
293
307
|
};
|
|
294
308
|
} catch (e: unknown) {
|
|
295
309
|
logger.error('[TRANSFER ERROR]', e);
|
|
@@ -313,7 +327,7 @@ export const useMakeIntentsTransfer = ({ providers }: IntentsTransferArgs) => {
|
|
|
313
327
|
});
|
|
314
328
|
}
|
|
315
329
|
|
|
316
|
-
if (e
|
|
330
|
+
if (isErrorLikeObject(e)) {
|
|
317
331
|
if (e.message.includes('Fee is not estimated')) {
|
|
318
332
|
throw new TransferError({
|
|
319
333
|
code: 'FEES_NOT_ESTIMATED',
|
|
@@ -321,10 +335,7 @@ export const useMakeIntentsTransfer = ({ providers }: IntentsTransferArgs) => {
|
|
|
321
335
|
}
|
|
322
336
|
|
|
323
337
|
// User rejected
|
|
324
|
-
if (
|
|
325
|
-
isUserDeniedSigning(e.message) ||
|
|
326
|
-
isUserDeniedSigning(`${e.cause}`)
|
|
327
|
-
) {
|
|
338
|
+
if (isUserDeniedSigning(e)) {
|
|
328
339
|
return undefined;
|
|
329
340
|
}
|
|
330
341
|
}
|
|
@@ -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',
|