@ton/appkit-react 1.0.0-alpha.0 → 1.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +7 -6
  2. package/dist/esm/components/shared/amount-preview/amount-preview.js +17 -0
  3. package/dist/esm/components/shared/amount-preview/amount-preview.js.map +1 -0
  4. package/dist/esm/components/shared/amount-preview/amount-preview.module.css +40 -0
  5. package/dist/esm/{features/balances/components/balance-badge → components/shared/amount-preview}/index.js +1 -1
  6. package/dist/esm/components/shared/amount-preview/index.js.map +1 -0
  7. package/dist/esm/components/shared/flow-preview/flow-preview.js +24 -0
  8. package/dist/esm/components/shared/flow-preview/flow-preview.js.map +1 -0
  9. package/dist/esm/components/shared/flow-preview/flow-preview.module.css +37 -0
  10. package/dist/esm/components/shared/flow-preview/index.js +9 -0
  11. package/dist/esm/components/shared/flow-preview/index.js.map +1 -0
  12. package/dist/esm/components/shared/settings-button/settings-button.js +1 -1
  13. package/dist/esm/components/shared/settings-button/settings-button.js.map +1 -1
  14. package/dist/esm/components/ui/button/button.module.css +1 -1
  15. package/dist/esm/components/ui/logo/logo.module.css +1 -3
  16. package/dist/esm/components/ui/modal/modal.module.css +1 -1
  17. package/dist/esm/components/ui/tabs/tabs.module.css +1 -1
  18. package/dist/esm/features/balances/components/send-jetton-button/send-jetton-button.js +3 -3
  19. package/dist/esm/features/balances/components/send-jetton-button/send-jetton-button.js.map +1 -1
  20. package/dist/esm/features/balances/index.js +0 -1
  21. package/dist/esm/features/balances/index.js.map +1 -1
  22. package/dist/esm/features/staking/components/select-unstake-mode/select-unstake-mode.js +2 -1
  23. package/dist/esm/features/staking/components/select-unstake-mode/select-unstake-mode.js.map +1 -1
  24. package/dist/esm/features/staking/components/select-unstake-mode/select-unstake-mode.module.css +2 -6
  25. package/dist/esm/features/staking/components/staking-confirm-modal/index.js +9 -0
  26. package/dist/esm/features/staking/components/staking-confirm-modal/index.js.map +1 -0
  27. package/dist/esm/features/staking/components/staking-confirm-modal/staking-confirm-modal.js +46 -0
  28. package/dist/esm/features/staking/components/staking-confirm-modal/staking-confirm-modal.js.map +1 -0
  29. package/dist/esm/features/staking/components/staking-confirm-modal/staking-confirm-modal.module.css +11 -0
  30. package/dist/esm/features/staking/components/staking-widget-provider/staking-widget-provider.js +27 -4
  31. package/dist/esm/features/staking/components/staking-widget-provider/staking-widget-provider.js.map +1 -1
  32. package/dist/esm/features/staking/components/staking-widget-provider/use-staking-validation.js +12 -3
  33. package/dist/esm/features/staking/components/staking-widget-provider/use-staking-validation.js.map +1 -1
  34. package/dist/esm/features/staking/components/staking-widget-ui/staking-widget-ui.js +16 -4
  35. package/dist/esm/features/staking/components/staking-widget-ui/staking-widget-ui.js.map +1 -1
  36. package/dist/esm/features/staking/components/staking-widget-ui/staking-widget-ui.module.css +4 -0
  37. package/dist/esm/features/staking/hooks/use-build-stake-transaction.js +2 -2
  38. package/dist/esm/features/staking/hooks/use-build-stake-transaction.js.map +1 -1
  39. package/dist/esm/features/staking/utils/map-staking-error.js +6 -4
  40. package/dist/esm/features/staking/utils/map-staking-error.js.map +1 -1
  41. package/dist/esm/features/swap/components/swap-confirm-modal/index.js +9 -0
  42. package/dist/esm/features/swap/components/swap-confirm-modal/index.js.map +1 -0
  43. package/dist/esm/features/swap/components/swap-confirm-modal/swap-confirm-modal.js +12 -0
  44. package/dist/esm/features/swap/components/swap-confirm-modal/swap-confirm-modal.js.map +1 -0
  45. package/dist/esm/features/swap/components/swap-confirm-modal/swap-confirm-modal.module.css +7 -0
  46. package/dist/esm/features/swap/components/swap-widget-provider/swap-widget-provider.js +28 -6
  47. package/dist/esm/features/swap/components/swap-widget-provider/swap-widget-provider.js.map +1 -1
  48. package/dist/esm/features/swap/components/swap-widget-provider/use-swap-validation.js +12 -3
  49. package/dist/esm/features/swap/components/swap-widget-provider/use-swap-validation.js.map +1 -1
  50. package/dist/esm/features/swap/components/swap-widget-ui/swap-widget-ui.js +16 -4
  51. package/dist/esm/features/swap/components/swap-widget-ui/swap-widget-ui.js.map +1 -1
  52. package/dist/esm/features/swap/utils/map-swap-error.js +10 -8
  53. package/dist/esm/features/swap/utils/map-swap-error.js.map +1 -1
  54. package/dist/esm/locales/en.js +9 -0
  55. package/dist/esm/locales/en.js.map +1 -1
  56. package/dist/esm/styles/index.css +3 -3
  57. package/dist/esm/utils/map-defi-error.js +7 -7
  58. package/dist/esm/utils/map-defi-error.js.map +1 -1
  59. package/dist/types/components/shared/amount-preview/amount-preview.d.ts +24 -0
  60. package/dist/types/components/shared/amount-preview/amount-preview.d.ts.map +1 -0
  61. package/dist/types/{features/balances/components/balance-badge → components/shared/amount-preview}/index.d.ts +1 -1
  62. package/dist/types/components/shared/amount-preview/index.d.ts.map +1 -0
  63. package/dist/types/components/shared/flow-preview/flow-preview.d.ts +18 -0
  64. package/dist/types/components/shared/flow-preview/flow-preview.d.ts.map +1 -0
  65. package/dist/types/components/shared/flow-preview/index.d.ts +9 -0
  66. package/dist/types/components/shared/flow-preview/index.d.ts.map +1 -0
  67. package/dist/types/features/balances/index.d.ts +0 -1
  68. package/dist/types/features/balances/index.d.ts.map +1 -1
  69. package/dist/types/features/staking/components/select-unstake-mode/select-unstake-mode.d.ts.map +1 -1
  70. package/dist/types/features/staking/components/staking-confirm-modal/index.d.ts +9 -0
  71. package/dist/types/features/staking/components/staking-confirm-modal/index.d.ts.map +1 -0
  72. package/dist/types/features/staking/components/staking-confirm-modal/staking-confirm-modal.d.ts +23 -0
  73. package/dist/types/features/staking/components/staking-confirm-modal/staking-confirm-modal.d.ts.map +1 -0
  74. package/dist/types/features/staking/components/staking-widget-provider/staking-widget-provider.d.ts.map +1 -1
  75. package/dist/types/features/staking/components/staking-widget-provider/use-staking-validation.d.ts +3 -1
  76. package/dist/types/features/staking/components/staking-widget-provider/use-staking-validation.d.ts.map +1 -1
  77. package/dist/types/features/staking/components/staking-widget-ui/staking-widget-ui.d.ts.map +1 -1
  78. package/dist/types/features/staking/hooks/use-build-stake-transaction.d.ts +3 -2
  79. package/dist/types/features/staking/hooks/use-build-stake-transaction.d.ts.map +1 -1
  80. package/dist/types/features/staking/utils/map-staking-error.d.ts +5 -3
  81. package/dist/types/features/staking/utils/map-staking-error.d.ts.map +1 -1
  82. package/dist/types/features/swap/components/swap-confirm-modal/index.d.ts +9 -0
  83. package/dist/types/features/swap/components/swap-confirm-modal/index.d.ts.map +1 -0
  84. package/dist/types/features/swap/components/swap-confirm-modal/swap-confirm-modal.d.ts +26 -0
  85. package/dist/types/features/swap/components/swap-confirm-modal/swap-confirm-modal.d.ts.map +1 -0
  86. package/dist/types/features/swap/components/swap-widget-provider/swap-widget-provider.d.ts.map +1 -1
  87. package/dist/types/features/swap/components/swap-widget-provider/use-swap-validation.d.ts +4 -1
  88. package/dist/types/features/swap/components/swap-widget-provider/use-swap-validation.d.ts.map +1 -1
  89. package/dist/types/features/swap/components/swap-widget-ui/swap-widget-ui.d.ts.map +1 -1
  90. package/dist/types/features/swap/utils/map-swap-error.d.ts +4 -2
  91. package/dist/types/features/swap/utils/map-swap-error.d.ts.map +1 -1
  92. package/dist/types/libs/i18n.d.ts +9 -0
  93. package/dist/types/libs/i18n.d.ts.map +1 -1
  94. package/dist/types/locales/en.d.ts +9 -0
  95. package/dist/types/locales/en.d.ts.map +1 -1
  96. package/package.json +12 -12
  97. package/src/components/shared/amount-preview/amount-preview.tsx +74 -0
  98. package/src/{features/balances/components/balance-badge → components/shared/amount-preview}/index.ts +1 -1
  99. package/src/components/shared/flow-preview/flow-preview.tsx +64 -0
  100. package/src/components/shared/flow-preview/index.ts +9 -0
  101. package/src/components/shared/settings-button/settings-button.tsx +1 -1
  102. package/src/features/balances/components/send-jetton-button/send-jetton-button.tsx +3 -3
  103. package/src/features/balances/index.ts +0 -1
  104. package/src/features/staking/components/select-unstake-mode/select-unstake-mode.tsx +12 -4
  105. package/src/features/staking/components/staking-confirm-modal/index.ts +9 -0
  106. package/src/features/staking/components/staking-confirm-modal/staking-confirm-modal.tsx +121 -0
  107. package/src/features/staking/components/staking-widget-provider/staking-widget-provider.tsx +39 -4
  108. package/src/features/staking/components/staking-widget-provider/use-staking-validation.ts +14 -2
  109. package/src/features/staking/components/staking-widget-ui/staking-widget-ui.tsx +39 -13
  110. package/src/features/staking/hooks/use-build-stake-transaction.ts +7 -2
  111. package/src/features/staking/utils/map-staking-error.ts +6 -4
  112. package/src/features/swap/components/swap-confirm-modal/index.ts +9 -0
  113. package/src/features/swap/components/swap-confirm-modal/swap-confirm-modal.tsx +75 -0
  114. package/src/features/swap/components/swap-widget-provider/swap-widget-provider.tsx +40 -6
  115. package/src/features/swap/components/swap-widget-provider/use-swap-validation.ts +17 -2
  116. package/src/features/swap/components/swap-widget-ui/swap-widget-ui.tsx +30 -3
  117. package/src/features/swap/utils/map-swap-error.ts +10 -8
  118. package/src/locales/en.ts +9 -0
  119. package/src/utils/map-defi-error.ts +7 -7
  120. package/dist/esm/features/balances/components/balance-badge/balance-badge.js +0 -33
  121. package/dist/esm/features/balances/components/balance-badge/balance-badge.js.map +0 -1
  122. package/dist/esm/features/balances/components/balance-badge/balance-badge.module.css +0 -21
  123. package/dist/esm/features/balances/components/balance-badge/index.js.map +0 -1
  124. package/dist/esm/tsconfig.build.tsbuildinfo +0 -1
  125. package/dist/types/features/balances/components/balance-badge/balance-badge.d.ts +0 -21
  126. package/dist/types/features/balances/components/balance-badge/balance-badge.d.ts.map +0 -1
  127. package/dist/types/features/balances/components/balance-badge/index.d.ts.map +0 -1
  128. package/src/features/balances/components/balance-badge/balance-badge.tsx +0 -47
@@ -0,0 +1,18 @@
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, ComponentProps } from 'react';
9
+ import type { AppkitUIToken } from '../../../types/appkit-ui-token';
10
+ export interface FlowPreviewProps extends ComponentProps<'div'> {
11
+ fromAmount: string;
12
+ toAmount: string;
13
+ fromToken?: AppkitUIToken;
14
+ toToken?: AppkitUIToken;
15
+ fiatSymbol?: string;
16
+ }
17
+ export declare const FlowPreview: FC<FlowPreviewProps>;
18
+ //# sourceMappingURL=flow-preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-preview.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/flow-preview/flow-preview.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAMhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAGpE,MAAM,WAAW,gBAAiB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAC3D,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAaD,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA2B5C,CAAC"}
@@ -0,0 +1,9 @@
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
+ export * from './flow-preview';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/flow-preview/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,gBAAgB,CAAC"}
@@ -6,7 +6,6 @@
6
6
  *
7
7
  */
8
8
  export * from './components/currency-item';
9
- export * from './components/balance-badge';
10
9
  export * from './components/send-ton-button';
11
10
  export * from './components/send-jetton-button';
12
11
  export * from './hooks/use-balance';
@@ -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,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"}
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"}
@@ -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;AAQ9F,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,CA8FxD,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"}
@@ -0,0 +1,9 @@
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
+ export * from './staking-confirm-modal';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/staking/components/staking-confirm-modal/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,23 @@
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
+ import type { Network, StakingProviderInfo, StakingProviderMetadata, StakingQuote, StakingQuoteDirection } from '@ton/appkit';
10
+ export interface StakingConfirmModalProps {
11
+ open: boolean;
12
+ onClose: () => void;
13
+ onConfirm: () => void;
14
+ direction: StakingQuoteDirection;
15
+ network: Network | undefined;
16
+ quote: StakingQuote | undefined;
17
+ providerInfo: StakingProviderInfo | undefined;
18
+ providerMetadata: StakingProviderMetadata | undefined;
19
+ isProviderInfoLoading: boolean;
20
+ isQuoteLoading: boolean;
21
+ }
22
+ export declare const StakingConfirmModal: FC<StakingConfirmModalProps>;
23
+ //# sourceMappingURL=staking-confirm-modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"staking-confirm-modal.d.ts","sourceRoot":"","sources":["../../../../../../src/features/staking/components/staking-confirm-modal/staking-confirm-modal.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAER,OAAO,EACP,mBAAmB,EACnB,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,EAExB,MAAM,aAAa,CAAC;AAYrB,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,EAAE,qBAAqB,CAAC;IACjC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,KAAK,EAAE,YAAY,GAAG,SAAS,CAAC;IAChC,YAAY,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAC9C,gBAAgB,EAAE,uBAAuB,GAAG,SAAS,CAAC;IACtD,qBAAqB,EAAE,OAAO,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;CAC3B;AAuBD,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAyD5D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"staking-widget-provider.d.ts","sourceRoot":"","sources":["../../../../../../src/features/staking/components/staking-widget-provider/staking-widget-provider.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAgB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AC5B,cAAc,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAC7C,iDAAiD;IACjD,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,4CAA4C;IAC5C,iBAAiB,EAAE,CAAC,SAAS,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC9D,kDAAkD;IAClD,oBAAoB,EAAE,OAAO,CAAC;IAC9B,0EAA0E;IAC1E,UAAU,EAAE,OAAO,CAAC;IACpB,8DAA8D;IAC9D,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,sDAAsD;IACtD,cAAc,EAAE,MAAM,CAAC;IACvB,uGAAuG;IACvG,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,6EAA6E;IAC7E,uBAAuB,EAAE,OAAO,CAAC;IACjC,oGAAoG;IACpG,cAAc,EAAE,QAAQ,GAAG,OAAO,CAAC;IACnC,8GAA8G;IAC9G,qBAAqB,EAAE,MAAM,CAAC;IAC9B,kGAAkG;IAClG,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,iEAAiE;IACjE,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAClC;AAED,eAAO,MAAM,cAAc,6CAiCzB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB,0BAE7B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC3D;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,oBAAoB,CA2P1D,CAAC"}
1
+ {"version":3,"file":"staking-widget-provider.d.ts","sourceRoot":"","sources":["../../../../../../src/features/staking/components/staking-widget-provider/staking-widget-provider.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,E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AC;IACpC,4BAA4B;IAC5B,cAAc,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAC7C,iDAAiD;IACjD,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,4CAA4C;IAC5C,iBAAiB,EAAE,CAAC,SAAS,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC9D,kDAAkD;IAClD,oBAAoB,EAAE,OAAO,CAAC;IAC9B,0EAA0E;IAC1E,UAAU,EAAE,OAAO,CAAC;IACpB,8DAA8D;IAC9D,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,sDAAsD;IACtD,cAAc,EAAE,MAAM,CAAC;IACvB,uGAAuG;IACvG,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,6EAA6E;IAC7E,uBAAuB,EAAE,OAAO,CAAC;IACjC,oGAAoG;IACpG,cAAc,EAAE,QAAQ,GAAG,OAAO,CAAC;IACnC,8GAA8G;IAC9G,qBAAqB,EAAE,MAAM,CAAC;IAC9B,kGAAkG;IAClG,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,iEAAiE;IACjE,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAClC;AAED,eAAO,MAAM,cAAc,6CAiCzB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB,0BAE7B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC3D;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,oBAAoB,CA8R1D,CAAC"}
@@ -12,13 +12,15 @@ interface UseStakingValidationOptions {
12
12
  balance: string | undefined;
13
13
  quote?: StakingQuote;
14
14
  quoteError: Error | null;
15
+ /** Error from the build/send mutation. Takes priority over input validation but does not block submit. */
16
+ sendError: Error | null;
15
17
  direction: StakingQuoteDirection;
16
18
  amountDecimals?: number;
17
19
  isReversed: boolean;
18
20
  stakedBalance?: string;
19
21
  isNetworkSupported: boolean;
20
22
  }
21
- export declare const useStakingValidation: ({ amount, amountDebounced, balance, quote, quoteError, direction, amountDecimals, isReversed, stakedBalance, isNetworkSupported, }: UseStakingValidationOptions) => {
23
+ export declare const useStakingValidation: ({ amount, amountDebounced, balance, quote, quoteError, sendError, direction, amountDecimals, isReversed, stakedBalance, isNetworkSupported, }: UseStakingValidationOptions) => {
22
24
  error: string | null;
23
25
  canSubmit: boolean;
24
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-staking-validation.d.ts","sourceRoot":"","sources":["../../../../../../src/features/staking/components/staking-widget-provider/use-staking-validation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKvE,UAAU,2BAA2B;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,UAAU,EAAE,KAAK,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,qBAAqB,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,oBAAoB,GAAI,oIAWlC,2BAA2B;;;CAwC7B,CAAC"}
1
+ {"version":3,"file":"use-staking-validation.d.ts","sourceRoot":"","sources":["../../../../../../src/features/staking/components/staking-widget-provider/use-staking-validation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKvE,UAAU,2BAA2B;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,UAAU,EAAE,KAAK,GAAG,IAAI,CAAC;IACzB,0GAA0G;IAC1G,SAAS,EAAE,KAAK,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,qBAAqB,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,oBAAoB,GAAI,+IAYlC,2BAA2B;;;CAiD7B,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,CAyKxD,CAAC"}
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;AAa3D,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,CAkMxD,CAAC"}
@@ -6,10 +6,11 @@
6
6
  *
7
7
  */
8
8
  import type { UseMutationResult } from '@tanstack/react-query';
9
- import type { BuildStakeTransactionData, BuildStakeTransactionErrorType, BuildStakeTransactionVariables } from '@ton/appkit/queries';
9
+ import type { BuildStakeTransactionData, BuildStakeTransactionErrorType, BuildStakeTransactionMutationOptions, BuildStakeTransactionVariables } from '@ton/appkit/queries';
10
+ export type UseBuildStakeTransactionParameters<context = unknown> = BuildStakeTransactionMutationOptions<context>;
10
11
  export type UseBuildStakeTransactionReturnType<context = unknown> = UseMutationResult<BuildStakeTransactionData, BuildStakeTransactionErrorType, BuildStakeTransactionVariables, context>;
11
12
  /**
12
13
  * Hook to build stake transaction
13
14
  */
14
- export declare const useBuildStakeTransaction: <context = unknown>() => UseBuildStakeTransactionReturnType<context>;
15
+ export declare const useBuildStakeTransaction: <context = unknown>(parameters?: UseBuildStakeTransactionParameters<context>) => UseBuildStakeTransactionReturnType<context>;
15
16
  //# sourceMappingURL=use-build-stake-transaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-build-stake-transaction.d.ts","sourceRoot":"","sources":["../../../../../src/features/staking/hooks/use-build-stake-transaction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,KAAK,EACR,yBAAyB,EACzB,8BAA8B,EAC9B,8BAA8B,EACjC,MAAM,qBAAqB,CAAC;AAK7B,MAAM,MAAM,kCAAkC,CAAC,OAAO,GAAG,OAAO,IAAI,iBAAiB,CACjF,yBAAyB,EACzB,8BAA8B,EAC9B,8BAA8B,EAC9B,OAAO,CACV,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,GAAG,OAAO,OAAK,kCAAkC,CAAC,OAAO,CAGxG,CAAC"}
1
+ {"version":3,"file":"use-build-stake-transaction.d.ts","sourceRoot":"","sources":["../../../../../src/features/staking/hooks/use-build-stake-transaction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,KAAK,EACR,yBAAyB,EACzB,8BAA8B,EAC9B,oCAAoC,EACpC,8BAA8B,EACjC,MAAM,qBAAqB,CAAC;AAK7B,MAAM,MAAM,kCAAkC,CAAC,OAAO,GAAG,OAAO,IAAI,oCAAoC,CAAC,OAAO,CAAC,CAAC;AAElH,MAAM,MAAM,kCAAkC,CAAC,OAAO,GAAG,OAAO,IAAI,iBAAiB,CACjF,yBAAyB,EACzB,8BAA8B,EAC9B,8BAA8B,EAC9B,OAAO,CACV,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,GAAG,OAAO,EACtD,aAAa,kCAAkC,CAAC,OAAO,CAAC,KACzD,kCAAkC,CAAC,OAAO,CAG5C,CAAC"}
@@ -6,8 +6,10 @@
6
6
  *
7
7
  */
8
8
  /**
9
- * Map a thrown staking error to an i18n key. Tries staking-specific codes first, falls back to the
10
- * shared {@link mapDefiError} for base DeFi codes, and finally to a generic `staking.quoteError`.
9
+ * Map a thrown staking error to an i18n key. Tries staking-specific codes first, falls back to
10
+ * the shared {@link mapDefiError} for base DeFi codes, and finally to the caller-provided
11
+ * {@link fallback} (defaults to `staking.quoteError`, but send-time callers should pass
12
+ * `staking.sendFailed`).
11
13
  */
12
- export declare const mapStakingError: (error: unknown) => string;
14
+ export declare const mapStakingError: (error: unknown, fallback?: string) => string;
13
15
  //# sourceMappingURL=map-staking-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"map-staking-error.d.ts","sourceRoot":"","sources":["../../../../../src/features/staking/utils/map-staking-error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,MAWhD,CAAC"}
1
+ {"version":3,"file":"map-staking-error.d.ts","sourceRoot":"","sources":["../../../../../src/features/staking/utils/map-staking-error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,EAAE,WAAU,MAA6B,KAAG,MAWzF,CAAC"}
@@ -0,0 +1,9 @@
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
+ export * from './swap-confirm-modal';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/swap/components/swap-confirm-modal/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,26 @@
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
+ import type { SwapProvider, SwapQuote } from '@ton/appkit';
10
+ import type { AppkitUIToken } from '../../../../types/appkit-ui-token';
11
+ export interface SwapConfirmModalProps {
12
+ open: boolean;
13
+ onClose: () => void;
14
+ onConfirm: () => void;
15
+ fromToken: AppkitUIToken | null;
16
+ toToken: AppkitUIToken | null;
17
+ fromAmount: string;
18
+ toAmount: string;
19
+ fiatSymbol: string;
20
+ quote?: SwapQuote;
21
+ swapProvider?: SwapProvider;
22
+ slippage: number;
23
+ isQuoteLoading?: boolean;
24
+ }
25
+ export declare const SwapConfirmModal: FC<SwapConfirmModalProps>;
26
+ //# sourceMappingURL=swap-confirm-modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swap-confirm-modal.d.ts","sourceRoot":"","sources":["../../../../../../src/features/swap/components/swap-confirm-modal/swap-confirm-modal.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAM3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAIvE,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;IAChC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAwCtD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"swap-widget-provider.d.ts","sourceRoot":"","sources":["../../../../../../src/features/swap/components/swap-widget-provider/swap-widget-provider.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAchD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAMvE,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,iDAAiD;IACjD,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,sCAAsC;I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AAC;IACnB,8DAA8D;IAC9D,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,oCAAoC;IACpC,mBAAmB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,sDAAsD;IACtD,oBAAoB,EAAE,OAAO,CAAC;IAC9B,6EAA6E;IAC7E,uBAAuB,EAAE,OAAO,CAAC;IACjC,oGAAoG;IACpG,cAAc,EAAE,QAAQ,GAAG,OAAO,CAAC;IACnC,8GAA8G;IAC9G,qBAAqB,EAAE,MAAM,CAAC;IAC9B,kGAAkG;IAClG,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,iEAAiE;IACjE,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAClC;AAED,eAAO,MAAM,WAAW,0CAgCtB,CAAC;AAEH;;;GAGG;AACH,wBAAgB,cAAc,oBAE7B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IACxD,2DAA2D;IAC3D,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,2FAA2F;IAC3F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wEAAwE;IACxE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,iBAAiB,CAsNpD,CAAC"}
1
+ {"version":3,"file":"swap-widget-provider.d.ts","sourceRoot":"","sources":["../../../../../../src/features/swap/components/swap-widget-provider/swap-widget-provider.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK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AC,iBAAiB,CAwPpD,CAAC"}
@@ -5,6 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
+ import type { SwapQuote } from '@ton/appkit';
8
9
  import type { AppkitUIToken } from '../../../../types/appkit-ui-token';
9
10
  interface UseSwapValidationOptions {
10
11
  fromAmount: string;
@@ -12,10 +13,12 @@ interface UseSwapValidationOptions {
12
13
  fromToken: AppkitUIToken | null;
13
14
  toToken: AppkitUIToken | null;
14
15
  fromBalance: string | undefined;
16
+ quote: SwapQuote | undefined;
15
17
  quoteError: Error | null;
18
+ sendError: Error | null;
16
19
  isNetworkSupported: boolean;
17
20
  }
18
- export declare function useSwapValidation({ fromAmount, fromAmountDebounced, fromToken, toToken, fromBalance, quoteError, isNetworkSupported, }: UseSwapValidationOptions): {
21
+ export declare function useSwapValidation({ fromAmount, fromAmountDebounced, fromToken, toToken, fromBalance, quote, quoteError, sendError, isNetworkSupported, }: UseSwapValidationOptions): {
19
22
  error: string | null;
20
23
  canSubmit: boolean;
21
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-swap-validation.d.ts","sourceRoot":"","sources":["../../../../../../src/features/swap/components/swap-widget-provider/use-swap-validation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAIvE,UAAU,wBAAwB;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;IAChC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,UAAU,EAAE,KAAK,GAAG,IAAI,CAAC;IACzB,kBAAkB,EAAE,OAAO,CAAC;CAC/B;AAED,wBAAgB,iBAAiB,CAAC,EAC9B,UAAU,EACV,mBAAmB,EACnB,SAAS,EACT,OAAO,EACP,WAAW,EACX,UAAU,EACV,kBAAkB,GACrB,EAAE,wBAAwB;;;EAkB1B"}
1
+ {"version":3,"file":"use-swap-validation.d.ts","sourceRoot":"","sources":["../../../../../../src/features/swap/components/swap-widget-provider/use-swap-validation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAIvE,UAAU,wBAAwB;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;IAChC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B,UAAU,EAAE,KAAK,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,KAAK,GAAG,IAAI,CAAC;IACxB,kBAAkB,EAAE,OAAO,CAAC;CAC/B;AAED,wBAAgB,iBAAiB,CAAC,EAC9B,UAAU,EACV,mBAAmB,EACnB,SAAS,EACT,OAAO,EACP,WAAW,EACX,KAAK,EACL,UAAU,EACV,SAAS,EACT,kBAAkB,GACrB,EAAE,wBAAwB;;;EA4B1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"swap-widget-ui.d.ts","sourceRoot":"","sources":["../../../../../../src/features/swap/components/swap-widget-ui/swap-widget-ui.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAYhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI/D,MAAM,MAAM,qBAAqB,GAAG,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE5E,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,qBAAqB,CA4IlD,CAAC"}
1
+ {"version":3,"file":"swap-widget-ui.d.ts","sourceRoot":"","sources":["../../../../../../src/features/swap/components/swap-widget-ui/swap-widget-ui.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAahD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI/D,MAAM,MAAM,qBAAqB,GAAG,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE5E,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,qBAAqB,CAsKlD,CAAC"}
@@ -7,7 +7,9 @@
7
7
  */
8
8
  /**
9
9
  * Map a thrown swap error to an i18n key. Tries swap-specific codes first, falls back to the
10
- * shared {@link mapDefiError} for base DeFi codes, and finally to a generic `swap.quoteError`.
10
+ * shared {@link mapDefiError} for base DeFi codes, and finally to the caller-provided
11
+ * {@link fallback} (defaults to `swap.quoteError`, but send-time callers should pass
12
+ * `swap.sendFailed`).
11
13
  */
12
- export declare const mapSwapError: (error: unknown) => string;
14
+ export declare const mapSwapError: (error: unknown, fallback?: string) => string;
13
15
  //# sourceMappingURL=map-swap-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"map-swap-error.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/utils/map-swap-error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,MAe7C,CAAC"}
1
+ {"version":3,"file":"map-swap-error.d.ts","sourceRoot":"","sources":["../../../../../src/features/swap/utils/map-swap-error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,EAAE,WAAU,MAA0B,KAAG,MAenF,CAAC"}
@@ -66,6 +66,10 @@ export declare const i18n: rosetta.Rosetta<{
66
66
  readonly provider: "Provider";
67
67
  readonly save: "Save";
68
68
  readonly minReceived: "Min Received";
69
+ readonly confirmTitle: "Confirm swap transaction";
70
+ readonly confirm: "Confirm";
71
+ readonly sendFailed: "Transaction failed";
72
+ readonly loading: "Loading...";
69
73
  };
70
74
  readonly lowBalance: {
71
75
  readonly title: "Not enough TON";
@@ -100,6 +104,11 @@ export declare const i18n: rosetta.Rosetta<{
100
104
  readonly provider: "Provider";
101
105
  readonly settings: "Staking settings";
102
106
  readonly save: "Save";
107
+ readonly confirmStakingTitle: "Confirm staking";
108
+ readonly confirmUnstakingTitle: "Confirm unstaking";
109
+ readonly confirm: "Confirm";
110
+ readonly sendFailed: "Transaction failed";
111
+ readonly loading: "Loading...";
103
112
  };
104
113
  }>;
105
114
  export { en };
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/libs/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,MAAM,eAAe,CAAC;AAE/B,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAkB,CAAC;AACpC,OAAO,EAAE,EAAE,EAAE,CAAC;AACd,eAAO,MAAM,eAAe,OAAO,CAAC;AAIpC,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC;AAC/B,MAAM,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/libs/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,MAAM,eAAe,CAAC;AAE/B,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAkB,CAAC;AACpC,OAAO,EAAE,EAAE,EAAE,CAAC;AACd,eAAO,MAAM,eAAe,OAAO,CAAC;AAIpC,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC;AAC/B,MAAM,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC"}
@@ -64,6 +64,10 @@ declare const _default: {
64
64
  readonly provider: "Provider";
65
65
  readonly save: "Save";
66
66
  readonly minReceived: "Min Received";
67
+ readonly confirmTitle: "Confirm swap transaction";
68
+ readonly confirm: "Confirm";
69
+ readonly sendFailed: "Transaction failed";
70
+ readonly loading: "Loading...";
67
71
  };
68
72
  readonly lowBalance: {
69
73
  readonly title: "Not enough TON";
@@ -98,6 +102,11 @@ declare const _default: {
98
102
  readonly provider: "Provider";
99
103
  readonly settings: "Staking settings";
100
104
  readonly save: "Save";
105
+ readonly confirmStakingTitle: "Confirm staking";
106
+ readonly confirmUnstakingTitle: "Confirm unstaking";
107
+ readonly confirm: "Confirm";
108
+ readonly sendFailed: "Transaction failed";
109
+ readonly loading: "Loading...";
101
110
  };
102
111
  };
103
112
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../src/locales/en.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wBAiHW"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../src/locales/en.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wBA0HW"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ton/appkit-react",
3
- "version": "1.0.0-alpha.0",
3
+ "version": "1.0.0-alpha.2",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,27 +33,27 @@
33
33
  }
34
34
  },
35
35
  "dependencies": {
36
- "clsx": "2.1.1",
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.0"
39
+ "@ton/appkit": "1.0.0-alpha.2"
40
40
  },
41
41
  "devDependencies": {
42
- "@storybook/addon-docs": "10.3.5",
43
- "@storybook/react": "10.3.5",
44
- "@storybook/react-vite": "10.3.5",
42
+ "@storybook/addon-docs": "10.4.1",
43
+ "@storybook/react": "10.4.1",
44
+ "@storybook/react-vite": "10.4.1",
45
45
  "@storybook/test": "^8.6.15",
46
- "@tanstack/react-query": "5.99.0",
47
- "@tonconnect/ui-react": "2.5.0-alpha.0",
46
+ "@tanstack/react-query": "^5.100.14",
47
+ "@tonconnect/ui-react": "^2.5.0-alpha.0",
48
48
  "@types/react": "19.2.3",
49
49
  "@types/react-dom": "19.2.3",
50
+ "buffer": "^6.0.3",
50
51
  "copyfiles": "2.4.1",
51
52
  "react": "19.2.3",
52
53
  "react-dom": "19.2.3",
53
- "storybook": "10.3.5",
54
- "typescript": "^5.9.3",
55
- "vite": "^8.0.8",
56
- "vite-plugin-node-polyfills": "^0.26.0"
54
+ "storybook": "10.4.1",
55
+ "typescript": "5.9.3",
56
+ "vite": "8.0.14"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@tanstack/react-query": ">=5.0.0",
@@ -0,0 +1,74 @@
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 type { FC, ComponentProps } from 'react';
10
+ import { calcFiatValue, formatLargeValue } from '@ton/appkit';
11
+ import clsx from 'clsx';
12
+
13
+ import { Logo } from '../../ui/logo';
14
+ import { TonIconCircle } from '../../ui/icons';
15
+ import type { AppkitUIToken } from '../../../types/appkit-ui-token';
16
+ import { getDisplayAmount } from '../../../features/swap/utils/get-display-amount';
17
+ import styles from './amount-preview.module.css';
18
+
19
+ export interface AmountPreviewProps extends ComponentProps<'div'> {
20
+ /** Raw token amount to display (decimal string). */
21
+ amount: string;
22
+ /** Token whose logo and symbol are shown alongside the amount. */
23
+ token?: AppkitUIToken;
24
+ /** Fiat currency symbol, e.g. "$". */
25
+ fiatSymbol?: string;
26
+ /**
27
+ * Relative fiat delta to render after the fiat value, e.g. -0.0025 → "(-0.25%)".
28
+ * Typically computed by a parent that knows both legs of a flow.
29
+ */
30
+ fiatDelta?: number;
31
+ }
32
+
33
+ const formatFiatDelta = (delta: number): string => {
34
+ const sign = delta > 0 ? '+' : '';
35
+ return `(${sign}${(delta * 100).toFixed(2)}%)`;
36
+ };
37
+
38
+ export const AmountPreview: FC<AmountPreviewProps> = ({
39
+ amount,
40
+ token,
41
+ fiatSymbol = '$',
42
+ fiatDelta,
43
+ className,
44
+ ...props
45
+ }) => {
46
+ const displayAmount = getDisplayAmount(amount, token?.decimals);
47
+ const fiatValue = token?.rate ? formatLargeValue(calcFiatValue(amount || '0', token.rate), 2, 2) : null;
48
+
49
+ return (
50
+ <div className={clsx(styles.container, className)} {...props}>
51
+ <div className={styles.amountRow}>
52
+ <span className={styles.amount}>{displayAmount}</span>
53
+ {token && (
54
+ <span className={styles.tokenTag}>
55
+ {token.address === 'ton' ? (
56
+ <TonIconCircle size={24} />
57
+ ) : (
58
+ <Logo size={24} src={token.logo} fallback={token.symbol?.[0] ?? '?'} alt={token.symbol} />
59
+ )}
60
+ <span className={styles.symbol}>{token.symbol}</span>
61
+ </span>
62
+ )}
63
+ </div>
64
+ {fiatValue !== null && (
65
+ <div className={styles.fiat}>
66
+ <span>
67
+ {fiatSymbol} {fiatValue}
68
+ </span>
69
+ {fiatDelta !== undefined && <span className={styles.fiatDelta}>{formatFiatDelta(fiatDelta)}</span>}
70
+ </div>
71
+ )}
72
+ </div>
73
+ );
74
+ };
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- export { BalanceBadge } from './balance-badge';
9
+ export * from './amount-preview';
@@ -0,0 +1,64 @@
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 type { FC, ComponentProps } from 'react';
10
+ import { calcFiatValue } from '@ton/appkit';
11
+ import clsx from 'clsx';
12
+
13
+ import { ChevronDownIcon } from '../../ui/icons';
14
+ import { AmountPreview } from '../amount-preview';
15
+ import type { AppkitUIToken } from '../../../types/appkit-ui-token';
16
+ import styles from './flow-preview.module.css';
17
+
18
+ export interface FlowPreviewProps extends ComponentProps<'div'> {
19
+ fromAmount: string;
20
+ toAmount: string;
21
+ fromToken?: AppkitUIToken;
22
+ toToken?: AppkitUIToken;
23
+ fiatSymbol?: string;
24
+ }
25
+
26
+ /**
27
+ * Returns the relative fiat delta between paying `fromFiat` and receiving `toFiat`,
28
+ * or `undefined` when either side lacks fiat data.
29
+ */
30
+ const calcFiatDelta = (fromFiat: string, toFiat: string): number | undefined => {
31
+ const from = parseFloat(fromFiat);
32
+ const to = parseFloat(toFiat);
33
+ if (!from || !to) return undefined;
34
+ return (to - from) / from;
35
+ };
36
+
37
+ export const FlowPreview: FC<FlowPreviewProps> = ({
38
+ fromAmount,
39
+ toAmount,
40
+ fromToken,
41
+ toToken,
42
+ fiatSymbol = '$',
43
+ className,
44
+ ...props
45
+ }) => {
46
+ const fromFiat = calcFiatValue(fromAmount || '0', fromToken?.rate);
47
+ const toFiat = calcFiatValue(toAmount || '0', toToken?.rate);
48
+ const fiatDelta = calcFiatDelta(fromFiat, toFiat);
49
+
50
+ return (
51
+ <div className={clsx(styles.container, className)} {...props}>
52
+ <AmountPreview amount={fromAmount} token={fromToken} fiatSymbol={fiatSymbol} />
53
+
54
+ <div className={styles.separator}>
55
+ <span className={styles.separatorLine} />
56
+ <span className={styles.arrowBadge}>
57
+ <ChevronDownIcon size={16} />
58
+ </span>
59
+ </div>
60
+
61
+ <AmountPreview amount={toAmount} token={toToken} fiatSymbol={fiatSymbol} fiatDelta={fiatDelta} />
62
+ </div>
63
+ );
64
+ };
@@ -0,0 +1,9 @@
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
+ export * from './flow-preview';
@@ -21,7 +21,7 @@ export const SettingsButton: FC<SettingsButtonProps> = ({ onClick, className, ..
21
21
  return (
22
22
  <Button
23
23
  className={clsx(styles.settingsButton, className)}
24
- variant="secondary"
24
+ variant="gray"
25
25
  size="l"
26
26
  borderRadius="l"
27
27
  onClick={onClick}
@@ -40,7 +40,7 @@ export const SendJettonButton: FC<SendJettonButtonProps> = ({
40
40
  throw new Error('Jetton address is required');
41
41
  }
42
42
 
43
- if (!jetton.decimals) {
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 || !jetton.decimals}
71
+ disabled={!recipientAddress || !amount || !jetton.address || jetton.decimals === undefined}
72
72
  {...props}
73
73
  />
74
74
  );
@@ -7,7 +7,6 @@
7
7
  */
8
8
 
9
9
  export * from './components/currency-item';
10
- export * from './components/balance-badge';
11
10
  export * from './components/send-ton-button';
12
11
  export * from './components/send-jetton-button';
13
12