@reown/appkit-ui-react-native 0.0.0-feat-wallet-features-20240925132010 → 0.0.0-fix-email-login-20241010173711
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/components/wui-icon/index.js +0 -4
- package/lib/commonjs/components/wui-icon/index.js.map +1 -1
- package/lib/commonjs/composites/wui-account-button/index.js +7 -13
- 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-avatar/styles.js +1 -2
- package/lib/commonjs/composites/wui-avatar/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-button/index.js +2 -2
- 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 +7 -5
- 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-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 +3 -4
- package/lib/commonjs/composites/wui-list-item/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-network-button/index.js +10 -14
- 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 +21 -48
- package/lib/commonjs/composites/wui-network-image/index.js.map +1 -1
- package/lib/commonjs/composites/wui-network-image/styles.js +1 -3
- package/lib/commonjs/composites/wui-network-image/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-qr-code/index.js +11 -14
- package/lib/commonjs/composites/wui-qr-code/index.js.map +1 -1
- package/lib/commonjs/composites/wui-snackbar/index.js +0 -1
- package/lib/commonjs/composites/wui-snackbar/index.js.map +1 -1
- package/lib/commonjs/composites/wui-snackbar/styles.js +1 -2
- package/lib/commonjs/composites/wui-snackbar/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-tabs/index.js +8 -22
- package/lib/commonjs/composites/wui-tabs/index.js.map +1 -1
- package/lib/commonjs/composites/wui-tabs/styles.js +2 -1
- package/lib/commonjs/composites/wui-tabs/styles.js.map +1 -1
- package/lib/commonjs/index.js +0 -56
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/ThemeUtil.js +1 -2
- package/lib/commonjs/utils/ThemeUtil.js.map +1 -1
- package/lib/commonjs/utils/UiUtil.js +0 -15
- package/lib/commonjs/utils/UiUtil.js.map +1 -1
- package/lib/module/components/wui-icon/index.js +0 -4
- package/lib/module/components/wui-icon/index.js.map +1 -1
- package/lib/module/composites/wui-account-button/index.js +7 -13
- 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-avatar/styles.js +1 -2
- package/lib/module/composites/wui-avatar/styles.js.map +1 -1
- package/lib/module/composites/wui-button/index.js +2 -2
- 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 +8 -6
- 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-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 +3 -4
- package/lib/module/composites/wui-list-item/styles.js.map +1 -1
- package/lib/module/composites/wui-network-button/index.js +11 -15
- 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 +22 -49
- package/lib/module/composites/wui-network-image/index.js.map +1 -1
- package/lib/module/composites/wui-network-image/styles.js +0 -2
- package/lib/module/composites/wui-network-image/styles.js.map +1 -1
- package/lib/module/composites/wui-qr-code/index.js +11 -14
- package/lib/module/composites/wui-qr-code/index.js.map +1 -1
- package/lib/module/composites/wui-snackbar/index.js +0 -1
- package/lib/module/composites/wui-snackbar/index.js.map +1 -1
- package/lib/module/composites/wui-snackbar/styles.js +1 -2
- package/lib/module/composites/wui-snackbar/styles.js.map +1 -1
- package/lib/module/composites/wui-tabs/index.js +8 -22
- package/lib/module/composites/wui-tabs/index.js.map +1 -1
- package/lib/module/composites/wui-tabs/styles.js +2 -1
- package/lib/module/composites/wui-tabs/styles.js.map +1 -1
- package/lib/module/index.js +0 -8
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/ThemeUtil.js +1 -2
- package/lib/module/utils/ThemeUtil.js.map +1 -1
- package/lib/module/utils/UiUtil.js +0 -15
- package/lib/module/utils/UiUtil.js.map +1 -1
- 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-avatar/styles.d.ts.map +1 -1
- 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-list-item/index.d.ts +4 -6
- package/lib/typescript/composites/wui-list-item/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-list-item/styles.d.ts +0 -1
- package/lib/typescript/composites/wui-list-item/styles.d.ts.map +1 -1
- package/lib/typescript/composites/wui-network-button/index.d.ts +4 -6
- 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 +2 -6
- package/lib/typescript/composites/wui-network-image/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-network-image/styles.d.ts +0 -2
- package/lib/typescript/composites/wui-network-image/styles.d.ts.map +1 -1
- package/lib/typescript/composites/wui-qr-code/index.d.ts +1 -4
- package/lib/typescript/composites/wui-qr-code/index.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 +2 -4
- package/lib/typescript/composites/wui-tabs/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-tabs/styles.d.ts +2 -1
- package/lib/typescript/composites/wui-tabs/styles.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +0 -8
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/ThemeUtil.d.ts +0 -1
- package/lib/typescript/utils/ThemeUtil.d.ts.map +1 -1
- package/lib/typescript/utils/TypesUtil.d.ts +3 -4
- package/lib/typescript/utils/TypesUtil.d.ts.map +1 -1
- package/lib/typescript/utils/UiUtil.d.ts +0 -1
- package/lib/typescript/utils/UiUtil.d.ts.map +1 -1
- package/package.json +4 -4
- package/readme.md +1 -1
- package/src/components/wui-icon/index.tsx +0 -4
- package/src/composites/wui-account-button/index.tsx +8 -17
- package/src/composites/wui-account-button/styles.ts +4 -4
- package/src/composites/wui-avatar/styles.ts +1 -2
- package/src/composites/wui-button/index.tsx +1 -3
- package/src/composites/wui-button/styles.ts +2 -2
- package/src/composites/wui-chip/index.tsx +9 -7
- package/src/composites/wui-chip/styles.ts +1 -1
- package/src/composites/wui-list-item/index.tsx +14 -15
- package/src/composites/wui-list-item/styles.ts +3 -4
- package/src/composites/wui-network-button/index.tsx +15 -22
- package/src/composites/wui-network-button/styles.ts +4 -4
- package/src/composites/wui-network-image/index.tsx +21 -57
- package/src/composites/wui-network-image/styles.ts +0 -6
- package/src/composites/wui-qr-code/index.tsx +10 -15
- package/src/composites/wui-snackbar/index.tsx +0 -1
- package/src/composites/wui-snackbar/styles.ts +1 -2
- package/src/composites/wui-tabs/index.tsx +9 -33
- package/src/composites/wui-tabs/styles.ts +2 -1
- package/src/index.ts +0 -11
- package/src/utils/ThemeUtil.ts +1 -2
- package/src/utils/TypesUtil.ts +2 -36
- package/src/utils/UiUtil.ts +0 -18
- package/lib/commonjs/assets/svg/ArrowBottomCircle.js +0 -21
- package/lib/commonjs/assets/svg/ArrowBottomCircle.js.map +0 -1
- package/lib/commonjs/assets/svg/Paperplane.js +0 -21
- package/lib/commonjs/assets/svg/Paperplane.js.map +0 -1
- package/lib/commonjs/composites/wui-account-pill/index.js +0 -73
- package/lib/commonjs/composites/wui-account-pill/index.js.map +0 -1
- package/lib/commonjs/composites/wui-account-pill/styles.js +0 -25
- package/lib/commonjs/composites/wui-account-pill/styles.js.map +0 -1
- package/lib/commonjs/composites/wui-balance/index.js +0 -27
- package/lib/commonjs/composites/wui-balance/index.js.map +0 -1
- package/lib/commonjs/composites/wui-banner/index.js +0 -36
- package/lib/commonjs/composites/wui-banner/index.js.map +0 -1
- package/lib/commonjs/composites/wui-banner/styles.js +0 -21
- package/lib/commonjs/composites/wui-banner/styles.js.map +0 -1
- package/lib/commonjs/composites/wui-compatible-network/index.js +0 -58
- package/lib/commonjs/composites/wui-compatible-network/index.js.map +0 -1
- package/lib/commonjs/composites/wui-list-token/index.js +0 -78
- package/lib/commonjs/composites/wui-list-token/index.js.map +0 -1
- package/lib/commonjs/composites/wui-list-token/styles.js +0 -30
- package/lib/commonjs/composites/wui-list-token/styles.js.map +0 -1
- package/lib/commonjs/composites/wui-list-transaction/index.js +0 -64
- package/lib/commonjs/composites/wui-list-transaction/index.js.map +0 -1
- package/lib/commonjs/composites/wui-list-transaction/styles.js +0 -16
- package/lib/commonjs/composites/wui-list-transaction/styles.js.map +0 -1
- package/lib/commonjs/composites/wui-list-transaction/utils.js +0 -88
- package/lib/commonjs/composites/wui-list-transaction/utils.js.map +0 -1
- package/lib/commonjs/composites/wui-token-button/index.js +0 -37
- package/lib/commonjs/composites/wui-token-button/index.js.map +0 -1
- package/lib/commonjs/composites/wui-token-button/styles.js +0 -24
- package/lib/commonjs/composites/wui-token-button/styles.js.map +0 -1
- package/lib/commonjs/composites/wui-transaction-visual/index.js +0 -73
- package/lib/commonjs/composites/wui-transaction-visual/index.js.map +0 -1
- package/lib/commonjs/composites/wui-transaction-visual/styles.js +0 -42
- package/lib/commonjs/composites/wui-transaction-visual/styles.js.map +0 -1
- package/lib/commonjs/utils/TransactionUtil.js +0 -139
- package/lib/commonjs/utils/TransactionUtil.js.map +0 -1
- package/lib/module/assets/svg/ArrowBottomCircle.js +0 -13
- package/lib/module/assets/svg/ArrowBottomCircle.js.map +0 -1
- package/lib/module/assets/svg/Paperplane.js +0 -13
- package/lib/module/assets/svg/Paperplane.js.map +0 -1
- package/lib/module/composites/wui-account-pill/index.js +0 -66
- package/lib/module/composites/wui-account-pill/index.js.map +0 -1
- package/lib/module/composites/wui-account-pill/styles.js +0 -19
- package/lib/module/composites/wui-account-pill/styles.js.map +0 -1
- package/lib/module/composites/wui-balance/index.js +0 -21
- package/lib/module/composites/wui-balance/index.js.map +0 -1
- package/lib/module/composites/wui-banner/index.js +0 -29
- package/lib/module/composites/wui-banner/index.js.map +0 -1
- package/lib/module/composites/wui-banner/styles.js +0 -15
- package/lib/module/composites/wui-banner/styles.js.map +0 -1
- package/lib/module/composites/wui-compatible-network/index.js +0 -52
- package/lib/module/composites/wui-compatible-network/index.js.map +0 -1
- package/lib/module/composites/wui-list-token/index.js +0 -71
- package/lib/module/composites/wui-list-token/index.js.map +0 -1
- package/lib/module/composites/wui-list-token/styles.js +0 -24
- package/lib/module/composites/wui-list-token/styles.js.map +0 -1
- package/lib/module/composites/wui-list-transaction/index.js +0 -57
- package/lib/module/composites/wui-list-transaction/index.js.map +0 -1
- package/lib/module/composites/wui-list-transaction/styles.js +0 -10
- package/lib/module/composites/wui-list-transaction/styles.js.map +0 -1
- package/lib/module/composites/wui-list-transaction/utils.js +0 -79
- package/lib/module/composites/wui-list-transaction/utils.js.map +0 -1
- package/lib/module/composites/wui-token-button/index.js +0 -30
- package/lib/module/composites/wui-token-button/index.js.map +0 -1
- package/lib/module/composites/wui-token-button/styles.js +0 -18
- package/lib/module/composites/wui-token-button/styles.js.map +0 -1
- package/lib/module/composites/wui-transaction-visual/index.js +0 -66
- package/lib/module/composites/wui-transaction-visual/index.js.map +0 -1
- package/lib/module/composites/wui-transaction-visual/styles.js +0 -36
- package/lib/module/composites/wui-transaction-visual/styles.js.map +0 -1
- package/lib/module/utils/TransactionUtil.js +0 -134
- package/lib/module/utils/TransactionUtil.js.map +0 -1
- package/lib/typescript/assets/svg/ArrowBottomCircle.d.ts +0 -4
- package/lib/typescript/assets/svg/ArrowBottomCircle.d.ts.map +0 -1
- package/lib/typescript/assets/svg/Paperplane.d.ts +0 -4
- package/lib/typescript/assets/svg/Paperplane.d.ts.map +0 -1
- package/lib/typescript/composites/wui-account-pill/index.d.ts +0 -11
- package/lib/typescript/composites/wui-account-pill/index.d.ts.map +0 -1
- package/lib/typescript/composites/wui-account-pill/styles.d.ts +0 -18
- package/lib/typescript/composites/wui-account-pill/styles.d.ts.map +0 -1
- package/lib/typescript/composites/wui-balance/index.d.ts +0 -6
- package/lib/typescript/composites/wui-balance/index.d.ts.map +0 -1
- package/lib/typescript/composites/wui-banner/index.d.ts +0 -7
- package/lib/typescript/composites/wui-banner/index.d.ts.map +0 -1
- package/lib/typescript/composites/wui-banner/styles.d.ts +0 -14
- package/lib/typescript/composites/wui-banner/styles.d.ts.map +0 -1
- package/lib/typescript/composites/wui-compatible-network/index.d.ts +0 -10
- package/lib/typescript/composites/wui-compatible-network/index.d.ts.map +0 -1
- package/lib/typescript/composites/wui-list-token/index.d.ts +0 -11
- package/lib/typescript/composites/wui-list-token/index.d.ts.map +0 -1
- package/lib/typescript/composites/wui-list-token/styles.d.ts +0 -23
- package/lib/typescript/composites/wui-list-token/styles.d.ts.map +0 -1
- package/lib/typescript/composites/wui-list-transaction/index.d.ts +0 -15
- package/lib/typescript/composites/wui-list-transaction/index.d.ts.map +0 -1
- package/lib/typescript/composites/wui-list-transaction/styles.d.ts +0 -10
- package/lib/typescript/composites/wui-list-transaction/styles.d.ts.map +0 -1
- package/lib/typescript/composites/wui-list-transaction/utils.d.ts +0 -6
- package/lib/typescript/composites/wui-list-transaction/utils.d.ts.map +0 -1
- package/lib/typescript/composites/wui-token-button/index.d.ts +0 -7
- package/lib/typescript/composites/wui-token-button/index.d.ts.map +0 -1
- package/lib/typescript/composites/wui-token-button/styles.d.ts +0 -17
- package/lib/typescript/composites/wui-token-button/styles.d.ts.map +0 -1
- package/lib/typescript/composites/wui-transaction-visual/index.d.ts +0 -8
- package/lib/typescript/composites/wui-transaction-visual/index.d.ts.map +0 -1
- package/lib/typescript/composites/wui-transaction-visual/styles.d.ts +0 -35
- package/lib/typescript/composites/wui-transaction-visual/styles.d.ts.map +0 -1
- package/lib/typescript/utils/TransactionUtil.d.ts +0 -13
- package/lib/typescript/utils/TransactionUtil.d.ts.map +0 -1
- package/src/assets/svg/ArrowBottomCircle.tsx +0 -12
- package/src/assets/svg/Paperplane.tsx +0 -12
- package/src/composites/wui-account-pill/index.tsx +0 -72
- package/src/composites/wui-account-pill/styles.ts +0 -19
- package/src/composites/wui-balance/index.tsx +0 -25
- package/src/composites/wui-banner/index.tsx +0 -28
- package/src/composites/wui-banner/styles.ts +0 -15
- package/src/composites/wui-compatible-network/index.tsx +0 -64
- package/src/composites/wui-list-token/index.tsx +0 -83
- package/src/composites/wui-list-token/styles.ts +0 -24
- package/src/composites/wui-list-transaction/index.tsx +0 -65
- package/src/composites/wui-list-transaction/styles.ts +0 -10
- package/src/composites/wui-list-transaction/utils.ts +0 -83
- package/src/composites/wui-token-button/index.tsx +0 -29
- package/src/composites/wui-token-button/styles.ts +0 -18
- package/src/composites/wui-transaction-visual/index.tsx +0 -78
- package/src/composites/wui-transaction-visual/styles.ts +0 -36
- package/src/utils/TransactionUtil.ts +0 -173
|
@@ -1,173 +0,0 @@
|
|
|
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
|
-
};
|