Skip to content

Commit 431a8ec

Browse files
chore: code improvements
1 parent 7a073e3 commit 431a8ec

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

packages/core/src/controllers/OnRampController.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,3 @@ export const OnRampController = {
661661
this.updateSelectedPurchaseCurrency();
662662
}
663663
};
664-
665-
// Add getQuotesDebounced to the controller after definition to avoid circular reference
666-
(OnRampController as any).getQuotesDebounced = CoreHelperUtil.debounce(function () {
667-
OnRampController.getQuotes();
668-
}, 500);

packages/scaffold/src/views/w3m-onramp-view/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
import { NumberUtil, StringUtil } from '@reown/appkit-common-react-native';
2424
import { SelectorModal } from '../../partials/w3m-selector-modal';
2525
import { Currency, ITEM_HEIGHT as CURRENCY_ITEM_HEIGHT } from './components/Currency';
26-
import { getPurchaseCurrencies } from './utils';
26+
import { getPurchaseCurrencies, getQuotesDebounced } from './utils';
2727
import { CurrencyInput } from './components/CurrencyInput';
2828
import { SelectPaymentModal } from './components/SelectPaymentModal';
2929
import { Header } from './components/Header';
@@ -108,7 +108,7 @@ export function OnRampView() {
108108
}
109109

110110
OnRampController.setPaymentAmount(value);
111-
OnRampController.getQuotesDebounced();
111+
getQuotesDebounced();
112112
};
113113

114114
const handleSearch = (value: string) => {

packages/scaffold/src/views/w3m-onramp-view/utils.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { OnRampController, NetworkController } from '@reown/appkit-core-react-native';
1+
import {
2+
OnRampController,
3+
NetworkController,
4+
CoreHelperUtil
5+
} from '@reown/appkit-core-react-native';
26

37
// -------------------------- Utils --------------------------
48
export const getPurchaseCurrencies = (searchValue?: string, filterSelected?: boolean) => {
@@ -20,3 +24,7 @@ export const getPurchaseCurrencies = (searchValue?: string, filterSelected?: boo
2024
)
2125
: networkTokens;
2226
};
27+
28+
export const getQuotesDebounced = CoreHelperUtil.debounce(function () {
29+
OnRampController.getQuotes();
30+
}, 500);

0 commit comments

Comments
 (0)