@aurora-is-near/intents-swap-widget 2.15.2 → 2.17.0
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/Input.d.ts +1 -1
- package/dist/components/Input.js +45 -40
- package/dist/components/Input.js.map +1 -1
- package/dist/{config-XyIPS3Jf.js → config-DuYu3wzi.js} +909 -902
- package/dist/config-DuYu3wzi.js.map +1 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +5 -4
- package/dist/config.js.map +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 +9 -8
- package/dist/features/ExternalDeposit.js.map +1 -1
- package/dist/features/SendAddress/index.js +33 -28
- package/dist/features/SendAddress/index.js.map +1 -1
- package/dist/features/SendAddress/useNotification.js +18 -16
- package/dist/features/SendAddress/useNotification.js.map +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 +4 -3
- package/dist/features/TokensModal.js.map +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/useChains.js +1 -1
- package/dist/hooks/useCompatibilityCheck.js +1 -1
- package/dist/hooks/useDefaultToken.js +1 -1
- package/dist/hooks/useExternalDepositStatus.js +1 -1
- package/dist/hooks/useIntentsBalance.js +1 -1
- package/dist/hooks/useMakeDepositAddress.js +1 -1
- package/dist/hooks/useMakeEvmTransfer.d.ts +13 -0
- package/dist/hooks/useMakeEvmTransfer.js +71 -0
- package/dist/hooks/useMakeEvmTransfer.js.map +1 -0
- package/dist/hooks/useMakeIntentsTransfer.js +1 -1
- package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
- package/dist/hooks/useMakeQuote.d.ts +18 -2
- package/dist/hooks/useMakeQuote.js +1 -1
- package/dist/hooks/useMakeQuoteTransfer.d.ts +1 -1
- package/dist/hooks/useMakeQuoteTransfer.js +5 -2
- package/dist/hooks/useMakeQuoteTransfer.js.map +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 +1 -1
- 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/types/config.d.ts +1 -0
- package/dist/types/transfer.d.ts +1 -0
- package/dist/utils/evm/isEvmAddress.d.ts +1 -0
- package/dist/utils/evm/isEvmAddress.js +5 -0
- package/dist/utils/evm/isEvmAddress.js.map +1 -0
- 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/widgets/WidgetDeposit/WidgetDepositContent.js +8 -7
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js.map +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js +4 -3
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js.map +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +18 -17
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js.map +1 -1
- package/package.json +4 -4
- package/src/components/Input.tsx +9 -4
- package/src/config.tsx +0 -4
- package/src/features/SendAddress/index.tsx +18 -3
- package/src/features/SendAddress/useNotification.ts +5 -1
- package/src/hooks/useMakeEvmTransfer.ts +115 -0
- package/src/hooks/useMakeQuote.ts +24 -17
- package/src/hooks/useMakeQuoteTransfer.ts +38 -15
- package/src/types/config.ts +3 -0
- package/src/types/transfer.ts +1 -0
- package/src/utils/evm/isEvmAddress.ts +3 -0
- package/dist/config-XyIPS3Jf.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InputProps } from '@headlessui/react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
import { LucideIcon } from 'lucide-react';
|
|
4
|
-
type State = 'default' | 'disabled' | 'error';
|
|
4
|
+
type State = 'default' | 'disabled' | 'error' | 'fixed';
|
|
5
5
|
export type Props = Omit<InputProps, 'size'> & {
|
|
6
6
|
icon?: LucideIcon;
|
|
7
7
|
defaultValue?: string;
|
package/dist/components/Input.js
CHANGED
|
@@ -1,81 +1,86 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { Input as
|
|
4
|
-
import * as
|
|
5
|
-
import { cn as
|
|
1
|
+
import { jsx as s, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as F, useState as g, useEffect as w, Fragment as I } from "react";
|
|
3
|
+
import { Input as j } from "@headlessui/react";
|
|
4
|
+
import * as B from "lucide-react";
|
|
5
|
+
import { cn as l } from "../utils/cn.js";
|
|
6
6
|
const E = ({
|
|
7
7
|
state: e = "default",
|
|
8
8
|
defaultValue: t = "",
|
|
9
|
-
focusOnMount:
|
|
10
|
-
className:
|
|
11
|
-
onChange:
|
|
12
|
-
children:
|
|
13
|
-
icon:
|
|
14
|
-
...
|
|
9
|
+
focusOnMount: p = !1,
|
|
10
|
+
className: x,
|
|
11
|
+
onChange: n,
|
|
12
|
+
children: y,
|
|
13
|
+
icon: i,
|
|
14
|
+
...c
|
|
15
15
|
}) => {
|
|
16
|
-
const
|
|
17
|
-
a(""),
|
|
16
|
+
const u = F(null), [b, d] = g(!1), [r, a] = g(t), h = () => d(!0), v = () => d(!1), N = () => {
|
|
17
|
+
a(""), n?.({
|
|
18
18
|
target: { value: "" }
|
|
19
19
|
});
|
|
20
|
-
},
|
|
21
|
-
a(
|
|
20
|
+
}, C = (m) => {
|
|
21
|
+
a(m.target.value), n?.(m);
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
w(() => {
|
|
24
24
|
a(t);
|
|
25
|
-
}, [t]),
|
|
26
|
-
|
|
27
|
-
}, [])
|
|
28
|
-
|
|
25
|
+
}, [t]), w(() => {
|
|
26
|
+
p && u.current?.focus();
|
|
27
|
+
}, []);
|
|
28
|
+
const o = ["disabled", "fixed"].includes(e);
|
|
29
|
+
return /* @__PURE__ */ s(
|
|
30
|
+
j,
|
|
29
31
|
{
|
|
30
32
|
type: "text",
|
|
31
|
-
as:
|
|
32
|
-
disabled:
|
|
33
|
+
as: I,
|
|
34
|
+
disabled: o,
|
|
33
35
|
autoComplete: "off",
|
|
34
|
-
className:
|
|
36
|
+
className: l(
|
|
35
37
|
"px-sw-lg py-sw-lg text-sw-label-m rounded-sw-md ring-transparent ring-1 ring-inset data-focus:outline-none transition-colors",
|
|
36
38
|
{
|
|
37
39
|
"bg-sw-gray-600 text-sw-gray-50 hover:bg-sw-gray-500": e === "default"
|
|
38
40
|
},
|
|
39
|
-
{ "ring-sw-gray-400":
|
|
41
|
+
{ "ring-sw-gray-400": b && e === "default" },
|
|
40
42
|
{
|
|
41
43
|
"cursor-not-allowed bg-sw-gray-800 text-sw-gray-100": e === "disabled"
|
|
42
44
|
},
|
|
45
|
+
{
|
|
46
|
+
"bg-sw-gray-800 text-sw-gray-100": e === "fixed"
|
|
47
|
+
},
|
|
43
48
|
{ "text-sw-alert-100 bg-sw-gray-600": e === "error" },
|
|
44
|
-
|
|
49
|
+
x
|
|
45
50
|
),
|
|
46
|
-
...
|
|
47
|
-
children: () => /* @__PURE__ */
|
|
48
|
-
|
|
51
|
+
...c,
|
|
52
|
+
children: () => /* @__PURE__ */ f("div", { className: "flex items-center justify-between", children: [
|
|
53
|
+
i && /* @__PURE__ */ s(i, { size: 16, className: "mr-sw-md text-sw-gray-100" }),
|
|
49
54
|
/* @__PURE__ */ s(
|
|
50
55
|
"input",
|
|
51
56
|
{
|
|
52
57
|
value: r,
|
|
53
|
-
ref:
|
|
54
|
-
onBlur:
|
|
55
|
-
onFocus:
|
|
56
|
-
onChange:
|
|
57
|
-
disabled:
|
|
58
|
-
placeholder:
|
|
58
|
+
ref: u,
|
|
59
|
+
onBlur: v,
|
|
60
|
+
onFocus: h,
|
|
61
|
+
onChange: C,
|
|
62
|
+
disabled: o,
|
|
63
|
+
placeholder: c.placeholder,
|
|
59
64
|
autoComplete: "off",
|
|
60
|
-
className:
|
|
65
|
+
className: l("text-sw-label-m mr-auto w-full outline-none", {
|
|
61
66
|
"cursor-not-allowed": e === "disabled"
|
|
62
67
|
})
|
|
63
68
|
}
|
|
64
69
|
),
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
!o && /* @__PURE__ */ f("div", { className: "gap-sw-md relative flex items-center", children: [
|
|
71
|
+
y,
|
|
67
72
|
r ? /* @__PURE__ */ s(
|
|
68
73
|
"button",
|
|
69
74
|
{
|
|
70
75
|
type: "button",
|
|
71
|
-
className:
|
|
76
|
+
className: l(
|
|
72
77
|
"cursor-default text-sw-gray-100 opacity-0 transition-opacity duration-150 ease-in-out hover:text-sw-gray-50",
|
|
73
78
|
{
|
|
74
79
|
"cursor-pointer opacity-100": !!r
|
|
75
80
|
}
|
|
76
81
|
),
|
|
77
|
-
onClick:
|
|
78
|
-
children: /* @__PURE__ */ s(
|
|
82
|
+
onClick: N,
|
|
83
|
+
children: /* @__PURE__ */ s(B.X, { className: "h-sw-xl w-sw-xl" })
|
|
79
84
|
}
|
|
80
85
|
) : null
|
|
81
86
|
] })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sources":["../../src/components/Input.tsx"],"sourcesContent":["import { Fragment, useEffect, useRef, useState } from 'react';\nimport { Input as UIInput } from '@headlessui/react';\nimport type { InputProps } from '@headlessui/react';\nimport type { PropsWithChildren } from 'react';\nimport type { LucideIcon } from 'lucide-react';\nimport * as Icons from 'lucide-react';\n\nimport { cn } from '@/utils/cn';\n\ntype State = 'default' | 'disabled' | 'error';\n\nexport type Props = Omit<InputProps, 'size'> & {\n icon?: LucideIcon;\n defaultValue?: string;\n focusOnMount?: boolean;\n state?: State;\n};\n\nexport const Input = ({\n state = 'default',\n defaultValue = '',\n focusOnMount = false,\n className,\n onChange,\n children,\n icon: Icon,\n ...inputProps\n}: PropsWithChildren<Props>) => {\n const inputRef = useRef<HTMLInputElement>(null);\n const [isFocused, setIsFocused] = useState(false);\n const [value, setValue] = useState(defaultValue);\n\n const handleFocus = () => setIsFocused(true);\n const handleBlur = () => setIsFocused(false);\n const handleClear = () => {\n setValue('');\n onChange?.({\n target: { value: '' },\n } as React.ChangeEvent<HTMLInputElement>);\n };\n\n const onInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n onChange?.(e);\n };\n\n useEffect(() => {\n setValue(defaultValue);\n }, [defaultValue]);\n\n useEffect(() => {\n if (focusOnMount) {\n inputRef.current?.focus();\n }\n }, []);\n\n return (\n <UIInput\n type=\"text\"\n as={Fragment}\n disabled={
|
|
1
|
+
{"version":3,"file":"Input.js","sources":["../../src/components/Input.tsx"],"sourcesContent":["import { Fragment, useEffect, useRef, useState } from 'react';\nimport { Input as UIInput } from '@headlessui/react';\nimport type { InputProps } from '@headlessui/react';\nimport type { PropsWithChildren } from 'react';\nimport type { LucideIcon } from 'lucide-react';\nimport * as Icons from 'lucide-react';\n\nimport { cn } from '@/utils/cn';\n\ntype State = 'default' | 'disabled' | 'error' | 'fixed';\n\nexport type Props = Omit<InputProps, 'size'> & {\n icon?: LucideIcon;\n defaultValue?: string;\n focusOnMount?: boolean;\n state?: State;\n};\n\nexport const Input = ({\n state = 'default',\n defaultValue = '',\n focusOnMount = false,\n className,\n onChange,\n children,\n icon: Icon,\n ...inputProps\n}: PropsWithChildren<Props>) => {\n const inputRef = useRef<HTMLInputElement>(null);\n const [isFocused, setIsFocused] = useState(false);\n const [value, setValue] = useState(defaultValue);\n\n const handleFocus = () => setIsFocused(true);\n const handleBlur = () => setIsFocused(false);\n const handleClear = () => {\n setValue('');\n onChange?.({\n target: { value: '' },\n } as React.ChangeEvent<HTMLInputElement>);\n };\n\n const onInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n onChange?.(e);\n };\n\n useEffect(() => {\n setValue(defaultValue);\n }, [defaultValue]);\n\n useEffect(() => {\n if (focusOnMount) {\n inputRef.current?.focus();\n }\n }, []);\n\n const inputDisabled = ['disabled', 'fixed'].includes(state);\n\n return (\n <UIInput\n type=\"text\"\n as={Fragment}\n disabled={inputDisabled}\n autoComplete=\"off\"\n className={cn(\n 'px-sw-lg py-sw-lg text-sw-label-m rounded-sw-md ring-transparent ring-1 ring-inset data-focus:outline-none transition-colors',\n {\n 'bg-sw-gray-600 text-sw-gray-50 hover:bg-sw-gray-500':\n state === 'default',\n },\n { 'ring-sw-gray-400': isFocused && state === 'default' },\n {\n 'cursor-not-allowed bg-sw-gray-800 text-sw-gray-100':\n state === 'disabled',\n },\n {\n 'bg-sw-gray-800 text-sw-gray-100': state === 'fixed',\n },\n { 'text-sw-alert-100 bg-sw-gray-600': state === 'error' },\n className,\n )}\n {...inputProps}>\n {() => (\n <div className=\"flex items-center justify-between\">\n {Icon && <Icon size={16} className=\"mr-sw-md text-sw-gray-100\" />}\n <input\n value={value}\n ref={inputRef}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onChange={onInputChange}\n disabled={inputDisabled}\n placeholder={inputProps.placeholder}\n autoComplete=\"off\"\n className={cn('text-sw-label-m mr-auto w-full outline-none', {\n 'cursor-not-allowed': state === 'disabled',\n })}\n />\n {!inputDisabled && (\n <div className=\"gap-sw-md relative flex items-center\">\n {children}\n {value ? (\n <button\n type=\"button\"\n className={cn(\n 'cursor-default text-sw-gray-100 opacity-0 transition-opacity duration-150 ease-in-out hover:text-sw-gray-50',\n {\n 'cursor-pointer opacity-100': !!value,\n },\n )}\n onClick={handleClear}>\n <Icons.X className=\"h-sw-xl w-sw-xl\" />\n </button>\n ) : null}\n </div>\n )}\n </div>\n )}\n </UIInput>\n );\n};\n"],"names":["Input","state","defaultValue","focusOnMount","className","onChange","children","Icon","inputProps","inputRef","useRef","isFocused","setIsFocused","useState","value","setValue","handleFocus","handleBlur","handleClear","onInputChange","e","useEffect","inputDisabled","jsx","UIInput","Fragment","cn","jsxs","Icons"],"mappings":";;;;;AAk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