UNPKG

@suiware/kit

Version:

Opinionated React components and hooks for building Sui dApps.

1 lines 2.02 kB
{"version":3,"sources":["../src/components/Faucet.tsx"],"names":[],"mappings":";;;;;AA2BA,IAAM,MAAA,GAAsB,CAAC,KAAU,KAAA;AACrC,EAAM,MAAA,EAAE,OAAS,EAAA,SAAA,EAAc,GAAA,KAAA;AAE/B,EAAM,MAAA,EAAE,IAAK,EAAA,GAAI,iBAAU,CAAA;AAAA,IACzB,OAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EACE,uBAAA,IAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,SAAA;AAAA,MACR,SAAU,EAAA,kBAAA;AAAA,MACV,OAAA,EAAS,MAAM,IAAK,EAAA;AAAA,MAEpB,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,aAAc,EAAA,EAAA,CAAA;AAAA,QAAE;AAAA;AAAA;AAAA,GAEnB;AAEJ,CAAA;AAEA,IAAO,cAAQ,GAAA","file":"chunk-FLUV4VNP.mjs","sourcesContent":["import { Button } from '@radix-ui/themes'\nimport { HandCoinsIcon } from 'lucide-react'\nimport { FC } from 'react'\nimport useFaucet from '~~/hooks/useFaucet'\n\nexport interface IFaucet {\n onError?: (error: Error | null, errorMessage?: string) => void\n onSuccess?: (message: string) => void\n}\n\n/**\n * The `Faucet` component renders a button that lets user fund their current address on the currently selected test network.\n *\n * The supported networks are **localnet**, **devnet** and **testnet**.\n * The granted amount is:\n * - localnet: 100 SUI\n * - devnet: 10 SUI\n * - testnet: 1 SUI\n * For the **testnet**, the faucet link is opened in a new tab.\n * Please note there is a certain quota for requesting funds from **devnet** and **testnet**.\n * If you have reached the limit, wait for 24 hours, and in the meanwhile use the `#devnet-faucet` and `#testnet-faucet` channels\n * of the official Sui Discord https://discord.gg/sui\n *\n * The component is using the useFaucet hook to fund the current address.\n *\n * @param {IFaucet} props The component props.\n */\nconst Faucet: FC<IFaucet> = (props) => {\n const { onError, onSuccess } = props\n\n const { fund } = useFaucet({\n onError,\n onSuccess,\n })\n\n return (\n <Button\n variant=\"surface\"\n className=\"sk-faucet-button\"\n onClick={() => fund()}\n >\n <HandCoinsIcon />\n Faucet\n </Button>\n )\n}\n\nexport default Faucet\n"]}