File tree Expand file tree Collapse file tree 3 files changed +33
-4
lines changed
Expand file tree Collapse file tree 3 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import { fetchSardineOrderStatus } from '../../api/data.js'
1111import type { TransakConfig } from '../../contexts/CheckoutModal.js'
1212import { useEnvironmentContext } from '../../contexts/Environment.js'
1313import type { Collectible , CreditCardProviders } from '../../contexts/SelectPaymentModal.js'
14- import { TRANSAK_PROXY_ADDRESS } from '../../utils/transak.js'
14+ import { TRANSAK_PROXY_ADDRESS , getCurrencyCode } from '../../utils/transak.js'
1515import { useSardineClientToken } from '../useSardineClientToken.js'
1616
1717import { useTransakWidgetUrl } from '../useTransakWidgetUrl.js'
@@ -171,7 +171,11 @@ export const useCreditCardPayment = ({
171171 isNFT : true ,
172172 calldata : transakCallData ,
173173 targetContractAddress,
174- cryptoCurrencyCode : currencySymbol ,
174+ cryptoCurrencyCode : getCurrencyCode ( {
175+ chainId : network ?. chainId || 137 ,
176+ currencyAddress,
177+ defaultCurrencyCode : currencySymbol || 'ETH'
178+ } ) ,
175179 estimatedGasLimit,
176180 nftData : transakNftData ,
177181 walletAddress : recipientAddress ,
Original file line number Diff line number Diff line change 1+ import { ChainId } from '@0xsequence/network'
2+ import { zeroAddress } from 'viem'
3+
14import type { AddFundsSettings } from '../contexts/AddFundsModal.js'
25
36export const TRANSAK_PROXY_ADDRESS = '0x4a598b7ec77b1562ad0df7dc64a162695ce4c78a'
@@ -29,3 +32,21 @@ export const fetchTransakSupportedCountries = async () => {
2932
3033 return data . response . filter ( x => x . isAllowed ) . map ( x => x . alpha2 )
3134}
35+
36+ interface GetCurrencyCodeParams {
37+ chainId : number
38+ currencyAddress : string
39+ defaultCurrencyCode : string
40+ }
41+
42+ export const getCurrencyCode = ( { chainId, currencyAddress, defaultCurrencyCode } : GetCurrencyCodeParams ) => {
43+ const currencyCodeByAddress : { [ chainId : number ] : { [ currencyAddress : string ] : string | undefined } | undefined } = {
44+ [ ChainId . SEPOLIA ] : {
45+ [ zeroAddress ] : 'ETH'
46+ }
47+ }
48+
49+ const foundCurrencyAddress = currencyCodeByAddress ?. [ chainId ] ?. [ currencyAddress . toLowerCase ( ) ]
50+
51+ return foundCurrencyAddress || defaultCurrencyCode
52+ }
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import {
1818 useTransactionStatusModal
1919} from '../hooks/index.js'
2020import { useTransakWidgetUrl } from '../hooks/useTransakWidgetUrl.js'
21- import { TRANSAK_PROXY_ADDRESS } from '../utils/transak.js'
21+ import { TRANSAK_PROXY_ADDRESS , getCurrencyCode } from '../utils/transak.js'
2222
2323const POLLING_TIME = 10 * 1000
2424
@@ -136,7 +136,11 @@ export const PendingCreditCardTransactionTransak = ({ skipOnCloseCallback }: Pen
136136 isNFT : true ,
137137 calldata : transakCallData ,
138138 targetContractAddress : creditCardCheckout . contractAddress ,
139- cryptoCurrencyCode : creditCardCheckout . currencySymbol ,
139+ cryptoCurrencyCode : getCurrencyCode ( {
140+ chainId : creditCardCheckout . chainId ,
141+ currencyAddress : creditCardCheckout . currencyAddress ,
142+ defaultCurrencyCode : creditCardCheckout . currencySymbol || 'ETH'
143+ } ) ,
140144 estimatedGasLimit,
141145 nftData : transakNftData ,
142146 walletAddress : creditCardCheckout . recipientAddress ,
You can’t perform that action at this time.
0 commit comments