@@ -27,7 +27,7 @@ type UseTransakIframeProps = {
2727 onError ?: ( ) => void ;
2828} ;
2929
30- const MAX_GAS_LIMIT = ' 30000000' ;
30+ const MAX_GAS_LIMIT = 30000000 ;
3131
3232export const TRANSAK_API_BASE_URL = {
3333 [ Environment . SANDBOX ] : 'https://api-stg.transak.com' ,
@@ -69,42 +69,25 @@ export const useTransakIframe = (props: UseTransakIframeProps) => {
6969 // as transak currently only supports on nft at a time
7070 const nftData = nfts ?. slice ( 0 , 1 )
7171 . map ( ( item ) => ( {
72- ...item ,
73- imageURL : sanitizeToLatin1 ( item . imageURL ) ,
74- nftName : sanitizeToLatin1 ( item . nftName ) ,
72+ collection_address : item . collectionAddress ,
73+ image_url : sanitizeToLatin1 ( item . imageURL ) ,
74+ nft_name : sanitizeToLatin1 ( item . nftName ) ,
75+ nft_type : item . nftType ,
76+ price : item . price ,
77+ quantity : item . quantity ,
78+ token_id : item . tokenID ,
7579 } ) ) ;
7680
7781 const gasLimit = estimatedGasLimit > 0 ? estimatedGasLimit : MAX_GAS_LIMIT ;
7882
79- const params = {
80- contractId,
81- cryptoCurrencyCode,
82- calldata,
83- nftData,
84- estimatedGasLimit : gasLimit . toString ( ) ,
85- } ;
86-
87- // eslint-disable-next-line max-len
88- const baseApiUrl = `${ TRANSAK_API_BASE_URL [ environment ] } /cryptocoverage/api/v1/public/one-click-protocol/nft-transaction-id` ;
89-
90- const response = await fetch ( baseApiUrl , {
91- method : 'POST' ,
92- headers : {
93- // eslint-disable-next-line @typescript-eslint/naming-convention
94- 'Content-Type' : 'application/json' ,
95- } ,
96- body : JSON . stringify ( params ) ,
97- } ) ;
98-
99- if ( ! response . ok ) {
100- throw new Error ( 'Failed to get NFT transaction ID' ) ;
101- }
102-
103- const { id : nftTransactionId } = await response . json ( ) ;
104-
10583 const requestBody : Record < string , unknown > = {
84+ is_nft : true ,
85+ contract_id : contractId ,
86+ crypto_currency_code : cryptoCurrencyCode ,
87+ calldata,
88+ nft_data : nftData ,
89+ estimated_gas_limit : gasLimit ,
10690 api_key : TRANSAK_API_KEY [ environment ] ,
107- nft_transaction_id : nftTransactionId ,
10891 theme_color : '0D0D0D' ,
10992 exchange_screen_title : exchangeScreenTitle ,
11093 wallet_address : walletAddress ,
0 commit comments