Skip to content

Commit

Permalink
add leading 0
Browse files Browse the repository at this point in the history
  • Loading branch information
alissacrane-cb committed Dec 16, 2024
1 parent 3282b1d commit edcf11d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/swap/components/SwapLiteDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ export function SwapLiteDropdown() {
(paymentMethodId: string) => {
return () => {
const assetSymbol = to?.token?.symbol;
const fundAmount = to?.amount;
let fundAmount = to?.amount;
// funding url requires a leading zero if the amount is less than 1
if (fundAmount?.[0] === '.') {
fundAmount = `0${fundAmount}`;
}
const fundingUrl = `${ONRAMP_BUY_URL}/one-click?appId=${projectId}&addresses={"${address}":["base"]}&assets=["${assetSymbol}"]&presetCryptoAmount=${fundAmount}&defaultPaymentMethod=${paymentMethodId}`;
const { height, width } = getFundingPopupSize('md', fundingUrl);
const popupWindow = openPopup({
Expand Down

0 comments on commit edcf11d

Please sign in to comment.