@aurora-is-near/intents-swap-widget 2.0.0 → 2.1.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/features/SubmitButton/index.d.ts +4 -1
- package/dist/features/SubmitButton/index.js +39 -32
- package/dist/features/SubmitButton/index.js.map +1 -1
- package/dist/hooks/useTokenModal.d.ts +1 -1
- package/dist/hooks/useTokenModal.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -13
- package/dist/index.js.map +1 -1
- package/dist/types/localisation.d.ts +1 -1
- package/dist/{presets/widgets → widgets}/WidgetDeposit.d.ts +1 -1
- package/dist/{presets/widgets → widgets}/WidgetDeposit.js +74 -69
- package/dist/widgets/WidgetDeposit.js.map +1 -0
- package/dist/{presets/widgets/shared → widgets}/WidgetSkeleton.js +1 -1
- package/dist/widgets/WidgetSkeleton.js.map +1 -0
- package/dist/{presets/widgets → widgets}/WidgetSwap.d.ts +1 -1
- package/dist/{presets/widgets → widgets}/WidgetSwap.js +74 -69
- package/dist/widgets/WidgetSwap.js.map +1 -0
- package/dist/{presets/widgets → widgets}/WidgetWithdraw.d.ts +1 -1
- package/dist/{presets/widgets → widgets}/WidgetWithdraw.js +82 -71
- package/dist/widgets/WidgetWithdraw.js.map +1 -0
- package/dist/widgets/index.d.ts +4 -0
- package/dist/widgets/index.js +11 -0
- package/dist/{presets/widgets/shared → widgets}/index.js.map +1 -1
- package/package.json +1 -1
- package/src/features/SubmitButton/index.tsx +14 -4
- package/src/hooks/useTokenModal.ts +1 -1
- package/src/index.ts +1 -1
- package/src/types/localisation.ts +12 -4
- package/src/{presets/widgets → widgets}/WidgetDeposit.tsx +10 -2
- package/src/{presets/widgets → widgets}/WidgetSwap.tsx +10 -3
- package/src/{presets/widgets → widgets}/WidgetWithdraw.tsx +16 -3
- package/src/widgets/index.ts +4 -0
- package/dist/presets/index.d.ts +0 -3
- package/dist/presets/index.js +0 -9
- package/dist/presets/index.js.map +0 -1
- package/dist/presets/widgets/WidgetDeposit.js.map +0 -1
- package/dist/presets/widgets/WidgetSwap.js.map +0 -1
- package/dist/presets/widgets/WidgetWithdraw.js.map +0 -1
- package/dist/presets/widgets/shared/WidgetSkeleton.js.map +0 -1
- package/dist/presets/widgets/shared/index.d.ts +0 -1
- package/dist/presets/widgets/shared/index.js +0 -5
- package/src/presets/index.ts +0 -3
- package/src/presets/widgets/shared/index.ts +0 -1
- /package/dist/{presets/widgets/shared → widgets}/WidgetSkeleton.d.ts +0 -0
- /package/dist/{presets/widgets → widgets}/types.d.ts +0 -0
- /package/dist/{presets/widgets → widgets}/types.js +0 -0
- /package/dist/{presets/widgets → widgets}/types.js.map +0 -0
- /package/src/{presets/widgets/shared → widgets}/WidgetSkeleton.tsx +0 -0
- /package/src/{presets/widgets → widgets}/types.ts +0 -0
|
@@ -7,8 +7,11 @@ type Msg = {
|
|
|
7
7
|
};
|
|
8
8
|
type Props = QuoteTransferArgs & IntentsTransferArgs & {
|
|
9
9
|
onMsg: (msg: Msg) => void;
|
|
10
|
+
externalSwapLabel: string;
|
|
11
|
+
internalSwapLabel: string;
|
|
12
|
+
transferLabel: string;
|
|
10
13
|
};
|
|
11
|
-
export declare const SubmitButton: (({ providers, makeTransfer, onMsg }: Props) => import("react/jsx-runtime").JSX.Element) & {
|
|
14
|
+
export declare const SubmitButton: (({ providers, makeTransfer, onMsg, internalSwapLabel, externalSwapLabel, transferLabel, }: Props) => import("react/jsx-runtime").JSX.Element) & {
|
|
12
15
|
Error: () => import("react/jsx-runtime").JSX.Element | undefined;
|
|
13
16
|
};
|
|
14
17
|
export {};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { Trans as
|
|
1
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { Trans as w } from "react-i18next";
|
|
3
3
|
import { Button as t } from "../../components/Button.js";
|
|
4
|
-
import { TinyNumber as
|
|
4
|
+
import { TinyNumber as O } from "../../components/TinyNumber.js";
|
|
5
5
|
import { ErrorMessage as l } from "../../components/ErrorMessage.js";
|
|
6
|
-
import { g, e as
|
|
6
|
+
import { g, e as R } from "../../config-CsHJaepw.js";
|
|
7
7
|
import { useTypedTranslation as h } from "../../localisation.js";
|
|
8
|
-
import { useMakeTransfer as
|
|
9
|
-
import { isNotEmptyAmount as
|
|
10
|
-
import { NATIVE_NEAR_DUMB_ASSET_ID as
|
|
8
|
+
import { useMakeTransfer as y } from "../../hooks/useMakeTransfer.js";
|
|
9
|
+
import { isNotEmptyAmount as D } from "../../utils/checkers/isNotEmptyAmount.js";
|
|
10
|
+
import { NATIVE_NEAR_DUMB_ASSET_ID as F, WNEAR_ASSET_ID as B } from "../../constants/tokens.js";
|
|
11
11
|
const n = {
|
|
12
12
|
size: "lg",
|
|
13
13
|
variant: "primary"
|
|
14
14
|
}, N = (r) => {
|
|
15
|
-
const { t:
|
|
15
|
+
const { t: o } = h();
|
|
16
16
|
if (r.error?.code === "SOURCE_BALANCE_INSUFFICIENT")
|
|
17
|
-
return /* @__PURE__ */ e(t, { state: "error", ...n, children:
|
|
17
|
+
return /* @__PURE__ */ e(t, { state: "error", ...n, children: o("submit.error.insufficientBalance", "Insufficient balance") });
|
|
18
18
|
if (r.error?.code === "TOKEN_IS_NOT_SUPPORTED")
|
|
19
|
-
return /* @__PURE__ */ e(t, { state: "error", ...n, children:
|
|
19
|
+
return /* @__PURE__ */ e(t, { state: "error", ...n, children: o("submit.error.invalidAddress", "Invalid address") });
|
|
20
20
|
if (r.error?.code === "QUOTE_AMOUNT_IS_TOO_LOW")
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */ e(t, { state: "error", ...n, children:
|
|
23
|
-
/* @__PURE__ */ e(l, { children: /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ a("div", { className: "gap-sw-md flex flex-col", children: [
|
|
22
|
+
/* @__PURE__ */ e(t, { state: "error", ...n, children: o("submit.error.amountTooLow.label", "Amount is too low") }),
|
|
23
|
+
/* @__PURE__ */ e(l, { children: /* @__PURE__ */ a(w, { i18nKey: "submit.error.amountTooLow.message", children: [
|
|
24
24
|
"Amount you entered is very low. Please try increasing it",
|
|
25
25
|
" ",
|
|
26
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ a("span", { className: "text-nowrap", children: [
|
|
27
27
|
"above ",
|
|
28
|
-
/* @__PURE__ */ e(
|
|
28
|
+
/* @__PURE__ */ e(O, { value: r.error.meta.minAmount ?? "0" }),
|
|
29
29
|
" ",
|
|
30
30
|
r.sourceToken?.symbol ?? "",
|
|
31
31
|
"."
|
|
@@ -33,40 +33,47 @@ const n = {
|
|
|
33
33
|
] }) })
|
|
34
34
|
] });
|
|
35
35
|
if (r.quoteStatus === "error")
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */ e(t, { state: "error", ...n, children:
|
|
38
|
-
/* @__PURE__ */ e(l, { children:
|
|
36
|
+
return /* @__PURE__ */ a("div", { className: "gap-sw-md flex flex-col", children: [
|
|
37
|
+
/* @__PURE__ */ e(t, { state: "error", ...n, children: o("submit.error.quoteFailed.label", "Quote failed") }),
|
|
38
|
+
/* @__PURE__ */ e(l, { children: o(
|
|
39
39
|
"submit.error.quoteFailed.message",
|
|
40
40
|
"We couldn’t finalize your quote. Please try again or adjust your values."
|
|
41
41
|
) })
|
|
42
42
|
] });
|
|
43
43
|
if (r.error?.code === "TRANSFER_INVALID_INITIAL")
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */ e(t, { state: "error", ...n, children:
|
|
44
|
+
return /* @__PURE__ */ a("div", { className: "gap-sw-md flex flex-col", children: [
|
|
45
|
+
/* @__PURE__ */ e(t, { state: "error", ...n, children: o("submit.error.invalidTransferData.label", "Invalid transfer data") }),
|
|
46
46
|
r.error.meta?.message ? /* @__PURE__ */ e(l, { children: r.error.meta.message }) : null
|
|
47
47
|
] });
|
|
48
48
|
if (r.error?.code === "DIRECT_TRANSFER_ERROR")
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */ e(t, { state: "error", ...n, children:
|
|
49
|
+
return /* @__PURE__ */ a("div", { className: "gap-sw-md flex flex-col", children: [
|
|
50
|
+
/* @__PURE__ */ e(t, { state: "error", ...n, children: o("submit.error.transferFailed.label", "Transfer failed") }),
|
|
51
51
|
r.error.meta?.message ? /* @__PURE__ */ e(l, { children: r.error.meta.message }) : null
|
|
52
52
|
] });
|
|
53
|
-
},
|
|
53
|
+
}, k = () => {
|
|
54
54
|
const { ctx: r } = g();
|
|
55
55
|
return N(r);
|
|
56
|
-
},
|
|
56
|
+
}, C = ({
|
|
57
|
+
providers: r,
|
|
58
|
+
makeTransfer: o,
|
|
59
|
+
onMsg: I,
|
|
60
|
+
internalSwapLabel: E,
|
|
61
|
+
externalSwapLabel: S,
|
|
62
|
+
transferLabel: _
|
|
63
|
+
}) => {
|
|
57
64
|
const { ctx: s } = g(), { t: i } = h(), {
|
|
58
65
|
isDirectTransfer: d,
|
|
59
66
|
isDirectNonNearWithdrawal: m,
|
|
60
67
|
isNearToIntentsSameAssetTransfer: c,
|
|
61
68
|
isDirectNearDeposit: f
|
|
62
|
-
} =
|
|
63
|
-
const b = await
|
|
69
|
+
} = R(), { make: A } = y({ providers: r, makeTransfer: o }), T = N(s), p = s.sourceToken?.assetId === F && s.targetToken?.assetId === B, u = () => d || m || c || f || p ? _ : s.sourceToken?.isIntent && s.targetToken?.isIntent ? E : S, v = async () => {
|
|
70
|
+
const b = await A();
|
|
64
71
|
b && I({
|
|
65
72
|
type: "on_successful_transfer",
|
|
66
73
|
transfer: b
|
|
67
74
|
});
|
|
68
75
|
};
|
|
69
|
-
if (!
|
|
76
|
+
if (!D(s.sourceTokenAmount))
|
|
70
77
|
return /* @__PURE__ */ e(t, { ...n, state: "disabled", children: "Enter amount" });
|
|
71
78
|
if (T)
|
|
72
79
|
return T;
|
|
@@ -78,7 +85,7 @@ const n = {
|
|
|
78
85
|
default:
|
|
79
86
|
return /* @__PURE__ */ e(t, { state: "loading", ...n, children: i("submit.pending.transfer.finalizing", "Finalizing transfer") });
|
|
80
87
|
}
|
|
81
|
-
return s.transferStatus.status === "error" ? /* @__PURE__ */
|
|
88
|
+
return s.transferStatus.status === "error" ? /* @__PURE__ */ a("div", { className: "gap-sw-md flex flex-col", children: [
|
|
82
89
|
/* @__PURE__ */ e(t, { ...n, children: u() }),
|
|
83
90
|
/* @__PURE__ */ e(l, { children: (() => {
|
|
84
91
|
switch (s.error?.code) {
|
|
@@ -94,11 +101,11 @@ const n = {
|
|
|
94
101
|
);
|
|
95
102
|
}
|
|
96
103
|
})() })
|
|
97
|
-
] }) : s.quoteStatus === "pending" ? /* @__PURE__ */ e(t, { state: "loading", ...n, children: i("submit.pending.quote.finalizing", "Finalizing quote") }) : s.error ? /* @__PURE__ */ e(t, { state: "disabled", ...n, children: u() }) : !s.quote && !d && !m && !c && !f && !p ? /* @__PURE__ */ e(t, { state: "disabled", ...n, children: u() }) : /* @__PURE__ */ e(t, { ...n, onClick:
|
|
98
|
-
},
|
|
99
|
-
Error:
|
|
104
|
+
] }) : s.quoteStatus === "pending" ? /* @__PURE__ */ e(t, { state: "loading", ...n, children: i("submit.pending.quote.finalizing", "Finalizing quote") }) : s.error ? /* @__PURE__ */ e(t, { state: "disabled", ...n, children: u() }) : !s.quote && !d && !m && !c && !f && !p ? /* @__PURE__ */ e(t, { state: "disabled", ...n, children: u() }) : /* @__PURE__ */ e(t, { ...n, onClick: v, children: u() });
|
|
105
|
+
}, K = Object.assign(C, {
|
|
106
|
+
Error: k
|
|
100
107
|
});
|
|
101
108
|
export {
|
|
102
|
-
|
|
109
|
+
K as SubmitButton
|
|
103
110
|
};
|
|
104
111
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/features/SubmitButton/index.tsx"],"sourcesContent":["import { Trans } from 'react-i18next';\nimport { Button } from '@/components/Button';\nimport { TinyNumber } from '@/components/TinyNumber';\nimport { ErrorMessage } from '@/components/ErrorMessage';\nimport { useComputedSnapshot, useUnsafeSnapshot } from '@/machine/snap';\nimport type { TransferResult } from '@/types/transfer';\nimport type { Context } from '@/machine/context';\n\nimport { useTypedTranslation } from '@/localisation';\nimport { useMakeTransfer } from '@/hooks/useMakeTransfer';\nimport { isNotEmptyAmount } from '@/utils/checkers/isNotEmptyAmount';\nimport { NATIVE_NEAR_DUMB_ASSET_ID, WNEAR_ASSET_ID } from '@/constants/tokens';\nimport type { QuoteTransferArgs } from '@/hooks/useMakeQuoteTransfer';\nimport type { IntentsTransferArgs } from '@/hooks/useMakeIntentsTransfer';\n\ntype Msg = { type: 'on_successful_transfer'; transfer: TransferResult };\n\ntype Props = QuoteTransferArgs &\n IntentsTransferArgs & {\n onMsg: (msg: Msg) => void;\n };\n\nconst commonBtnProps = {\n size: 'lg' as const,\n variant: 'primary' as const,\n};\n\nconst useGetErrorButton = (ctx: Context) => {\n const { t } = useTypedTranslation();\n\n if (ctx.error?.code === 'SOURCE_BALANCE_INSUFFICIENT') {\n return (\n <Button state=\"error\" {...commonBtnProps}>\n {t('submit.error.insufficientBalance', 'Insufficient balance')}\n </Button>\n );\n }\n\n if (ctx.error?.code === 'TOKEN_IS_NOT_SUPPORTED') {\n return (\n <Button state=\"error\" {...commonBtnProps}>\n {t('submit.error.invalidAddress', 'Invalid address')}\n </Button>\n );\n }\n\n if (ctx.error?.code === 'QUOTE_AMOUNT_IS_TOO_LOW') {\n return (\n <div className=\"gap-sw-md flex flex-col\">\n <Button state=\"error\" {...commonBtnProps}>\n {t('submit.error.amountTooLow.label', 'Amount is too low')}\n </Button>\n <ErrorMessage>\n <Trans i18nKey=\"submit.error.amountTooLow.message\">\n Amount you entered is very low. Please try increasing it{' '}\n <span className=\"text-nowrap\">\n above <TinyNumber value={ctx.error.meta.minAmount ?? '0'} />{' '}\n {ctx.sourceToken?.symbol ?? ''}.\n </span>\n </Trans>\n </ErrorMessage>\n </div>\n );\n }\n\n // other quote errors\n if (ctx.quoteStatus === 'error') {\n return (\n <div className=\"gap-sw-md flex flex-col\">\n <Button state=\"error\" {...commonBtnProps}>\n {t('submit.error.quoteFailed.label', 'Quote failed')}\n </Button>\n <ErrorMessage>\n {t(\n 'submit.error.quoteFailed.message',\n 'We couldn’t finalize your quote. Please try again or adjust your values.',\n )}\n </ErrorMessage>\n </div>\n );\n }\n\n // transfer errors\n if (ctx.error?.code === 'TRANSFER_INVALID_INITIAL') {\n return (\n <div className=\"gap-sw-md flex flex-col\">\n <Button state=\"error\" {...commonBtnProps}>\n {t('submit.error.invalidTransferData.label', 'Invalid transfer data')}\n </Button>\n {ctx.error.meta?.message ? (\n <ErrorMessage>{ctx.error.meta.message}</ErrorMessage>\n ) : null}\n </div>\n );\n }\n\n if (ctx.error?.code === 'DIRECT_TRANSFER_ERROR') {\n return (\n <div className=\"gap-sw-md flex flex-col\">\n <Button state=\"error\" {...commonBtnProps}>\n {t('submit.error.transferFailed.label', 'Transfer failed')}\n </Button>\n {ctx.error.meta?.message ? (\n <ErrorMessage>{ctx.error.meta.message}</ErrorMessage>\n ) : null}\n </div>\n );\n }\n};\n\nconst SubmitButtonError = () => {\n const { ctx } = useUnsafeSnapshot();\n\n return useGetErrorButton(ctx);\n};\n\nconst SubmitButtonBase = ({ providers, makeTransfer, onMsg }: Props) => {\n const { ctx } = useUnsafeSnapshot();\n const { t } = useTypedTranslation();\n const {\n isDirectTransfer,\n isDirectNonNearWithdrawal,\n isNearToIntentsSameAssetTransfer,\n isDirectNearDeposit,\n } = useComputedSnapshot();\n\n const { make } = useMakeTransfer({ providers, makeTransfer });\n\n const SubmitErrorButton = useGetErrorButton(ctx);\n\n const nativeNearDeposit =\n ctx.sourceToken?.assetId === NATIVE_NEAR_DUMB_ASSET_ID &&\n ctx.targetToken?.assetId === WNEAR_ASSET_ID;\n\n const getMainLabel = () => {\n if (\n isDirectTransfer ||\n isDirectNonNearWithdrawal ||\n isNearToIntentsSameAssetTransfer ||\n isDirectNearDeposit ||\n nativeNearDeposit\n ) {\n return t('submit.active.transfer', 'Transfer');\n }\n\n return ctx.sourceToken?.isIntent && ctx.targetToken?.isIntent\n ? t('submit.active.internal', 'Swap')\n : t('submit.active.external', 'Swap & send');\n };\n\n const onClick = async () => {\n const transferResult = await make();\n\n if (transferResult) {\n onMsg({\n type: 'on_successful_transfer',\n transfer: transferResult,\n });\n }\n };\n\n if (!isNotEmptyAmount(ctx.sourceTokenAmount)) {\n return (\n <Button {...commonBtnProps} state=\"disabled\">\n Enter amount\n </Button>\n );\n }\n\n if (SubmitErrorButton) {\n return SubmitErrorButton;\n }\n\n if (ctx.transferStatus.status === 'pending') {\n switch (ctx.transferStatus.reason) {\n case 'WAITING_CONFIRMATION':\n return (\n <Button state=\"loading\" {...commonBtnProps}>\n {t('submit.pending.transfer.confirmInWallet', 'Confirm in wallet')}\n </Button>\n );\n case 'PROCESSING':\n default:\n return (\n <Button state=\"loading\" {...commonBtnProps}>\n {t('submit.pending.transfer.finalizing', 'Finalizing transfer')}\n </Button>\n );\n }\n }\n\n if (ctx.transferStatus.status === 'error') {\n return (\n <div className=\"gap-sw-md flex flex-col\">\n <Button {...commonBtnProps}>{getMainLabel()}</Button>\n <ErrorMessage>\n {(() => {\n switch (ctx.error?.code) {\n case 'FEES_NOT_ESTIMATED':\n return t(\n 'submit.error.transfer.noFees',\n 'Transfer fees could not be estimated.',\n );\n default:\n return t(\n 'submit.error.transfer.failed',\n 'Transfer can not be completed.',\n );\n }\n })()}\n </ErrorMessage>\n </div>\n );\n }\n\n if (ctx.quoteStatus === 'pending') {\n return (\n <Button state=\"loading\" {...commonBtnProps}>\n {t('submit.pending.quote.finalizing', 'Finalizing quote')}\n </Button>\n );\n }\n\n if (ctx.error) {\n return (\n <Button state=\"disabled\" {...commonBtnProps}>\n {getMainLabel()}\n </Button>\n );\n }\n\n if (\n !ctx.quote &&\n !isDirectTransfer &&\n !isDirectNonNearWithdrawal &&\n !isNearToIntentsSameAssetTransfer &&\n !isDirectNearDeposit &&\n !nativeNearDeposit\n ) {\n return (\n <Button state=\"disabled\" {...commonBtnProps}>\n {getMainLabel()}\n </Button>\n );\n }\n\n return (\n <Button {...commonBtnProps} onClick={onClick}>\n {getMainLabel()}\n </Button>\n );\n};\n\nexport const SubmitButton = Object.assign(SubmitButtonBase, {\n Error: SubmitButtonError,\n});\n"],"names":["commonBtnProps","useGetErrorButton","ctx","t","useTypedTranslation","jsx","Button","jsxs","ErrorMessage","Trans","TinyNumber","SubmitButtonError","useUnsafeSnapshot","SubmitButtonBase","providers","makeTransfer","onMsg","isDirectTransfer","isDirectNonNearWithdrawal","isNearToIntentsSameAssetTransfer","isDirectNearDeposit","useComputedSnapshot","make","useMakeTransfer","SubmitErrorButton","nativeNearDeposit","NATIVE_NEAR_DUMB_ASSET_ID","WNEAR_ASSET_ID","getMainLabel","onClick","transferResult","isNotEmptyAmount","SubmitButton"],"mappings":";;;;;;;;;;AAsBA,MAAMA,IAAiB;AAAA,EACrB,MAAM;AAAA,EACN,SAAS;AACX,GAEMC,IAAoB,CAACC,MAAiB;AAC1C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA;AAEd,MAAIF,EAAI,OAAO,SAAS;AACtB,WACE,gBAAAG,EAACC,KAAO,OAAM,SAAS,GAAGN,GACvB,UAAAG,EAAE,oCAAoC,sBAAsB,EAAA,CAC/D;AAIJ,MAAID,EAAI,OAAO,SAAS;AACtB,WACE,gBAAAG,EAACC,KAAO,OAAM,SAAS,GAAGN,GACvB,UAAAG,EAAE,+BAA+B,iBAAiB,EAAA,CACrD;AAIJ,MAAID,EAAI,OAAO,SAAS;AACtB,WACE,gBAAAK,EAAC,OAAA,EAAI,WAAU,2BACb,UAAA;AAAA,MAAA,gBAAAF,EAACC,GAAA,EAAO,OAAM,SAAS,GAAGN,GACvB,UAAAG,EAAE,mCAAmC,mBAAmB,EAAA,CAC3D;AAAA,MACA,gBAAAE,E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ACE,gBAAAE,EAACC,KAAO,OAAM,WAAW,GAAGN,GACzB,UAAAG,EAAE,sCAAsC,qBAAqB,EAAA,CAChE;AAAA,IAAA;AAKR,SAAID,EAAI,eAAe,WAAW,UAE9B,gBAAAK,EAAC,OAAA,EAAI,WAAU,2BACb,UAAA;AAAA,IAAA,gBAAAF,EAACC,GAAA,EAAQ,GAAGN,GAAiB,UAAA4B,EAAA,GAAe;AAAA,IAC5C,gBAAAvB,EAACG,KACG,WAAA,MAAM;AACN,cAAQN,EAAI,OAAO,MAAA;AAAA,QACjB,KAAK;AACH,iBAAOC;AAAA,YACL;AAAA,YACA;AAAA,UAAA;AAAA,QAEJ;AACE,iBAAOA;AAAA,YACL;AAAA,YACA;AAAA,UAAA;AAAA,MACF;AAAA,IAEN,KAAG,CACL;AAAA,EAAA,GACF,IAIAD,EAAI,gBAAgB,YAEpB,gBAAAG,EAACC,KAAO,OAAM,WAAW,GAAGN,GACzB,UAAAG,EAAE,mCAAmC,kBAAkB,EAAA,CAC1D,IAIAD,EAAI,0BAEHI,GAAA,EAAO,OAAM,YAAY,GAAGN,GAC1B,eACH,IAKF,CAACE,EAAI,SACL,CAACe,KACD,CAACC,KACD,CAACC,KACD,CAACC,KACD,CAACK,sBAGEnB,GAAA,EAAO,OAAM,YAAY,GAAGN,GAC1B,eACH,sBAKDM,GAAA,EAAQ,GAAGN,GAAgB,SAAA6B,GACzB,eACH;AAEJ,GAEaG,IAAe,OAAO,OAAOnB,GAAkB;AAAA,EAC1D,OAAOF;AACT,CAAC;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/features/SubmitButton/index.tsx"],"sourcesContent":["import { Trans } from 'react-i18next';\nimport { Button } from '@/components/Button';\nimport { TinyNumber } from '@/components/TinyNumber';\nimport { ErrorMessage } from '@/components/ErrorMessage';\nimport { useComputedSnapshot, useUnsafeSnapshot } from '@/machine/snap';\nimport type { TransferResult } from '@/types/transfer';\nimport type { Context } from '@/machine/context';\n\nimport { useTypedTranslation } from '@/localisation';\nimport { useMakeTransfer } from '@/hooks/useMakeTransfer';\nimport { isNotEmptyAmount } from '@/utils/checkers/isNotEmptyAmount';\nimport { NATIVE_NEAR_DUMB_ASSET_ID, WNEAR_ASSET_ID } from '@/constants/tokens';\nimport type { QuoteTransferArgs } from '@/hooks/useMakeQuoteTransfer';\nimport type { IntentsTransferArgs } from '@/hooks/useMakeIntentsTransfer';\n\ntype Msg = { type: 'on_successful_transfer'; transfer: TransferResult };\n\ntype Props = QuoteTransferArgs &\n IntentsTransferArgs & {\n onMsg: (msg: Msg) => void;\n externalSwapLabel: string;\n internalSwapLabel: string;\n transferLabel: string;\n };\n\nconst commonBtnProps = {\n size: 'lg' as const,\n variant: 'primary' as const,\n};\n\nconst useGetErrorButton = (ctx: Context) => {\n const { t } = useTypedTranslation();\n\n if (ctx.error?.code === 'SOURCE_BALANCE_INSUFFICIENT') {\n return (\n <Button state=\"error\" {...commonBtnProps}>\n {t('submit.error.insufficientBalance', 'Insufficient balance')}\n </Button>\n );\n }\n\n if (ctx.error?.code === 'TOKEN_IS_NOT_SUPPORTED') {\n return (\n <Button state=\"error\" {...commonBtnProps}>\n {t('submit.error.invalidAddress', 'Invalid address')}\n </Button>\n );\n }\n\n if (ctx.error?.code === 'QUOTE_AMOUNT_IS_TOO_LOW') {\n return (\n <div className=\"gap-sw-md flex flex-col\">\n <Button state=\"error\" {...commonBtnProps}>\n {t('submit.error.amountTooLow.label', 'Amount is too low')}\n </Button>\n <ErrorMessage>\n <Trans i18nKey=\"submit.error.amountTooLow.message\">\n Amount you entered is very low. Please try increasing it{' '}\n <span className=\"text-nowrap\">\n above <TinyNumber value={ctx.error.meta.minAmount ?? '0'} />{' '}\n {ctx.sourceToken?.symbol ?? ''}.\n </span>\n </Trans>\n </ErrorMessage>\n </div>\n );\n }\n\n // other quote errors\n if (ctx.quoteStatus === 'error') {\n return (\n <div className=\"gap-sw-md flex flex-col\">\n <Button state=\"error\" {...commonBtnProps}>\n {t('submit.error.quoteFailed.label', 'Quote failed')}\n </Button>\n <ErrorMessage>\n {t(\n 'submit.error.quoteFailed.message',\n 'We couldn’t finalize your quote. Please try again or adjust your values.',\n )}\n </ErrorMessage>\n </div>\n );\n }\n\n // transfer errors\n if (ctx.error?.code === 'TRANSFER_INVALID_INITIAL') {\n return (\n <div className=\"gap-sw-md flex flex-col\">\n <Button state=\"error\" {...commonBtnProps}>\n {t('submit.error.invalidTransferData.label', 'Invalid transfer data')}\n </Button>\n {ctx.error.meta?.message ? (\n <ErrorMessage>{ctx.error.meta.message}</ErrorMessage>\n ) : null}\n </div>\n );\n }\n\n if (ctx.error?.code === 'DIRECT_TRANSFER_ERROR') {\n return (\n <div className=\"gap-sw-md flex flex-col\">\n <Button state=\"error\" {...commonBtnProps}>\n {t('submit.error.transferFailed.label', 'Transfer failed')}\n </Button>\n {ctx.error.meta?.message ? (\n <ErrorMessage>{ctx.error.meta.message}</ErrorMessage>\n ) : null}\n </div>\n );\n }\n};\n\nconst SubmitButtonError = () => {\n const { ctx } = useUnsafeSnapshot();\n\n return useGetErrorButton(ctx);\n};\n\nconst SubmitButtonBase = ({\n providers,\n makeTransfer,\n onMsg,\n internalSwapLabel,\n externalSwapLabel,\n transferLabel,\n}: Props) => {\n const { ctx } = useUnsafeSnapshot();\n const { t } = useTypedTranslation();\n const {\n isDirectTransfer,\n isDirectNonNearWithdrawal,\n isNearToIntentsSameAssetTransfer,\n isDirectNearDeposit,\n } = useComputedSnapshot();\n\n const { make } = useMakeTransfer({ providers, makeTransfer });\n\n const SubmitErrorButton = useGetErrorButton(ctx);\n\n const nativeNearDeposit =\n ctx.sourceToken?.assetId === NATIVE_NEAR_DUMB_ASSET_ID &&\n ctx.targetToken?.assetId === WNEAR_ASSET_ID;\n\n const getMainLabel = () => {\n if (\n isDirectTransfer ||\n isDirectNonNearWithdrawal ||\n isNearToIntentsSameAssetTransfer ||\n isDirectNearDeposit ||\n nativeNearDeposit\n ) {\n return transferLabel;\n }\n\n return ctx.sourceToken?.isIntent && ctx.targetToken?.isIntent\n ? internalSwapLabel\n : externalSwapLabel;\n };\n\n const onClick = async () => {\n const transferResult = await make();\n\n if (transferResult) {\n onMsg({\n type: 'on_successful_transfer',\n transfer: transferResult,\n });\n }\n };\n\n if (!isNotEmptyAmount(ctx.sourceTokenAmount)) {\n return (\n <Button {...commonBtnProps} state=\"disabled\">\n Enter amount\n </Button>\n );\n }\n\n if (SubmitErrorButton) {\n return SubmitErrorButton;\n }\n\n if (ctx.transferStatus.status === 'pending') {\n switch (ctx.transferStatus.reason) {\n case 'WAITING_CONFIRMATION':\n return (\n <Button state=\"loading\" {...commonBtnProps}>\n {t('submit.pending.transfer.confirmInWallet', 'Confirm in wallet')}\n </Button>\n );\n case 'PROCESSING':\n default:\n return (\n <Button state=\"loading\" {...commonBtnProps}>\n {t('submit.pending.transfer.finalizing', 'Finalizing transfer')}\n </Button>\n );\n }\n }\n\n if (ctx.transferStatus.status === 'error') {\n return (\n <div className=\"gap-sw-md flex flex-col\">\n <Button {...commonBtnProps}>{getMainLabel()}</Button>\n <ErrorMessage>\n {(() => {\n switch (ctx.error?.code) {\n case 'FEES_NOT_ESTIMATED':\n return t(\n 'submit.error.transfer.noFees',\n 'Transfer fees could not be estimated.',\n );\n default:\n return t(\n 'submit.error.transfer.failed',\n 'Transfer can not be completed.',\n );\n }\n })()}\n </ErrorMessage>\n </div>\n );\n }\n\n if (ctx.quoteStatus === 'pending') {\n return (\n <Button state=\"loading\" {...commonBtnProps}>\n {t('submit.pending.quote.finalizing', 'Finalizing quote')}\n </Button>\n );\n }\n\n if (ctx.error) {\n return (\n <Button state=\"disabled\" {...commonBtnProps}>\n {getMainLabel()}\n </Button>\n );\n }\n\n if (\n !ctx.quote &&\n !isDirectTransfer &&\n !isDirectNonNearWithdrawal &&\n !isNearToIntentsSameAssetTransfer &&\n !isDirectNearDeposit &&\n !nativeNearDeposit\n ) {\n return (\n <Button state=\"disabled\" {...commonBtnProps}>\n {getMainLabel()}\n </Button>\n );\n }\n\n return (\n <Button {...commonBtnProps} onClick={onClick}>\n {getMainLabel()}\n </Button>\n );\n};\n\nexport const SubmitButton = Object.assign(SubmitButtonBase, {\n Error: SubmitButtonError,\n});\n"],"names":["commonBtnProps","useGetErrorButton","ctx","t","useTypedTranslation","jsx","Button","jsxs","ErrorMessage","Trans","TinyNumber","SubmitButtonError","useUnsafeSnapshot","SubmitButtonBase","providers","makeTransfer","onMsg","internalSwapLabel","externalSwapLabel","transferLabel","isDirectTransfer","isDirectNonNearWithdrawal","isNearToIntentsSameAssetTransfer","isDirectNearDeposit","useComputedSnapshot","make","useMakeTransfer","SubmitErrorButton","nativeNearDeposit","NATIVE_NEAR_DUMB_ASSET_ID","WNEAR_ASSET_ID","getMainLabel","onClick","transferResult","isNotEmptyAmount","SubmitButton"],"mappings":";;;;;;;;;;AAyBA,MAAMA,IAAiB;AAAA,EACrB,MAAM;AAAA,EACN,SAAS;AACX,GAEMC,IAAoB,CAACC,MAAiB;AAC1C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA;AAEd,MAAIF,EAAI,OAAO,SAAS;AACtB,WACE,gBAAAG,EAACC,KAAO,OAAM,SAAS,GAAGN,GACvB,UAAAG,EAAE,oCAAoC,sBAAsB,EAAA,CAC/D;AAIJ,MAAID,EAAI,OAAO,SAAS;AACtB,WACE,gBAAAG,EAACC,KAAO,OAAM,SAAS,GAAGN,GACvB,UAAAG,EAAE,+BAA+B,iBAAiB,EAAA,CACrD;AAIJ,MAAID,EAAI,OAAO,SAAS;AACtB,WACE,gBAAAK,EAAC,OAAA,EAAI,WAAU,2BACb,UAAA;AAAA,MAAA,gBAAAF,EAACC,GAAA,EAAO,OAAM,SAAS,GAAGN,GACvB,UAAAG,EAAE,mCAAmC,mBAAmB,EAAA,CAC3D;AAAA,MACA,gBAAAE,EAACG,GAAA,EACC,UAAA,gBAAAD,EAACE,GAAA,EAAM,SAAQ,qCAAoC,UAAA;AAAA,QAAA;AAAA,QACQ;AAAA,QACzD,gB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AAAA,IAAA;AAKR,SAAID,EAAI,eAAe,WAAW,UAE9B,gBAAAK,EAAC,OAAA,EAAI,WAAU,2BACb,UAAA;AAAA,IAAA,gBAAAF,EAACC,GAAA,EAAQ,GAAGN,GAAiB,UAAA+B,EAAA,GAAe;AAAA,IAC5C,gBAAA1B,EAACG,KACG,WAAA,MAAM;AACN,cAAQN,EAAI,OAAO,MAAA;AAAA,QACjB,KAAK;AACH,iBAAOC;AAAA,YACL;AAAA,YACA;AAAA,UAAA;AAAA,QAEJ;AACE,iBAAOA;AAAA,YACL;AAAA,YACA;AAAA,UAAA;AAAA,MACF;AAAA,IAEN,KAAG,CACL;AAAA,EAAA,GACF,IAIAD,EAAI,gBAAgB,YAEpB,gBAAAG,EAACC,KAAO,OAAM,WAAW,GAAGN,GACzB,UAAAG,EAAE,mCAAmC,kBAAkB,EAAA,CAC1D,IAIAD,EAAI,0BAEHI,GAAA,EAAO,OAAM,YAAY,GAAGN,GAC1B,eACH,IAKF,CAACE,EAAI,SACL,CAACkB,KACD,CAACC,KACD,CAACC,KACD,CAACC,KACD,CAACK,sBAGEtB,GAAA,EAAO,OAAM,YAAY,GAAGN,GAC1B,eACH,sBAKDM,GAAA,EAAQ,GAAGN,GAAgB,SAAAgC,GACzB,eACH;AAEJ,GAEaG,IAAe,OAAO,OAAOtB,GAAkB;AAAA,EAC1D,OAAOF;AACT,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTokenModal.js","sources":["../../src/hooks/useTokenModal.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport { TokenModalState } from '../
|
|
1
|
+
{"version":3,"file":"useTokenModal.js","sources":["../../src/hooks/useTokenModal.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport { TokenModalState } from '../widgets/types';\n\nexport const useTokenModal = ({\n onMsg,\n}: {\n onMsg?: (msg: { type: 'on_tokens_modal_toggled'; isOpen: boolean }) => void;\n}) => {\n const [tokenModalOpen, setTokenModalOpen] = useState<TokenModalState>('none');\n\n const updateTokenModalState = useCallback(\n (state: TokenModalState) => {\n setTokenModalOpen(state);\n onMsg?.({\n type: 'on_tokens_modal_toggled',\n isOpen: state !== 'none',\n });\n },\n [onMsg],\n );\n\n return { tokenModalOpen, updateTokenModalState };\n};\n"],"names":["useTokenModal","onMsg","tokenModalOpen","setTokenModalOpen","useState","updateTokenModalState","useCallback","state"],"mappings":";AAGO,MAAMA,IAAgB,CAAC;AAAA,EAC5B,OAAAC;AACF,MAEM;AACJ,QAAM,CAACC,GAAgBC,CAAiB,IAAIC,EAA0B,MAAM,GAEtEC,IAAwBC;AAAA,IAC5B,CAACC,MAA2B;AAC1B,MAAAJ,EAAkBI,CAAK,GACvBN,IAAQ;AAAA,QACN,MAAM;AAAA,QACN,QAAQM,MAAU;AAAA,MAAA,CACnB;AAAA,IACH;AAAA,IACA,CAACN,CAAK;AAAA,EAAA;AAGR,SAAO,EAAE,gBAAAC,GAAgB,uBAAAG,EAAA;AAC3B;"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,10 +3,10 @@ import { Badge as s } from "./components/Badge.js";
|
|
|
3
3
|
import { Banner as a } from "./components/Banner.js";
|
|
4
4
|
import { BlockingError as f } from "./components/BlockingError.js";
|
|
5
5
|
import { Button as x, OutlinedButton as u } from "./components/Button.js";
|
|
6
|
-
import { Card as
|
|
6
|
+
import { Card as d } from "./components/Card.js";
|
|
7
7
|
import { CopyButton as S } from "./components/CopyButton.js";
|
|
8
8
|
import { DirectionSwitcher as k } from "./components/DirectionSwitcher.js";
|
|
9
|
-
import { ErrorMessage as
|
|
9
|
+
import { ErrorMessage as h } from "./components/ErrorMessage.js";
|
|
10
10
|
import { Hr as B } from "./components/Hr.js";
|
|
11
11
|
import { Icon as I } from "./components/Icon.js";
|
|
12
12
|
import { Input as W } from "./components/Input.js";
|
|
@@ -29,8 +29,8 @@ import { SwapDirectionSwitcher as pe } from "./features/SwapDirectionSwitcher.js
|
|
|
29
29
|
import { ExternalDeposit as ne } from "./features/ExternalDeposit.js";
|
|
30
30
|
import { DepositMethodSwitcher as me } from "./features/DepositMethodSwitcher.js";
|
|
31
31
|
import { WalletCompatibilityCheck as ue } from "./features/WalletCompatibilityCheck/index.js";
|
|
32
|
-
import { useChains as
|
|
33
|
-
import { M as Se, Q as le, T as ke, W as
|
|
32
|
+
import { useChains as de } from "./hooks/useChains.js";
|
|
33
|
+
import { M as Se, Q as le, T as ke, W as ge, j as he, r as Te, u as Be, e as Ee, a as Ie, b as Me, c as We, f as we, h as Ce, d as De, g as Ae } from "./config-CsHJaepw.js";
|
|
34
34
|
import { useMakeIntentsTransfer as be } from "./hooks/useMakeIntentsTransfer.js";
|
|
35
35
|
import { useMakeTransfer as ve } from "./hooks/useMakeTransfer.js";
|
|
36
36
|
import { useMakeQuoteTransfer as Ne } from "./hooks/useMakeQuoteTransfer.js";
|
|
@@ -41,9 +41,10 @@ import { useExternalDepositStatus as qe } from "./hooks/useExternalDepositStatus
|
|
|
41
41
|
import { guardStates as Ge } from "./machine/guards/index.js";
|
|
42
42
|
import { machine as Ke, moveTo as Ve } from "./machine/machine.js";
|
|
43
43
|
import { fireEvent as Ye } from "./machine/events/utils/fireEvent.js";
|
|
44
|
-
import { WidgetSwap as _e } from "./
|
|
45
|
-
import { WidgetDeposit as er } from "./
|
|
46
|
-
import { WidgetWithdraw as or } from "./
|
|
44
|
+
import { WidgetSwap as _e } from "./widgets/WidgetSwap.js";
|
|
45
|
+
import { WidgetDeposit as er } from "./widgets/WidgetDeposit.js";
|
|
46
|
+
import { WidgetWithdraw as or } from "./widgets/WidgetWithdraw.js";
|
|
47
|
+
import { WidgetSkeleton as sr } from "./widgets/WidgetSkeleton.js";
|
|
47
48
|
export {
|
|
48
49
|
o as Accordion,
|
|
49
50
|
s as Badge,
|
|
@@ -51,12 +52,12 @@ export {
|
|
|
51
52
|
a as Banner,
|
|
52
53
|
f as BlockingError,
|
|
53
54
|
x as Button,
|
|
54
|
-
|
|
55
|
+
d as Card,
|
|
55
56
|
U as ChainsDropdown,
|
|
56
57
|
S as CopyButton,
|
|
57
58
|
me as DepositMethodSwitcher,
|
|
58
59
|
k as DirectionSwitcher,
|
|
59
|
-
|
|
60
|
+
h as ErrorMessage,
|
|
60
61
|
ne as ExternalDeposit,
|
|
61
62
|
B as Hr,
|
|
62
63
|
I as Icon,
|
|
@@ -83,17 +84,18 @@ export {
|
|
|
83
84
|
ke as TransferError,
|
|
84
85
|
ue as WalletCompatibilityCheck,
|
|
85
86
|
er as WidgetDeposit,
|
|
86
|
-
|
|
87
|
+
ge as WidgetError,
|
|
88
|
+
sr as WidgetSkeleton,
|
|
87
89
|
_e as WidgetSwap,
|
|
88
90
|
or as WidgetWithdraw,
|
|
89
91
|
Ye as fireEvent,
|
|
90
92
|
Ge as guardStates,
|
|
91
|
-
|
|
93
|
+
he as isWidgetError,
|
|
92
94
|
Ke as machine,
|
|
93
95
|
Ve as moveTo,
|
|
94
|
-
|
|
96
|
+
Te as registerStoreEvents,
|
|
95
97
|
Be as useAlchemyBalanceIntegration,
|
|
96
|
-
|
|
98
|
+
de as useChains,
|
|
97
99
|
Ee as useComputedSnapshot,
|
|
98
100
|
qe as useExternalDepositStatus,
|
|
99
101
|
Ie as useIntentsBalance,
|
package/dist/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,2 +1,2 @@
|
|
|
1
|
-
export type LocalisationKeys = 'chain.all.label' | 'wallet.recipient.placeholder' | 'wallet.recipient.info.selectToken' | 'wallet.recipient.error.noAddress' | 'wallet.recipient.error.tokenNotSelected' | 'wallet.recipient.error.invalidAddress' | 'wallet.recipient.warn.compatibleNetwork' | 'wallet.recipient.message.networkVerified' | 'wallet.recipient.message.receiveFunds' | 'wallet.connected.error.notSupportedChain' | 'transfer.success.hash.label' | 'transfer.success.intent.label' | 'quote.result.maxSlippage.label' | 'quote.result.processingTime.label' | 'tokens.input.max.label' | 'tokens.input.half.label' | 'tokens.input.externalBalance.label' | 'tokens.list.noBalanceOnApp.label' | 'tokens.list.searchEmpty.label' | 'tokens.list.searchReset.label' | 'deposit.external.error.noStatus' | 'deposit.external.error.incomplete' | 'deposit.external.error.failed' | 'deposit.external.loading.waiting' | 'deposit.external.loading.fetching' | 'submit.error.invalidTransferData.label' | 'submit.error.transferFailed.label' | 'submit.error.insufficientBalance' | 'submit.error.invalidAddress' | 'submit.error.amountTooLow.label' | 'submit.error.amountTooLow.message' | 'submit.error.quoteFailed.label' | 'submit.error.quoteFailed.message' | 'submit.error.transfer.noFees' | 'submit.error.transfer.failed' | 'submit.active.transfer' | 'submit.active.internal' | 'submit.active.external' | 'submit.disabled.temporary.label' | 'submit.disabled.temporary.message' | 'submit.pending.quote.finalizing' | 'submit.pending.transfer.confirmInWallet' | 'submit.pending.transfer.finalizing' | 'walletCompatibility.modal.title.initial' | 'walletCompatibility.modal.title.error' | 'walletCompatibility.modal.description.initial' | 'walletCompatibility.modal.description.error' | 'walletCompatibility.modal.feature.secureTransactions' | 'walletCompatibility.modal.feature.fullAccess' | 'walletCompatibility.modal.feature.fundProtection' | 'walletCompatibility.modal.error.interrupted' | 'walletCompatibility.modal.error.incompatible' | 'walletCompatibility.modal.button.checkCompatibility' | 'walletCompatibility.modal.button.tryAgain' | 'walletCompatibility.modal.button.signOut';
|
|
1
|
+
export type LocalisationKeys = 'chain.all.label' | 'wallet.recipient.placeholder' | 'wallet.recipient.info.selectToken' | 'wallet.recipient.error.noAddress' | 'wallet.recipient.error.tokenNotSelected' | 'wallet.recipient.error.invalidAddress' | 'wallet.recipient.warn.compatibleNetwork' | 'wallet.recipient.message.networkVerified' | 'wallet.recipient.message.receiveFunds' | 'wallet.connected.error.notSupportedChain' | 'transfer.success.hash.label' | 'transfer.success.intent.label' | 'quote.result.maxSlippage.label' | 'quote.result.processingTime.label' | 'tokens.input.max.label' | 'tokens.input.half.label' | 'tokens.input.externalBalance.label' | 'tokens.list.noBalanceOnApp.label' | 'tokens.list.searchEmpty.label' | 'tokens.list.searchReset.label' | 'deposit.external.error.noStatus' | 'deposit.external.error.incomplete' | 'deposit.external.error.failed' | 'deposit.external.loading.waiting' | 'deposit.external.loading.fetching' | 'submit.error.invalidTransferData.label' | 'submit.error.transferFailed.label' | 'submit.error.insufficientBalance' | 'submit.error.invalidAddress' | 'submit.error.amountTooLow.label' | 'submit.error.amountTooLow.message' | 'submit.error.quoteFailed.label' | 'submit.error.quoteFailed.message' | 'submit.error.transfer.noFees' | 'submit.error.transfer.failed' | 'submit.active.transfer.swap' | 'submit.active.internal.swap' | 'submit.active.external.swap' | 'submit.active.transfer.withdraw' | 'submit.active.internal.withdraw' | 'submit.active.external.withdraw' | 'submit.active.transfer.deposit' | 'submit.active.internal.deposit' | 'submit.active.external.deposit' | 'submit.disabled.temporary.label' | 'submit.disabled.temporary.message' | 'submit.pending.quote.finalizing' | 'submit.pending.transfer.confirmInWallet' | 'submit.pending.transfer.finalizing' | 'walletCompatibility.modal.title.initial' | 'walletCompatibility.modal.title.error' | 'walletCompatibility.modal.description.initial' | 'walletCompatibility.modal.description.error' | 'walletCompatibility.modal.feature.secureTransactions' | 'walletCompatibility.modal.feature.fullAccess' | 'walletCompatibility.modal.feature.fundProtection' | 'walletCompatibility.modal.error.interrupted' | 'walletCompatibility.modal.error.incompatible' | 'walletCompatibility.modal.button.checkCompatibility' | 'walletCompatibility.modal.button.tryAgain' | 'walletCompatibility.modal.button.signOut';
|
|
2
2
|
export type LocalisationDict = Partial<Record<LocalisationKeys, string>>;
|
|
@@ -1,58 +1,57 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useState as g, useEffect as
|
|
3
|
-
import { g as
|
|
1
|
+
import { jsx as t, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g, useEffect as f } from "react";
|
|
3
|
+
import { g as E, e as D, i as C, d as M, h as B } from "../config-CsHJaepw.js";
|
|
4
4
|
import "@tanstack/react-query";
|
|
5
|
-
import "
|
|
5
|
+
import "../features/BalanceRpcLoader/TokenBalanceLoader.js";
|
|
6
6
|
import "@headlessui/react";
|
|
7
7
|
import "framer-motion";
|
|
8
8
|
import "lucide-react";
|
|
9
|
-
import "
|
|
10
|
-
import "
|
|
11
|
-
import { notReachable as r } from "
|
|
12
|
-
import "
|
|
13
|
-
import "
|
|
14
|
-
import { Banner as B } from "../../components/Banner.js";
|
|
9
|
+
import "../utils/cn.js";
|
|
10
|
+
import "../constants/chains.js";
|
|
11
|
+
import { notReachable as r } from "../utils/notReachable.js";
|
|
12
|
+
import { useTypedTranslation as W } from "../localisation.js";
|
|
13
|
+
import { Banner as F } from "../components/Banner.js";
|
|
15
14
|
import "ethers";
|
|
16
|
-
import "
|
|
17
|
-
import { fireEvent as
|
|
18
|
-
import { isDebug as
|
|
15
|
+
import "../machine/machine.js";
|
|
16
|
+
import { fireEvent as d } from "../machine/events/utils/fireEvent.js";
|
|
17
|
+
import { isDebug as I } from "../utils/checkers/isDebug.js";
|
|
19
18
|
import "viem";
|
|
20
|
-
import { SubmitButton as
|
|
21
|
-
import { SuccessScreen as
|
|
22
|
-
import { SwapQuote as
|
|
23
|
-
import { TokenInput as
|
|
24
|
-
import "
|
|
25
|
-
import { TokensModal as
|
|
26
|
-
import { ExternalDeposit as
|
|
27
|
-
import { DepositMethodSwitcher as
|
|
28
|
-
import "
|
|
19
|
+
import { SubmitButton as k } from "../features/SubmitButton/index.js";
|
|
20
|
+
import { SuccessScreen as N } from "../features/SuccessScreen/index.js";
|
|
21
|
+
import { SwapQuote as R } from "../features/SwapQuote/index.js";
|
|
22
|
+
import { TokenInput as A } from "../features/TokenInput/index.js";
|
|
23
|
+
import "../features/TokensList/index.js";
|
|
24
|
+
import { TokensModal as L } from "../features/TokensModal.js";
|
|
25
|
+
import { ExternalDeposit as j } from "../features/ExternalDeposit.js";
|
|
26
|
+
import { DepositMethodSwitcher as q } from "../features/DepositMethodSwitcher.js";
|
|
27
|
+
import "../index-CqENtPJM.js";
|
|
29
28
|
import "@defuse-protocol/internal-utils";
|
|
30
|
-
import "
|
|
31
|
-
import { BlockingError as
|
|
29
|
+
import "../utils/near/rpc.js";
|
|
30
|
+
import { BlockingError as Q } from "../components/BlockingError.js";
|
|
32
31
|
import "copy-text-to-clipboard";
|
|
33
32
|
import "clsx";
|
|
34
|
-
import "
|
|
35
|
-
import "
|
|
33
|
+
import "../components/InputAmount.js";
|
|
34
|
+
import "../components/Notes.js";
|
|
36
35
|
import "zod";
|
|
37
36
|
import "@defuse-protocol/bridge-sdk";
|
|
38
37
|
import "change-case";
|
|
39
38
|
import "bs58";
|
|
40
39
|
import "@defuse-protocol/one-click-sdk-typescript";
|
|
41
40
|
import "axios";
|
|
42
|
-
import "
|
|
43
|
-
import { useTokenInputPair as
|
|
44
|
-
import { WidgetSkeleton as
|
|
45
|
-
import { useTokenModal as
|
|
46
|
-
const
|
|
47
|
-
providers:
|
|
48
|
-
onMsg:
|
|
41
|
+
import "../network.js";
|
|
42
|
+
import { useTokenInputPair as U } from "../hooks/useTokenInputPair.js";
|
|
43
|
+
import { WidgetSkeleton as h } from "./WidgetSkeleton.js";
|
|
44
|
+
import { useTokenModal as K } from "../hooks/useTokenModal.js";
|
|
45
|
+
const Ie = ({
|
|
46
|
+
providers: w,
|
|
47
|
+
onMsg: a,
|
|
49
48
|
makeTransfer: _
|
|
50
49
|
}) => {
|
|
51
|
-
const { ctx: o } =
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
}), []),
|
|
55
|
-
debug:
|
|
50
|
+
const { ctx: o } = E(), { isDirectTransfer: b } = D(), { chainsFilter: p, walletAddress: x } = C(), { t: n } = W(), { onChangeAmount: S, onChangeToken: y } = U(), { status: T, refetch: v } = M(), { tokenModalOpen: s, updateTokenModalState: i } = K({ onMsg: a }), [u, c] = g();
|
|
51
|
+
if (f(() => (d("reset", null), () => {
|
|
52
|
+
d("depositTypeSet", { isExternal: !1 });
|
|
53
|
+
}), []), B({
|
|
54
|
+
debug: I(),
|
|
56
55
|
listenTo: [
|
|
57
56
|
"checkWalletConnection",
|
|
58
57
|
"setSourceTokenBalance",
|
|
@@ -61,18 +60,18 @@ const Fe = ({
|
|
|
61
60
|
["makeQuote", { message: void 0 }],
|
|
62
61
|
["setBalancesUsingAlchemyExt", { alchemyApiKey: void 0 }]
|
|
63
62
|
]
|
|
64
|
-
}),
|
|
65
|
-
|
|
63
|
+
}), f(() => {
|
|
64
|
+
a?.({
|
|
66
65
|
type: "on_change_deposit_type",
|
|
67
66
|
isExternal: o.isDepositFromExternalWallet
|
|
68
67
|
});
|
|
69
68
|
}, [o.isDepositFromExternalWallet]), !o.sourceToken)
|
|
70
|
-
return /* @__PURE__ */ t(
|
|
71
|
-
if (o.state === "transfer_success" &&
|
|
69
|
+
return /* @__PURE__ */ t(h.Deposit, {});
|
|
70
|
+
if (o.state === "transfer_success" && u)
|
|
72
71
|
return /* @__PURE__ */ t(
|
|
73
|
-
|
|
72
|
+
N,
|
|
74
73
|
{
|
|
75
|
-
...
|
|
74
|
+
...u,
|
|
76
75
|
message: [
|
|
77
76
|
"Your deposit has been successfully completed,",
|
|
78
77
|
"and the funds are now available in your account."
|
|
@@ -80,7 +79,7 @@ const Fe = ({
|
|
|
80
79
|
onMsg: (e) => {
|
|
81
80
|
switch (e.type) {
|
|
82
81
|
case "on_dismiss_success":
|
|
83
|
-
|
|
82
|
+
c(void 0);
|
|
84
83
|
break;
|
|
85
84
|
default:
|
|
86
85
|
r(e.type);
|
|
@@ -91,49 +90,49 @@ const Fe = ({
|
|
|
91
90
|
switch (T) {
|
|
92
91
|
case "error":
|
|
93
92
|
return /* @__PURE__ */ t(
|
|
94
|
-
|
|
93
|
+
Q,
|
|
95
94
|
{
|
|
96
95
|
message: "Couldn't load tokens list.",
|
|
97
|
-
onClickRetry:
|
|
96
|
+
onClickRetry: v
|
|
98
97
|
}
|
|
99
98
|
);
|
|
100
99
|
case "success":
|
|
101
100
|
return s !== "none" ? /* @__PURE__ */ t(
|
|
102
|
-
|
|
101
|
+
L,
|
|
103
102
|
{
|
|
104
103
|
showBalances: !0,
|
|
105
104
|
showChainsSelector: !0,
|
|
106
105
|
groupTokens: s === "source",
|
|
107
|
-
chainsFilter: s === "source" ?
|
|
106
|
+
chainsFilter: s === "source" ? p.source : p.target,
|
|
108
107
|
onMsg: (e) => {
|
|
109
108
|
switch (e.type) {
|
|
110
109
|
case "on_select_token":
|
|
111
|
-
|
|
110
|
+
y(s, e.token), i("none"), a?.({
|
|
112
111
|
type: e.type,
|
|
113
112
|
token: e.token,
|
|
114
113
|
variant: s
|
|
115
114
|
});
|
|
116
115
|
break;
|
|
117
116
|
case "on_dismiss_tokens_modal":
|
|
118
|
-
|
|
117
|
+
i("none");
|
|
119
118
|
break;
|
|
120
119
|
default:
|
|
121
120
|
r(e);
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
123
|
}
|
|
125
|
-
) : /* @__PURE__ */ t("div", { className: "gap-sw-2xl flex flex-col", children: /* @__PURE__ */
|
|
124
|
+
) : /* @__PURE__ */ t("div", { className: "gap-sw-2xl flex flex-col", children: /* @__PURE__ */ m("div", { className: "gap-sw-lg relative flex flex-col", children: [
|
|
126
125
|
/* @__PURE__ */ t(
|
|
127
|
-
|
|
126
|
+
A.Source,
|
|
128
127
|
{
|
|
129
128
|
showBalance: !o.isDepositFromExternalWallet,
|
|
130
129
|
onMsg: (e) => {
|
|
131
130
|
switch (e.type) {
|
|
132
131
|
case "on_change_amount":
|
|
133
|
-
|
|
132
|
+
S("source", e.amount);
|
|
134
133
|
break;
|
|
135
134
|
case "on_click_select_token":
|
|
136
|
-
|
|
135
|
+
i("source");
|
|
137
136
|
break;
|
|
138
137
|
default:
|
|
139
138
|
r(e);
|
|
@@ -141,25 +140,25 @@ const Fe = ({
|
|
|
141
140
|
}
|
|
142
141
|
}
|
|
143
142
|
),
|
|
144
|
-
/* @__PURE__ */ t(
|
|
143
|
+
/* @__PURE__ */ t(q, { className: "mt-sw-md", children: ({ isExternal: e }) => e ? /* @__PURE__ */ m("div", { className: "gap-sw-2xl pb-sw-2xl flex flex-col", children: [
|
|
145
144
|
/* @__PURE__ */ t(
|
|
146
|
-
|
|
145
|
+
j,
|
|
147
146
|
{
|
|
148
|
-
onMsg: (
|
|
149
|
-
switch (
|
|
147
|
+
onMsg: (l) => {
|
|
148
|
+
switch (l.type) {
|
|
150
149
|
case "on_successful_transfer":
|
|
151
|
-
|
|
150
|
+
c(l.transferResult);
|
|
152
151
|
break;
|
|
153
152
|
case "on_transaction_received":
|
|
154
153
|
break;
|
|
155
154
|
default:
|
|
156
|
-
r(
|
|
155
|
+
r(l);
|
|
157
156
|
}
|
|
158
157
|
}
|
|
159
158
|
}
|
|
160
159
|
),
|
|
161
160
|
(o.state === "quote_success_internal" || o.state === "quote_success_external") && /* @__PURE__ */ t(
|
|
162
|
-
|
|
161
|
+
F,
|
|
163
162
|
{
|
|
164
163
|
multiline: !0,
|
|
165
164
|
variant: "warn",
|
|
@@ -167,30 +166,36 @@ const Fe = ({
|
|
|
167
166
|
}
|
|
168
167
|
)
|
|
169
168
|
] }) : null }),
|
|
170
|
-
!
|
|
169
|
+
!b && /* @__PURE__ */ t(R, { className: "mt-sw-md" }),
|
|
171
170
|
x ? /* @__PURE__ */ t(
|
|
172
|
-
|
|
171
|
+
k,
|
|
173
172
|
{
|
|
174
|
-
providers:
|
|
173
|
+
providers: w,
|
|
175
174
|
makeTransfer: _,
|
|
175
|
+
transferLabel: n("submit.active.transfer.withdraw", "Transfer"),
|
|
176
|
+
internalSwapLabel: n("submit.active.internal.withdraw", "Swap"),
|
|
177
|
+
externalSwapLabel: n(
|
|
178
|
+
"submit.active.external.deposit",
|
|
179
|
+
"Swap & send"
|
|
180
|
+
),
|
|
176
181
|
onMsg: (e) => {
|
|
177
182
|
switch (e.type) {
|
|
178
183
|
case "on_successful_transfer":
|
|
179
|
-
|
|
184
|
+
c(e.transfer), a?.({ type: "on_transfer_success" });
|
|
180
185
|
break;
|
|
181
186
|
default:
|
|
182
187
|
r(e.type);
|
|
183
188
|
}
|
|
184
189
|
}
|
|
185
190
|
}
|
|
186
|
-
) : /* @__PURE__ */ t(
|
|
191
|
+
) : /* @__PURE__ */ t(k.Error, {})
|
|
187
192
|
] }) });
|
|
188
193
|
case "pending":
|
|
189
194
|
default:
|
|
190
|
-
return /* @__PURE__ */ t(
|
|
195
|
+
return /* @__PURE__ */ t(h.Deposit, {});
|
|
191
196
|
}
|
|
192
197
|
};
|
|
193
198
|
export {
|
|
194
|
-
|
|
199
|
+
Ie as WidgetDeposit
|
|
195
200
|
};
|
|
196
201
|
//# sourceMappingURL=WidgetDeposit.js.map
|