Skip to content

faucet.useFund

Hook for funding an account with testnet tokens on Tempo's testnet.

Usage

ts
import { 
Hooks
} from 'wagmi/tempo'
const
fund
=
Hooks
.
faucet
.
useFund
()
// Call `mutate` in response to user action (e.g. button click)
fund
.
mutate
({
account
: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef',
})
console
.
log
('Transaction hashes:',
fund
.
data
)
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 { 
Hooks
} from 'wagmi/tempo'
const
fundSync
=
Hooks
.
faucet
.
useFundSync
()
// Call `mutate` in response to user action
fundSync
.
mutate
({
account
: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef',
})
console
.
log
('Receipts:',
fundSync
.
data
)
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.

Action

Released under the MIT License.