@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.
Files changed (116) hide show
  1. package/dist/{config-CQ4V08as.js → config-BVaLnxO9.js} +803 -788
  2. package/dist/config-BVaLnxO9.js.map +1 -0
  3. package/dist/config.js +2 -2
  4. package/dist/errors.js +1 -1
  5. package/dist/ext/alchemy/index.js +1 -1
  6. package/dist/ext/index.js +1 -1
  7. package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
  8. package/dist/features/BalanceRpcLoader/index.js +1 -1
  9. package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
  10. package/dist/features/ChainsDropdown/index.js +1 -1
  11. package/dist/features/DepositMethodSwitcher.js +1 -1
  12. package/dist/features/ErrorBoundary.js +1 -1
  13. package/dist/features/ExternalDeposit.js +2 -2
  14. package/dist/features/SendAddress/index.js +1 -1
  15. package/dist/features/SendAddress/useNotification.js +1 -1
  16. package/dist/features/SubmitButton/index.js +1 -1
  17. package/dist/features/SuccessScreen/index.js +1 -1
  18. package/dist/features/SwapDirectionSwitcher.js +1 -1
  19. package/dist/features/SwapQuote/SwapQuote.js +1 -1
  20. package/dist/features/SwapQuote/index.js +1 -1
  21. package/dist/features/TokenInput/TokenInput.js +1 -1
  22. package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
  23. package/dist/features/TokenInput/TokenInputSource.js +1 -1
  24. package/dist/features/TokenInput/TokenInputTarget.js +1 -1
  25. package/dist/features/TokenInput/WalletBalance.js +1 -1
  26. package/dist/features/TokenInput/hooks/index.js +1 -1
  27. package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
  28. package/dist/features/TokenInput/index.js +1 -1
  29. package/dist/features/TokensList/TokenItem.js +1 -1
  30. package/dist/features/TokensList/TokensList.js +1 -1
  31. package/dist/features/TokensList/index.js +1 -1
  32. package/dist/features/TokensModal.js +2 -2
  33. package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +2 -2
  34. package/dist/features/WalletCompatibilityCheck/index.js +1 -1
  35. package/dist/features/index.js +1 -1
  36. package/dist/hooks/index.js +1 -1
  37. package/dist/hooks/useAllTokens.js +1 -1
  38. package/dist/hooks/useChains.js +1 -1
  39. package/dist/hooks/useCompatibilityCheck.js +1 -1
  40. package/dist/hooks/useDefaultToken.js +1 -1
  41. package/dist/hooks/useExternalDepositStatus/index.js +1 -1
  42. package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
  43. package/dist/hooks/useIntentsBalance.js +1 -1
  44. package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
  45. package/dist/hooks/useMakeDepositAddress.js +1 -1
  46. package/dist/hooks/useMakeIntentsTransfer.js +4 -3
  47. package/dist/hooks/useMakeIntentsTransfer.js.map +1 -1
  48. package/dist/hooks/useMakeNEARFtTransferCall.js +4 -2
  49. package/dist/hooks/useMakeNEARFtTransferCall.js.map +1 -1
  50. package/dist/hooks/useMakeQuote.js +1 -1
  51. package/dist/hooks/useMakeQuoteTransfer.js +3 -2
  52. package/dist/hooks/useMakeQuoteTransfer.js.map +1 -1
  53. package/dist/hooks/useMakeSolanaTransfer.js +1 -1
  54. package/dist/hooks/useMakeTransfer.js +1 -1
  55. package/dist/hooks/useMergedBalance.js +1 -1
  56. package/dist/hooks/useSwitchChain.js +1 -1
  57. package/dist/hooks/useTheme.js +1 -1
  58. package/dist/hooks/useTokenInputPair.js +1 -1
  59. package/dist/hooks/useTokens.js +1 -1
  60. package/dist/hooks/useTokensFiltered.js +1 -1
  61. package/dist/hooks/useTokensIntentsUnique.js +1 -1
  62. package/dist/{index-Ce9bzNHX.js → index-JGjxyZXI.js} +70 -70
  63. package/dist/index-JGjxyZXI.js.map +1 -0
  64. package/dist/index.browser.esm-COWShN0a.js.map +1 -1
  65. package/dist/index.js +1 -1
  66. package/dist/machine/effects/index.js +1 -1
  67. package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
  68. package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
  69. package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
  70. package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
  71. package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
  72. package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
  73. package/dist/machine/effects/useWalletConnEffect.js +1 -1
  74. package/dist/machine/events/index.js +1 -1
  75. package/dist/machine/events/tokenSelect.js +1 -1
  76. package/dist/machine/events/validateInputAndMoveTo.js +1 -1
  77. package/dist/machine/events/validateInputs.js +1 -1
  78. package/dist/machine/index.js +1 -1
  79. package/dist/machine/snap.js +1 -1
  80. package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
  81. package/dist/machine/subscriptions/index.js +1 -1
  82. package/dist/theme/ThemeProvider.js +1 -1
  83. package/dist/utils/checkers/isUserDeniedSigning.d.ts +2 -1
  84. package/dist/utils/checkers/isUserDeniedSigning.js +6 -4
  85. package/dist/utils/checkers/isUserDeniedSigning.js.map +1 -1
  86. package/dist/utils/index.d.ts +1 -0
  87. package/dist/utils/index.js +26 -24
  88. package/dist/utils/index.js.map +1 -1
  89. package/dist/utils/intents/signers/near.d.ts +1 -1
  90. package/dist/utils/intents/signers/near.js +2 -2
  91. package/dist/utils/intents/signers/privy.d.ts +1 -1
  92. package/dist/utils/intents/signers/privy.js +1 -1
  93. package/dist/utils/intents/signers/solana.d.ts +1 -1
  94. package/dist/utils/intents/signers/solana.js.map +1 -1
  95. package/dist/utils/isErrorLikeObject.d.ts +4 -0
  96. package/dist/utils/isErrorLikeObject.js +5 -0
  97. package/dist/utils/isErrorLikeObject.js.map +1 -0
  98. package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
  99. package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +2 -2
  100. package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
  101. package/dist/widgets/WidgetSwap/WidgetSwapContent.js +2 -2
  102. package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
  103. package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +2 -2
  104. package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
  105. package/package.json +2 -2
  106. package/src/hooks/useMakeIntentsTransfer.ts +40 -29
  107. package/src/hooks/useMakeNEARFtTransferCall.ts +10 -0
  108. package/src/hooks/useMakeQuoteTransfer.ts +2 -1
  109. package/src/utils/checkers/isUserDeniedSigning.ts +11 -3
  110. package/src/utils/index.ts +1 -0
  111. package/src/utils/intents/signers/near.ts +1 -1
  112. package/src/utils/intents/signers/privy.ts +1 -1
  113. package/src/utils/intents/signers/solana.ts +1 -1
  114. package/src/utils/isErrorLikeObject.ts +11 -0
  115. package/dist/config-CQ4V08as.js.map +0 -1
  116. 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-CQ4V08as.js";
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,6 +1,6 @@
1
1
  import "lodash.once";
2
2
  import "react";
3
- import { r as i, c as m } from "../../config-CQ4V08as.js";
3
+ import { r as i, c as m } from "../../config-BVaLnxO9.js";
4
4
  import "../../logger.js";
5
5
  export {
6
6
  i as registerStoreEvents,
@@ -1,4 +1,4 @@
1
- import { U as c } from "../../config-CQ4V08as.js";
1
+ import { U as c } from "../../config-BVaLnxO9.js";
2
2
  export {
3
3
  c as useAlchemyBalanceEffect
4
4
  };
@@ -1,6 +1,6 @@
1
1
  import "react";
2
2
  import "@tanstack/react-query";
3
- import { F as a } from "../../config-CQ4V08as.js";
3
+ import { F as a } from "../../config-BVaLnxO9.js";
4
4
  import "../guards/index.js";
5
5
  import "../machine.js";
6
6
  export {
@@ -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-CQ4V08as.js";
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-CQ4V08as.js";
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,5 +1,5 @@
1
1
  import "react";
2
- import { G as a } from "../../config-CQ4V08as.js";
2
+ import { G as a } from "../../config-BVaLnxO9.js";
3
3
  import "../../utils/intents/getTokenBalanceKey.js";
4
4
  import "ethers";
5
5
  import "../machine.js";
@@ -1,5 +1,5 @@
1
1
  import "react";
2
- import { H as i } from "../../config-CQ4V08as.js";
2
+ import { H as i } from "../../config-BVaLnxO9.js";
3
3
  import "ethers";
4
4
  import "../machine.js";
5
5
  import "../events/utils/fireEvent.js";
@@ -1,6 +1,6 @@
1
1
  import "react";
2
2
  import "../../hooks/useWalletAddressForToken.js";
3
- import { I as f } from "../../config-CQ4V08as.js";
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-CQ4V08as.js";
6
+ import { _ as b } from "../../config-BVaLnxO9.js";
7
7
  import "./tokenSetAmount.js";
8
8
  import "./quoteSetStatus.js";
9
9
  import "./depositTypeSet.js";
@@ -1,6 +1,6 @@
1
1
  import "valtio";
2
2
  import "./tokenSelectRotate.js";
3
- import { Z as p } from "../../config-CQ4V08as.js";
3
+ import { Z as p } from "../../config-BVaLnxO9.js";
4
4
  import "../../utils/notReachable.js";
5
5
  export {
6
6
  p as tokenSelect
@@ -1,4 +1,4 @@
1
- import { O as m } from "../../config-CQ4V08as.js";
1
+ import { O as m } from "../../config-BVaLnxO9.js";
2
2
  import "ethers";
3
3
  import "../machine.js";
4
4
  import "../guards/checks/isDryQuote.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-CQ4V08as.js";
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";
@@ -1,4 +1,4 @@
1
- import { r as o, u as t, a as r, c as a, b as f } from "../config-CQ4V08as.js";
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";
@@ -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-CQ4V08as.js";
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";
@@ -1,5 +1,5 @@
1
1
  import "valtio";
2
- import { V as o } from "../../../config-CQ4V08as.js";
2
+ import { V as o } from "../../../config-BVaLnxO9.js";
3
3
  export {
4
4
  o as isSendAddressAsConnected
5
5
  };
@@ -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-CQ4V08as.js";
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,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "./createColorPalette.js";
4
- import { C as i, ae as p } from "../config-CQ4V08as.js";
4
+ import { C as i, ae as p } from "../config-BVaLnxO9.js";
5
5
  export {
6
6
  i as ThemeContext,
7
7
  p as ThemeProvider
@@ -1 +1,2 @@
1
- export declare const isUserDeniedSigning: (errorMessage: string) => boolean;
1
+ import { ErrorLikeObject } from '../isErrorLikeObject';
2
+ export declare const isUserDeniedSigning: (error: ErrorLikeObject) => boolean;
@@ -1,13 +1,15 @@
1
- const s = [
1
+ const n = [
2
2
  "user denied",
3
3
  "user closed",
4
4
  "user rejected",
5
5
  "user cancelled",
6
6
  "user declined"
7
- ], n = (e) => s.some(
8
- (r) => e.toLowerCase().includes(r)
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
- n as isUserDeniedSigning
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":["const errorVariations = [\n 'user denied',\n 'user closed',\n 'user rejected',\n 'user cancelled',\n 'user declined',\n];\n\nexport const isUserDeniedSigning = (errorMessage: string) => {\n return errorVariations.some((variation) =>\n errorMessage.toLowerCase().includes(variation),\n );\n};\n"],"names":["errorVariations","isUserDeniedSigning","errorMessage","variation"],"mappings":"AAAA,MAAMA,IAAkB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEaC,IAAsB,CAACC,MAC3BF,EAAgB;AAAA,EAAK,CAACG,MAC3BD,EAAa,YAAA,EAAc,SAASC,CAAS;AAAA;"}
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;"}
@@ -18,3 +18,4 @@ export { formatAddressTruncate } from './formatters/formatAddressTruncate';
18
18
  export { cn } from './cn';
19
19
  export { noop } from './noop';
20
20
  export { notReachable } from './notReachable';
21
+ export { isErrorLikeObject } from './isErrorLikeObject';
@@ -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 a } from "./checkers/isValidChain.js";
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 g } from "./evm/isEvmBaseToken.js";
8
- import { getEvmTokenBalance as c } from "./evm/getEvmTokenBalance.js";
9
- import { getEvmMainTokenBalance as h } from "./evm/getEvmMainTokenBalance.js";
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 d } from "./formatters/formatHumanToBig.js";
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 N } from "./formatters/formatUsdAmount.js";
15
- import { getExplorerUrl as D } from "./formatters/getExplorerUrl.js";
16
- import { getTransactionLink as M } from "./formatters/getTransactionLink.js";
17
- import { formatAddressTruncate as V } from "./formatters/formatAddressTruncate.js";
18
- import { cn as q } from "./cn.js";
19
- import { noop as z } from "./noop.js";
20
- import { notReachable as G } from "./notReachable.js";
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
- q as cn,
23
- V as formatAddressTruncate,
23
+ V as cn,
24
+ O as formatAddressTruncate,
24
25
  v as formatBigToHuman,
25
- d as formatHumanToBig,
26
+ b as formatHumanToBig,
26
27
  A as formatTinyNumber,
27
28
  y as formatTxHash,
28
- N as formatUsdAmount,
29
- h as getEvmMainTokenBalance,
30
- c as getEvmTokenBalance,
31
- D as getExplorerUrl,
32
- M as getTransactionLink,
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
- g as isEvmBaseToken,
37
+ c as isEvmBaseToken,
36
38
  i as isEvmChain,
37
39
  T as isEvmToken,
38
40
  m as isNotEmptyAmount,
39
- a as isValidChain,
40
- z as noop,
41
- G as notReachable
41
+ p as isValidChain,
42
+ w as noop,
43
+ F as notReachable
42
44
  };
43
45
  //# sourceMappingURL=index.js.map
@@ -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/bridge-sdk';
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/bridge-sdk";
3
- import { a2 as o } from "../../../config-CQ4V08as.js";
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/bridge-sdk';
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,5 +1,5 @@
1
1
  import "@defuse-protocol/internal-utils";
2
- import { a1 as i } from "../../../config-CQ4V08as.js";
2
+ import { a1 as i } from "../../../config-BVaLnxO9.js";
3
3
  export {
4
4
  i as IntentSignerPrivy
5
5
  };
@@ -1,4 +1,4 @@
1
- import { createIntentSignerViem } from '@defuse-protocol/bridge-sdk';
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/bridge-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;"}
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,4 @@
1
+ export type ErrorLikeObject = Error | {
2
+ message: string;
3
+ };
4
+ export declare const isErrorLikeObject: (error: unknown) => error is ErrorLikeObject;
@@ -0,0 +1,5 @@
1
+ const e = (t) => t instanceof Error || typeof t == "object" && t !== null && "message" in t && typeof t.message == "string";
2
+ export {
3
+ e as isErrorLikeObject
4
+ };
5
+ //# sourceMappingURL=isErrorLikeObject.js.map
@@ -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;"}
@@ -2,7 +2,7 @@ import "../../index-DEq3oXQF.js";
2
2
  import "zod";
3
3
  import "./decodeQueryResult.js";
4
4
  import "./rpc.js";
5
- import { $ as m } from "../../config-CQ4V08as.js";
5
+ import { $ as m } from "../../config-BVaLnxO9.js";
6
6
  export {
7
7
  m as getNearNep141StorageBalance
8
8
  };
@@ -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-CQ4V08as.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-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/bridge-sdk";
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-CQ4V08as.js";
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-CQ4V08as.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-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/bridge-sdk";
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-CQ4V08as.js";
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-CQ4V08as.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-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/bridge-sdk";
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-CQ4V08as.js";
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.1",
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/bridge-sdk": "0.10.3",
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/bridge-sdk';
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 BridgeSDK({ referral: snakeCase(appName) });
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 withdrawal = sdk.createWithdrawal({
265
- 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
- });
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 withdrawal.estimateFee();
280
+ const feeEstimation = await sdk.estimateWithdrawalFee({
281
+ withdrawalParams,
282
+ });
280
283
 
281
- onPending('WAITING_CONFIRMATION');
282
- const txIntent = await withdrawal.signAndSendIntent();
284
+ const { intentHash } = await sdk.signAndSendWithdrawalIntent({
285
+ withdrawalParams,
286
+ feeEstimation,
287
+ });
283
288
 
284
289
  onPending('PROCESSING');
285
- const tx = await withdrawal.waitForIntentSettlement();
290
+ const intentTx = await sdk.waitForIntentSettlement({ intentHash });
286
291
 
287
- await withdrawal.waitForWithdrawalCompletion();
292
+ const completionResult = await sdk.waitForWithdrawalCompletion({
293
+ withdrawalParams,
294
+ intentTx,
295
+ });
288
296
 
289
297
  return {
290
- hash: tx.hash,
291
- transactionLink: getTransactionLink(CHAIN_IDS_MAP.near, tx.hash),
292
- intent: txIntent,
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 instanceof Error) {
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',