Skip to content

Commit 1d7c8ef

Browse files
committed
added approvedspender field
1 parent f05f1f3 commit 1d7c8ef

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

packages/checkout/src/api/data.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ export interface CreateFortePaymentIntentArgs {
290290
currencyQuantity: string
291291
protocolConfig: ForteConfig
292292
calldata: string | StructuredCalldata
293+
approvedSpenderAddress?: string
293294
}
294295

295296
const forteCurrencyMap: { [chainId: string]: { [currencyAddress: string]: string } } = {
@@ -325,7 +326,8 @@ export const createFortePaymentIntent = async (forteApiUrl: string, args: Create
325326
tokenId,
326327
protocolConfig,
327328
currencyAddress,
328-
currencyQuantity
329+
currencyQuantity,
330+
approvedSpenderAddress
329331
} = args
330332

331333
const network = findSupportedNetwork(chainId)
@@ -362,6 +364,7 @@ export const createFortePaymentIntent = async (forteApiUrl: string, args: Create
362364
image_url: imageUrl,
363365
title: nftName,
364366
mint_data: {
367+
...(approvedSpenderAddress ? { pay_to_address: approvedSpenderAddress } : {}),
365368
token_contract_address: nftAddress,
366369
token_ids: tokenId ? [tokenId] : [],
367370
protocol_address: targetContractAddress,
@@ -391,6 +394,7 @@ export const createFortePaymentIntent = async (forteApiUrl: string, args: Create
391394
}
392395
} else if (protocolConfig.protocol == 'custom_evm_call') {
393396
listingData = {
397+
...(approvedSpenderAddress ? { pay_to_address: approvedSpenderAddress } : {}),
394398
protocol: protocolConfig.protocol,
395399
protocol_address: targetContractAddress,
396400
...(typeof protocolConfig.calldata === 'string'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const PayWithCreditCard = ({ settings, disableButtons, skipOnCloseCallbac
108108
nftDecimals: collectible.decimals === undefined ? undefined : String(collectible.decimals),
109109
provider: selectedPaymentProvider as BasePaymentProviderOptions,
110110
calldata: txData,
111-
approvedSpenderAddress: sardineConfig?.approvedSpenderAddress || targetContractAddress,
111+
approvedSpenderAddress: sardineConfig?.approvedSpenderAddress || settings.approvedSpenderAddress,
112112
supplementaryAnalyticsInfo,
113113
transakConfig,
114114
forteConfig

packages/checkout/src/views/PendingCreditCardTransaction.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,8 @@ export const PendingCreditCardTransactionForte = ({ skipOnCloseCallback }: Pendi
470470
Number(creditCardCheckout.currencyDecimals || 18)
471471
)
472472

473+
console.log('creditCardCheckout', creditCardCheckout)
474+
473475
const { data: paymentIntentData, isError: isErrorPaymentIntent } = useFortePaymentIntent(
474476
{
475477
accessToken: accessTokenData?.accessToken || '',
@@ -488,7 +490,8 @@ export const PendingCreditCardTransactionForte = ({ skipOnCloseCallback }: Pendi
488490
calldata:
489491
creditCardCheckout.forteConfig!.protocol === 'mint'
490492
? creditCardCheckout.forteConfig!.calldata
491-
: creditCardCheckout.calldata
493+
: creditCardCheckout.calldata,
494+
approvedSpenderAddress: creditCardCheckout.approvedSpenderAddress
492495
},
493496
{
494497
disabled: isLoadingTokenMetadata || isLoadingAccessToken

0 commit comments

Comments
 (0)