Skip to content

Commit f5822e8

Browse files
committed
fixed presets
1 parent fc001a8 commit f5822e8

File tree

4 files changed

+6
-70
lines changed

4 files changed

+6
-70
lines changed

examples/react/src/components/Connected.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const searchParams = new URLSearchParams(location.search)
4242
const isDebugMode = searchParams.has('debug')
4343
const checkoutProvider = searchParams.get('checkoutProvider')
4444
const onRampProvider = searchParams.get('onRampProvider')
45-
const checkoutPreset = searchParams.get('checkoutPreset') || 'forte-payment-erc1155-sale-native-token-testnet'
45+
const checkoutPreset = searchParams.get('checkoutPreset') || 'forte-transak-payment-erc1155-sale-native-token-testnet'
4646

4747
// @ts-ignore
4848
const isDev = __SEQUENCE_WEB_SDK_IS_DEV__

packages/checkout/src/hooks/useCheckoutUI/useCreditCardPayment.tsx

Lines changed: 4 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import React, { useEffect, useMemo, useRef } from 'react'
77
import { formatUnits, zeroAddress, type Hex } from 'viem'
88

99
import type { TransakConfig } from '../../contexts/CheckoutModal.js'
10-
import { useEnvironmentContext } from '../../contexts/Environment.js'
1110
import type { Collectible, CreditCardProviders } from '../../contexts/SelectPaymentModal.js'
1211
import { TRANSAK_PROXY_ADDRESS, getCurrencyCode } from '../../utils/transak.js'
1312

@@ -77,13 +76,10 @@ export const useCreditCardPayment = ({
7776
}: UseCreditCardPaymentArgs): UseCreditCardPaymentReturn => {
7877
const projectAccessKey = useProjectAccessKey()
7978
const { env } = useConfig()
80-
const disableSardineClientTokenFetch =
81-
isLoadingTokenMetadatas || isLoadingCurrencyInfo || isLoadingCollectionInfo || creditCardProvider !== 'sardine'
8279

8380
const disableTransakWidgetUrlFetch =
8481
isLoadingTokenMetadatas || isLoadingCurrencyInfo || isLoadingCollectionInfo || creditCardProvider !== 'transak'
8582

86-
const { sardineCheckoutUrl: sardineProxyUrl } = useEnvironmentContext()
8783
const network = findSupportedNetwork(chain)
8884
const error = errorCollectionInfo || errorTokenMetadata || errorCurrencyInfo
8985
const isLoading = isLoadingCollectionInfo || isLoadingTokenMetadatas || isLoadingCurrencyInfo
@@ -93,33 +89,6 @@ export const useCreditCardPayment = ({
9389
const iframeRef = useRef<HTMLIFrameElement | null>(null)
9490
const tokenMetadata = tokenMetadatas?.[0]
9591

96-
const {
97-
data: dataClientToken,
98-
isLoading: isLoadingClientToken,
99-
error: errorClientToken
100-
} = useSardineClientToken(
101-
{
102-
order: {
103-
chainId: network?.chainId || 137,
104-
contractAddress: targetContractAddress,
105-
recipientAddress,
106-
currencyQuantity: totalPriceRaw,
107-
currencySymbol: currencyInfo?.symbol || 'POL',
108-
currencyDecimals: String(currencyDecimals || 18),
109-
currencyAddress,
110-
nftId: collectible.tokenId ?? '',
111-
nftAddress: collectionAddress,
112-
nftQuantity: collectible.quantity,
113-
nftDecimals: String(dataCollectionInfo?.decimals || 18),
114-
calldata: txData
115-
},
116-
projectAccessKey: projectAccessKey,
117-
apiClientUrl: env.apiUrl,
118-
tokenMetadata: tokenMetadata
119-
},
120-
disableSardineClientTokenFetch
121-
)
122-
12392
// Transak requires the recipient address to be the proxy address
12493
// so we need to replace the recipient address with the proxy address in the calldata
12594
// this is a weird hack so that credit card integrations are as simple as possible and should work 99% of the time
@@ -234,43 +203,14 @@ export const useCreditCardPayment = ({
234203
},
235204
isLoading: isLoadingTransakLink
236205
}
237-
])
238-
239-
const transakNftData = encodeURIComponent(btoa(transakNftDataJson))
240-
241-
const estimatedGasLimit = '500000'
242-
243-
const partnerOrderId = `${recipientAddress}-${new Date().getTime()}`
244-
245-
// Note: the network name might not always line up with Transak. A conversion function might be necessary
246-
const networkName = network?.name.toLowerCase()
247-
const transakLink = `${transakApiUrl}?apiKey=${transakApiKey}&isNFT=true&calldata=${transakCallData}&contractId=${transakConfig?.contractId}&cryptoCurrencyCode=${currencySymbol}&estimatedGasLimit=${estimatedGasLimit}&nftData=${transakNftData}&walletAddress=${recipientAddress}&disableWalletAddressForm=true&partnerOrderId=${partnerOrderId}&network=${networkName}`
206+
}
248207

249208
return {
250209
error: null,
251210
data: {
252-
iframeId: TRANSAK_IFRAME_ID,
253-
paymentUrl: transakLink,
254-
CreditCardIframe: () => (
255-
<div className="flex items-center justify-center" style={{ height: '770px' }}>
256-
<iframe
257-
id="transakIframe"
258-
ref={iframeRef}
259-
allow="camera;microphone;payment"
260-
src={transakLink}
261-
style={{
262-
maxHeight: '650px',
263-
height: '100%',
264-
maxWidth: '380px',
265-
width: '100%'
266-
}}
267-
referrerPolicy="strict-origin-when-cross-origin"
268-
/>
269-
</div>
270-
),
271-
EventListener: () => (
272-
<TransakEventListener onSuccess={onSuccess} onError={onError} isLoading={isLoading} iframeRef={iframeRef} />
273-
)
211+
iframeId: '',
212+
CreditCardIframe: () => null,
213+
EventListener: () => null
274214
},
275215
isLoading: false
276216
}

packages/checkout/src/views/PaymentSelection/PayWithCreditCard/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,8 @@ export const PayWithCreditCard = ({ settings, disableButtons, skipOnCloseCallbac
121121
const Options = () => {
122122
return (
123123
<div className="flex flex-col justify-center items-center gap-2 w-full">
124-
{/* Only 1 option will be displayed, even if multiple providers are passed */}
125124
{creditCardProviders.slice(0, 1).map(creditCardProvider => {
126125
switch (creditCardProvider) {
127-
case 'sardine':
128126
case 'transak':
129127
case 'forte':
130128
case 'custom':

packages/connect/src/styles.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,6 +2513,4 @@ export const styles = String.raw`
25132513
--tw-gradient-to-position: 100%;
25142514
}
25152515
}
2516-
}
2517-
2518-
`
2516+
}`

0 commit comments

Comments
 (0)