@ton/appkit-react 1.0.0-alpha.0 → 1.0.0-alpha.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/README.md +7 -6
- package/dist/esm/components/shared/settings-button/settings-button.js +1 -1
- package/dist/esm/components/shared/settings-button/settings-button.js.map +1 -1
- package/dist/esm/components/ui/button/button.module.css +1 -1
- package/dist/esm/components/ui/modal/modal.module.css +1 -1
- package/dist/esm/components/ui/tabs/tabs.module.css +1 -1
- package/dist/esm/features/balances/components/send-jetton-button/send-jetton-button.js +3 -3
- package/dist/esm/features/balances/components/send-jetton-button/send-jetton-button.js.map +1 -1
- package/dist/esm/features/balances/index.js +0 -1
- package/dist/esm/features/balances/index.js.map +1 -1
- package/dist/esm/features/staking/components/select-unstake-mode/select-unstake-mode.js +2 -1
- package/dist/esm/features/staking/components/select-unstake-mode/select-unstake-mode.js.map +1 -1
- package/dist/esm/features/staking/components/select-unstake-mode/select-unstake-mode.module.css +2 -6
- package/dist/esm/features/staking/components/staking-widget-ui/staking-widget-ui.js +1 -1
- package/dist/esm/features/staking/components/staking-widget-ui/staking-widget-ui.js.map +1 -1
- package/dist/esm/features/staking/components/staking-widget-ui/staking-widget-ui.module.css +4 -0
- package/dist/esm/features/swap/utils/map-swap-error.js +5 -5
- package/dist/esm/features/swap/utils/map-swap-error.js.map +1 -1
- package/dist/esm/styles/index.css +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/utils/map-defi-error.js +7 -7
- package/dist/esm/utils/map-defi-error.js.map +1 -1
- package/dist/types/features/balances/index.d.ts +0 -1
- package/dist/types/features/balances/index.d.ts.map +1 -1
- package/dist/types/features/staking/components/select-unstake-mode/select-unstake-mode.d.ts.map +1 -1
- package/dist/types/features/staking/components/staking-widget-ui/staking-widget-ui.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/shared/settings-button/settings-button.tsx +1 -1
- package/src/features/balances/components/send-jetton-button/send-jetton-button.tsx +3 -3
- package/src/features/balances/index.ts +0 -1
- package/src/features/staking/components/select-unstake-mode/select-unstake-mode.tsx +12 -4
- package/src/features/staking/components/staking-widget-ui/staking-widget-ui.tsx +11 -10
- package/src/features/swap/utils/map-swap-error.ts +5 -5
- package/src/utils/map-defi-error.ts +7 -7
- package/dist/esm/features/balances/components/balance-badge/balance-badge.js +0 -33
- package/dist/esm/features/balances/components/balance-badge/balance-badge.js.map +0 -1
- package/dist/esm/features/balances/components/balance-badge/balance-badge.module.css +0 -21
- package/dist/esm/features/balances/components/balance-badge/index.js +0 -9
- package/dist/esm/features/balances/components/balance-badge/index.js.map +0 -1
- package/dist/types/features/balances/components/balance-badge/balance-badge.d.ts +0 -21
- package/dist/types/features/balances/components/balance-badge/balance-badge.d.ts.map +0 -1
- package/dist/types/features/balances/components/balance-badge/index.d.ts +0 -9
- package/dist/types/features/balances/components/balance-badge/index.d.ts.map +0 -1
- package/src/features/balances/components/balance-badge/balance-badge.tsx +0 -47
- package/src/features/balances/components/balance-badge/index.ts +0 -9
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import { DefiError } from '@ton/appkit';
|
|
8
|
+
import { DefiError, DefiErrorCode } from '@ton/appkit';
|
|
9
9
|
/**
|
|
10
10
|
* Map a thrown error to an i18n key from the `defi.*` namespace.
|
|
11
11
|
* Returns `null` when the error isn't a {@link DefiError} or the code isn't recognised —
|
|
@@ -15,17 +15,17 @@ export const mapDefiError = (error) => {
|
|
|
15
15
|
if (!(error instanceof DefiError))
|
|
16
16
|
return null;
|
|
17
17
|
switch (error.code) {
|
|
18
|
-
case
|
|
18
|
+
case DefiErrorCode.UnsupportedNetwork:
|
|
19
19
|
return 'defi.unsupportedNetwork';
|
|
20
|
-
case
|
|
20
|
+
case DefiErrorCode.NetworkError:
|
|
21
21
|
return 'defi.networkError';
|
|
22
|
-
case
|
|
22
|
+
case DefiErrorCode.ProviderNotFound:
|
|
23
23
|
return 'defi.providerNotFound';
|
|
24
|
-
case
|
|
24
|
+
case DefiErrorCode.NoDefaultProvider:
|
|
25
25
|
return 'defi.noDefaultProvider';
|
|
26
|
-
case
|
|
26
|
+
case DefiErrorCode.InvalidProvider:
|
|
27
27
|
return 'defi.invalidProvider';
|
|
28
|
-
case
|
|
28
|
+
case DefiErrorCode.InvalidParams:
|
|
29
29
|
return 'defi.invalidParams';
|
|
30
30
|
default:
|
|
31
31
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-defi-error.js","sourceRoot":"","sources":["../../../src/utils/map-defi-error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"map-defi-error.js","sourceRoot":"","sources":["../../../src/utils/map-defi-error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAc,EAAiB,EAAE;IAC1D,IAAI,CAAC,CAAC,KAAK,YAAY,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IAE/C,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,aAAa,CAAC,kBAAkB;YACjC,OAAO,yBAAyB,CAAC;QACrC,KAAK,aAAa,CAAC,YAAY;YAC3B,OAAO,mBAAmB,CAAC;QAC/B,KAAK,aAAa,CAAC,gBAAgB;YAC/B,OAAO,uBAAuB,CAAC;QACnC,KAAK,aAAa,CAAC,iBAAiB;YAChC,OAAO,wBAAwB,CAAC;QACpC,KAAK,aAAa,CAAC,eAAe;YAC9B,OAAO,sBAAsB,CAAC;QAClC,KAAK,aAAa,CAAC,aAAa;YAC5B,OAAO,oBAAoB,CAAC;QAChC;YACI,OAAO,IAAI,CAAC;IACpB,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/balances/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,4BAA4B,CAAC;AAC3C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/balances/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAEhD,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC"}
|
package/dist/types/features/staking/components/select-unstake-mode/select-unstake-mode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-unstake-mode.d.ts","sourceRoot":"","sources":["../../../../../../src/features/staking/components/select-unstake-mode/select-unstake-mode.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"select-unstake-mode.d.ts","sourceRoot":"","sources":["../../../../../../src/features/staking/components/select-unstake-mode/select-unstake-mode.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAS9F,MAAM,WAAW,sBAAuB,SAAQ,cAAc,CAAC,KAAK,CAAC;IACjE,KAAK,EAAE,YAAY,CAAC;IACpB,aAAa,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C,YAAY,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAC9C,gBAAgB,EAAE,uBAAuB,GAAG,SAAS,CAAC;CACzD;AAQD,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAqGxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staking-widget-ui.d.ts","sourceRoot":"","sources":["../../../../../../src/features/staking/components/staking-widget-ui/staking-widget-ui.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,EAAE,EAAa,MAAM,OAAO,CAAC;AAY3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAMrE,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAElF,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,wBAAwB,
|
|
1
|
+
{"version":3,"file":"staking-widget-ui.d.ts","sourceRoot":"","sources":["../../../../../../src/features/staking/components/staking-widget-ui/staking-widget-ui.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,EAAE,EAAa,MAAM,OAAO,CAAC;AAY3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAMrE,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAElF,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,wBAAwB,CA0KxD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ton/appkit-react",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"clsx": "2.1.1",
|
|
37
37
|
"radix-ui": "^1.4.3",
|
|
38
38
|
"rosetta": "1.1.0",
|
|
39
|
-
"@ton/appkit": "1.0.0-alpha.
|
|
39
|
+
"@ton/appkit": "1.0.0-alpha.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@storybook/addon-docs": "10.3.5",
|
|
@@ -40,7 +40,7 @@ export const SendJettonButton: FC<SendJettonButtonProps> = ({
|
|
|
40
40
|
throw new Error('Jetton address is required');
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
if (
|
|
43
|
+
if (jetton.decimals === undefined) {
|
|
44
44
|
throw new Error('Jetton decimals is required');
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -54,7 +54,7 @@ export const SendJettonButton: FC<SendJettonButtonProps> = ({
|
|
|
54
54
|
}, [appKit, recipientAddress, amount, comment, jetton]);
|
|
55
55
|
|
|
56
56
|
const text = useMemo(() => {
|
|
57
|
-
if (amount && jetton.decimals) {
|
|
57
|
+
if (amount && jetton.decimals !== undefined) {
|
|
58
58
|
return t('balances.sendJettonWithAmount', {
|
|
59
59
|
amount: formatUnits(parseUnits(amount, jetton.decimals), jetton.decimals).toString(),
|
|
60
60
|
symbol: jetton.symbol,
|
|
@@ -68,7 +68,7 @@ export const SendJettonButton: FC<SendJettonButtonProps> = ({
|
|
|
68
68
|
<Send
|
|
69
69
|
request={createTransferTransaction}
|
|
70
70
|
text={text}
|
|
71
|
-
disabled={!recipientAddress || !amount || !jetton.address ||
|
|
71
|
+
disabled={!recipientAddress || !amount || !jetton.address || jetton.decimals === undefined}
|
|
72
72
|
{...props}
|
|
73
73
|
/>
|
|
74
74
|
);
|
|
@@ -17,6 +17,7 @@ import { ChevronDownIcon } from '../../../../components/ui/icons';
|
|
|
17
17
|
import { useI18n } from '../../../settings/hooks/use-i18n';
|
|
18
18
|
import { formatAmount } from '../staking-info/utils';
|
|
19
19
|
import styles from './select-unstake-mode.module.css';
|
|
20
|
+
import { Button } from '../../../../components/ui/button';
|
|
20
21
|
|
|
21
22
|
export interface SelectUnstakeModeProps extends ComponentProps<'div'> {
|
|
22
23
|
value: UnstakeModes;
|
|
@@ -84,13 +85,20 @@ export const SelectUnstakeMode: FC<SelectUnstakeModeProps> = ({
|
|
|
84
85
|
|
|
85
86
|
return (
|
|
86
87
|
<div className={clsx(styles.root, className)} {...props}>
|
|
87
|
-
<
|
|
88
|
+
<div className={styles.header}>
|
|
88
89
|
<span className={styles.headerLabel}>{t('staking.unstakeType')}</span>
|
|
89
|
-
|
|
90
|
+
|
|
91
|
+
<Button
|
|
92
|
+
variant="gray"
|
|
93
|
+
size="s"
|
|
94
|
+
borderRadius="full"
|
|
95
|
+
className={styles.headerValue}
|
|
96
|
+
onClick={() => setOpen((v) => !v)}
|
|
97
|
+
>
|
|
90
98
|
{selectedLabel}
|
|
91
99
|
<ChevronDownIcon size={16} className={clsx(styles.chevron, open && styles.chevronOpen)} />
|
|
92
|
-
</
|
|
93
|
-
</
|
|
100
|
+
</Button>
|
|
101
|
+
</div>
|
|
94
102
|
|
|
95
103
|
<Collapsible open={open}>
|
|
96
104
|
<div className={styles.options}>
|
|
@@ -127,7 +127,7 @@ export const StakingWidgetUI: FC<StakingWidgetRenderProps> = ({
|
|
|
127
127
|
</TabsContent>
|
|
128
128
|
|
|
129
129
|
{/* ── UNSTAKE TAB ── */}
|
|
130
|
-
<TabsContent
|
|
130
|
+
<TabsContent value="unstake">
|
|
131
131
|
<div className={styles.content}>
|
|
132
132
|
<div className={styles.inputSection}>
|
|
133
133
|
<CenteredAmountInput
|
|
@@ -167,17 +167,18 @@ export const StakingWidgetUI: FC<StakingWidgetRenderProps> = ({
|
|
|
167
167
|
/>
|
|
168
168
|
</div>
|
|
169
169
|
</TabsContent>
|
|
170
|
-
|
|
171
|
-
<StakingInfo
|
|
172
|
-
quote={quote}
|
|
173
|
-
isQuoteLoading={isQuoteLoading}
|
|
174
|
-
providerInfo={providerInfo}
|
|
175
|
-
providerMetadata={providerMetadata}
|
|
176
|
-
isProviderInfoLoading={isProviderInfoLoading}
|
|
177
|
-
direction={direction}
|
|
178
|
-
/>
|
|
179
170
|
</Tabs>
|
|
180
171
|
|
|
172
|
+
<StakingInfo
|
|
173
|
+
className={styles.info}
|
|
174
|
+
quote={quote}
|
|
175
|
+
isQuoteLoading={isQuoteLoading}
|
|
176
|
+
providerInfo={providerInfo}
|
|
177
|
+
providerMetadata={providerMetadata}
|
|
178
|
+
isProviderInfoLoading={isProviderInfoLoading}
|
|
179
|
+
direction={direction}
|
|
180
|
+
/>
|
|
181
|
+
|
|
181
182
|
<LowBalanceModal
|
|
182
183
|
open={isLowBalanceWarningOpen}
|
|
183
184
|
mode={lowBalanceMode}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { SwapError } from '@ton/appkit';
|
|
9
|
+
import { SwapError, SwapErrorCode } from '@ton/appkit';
|
|
10
10
|
|
|
11
11
|
import { mapDefiError } from '../../../utils/map-defi-error';
|
|
12
12
|
|
|
@@ -17,13 +17,13 @@ import { mapDefiError } from '../../../utils/map-defi-error';
|
|
|
17
17
|
export const mapSwapError = (error: unknown): string => {
|
|
18
18
|
if (error instanceof SwapError) {
|
|
19
19
|
switch (error.code) {
|
|
20
|
-
case
|
|
20
|
+
case SwapErrorCode.InvalidQuote:
|
|
21
21
|
return 'swap.invalidQuote';
|
|
22
|
-
case
|
|
22
|
+
case SwapErrorCode.InsufficientLiquidity:
|
|
23
23
|
return 'swap.insufficientLiquidity';
|
|
24
|
-
case
|
|
24
|
+
case SwapErrorCode.QuoteExpired:
|
|
25
25
|
return 'swap.quoteExpired';
|
|
26
|
-
case
|
|
26
|
+
case SwapErrorCode.BuildTxFailed:
|
|
27
27
|
return 'swap.buildTxFailed';
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { DefiError } from '@ton/appkit';
|
|
9
|
+
import { DefiError, DefiErrorCode } from '@ton/appkit';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Map a thrown error to an i18n key from the `defi.*` namespace.
|
|
@@ -17,17 +17,17 @@ export const mapDefiError = (error: unknown): string | null => {
|
|
|
17
17
|
if (!(error instanceof DefiError)) return null;
|
|
18
18
|
|
|
19
19
|
switch (error.code) {
|
|
20
|
-
case
|
|
20
|
+
case DefiErrorCode.UnsupportedNetwork:
|
|
21
21
|
return 'defi.unsupportedNetwork';
|
|
22
|
-
case
|
|
22
|
+
case DefiErrorCode.NetworkError:
|
|
23
23
|
return 'defi.networkError';
|
|
24
|
-
case
|
|
24
|
+
case DefiErrorCode.ProviderNotFound:
|
|
25
25
|
return 'defi.providerNotFound';
|
|
26
|
-
case
|
|
26
|
+
case DefiErrorCode.NoDefaultProvider:
|
|
27
27
|
return 'defi.noDefaultProvider';
|
|
28
|
-
case
|
|
28
|
+
case DefiErrorCode.InvalidProvider:
|
|
29
29
|
return 'defi.invalidProvider';
|
|
30
|
-
case
|
|
30
|
+
case DefiErrorCode.InvalidParams:
|
|
31
31
|
return 'defi.invalidParams';
|
|
32
32
|
default:
|
|
33
33
|
return null;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) TonTech.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
import { formatUnits } from '@ton/appkit';
|
|
10
|
-
import clsx from 'clsx';
|
|
11
|
-
import { Block } from '../../../../components/ui/block';
|
|
12
|
-
import styles from './balance-badge.module.css';
|
|
13
|
-
import { Logo } from '../../../../components/ui/logo';
|
|
14
|
-
const BalanceBadgeContainer = ({ className, ...props }) => {
|
|
15
|
-
return _jsx(Block, { direction: "row", className: clsx(styles.balance, className), ...props });
|
|
16
|
-
};
|
|
17
|
-
const BalanceBlock = ({ className, ...props }) => {
|
|
18
|
-
return _jsx("div", { className: clsx(styles.balanceContainer, className), ...props });
|
|
19
|
-
};
|
|
20
|
-
const Balance = ({ balance, decimals, ...props }) => {
|
|
21
|
-
return _jsx("span", { ...props, children: balance ? formatUnits(balance, decimals) : '0' });
|
|
22
|
-
};
|
|
23
|
-
const BalanceSymbol = ({ className, symbol, ...props }) => {
|
|
24
|
-
return (_jsx("span", { className: clsx(styles.ticker, className), ...props, children: symbol }));
|
|
25
|
-
};
|
|
26
|
-
export const BalanceBadge = {
|
|
27
|
-
Container: BalanceBadgeContainer,
|
|
28
|
-
Icon: Logo,
|
|
29
|
-
BalanceBlock: BalanceBlock,
|
|
30
|
-
Symbol: BalanceSymbol,
|
|
31
|
-
Balance: Balance,
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=balance-badge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"balance-badge.js","sourceRoot":"","sources":["../../../../../../src/features/balances/components/balance-badge/balance-badge.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACxD,OAAO,MAAM,MAAM,4BAA4B,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAEtD,MAAM,qBAAqB,GAA8B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACjF,OAAO,KAAC,KAAK,IAAC,SAAS,EAAC,KAAK,EAAC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAAC;AAC5F,CAAC,CAAC;AAEF,MAAM,YAAY,GAA8B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACxE,OAAO,cAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAAC;AACnF,CAAC,CAAC;AAEF,MAAM,OAAO,GAAuE,CAAC,EACjF,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,EAAE;IACD,OAAO,kBAAU,KAAK,YAAG,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,GAAQ,CAAC;AACpF,CAAC,CAAC;AAEF,MAAM,aAAa,GAAoD,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACvG,OAAO,CACH,eAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,KAAM,KAAK,YACrD,MAAM,GACJ,CACV,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,SAAS,EAAE,qBAAqB;IAChC,IAAI,EAAE,IAAI;IACV,YAAY,EAAE,YAAY;IAC1B,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,OAAO;CACnB,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
.balance {
|
|
2
|
-
composes: labelMedium from "../../../../styles/typography.module.css";
|
|
3
|
-
|
|
4
|
-
width: fit-content;
|
|
5
|
-
gap: 12px;
|
|
6
|
-
padding: 12px;
|
|
7
|
-
color: var(--ta-color-text-secondary);
|
|
8
|
-
line-height: 1;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.balanceContainer {
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
gap: 4px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.ticker {
|
|
18
|
-
composes: labelSemibold from "../../../../styles/typography.module.css";
|
|
19
|
-
color: var(--ta-color-text);
|
|
20
|
-
line-height: 1;
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/features/balances/components/balance-badge/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) TonTech.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
import type { FC } from 'react';
|
|
9
|
-
export declare const BalanceBadge: {
|
|
10
|
-
Container: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
11
|
-
Icon: import("react").ForwardRefExoticComponent<import("../../../..").LogoProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
12
|
-
BalanceBlock: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
13
|
-
Symbol: FC<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
|
|
14
|
-
symbol: string;
|
|
15
|
-
}>;
|
|
16
|
-
Balance: FC<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
|
|
17
|
-
balance: string;
|
|
18
|
-
decimals: number;
|
|
19
|
-
}>;
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=balance-badge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"balance-badge.d.ts","sourceRoot":"","sources":["../../../../../../src/features/balances/components/balance-badge/balance-badge.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAkB,MAAM,OAAO,CAAC;AA+BhD,eAAO,MAAM,YAAY;;;;;gBARkC,MAAM;;;iBARX,MAAM;kBAAY,MAAM;;CAsB7E,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/balances/components/balance-badge/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) TonTech.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { formatUnits } from '@ton/appkit';
|
|
10
|
-
import type { FC, ComponentProps } from 'react';
|
|
11
|
-
import clsx from 'clsx';
|
|
12
|
-
|
|
13
|
-
import { Block } from '../../../../components/ui/block';
|
|
14
|
-
import styles from './balance-badge.module.css';
|
|
15
|
-
import { Logo } from '../../../../components/ui/logo';
|
|
16
|
-
|
|
17
|
-
const BalanceBadgeContainer: FC<ComponentProps<'div'>> = ({ className, ...props }) => {
|
|
18
|
-
return <Block direction="row" className={clsx(styles.balance, className)} {...props} />;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const BalanceBlock: FC<ComponentProps<'div'>> = ({ className, ...props }) => {
|
|
22
|
-
return <div className={clsx(styles.balanceContainer, className)} {...props} />;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const Balance: FC<ComponentProps<'span'> & { balance: string; decimals: number }> = ({
|
|
26
|
-
balance,
|
|
27
|
-
decimals,
|
|
28
|
-
...props
|
|
29
|
-
}) => {
|
|
30
|
-
return <span {...props}>{balance ? formatUnits(balance, decimals) : '0'}</span>;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const BalanceSymbol: FC<ComponentProps<'span'> & { symbol: string }> = ({ className, symbol, ...props }) => {
|
|
34
|
-
return (
|
|
35
|
-
<span className={clsx(styles.ticker, className)} {...props}>
|
|
36
|
-
{symbol}
|
|
37
|
-
</span>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const BalanceBadge = {
|
|
42
|
-
Container: BalanceBadgeContainer,
|
|
43
|
-
Icon: Logo,
|
|
44
|
-
BalanceBlock: BalanceBlock,
|
|
45
|
-
Symbol: BalanceSymbol,
|
|
46
|
-
Balance: Balance,
|
|
47
|
-
};
|