Skip to content

Commit 9b68a2e

Browse files
committed
removed transakConfig object
1 parent 75db506 commit 9b68a2e

File tree

11 files changed

+39
-77
lines changed

11 files changed

+39
-77
lines changed

examples/react/src/components/Connected.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,6 @@ export const Connected = () => {
422422
recipientAddress: address,
423423
creditCardProviders: [creditCardProvider],
424424
onRampProvider: onRampProvider ? (onRampProvider as TransactionOnRampProvider) : TransactionOnRampProvider.transak,
425-
transakConfig: {
426-
contractId: isDev ? '68cd557b1f0d7a10940611a6' : '674eb5613d739107bbd18ed2'
427-
},
428425
onSuccess: (txnHash?: string) => {
429426
console.log('success!', txnHash)
430427
},

examples/react/src/components/CustomCheckout/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ export const CustomCheckout = () => {
5555
currencyAddress,
5656
collectionAddress,
5757
creditCardProvider: 'transak' as CreditCardProviders,
58-
transakConfig: {
59-
contractId
60-
},
6158
onSuccess: (txnHash?: string) => {
6259
console.log('success!', txnHash)
6360
},

examples/react/src/utils/checkout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export const checkoutPresets: Record<string, (recipientAddress: string) => Check
178178
}
179179
}
180180
},
181-
'forte-payment-erc1155-sale-native-token-testnet': (recipientAddress: string) => {
181+
'forte-transak-payment-erc1155-sale-native-token-testnet': (recipientAddress: string) => {
182182
const collectibles = [
183183
{
184184
tokenId: '1',

packages/checkout/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@ const CustomCheckoutUI = () => {
274274
currencyAddress,
275275
collectionAddress,
276276
creditCardProvider: 'transak' as CreditCardProviders,
277-
transakConfig: {
278-
contractId,
279-
},
280277
onSuccess: (txnHash?: string) => {
281278
console.log('success!', txnHash)
282279
},

packages/checkout/src/api/data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ export const fetchFortePaymentStatus = async (
503503
export interface TransakWidgetUrlArgs {
504504
isNFT?: boolean
505505
calldata?: string
506-
contractId?: string
506+
targetContractAddress?: string
507507
cryptoCurrencyCode?: string
508508
estimatedGasLimit?: number
509509
nftData?: string

packages/checkout/src/contexts/CheckoutModal.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ interface OrderSummaryItem {
1919
}
2020

2121
export interface TransakConfig {
22-
contractId: string
2322
callDataOverride?: string
2423
}
2524

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,7 @@ export const useCreditCardPayment = ({
8585
isLoadingTokenMetadatas || isLoadingCurrencyInfo || isLoadingCollectionInfo || creditCardProvider !== 'sardine'
8686

8787
const disableTransakWidgetUrlFetch =
88-
isLoadingTokenMetadatas ||
89-
isLoadingCurrencyInfo ||
90-
isLoadingCollectionInfo ||
91-
creditCardProvider !== 'transak' ||
92-
!transakConfig
88+
isLoadingTokenMetadatas || isLoadingCurrencyInfo || isLoadingCollectionInfo || creditCardProvider !== 'transak'
9389

9490
const { sardineCheckoutUrl: sardineProxyUrl } = useEnvironmentContext()
9591
const network = findSupportedNetwork(chain)
@@ -174,7 +170,7 @@ export const useCreditCardPayment = ({
174170
{
175171
isNFT: true,
176172
calldata: transakCallData,
177-
contractId: transakConfig?.contractId,
173+
targetContractAddress,
178174
cryptoCurrencyCode: currencySymbol,
179175
estimatedGasLimit,
180176
nftData: transakNftData,
@@ -188,9 +184,8 @@ export const useCreditCardPayment = ({
188184
)
189185

190186
const missingCreditCardProvider = !creditCardProvider
191-
const missingTransakConfig = !transakConfig && creditCardProvider === 'transak'
192187

193-
if (missingCreditCardProvider || missingTransakConfig) {
188+
if (missingCreditCardProvider) {
194189
return {
195190
error: new Error('Missing credit card provider or transak config'),
196191
data: {

packages/checkout/src/hooks/useSelectPaymentModal.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ type UseSelectPaymentModalReturnType = {
8080
* currencyAddress,
8181
* collectionAddress,
8282
* creditCardProviders: ['sardine', 'transak'],
83-
* transakConfig: {
84-
* contractId: 'your-contract-id',
85-
* },
8683
* copyrightText: 'ⓒ2024 Your Company',
8784
* onSuccess: (txnHash: string) => {
8885
* console.log('success!', txnHash)

packages/checkout/src/views/Checkout/PaymentMethodSelect/index.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ export const PaymentSelectionContent = () => {
3636

3737
const isFree = Number(price) == 0
3838

39-
const validCreditCardProviders = creditCardProviders.filter(provider => {
40-
if (provider === 'transak') {
41-
return !!selectPaymentSettings?.transakConfig
42-
}
43-
return true
44-
})
45-
4639
const [selectedTab, setSelectedTab] = useState<Tab>('crypto')
4740
const { clearCachedBalances } = useClearCachedBalances()
4841

@@ -52,7 +45,7 @@ export const PaymentSelectionContent = () => {
5245

5346
const isTokenIdUnknown = collectibles.some(collectible => !collectible.tokenId)
5447

55-
const showCreditCardPayment = validCreditCardProviders.length > 0 && !isTokenIdUnknown && !isFree
48+
const showCreditCardPayment = creditCardProviders.length > 0 && !isTokenIdUnknown && !isFree
5649

5750
const tabs: { label: string; value: Tab }[] = [
5851
{ label: 'Crypto', value: 'crypto' as Tab },

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

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -124,45 +124,36 @@ export const PayWithCreditCard = ({ settings, disableButtons, skipOnCloseCallbac
124124
return (
125125
<div className="flex flex-col justify-center items-center gap-2 w-full">
126126
{/* Only 1 option will be displayed, even if multiple providers are passed */}
127-
{creditCardProviders
128-
.slice(0, 1)
129-
.filter(provider => {
130-
// cannot display transak checkout if the settings aren't provided
131-
if (provider === 'transak' && !settings.transakConfig) {
132-
return false
133-
}
134-
return true
135-
})
136-
.map(creditCardProvider => {
137-
switch (creditCardProvider) {
138-
case 'sardine':
139-
case 'transak':
140-
case 'forte':
141-
case 'custom':
142-
return (
143-
<Card
144-
className="flex justify-between items-center p-4 cursor-pointer"
145-
key="sardine"
146-
onClick={() => {
147-
setSelectedPaymentProvider(creditCardProvider)
148-
}}
149-
disabled={disableButtons}
150-
>
151-
<div className="flex flex-row gap-3 items-center">
152-
<PaymentsIcon className="text-white" />
153-
<Text color="primary" variant="normal" fontWeight="bold">
154-
Pay with credit or debit card
155-
</Text>
156-
</div>
157-
<div style={{ transform: 'rotate(-45deg)' }}>
158-
<ArrowRightIcon className="text-white" />
159-
</div>
160-
</Card>
161-
)
162-
default:
163-
return null
164-
}
165-
})}
127+
{creditCardProviders.slice(0, 1).map(creditCardProvider => {
128+
switch (creditCardProvider) {
129+
case 'sardine':
130+
case 'transak':
131+
case 'forte':
132+
case 'custom':
133+
return (
134+
<Card
135+
className="flex justify-between items-center p-4 cursor-pointer"
136+
key="sardine"
137+
onClick={() => {
138+
setSelectedPaymentProvider(creditCardProvider)
139+
}}
140+
disabled={disableButtons}
141+
>
142+
<div className="flex flex-row gap-3 items-center">
143+
<PaymentsIcon className="text-white" />
144+
<Text color="primary" variant="normal" fontWeight="bold">
145+
Pay with credit or debit card
146+
</Text>
147+
</div>
148+
<div style={{ transform: 'rotate(-45deg)' }}>
149+
<ArrowRightIcon className="text-white" />
150+
</div>
151+
</Card>
152+
)
153+
default:
154+
return null
155+
}
156+
})}
166157
</div>
167158
)
168159
}

0 commit comments

Comments
 (0)