MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / RootRPCMethodsUI

Function RootRPCMethodsUI

app/components/Nav/Main/RootRPCMethodsUI.js:73–416  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

71const hstInterface = new ethers.utils.Interface(abi);
72
73const RootRPCMethodsUI = (props) => {
74 const { trackEvent, trackAnonymousEvent } = useMetrics();
75 const [transactionModalType, setTransactionModalType] = useState(undefined);
76 const tokenList = useSelector(selectTokenList);
77 const setTransactionObject = props.setTransactionObject;
78 const setEtherTransaction = props.setEtherTransaction;
79
80 const initializeWalletConnect = () => {
81 WalletConnect.init();
82 };
83
84 const trackSwaps = useCallback(
85 async (event, transactionMeta) => {
86 try {
87 const { TransactionController } = Engine.context;
88 const newSwapsTransactions = props.swapsTransactions;
89 const swapTransaction = newSwapsTransactions[transactionMeta.id];
90 const {
91 sentAt,
92 gasEstimate,
93 ethAccountBalance,
94 approvalTransactionMetaId,
95 } = swapTransaction.paramsForAnalytics;
96
97 const approvalTransaction =
98 TransactionController.state.transactions.find(
99 ({ id }) => id === approvalTransactionMetaId,
100 );
101 const ethBalance = await query(
102 TransactionController.ethQuery,
103 'getBalance',
104 [props.selectedAddress],
105 );
106 const receipt = await query(
107 TransactionController.ethQuery,
108 'getTransactionReceipt',
109 [transactionMeta.hash],
110 );
111
112 const currentBlock = await query(
113 TransactionController.ethQuery,
114 'getBlockByHash',
115 [receipt.blockHash, false],
116 );
117 let approvalReceipt;
118 if (approvalTransaction?.hash) {
119 approvalReceipt = await query(
120 TransactionController.ethQuery,
121 'getTransactionReceipt',
122 [approvalTransaction.hash],
123 );
124 }
125 const tokensReceived = swapsUtils.getSwapsTokensReceived(
126 receipt,
127 approvalReceipt,
128 transactionMeta?.txParams,
129 approvalTransaction?.txParams,
130 swapTransaction.destinationToken,

Callers

nothing calls this directly

Calls 15

useMetricsFunction · 0.90
getAddressAccountTypeFunction · 0.90
isHardwareAccountFunction · 0.90
getLedgerKeyringFunction · 0.90
stringsFunction · 0.90
isSwapTransactionFunction · 0.90
hexToBNFunction · 0.90
getMethodDataFunction · 0.90
toLowerCaseEqualsFunction · 0.90
getTokenValueParamFunction · 0.90
getTokenAddressParamFunction · 0.90
calcTokenAmountFunction · 0.90

Tested by

no test coverage detected