@@ -9,24 +9,51 @@ import styled from "styled-components";
99import { DSColor , DSTypography } from "@keplr-wallet/design-system" ;
1010
1111const KNOWN_SELECTORS : Record < string , string > = {
12- "0xa9059cbb" : "Transfer " ,
13- "0x095ea7b3" : "Approve " ,
14- "0x23b872dd" : "Transfer From " ,
15- "0x42842e0e" : "Safe Transfer From " ,
16- "0x38ed1739" : "Swap Tokens " ,
17- "0x7ff36ab5" : "Swap ETH for Tokens " ,
18- "0x18cbafe5" : "Swap Tokens for ETH " ,
19- "0x5c11d795" : "Swap Exact Tokens " ,
20- "0xfb3bdb41" : "Swap ETH for Exact Tokens " ,
21- "0x3593564c" : "Execute (Universal Router) " ,
22- "0x04e45aaf" : "Exact Input Single " ,
23- "0xb858183f" : "Exact Input " ,
24- "0x414bf389" : "Exact Input Single (V3) " ,
25- "0xd0e30db0" : "Deposit (Wrap) " ,
26- "0x2e1a7d4d" : "Withdraw (Unwrap) " ,
12+ "0xa9059cbb" : "transfer " ,
13+ "0x095ea7b3" : "approve " ,
14+ "0x23b872dd" : "transfer-from " ,
15+ "0x42842e0e" : "safe-transfer-from " ,
16+ "0x38ed1739" : "swap-tokens " ,
17+ "0x7ff36ab5" : "swap-eth- for-tokens " ,
18+ "0x18cbafe5" : "swap-tokens- for-eth " ,
19+ "0x5c11d795" : "swap-exact-tokens " ,
20+ "0xfb3bdb41" : "swap-eth- for-exact-tokens " ,
21+ "0x3593564c" : "execute-universal-router " ,
22+ "0x04e45aaf" : "exact-input-single " ,
23+ "0xb858183f" : "exact-input " ,
24+ "0x414bf389" : "exact-input-single-v3 " ,
25+ "0xd0e30db0" : "deposit-wrap " ,
26+ "0x2e1a7d4d" : "withdraw-unwrap " ,
2727} ;
2828
29- function decodeMethodName ( data : string | undefined ) : string | null {
29+ const METHOD_NAMES : Record < string , { ko : string ; en : string } > = {
30+ transfer : { ko : "전송" , en : "Transfer" } ,
31+ approve : { ko : "승인" , en : "Approve" } ,
32+ "transfer-from" : { ko : "전송 (대리)" , en : "Transfer From" } ,
33+ "safe-transfer-from" : { ko : "안전 전송 (대리)" , en : "Safe Transfer From" } ,
34+ "swap-tokens" : { ko : "토큰 스왑" , en : "Swap Tokens" } ,
35+ "swap-eth-for-tokens" : { ko : "ETH → 토큰 스왑" , en : "Swap ETH for Tokens" } ,
36+ "swap-tokens-for-eth" : { ko : "토큰 → ETH 스왑" , en : "Swap Tokens for ETH" } ,
37+ "swap-exact-tokens" : { ko : "정확한 토큰 스왑" , en : "Swap Exact Tokens" } ,
38+ "swap-eth-for-exact-tokens" : {
39+ ko : "ETH → 정확한 토큰 스왑" ,
40+ en : "Swap ETH for Exact Tokens" ,
41+ } ,
42+ "execute-universal-router" : {
43+ ko : "실행 (유니버설 라우터)" ,
44+ en : "Execute (Universal Router)" ,
45+ } ,
46+ "exact-input-single" : { ko : "단일 정확 입력" , en : "Exact Input Single" } ,
47+ "exact-input" : { ko : "정확 입력" , en : "Exact Input" } ,
48+ "exact-input-single-v3" : {
49+ ko : "단일 정확 입력 (V3)" ,
50+ en : "Exact Input Single (V3)" ,
51+ } ,
52+ "deposit-wrap" : { ko : "예치 (래핑)" , en : "Deposit (Wrap)" } ,
53+ "withdraw-unwrap" : { ko : "인출 (언래핑)" , en : "Withdraw (Unwrap)" } ,
54+ } ;
55+
56+ function decodeMethodKey ( data : string | undefined ) : string | null {
3057 if ( ! data || data === "0x" || data . length < 10 ) return null ;
3158 const selector = data . slice ( 0 , 10 ) . toLowerCase ( ) ;
3259 return KNOWN_SELECTORS [ selector ] ?? null ;
@@ -63,7 +90,10 @@ const CallCard: FunctionComponent<{
6390 }
6491 } ) ( ) ;
6592
66- const methodName = decodeMethodName ( call . data ) ;
93+ const methodKey = decodeMethodKey ( call . data ) ;
94+ const methodName = methodKey
95+ ? t ( METHOD_NAMES [ methodKey ] . ko , METHOD_NAMES [ methodKey ] . en )
96+ : null ;
6797 const dataPreview =
6898 call . data && call . data !== "0x" ? call . data . slice ( 0 , 10 ) : null ;
6999
0 commit comments