@aurora-is-near/intents-swap-widget 2.22.0 → 2.23.1
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/components/SwapCard.js +35 -60
- package/dist/components/SwapCard.js.map +1 -1
- package/dist/{config-ftnUM5ot.js → config-BfE-vfA3.js} +362 -348
- package/dist/config-BfE-vfA3.js.map +1 -0
- package/dist/config.js +1 -1
- 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 +1 -1
- 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/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 +1 -1
- 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.d.ts +3 -0
- package/dist/hooks/useAllTokens.js +6 -0
- package/dist/hooks/useAllTokens.js.map +1 -0
- package/dist/hooks/useChains.js +1 -1
- package/dist/hooks/useCompatibilityCheck.js +3 -3
- package/dist/hooks/useDefaultToken.js +2 -2
- package/dist/hooks/useExternalDepositStatus.js +1 -1
- package/dist/hooks/useIntentsBalance.js +1 -1
- package/dist/hooks/useMakeDepositAddress.js +1 -1
- package/dist/hooks/useMakeIntentsTransfer.js +1 -1
- package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
- package/dist/hooks/useMakeQuote.js +1 -1
- package/dist/hooks/useMakeQuoteTransfer.js +1 -1
- package/dist/hooks/useMakeTransfer.js +1 -1
- package/dist/hooks/useMergedBalance.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.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 +2 -2
- package/dist/machine/events/tokenSelect.js +1 -1
- package/dist/machine/events/validateInputAndMoveTo.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/utils/intents/signers/near.js +1 -1
- package/dist/utils/intents/signers/privy.js +1 -1
- package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
- package/dist/utils/ton/getTonTokenBalance.js +16 -7
- package/dist/utils/ton/getTonTokenBalance.js.map +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +1 -1
- package/package.json +1 -1
- package/src/components/SwapCard.tsx +4 -24
- package/src/features/BalanceRpcLoader/index.tsx +2 -2
- package/src/features/BalanceRpcLoader/useTokenBalanceRpc.ts +1 -5
- package/src/hooks/useAllTokens.ts +27 -0
- package/src/utils/ton/getTonTokenBalance.ts +69 -9
- package/dist/config-ftnUM5ot.js.map +0 -1
|
@@ -1,90 +1,65 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import { TokenAmount as
|
|
6
|
-
import {
|
|
1
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import p from "clsx";
|
|
3
|
+
import * as l from "lucide-react";
|
|
4
|
+
import { useMemo as u } from "react";
|
|
5
|
+
import { TokenAmount as d } from "./TokenAmount.js";
|
|
6
|
+
import { Card as w } from "./Card.js";
|
|
7
7
|
import "../constants/chains.js";
|
|
8
|
-
import "@tanstack/react-query";
|
|
9
|
-
import "zod";
|
|
10
|
-
import "../utils/near/rpc.js";
|
|
11
|
-
import "@defuse-protocol/bridge-sdk";
|
|
12
|
-
import "change-case";
|
|
13
|
-
import "@defuse-protocol/internal-utils";
|
|
14
|
-
import "bs58";
|
|
15
|
-
import "@defuse-protocol/one-click-sdk-typescript";
|
|
16
|
-
import "axios";
|
|
17
|
-
import "../network.js";
|
|
18
|
-
import "ethers";
|
|
19
|
-
import "../machine/machine.js";
|
|
20
8
|
import "viem";
|
|
21
|
-
import
|
|
22
|
-
import "
|
|
23
|
-
import {
|
|
24
|
-
const
|
|
25
|
-
title:
|
|
26
|
-
state:
|
|
27
|
-
className:
|
|
9
|
+
import "ethers";
|
|
10
|
+
import { cn as N } from "../utils/cn.js";
|
|
11
|
+
import { x as h } from "../config-BfE-vfA3.js";
|
|
12
|
+
const A = ({
|
|
13
|
+
title: f = "Swap",
|
|
14
|
+
state: s,
|
|
15
|
+
className: x,
|
|
28
16
|
source: i,
|
|
29
|
-
target:
|
|
17
|
+
target: m
|
|
30
18
|
}) => {
|
|
31
|
-
const { tokens:
|
|
32
|
-
|
|
33
|
-
return [
|
|
34
|
-
...n,
|
|
35
|
-
...c || [],
|
|
36
|
-
...d || []
|
|
37
|
-
].forEach((x) => {
|
|
38
|
-
s[x.assetId] = x;
|
|
39
|
-
}), Object.values(s);
|
|
40
|
-
}, [n, c, d]), f = p.find(
|
|
41
|
-
(s) => s.assetId === i.assetId
|
|
42
|
-
), u = p.find(
|
|
43
|
-
(s) => s.assetId === l.assetId
|
|
44
|
-
), o = w(() => {
|
|
45
|
-
if (t === "in-progress")
|
|
19
|
+
const { tokens: o } = h(), n = o.find((r) => r.assetId === i.assetId), c = o.find((r) => r.assetId === m.assetId), t = u(() => {
|
|
20
|
+
if (s === "in-progress")
|
|
46
21
|
return {
|
|
47
22
|
label: "Waiting",
|
|
48
|
-
icon: /* @__PURE__ */ e(
|
|
23
|
+
icon: /* @__PURE__ */ e(l.Loader, { size: 16, className: "animate-spin" })
|
|
49
24
|
};
|
|
50
|
-
if (
|
|
25
|
+
if (s === "completed")
|
|
51
26
|
return {
|
|
52
27
|
label: "Completed",
|
|
53
28
|
labelClassName: "text-sw-success-100",
|
|
54
|
-
icon: /* @__PURE__ */ e("div", { className: "rounded-full w-[16px] h-[16px] flex items-center justify-center bg-sw-success-100", children: /* @__PURE__ */ e(
|
|
29
|
+
icon: /* @__PURE__ */ e("div", { className: "rounded-full w-[16px] h-[16px] flex items-center justify-center bg-sw-success-100", children: /* @__PURE__ */ e(l.Check, { size: 9, className: "text-sw-gray-900" }) })
|
|
55
30
|
};
|
|
56
|
-
if (
|
|
31
|
+
if (s === "failed")
|
|
57
32
|
return {
|
|
58
33
|
label: "Failed",
|
|
59
34
|
labelClassName: "text-sw-alert-100",
|
|
60
|
-
icon: /* @__PURE__ */ e("div", { className: "rounded-full w-[16px] h-[16px] flex items-center justify-center bg-sw-alert-100", children: /* @__PURE__ */ e(
|
|
35
|
+
icon: /* @__PURE__ */ e("div", { className: "rounded-full w-[16px] h-[16px] flex items-center justify-center bg-sw-alert-100", children: /* @__PURE__ */ e(l.X, { size: 9, className: "text-sw-gray-900" }) })
|
|
61
36
|
};
|
|
62
|
-
}, [
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
/* @__PURE__ */ e("h2", { className: "font-medium text-sw-label-m", children:
|
|
66
|
-
|
|
67
|
-
|
|
37
|
+
}, [s]);
|
|
38
|
+
return /* @__PURE__ */ a(w, { className: p("w-full text-sw-gray-50", x), children: [
|
|
39
|
+
/* @__PURE__ */ a("div", { className: "flex justify-between", children: [
|
|
40
|
+
/* @__PURE__ */ e("h2", { className: "font-medium text-sw-label-m", children: f }),
|
|
41
|
+
t ? /* @__PURE__ */ a("div", { className: "flex flex-row items-center gap-x-sw-sm", children: [
|
|
42
|
+
t.icon,
|
|
68
43
|
/* @__PURE__ */ e(
|
|
69
44
|
"span",
|
|
70
45
|
{
|
|
71
|
-
className:
|
|
46
|
+
className: N(
|
|
72
47
|
"font-medium text-sw-label-m",
|
|
73
|
-
|
|
48
|
+
t.labelClassName
|
|
74
49
|
),
|
|
75
|
-
children:
|
|
50
|
+
children: t.label
|
|
76
51
|
}
|
|
77
52
|
)
|
|
78
53
|
] }) : /* @__PURE__ */ e("div", {})
|
|
79
54
|
] }),
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
|
|
82
|
-
/* @__PURE__ */ e(
|
|
83
|
-
|
|
55
|
+
/* @__PURE__ */ a("div", { className: "flex flex-row items-center gap-x-sw-2md mt-sw-xl", children: [
|
|
56
|
+
n && /* @__PURE__ */ e(d, { token: n, amount: i.amount }),
|
|
57
|
+
/* @__PURE__ */ e(l.ArrowRight, { className: "text-sw-gray-100", size: 16 }),
|
|
58
|
+
c && /* @__PURE__ */ e(d, { token: c, amount: m.amount })
|
|
84
59
|
] })
|
|
85
60
|
] });
|
|
86
61
|
};
|
|
87
62
|
export {
|
|
88
|
-
|
|
63
|
+
A as SwapCard
|
|
89
64
|
};
|
|
90
65
|
//# sourceMappingURL=SwapCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwapCard.js","sources":["../../src/components/SwapCard.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport * as Icons from 'lucide-react';\nimport { ReactNode, useMemo } from 'react';\nimport { TokenAmount } from './TokenAmount';\nimport {
|
|
1
|
+
{"version":3,"file":"SwapCard.js","sources":["../../src/components/SwapCard.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport * as Icons from 'lucide-react';\nimport { ReactNode, useMemo } from 'react';\nimport { TokenAmount } from './TokenAmount';\nimport { Card } from './Card';\nimport { cn } from '../utils';\nimport { useAllTokens } from '../hooks/useAllTokens';\n\ntype Props = {\n title?: string;\n state?: 'not-started' | 'in-progress' | 'completed' | 'failed';\n className?: string;\n source: {\n assetId: string;\n amount: string;\n };\n target: {\n assetId: string;\n amount: string;\n };\n};\n\nexport const SwapCard = ({\n title = 'Swap',\n state,\n className,\n source,\n target,\n}: Props) => {\n const { tokens } = useAllTokens();\n\n const sourceToken = tokens.find((token) => token.assetId === source.assetId);\n\n const targetToken = tokens.find((token) => token.assetId === target.assetId);\n\n const statusIndicator:\n | {\n label: string;\n labelClassName?: string;\n icon?: ReactNode;\n }\n | undefined = useMemo(() => {\n if (state === 'in-progress') {\n return {\n label: 'Waiting',\n icon: <Icons.Loader size={16} className=\"animate-spin\" />,\n };\n }\n\n if (state === 'completed') {\n return {\n label: 'Completed',\n labelClassName: 'text-sw-success-100',\n icon: (\n <div className=\"rounded-full w-[16px] h-[16px] flex items-center justify-center bg-sw-success-100\">\n <Icons.Check size={9} className=\"text-sw-gray-900\" />\n </div>\n ),\n };\n }\n\n if (state === 'failed') {\n return {\n label: 'Failed',\n labelClassName: 'text-sw-alert-100',\n icon: (\n <div className=\"rounded-full w-[16px] h-[16px] flex items-center justify-center bg-sw-alert-100\">\n <Icons.X size={9} className=\"text-sw-gray-900\" />\n </div>\n ),\n };\n }\n }, [state]);\n\n return (\n <Card className={clsx('w-full text-sw-gray-50', className)}>\n <div className=\"flex justify-between\">\n <h2 className=\"font-medium text-sw-label-m\">{title}</h2>\n {statusIndicator ? (\n <div className=\"flex flex-row items-center gap-x-sw-sm\">\n {statusIndicator.icon}\n <span\n className={cn(\n 'font-medium text-sw-label-m',\n statusIndicator.labelClassName,\n )}>\n {statusIndicator.label}\n </span>\n </div>\n ) : (\n <div />\n )}\n </div>\n <div className=\"flex flex-row items-center gap-x-sw-2md mt-sw-xl\">\n {sourceToken && (\n <TokenAmount token={sourceToken} amount={source.amount} />\n )}\n <Icons.ArrowRight className=\"text-sw-gray-100\" size={16} />\n {targetToken && (\n <TokenAmount token={targetToken} amount={target.amount} />\n )}\n </div>\n </Card>\n );\n};\n"],"names":["SwapCard","title","state","className","source","target","tokens","useAllTokens","sourceToken","token","targetToken","statusIndicator","useMemo","Icons","jsx","Card","clsx","jsxs","cn","TokenAmount"],"mappings":";;;;;;;;;;;AAsBO,MAAMA,IAAW,CAAC;AAAA,EACvB,OAAAC,IAAQ;AAAA,EACR,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AACF,MAAa;AACX,QAAM,EAAE,QAAAC,EAAA,IAAWC,EAAA,GAEbC,IAAcF,EAAO,KAAK,CAACG,MAAUA,EAAM,YAAYL,EAAO,OAAO,GAErEM,IAAcJ,EAAO,KAAK,CAACG,MAAUA,EAAM,YAAYJ,EAAO,OAAO,GAErEM,IAMUC,EAAQ,MAAM;AAC5B,QAAIV,MAAU;AACZ,aAAO;AAAA,QACL,OAAO;AAAA,QACP,wBAAOW,EA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