faucet.useFund
Hook for funding an account with testnet tokens on Tempo's testnet.
Usage
ts
import { } from 'wagmi/tempo'
const = ..()
// Call `mutate` in response to user action (e.g. button click)
.({
: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef',
})
.('Transaction hashes:', .)
Transaction hashes: ['0x...', '0x...']ts
import { createConfig, http } from 'wagmi'
import { tempoTestnet } from 'wagmi/chains'
import { KeyManager, webAuthn } from 'wagmi/tempo'
export const config = createConfig({
connectors: [
webAuthn({
keyManager: KeyManager.localStorage(),
}),
],
chains: [tempoTestnet],
multiInjectedProviderDiscovery: false,
transports: {
[tempoTestnet.id]: http(),
},
})Synchronous Usage
Use useFundSync to wait for the transactions to be included on a block before returning:
ts
import { } from 'wagmi/tempo'
const = ..()
// Call `mutate` in response to user action
.({
: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef',
})
.('Receipts:', .)
Receipts: [{ blockNumber: 123n, ... }, { blockNumber: 123n, ... }]Return Type
See TanStack Query mutation docs for more info hook return types.
data
See Wagmi Action faucet.fund Return Type
mutate/mutateAsync
See Wagmi Action faucet.fund Parameters
Parameters
config
Config | undefined
Config to use instead of retrieving from the nearest WagmiProvider.
mutation
See the TanStack Query mutation docs for more info hook parameters.