clawchain/wagmi/site/vue/api/composables/useTransactionReceipt.md

3.1 KiB

title, description
title description
useTransactionReceipt Composable for return the Transaction Receipt given a Transaction hash.

useTransactionReceipt

Composable for return the Transaction Receipt given a Transaction hash.

Import

import { useTransactionReceipt } from '@wagmi/vue'

Usage

::: code-group

<script setup lang="ts">
import { useTransactionReceipt } from '@wagmi/vue'

const result = useTransactionReceipt({
  hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
})
</script>

<<< @/snippets/vue/config.ts[config.ts] :::

Parameters

import { type UseTransactionReceiptParameters } from '@wagmi/vue'

hash

`0x${string}` | undefined

A transaction hash.

::: code-group

<script setup lang="ts">
import { useTransactionReceipt } from '@wagmi/vue'

const result = useTransactionReceipt({
  hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', // [!code focus]
})
</script>

<<< @/snippets/vue/config.ts[config.ts] :::

chainId

config['chains'][number]['id'] | undefined

The ID of chain to return the transaction receipt from.

::: code-group

<script setup lang="ts">
import { useTransactionReceipt } from '@wagmi/vue'
import { mainnet } from 'wagmi/chains'

const result = useTransactionReceipt({
  chainId: mainnet.id, // [!code focus]
  hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
})
</script>

<<< @/snippets/vue/config.ts[config.ts] :::

config

Config | undefined

Config to use instead of retrieving from the WagmiPlugin.

::: code-group

<script setup lang="ts">
import { useTransactionReceipt } from '@wagmi/vue'
import { config } from './config' // [!code focus]

const result = useTransactionReceipt({
  config, // [!code focus]
  hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
})
</script>

<<< @/snippets/vue/config.ts[config.ts] :::

scopeKey

string | undefined

Scopes the cache to a given context. Composables that have identical context will share the same cache.

::: code-group

<script setup lang="ts">
import { useTransactionReceipt } from '@wagmi/vue'
import { config } from './config'

const result = useTransactionReceipt({
  scopeKey: 'foo' // [!code focus]
  hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
})
</script>

<<< @/snippets/vue/config.ts[config.ts] :::

Return Type

import { type UseTransactionReceiptReturnType } from '@wagmi/vue'

Action