@reown/appkit-ui-react-native 0.0.0-canary-20240912195440 → 0.0.0-develop-20240925193922
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/lib/commonjs/assets/svg/ArrowBottomCircle.js +21 -0
- package/lib/commonjs/assets/svg/ArrowBottomCircle.js.map +1 -0
- package/lib/commonjs/assets/svg/Paperplane.js +21 -0
- package/lib/commonjs/assets/svg/Paperplane.js.map +1 -0
- package/lib/commonjs/components/wui-icon/index.js +4 -0
- package/lib/commonjs/components/wui-icon/index.js.map +1 -1
- package/lib/commonjs/composites/wui-account-button/index.js +13 -7
- package/lib/commonjs/composites/wui-account-button/index.js.map +1 -1
- package/lib/commonjs/composites/wui-account-button/styles.js +3 -3
- package/lib/commonjs/composites/wui-account-button/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-account-pill/index.js +73 -0
- package/lib/commonjs/composites/wui-account-pill/index.js.map +1 -0
- package/lib/commonjs/composites/wui-account-pill/styles.js +25 -0
- package/lib/commonjs/composites/wui-account-pill/styles.js.map +1 -0
- package/lib/commonjs/composites/wui-avatar/styles.js +2 -1
- package/lib/commonjs/composites/wui-avatar/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-balance/index.js +27 -0
- package/lib/commonjs/composites/wui-balance/index.js.map +1 -0
- package/lib/commonjs/composites/wui-banner/index.js +36 -0
- package/lib/commonjs/composites/wui-banner/index.js.map +1 -0
- package/lib/commonjs/composites/wui-banner/styles.js +21 -0
- package/lib/commonjs/composites/wui-banner/styles.js.map +1 -0
- package/lib/commonjs/composites/wui-button/index.js +3 -3
- package/lib/commonjs/composites/wui-button/index.js.map +1 -1
- package/lib/commonjs/composites/wui-button/styles.js +2 -2
- package/lib/commonjs/composites/wui-button/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-chip/index.js +5 -7
- package/lib/commonjs/composites/wui-chip/index.js.map +1 -1
- package/lib/commonjs/composites/wui-chip/styles.js +1 -1
- package/lib/commonjs/composites/wui-chip/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-compatible-network/index.js +58 -0
- package/lib/commonjs/composites/wui-compatible-network/index.js.map +1 -0
- package/lib/commonjs/composites/wui-list-item/index.js +10 -10
- package/lib/commonjs/composites/wui-list-item/index.js.map +1 -1
- package/lib/commonjs/composites/wui-list-item/styles.js +4 -3
- package/lib/commonjs/composites/wui-list-item/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-list-token/index.js +78 -0
- package/lib/commonjs/composites/wui-list-token/index.js.map +1 -0
- package/lib/commonjs/composites/wui-list-token/styles.js +30 -0
- package/lib/commonjs/composites/wui-list-token/styles.js.map +1 -0
- package/lib/commonjs/composites/wui-list-transaction/index.js +64 -0
- package/lib/commonjs/composites/wui-list-transaction/index.js.map +1 -0
- package/lib/commonjs/composites/wui-list-transaction/styles.js +16 -0
- package/lib/commonjs/composites/wui-list-transaction/styles.js.map +1 -0
- package/lib/commonjs/composites/wui-list-transaction/utils.js +88 -0
- package/lib/commonjs/composites/wui-list-transaction/utils.js.map +1 -0
- package/lib/commonjs/composites/wui-network-button/index.js +14 -10
- package/lib/commonjs/composites/wui-network-button/index.js.map +1 -1
- package/lib/commonjs/composites/wui-network-button/styles.js +3 -3
- package/lib/commonjs/composites/wui-network-button/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-network-image/index.js +48 -21
- package/lib/commonjs/composites/wui-network-image/index.js.map +1 -1
- package/lib/commonjs/composites/wui-network-image/styles.js +3 -1
- package/lib/commonjs/composites/wui-network-image/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-qr-code/index.js +26 -12
- package/lib/commonjs/composites/wui-qr-code/index.js.map +1 -1
- package/lib/commonjs/composites/wui-qr-code/styles.js +3 -0
- package/lib/commonjs/composites/wui-qr-code/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-snackbar/index.js +1 -0
- package/lib/commonjs/composites/wui-snackbar/index.js.map +1 -1
- package/lib/commonjs/composites/wui-snackbar/styles.js +2 -1
- package/lib/commonjs/composites/wui-snackbar/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-tabs/index.js +22 -8
- package/lib/commonjs/composites/wui-tabs/index.js.map +1 -1
- package/lib/commonjs/composites/wui-tabs/styles.js +1 -2
- package/lib/commonjs/composites/wui-tabs/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-token-button/index.js +37 -0
- package/lib/commonjs/composites/wui-token-button/index.js.map +1 -0
- package/lib/commonjs/composites/wui-token-button/styles.js +24 -0
- package/lib/commonjs/composites/wui-token-button/styles.js.map +1 -0
- package/lib/commonjs/composites/wui-transaction-visual/index.js +73 -0
- package/lib/commonjs/composites/wui-transaction-visual/index.js.map +1 -0
- package/lib/commonjs/composites/wui-transaction-visual/styles.js +42 -0
- package/lib/commonjs/composites/wui-transaction-visual/styles.js.map +1 -0
- package/lib/commonjs/index.js +56 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/ThemeUtil.js +2 -1
- package/lib/commonjs/utils/ThemeUtil.js.map +1 -1
- package/lib/commonjs/utils/TransactionUtil.js +139 -0
- package/lib/commonjs/utils/TransactionUtil.js.map +1 -0
- package/lib/commonjs/utils/UiUtil.js +15 -0
- package/lib/commonjs/utils/UiUtil.js.map +1 -1
- package/lib/module/assets/svg/ArrowBottomCircle.js +13 -0
- package/lib/module/assets/svg/ArrowBottomCircle.js.map +1 -0
- package/lib/module/assets/svg/Paperplane.js +13 -0
- package/lib/module/assets/svg/Paperplane.js.map +1 -0
- package/lib/module/components/wui-icon/index.js +4 -0
- package/lib/module/components/wui-icon/index.js.map +1 -1
- package/lib/module/composites/wui-account-button/index.js +13 -7
- package/lib/module/composites/wui-account-button/index.js.map +1 -1
- package/lib/module/composites/wui-account-button/styles.js +4 -4
- package/lib/module/composites/wui-account-button/styles.js.map +1 -1
- package/lib/module/composites/wui-account-pill/index.js +66 -0
- package/lib/module/composites/wui-account-pill/index.js.map +1 -0
- package/lib/module/composites/wui-account-pill/styles.js +19 -0
- package/lib/module/composites/wui-account-pill/styles.js.map +1 -0
- package/lib/module/composites/wui-avatar/styles.js +2 -1
- package/lib/module/composites/wui-avatar/styles.js.map +1 -1
- package/lib/module/composites/wui-balance/index.js +21 -0
- package/lib/module/composites/wui-balance/index.js.map +1 -0
- package/lib/module/composites/wui-banner/index.js +29 -0
- package/lib/module/composites/wui-banner/index.js.map +1 -0
- package/lib/module/composites/wui-banner/styles.js +15 -0
- package/lib/module/composites/wui-banner/styles.js.map +1 -0
- package/lib/module/composites/wui-button/index.js +3 -3
- package/lib/module/composites/wui-button/index.js.map +1 -1
- package/lib/module/composites/wui-button/styles.js +2 -2
- package/lib/module/composites/wui-button/styles.js.map +1 -1
- package/lib/module/composites/wui-chip/index.js +6 -8
- package/lib/module/composites/wui-chip/index.js.map +1 -1
- package/lib/module/composites/wui-chip/styles.js +1 -1
- package/lib/module/composites/wui-chip/styles.js.map +1 -1
- package/lib/module/composites/wui-compatible-network/index.js +52 -0
- package/lib/module/composites/wui-compatible-network/index.js.map +1 -0
- package/lib/module/composites/wui-list-item/index.js +10 -10
- package/lib/module/composites/wui-list-item/index.js.map +1 -1
- package/lib/module/composites/wui-list-item/styles.js +4 -3
- package/lib/module/composites/wui-list-item/styles.js.map +1 -1
- package/lib/module/composites/wui-list-token/index.js +71 -0
- package/lib/module/composites/wui-list-token/index.js.map +1 -0
- package/lib/module/composites/wui-list-token/styles.js +24 -0
- package/lib/module/composites/wui-list-token/styles.js.map +1 -0
- package/lib/module/composites/wui-list-transaction/index.js +57 -0
- package/lib/module/composites/wui-list-transaction/index.js.map +1 -0
- package/lib/module/composites/wui-list-transaction/styles.js +10 -0
- package/lib/module/composites/wui-list-transaction/styles.js.map +1 -0
- package/lib/module/composites/wui-list-transaction/utils.js +79 -0
- package/lib/module/composites/wui-list-transaction/utils.js.map +1 -0
- package/lib/module/composites/wui-network-button/index.js +15 -11
- package/lib/module/composites/wui-network-button/index.js.map +1 -1
- package/lib/module/composites/wui-network-button/styles.js +4 -4
- package/lib/module/composites/wui-network-button/styles.js.map +1 -1
- package/lib/module/composites/wui-network-image/index.js +49 -22
- package/lib/module/composites/wui-network-image/index.js.map +1 -1
- package/lib/module/composites/wui-network-image/styles.js +2 -0
- package/lib/module/composites/wui-network-image/styles.js.map +1 -1
- package/lib/module/composites/wui-qr-code/index.js +26 -12
- package/lib/module/composites/wui-qr-code/index.js.map +1 -1
- package/lib/module/composites/wui-qr-code/styles.js +3 -0
- package/lib/module/composites/wui-qr-code/styles.js.map +1 -1
- package/lib/module/composites/wui-snackbar/index.js +1 -0
- package/lib/module/composites/wui-snackbar/index.js.map +1 -1
- package/lib/module/composites/wui-snackbar/styles.js +2 -1
- package/lib/module/composites/wui-snackbar/styles.js.map +1 -1
- package/lib/module/composites/wui-tabs/index.js +22 -8
- package/lib/module/composites/wui-tabs/index.js.map +1 -1
- package/lib/module/composites/wui-tabs/styles.js +1 -2
- package/lib/module/composites/wui-tabs/styles.js.map +1 -1
- package/lib/module/composites/wui-token-button/index.js +30 -0
- package/lib/module/composites/wui-token-button/index.js.map +1 -0
- package/lib/module/composites/wui-token-button/styles.js +18 -0
- package/lib/module/composites/wui-token-button/styles.js.map +1 -0
- package/lib/module/composites/wui-transaction-visual/index.js +66 -0
- package/lib/module/composites/wui-transaction-visual/index.js.map +1 -0
- package/lib/module/composites/wui-transaction-visual/styles.js +36 -0
- package/lib/module/composites/wui-transaction-visual/styles.js.map +1 -0
- package/lib/module/index.js +8 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/ThemeUtil.js +2 -1
- package/lib/module/utils/ThemeUtil.js.map +1 -1
- package/lib/module/utils/TransactionUtil.js +134 -0
- package/lib/module/utils/TransactionUtil.js.map +1 -0
- package/lib/module/utils/UiUtil.js +15 -0
- package/lib/module/utils/UiUtil.js.map +1 -1
- package/lib/typescript/assets/svg/ArrowBottomCircle.d.ts +4 -0
- package/lib/typescript/assets/svg/ArrowBottomCircle.d.ts.map +1 -0
- package/lib/typescript/assets/svg/Paperplane.d.ts +4 -0
- package/lib/typescript/assets/svg/Paperplane.d.ts.map +1 -0
- package/lib/typescript/components/wui-icon/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-account-button/index.d.ts +2 -2
- package/lib/typescript/composites/wui-account-button/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-account-pill/index.d.ts +11 -0
- package/lib/typescript/composites/wui-account-pill/index.d.ts.map +1 -0
- package/lib/typescript/composites/wui-account-pill/styles.d.ts +18 -0
- package/lib/typescript/composites/wui-account-pill/styles.d.ts.map +1 -0
- package/lib/typescript/composites/wui-avatar/styles.d.ts.map +1 -1
- package/lib/typescript/composites/wui-balance/index.d.ts +6 -0
- package/lib/typescript/composites/wui-balance/index.d.ts.map +1 -0
- package/lib/typescript/composites/wui-banner/index.d.ts +7 -0
- package/lib/typescript/composites/wui-banner/index.d.ts.map +1 -0
- package/lib/typescript/composites/wui-banner/styles.d.ts +14 -0
- package/lib/typescript/composites/wui-banner/styles.d.ts.map +1 -0
- package/lib/typescript/composites/wui-button/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-chip/index.d.ts +2 -2
- package/lib/typescript/composites/wui-chip/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-compatible-network/index.d.ts +10 -0
- package/lib/typescript/composites/wui-compatible-network/index.d.ts.map +1 -0
- package/lib/typescript/composites/wui-list-item/index.d.ts +6 -4
- package/lib/typescript/composites/wui-list-item/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-list-item/styles.d.ts +1 -0
- package/lib/typescript/composites/wui-list-item/styles.d.ts.map +1 -1
- package/lib/typescript/composites/wui-list-token/index.d.ts +11 -0
- package/lib/typescript/composites/wui-list-token/index.d.ts.map +1 -0
- package/lib/typescript/composites/wui-list-token/styles.d.ts +23 -0
- package/lib/typescript/composites/wui-list-token/styles.d.ts.map +1 -0
- package/lib/typescript/composites/wui-list-transaction/index.d.ts +15 -0
- package/lib/typescript/composites/wui-list-transaction/index.d.ts.map +1 -0
- package/lib/typescript/composites/wui-list-transaction/styles.d.ts +10 -0
- package/lib/typescript/composites/wui-list-transaction/styles.d.ts.map +1 -0
- package/lib/typescript/composites/wui-list-transaction/utils.d.ts +6 -0
- package/lib/typescript/composites/wui-list-transaction/utils.d.ts.map +1 -0
- package/lib/typescript/composites/wui-network-button/index.d.ts +6 -4
- package/lib/typescript/composites/wui-network-button/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-network-button/styles.d.ts +1 -1
- package/lib/typescript/composites/wui-network-image/index.d.ts +6 -2
- package/lib/typescript/composites/wui-network-image/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-network-image/styles.d.ts +2 -0
- package/lib/typescript/composites/wui-network-image/styles.d.ts.map +1 -1
- package/lib/typescript/composites/wui-qr-code/index.d.ts +4 -1
- package/lib/typescript/composites/wui-qr-code/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-qr-code/styles.d.ts +3 -0
- package/lib/typescript/composites/wui-qr-code/styles.d.ts.map +1 -1
- package/lib/typescript/composites/wui-snackbar/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-snackbar/styles.d.ts.map +1 -1
- package/lib/typescript/composites/wui-tabs/index.d.ts +4 -2
- package/lib/typescript/composites/wui-tabs/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-tabs/styles.d.ts +1 -2
- package/lib/typescript/composites/wui-tabs/styles.d.ts.map +1 -1
- package/lib/typescript/composites/wui-token-button/index.d.ts +7 -0
- package/lib/typescript/composites/wui-token-button/index.d.ts.map +1 -0
- package/lib/typescript/composites/wui-token-button/styles.d.ts +17 -0
- package/lib/typescript/composites/wui-token-button/styles.d.ts.map +1 -0
- package/lib/typescript/composites/wui-transaction-visual/index.d.ts +8 -0
- package/lib/typescript/composites/wui-transaction-visual/index.d.ts.map +1 -0
- package/lib/typescript/composites/wui-transaction-visual/styles.d.ts +35 -0
- package/lib/typescript/composites/wui-transaction-visual/styles.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +8 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/ThemeUtil.d.ts +1 -0
- package/lib/typescript/utils/ThemeUtil.d.ts.map +1 -1
- package/lib/typescript/utils/TransactionUtil.d.ts +13 -0
- package/lib/typescript/utils/TransactionUtil.d.ts.map +1 -0
- package/lib/typescript/utils/TypesUtil.d.ts +4 -3
- package/lib/typescript/utils/TypesUtil.d.ts.map +1 -1
- package/lib/typescript/utils/UiUtil.d.ts +1 -0
- package/lib/typescript/utils/UiUtil.d.ts.map +1 -1
- package/package.json +6 -6
- package/readme.md +9 -0
- package/src/assets/svg/ArrowBottomCircle.tsx +12 -0
- package/src/assets/svg/Paperplane.tsx +12 -0
- package/src/components/wui-icon/index.tsx +4 -0
- package/src/composites/wui-account-button/index.tsx +17 -8
- package/src/composites/wui-account-button/styles.ts +4 -4
- package/src/composites/wui-account-pill/index.tsx +72 -0
- package/src/composites/wui-account-pill/styles.ts +19 -0
- package/src/composites/wui-avatar/styles.ts +2 -1
- package/src/composites/wui-balance/index.tsx +25 -0
- package/src/composites/wui-banner/index.tsx +28 -0
- package/src/composites/wui-banner/styles.ts +15 -0
- package/src/composites/wui-button/index.tsx +12 -10
- package/src/composites/wui-button/styles.ts +2 -2
- package/src/composites/wui-chip/index.tsx +7 -9
- package/src/composites/wui-chip/styles.ts +1 -1
- package/src/composites/wui-compatible-network/index.tsx +64 -0
- package/src/composites/wui-list-item/index.tsx +15 -14
- package/src/composites/wui-list-item/styles.ts +4 -3
- package/src/composites/wui-list-token/index.tsx +83 -0
- package/src/composites/wui-list-token/styles.ts +24 -0
- package/src/composites/wui-list-transaction/index.tsx +65 -0
- package/src/composites/wui-list-transaction/styles.ts +10 -0
- package/src/composites/wui-list-transaction/utils.ts +83 -0
- package/src/composites/wui-network-button/index.tsx +22 -15
- package/src/composites/wui-network-button/styles.ts +4 -4
- package/src/composites/wui-network-image/index.tsx +57 -21
- package/src/composites/wui-network-image/styles.ts +6 -0
- package/src/composites/wui-qr-code/index.tsx +29 -14
- package/src/composites/wui-qr-code/styles.ts +3 -0
- package/src/composites/wui-snackbar/index.tsx +1 -0
- package/src/composites/wui-snackbar/styles.ts +2 -1
- package/src/composites/wui-tabs/index.tsx +33 -9
- package/src/composites/wui-tabs/styles.ts +1 -2
- package/src/composites/wui-token-button/index.tsx +29 -0
- package/src/composites/wui-token-button/styles.ts +18 -0
- package/src/composites/wui-transaction-visual/index.tsx +78 -0
- package/src/composites/wui-transaction-visual/styles.ts +36 -0
- package/src/index.ts +11 -0
- package/src/utils/ThemeUtil.ts +2 -1
- package/src/utils/TransactionUtil.ts +173 -0
- package/src/utils/TypesUtil.ts +36 -2
- package/src/utils/UiUtil.ts +18 -0
|
@@ -3,3 +3,9 @@ export const PathLg =
|
|
|
3
3
|
|
|
4
4
|
export const PathNormal =
|
|
5
5
|
'M24.0002 2.34328C26.4754 0.914219 29.525 0.914219 32.0002 2.34328L48.2489 11.7245C50.7241 13.1535 52.2489 15.7946 52.2489 18.6527V37.4151C52.2489 40.2732 50.7241 42.9142 48.2489 44.3433L32.0002 53.7245C29.525 55.1535 26.4754 55.1535 24.0002 53.7245L7.75146 44.3433C5.27625 42.9142 3.75146 40.2732 3.75146 37.4151V18.6527C3.75146 15.7946 5.27626 13.1535 7.75146 11.7245L24.0002 2.34328Z';
|
|
6
|
+
|
|
7
|
+
export const PathSmall =
|
|
8
|
+
'M17.1428 1.67377C18.9108 0.653013 21.0891 0.653014 22.8571 1.67377L34.4633 8.37463C36.2313 9.39539 37.3205 11.2818 37.3205 13.3233V26.7251C37.3205 28.7666 36.2313 30.653 34.4633 31.6738L22.8571 38.3746C21.0891 39.3954 18.9108 39.3954 17.1428 38.3746L5.53659 31.6738C3.76858 30.653 2.67944 28.7666 2.67944 26.7251V13.3233C2.67944 11.2818 3.76858 9.39539 5.53659 8.37463L17.1428 1.67377Z';
|
|
9
|
+
|
|
10
|
+
export const PathXS =
|
|
11
|
+
'M8.57153 0.836886C9.45553 0.326507 10.5447 0.326507 11.4287 0.836886L17.2318 4.18731C18.1158 4.69769 18.6604 5.64091 18.6604 6.66167V13.3625C18.6604 14.3833 18.1158 15.3265 17.2318 15.8369L11.4287 19.1873C10.5447 19.6977 9.45553 19.6977 8.57153 19.1873L2.76841 15.8369C1.88441 15.3265 1.33984 14.3833 1.33984 13.3625V6.66167C1.33984 5.64091 1.88441 4.69769 2.76841 4.18731L8.57153 0.836886Z';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { View, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
3
|
import Svg from 'react-native-svg';
|
|
4
4
|
import { Icon } from '../../components/wui-icon';
|
|
5
5
|
import { Image } from '../../components/wui-image';
|
|
6
6
|
import { Shimmer } from '../../components/wui-shimmer';
|
|
7
|
+
import { Text } from '../../components/wui-text';
|
|
8
|
+
import { FlexView } from '../../layout/wui-flex';
|
|
7
9
|
import { QRCodeUtil } from '../../utils/QRCodeUtil';
|
|
8
10
|
import { BorderRadius, LightTheme, Spacing } from '../../utils/ThemeUtil';
|
|
9
11
|
import styles from './styles';
|
|
@@ -13,22 +15,26 @@ export interface QrCodeProps {
|
|
|
13
15
|
uri?: string;
|
|
14
16
|
imageSrc?: string;
|
|
15
17
|
testID?: string;
|
|
18
|
+
arenaClear?: boolean;
|
|
19
|
+
style?: StyleProp<ViewStyle>;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
|
-
export function QrCode({ size, uri, imageSrc, testID }: QrCodeProps) {
|
|
22
|
+
export function QrCode({ size, uri, imageSrc, testID, arenaClear, style }: QrCodeProps) {
|
|
19
23
|
const Theme = LightTheme;
|
|
20
24
|
const containerPadding = Spacing.l;
|
|
21
25
|
const qrSize = size - containerPadding * 2;
|
|
26
|
+
const logoSize = arenaClear ? 0 : qrSize / 4;
|
|
27
|
+
|
|
22
28
|
const dots = useMemo(
|
|
23
|
-
() => (uri ? QRCodeUtil.generate(uri, qrSize,
|
|
24
|
-
[uri, qrSize]
|
|
29
|
+
() => (uri ? QRCodeUtil.generate(uri, qrSize, logoSize) : []),
|
|
30
|
+
[uri, qrSize, logoSize]
|
|
25
31
|
);
|
|
26
32
|
|
|
27
|
-
const shimmerTemplate = () => {
|
|
28
|
-
return <Shimmer width={size} height={size} borderRadius={BorderRadius.l} />;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
33
|
const logoTemplate = () => {
|
|
34
|
+
if (arenaClear) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
if (imageSrc) {
|
|
33
39
|
return (
|
|
34
40
|
<Image
|
|
@@ -56,16 +62,25 @@ export function QrCode({ size, uri, imageSrc, testID }: QrCodeProps) {
|
|
|
56
62
|
<View
|
|
57
63
|
style={[
|
|
58
64
|
styles.container,
|
|
59
|
-
{
|
|
65
|
+
{ width: size, backgroundColor: Theme['bg-100'], padding: containerPadding },
|
|
66
|
+
style
|
|
60
67
|
]}
|
|
61
68
|
testID={testID}
|
|
62
69
|
>
|
|
63
|
-
<
|
|
64
|
-
{
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
<FlexView alignItems="center" justifyContent="center">
|
|
71
|
+
<Svg height={qrSize} width={qrSize}>
|
|
72
|
+
{dots}
|
|
73
|
+
</Svg>
|
|
74
|
+
{logoTemplate()}
|
|
75
|
+
</FlexView>
|
|
76
|
+
<Text variant="small-500" color="fg-150" style={styles.label}>
|
|
77
|
+
UX by{' '}
|
|
78
|
+
<Text variant="small-500" color="inverse-000">
|
|
79
|
+
Reown
|
|
80
|
+
</Text>
|
|
81
|
+
</Text>
|
|
67
82
|
</View>
|
|
68
83
|
) : (
|
|
69
|
-
|
|
84
|
+
<Shimmer width={size} height={size} borderRadius={BorderRadius.l} />
|
|
70
85
|
);
|
|
71
86
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { BorderRadius } from '../../utils/ThemeUtil';
|
|
2
3
|
|
|
3
4
|
export default StyleSheet.create({
|
|
4
5
|
container: {
|
|
5
6
|
height: 40,
|
|
6
7
|
flexDirection: 'row',
|
|
7
8
|
paddingHorizontal: 8,
|
|
8
|
-
borderRadius:
|
|
9
|
+
borderRadius: BorderRadius.full,
|
|
9
10
|
borderWidth: 1,
|
|
10
11
|
alignItems: 'center'
|
|
11
12
|
},
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { useRef, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Animated,
|
|
4
|
+
Pressable,
|
|
5
|
+
View,
|
|
6
|
+
type LayoutChangeEvent,
|
|
7
|
+
type StyleProp,
|
|
8
|
+
type ViewStyle
|
|
9
|
+
} from 'react-native';
|
|
3
10
|
import { Icon } from '../../components/wui-icon';
|
|
4
11
|
import { Text } from '../../components/wui-text';
|
|
5
12
|
import { useTheme } from '../../hooks/useTheme';
|
|
@@ -8,13 +15,16 @@ import styles from './styles';
|
|
|
8
15
|
|
|
9
16
|
export interface TabsProps {
|
|
10
17
|
onTabChange: (index: number) => void;
|
|
11
|
-
tabs: TabOptionType[];
|
|
18
|
+
tabs: TabOptionType[] | string[];
|
|
19
|
+
style?: StyleProp<ViewStyle>;
|
|
12
20
|
}
|
|
13
21
|
|
|
14
|
-
export function Tabs({ tabs, onTabChange }: TabsProps) {
|
|
22
|
+
export function Tabs({ tabs, onTabChange, style }: TabsProps) {
|
|
15
23
|
const Theme = useTheme();
|
|
16
24
|
const [activeTab, setActiveTab] = useState(0);
|
|
17
25
|
const animatedPosition = useRef(new Animated.Value(0));
|
|
26
|
+
const [viewWidth, setViewWidth] = useState(1);
|
|
27
|
+
const tabWidth = Math.trunc(viewWidth / tabs.length) - 2;
|
|
18
28
|
|
|
19
29
|
const onTabPress = (index: number) => {
|
|
20
30
|
setActiveTab(index);
|
|
@@ -28,27 +38,41 @@ export function Tabs({ tabs, onTabChange }: TabsProps) {
|
|
|
28
38
|
|
|
29
39
|
const markPosition = animatedPosition.current.interpolate({
|
|
30
40
|
inputRange: [0, tabs.length - 1],
|
|
31
|
-
outputRange: [0,
|
|
41
|
+
outputRange: [0, tabWidth * (tabs.length - 1)]
|
|
32
42
|
});
|
|
33
43
|
|
|
44
|
+
const onLayout = (event: LayoutChangeEvent) => {
|
|
45
|
+
const { width } = event.nativeEvent.layout;
|
|
46
|
+
setViewWidth(width);
|
|
47
|
+
};
|
|
48
|
+
|
|
34
49
|
return (
|
|
35
|
-
<View
|
|
50
|
+
<View
|
|
51
|
+
style={[styles.container, { backgroundColor: Theme['gray-glass-002'] }, style]}
|
|
52
|
+
onLayout={onLayout}
|
|
53
|
+
>
|
|
36
54
|
<Animated.View
|
|
37
55
|
style={[
|
|
38
56
|
styles.activeMark,
|
|
39
57
|
{
|
|
40
58
|
backgroundColor: Theme['gray-glass-005'],
|
|
41
59
|
borderColor: Theme['gray-glass-005'],
|
|
42
|
-
left: markPosition
|
|
60
|
+
left: markPosition,
|
|
61
|
+
width: tabWidth
|
|
43
62
|
}
|
|
44
63
|
]}
|
|
45
64
|
/>
|
|
46
65
|
{tabs.map((option, index) => {
|
|
47
66
|
const isActive = index === activeTab;
|
|
67
|
+
const isString = typeof option === 'string';
|
|
48
68
|
|
|
49
69
|
return (
|
|
50
|
-
<Pressable
|
|
51
|
-
{
|
|
70
|
+
<Pressable
|
|
71
|
+
onPress={() => onTabPress(index)}
|
|
72
|
+
key={isString ? option : option.label}
|
|
73
|
+
style={[styles.tabItem, { width: tabWidth }]}
|
|
74
|
+
>
|
|
75
|
+
{!isString && option.icon && (
|
|
52
76
|
<Icon
|
|
53
77
|
name={option.icon}
|
|
54
78
|
size="xs"
|
|
@@ -57,7 +81,7 @@ export function Tabs({ tabs, onTabChange }: TabsProps) {
|
|
|
57
81
|
/>
|
|
58
82
|
)}
|
|
59
83
|
<Text variant="small-600" color={isActive ? 'fg-100' : 'fg-200'}>
|
|
60
|
-
{option.label}
|
|
84
|
+
{isString ? option : option.label}
|
|
61
85
|
</Text>
|
|
62
86
|
</Pressable>
|
|
63
87
|
);
|
|
@@ -4,6 +4,7 @@ import { BorderRadius, Spacing } from '../../utils/ThemeUtil';
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
5
|
container: {
|
|
6
6
|
height: 34,
|
|
7
|
+
width: '100%',
|
|
7
8
|
flexDirection: 'row',
|
|
8
9
|
alignItems: 'center',
|
|
9
10
|
paddingHorizontal: Spacing['3xs'],
|
|
@@ -13,7 +14,6 @@ export default StyleSheet.create({
|
|
|
13
14
|
flexDirection: 'row',
|
|
14
15
|
justifyContent: 'center',
|
|
15
16
|
alignItems: 'center',
|
|
16
|
-
width: 100,
|
|
17
17
|
paddingVertical: Spacing['2xs']
|
|
18
18
|
},
|
|
19
19
|
tabIcon: {
|
|
@@ -22,7 +22,6 @@ export default StyleSheet.create({
|
|
|
22
22
|
activeMark: {
|
|
23
23
|
position: 'absolute',
|
|
24
24
|
height: 28,
|
|
25
|
-
width: 100,
|
|
26
25
|
borderWidth: 1,
|
|
27
26
|
borderRadius: BorderRadius['3xl'],
|
|
28
27
|
margin: Spacing['3xs']
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Balance } from '@reown/appkit-common-react-native';
|
|
2
|
+
import { Image } from '../../components/wui-image';
|
|
3
|
+
import { Text } from '../../components/wui-text';
|
|
4
|
+
import { Button } from '../wui-button';
|
|
5
|
+
import styles from './styles';
|
|
6
|
+
|
|
7
|
+
export interface TokenButtonProps {
|
|
8
|
+
onPress?: () => void;
|
|
9
|
+
token?: Balance;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function TokenButton({ token, onPress }: TokenButtonProps) {
|
|
13
|
+
if (!token) {
|
|
14
|
+
return (
|
|
15
|
+
<Button variant="accent" style={styles.selectButton} size="sm" onPress={onPress}>
|
|
16
|
+
<Text variant="small-600" color="accent-100">
|
|
17
|
+
Select token
|
|
18
|
+
</Text>
|
|
19
|
+
</Button>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Button variant="shade" style={styles.container} size="sm" onPress={onPress}>
|
|
25
|
+
{token?.iconUrl && <Image source={token?.iconUrl} style={styles.image} />}
|
|
26
|
+
{token?.symbol && <Text>{token.symbol}</Text>}
|
|
27
|
+
</Button>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { BorderRadius, Spacing } from '../../utils/ThemeUtil';
|
|
3
|
+
|
|
4
|
+
export default StyleSheet.create({
|
|
5
|
+
selectButton: {
|
|
6
|
+
height: 40,
|
|
7
|
+
paddingHorizontal: Spacing.m
|
|
8
|
+
},
|
|
9
|
+
container: {
|
|
10
|
+
height: 40
|
|
11
|
+
},
|
|
12
|
+
image: {
|
|
13
|
+
width: 24,
|
|
14
|
+
height: 24,
|
|
15
|
+
borderRadius: BorderRadius.full,
|
|
16
|
+
marginRight: Spacing['2xs']
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { TransactionImage } from '@reown/appkit-common-react-native';
|
|
2
|
+
|
|
3
|
+
import { FlexView } from '../../layout/wui-flex';
|
|
4
|
+
import { Icon } from '../../components/wui-icon';
|
|
5
|
+
import { Image } from '../../components/wui-image';
|
|
6
|
+
import { useTheme } from '../../hooks/useTheme';
|
|
7
|
+
import styles from './styles';
|
|
8
|
+
|
|
9
|
+
export interface TransactionVisualProps {
|
|
10
|
+
images?: TransactionImage[];
|
|
11
|
+
networkSrc?: string;
|
|
12
|
+
isAllNFT?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function TransactionVisual({ images, networkSrc, isAllNFT }: TransactionVisualProps) {
|
|
16
|
+
const Theme = useTheme();
|
|
17
|
+
const backgroundColor = Theme['bg-200'];
|
|
18
|
+
const isFirstNFT = Boolean(images?.[0]?.type === 'NFT');
|
|
19
|
+
const filteredImages = images?.filter(image => image.url);
|
|
20
|
+
const [firstImage, secondImage] = filteredImages ?? [];
|
|
21
|
+
const hasOneImage = filteredImages?.length === 1;
|
|
22
|
+
const hasTwoImages = filteredImages && filteredImages?.length > 1;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<FlexView>
|
|
26
|
+
{!filteredImages?.length && (
|
|
27
|
+
<FlexView
|
|
28
|
+
alignItems="center"
|
|
29
|
+
justifyContent="center"
|
|
30
|
+
style={[styles.image, { backgroundColor }]}
|
|
31
|
+
>
|
|
32
|
+
<Icon name={isFirstNFT ? 'nftPlaceholder' : 'coinPlaceholder'} size="sm" color="fg-200" />
|
|
33
|
+
</FlexView>
|
|
34
|
+
)}
|
|
35
|
+
{hasOneImage && firstImage?.url && (
|
|
36
|
+
<Image
|
|
37
|
+
source={firstImage.url}
|
|
38
|
+
style={[styles.image, firstImage?.type === 'NFT' && styles.imageNft, { backgroundColor }]}
|
|
39
|
+
/>
|
|
40
|
+
)}
|
|
41
|
+
{hasTwoImages && firstImage?.url && secondImage?.url && (
|
|
42
|
+
<FlexView flexDirection="row" padding={['0', 's', '0', '0']}>
|
|
43
|
+
<FlexView style={styles.halfContainer}>
|
|
44
|
+
<Image
|
|
45
|
+
source={firstImage.url}
|
|
46
|
+
style={[styles.image, isAllNFT && styles.imageNft, { backgroundColor }]}
|
|
47
|
+
/>
|
|
48
|
+
</FlexView>
|
|
49
|
+
<FlexView style={styles.halfContainer}>
|
|
50
|
+
<Image
|
|
51
|
+
source={secondImage.url}
|
|
52
|
+
style={[
|
|
53
|
+
styles.image,
|
|
54
|
+
styles.halfRight,
|
|
55
|
+
isAllNFT && styles.imageNft,
|
|
56
|
+
{ backgroundColor }
|
|
57
|
+
]}
|
|
58
|
+
/>
|
|
59
|
+
</FlexView>
|
|
60
|
+
</FlexView>
|
|
61
|
+
)}
|
|
62
|
+
<FlexView
|
|
63
|
+
alignItems="center"
|
|
64
|
+
justifyContent="center"
|
|
65
|
+
style={[
|
|
66
|
+
styles.networkImageContainer,
|
|
67
|
+
{ borderColor: Theme['bg-100'], backgroundColor: Theme['bg-200'] }
|
|
68
|
+
]}
|
|
69
|
+
>
|
|
70
|
+
{networkSrc ? (
|
|
71
|
+
<Image source={networkSrc} style={styles.networkImage} />
|
|
72
|
+
) : (
|
|
73
|
+
<Icon name="networkPlaceholder" size="xxs" color="fg-200" />
|
|
74
|
+
)}
|
|
75
|
+
</FlexView>
|
|
76
|
+
</FlexView>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { BorderRadius, Spacing } from '../../utils/ThemeUtil';
|
|
3
|
+
|
|
4
|
+
export default StyleSheet.create({
|
|
5
|
+
image: {
|
|
6
|
+
height: 40,
|
|
7
|
+
width: 40,
|
|
8
|
+
borderRadius: BorderRadius.full,
|
|
9
|
+
marginRight: Spacing.s
|
|
10
|
+
},
|
|
11
|
+
imageNft: {
|
|
12
|
+
borderRadius: BorderRadius.xxs
|
|
13
|
+
},
|
|
14
|
+
halfContainer: {
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
width: 20,
|
|
17
|
+
marginRight: 2
|
|
18
|
+
},
|
|
19
|
+
halfRight: {
|
|
20
|
+
left: -20
|
|
21
|
+
},
|
|
22
|
+
networkImageContainer: {
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
bottom: -2,
|
|
25
|
+
left: 24,
|
|
26
|
+
borderWidth: 2,
|
|
27
|
+
borderRadius: BorderRadius.full,
|
|
28
|
+
width: 18,
|
|
29
|
+
height: 18
|
|
30
|
+
},
|
|
31
|
+
networkImage: {
|
|
32
|
+
width: 14,
|
|
33
|
+
height: 14,
|
|
34
|
+
borderRadius: BorderRadius.full
|
|
35
|
+
}
|
|
36
|
+
});
|
package/src/index.ts
CHANGED
|
@@ -9,8 +9,11 @@ export { Visual, type VisualProps } from './components/wui-visual';
|
|
|
9
9
|
export { Shimmer, type ShimmerProps } from './components/wui-shimmer';
|
|
10
10
|
|
|
11
11
|
export { AccountButton, type AccountButtonProps } from './composites/wui-account-button';
|
|
12
|
+
export { AccountPill, type AccountPillProps } from './composites/wui-account-pill';
|
|
12
13
|
export { ActionEntry, type ActionEntryProps } from './composites/wui-action-entry';
|
|
13
14
|
export { Avatar, type AvatarProps } from './composites/wui-avatar';
|
|
15
|
+
export { Balance, type BalanceProps } from './composites/wui-balance';
|
|
16
|
+
export { Banner, type BannerProps } from './composites/wui-banner';
|
|
14
17
|
export { Button, type ButtonProps } from './composites/wui-button';
|
|
15
18
|
export {
|
|
16
19
|
CardSelectLoader,
|
|
@@ -24,6 +27,10 @@ export {
|
|
|
24
27
|
type CardSelectProps
|
|
25
28
|
} from './composites/wui-card-select';
|
|
26
29
|
export { Chip, type ChipProps } from './composites/wui-chip';
|
|
30
|
+
export {
|
|
31
|
+
CompatibleNetwork,
|
|
32
|
+
type CompatibleNetworkProps
|
|
33
|
+
} from './composites/wui-compatible-network';
|
|
27
34
|
export { ConnectButton, type ConnectButtonProps } from './composites/wui-connect-button';
|
|
28
35
|
export { EmailInput, type EmailInputProps } from './composites/wui-email-input';
|
|
29
36
|
export { IconBox, type IconBoxProps } from './composites/wui-icon-box';
|
|
@@ -33,6 +40,8 @@ export { InputNumeric, type InputNumericProps } from './composites/wui-input-num
|
|
|
33
40
|
export { InputText, type InputTextProps } from './composites/wui-input-text';
|
|
34
41
|
export { Link, type LinkProps } from './composites/wui-link';
|
|
35
42
|
export { ListItem, type ListItemProps } from './composites/wui-list-item';
|
|
43
|
+
export { ListToken, type ListTokenProps } from './composites/wui-list-token';
|
|
44
|
+
export { ListTransaction, type ListTransactionProps } from './composites/wui-list-transaction';
|
|
36
45
|
export { ListWallet, type ListWalletProps } from './composites/wui-list-wallet';
|
|
37
46
|
export { Logo, type LogoProps } from './composites/wui-logo';
|
|
38
47
|
export { LogoSelect, type LogoSelectProps } from './composites/wui-logo-select';
|
|
@@ -44,6 +53,7 @@ export { SearchBar, type SearchBarProps } from './composites/wui-search-bar';
|
|
|
44
53
|
export { Snackbar, type SnackbarProps } from './composites/wui-snackbar';
|
|
45
54
|
export { Tabs, type TabsProps } from './composites/wui-tabs';
|
|
46
55
|
export { Tag, type TagProps } from './composites/wui-tag';
|
|
56
|
+
export { TokenButton, type TokenButtonProps } from './composites/wui-token-button';
|
|
47
57
|
export { Tooltip, type TooltipProps } from './composites/wui-tooltip';
|
|
48
58
|
export { WalletImage, type WalletImageProps } from './composites/wui-wallet-image';
|
|
49
59
|
|
|
@@ -66,6 +76,7 @@ export type {
|
|
|
66
76
|
VisualType
|
|
67
77
|
} from './utils/TypesUtil';
|
|
68
78
|
export { UiUtil } from './utils/UiUtil';
|
|
79
|
+
export { TransactionUtil } from './utils/TransactionUtil';
|
|
69
80
|
export { Spacing, BorderRadius } from './utils/ThemeUtil';
|
|
70
81
|
|
|
71
82
|
export { useTheme } from './hooks/useTheme';
|
package/src/utils/ThemeUtil.ts
CHANGED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { DateUtil } from '@reown/appkit-common-react-native';
|
|
2
|
+
import type {
|
|
3
|
+
TransactionTransfer,
|
|
4
|
+
Transaction,
|
|
5
|
+
TransactionImage
|
|
6
|
+
} from '@reown/appkit-common-react-native';
|
|
7
|
+
import type { TransactionType } from './TypesUtil';
|
|
8
|
+
import { UiUtil } from './UiUtil';
|
|
9
|
+
|
|
10
|
+
// -- Helpers --------------------------------------------- //
|
|
11
|
+
const FLOAT_FIXED_VALUE = 2;
|
|
12
|
+
const SMALL_FLOAT_FIXED_VALUE = 4;
|
|
13
|
+
const plusTypes: TransactionType[] = ['receive', 'deposit', 'borrow', 'claim'];
|
|
14
|
+
const minusTypes: TransactionType[] = ['withdraw', 'repay', 'burn'];
|
|
15
|
+
|
|
16
|
+
export const TransactionUtil = {
|
|
17
|
+
getTransactionGroupTitle(year: string, month: string) {
|
|
18
|
+
const currentYear = DateUtil.getYear().toString();
|
|
19
|
+
const monthName = DateUtil.getMonth(parseInt(month));
|
|
20
|
+
const isCurrentYear = year === currentYear;
|
|
21
|
+
const groupTitle = isCurrentYear ? monthName : `${monthName} ${year}`;
|
|
22
|
+
|
|
23
|
+
return groupTitle;
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
getTransactionImages(transfers: TransactionTransfer[]): TransactionImage[] {
|
|
27
|
+
const [transfer, secondTransfer] = transfers;
|
|
28
|
+
const isAllNFT = Boolean(transfer) && transfers?.every(item => Boolean(item.nft_info));
|
|
29
|
+
const haveMultipleTransfers = transfers?.length > 1;
|
|
30
|
+
const haveTwoTransfers = transfers?.length === 2;
|
|
31
|
+
|
|
32
|
+
if (haveTwoTransfers && !isAllNFT) {
|
|
33
|
+
return [this.getTransactionImage(transfer), this.getTransactionImage(secondTransfer)];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (haveMultipleTransfers) {
|
|
37
|
+
return transfers.map(item => this.getTransactionImage(item));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return [this.getTransactionImage(transfer)];
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
getTransactionImage(transfer?: TransactionTransfer): TransactionImage {
|
|
44
|
+
return {
|
|
45
|
+
type: TransactionUtil.getTransactionTransferTokenType(transfer),
|
|
46
|
+
url: TransactionUtil.getTransactionImageURL(transfer)
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
getTransactionImageURL(transfer: TransactionTransfer | undefined) {
|
|
51
|
+
let imageURL;
|
|
52
|
+
const isNFT = Boolean(transfer?.nft_info);
|
|
53
|
+
const isFungible = Boolean(transfer?.fungible_info);
|
|
54
|
+
|
|
55
|
+
if (transfer && isNFT) {
|
|
56
|
+
imageURL = transfer?.nft_info?.content?.preview?.url;
|
|
57
|
+
} else if (transfer && isFungible) {
|
|
58
|
+
imageURL = transfer?.fungible_info?.icon?.url;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return imageURL;
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
getTransactionTransferTokenType(transfer?: TransactionTransfer): 'FUNGIBLE' | 'NFT' | undefined {
|
|
65
|
+
if (transfer?.fungible_info) {
|
|
66
|
+
return 'FUNGIBLE';
|
|
67
|
+
} else if (transfer?.nft_info) {
|
|
68
|
+
return 'NFT';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return undefined;
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
getTransactionDescriptions(transaction: Transaction) {
|
|
75
|
+
const type = transaction?.metadata?.operationType as TransactionType;
|
|
76
|
+
|
|
77
|
+
const transfers = transaction?.transfers;
|
|
78
|
+
const haveTransfer = transaction?.transfers?.length > 0;
|
|
79
|
+
const haveMultipleTransfers = transaction?.transfers?.length > 1;
|
|
80
|
+
const isSendOrReceive = type === 'send' || type === 'receive';
|
|
81
|
+
const isFungible =
|
|
82
|
+
haveTransfer && transfers?.every(transfer => Boolean(transfer?.fungible_info));
|
|
83
|
+
const [firstTransfer, secondTransfer] = transfers;
|
|
84
|
+
|
|
85
|
+
let firstDescription = this.getTransferDescription(firstTransfer);
|
|
86
|
+
let secondDescription = this.getTransferDescription(secondTransfer);
|
|
87
|
+
|
|
88
|
+
if (!haveTransfer) {
|
|
89
|
+
if (isSendOrReceive && isFungible) {
|
|
90
|
+
firstDescription = UiUtil.getTruncateString({
|
|
91
|
+
string: transaction?.metadata.sentFrom,
|
|
92
|
+
charsStart: 4,
|
|
93
|
+
charsEnd: 6,
|
|
94
|
+
truncate: 'middle'
|
|
95
|
+
});
|
|
96
|
+
secondDescription = UiUtil.getTruncateString({
|
|
97
|
+
string: transaction?.metadata.sentTo,
|
|
98
|
+
charsStart: 4,
|
|
99
|
+
charsEnd: 6,
|
|
100
|
+
truncate: 'middle'
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
return [firstDescription, secondDescription];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return [transaction.metadata.status];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (haveMultipleTransfers) {
|
|
110
|
+
return transfers.map(item => this.getTransferDescription(item));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
let prefix = '';
|
|
114
|
+
if (plusTypes.includes(type)) {
|
|
115
|
+
prefix = '+';
|
|
116
|
+
} else if (minusTypes.includes(type)) {
|
|
117
|
+
prefix = '-';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
firstDescription = prefix.concat(firstDescription);
|
|
121
|
+
|
|
122
|
+
if (isSendOrReceive) {
|
|
123
|
+
const isSend = type === 'send';
|
|
124
|
+
const address = UiUtil.getTruncateString({
|
|
125
|
+
string: isSend ? transaction.metadata.sentTo : transaction.metadata.sentFrom,
|
|
126
|
+
charsStart: 4,
|
|
127
|
+
charsEnd: 4,
|
|
128
|
+
truncate: 'middle'
|
|
129
|
+
});
|
|
130
|
+
const arrow = isSend ? '→' : '←';
|
|
131
|
+
firstDescription = firstDescription.concat(` ${arrow} ${address}`);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return [firstDescription];
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
getTransferDescription(transfer?: TransactionTransfer) {
|
|
138
|
+
let description = '';
|
|
139
|
+
|
|
140
|
+
if (!transfer) {
|
|
141
|
+
return description;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (transfer?.nft_info) {
|
|
145
|
+
description = transfer?.nft_info?.name || '-';
|
|
146
|
+
} else if (transfer?.fungible_info) {
|
|
147
|
+
description = this.getFungibleTransferDescription(transfer) ?? '-';
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return description;
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
getFungibleTransferDescription(transfer?: TransactionTransfer) {
|
|
154
|
+
if (!transfer) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const quantity = this.getQuantityFixedValue(transfer?.quantity.numeric);
|
|
159
|
+
const description = [quantity, transfer?.fungible_info?.symbol].join(' ').trim();
|
|
160
|
+
|
|
161
|
+
return description;
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
getQuantityFixedValue(value: string | undefined) {
|
|
165
|
+
if (!value) {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const parsedValue = parseFloat(value);
|
|
170
|
+
|
|
171
|
+
return parsedValue.toFixed(parsedValue > 1 ? FLOAT_FIXED_VALUE : SMALL_FLOAT_FIXED_VALUE);
|
|
172
|
+
}
|
|
173
|
+
};
|