diff --git a/examples/react/src/components/Homepage.tsx b/examples/react/src/components/Homepage.tsx
index 901be570..f19e4d56 100644
--- a/examples/react/src/components/Homepage.tsx
+++ b/examples/react/src/components/Homepage.tsx
@@ -24,7 +24,7 @@ import {
getModalPositionCss,
useStorage
} from '@0xsequence/kit'
-import { useCheckoutModal } from '@0xsequence/kit-checkout'
+import { useCheckoutModal, useAddFundsModal } from '@0xsequence/kit-checkout'
import { useOpenWalletModal } from '@0xsequence/kit-wallet'
import { allNetworks } from '@0xsequence/network'
import { ethers } from 'ethers'
@@ -61,6 +61,7 @@ export const Homepage = () => {
const { setOpenConnectModal } = useOpenConnectModal()
const { setOpenWalletModal } = useOpenWalletModal()
const { triggerCheckout } = useCheckoutModal()
+ const { triggerAddFunds } = useAddFundsModal()
const { disconnect } = useDisconnect()
const { data: walletClient } = useWalletClient()
const { switchChain } = useSwitchChain()
@@ -372,6 +373,12 @@ export const Homepage = () => {
}
}
+ const onClickAddFunds = () => {
+ triggerAddFunds({
+ walletAddress: address || '',
+ })
+ }
+
const SwitchThemeButton = () => {
return
}
@@ -461,7 +468,11 @@ export const Homepage = () => {
)}
-
+ onClickAddFunds()}
+ />
{
const { location } = navigation
switch (location) {
default:
- return
+ return
}
}
@@ -167,7 +173,7 @@ export const KitCheckoutContent = ({ children }: KitCheckoutProvider) => {
}}
scroll={false}
backdropColor="backgroundBackdrop"
- onClose={() => setOpenCheckoutModal(false)}
+ onClose={() => setOpenAddFundsModal(false)}
>
{getAddFundsHeader()}
diff --git a/packages/checkout/src/utils/transak.ts b/packages/checkout/src/utils/transak.ts
index 834bf87f..56ac3960 100644
--- a/packages/checkout/src/utils/transak.ts
+++ b/packages/checkout/src/utils/transak.ts
@@ -6,14 +6,14 @@ export const getTransakLink = (addFundsSettings: AddFundsSettings) => {
const defaultNetworks = "ethereum,mainnet,arbitrum,optimism,polygon,polygonzkevm,zksync,base,bnb,oasys,astar,avaxcchain"
interface Options {
- [index: string]: string
+ [index: string]: string | undefined
}
const options: Options = {
apiKey: TRANSAK_API_KEY,
referrerDomain: window.location.origin,
walletAddress: addFundsSettings.walletAddress,
- fiatCurrency: addFundsSettings.fiatCurrency,
+ fiatCurrency: addFundsSettings?.fiatCurrency,
disableWalletAddressForm: 'true',
defaultFiatAmount: addFundsSettings?.defaultFiatAmount || '50',
defaultCryptoCurrency: addFundsSettings?.defaultCryptoCurrency || 'USDC',
diff --git a/packages/checkout/src/views/AddFunds.tsx b/packages/checkout/src/views/AddFunds.tsx
index 420189a1..57c87ca7 100644
--- a/packages/checkout/src/views/AddFunds.tsx
+++ b/packages/checkout/src/views/AddFunds.tsx
@@ -1,3 +1,4 @@
+import React from 'react'
import {
Box,
} from '@0xsequence/design-system'
@@ -15,7 +16,7 @@ export const AddFundsContent = () => {
const link = getTransakLink(addFundsSettings)
return (
-
+
)