Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions examples/react-wallet-kit/src/components/demo/DemoPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default function DemoPanel() {
handleImportWallet,
handleConnectExternalWallet,
fetchWalletProviders,
handleOnRamp,
} = useTurnkey();

const { pushPage } = useModal();
Expand Down Expand Up @@ -112,6 +113,18 @@ export default function DemoPanel() {
}
}, [wallets]);

const handleAddFunds = async () => {
try {
await handleOnRamp({
onrampProvider: "FIAT_ON_RAMP_PROVIDER_MOONPAY",
walletAccount: selectedWalletAccount!,
sandboxMode: true,
});
} catch (error) {
handleError(error);
}
};

function truncateAddress(address: string) {
return `${address.slice(0, 4)}...${address.slice(-4)}`;
}
Expand Down Expand Up @@ -385,6 +398,13 @@ export default function DemoPanel() {
>
Sign Message
</Button>

<Button
className="bg-primary-light dark:bg-primary-dark text-primary-text-light dark:text-primary-text-dark rounded-lg px-4 py-2 active:scale-95 transition-transform cursor-pointer"
onClick={handleAddFunds}
>
Add Funds
</Button>
{selectedWallet?.source === WalletSource.Embedded && (
<>
<hr className="border-draggable-background-light dark:border-draggable-background-dark" />
Expand Down
6 changes: 5 additions & 1 deletion packages/react-wallet-kit/src/providers/client/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5331,7 +5331,11 @@ export const ClientProvider: React.FC<ClientProviderProps> = ({
pollingRef.current = null;
}
};

useEffect(() => {
return () => {
cleanup();
};
}, []);
const action = async () => {
try {
let onRampWindow: Window | null = null;
Expand Down
Loading