--- url: /tempo/actions/amm.burn.md --- # `amm.burn` Burns liquidity tokens and receives the underlying token pair. [Learn more about the Fee AMM](https://docs.tempo.xyz/protocol/fees/spec-fee-amm) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/amm.burn.md","from":213,"to":8601} // @twoslash-cache: {"v":1,"hash":"15a04714fe58dc0283f87db9029cec245122d1b5c43e71becacad49ab6778a83","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScAGYArmD8gmCcWJJwMACqYIxocEFEobEwiJxipBZKFJywvCyhcCVgscwARmQRJS2MShZoADrZrOxcqaTpWTmmUBC8CAYAsrFyAljm8JzipWjlypykMFj76WASxskQ0RucTa1knC0YVz0kyXRsliecF/fhMJwAjNZOEFAW8hIo0BEAHQDAYAWk4ABEZg1OPg0GgsA0APTYoiMGDMKFwfDY6azbGxATmATwbGjcbZXKUajiJRzZDIEB0cSsBQslhsDicYApNKZJlwTiuGKkCDMTgAcnxhMVsLADIlkyCioALAAmayKqrSCIDXGcA3Wa0221gEAAXQdom0+l1mjMihUakQgK0kl0gU1E2Z8gsVn+dgcpCcNHIiGk7k8ODwhBI5H89DwITCkU4vBMXALYGi3RKAGEhKWlANBcN81XuiyxJJ9AAOSOe5SqJAANn9Oj0eGL1ZZ5ksSH1UccznjiY81C8qd8GeoAWHhY2zAg8TQGXSpAAKhAANaKTrdXrN11If7/ACs8i9Pd9j9Zg8CvJ3J33ZGPZ/tMMJ0QXVpxjWckDbJNFxTAw0z8NcswMYsxC3b80AANVCRgoHENB2H/c97kvE5r1bW8AGYpy7b1J1sd9AzwL9dyw8xcPwo9T0UMdwyQUCQHsGc40ne9oMwWCfHTFkaCQgTN32XgYEYLA0BKQ8Y2EWMkgAJRgRTlIYKh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X1TC71T6wun/euOs383/8K38ooKytRgXz4R3zhF/TA0Bqvb8QgBJAuU6taPwL+37I/hKR/dVUMLRT9egTJAiyNYuIEgKAAECL0kI2ggK4K4EAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { config } from './config' const { amountUserToken, amountValidatorToken, receipt } = await Actions.amm.burnSync(config, { liquidity: parseUnits('10.5', 18), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', userToken: '0x20c0000000000000000000000000000000000000', validatorToken: '0x20c0000000000000000000000000000000000001', }) console.log('Received user tokens:', amountUserToken) // @log: Received user tokens: 5250000000000000000n console.log('Received validator tokens:', amountValidatorToken) // @log: Received validator tokens: 5250000000000000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `amm.burn` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.burn.md","from":8937,"to":9561} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' import { parseUnits } from 'viem' const hash = await Actions.amm.burn(config, { liquidity: parseUnits('10.5', 18), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', userToken: '0x20c0000000000000000000000000000000000000', validatorToken: '0x20c0000000000000000000000000000000000001', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args: { amountUserToken, amountValidatorToken } } = viem_Actions.amm.burn.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.burn.md","from":9588,"to":10122} type ReturnType = { /** Amount of user tokens received */ amountUserToken: bigint /** Amount of validator tokens received */ amountValidatorToken: bigint /** Amount of liquidity tokens burned */ liquidity: bigint /** Transaction receipt */ receipt: TransactionReceipt /** Address that initiated the burn */ sender: Address /** Address that received the underlying tokens */ to: Address /** Address of the user token */ userToken: Address /** Address of the validator token */ validatorToken: Address } ``` ## Parameters ### liquidity * **Type:** `bigint` Amount of LP tokens to burn. ### to * **Type:** `Address` Address to send tokens to. ### userToken * **Type:** `Address | bigint` Address or ID of the user token. ### validatorToken * **Type:** `Address | bigint` Address or ID of the validator token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`amm.burn`](https://viem.sh/tempo/actions/amm.burn) --- --- url: /tempo/actions/amm.getLiquidityBalance.md --- # `amm.getLiquidityBalance` Gets the liquidity balance for an address in a specific pool. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/amm.getLiquidityBalance.md","from":145,"to":5397} // @twoslash-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ZDZjZ9Z68IoOIvQfBEhHMMoRMMQsAIIMsYky0wgEkbE4mnEFEFkEAQk0EokByI5UkBEwYrBWQykRJywVZ6UC04gWUxYq0605ZjMO0Voe0HonAFU50ec10g0tA6glQxIUA4ZaQvAjQjQqZaQ1gcIdp/84gLwKwg2lQlQZovA0gMA6gcI0gcICQ1gKwUGKwKwo03kK87c15xI1gvATZGFmFWFGFCFHUXU18UCyFt0tAqF6F2F5FFFlpvQCFj0kGLO8JB5NYccgZLeVZ40pQEM4gSAoAAQigPCQgGZCArgrgQAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const balance = await Actions.amm.getLiquidityBalance(config, { address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', userToken: '0x20c0000000000000000000000000000000000000', validatorToken: '0x20c0000000000000000000000000000000000001', }) console.log('Liquidity balance:', balance) // @log: Liquidity balance: 10500000000000000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type `bigint` Liquidity balance. ## Parameters ### address * **Type:** `Address` Address to check balance for. ### poolId (optional) * **Type:** `Hex` Pool ID. ### userToken (optional) * **Type:** `Address | bigint` User token. ### validatorToken (optional) * **Type:** `Address | bigint` Validator token. ## Viem * [`amm.getLiquidityBalance`](https://viem.sh/tempo/actions/amm.getLiquidityBalance) --- --- url: /tempo/actions/amm.getPool.md --- # `amm.getPool` Gets the reserves for a liquidity pool. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/amm.getPool.md","from":112,"to":9506} // @twoslash-cache: {"v":1,"hash":"7dda7bb1ad17e8af2b2215af2a34e1eccb912d3acf16ffbd8338a2da0631fe20","data":"N4Ig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lIeM/GdA3xgExQGeNbWmAueHyTnaJxom9MJvsgRma6BEmeBTgAQQwRpMMmZBbJrk1SD5MSEhTJgtyFKblNKmIAaptwlqbst6mWhRpnSGaZSF0E7Tb5iUWs4qEAW6hd8kM0YAjMnChhOdMYQHRTM/uszKwvM2NiLMisozZwmsw2YeFtmuzHste0ObHNMipzXqhc2iKDUbmWvO5m+AeaRCwAzzIItkQGKfNgYHTQwTanKImCyKPLQEjK2BICsGK4JaSj12Goyd9OfRAEjxWlaytUSGJeVmjW2rrck+2LJYpbyuLrEGWWxElo8W+5I4WW7xMHodwr4/o6WuxBljtz6E3cOWFEBhNyzIjAtUSoLAoeC2FZQtYSY1cobyyRJVCRiNQzErxGxLTcVWuQogq3DMYatSS2rKgBSSpI0kDWkAwgTrW7iaNWSGbAwNY1HZWBmB2ZHGOLHtYmMnSHA3RssGFKcABoYpT1mmWrZ+lw2/rRthQKrY+sw2frKEH6ivDRtbwNbGUliA7ZVBrAxpVNum0tbUgx4Xw9AdPElhYD2BETROCWxVhRBI2GpDEdCM3YgBzgMIFwjeDITVxOAAAGRTBtsGwOI0kBlhTa9wOYYBQIAyPREYASRaAidrjCTZhMcBVASxm8IIEJtSQTtUUXKFIGRM2ROSbRJyNoH0CTR/jEkVzDJEwFXA0MGILAH5BMxzIbUYQKpGsgCRQMWkSSJFAgDGR8UoIvji6PUiCR6wX+LIK5CT7UhGo4gZqEKCdEfQmwaMOQL1Fpj9QXgocatitFoCShrAvAU0bmLzHWANo5UFtgiJXAZisxOY/MZWN8a9BCxW0I3kMMEjOMqB5bUbN7mpAOYIR3rRQCFiO57p4RcEZsTQLbGYRB2lbLON2I257p9RoMQ0TG2HFrB6wUozkSFlKCPRxASAUAAEEUAfwhApjBAK4FcBAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const pool = await Actions.amm.getPool(config, { userToken: '0x20c0000000000000000000000000000000000000', validatorToken: '0x20c0000000000000000000000000000000000001', }) console.log('User token reserve:', pool.reserveUserToken) // @log: User token reserve: 1000000000000000000000n console.log('Validator token reserve:', pool.reserveValidatorToken) // @log: Validator token reserve: 1000000000000000000000n console.log('Total supply:', pool.totalSupply) // @log: Total supply: 1000000000000000000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.getPool.md","from":9592,"to":9797} type ReturnType = { /** Reserve of user token */ reserveUserToken: bigint /** Reserve of validator token */ reserveValidatorToken: bigint /** Total supply of LP tokens */ totalSupply: bigint } ``` ## Parameters ### userToken * **Type:** `Address | bigint` Address or ID of the user token. ### validatorToken * **Type:** `Address | bigint` Address or ID of the validator token. ## Viem * [`amm.getPool`](https://viem.sh/tempo/actions/amm.getPool) --- --- url: /tempo/actions/amm.mint.md --- # `amm.mint` Mints liquidity tokens by providing a token pair. [Learn more about the Fee AMM](https://docs.tempo.xyz/protocol/fees/spec-fee-amm) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/amm.mint.md","from":201,"to":6391} // @twoslash-cache: {"v":1,"hash":"8c8d9e3a10d7fc7ac97a66b8da388430eb2e46abfa5de1aeb9fd7c017dfd2448","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScAGYArmD8gmCcWJJwMACqYIxocEFEobEwiJxipBZKFJywvCyhcCVgscwARmQRJS2MShZoADrZrOxcqaTpWTmmUBC8CAYAsrFyAljm8JzipWjlypykMFj76WASxsk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ZIKnVIDlAhKoOnTzHXAYUsMYLgErALW3Q4OoUgR4IDOASQ37DYBsowt8JIEnVS8IUoI8sQHIOooQSDJ1BjJjFjaDSWAHYQ6IIIUySLXc1tWvZfMAdQfbRvccWIa7PysfSQodPy0ybvXoaIKEUyJ7NAF7OeIIXfYSjqDAjXKQhsqSmnKrWbOo2WRfZfNAZLbyzECHevbeGHAiZvI2Vve8lHPtZjRKl7V7Qq4qp6TqtAOEAMSIaEU/TWc/MA4QPOIGJkq8Xk+0hCxUAsFBZ0l/KoOak4Qck0jAkoZaymG8KrDi0Al4mazaxAfdTa1alija+GLarE3axcuadUPPP4Aq6kYhdgEqsqsHCq2vSHBvQ7WqlvHqtvDvJqwq1qt7Dql6rq8GnqvqqfdgLDefEsSGpIOWVkCdJWRjEbFkIgF+f4KENBd8y9XiX5NVLyf86/ICzsD9eMNJUSc1YVKSLxUWN8I8CGYmRZL8d0Ymn0WQR9bSMwPGV8Q8cmkCkKUyUycC8dFkC458cLNm0KW9X8pAB9f9EAAAGX5rFm0pKKgFQXeXtANQvG8mNUEhCjAp0QLFgCYHnRjmqilBlD9lXUDidnrijittFBDWXTtsTk7RdsCX1nzk9tXShGfOrE3S8VFEZsPCqHJkExlFXnXi4Btp3j3m5gSGPh8VPnbggBwVoAqX1CqRqTqQaSaRaTaQ6S6R6T6V1EGWGVGXGUmRmTmRgQmlBTZXBQ5WzvAVJS7pJSbslQeixTBVvjxSVEJWeW7vHpeX+F7u1WxWvj1RKHdodUVDQX3V7EnlnjOO1JmrVvxiZq5i2O1v3QjouQGBZH4XECQFAACEUEYyEDwGZFcFcCAA"} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { config } from './config' const { liquidity, receipt } = await Actions.amm.mintSync(config, { to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', userTokenAddress: '0x20c0000000000000000000000000000000000000', validatorTokenAddress: '0x20c0000000000000000000000000000000000001', validatorTokenAmount: parseUnits('100', 6), }) console.log('Liquidity minted:', liquidity) // @log: Liquidity minted: 100000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `amm.mint` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.mint.md","from":6729,"to":7348} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' import { parseUnits } from 'viem' const hash = await Actions.amm.mint(config, { to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', userTokenAddress: '0x20c0000000000000000000000000000000000000', validatorTokenAddress: '0x20c0000000000000000000000000000000000001', validatorTokenAmount: parseUnits('100', 6), }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args: { liquidity } } = viem_Actions.amm.mint.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.mint.md","from":7375,"to":7842} type ReturnType = { /** Amount of user tokens provided */ amountUserToken: bigint /** Amount of validator tokens provided */ amountValidatorToken: bigint /** Amount of liquidity tokens minted */ liquidity: bigint /** Transaction receipt */ receipt: TransactionReceipt /** Address that initiated the mint */ sender: Address /** Address of the user token */ userToken: Address /** Address of the validator token */ validatorToken: Address } ``` ## Parameters ### to * **Type:** `Address` Address to mint the liquidity tokens to. ### userTokenAddress * **Type:** `Address | bigint` User token address. ### validatorTokenAddress * **Type:** `Address | bigint` Validator token address. ### validatorTokenAmount * **Type:** `bigint` Amount of validator tokens to provide. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`amm.mint`](https://viem.sh/tempo/actions/amm.mint) --- --- url: /tempo/actions/amm.rebalanceSwap.md --- # `amm.rebalanceSwap` Performs a rebalance swap between user and validator tokens. [Learn more about the Fee AMM](https://docs.tempo.xyz/protocol/fees/spec-fee-amm) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/amm.rebalanceSwap.md","from":221,"to":6288} // @twoslash-cache: {"v":1,"hash":"e399d67fb11f22f03c5401507bb51f3428c3c4c6a5e925ed4f4bc4e8e55c065a","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScAGYArmD8gmCcWJJwMACqYIxocEFEobEwiJxipBZKFJywvCyhcCVgscwARmQRJS2MShZoADrZrOxcqaTpWTmmUBC8CAYAsrFyAljm8JzipWjlypykMFj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EEGpNZt2QConm3mAOoINqnuOLEHNtpVXuQbCtpWpEtr0NEFCGpIXv9nILvEEFjhsDoERaKS5c7vGRRekOFnVsdJEXIFCK3m9K5hpZiHdsnlfE9gROns7JnrOV9otgFXZQDgFcFWgOlXCAGJENCOPlbJPgkJuAWLuLiZeFiQqXeYqMVScCULfuvlUNVZCG6YhSUI1SUNeDFqhbMisZVW1VSo1QWe6aKa1TjO1Z8V1Q2eqEHqHv5dSEFaLCFepTduFYnvdinsNjFRnmgO9tnolZCqhilZtmlQtRlSdVlToHmPXpxs3iWCdUkPrKyMisbMBlzCyEQNYFCP8J9daKuQWl+NYByqWr5IuoELPgeZ2HWuFFYkBGKskheS4tkqjHkjMt6rxNNrOneBuiDc+NuCjPaNxBGBDVuvWvEtYngEiiyBMXgGDX9bxNqhjT6LYC2gYICL2HqjaPjWYJ+IYUefGCecogWLAEwFijnK1FKDKHHASsXItr3FnCLaKAsnihLYXCCnLd4g7LXMrQSlCIuW4iSi4qKIjcguIkRjKCfGfFwGLdfLfAxlLNzANM/K/G4u/I9FUrkord0oqICFCJeFSr2OvKPBAOgkqiqmqhqlqjqnqgakapeCamahataravao6s6m6h6jghtJWt/N9BgkOqOvnTmhnZ2i9CutncHYOtYBmgXdXbaP8DgnglGUuZVdwLjZ8BYIgFSkbbvCyGwuIEgKAAEIoMBkIOTQgK4K4EAA=="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { config } from './config' const { amountIn, receipt } = await Actions.amm.rebalanceSwapSync(config, { amountOut: parseUnits('10.5', 6), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', userToken: '0x20c0000000000000000000000000000000000000', validatorToken: '0x20c0000000000000000000000000000000000001', }) console.log('Amount in:', amountIn) // @log: 10605000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `amm.rebalanceSwap` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.rebalanceSwap.md","from":6635,"to":7247} import { Actions } from 'wagmi/tempo' import { Actions as viem_Actions } from 'viem/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' import { parseUnits } from 'viem' const hash = await Actions.amm.rebalanceSwap(config, { amountOut: parseUnits('10.5', 6), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', userToken: '0x20c0000000000000000000000000000000000000', validatorToken: '0x20c0000000000000000000000000000000000001', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args: { amountIn } } = viem_Actions.amm.rebalanceSwap.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.rebalanceSwap.md","from":7274,"to":7666} type ReturnType = { /** Amount of tokens required for the swap */ amountIn: bigint /** Amount of output tokens received */ amountOut: bigint /** Transaction receipt */ receipt: TransactionReceipt /** Address that initiated the swap */ swapper: Address /** Address of the user token */ userToken: Address /** Address of the validator token */ validatorToken: Address } ``` ## Parameters ### amountOut * **Type:** `bigint` Amount of user token to receive. ### to * **Type:** `Address` Address to send the user token to. ### userToken * **Type:** `Address | bigint` Address or ID of the user token. ### validatorToken * **Type:** `Address | bigint` Address or ID of the validator token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`amm.rebalanceSwap`](https://viem.sh/tempo/actions/amm.rebalanceSwap) --- --- url: /tempo/hooks/amm.useBurn.md --- # `amm.useBurn` Burns liquidity tokens and receives the underlying token pair. [Learn more about the Fee AMM](https://docs.tempo.xyz/protocol/fees/spec-fee-amm) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/amm.useBurn.md","from":216,"to":10037} // @twoslash-cache: {"v":1,"hash":"f352a044790f8cbde9e59508d0e42c0dd85e637c21507c3fb59ad6574684cfad","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUoiaicACUnABmAK5gjowQYJxY4nAwAKpgjGhwwURhcTCInCKkpgoUnLDWLGFwZWBxzABGZJFlbYwKpmgAOrms7FzppJk5eUZQENYIegCycTJojFgm8Jyi5WiVipykMFhHmWBiaymcEDHbnC3tZJxtGHd9JKl0bGbn17dtERgnAAjBZOMFQV8UvI0JEAHRDIYAWk4ABE5k1OPg0GgsE0APT4oiMGDMOFwfD42bzfFxNYmNbwfHjSa5fL+MQKBbIZAgOiiVhyfwsNgcTjANIZbJsuCcVyxUgQZicADkxNJKsRYBZ0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7qNw0Prt3iorRNGYwghuQwMYK0kOmAnLoxzy4sc8GdjDjsQ3WGONNhWgKIHiw8aNdyGvjMWm9ECYKEcUoTcJnaBIGvZo4DTS+K/GaacCFqmeBQV003DKCo2heM3q03ATMxCmbMUSIIl8jwJby5TZBDZFQSORnWJOWzJQMAiasiEgiCkSG1qbhsWBbuWkYwlNYI5eWYgCZo7GmbaIVmXzXxIs1ObLNPm5STURsySRp5rWOzPUfs2qS+srWZzW1uaItZoAbmfuY0ec0eYhxnmeSa0Y7A+ZzNDePzCWH8zBYAsuwQLZpGACEHgswAkLJZI61WQOCW8SLMVjuy7QUs94MrRUfywygKslSWoIlnGJRYSskxmLGQDy1pbpiNUBLLMcy0Ay5i9UHLKVsmMLE0s5WArUsQyxFY5jxW1YyVhiypb1jZWq6JsTaiFaMt+RrrPgbU2oHas5BAYSkXq1DbAgaRBeOUcMwVG+t7RRoq0SZjtaRiVk6cfkaoCsyNMTQ1AlcYaLuYBsAc8giUaBF6Y/xvAbAqgBwL0BcDomugVQKr1HGWBsmIAIQTy02YpIxB8gCQe9mkEyDM88mRgTeGoT8ZcwsAD8G/nFBMjZQ8ofbMqEjIvQ4YCMUkGwGRgbZ4Jf2RCZDBQnqhmAx2HPgWDATaVvwrMTyKyLARcwVo1ofsKBhZRaoYAAHVIPdDzBPtRBwY8EJiQUB8d+4VwLaH/n4A1AEGWQuGAymWgFwGRcIaTFrAFiuijMW2VkGdlBBwhVAl2YEF+TjgqwkcpsWgOjiNCY5scuOfHITmJyk5ycqgSnNTlpz05GczOVnOzk5zc5c4qubUeEmTjB4dcwEvyQ6Hcm/j083sAyX7H8nhTgQwcVwAXAeESMVQ34kQR8UTjiDEAl2WSWMzUjuRGGlo9xAXAW6LUEpe0IKQfRSlpS2RGUrKQkhPEpJ1cBcfwMvFEBIBQAgQACctFYEIBXArgIAA==="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' const burnSync = Hooks.amm.useBurnSync() // Call `mutate` in response to user action (e.g. button click, form submission) burnSync.mutate({ liquidity: parseUnits('10.5', 18), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', userToken: '0x20c0000000000000000000000000000000000000', validatorToken: '0x20c0000000000000000000000000000000000001', }) console.log('Received user tokens:', burnSync.data?.amountUserToken) // @log: Received user tokens: 5250000000000000000n console.log('Received validator tokens:', burnSync.data?.amountValidatorToken) // @log: Received validator tokens: 5250000000000000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `amm.burn` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/amm.useBurn.md","from":10373,"to":11081} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { parseUnits } from 'viem' import { useWaitForTransactionReceipt } from 'wagmi' const burn = Hooks.amm.useBurn() const { data: receipt } = useWaitForTransactionReceipt({ hash: burn.data }) // Call `mutate` in response to user action (e.g. button click, form submission) burn.mutate({ liquidity: parseUnits('10.5', 18), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', userToken: '0x20c0000000000000000000000000000000000000', validatorToken: '0x20c0000000000000000000000000000000000001', }) if (receipt) { const { args: { amountUserToken, amountValidatorToken } } = Actions.amm.burn.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `amm.burn` Return Type](/tempo/actions/amm.burn#return-type) ### mutate/mutateAsync See [Wagmi Action `amm.burn` Parameters](/tempo/actions/amm.burn#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`amm.burn`](/tempo/actions/amm.burn) --- --- url: /tempo/hooks/amm.useLiquidityBalance.md --- # `amm.useLiquidityBalance` Gets the liquidity balance for an address in a specific pool. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/amm.useLiquidityBalance.md","from":145,"to":5353} // @twoslash-cache: {"v":1,"hash":"8ac7e459f30e286677d1cb839aa57883a14653c6b8b3bf03624ebf676bd6cacc","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUWKQQOBwYAJScUKJiiJwARowKplwAPpwArmCwAGamMFD+UBDWCHoAKvgwnDKiIpxwOdbW8HAFOTIyGJyk8BAyJFBxCaKcBeycyvUAjjlkGAB0ADpgGxu19Y3Nre2d3b39g3DDo+NiUzNznIvL65vPOw1NXAcdcF09fQNDIxKV0m01Iszq9yWpFWWxeEL2HzaXx+J3+50BY3i11B4IWUJhz228PeLSRR1+pwBlyxINuEIe0JW/hE4l0ABZ1MZ5EoVIg2RpxNogjT/CYzEgAEw2OykBxOJAADncnhweEIJHIGkCeGsEDAzWSokaYA6SVS6TAWVy+RgRTMpSo5UqeFeCNJh2+xz+ZwuQJpNzBdwZq2Zml0qgAjLJucokAB2AVaHR4Q3Gjqi4qS6X2Rx+RARtnK6heNW+TUBehMVjsLgGQSh1lIABsAGZo4pY4hOZohXg60YxeYpSBbDn5YgJU2i5hVXp1X4tZW9Cw2BxOKJmMwGxJEE3pFyO7y29RBcm9But7JMxPs7Lc84WxLpyW52X/DQlyBuia0Iw9bk4BgAAZRhFkYKBGEwAAhI1RBNGAAB4AGE9SKBQKBSNIMgAPlCexmB0Mg4A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tYpZH9GDeKbYjlXlXKFnGQFYUEeTNAL5awv1KjINWjNVQ+RjKNGNVjeNLqBkwk21Bk5khICU6NQUOAaIHNYzfKHvdg3UUKQfVQWfMrCLRqFUy0JIWLRzDCHU51OQ0bKAgpUKJIdQc+YrLff5LUo0xARLI0l/eQt/c03UzgK0oLNAEVErMAV2WELDeoPlEUqUtk31SjGErkqOUNXkrVfkvwtjBNEU7jG1cUuTSUjM6UrQWUxyKTeoUwKUxTAwlKJANKEuUwdMKgIgCwFYCMOs1mMIh+RsCcBUZ+GIzsY8OuIICzJIlI8cJUYBF8IeBcCsBIuffOeCM0LCS0HBHeW0PeMJGoYkfYMkT0CkNEX0TECYRyIMfEHRFslsfRdsWI5+bslMQmPszuMcHuQsIcweMQBQfwWPPAXs8Iw8iUYcDs3kKwMcvAXGSyfoSco2CMNmVmcCiCyC8CsAaxUC/svMdI4uXUWAKsRZcqTGaqWqAoeqJLNqDqbqGAXqJ3OfOGRIG+AuGqQfcibGcSOiaSFuDoYmS6GeToemOMNkCUKAFsVQJCawJsVsNkJCNmR8SQCUVQUQFsZIBUNkNkKCawSQGAOMVQSQVQAoCwZIZTZIZITmWaZhZBemRmawKC4yky0y4ynS5o76CRSxQGJqJ6Qysyxypy8CiMTmbmNgm/LUgC/GciqcxLYCmAWHfwJdUQJAUAQIeQNJPUPAQqEAVwVwIAA"} import { Hooks } from 'wagmi/tempo' const { data: balance } = Hooks.amm.useLiquidityBalance({ address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', userToken: '0x20c0000000000000000000000000000000000000', validatorToken: '0x20c0000000000000000000000000000000000001', }) console.log('Liquidity balance:', balance) // @log: Liquidity balance: 10500000000000000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `amm.getLiquidityBalance` Return Type](/tempo/actions/amm.getLiquidityBalance#return-type) ## Parameters See [Wagmi Action `amm.getLiquidityBalance` Parameters](/tempo/actions/amm.getLiquidityBalance#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`amm.getLiquidityBalance`](/tempo/actions/amm.getLiquidityBalance) --- --- url: /tempo/hooks/amm.useMint.md --- # `amm.useMint` Mints liquidity tokens by providing a token pair. [Learn more about the Fee AMM](https://docs.tempo.xyz/protocol/fees/spec-fee-amm) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/amm.useMint.md","from":203,"to":7459} // @twoslash-cache: {"v":1,"hash":"4fca6eaaab4d04b51aad961895f40c6a81566cafdac628c7923a2a2603d064ae","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUoiaicACUnABmAK5gjowQYJxY4nAwAKpgjGhwwURhcTCInCKkpgoUnLDWLGFwZWBxzABGZJFlbYwKpmgAOrms7FzppJk5eUZQENYIegCycTJojFgm8Jyi5WiVipykMFhHmWBiaymcEDHbnC3tZJxtGHd9JKl0bGbn17dtERgnAAjBZOMFQV8UvI0JEAHRDIYAWk4ABE5k1OPg0GgsE0APT4oiMGDMOFwfD42bzfFxNYmNbwfHjSa5fL+MQKBbIZAgOiiVhyfwsNgcTjANIZbJsuCcVyxUgQZicADkxNJKsRYBZ0umwRVABYAEwWFU1SSRIaEzjGix2+0OsAgAC6zuEml0BvUxnkShUiFBGnE2iCOqm7NkpnMwJsdlIDicUncnhweEIJHIGkCeGsKREnGY/QAyhhEmUDII4QKyXFMoti6XrHCAEo6OKkMAAFS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kuXaQ7U6SGHlBWQSDWSjCgG7ySm/yA3zG7UNT7VBPgAqhIG2jXW8cjXFxSF1KGEhYiC4Bhd7RWH7VOEReHRRZVObR1TAExa/KBChdxdfWZThYvhUKRdqEGh2DJbRZ1K1CxdJVpfKHpaNQJfheZZJbZdRdJQpYCaEydskCh2fkQDIWab0DXTaaYme2vGNEyY+z6cDoGZ+2iAefKWeeWVWROlBdqZlfiehykCScNeHlVaUxYgNAye6e8E5H8D8rwFIItZAjRwSaLx1ZAH7kHnKQLCIqgBTmaydF/mjG9DVYx0sFcAE1zFgHfAAPFEZkEADyDyhmelhnhjYERi9wzYj393lED0hhDw1FJsmrigsq/GZnchEjig5kWmtD7DAw5SBRgHfVMCZfukMMNKeFaVSGCAJIUDhGeGFiuHWggP4BqCQf5baELGZQWirjybhBk01j5gM1zlMyNHM0s2s1s3s0c2c1c3c082818380C2C1C3C0izaHLiHYSTjjW39i23qz2x/Z2xfY2bfbu0/cDl/dA/23/eyX+0A/ObKFLYKBVFThjxvEiAzjAFcCrgmpkejODbKWHjDdEojZjw3bXRUhIIHlw70yGH8F3lECQFAECHkCNJSDwHZFcFcCAA=="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' const mintSync = Hooks.amm.useMintSync() // Call `mutate` in response to user action (e.g. button click, form submission) mintSync.mutate({ to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', userTokenAddress: '0x20c0000000000000000000000000000000000000', validatorTokenAddress: '0x20c0000000000000000000000000000000000001', validatorTokenAmount: parseUnits('100', 6), }) console.log('Liquidity minted:', mintSync.data?.liquidity) // @log: Liquidity minted: 100000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `amm.mint` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/amm.useMint.md","from":7795,"to":8498} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { parseUnits } from 'viem' import { useWaitForTransactionReceipt } from 'wagmi' const mint = Hooks.amm.useMint() const { data: receipt } = useWaitForTransactionReceipt({ hash: mint.data }) // Call `mutate` in response to user action (e.g. button click, form submission) mint.mutate({ to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', userTokenAddress: '0x20c0000000000000000000000000000000000000', validatorTokenAddress: '0x20c0000000000000000000000000000000000001', validatorTokenAmount: parseUnits('100', 6), }) if (receipt) { const { args: { liquidity } } = Actions.amm.mint.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `amm.mint` Return Type](/tempo/actions/amm.mint#return-type) ### mutate/mutateAsync See [Wagmi Action `amm.mint` Parameters](/tempo/actions/amm.mint#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`amm.mint`](/tempo/actions/amm.mint) --- --- url: /tempo/hooks/amm.usePool.md --- # `amm.usePool` Gets the reserves for a liquidity pool. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/amm.usePool.md","from":111,"to":9752} // @twoslash-cache: {"v":1,"hash":"a5e2597c7cc0e903cdeee24bcbbc6a915a731be45436f6ef363478a4ecfdc54e","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caO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SgEwbUCeL+EAj+JwrJ8sRKAmStb4yYWAF+CeQYw4IosUEHjC6ykwKYVMNgDTFUYOCuYioJIJfHFiSxWoUUH+PLFGiiJhOxsHotYAEkWTLJFgbWKMAi6+cTJ6sMyVZOclCstwNktYAPGjGxkOWPw2uJ1jPANxBOgFeyAPE75JZ9x2E7lv5JUiBS9x6XFWKFMVbl0uJKqNCfVGil/BM45EjyAPH8A/pRASAUAIEHkBgYUwZEhAK4FcBAA=="} import { Hooks } from 'wagmi/tempo' const { data: pool } = Hooks.amm.usePool({ userToken: '0x20c0000000000000000000000000000000000000', validatorToken: '0x20c0000000000000000000000000000000000001', }) console.log('User token reserve:', pool?.reserveUserToken) // @log: User token reserve: 1000000000000000000000n console.log('Validator token reserve:', pool?.reserveValidatorToken) // @log: Validator token reserve: 1000000000000000000000n console.log('Total supply:', pool?.totalSupply) // @log: Total supply: 1000000000000000000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `amm.getPool` Return Type](/tempo/actions/amm.getPool#return-type) ## Parameters See [Wagmi Action `amm.getPool` Parameters](/tempo/actions/amm.getPool#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`amm.getPool`](/tempo/actions/amm.getPool) --- --- url: /tempo/hooks/amm.useRebalanceSwap.md --- # `amm.useRebalanceSwap` Performs a rebalance swap between user and validator tokens. [Learn more about the Fee AMM](https://docs.tempo.xyz/protocol/fees/spec-fee-amm) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/amm.useRebalanceSwap.md","from":223,"to":7472} // @twoslash-cache: {"v":1,"hash":"20c09f8cc1ff08a8faf46184bc97fb05274d872847ffff372666aabccf7c9bdd","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUoiaicACUnABmAK5gjowQYJxY4nAwAKpgjGhwwURhcTCInCKkpgoUnLDWLGFwZWBxzABGZJFlbYwKpmgAOrms7FzppJk5eUZQENYIegCycTJojFgm8Jyi5WiVipykMFhHmWBiaymcEDHbnC3tZJxtGHd9JKl0bGbn17dtERgnAAjBZOMFQV8UvI0JEAHRDIYAWk4ABE5k1OPg0GgsE0APT4oiMGDMOFwfD42bzfFxNYmNbwfHjSa5fL+MQKBbIZAgOiiVhyfwsNgcTjANIZbJsuCcVyxUgQZicADkxNJKsRYBZ0umwRVABYAEwWFU1SSRIaEzjGix2+0OsAgAC6zuEml0BvUxnkShUiFBGnE2iCOqm7NkpnMwJsdlIDicUncnhweEIJHIGkCeGsKREhxgAJkokSMAAygB3URYMsYRJlAyCOECslxTIAJULYRL1nLVZrdescM7aDipDAABUvAAeADCKRivRqCX4kArYAAfP4ROJdAB2PeyX3KJDAw/UYM6PBHIs9vvV2uJfwmMxIADMsfsjj8iAAbMnqC8NNfEzAJ6CYEYxUbIwdwkFxzzkRQT0Qb1NBDPBoOfKN30/eNv2cI1/w8QDUz0dM/CzcC9BFUZtmYZhtw9U8LA/H0kP9Vi0KvPQWyw19EFY2wv0TASjQAzBSJ8DMOWzPR4kSS5UjbGBO1vUtKwfQc5wXJdOBXNdN2CcYBR0Mg4AAfgbPgmxbOFlNU7t1P7R8hwABXsZhTImbSwEXao9LAVcIHXDcuh4ay4Gbei7I7LtiyczTEmHHQx0nGd5183T9OCzchjAEy4HSXs9NitTew0gcnyoakFn0azYnYNIyBidhmCqO4b0c4q4H7BUlU4IoTCgUQ0Ea0b+HkThRpKp5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/Mtcqo2OuO+OhOxOpO5OlO1OtO9OjOzOrO7OnO3OvO/ObQOc/MczOuEcYeFghuUe8Hpu4HAegSKcGzdc4eCHmHDowIOcLcBNLDkZbMzrS+6cd2u7miq65kUUhrYArc/gp8ogSAoAgQ8gO9KQeA7IrgrgQAA="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' const rebalanceSwapSync = Hooks.amm.useRebalanceSwapSync() // Call `mutate` in response to user action (e.g. button click, form submission) rebalanceSwapSync.mutate({ amountOut: parseUnits('10.5', 6), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', userToken: '0x20c0000000000000000000000000000000000000', validatorToken: '0x20c0000000000000000000000000000000000001', }) console.log('Amount in:', rebalanceSwapSync.data?.amountIn) // @log: 10605000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `amm.rebalanceSwap` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/amm.useRebalanceSwap.md","from":7817,"to":8540} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { parseUnits } from 'viem' import { useWaitForTransactionReceipt } from 'wagmi' const rebalanceSwap = Hooks.amm.useRebalanceSwap() const { data: receipt } = useWaitForTransactionReceipt({ hash: rebalanceSwap.data }) // Call `mutate` in response to user action (e.g. button click, form submission) rebalanceSwap.mutate({ amountOut: parseUnits('10.5', 6), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', userToken: '0x20c0000000000000000000000000000000000000', validatorToken: '0x20c0000000000000000000000000000000000001', }) if (receipt) { const { args: { amountIn } } = Actions.amm.rebalanceSwap.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `amm.rebalanceSwap` Return Type](/tempo/actions/amm.rebalanceSwap#return-type) ### mutate/mutateAsync See [Wagmi Action `amm.rebalanceSwap` Parameters](/tempo/actions/amm.rebalanceSwap#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`amm.rebalanceSwap`](/tempo/actions/amm.rebalanceSwap) --- --- url: /tempo/hooks/amm.useWatchBurn.md --- # `amm.useWatchBurn` Watches for liquidity burn events on the Fee AMM. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/amm.useWatchBurn.md","from":128,"to":4832} // @twoslash-cache: {"v":1,"hash":"1eb67ad9a75d59810fdaf0024451c348d0f712105fb6fc09eb9c9df760ca27f0","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXKLMzFGaugAssUmKykj9GVo6eO2deWZIRSC29o5+iABsVdRetb4NAfR4AGYArmCOjBBgnIdwMADqomi2AEKHpGAAPADC5/uMCgB8AAosPZmDoyHAAPyITjAAA6F04iIWpgAklAoZwwIdmAAjMicAA+lzAsB+ZigAG54YjEZlIdC4QiaTTriSyBiAAYWWgAEmAIlIpgUrg5hM4XN5/LQgsUIuQAF0xViZDIxcdSflKdTmTSrmQACoCeSc7l8gVCkViiVm6UWjkKpWHFVqtlkmBapk6oiiExQe7sQ38Y3Q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kZRzoJWG8thqopR7SciTBIgfk2OlGp4G4+iLAnOxigKwKfG+wAIsQ/YD6IqYqGGYA8QWK76B4hwFKcxMGJhn6cxsQ921Y+wf4sQGqjKc2AIHqKRoIoUMiKGK6wI3EPytsQKL2Mgf4b0GGaAfSNBIqz67BMAb6OKnCn6BK8qiqf6KqVUjxhxzKjxLx9w0JCqJ0Rq3uKUNGJwn+lCA8bOqgMeFmsmaJx40ICmHGoEuJnKiB0+xJ0I6gOy4RfuwyOJ/ceJKmxJk+5+/G2SA8FJVu1J+BHIV0h6m4DxzUTxsJ7xwqT6Yqr6YUUq/xX6QJ/B/6qq4JIGTKUJ6GMJqpcJU0jkzkyGm4pgsJWGhBUUSAMUhMpgJk/gRAFgf4VM1pFgFg4hhM/sXMVMwclMIw8hQQ4EShJM8cahSANMmhWwGcQsuhOcOM+cwEDID4xcwO4o5cjcPcD41ci80Ytoh8D4LcjEKZ8ZaZTcD4fcA8w8BozEW8O8+ZU8x4s8voWZJZS8aiK8D4a8bsm8dZZZnoe8cZDcuZiZYAx8EhxMH8N8l8IcPpSCQQD80w5gKhmCicswqgrgBMlCsAzQCSOUvU+UjkBYnipU0WFU1UPabAdUlGvUf4/UjM4CIuo0UcssdIqsCESEo4hc2S2JvSxU74KmJ0F0FAmk/hIAucogSAoAgQ8g8i5weAaUIArgrgQAA==="} import { Hooks } from 'wagmi/tempo' Hooks.amm.useWatchBurn({ onBurn: (args, log) => { console.log('args:', args) }, }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `amm.watchBurn` Parameters](/tempo/actions/amm.watchBurn#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`amm.burn`](/tempo/actions/amm.burn) * [`amm.watchBurn`](/tempo/actions/amm.watchBurn) --- --- url: /tempo/hooks/amm.useWatchMint.md --- # `amm.useWatchMint` Watches for liquidity mint events on the Fee AMM. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/amm.useWatchMint.md","from":128,"to":4640} // @twoslash-cache: {"v":1,"hash":"dcfbe669423c1e67e1fd5bfc996004b53912d26ef3dcef6280d135f90c3df485","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXKLMzFGaugAssUmKykj9GVo6eO2deWZIRSC29o5+iABsVdRetb4NAfR4AGYArmCOjBBgnIdwMADqomi2ALKmaAA8AMLn+4wKAHwAFFh7MwdGQ4AB+RCcYAAHQunARC1MAEkoJDOGBDswAEZkTgAH0uYFg3zMUAA3HCEQjMhCobD4dTqddiWR0QADCy0AAkwBEpFMClc7IJnE5PL5aAFimFyAAuqLMTIZKLjiT8hSqUzqVcyAAVATyDlc3n8wXC0Xi01S83s+WKw7K1Ws0kwTWM7VEUQmKD3dgG/hGqFWyXSoUiwkhs0yu0KwlKlWEtUwV3upmuZ3qsmUj37UgQZgAIRkEGs/HR2J+L0zKY1OaZ5wAoqR86R0f9/mRW1Dm62AJScAC8v04RAgjCgA6TLo1NdT9epbGV6Klhxgc9n06zboXCKXJkUyLATi9MnRmJxeK3tbJG+zWoR52ex/b/1pUIA7vcni8AHQAQS0OAKE4EsFE/b98GfNBfwAGQgBQB2HUdx0nO8dwfTgWVgNsoQDeRUQAeVIf8oCgUh4DgdC0x1a5SHwsB0QYoiSLIii4Co6950w08Jz9ejDUYvDBJY0jyMo6jd04aw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dmeONmEYdAoIMCLApAHAs+XOJATmQgrYEueWUgiuSmauICZeVyeuA2IwemXQUeLuduBORmJOMYIIPuDOWUoePA2YVQVwWmGSWAZoDRCqCaaqXyfMQRRqOTVqdqNgTqW9CaX8KaPmFeeaLUNOLWWkI2BCJCEcBaDac459d8NDO6J6CgJGSQkASuUQJAUAQIeQOAfqPAIqEAVwVwIAA=="} import { Hooks } from 'wagmi/tempo' Hooks.amm.useWatchMint({ onMint: (args, log) => { console.log('args:', args) }, }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `amm.watchMint` Parameters](/tempo/actions/amm.watchMint#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`amm.mint`](/tempo/actions/amm.mint) * [`amm.watchMint`](/tempo/actions/amm.watchMint) --- --- url: /tempo/hooks/amm.useWatchRebalanceSwap.md --- # `amm.useWatchRebalanceSwap` Watches for rebalance swap events on the Fee AMM. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/amm.useWatchRebalanceSwap.md","from":137,"to":4883} // @twoslash-cache: {"v":1,"hash":"a65363a61410810306bc28a64110f48e977141b2aff31cdee698fa19287f0ab5","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXKLMzFGaugAssUmKykj9GVo6eO2deWZIRSC29o5+i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aoCoktipSprhcAqBkBrpgZEI0UP05U8Vn5lBDgXhkINJmAFVCUAMQ1BozJ7VBoQMdUTAXhBpxkHlZw2YC535VYhZP5CEBZeYq5xZ5glMKEf4W4aFnAehO5NhtZmE9YghoRC1A5p97p2E4AksYBiQLksI0ZiU/EZp3hGYyYTMLldRnJqJbQTsABqIWbOeoJsW/FQqgcKSRPAPAwdWOUUeTNAJUT1HpFzBWa1AAWSDGmkqjPEyDJEXWEmsFdRvFXWuEs2yPwBnQmkYBZi4HdRGRnQiRYHEFiWcNcJS1TmDFv3BmJ1ewOXslXRegEJEG6V+3OH4XeFPFsXsUcSszFVE32GhFiFnHfVlXlXwzAHiGJT/TvEOEZQOJQ1cIAwONiHe07H2GQliCgy5Up2hC7TKIRFylThw13ThGUjBU4BhV+xkGQjw3uCmS4NlS/VEJgF/VJUSIA0pQ1S1VA11SGmBOeJ5WBLBLQBxJpjOitTDxqlYxOFAI0lPn51UAzzrw43JMfDRDU34ywjpKFVwMHwqVPjRHUCswyMj3mVpNvkfi0xZP72N3ZJZK5PH15NoNFH+kvTPCBOmhBJxIhJlU/XlR/TymVQRMA2RNkLAz1UGgxONW5WxPYHw1xPNPuHxIwgwzimwzPFMBxMI3oKKiQBKg5lMEQn8CIAsGQiFn9IsAsFUI5kLg0OkC/iIRAT/lIWMBwWmHMF/nmGoTbiQCFg7gYUsJ7l1l2FsMHmZhHhtjHijAng4j3jnizAXnEmXgdGknLM3kPmvB3lhxVFngbNFGvkFPPgSUvjQE7NPnvkfh7NMT7JxlwV0CFkWwGCjKTL0IAQwiMO5hMNTMFlUFcHZg0lgGaFyRahWnahilrHCV6iSwGmGlHTYDGiYxWmQjWkljtkwVjD2gtFrg9nrjehOw5BdnIkomXH2kuhpMmW6kgi0y+mxB+jACcn8CHlECQFAECHkDsXODwDqhAFcFcCAA=="} import { Hooks } from 'wagmi/tempo' Hooks.amm.useWatchRebalanceSwap({ onRebalanceSwap: (args, log) => { console.log('args:', args) }, }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `amm.watchRebalanceSwap` Parameters](/tempo/actions/amm.watchRebalanceSwap#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`amm.rebalanceSwap`](/tempo/actions/amm.rebalanceSwap) * [`amm.watchRebalanceSwap`](/tempo/actions/amm.watchRebalanceSwap) --- --- url: /tempo/actions/amm.watchBurn.md --- # `amm.watchBurn` Watches for liquidity burn events on the Fee AMM. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/amm.watchBurn.md","from":123,"to":5186} // @twoslash-cache: {"v":1,"hash":"88643edeaab8a1c3858658b1397de9291730cd2a4ec09f2bcb6ee2f76ce6d305","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qQDqW/YZYGhD/ACiJMcASnorpGAAKl6l5VKI6rK1yqoaLTp6eDWm22ankFisAGYBo5nKNGhNqM8DDM/NQAkxWOwuEZBMIXtp9AAOT4Kb4NGraNp4HEmLrgpBQkD2GEjPrwjyIqbI3xzNELAz5LGccTMZj4ioyGqk+oMv5UgwisVgnqIRnM06sxAAJkqCMwXJ8s1KNH5IASa34uM4wPsACE7mAADxHLIAPiCHWSqRdyQonCwjmY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Ljq5aGy4hYZlGNGVKbRiCTg3ZCCUKhArB9iSJARaLULvKfKsYJBBAQgRDHrspUEwZgDqCwqXrdArDYqLH/ohYsGLEQhnaTwJARgQjSpvpyDjZBDoatCpElhxoQbjrZFGo6IfI3ZyARggYwZoBNIUHsqnrcoXrwp+GCqopoB3qioPoSovEnHvovHvFbCwkgmlSebwbYEHhEa3I2QxD9wORYJh4z5kaYnHCpCiZ0Z+gEk0rV4BGpBkmpDyE6IhF6YNKl7fjUnFRFD9zQE15sbUmcC0mxY6am4Hj+LLqNjPECCvHwlfFsrPi/HnrLh8qAk3rCr3riogSQkyqkownQZwlakIlBTAaDjgaNgWDwlwa4EbhbjW4NilBEDWARi9B2nWDWBCEWw3xYLyEPyII4x4CoLKhWDulfyKG9A+y/x+yqF8iAIhxkBhxBQqS5zRx9I/YcJlwdzpxVyXy1zTKrytxJntxk5pnbx1xLwrwjwlw5lnypndwZm9z9xDxkAlkHzyJbw9xzzHCLzmDLyrRZnrzjyNlHwZm7xZSYANmTwFmqynwpldzpmuAwJsiEjiH3RPzIKvxBRyEKGahag4Ihl4JGhqEGA05Ah5gBSiyOESxQAznajWBSiYzkhekGAHkgjvy9D3wBmajWCuAXQxCwAYgIyEROTCAkRkS94oQgQiS4QWrRT3JKAAWITfgRh8FZD0TokQy2SxgOREQuT7KczDKej3gRymQuzc6lR8zhR4Uzyc5kbsysmInlTmTja1apQ3ikB2arQvixiVy5D3n2BGSlCDTiBICgABCKCSJCB4BLggCuCuBAA"} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.amm.watchBurn(config, { onBurn(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onBurn * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.watchBurn.md","from":5386,"to":5887} declare function onBurn(args: Args, log: Log): void type Args = { /** Amount of user token received */ amountUserToken: bigint /** Amount of validator token received */ amountValidatorToken: bigint /** Amount of LP tokens burned */ liquidity: bigint /** Address that removed liquidity */ sender: Address /** Address that received the tokens */ to: Address /** Address of the user token */ userToken: Address /** Address of the validator token */ validatorToken: Address } ``` Callback to invoke when liquidity is removed. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.watchBurn.md","from":5988,"to":6244} type Args = { /** Filter by sender address */ sender?: Address | Address[] | null /** Filter by user token address */ userToken?: Address | Address[] | null /** Filter by validator token address */ validatorToken?: Address | Address[] | null } ``` Filter events by indexed parameters. ### userToken (optional) * **Type:** `Address | bigint` Address or ID of the user token to filter events. ### validatorToken (optional) * **Type:** `Address | bigint` Address or ID of the validator token to filter events. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.watchBurn.md","from":6649,"to":6694} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`amm.watchBurn`](https://viem.sh/tempo/actions/amm.watchBurn) --- --- url: /tempo/actions/amm.watchMint.md --- # `amm.watchMint` Watches for liquidity mint events on the Fee AMM. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/amm.watchMint.md","from":126,"to":4909} // @twoslash-cache: {"v":1,"hash":"3e678dc18ce9b1b0888b0e3f1b0a2e9e066a3d862bdcaf011c8c115c0b244c46","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnE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Bz9v7AOgcg8r+D9P0OwAVRXGuJAG4yhetKMgWedwGzlKjXswCD9VBrQjDEZgMb6ltIOYBDVALAKXOueYVawEZf+IiFVU6rxa7VFRmSX4Kd5QNQnRnLuHtO6Z17tMfuhdKaMugFEPXqiVGNGAA/KkDYhgH6BGFAchvNKEING6mAWABgMgOJDmJwCLOOMZgANS9BUqzBBRGxn5tgrx4At5uL7hnqlLQqqCsowDrDdA+KcC2gHwCC7i0Y6ArBBgcLWK2KNgBgiImx+hiI0EHS5BJBphcCQppLhCIrUwsCSCZRAG6CGJoK2pGx6y4h9pSGqGyJrRiCTjJZCCTyhArB9iXwzg/yyrZK5KkYJBBAQgRCRo7Lz4NpgDqCNLxrdArD9KuElo0ZtKuEQh3IOgJARgQjZpPJyB2ZBDdqtCcEljMq0Z578FQrWHJZyARj1pbBqKz47LRoHJxrNKtJJoiSppXLpq3LpERHPLpFZFoB1GNSFQEbNoD6Hj46LYxBrBcDMRdy04Tr66JSdHHCpA3pLp+hDFoBN4kYR5FBdGpAv5uKUGgYqJy5fgTF5TjELLHBTEt6pDrGcALGsbAa47EKeo+r7hVF1E5HbJPj5GxpLjHLFEdKlH74VHDJVE5pTK1HsANr1E/FbCNH+QVqDg1qNh1r/HzRmz2zD4oCbhI4NilBEDWARi9AonWDWDn7myxxdwv6JyNyYx4CtzKhWC4nZxv69Dex5y+xf58hFzBxkChz+Tlx2jsyczD5Ym1yNCEg343TJzNxpzRzElICkkdyahag9xUl9xGjf4GCLZAh5i+RCzoGixQA1xIBajWBShozkgEkGDykggZy9AJxkmajWCuCnQxCwAYiwx4T2TCCETESm5ITDKCRYSni4TJJPyvh7QkQRjH5Qw0QE6gxWSxi2T4SOTBJszHBuRQweTSTOxoB+RrjcwhQRTSTcR7ZTosz5TChAnFQmR2ZSZJTXikCoaLTPixiPy5D6n2D6SlC9TiBICgABCKCXxCB4CLggCuCuBAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.amm.watchMint(config, { onMint(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.watchMint.md","from":4995,"to":5024} type ReturnType = () => void ``` Returns a function to unsubscribe from the event. ## Parameters ### onMint * **Type:** ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.watchMint.md","from":5126,"to":5651} declare function onMint(args: Args, log: Log): void type Args = { /** Amount of LP tokens minted */ liquidity: bigint /** Address that added liquidity */ sender: Address /** User token details */ userToken: { /** Address of the user token */ address: Address /** Amount of user token added */ amount: bigint } /** Validator token details */ validatorToken: { /** Address of the validator token */ address: Address /** Amount of validator token added */ amount: bigint } } ``` Callback to invoke when liquidity is added. ### sender (optional) * **Type:** `Address | bigint` Address or ID of the sender to filter events. ### userToken (optional) * **Type:** `Address | bigint` Address or ID of the user token to filter events. ### validatorToken (optional) * **Type:** `Address | bigint` Address or ID of the validator token to filter events. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `(error: Error) => void` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode for watching events. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`amm.watchMint`](https://viem.sh/tempo/actions/amm.watchMint) --- --- url: /tempo/actions/amm.watchRebalanceSwap.md --- # `amm.watchRebalanceSwap` Watches for rebalance swap events on the Fee AMM. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/amm.watchRebalanceSwap.md","from":133,"to":5190} // @twoslash-cache: {"v":1,"hash":"91e718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Os4+U+Rs1RHeRqZBf+ZoCQ7+EOBUZKOQ2ORQrUQOZQmGZmVOHqJ/IESsRKdWRw7WJ0/QLUCcv2MkSQrBQIBckEL+XoYmBQzUawVwB6GIWADEHGaiXyYQOiBiHvPCOCOSciG1HKXGZIB87CUCBMXgrITiR/ZYfcxpASGifyU5UWcOAWcKTGSKDSMOEKeBJKI8WWDKHOEsznYTYWbvRE+qJycbOrZWN8UgezXaP8VMQeXIEC/AWyUoSacQJAUAAIRQPRIQPAXcEAVwVwIAA"} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.amm.watchRebalanceSwap(config, { onRebalanceSwap(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.watchRebalanceSwap.md","from":5276,"to":5305} type ReturnType = () => void ``` Returns a function to unsubscribe from the event. ## Parameters ### onRebalanceSwap * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.watchRebalanceSwap.md","from":5427,"to":5802} declare function onRebalanceSwap(args: Args, log: Log): void type Args = { /** Address of the user token */ userToken: Address /** Address of the validator token */ validatorToken: Address /** Address of the swapper */ swapper: Address /** Amount of validator token swapped in */ amountIn: bigint /** Amount of user token received */ amountOut: bigint } ``` Callback to invoke when a rebalance swap occurs. ### userToken (optional) * **Type:** `Address | bigint` Address or ID of the user token to filter events. ### validatorToken (optional) * **Type:** `Address | bigint` Address or ID of the validator token to filter events. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.watchRebalanceSwap.md","from":6134,"to":6392} type Args = { /** Filter by user token address */ userToken?: Address | Address[] | null /** Filter by validator token address */ validatorToken?: Address | Address[] | null /** Filter by swapper address */ swapper?: Address | Address[] | null } ``` Filter parameters for the event. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/amm.watchRebalanceSwap.md","from":6565,"to":6610} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Whether to use polling. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`amm.watchRebalanceSwap`](https://viem.sh/tempo/actions/amm.watchRebalanceSwap) --- --- url: /tempo/connectors/dangerous_secp256k1.md --- # `dangerous_secp256k1` Connector for a Secp256k1 EOA. :::warning NOT RECOMMENDED FOR PRODUCTION USAGE. This connector stores private keys in clear text, and are bound to the session length of the storage used. Instead, use this connector for testing workflows, like end-to-end tests. ::: ## Install ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/tempo/connectors/dangerous_secp256k1.md","from":727,"to":776} pnpm add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/tempo/connectors/dangerous_secp256k1.md","from":799,"to":851} npm install accounts@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/tempo/connectors/dangerous_secp256k1.md","from":875,"to":924} yarn add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/tempo/connectors/dangerous_secp256k1.md","from":947,"to":995} bun add accounts@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts [wagmi.config.ts] // {"path":"/vercel/path0/site/tempo/connectors/dangerous_secp256k1.md","from":1038,"to":1387} import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { dangerous_secp256k1 } from 'wagmi/tempo' // [!code focus] export const config = createConfig({ connectors: [dangerous_secp256k1()], // [!code focus] chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` `dangerous_secp256k1` is a thin wagmi wrapper around the root `accounts` package. ## Parameters ### privateKey * **Type:** `Hex` Optional fixed private key to expose through the connector. If omitted, the connector generates and persists one for you. --- --- url: /tempo/actions/dex.buy.md --- # `dex.buy` Buys a specific amount of tokens from the Stablecoin DEX orderbook. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.buy.md","from":138,"to":6276} // @twoslash-cache: {"v":1,"hash":"514f8188da5f3aadb6f821b1369361f48b3a9b8e33f46d5689339bc21bc9aed7","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScAGYArmD8gmCcWJJwMACqYIxocEFEobEwiJxipBZKFJywvCyhcCVgscwARmQRJS2MShZoADrZrOxcqaTpWTmmUBC8CAYAsrFyAljm8JzipWjlypykMFj76WASxskQ0RucTa1knC0YVz0kyXRsliecF/fhMJwAjNZOEFAW8hIo0BEAHQDAYAWk4ABEZg1OPg0GgsA0APTYoiMGDMKFwfDY6azbGxATmATwbGjcbZXKUajiJRzZDIEB0cSsBQslhsDicYApNKZJlwTiuGKkCDMTgAcnxhMVsLADIlkyCioALAAmayKqrSCIDXGcA3Wa0221gEAAXQdom0+l1mjMihUakQgK0kl0gU1E2Z8gsVn+dgcpCcNHIiGk7k8ODwhBI5H89DwITCkU4vBMXALYGi3RKAGEhKWlANBcN81XuiyxJJ9AAOSOe5SqJAANn9Oj0eGL1ZZ5ksSH1UccznjiY81C8qd8GeoAWHhb2MF4MEYWDQJQAKjHhLGkgAlbe7/cs8lzEDH8SnxJCLc7vdoKHN11If7/ACs8hej2iAetogZ4Ps743mGE6ILq04xrOSBtkmi4pgYaZ+GuWYGHWwpGEkpgtlIvoAM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sDdFhNhZMNFNtYxAwS4nBD8I8TBS6aqUqXqWYPACqT6S6EqD8dGstVhOdQC0Cd9SCK8D8emv9FhCiGC3ddm4ILFQ9btd6SqJIAACXCHwBKFJl7kBOONcHflYqFoMCNpJHtWTIM15rOGnV0mkFcVloAnloMD1tFrOHtrUB/XAsZp0X+FcHwQLFgCYCTVFBCm1g5gVCQMNgez9jVljruTiQTt1iTvTSKRpkkW6FTT1ihHfJtjeUuNFC5v3HZjLgri4HjrCjoAiiim6kbhtmbjDh8TQFPUzRvmtHvkfkPmPgZXPi7kzqOW3msDvj3gPg9k/SJR7j7iHRvVXrHX+CXiKk/VPSXv7jXv3oBX1CXhfjrLmsNMVBFqwVMJJEQHvmrs/D9qwUDpYpAFgXECQFAACBWiSCXQQFcFcCAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { config } from './config' const { receipt } = await Actions.dex.buySync(config, { amountOut: parseUnits('100', 6), maxAmountIn: parseUnits('105', 6), tokenIn: '0x20c0000000000000000000000000000000000001', tokenOut: '0x20c0000000000000000000000000000000000002', }) console.log('Transaction hash:', receipt.transactionHash) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `dex.buy` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.buy.md","from":6613,"to":7045} import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' import { parseUnits } from 'viem' const hash = await Actions.dex.buy(config, { amountOut: parseUnits('100', 6), maxAmountIn: parseUnits('105', 6), tokenIn: '0x20c0000000000000000000000000000000000001', tokenOut: '0x20c0000000000000000000000000000000000002', }) const receipt = await waitForTransactionReceipt(config, { hash }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.buy.md","from":7072,"to":7153} type ReturnType = { /** Transaction receipt */ receipt: TransactionReceipt } ``` ## Parameters ### amountOut * **Type:** `bigint` Amount of tokenOut to buy. ### maxAmountIn * **Type:** `bigint` Maximum amount of tokenIn to spend. ### tokenIn * **Type:** `Address` Address of the token to spend. ### tokenOut * **Type:** `Address` Address of the token to buy. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`dex.buy`](https://viem.sh/tempo/actions/dex.buy) --- --- url: /tempo/actions/dex.cancel.md --- # `dex.cancel` Cancels an order from the Stablecoin DEX orderbook. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.cancel.md","from":125,"to":4919} // @twoslash-cache: {"v":1,"hash":"8e63dbc2614d60dc2105888794c30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4CcQgCuCuBAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { orderId, receipt } = await Actions.dex.cancelSync(config, { orderId: 123n, }) console.log('Cancelled order ID:', orderId) // @log: Cancelled order ID: 123n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `dex.cancel` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.cancel.md","from":5259,"to":5628} import { Actions } from 'wagmi/tempo' import { Actions as viem_Actions } from 'viem/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.dex.cancel(config, { orderId: 123n, }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args: { orderId } } = viem_Actions.dex.cancel.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.cancel.md","from":5655,"to":5789} type ReturnType = { /** ID of the cancelled order */ orderId: bigint /** Transaction receipt */ receipt: TransactionReceipt } ``` ## Parameters ### orderId * **Type:** `bigint` ID of the order to cancel. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`dex.cancel`](https://viem.sh/tempo/actions/dex.cancel) --- --- url: /tempo/actions/dex.createPair.md --- # `dex.createPair` Creates a new trading pair on the Stablecoin DEX. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.createPair.md","from":127,"to":8783} // @twoslash-cache: {"v":1,"hash":"898ef8c60c928fbbc1b3ecd918cdf0c00d4ac080a78268a8148b45b02b060db9","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinADWMBipAAbWtAAkwGKkFkqum6XlUogAHP21yqpIAMwtOnp4axhdFlbPIPaOzlGVwm1C8018c2oAUWsU4ACNwjAtjt9odjqdztp9Fdmnd6khKi82ngEXBcPJvk8BgCRn1HiDMFMDDM/FCFgYllwAI4AVwgNGRewOaCOygxoixMgATPI6g9EABWIlvAy8/nksyUxC/f5DQF9cYeUFMnyzUo0dl/WGkGC8GCMLBoVIAFSGwmGgjAACVbfbHaUoBBeAgDK7xO7+J7ODa7Q60AA6TEVGSyPHymraYkGGN+hgUnra6l62mIKWNBlg5kQ83Qg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filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { key, base, quote, receipt } = await Actions.dex.createPairSync(config, { base: '0x20c0000000000000000000000000000000000001', }) console.log('Pair key:', key) console.log('Base token:', base) console.log('Quote token:', quote) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `dex.createPair` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.createPair.md","from":9127,"to":9545} import { Actions } from 'wagmi/tempo' import { Actions as viem_Actions } from 'viem/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.dex.createPair(config, { base: '0x20c0000000000000000000000000000000000001', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args: { base, quote } } = viem_Actions.dex.createPair.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.createPair.md","from":9572,"to":9801} type ReturnType = { /** Key of the trading pair */ key: Hex /** Address of the base token */ base: Address /** Address of the quote token */ quote: Address /** Transaction receipt */ receipt: TransactionReceipt } ``` ## Parameters ### base * **Type:** `Address` Address of the base token for the pair. The quote token is determined by the base token's quote token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`dex.createPair`](https://viem.sh/tempo/actions/dex.createPair) --- --- url: /tempo/actions/dex.getBalance.md --- # `dex.getBalance` Gets a user's token balance on the Stablecoin DEX. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.getBalance.md","from":128,"to":5553} // @twoslash-cache: {"v":1,"hash":"2cbcd8f2e4514b44f515cfd59cdc515095e16ac4e7309dcfa2a7dbd7df793943","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinABGoeJgvDCpK8kWDKLa+uqytcqqGi06enhrchtbXRZWAMwDjs6jjRPUXtO+c2oASYrHYXCMgmEpXKUjGAFZ5HULogato2ngISYnj1EG8QPYPiMkAAmYk/TBTAwzPxAhYGfJgziwWjQo59ax4hTnBp4tE3AzM7Gvd5DT5IF7Wcl/KkA0o0OkgBIAV02xjAnDaACF1psYAAeDKJZIAPiCHWSqUNWQonCwjmYejIcFSmOEADpmW6tTqtm6AAr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BAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const balance = await Actions.dex.getBalance(config, { account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000001', }) console.log('DEX balance:', balance) // @log: DEX balance: 1000000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.getBalance.md","from":5639,"to":5664} type ReturnType = bigint ``` ## Parameters ### account * **Type:** `Address` Address of the account. ### token * **Type:** `Address` Address of the token. ## Viem * [`dex.getBalance`](https://viem.sh/tempo/actions/dex.getBalance) --- --- url: /tempo/actions/dex.getBuyQuote.md --- # `dex.getBuyQuote` Gets the quote for buying a specific amount of tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.getBuyQuote.md","from":133,"to":5800} // @twoslash-cache: {"v":1,"hash":"a420bc920b6563e021956e1161cf4176a0594ca6d74434e3e2fa2b7a9993a741","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScAGYArmD8gmCcWJJwMACqYIxocEFEobEwiJxipBZKFJywvCyhcCVgscwARmQRJS2MShZoADrZrOxcqaTpWTmmUBC8CAYAsrFyAljm8JzipWjlypykMFj76WASxskQ0RucTa1knC0YVz0kyXRsliecF/fhMJwAjNZOEFAW8hIo0BEAHQDAYAWk4ABEZg1OPg0GgsA0APTYoiMGDMKFwfDY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crCRthKl8qbJgK4x9z+w4JaKcJCnwSXi6iinAL3juUgAhX2iQrnjeVLLQKITwq5IsiyF4CeUOUXyxVjITIySGDEKfAjxjwlBuyIR2gylThylCQKmuCCkFiwBMDlLQwxS1IKja7IzYiMyQydWigzI9VKgJJDVfx7SBRjWKhQg8nVhNKsFJW6ziD6xcAxRxS0AJRoBJRmyFGFxWxcwcJOwtLaiKhuwMWeyKxCz7KhWBzBzWC8A9IvWvVvXvXWD/CpzUwsrYIPUhwfWA1A02j6ipzpyvGVFK6KhEJjQFajyjz0VVBJVqwsiNziBICgABCzRJB4DMiuCuBAA"} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { config } from './config' const amountIn = await Actions.dex.getBuyQuote(config, { amountOut: parseUnits('100', 6), tokenIn: '0x20c0000000000000000000000000000000000001', tokenOut: '0x20c0000000000000000000000000000000000002', }) console.log('Amount needed:', amountIn) // @log: Amount needed: 100300000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.getBuyQuote.md","from":5886,"to":5911} type ReturnType = bigint ``` Returns the amount of `tokenIn` needed to buy the specified `amountOut` of `tokenOut`. ## Parameters ### amountOut * **Type:** `bigint` Amount of tokenOut to buy. ### tokenIn * **Type:** `Address` Address of the token to spend. ### tokenOut * **Type:** `Address` Address of the token to buy. ## Viem * [`dex.getBuyQuote`](https://viem.sh/tempo/actions/dex.getBuyQuote) --- --- url: /tempo/actions/dex.getOrder.md --- # `dex.getOrder` Gets an order's details from the Stablecoin DEX orderbook. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.getOrder.md","from":134,"to":5091} // @twoslash-cache: {"v":1,"hash":"1b4c194e1433ff47798203a8d893230e07a7bba99b163b51514c7b0d01dbdc5f","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinOywpKnAuZzbK6RrAJJQqQBGyRZoANxbO8ziANZkqQAG1rQAJMBipBZKrk9XYB2nGOEAgdwA0jAMM9Xh8vj8/gCgYw4AAhRhHYGghTiMBInYCXh3VJgACuzGOZHx23EzAgpLAaBOZ0Z1M4pBgtwsP2ZSnObKwHKIvP5122lnoItZYs4KIAYuYsCdsTBcWyEoqACqMIkk8mU0gA1ylcpSRDqWS1ZSqJAAVhaOj0eFWfjMFisAGYBo5nKNGhNqF5pr45tQAkxWOwuEZBMITdp9NIvVb6hoHW08DGTF13Uhk/YfSMkAAmawBzBTAwzV00BYGfJRziwWjxip9az9FM2xDJ7QZgzNnM9Hveoa+ksADnLQarIdKtcCCQZ/FjnDaAHk9mQADwZRLJAB8QQ6yVSe6yFE4WEczD0ZDgqSzwgAdM3nxut6RnwAFG930hwLuxRKAeESpN+pAQMwKIwNuT5wK+dDvnom5rM+ABKeikqQYAAGqhKSMAHrkYC0vA168DAa4oZ+pRQBAvAIAYADiehwJwuK7GsADk7GwBIjByOxCSQcwnCqFRLqkCCYLPvO4hKExyDICAdC0lgCilE82loHAuQNoUwDRBy4g0OeySXvgaBoFgnCuJwIlQZw3EAAIAO4KdBAD0MQctx+mRoZ4mcmwdkOaJznuZ5jA+ewMA+Q4FhwP5eSBVwRnwWFjlia5HlKN5vnxTQkYpbkSxxMBnAALzGaqZnAUE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XMHBTAJEJBsBxHSDMZwL0CCVmVmZ9KPPcI8M5K8G/s+CMVyRiKkCNIRK/m/nZHnJaLvl6TGa4HTDELABGCrBlGdMIFlBFHutFF5J1BAClAZOlP4uDPZNlM5M+FPlkKVAHssFJIdOIMdKdLmghG+JzLdGDA9NcF7K9O9J9JtDpv0azoMQmfxFTMmaWVJDpqUCjOIEgKAAEIoIvEIHgLpCAK4K4EAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const order = await Actions.dex.getOrder(config, { orderId: 123n, }) console.log('Order details:', order) // @log: Order details: { amount: 100000000n, maker: '0x...', isBid: true, ... } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.getOrder.md","from":5177,"to":5947} type ReturnType = { /** Original order amount */ amount: bigint /** Orderbook key (identifies the trading pair) */ bookKey: Hex /** Tick to flip to when fully filled (for flip orders). For bid flips: must be > tick. For ask flips: must be < tick */ flipTick: number /** Whether this is a bid (true) or ask (false) order */ isBid: boolean /** Whether this is a flip order */ isFlip: boolean /** Address of the user who placed this order */ maker: Address /** Next order ID in the doubly linked list (0 if tail) */ next: bigint /** The order ID */ orderId: bigint /** Previous order ID in the doubly linked list (0 if head) */ prev: bigint /** Remaining amount to be filled */ remaining: bigint /** Price tick */ tick: number } ``` Returns the complete order details including the maker's address, order amounts, price tick, linked list pointers, and flip order information. ## Parameters ### orderId * **Type:** `bigint` Order ID to query. ## Viem * [`dex.getOrder`](https://viem.sh/tempo/actions/dex.getOrder) --- --- url: /tempo/actions/dex.getSellQuote.md --- # `dex.getSellQuote` Gets the quote for selling a specific amount of tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.getSellQuote.md","from":135,"to":5815} // @twoslash-cache: {"v":1,"hash":"e72885ed736301b0d1aa5f428258ba248ff06fde799d2fc7fe974306d5b6b9c7","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScAGYArmD8gmCcWJJwMACqYIxocEFEobEwiJxipBZKFJywvCyhcCVgscwARmQRJS2MShZoADrZrOxcqaTpWTmmUBC8CAYAsrFyAljm8JzipWjlypykMFj76WASxskQ0RucTa1knC0YVz0kyXRsliecF/fhMJwAjNZOEFAW8hIo0BEAHQDAYAWk4ABEZg1OPg0GgsA0APTYoiMGDMKFwfDY6azbGxATmATwbGjcbZXKUajiJRzZDIEB0cSsBQslhsDicYApNKZJlwTiuGKkCDMTgAcnxhMVsLADIlkyCioALAAmayKqrSCIDXGcA3Wa0221gEAAXQdom0+l1mjMihUakQgK0kl0gU1E2Z8gsVn+dgcpCcNHIiGk7k8ODwhBI5H89DwITCkU4vBMXALYGi3RKAGEhKWlANBcN81XuiyxJJ9AAOSOe5SqJAANn9Oj0eGL1ZZ5ksSH1UccznjiY81C8qd8GeoAWHhY2zAg8TQAHkqZ1ur1m66kP9/gBmeRensJgeBvC8ncnA8MMMTxC66cx2d9pOLimBhpn4a5ZgYdbCkYSSmC2Ui+penYKN2Poetoj4GNBJhjuGSDfiA9gznGk66gBmBAT46YsjQ4EgJBXCwLQp6tuel6yF23pINerKDoEjE4Z++GEb+xGIJe+pkUuwErtR64GHECRnJwgYAMowHIcgAIqxBANAADyViW3QAHxBCOZacIZ1ZVKMvJ6GQqJYcIUKMVCqnqVpOk0FCAAKjjMPZYwGY2SjGR0nA+XKzCMOkelOXALl0G5ehqRp2m6TAUIAEp6LEpBgAA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QEIUovAp6TmqQHacaVQAZHWAwpYYwXALm68A2hq5Q2OpAjwGpugwmGwW21eUAJSQgQG2Zo6pQlJYgOQb+QgMqxUg6LAHBHqiGyGwu0QQQl4EQr2mS722OYA6gJG3244sQjGo5cOieZSo5l4OmvQ0QUIl4UInGcgWsQQS8UZAU6hGwRWoQKWiZl6/ySGb+HCmO2OaAc6JJsm728mX2ZGTUv2p0amAOmmwORSHBG5BmPGl515p0QFaAcIAYkQySnhO09OCQm4BYDC5MECERnRzOio8FJwJQqu3OVQ6FkINRkJdRJQuFJQki/yvpNupRqFxFfRuFEJah0JxFnApF0uGGrROc6o52EsW0l5UIIFd5MmmIcmn2CUSmr5f2oFn5QO2mPFm53GgF7AN5IFYFOgeYmOOa6OJYClOOYAgK1Sq0MyFg1ULIRA1gUI/wZl1ofJXCXE+oHoLKYkbKeAZRkptgWyRED8bYcp0kKKQqiCus9Cr4h4FCli74Ap8El4ECSEIpMgjlBgg8nKH4EYrl0pD84kXlrISgLIUhTlM6zE4VvYYK0VNgRymEAVXANKk808JQ0g0g6gkykpJ8KV8Ysp/JBYsATAXm8M8UyMXSIMr0rMsMnVrSayuQPVCo3Sqo1ih0IC3QY1SoUIXJ1YfSzB8VfhRs4gJs8UiUtAyUaAqUVsNANsxMdsfMZCbsI1eQioXsfRvsqsYs0K5Coc4c1gvAEyb171H1n11g/wGc9MHKQVT1EcX1wNINNo+oGcWcmaAhXRiodCU048tKVVfRq1kIAwLILc4gSAoAAQi0SQeAzIrgrgQAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { config } from './config' const amountOut = await Actions.dex.getSellQuote(config, { amountIn: parseUnits('100', 6), tokenIn: '0x20c0000000000000000000000000000000000001', tokenOut: '0x20c0000000000000000000000000000000000002', }) console.log('Amount received:', amountOut) // @log: Amount received: 99700000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.getSellQuote.md","from":5901,"to":5926} type ReturnType = bigint ``` Returns the amount of `tokenOut` received for selling the specified `amountIn` of `tokenIn`. ## Parameters ### amountIn * **Type:** `bigint` Amount of tokenIn to sell. ### tokenIn * **Type:** `Address` Address of the token to sell. ### tokenOut * **Type:** `Address` Address of the token to receive. ## Viem * [`dex.getSellQuote`](https://viem.sh/tempo/actions/dex.getSellQuote) --- --- url: /tempo/actions/dex.getTickLevel.md --- # `dex.getTickLevel` Gets the tick level information at a specific tick on the Stablecoin DEX orderbook. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.getTickLevel.md","from":163,"to":5884} // @twoslash-cache: {"v":1,"hash":"3fba3acc82c4f344f1ecc51d048f896383905db7488d943734d6cdae1b8b032a","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogLGwcnAAqjLwA1pQgYpL6ACyaZooqaoiJWpK6gRHRseaWSACMdg6kTjTkiNLunjh4hCTk/vR4ABTi5uJwAJScvCZcQ2AAZoxKiJwAwkITSgA6YMHsI/OTsfFSiAAcZanKqkgAbNk6enijC4UWVgBM5Y7ONXUe1F5Nvq3UAVfDnAUJDk01y+SiABkYMCAHQAJT0AFdSGAAGrdRG4UTafQlEoAZnkaWOiAArOdcnggTA5LdipknpUXqd6h9GgZmn5fu0DKtQkZBMItjjSvcUgojhkUtpKQYBSY6VYsiB7M9qkh7tZWZh2T4WrEaDygqw1pxYLRhQlSvjyYd0khCdQcpcDObFUhlaqmer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WbeJAWKm+K1YpdKzgPCRGIfaYEoMAE3cQSNfisa1uCQOQCERgTudKGqDAEa9JNajaH8VwQ0smRVJmLUXGIYWAJecWPCUcHScSJ3KSexFKMyMxQSABc6vSRid1FKa6k0ZSHCAaiWSYR6hiRiGERUhYRxNKtGeycQaqWqDSSsasKmA8NqIWDqCKEOfqQaYada9GjGzGrGzaCaCKcuWaJJb+MJVJDaBpSadFTFI6E6HbIqC/EPeY2XbSdK1Y58C/WIAGcQJAUAAIRQXlIQPATCEAVwVwIAA"} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { Tick } from 'viem/tempo' import { config } from './config' const level = await Actions.dex.getTickLevel(config, { base: '0x20c0000000000000000000000000000000000001', tick: Tick.fromPrice('1.001'), isBid: true, }) console.log('Tick level:', level) // @log: Tick level: { head: 1n, tail: 5n, totalLiquidity: 1000000000n } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.getTickLevel.md","from":5970,"to":6226} type ReturnType = { /** Order ID of the first order at this tick (0 if empty) */ head: bigint /** Order ID of the last order at this tick (0 if empty) */ tail: bigint /** Total liquidity available at this tick level */ totalLiquidity: bigint } ``` Returns the price level information including the order IDs for the head and tail of the FIFO queue at this price level, and the total liquidity available. ## Parameters ### base * **Type:** `Address` Address of the base token. ### isBid * **Type:** `boolean` Whether to query the bid side (`true`) or ask side (`false`). ### tick * **Type:** `number` Price tick to query. Can be created using `Tick.fromPrice()`. ## Viem * [`dex.getTickLevel`](https://viem.sh/tempo/actions/dex.getTickLevel) --- --- url: /tempo/actions/dex.place.md --- # `dex.place` Places a limit order on the Stablecoin DEX orderbook. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.place.md","from":126,"to":6672} // @twoslash-cache: {"v":1,"hash":"ae78873af261e30e0a9ea1adc6baa89b8d91d755de180f0299788136db141068","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScAGYArmD8gmCcWJJwMACqYIxocEFEobEwiJxipBZKFJywvCyhcCVgscwARmQRJS2MShZoADrZrOxcqaTpWTmmUBC8CAYAsrFyAljm8JzipWjlypykMFj76WASxskQ0RucTa1knC0YVz0kyXRsliecF/fhMJwAjNZOEFAW8hIo0BEAHQDAYAWk4ABEZg1OPg0GgsA0APTYoiMGDMKFwfDY6azbGxATmATwbGjcbZXKUajiJRzZDIEB0cSsBQslhsDicYApNKZJlwTiuGKkCDMTgAcnxhMVsLADIlkyCioALAAmayKqrSCIDXGcA3Wa0221gEAAXQdom0+l1mjMihUakQgK0kl0gU1E2Z8gsVn+dgcpCcNHIiGk7k8ODwhBI5H89CYQ2FABVGLwANYssSSfQADkjnuUqiQuv9Oj0eHzRZZ5ksSH1UccznjiY81C8qd8GeoATwITCkU4vBMXFnYGi3RKAGEhEulANBcMZ+vuiXXUh/v8AKzyL21xAANgbgbwC43bfDSAAzN2Y723APMCmDGm/GOWYGAuYhfKQsCkAAklAnTdL0B5lkeuqyNW3oaLeTYGOwEHQU+HaIGeID2D2cZIOWSaDr+PjpiyNBAURc57DAvAwIwWBoCUuYxsIsZJAASsxrHsSy5JzCAXHiDxiRCExLFsWgUIIVIvonuW541j6HraHeBj7HJwlhvhhHER+pG+uoFE/t4/6jnRgTbsKRhJKYpbKf86g3qhl5aQGmGGNJwh4VYxnRrGLiIC+J6WUOf4jrR44GA5XCwLQSn6P85b1l5PpvqyjaBClQVICFJHhbqL7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VE80OwArDdOlYl2eutAOEAMSIblEiuuC44LR+DGcTE8Fiq4pSxUWcDGEoSE14qoYek4Nq2y3IEoSezGM8FvXEkElPQe+exAK1ee6e8m1EdezgRe6Uo/PEmxdUIo0or6dOzO0gbOu2lAzENAgu12u/Yu9opuzo7oiuy+wYuurOhu3+pulu2Y72RYv4ZY/+pIYuVkFVcuHYliFkIgBRHTARa6wHSKE7T1V8FtMwG416962HeMbtBHZ7UteiLpTWaCWCM5Q7CKdQKsR6ssrB8hqAXB0beMfUKKJ7AwZVFkfcvANPahl8csWwG5YRmbEAWo8CO4SCREEoN6l8a7MwZ8X0LKfBpAb6vJWcWAbMQZUUGaYQRjU+Veb/SDXeCtHVP1C9Y+JjUVUxnRiTIsAxg1UVNjW+RFYUFuJ+Kx0+KEc6npE1LpUUJhqoZJdiPuChKhLgPRuheaRaFiSpVhHpdhF6B5bhMUMYLUXIfha0K1YRHBNRMRexwsFdaRJzaLWLVRK6dRFbJUdbTbPbephplzPJyp77RUP7CxKxIhW8weiRiCTgaRjeqoJhwhFkEJcQJAUAAIRQVnIQLNBAVwVwIAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { Tick } from 'viem/tempo' import { config } from './config' const { orderId, receipt } = await Actions.dex.placeSync(config, { amount: parseUnits('100', 6), tick: Tick.fromPrice('0.99'), token: '0x20c0000000000000000000000000000000000001', type: 'buy', }) console.log('Order ID:', orderId) // @log: Order ID: 123n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `dex.place` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.place.md","from":7011,"to":7563} import { Actions } from 'wagmi/tempo' import { Actions as viem_Actions } from 'viem/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' import { parseUnits } from 'viem' import { Tick } from 'viem/tempo' const hash = await Actions.dex.place(config, { amount: parseUnits('100', 6), tick: Tick.fromPrice('0.99'), token: '0x20c0000000000000000000000000000000000001', type: 'buy', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args: { orderId } } = viem_Actions.dex.place.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.place.md","from":7590,"to":7985} type ReturnType = { /** ID of the placed order */ orderId: bigint /** Address of the order maker */ maker: Address /** Address of the base token */ token: Address /** Amount of tokens in the order */ amount: bigint /** Whether this is a buy order */ isBid: boolean /** Price tick for the order */ tick: number /** Transaction receipt */ receipt: TransactionReceipt } ``` ## Parameters ### amount * **Type:** `bigint` Amount of tokens to place in the order. ### tick * **Type:** `number` Price tick for the order. Use `Tick.fromPrice()` to convert from a price string. ### token * **Type:** `Address` Address of the base token. ### type * **Type:** `OrderType` Order type - `'buy'` to buy the token, `'sell'` to sell it. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`dex.place`](https://viem.sh/tempo/actions/dex.place) --- --- url: /tempo/actions/dex.placeFlip.md --- # `dex.placeFlip` Places a flip order that automatically flips to the opposite side when filled. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.placeFlip.md","from":155,"to":7335} // @twoslash-cache: {"v":1,"hash":"e9b109959543a4af97fa80fd74ff57c367fad28063d8fae2ea79374624391edb","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScAGYArmD8gmCcWJJwMACqYIxocEFEobEwiJxipBZKFJywvCyhcCVgscwARmQRJS2MShZoADrZrOxcqaTpWTmmUBC8CAYAsrFyAljm8JzipWjlypykMFj76WASxskQ0RucTa1knC0YVz0kyXRsliecF/fhMJwAjNZOEFAW8hIo0BEAHQDAYAWk4ABEZg1OPg0GgsA0APTYoiMGDMKFwfDY6azbGxATmATwbGjcbZXKUajiJRzZDIEB0cSsBQslhsDicYApNKZJlwTiuGKkCDMTgAcnxhMVsLADIlkyCioALAAmayKqrSCIDXGcA3Wa0221gEAAXQdom0+l1mjMihUakQgK0kl0gU1E2Z8gsVn+dgcpCcNHIiGk7k8ODwhBI5H89CYQ2FABVGLwANYssSSfQADkjnuUqiQuv9Oj0eHzRZZ5ksSH1UccznjiY81C8qd8GeoATwITCkU4vBMXFnYGi3RKAGEhEulANBcMZ+vuiXXUh/v8AKzyL21xAANgbgbwC43bfDSAAzN2Y723APMCmDGm/GOWYGAuYhfKQsCkAAklAnTdL0B5lkeuqy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HyfKPAUVqCKAHlrgklPq5tQNFkKGvAblllg0QiFgmwFdEAdZI2aQyCREEoXUbde0Z7U8Xlgh1wKZWcWAbMB5UUBaYQfTABB+Mk9jD+NdKNFNVOAPABZ1QNj19df3WNJUZ1YPNgSNnTR5boH1uNKEeB65JNS5UUJV6CKoPSIWTeERMRLgL1qRZaVZeRDaRRQpFRL6fFDRMUMYLUXIHRa0DNAxIJDmLmXtaNuvXPTzArexQJUhPtxPQd8LLbUd4JRGMJKAmAxApd5d60BxbthOBJJUWg1JdJPhPow5s1pVjcq1jNPNqAXhFkRpcQJAUAAIRQWwoQPAZkVwVwIAA=="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { Tick } from 'viem/tempo' import { config } from './config' const { orderId, receipt } = await Actions.dex.placeFlipSync(config, { amount: parseUnits('100', 6), flipTick: Tick.fromPrice('1.01'), tick: Tick.fromPrice('0.99'), token: '0x20c0000000000000000000000000000000000001', type: 'buy', }) console.log('Flip order ID:', orderId) // @log: Flip order ID: 456n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `dex.placeFlip` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.placeFlip.md","from":7678,"to":8274} import { Actions } from 'wagmi/tempo' import { Actions as viem_Actions } from 'viem/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' import { parseUnits } from 'viem' import { Tick } from 'viem/tempo' const hash = await Actions.dex.placeFlip(config, { amount: parseUnits('100', 6), flipTick: Tick.fromPrice('1.01'), tick: Tick.fromPrice('0.99'), token: '0x20c0000000000000000000000000000000000001', type: 'buy', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args: { orderId } } = viem_Actions.dex.placeFlip.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.placeFlip.md","from":8301,"to":8773} type ReturnType = { /** ID of the placed flip order */ orderId: bigint /** Address of the order maker */ maker: Address /** Address of the base token */ token: Address /** Amount of tokens in the order */ amount: bigint /** Whether this is a buy order */ isBid: boolean /** Price tick for the order */ tick: number /** Target tick to flip to when order is filled */ flipTick: number /** Transaction receipt */ receipt: TransactionReceipt } ``` ## Parameters ### amount * **Type:** `bigint` Amount of tokens to place in the order. ### flipTick * **Type:** `number` Target tick to flip to when order is filled. Must be greater than `tick` for buy orders, less than `tick` for sell orders. ### tick * **Type:** `number` Price tick for the order. Use `Tick.fromPrice()` to convert from a price string. ### token * **Type:** `Address` Address of the base token. ### type * **Type:** `'buy' | 'sell'` Order type - `'buy'` to buy the token, `'sell'` to sell it. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`dex.placeFlip`](https://viem.sh/tempo/actions/dex.placeFlip) --- --- url: /tempo/actions/dex.sell.md --- # `dex.sell` Sells a specific amount of tokens on the Stablecoin DEX orderbook. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.sell.md","from":138,"to":6272} // @twoslash-cache: {"v":1,"hash":"997af5c0532953dd4e2e196ac8b932f9108ab9fe48dbcca2fc81f6d18ce19b1e","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScAGYArmD8gmCcWJJwMACqYIxocEFEobEwiJxipBZKFJywvCyhcCVgscwARmQRJS2MShZoADrZrOxcqaTpWTmmUBC8CAYAsrFyAljm8JzipWjlypykMFj76WASxskQ0RucTa1knC0YVz0kyXRsliecF/fhMJwAjNZOEFAW8hIo0BEAHQDAYAWk4ABEZg1OPg0GgsA0APTYoiMGDMKFwfDY6azbGxATmATwbGjcbZXKUajiJRzZDIEB0cSsBQslhsDicYApNKZJlwTiuGKkCDMTgAcnxhMVsLADIlkyCioALAAmayKqrSCIDXGcA3Wa0221gEAAXQdom0+l1mjMihUakQgK0kl0gU1E2Z8gsVn+dgcpCcNHIiGk7k8ODwhBI5H89DwITCkU4vBMXALYGi3RKAGEhKWlANBcN81XuiyxJJ9AAOSOe5SqJAANn9Oj0eGL1ZZ5ksSH1UccznjiY81C8qd8GeoAWHhb2MF4MEYWDQJQAKjHhLGkgAlbe7/cs8lzEDH8SnxJCLc7vdoKHN11If7/ACs8hej2iAetogZ4Ps743mGE6ILq04xrOSBtkmi4pgYaZ+GuWYGHWwpGEkpgtlIvoAMxkUB3Y+mBAZDgYhEmGO4ZIAhID2DOcaTr2aGYB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xUPW7XMSiHeiqiSAAAlwh8AShSZ95QTzjXB352L+aDAjaSR7VUzTMuazhZ1dIl4gLIVSEa0V0XbDbjbaaoKdF/hXB8ECxYAmAk1RRQptYOYFQ0DDZXs/Y1Yo7BV7lY7dZ4701CkaZJFuhU146oRPybY3lbjRQ5auAZQy4K4uAY7wo6BIp64EhG4bZm4w4fEO4u40754+5rQV414R4LACUp4Z5u7e5F5l5B5h4N5+011d5r1eB70l6J1/gn5ipv1R6b5R1l6d7bR9Qn4X4Gz5rTTFRBasELCSREAV4K6oQ9ahazh7b8A2KQBYFxAkBQAAgVokgv0EBXBXAgA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { config } from './config' const { receipt } = await Actions.dex.sellSync(config, { amountIn: parseUnits('100', 6), minAmountOut: parseUnits('95', 6), tokenIn: '0x20c0000000000000000000000000000000000001', tokenOut: '0x20c0000000000000000000000000000000000002', }) console.log('Transaction hash:', receipt.transactionHash) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `dex.sell` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.sell.md","from":6610,"to":7042} import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' import { parseUnits } from 'viem' const hash = await Actions.dex.sell(config, { amountIn: parseUnits('100', 6), minAmountOut: parseUnits('95', 6), tokenIn: '0x20c0000000000000000000000000000000000001', tokenOut: '0x20c0000000000000000000000000000000000002', }) const receipt = await waitForTransactionReceipt(config, { hash }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.sell.md","from":7069,"to":7150} type ReturnType = { /** Transaction receipt */ receipt: TransactionReceipt } ``` ## Parameters ### amountIn * **Type:** `bigint` Amount of tokenIn to sell. ### minAmountOut * **Type:** `bigint` Minimum amount of tokenOut to receive. ### tokenIn * **Type:** `Address` Address of the token to sell. ### tokenOut * **Type:** `Address` Address of the token to receive. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`dex.sell`](https://viem.sh/tempo/actions/dex.sell) --- --- url: /tempo/hooks/dex.useBalance.md --- # `dex.useBalance` Gets a user's token balance on the Stablecoin DEX. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.useBalance.md","from":125,"to":5462} // @twoslash-cache: {"v":1,"hash":"86f30c8b6ecfcd05a596ac74359c0fbce656e58c96f45bc8cceeb1ce8f608b07","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywl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kcSO72cEu5hROOQppcu5SQ6gJOS6cRt22555aOR52Bp5SQ55nAl5YO15ZOYAWMsIMCxWpRAUo5k5bZMGTWcGXZSZx6vZ3WA5PxA2eGo5o2n6E57AG2U5qFCQM5Wgc52kK29Qa2GFe+nSYg7kSAnksspgqkIARAFgZ0Z0FgFgIJwg3SE4qsfSnYh4PYrysOiJXy44SosyT45sC4FYQQK5osoEZoCEmSiSPihyGkroJInw5IqIPoGIwI2kQY+INyLFEoRe7FvIMJXFQQElVFg4AyI4MoKJkoAlKo3gJF/gCBeAPFzFjYz+u4UJvIasSyeAjkTkVkRESQqsDFIVIVYAHyu4yJ3ylgrgMsuosAVYScUUw0gg/UCUoi6O6UmUOUMAeUbRjUyVNIZo1kaVQ02EuEWs1kwcM0IyloB0tAcYbIEoUALYqgEE1gTYrYbIEEFgqg94kgEoqgogLYyQCobIbIAE1gkgMAcYqgkgqgBQFgyQDkyQyQl0M0lymyyUh0x0oVe1+1B1h1+1F0W0YA10+VEKfhxkflAVYsiAaOplMACe/gfqogSAoAgQ8gd8eoeAIUIArgrgQAA=="} import { Hooks } from 'wagmi/tempo' const { data: balance } = Hooks.dex.useBalance({ account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000001', }) console.log('DEX balance:', balance) // @log: DEX balance: 1000000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `dex.getBalance` Return Type](/tempo/actions/dex.getBalance#return-type) ## Parameters See [Wagmi Action `dex.getBalance` Parameters](/tempo/actions/dex.getBalance#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`dex.getBalance`](/tempo/actions/dex.getBalance) --- --- url: /tempo/hooks/dex.useBuy.md --- # `dex.useBuy` Buys a specific amount of tokens from the Stablecoin DEX orderbook. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.useBuy.md","from":138,"to":7274} // @twoslash-cache: {"v":1,"hash":"19b864958a3edb268ed55df991f577eacfa8b004aba94539562aed8b4486c2ef","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUoiaicACUnABmAK5gjowQYJxY4nAwAKpgjGhwwURhcTCInCKkpgoUnLDWLGFwZWBxzABGZJFlbYwKpmgAOrms7FzppJk5eUZQENYIegCycTJojFgm8Jyi5WiVipykMFhHmWBiaymcEDHbnC3tZJxtGHd9JKl0bGbn17dtERgnAAjBZOMFQV8UvI0JEAHRDIYAWk4ABE5k1OPg0GgsE0APT4oiMGDMOFwfD42bzfFxNYmNbwfHjSa5fL+MQKBbIZAgOiiVhyfwsNgcTjANIZbJsuCcVyxUgQZicADkxNJKsRYBZ0umwRVABYAEwWFU1SSRIaEzjGix2+0OsAgAC6zuEml0BvUxnkShUiFBGnE2iCOqm7NkpnMwJsdlIDicUncnhweEIJHIGkCeGsKREzziGAAyhhEmUDII4bBaHC4pkAEKFkuJOEAJR0cVIYAAKl4ADwAYRSMV6NQS/EgAHcwAA+fwicS6ADsS9kvuUSFX1GDOjwbSbpes/hMZiQAGZY/ZHH5EAA2ZPULxp3yZgL0JgjMUVowLiSIAAcW5yIoG6IN6mghng37HlG56XvG17OMC94eI+qZ6OmfhZu+egiqMtR0POHpSBePogf6pEQbuejVjBp6IKRthXomiBGkaD6YOhPgZhy2Z6PEiSXKkdYwI2xaHoOw6jpw45TrOwTjAKOhkHAAD85Z8JW1a1g2B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peoD1aEkdZUGzyQB9t6bUAVwvVzFgA/Cuyp2BjpzBjTIeihhhlJDYHhlCyp0JxBmi2TcZ1Jrqq4USH6u/CZjclikPDZgRmtAHGxO2TKT6PUKhZuiMP1KeBFfBGoIUDhALEFlSFWlAP4BqAwfRbaChnWTmj7hLc8hfRVh5jQ2KhD2pxTiDjtEzmzh5imzjhmz1lXcDjTgsAzlDnDh5id33YNiNgN2j1vZNwthzlxkz0gyveNjvffayyNHdnziLbNO2pVG7EDc3jsApEQEzlnarB9VUmgpyhWbhDdd5bmmDbLsmx0FECQFAECEqjmjwHZFcFcCAA==="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' const buySync = Hooks.dex.useBuySync() // Call `mutate` in response to user action (e.g. button click, form submission) buySync.mutate({ amountOut: parseUnits('100', 6), maxAmountIn: parseUnits('105', 6), tokenIn: '0x20c0000000000000000000000000000000000001', tokenOut: '0x20c0000000000000000000000000000000000002', }) console.log('Transaction hash:', buySync.data?.receipt.transactionHash) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `dex.buy` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/dex.useBuy.md","from":7609,"to":8124} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' import { useWaitForTransactionReceipt } from 'wagmi' const buy = Hooks.dex.useBuy() const { data: receipt } = useWaitForTransactionReceipt({ hash: buy.data }) // Call `mutate` in response to user action (e.g. button click, form submission) buy.mutate({ amountOut: parseUnits('100', 6), maxAmountIn: parseUnits('105', 6), tokenIn: '0x20c0000000000000000000000000000000000001', tokenOut: '0x20c0000000000000000000000000000000000002', }) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `dex.buy` Return Type](/tempo/actions/dex.buy#return-type) ### mutate/mutateAsync See [Wagmi Action `dex.buy` Parameters](/tempo/actions/dex.buy#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`dex.buy`](/tempo/actions/dex.buy) --- --- url: /tempo/hooks/dex.useBuyQuote.md --- # `dex.useBuyQuote` Gets the quote for buying a specific amount of tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.useBuyQuote.md","from":130,"to":5743} // @twoslash-cache: {"v":1,"hash":"cb4e5f5fb447a1a65ef7af20e203bda1f35f12b1e876616083f30b47831f53fb","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUoiaicACUnABmAK5gjowQYJxY4nAwAKpgjGhwwURhcTCInCKkpgoUnLDWLGFwZWBxzABGZJFlbYwKpmgAOrms7FzppJk5eUZQENYIegCycTJojFgm8Jyi5WiVipykMFhHmWBiaymcEDHbnC3tZJxtGHd9JKl0bGbn17dtERgnAAjBZOMFQV8UvI0JEAHRDIYAWk4ABE5k1OPg0GgsE0APT4oiMGDMOFwfD42bzfFxNYmNbwfHjSa5fL+MQKBbIZAgOiiVhyfwsNgcTjANIZbJsuCcVyxUgQZicADkxNJKsRYBZ0umwRVABYAEwWFU1SSRIaEzjGix2+0OsAgAC6zuEml0BvUxnkShUiFBGnE2iCOqm7NkpnMwJsdlIDicUncnhweEIJHIGkCeG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noFZJ+DZMRPZKQo5FRDzILE+Nan6WJBYEGSKiVLCsFELO1V6otPIvGUoq6prP4JYXgG1XVTVNCo6v6FYH1XSmYr8GYOwlAGUPXMtI6NKkIodbGZYK4FwhpLAEwMUuKJnLKPKI8vbL8c7K7O7GwJ7NchDR8lDXbM8uqMwG8s0VHFRGUCFECOnJDdnLnOIgXEXAQS9WgPonEqyHqCqPXPHs3K3MXJKoSv3IPBYNYACrzXzfzQLSNGvFPJ3LTZzUPILZLVLfaEaGvBvPSWpScSqKYvQqwu9YgPHoTZvP4KgoJIgKAIEGrO0q6ggK4K4EAA=="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' const { data: quote } = Hooks.dex.useBuyQuote({ amountOut: parseUnits('100', 6), tokenIn: '0x20c0000000000000000000000000000000000001', tokenOut: '0x20c0000000000000000000000000000000000002', }) console.log('Amount needed:', quote) // @log: Amount needed: 100300000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `dex.getBuyQuote` Return Type](/tempo/actions/dex.getBuyQuote#return-type) ## Parameters See [Wagmi Action `dex.getBuyQuote` Parameters](/tempo/actions/dex.getBuyQuote#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`dex.getBuyQuote`](/tempo/actions/dex.getBuyQuote) --- --- url: /tempo/hooks/dex.useCancel.md --- # `dex.useCancel` Cancels an order from the Stablecoin DEX orderbook. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.useCancel.md","from":125,"to":5873} // @twoslash-cache: {"v":1,"hash":"d99005d358f82f6b8da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m4IArgrgQAA==="} import { Hooks } from 'wagmi/tempo' const cancelSync = Hooks.dex.useCancelSync() // Call `mutate` in response to user action (e.g. button click, form submission) cancelSync.mutate({ orderId: 123n, }) console.log('Cancelled order ID:', cancelSync.data?.orderId) // @log: Cancelled order ID: 123n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `dex.cancel` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/dex.useCancel.md","from":6211,"to":6670} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const cancel = Hooks.dex.useCancel() const { data: receipt } = useWaitForTransactionReceipt({ hash: cancel.data }) // Call `mutate` in response to user action (e.g. button click, form submission) cancel.mutate({ orderId: 123n, }) if (receipt) { const { args: { orderId } } = Actions.dex.cancel.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `dex.cancel` Return Type](/tempo/actions/dex.cancel#return-type) ### mutate/mutateAsync See [Wagmi Action `dex.cancel` Parameters](/tempo/actions/dex.cancel#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`dex.cancel`](/tempo/actions/dex.cancel) --- --- url: /tempo/hooks/dex.useCreatePair.md --- # `dex.useCreatePair` Creates a new trading pair on the Stablecoin DEX. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.useCreatePair.md","from":127,"to":8287} // @twoslash-cache: {"v":1,"hash":"30ad47475bf43802763bb99c5cf8fdf2fdf294d49b87a8e6428158f4753de2e3","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6INYQYCKc1qQwojQACqKMpADKGGDWiDx8ggB0sLTZAK5wMADCUTEw8YkpadkASjoFpGAAKl4APCWhAGaMChScBWD8kADuYAB8/iLiugAsAMyy8koqiACMcxri2kGR0XEJyanW/iZmSABMNnakDk5IAGzunjh4hCTkGoFMrOxcBkE000ukeVmMK2Uam2Wh0eEBRnO5muwVu9z8iEuCxe1C8718XwC9F+bA4nDywNmT0ey0UUMQS2oOzhegpslMyJu9kcGMubg8uLeeg+fm+xL03SGjkYoUGxTKB0qRxq1k6PT6AyGIwg4wmAAosPZmDoyHAAPwZBG5OiFeXlQ7VE7ZeJ3Y1OOBqsC9fqDYZjSYASktWTg1vyRVK9qVjtqDTQTVaHS6Xo1vu1uoAOmAwKJjXBDdYYHLI4qqsc0v4oBBrAg9IDON12BF7aYFJxRJwzKNOGg7lBW5xDYlOLLlEWACIAUQAGtks1mAHIQGgZFr4RhwTgb9ucOAnfCkUIQIqcQgCHt2LijBJoTeN0gXou90Rhe4ysBZtAQTgAIyLpmsGQClgKARzAHcfxkat+F/GB7yLKJ42aAcOyifNQmKbJ/DEBRa2QZAQDoXMsDkfwAAMKNvWgsxYUkuGATJDE4VwG0PZhOAAcmvBRmEYAB6Gg/g4+cvSlNB304ABBLAsD1ANOGALNOAiDD6M4ZgCjEGgBg3WJ5H7RRmM4ABeRicjyW0SwqMsVTkkTlMQhNOD1JTlM4dof00r8P3AtzlNCEoTGsfhjOAOSTImdTNIqPUGJ/URigyDiLFoS4LGsbJMvWdYOO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ALoQhYASR/gFIaejJug2JOJuJeIBI7s2BhJ7XyeSqBrdCrQ6e7QGfbIP898SgQcyJ+Uv7wI0Ip7igCEIxuk+FnI4MCgLLF1G8gPpx6/AAYMLhC68ROE74D/Jfyp7ZB+UsUVyCqiSgap0ohqLAdgKwE5QKAA0R/h6y3qa5S43/L8A7F1YHche2MUWmaGyAqp4BwnTXAAEVzqPGCgbJTrjUCNYtA7IAvxgB5kQAboUQEgFACBB5AhaUIHgFvAgBXArgIAA=="} import { Hooks } from 'wagmi/tempo' const createPairSync = Hooks.dex.useCreatePairSync() // Call `mutate` in response to user action (e.g. button click, form submission) createPairSync.mutate({ base: '0x20c0000000000000000000000000000000000001', }) console.log('Base token:', createPairSync.data?.base) console.log('Quote token:', createPairSync.data?.quote) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `dex.createPair` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/dex.useCreatePair.md","from":8629,"to":9149} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const createPair = Hooks.dex.useCreatePair() const { data: receipt } = useWaitForTransactionReceipt({ hash: createPair.data }) // Call `mutate` in response to user action (e.g. button click, form submission) createPair.mutate({ base: '0x20c0000000000000000000000000000000000001', }) if (receipt) { const { args: { base, quote } } = Actions.dex.createPair.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `dex.createPair` Return Type](/tempo/actions/dex.createPair#return-type) ### mutate/mutateAsync See [Wagmi Action `dex.createPair` Parameters](/tempo/actions/dex.createPair#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`dex.createPair`](/tempo/actions/dex.createPair) --- --- url: /tempo/hooks/dex.useOrder.md --- # `dex.useOrder` Gets an order's details from the Stablecoin DEX orderbook. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.useOrder.md","from":131,"to":5440} // @twoslash-cache: {"v":1,"hash":"1815c3299836587ecb4ba2019dc58a529df6920eadae785fd12d0d622fd85358","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUWKQQOBwYAJScUKJiiJzAADpgnBmc7LCkAJJQSQBGjAqmaADcaZmczKL8ZEkABha0ACTAIqSmCq6NlemZhXz8ANIwGE0t7Z3dvf3VjHAAQowFnEMQcqJg85lojNb8SWAArsyFZLsZoswQJ2BoRSVlV5ykMLWm3U+lD69hMCIPxeVUyZnowL+oIyiwAYiYsEU+FsdtDOAAzBEAFQOR04p3OlzSrk4AB9OPdYOjTDAoP4oBBrAg9Fj8DBODJRCJOHATtZrPA4OiTjIZBg3vBNiQoHEEqIMexOMp2QBHE5kDAAOjSOrArPZnO5vP5guFovF7zgUtpsrECtISrZnDVGu1YF1+o5XK4xoFcCFIrFEqtMmltvl6MVyud6tIWt1aU9hp9fL9AfNwetMvidsjDujLrjbo9TuTPNTpsDFsloZtOYjUadha1/hE4l0ABZ1MZ5EoVIgOxpxNogvX/CYzEgAEw2OykBxOJAADncnhweEIJHIGkCeGsEDA3OyDWSaOPeTWxV+FTRtXqpEmbQ6aC6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AL8IArgrgQAA==="} import { Hooks } from 'wagmi/tempo' const { data: order } = Hooks.dex.useOrder({ orderId: 123n, }) console.log('Order details:', order) // @log: Order details: { amount: 100000000n, maker: '0x...', isBid: true, ... } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `dex.getOrder` Return Type](/tempo/actions/dex.getOrder#return-type) ## Parameters See [Wagmi Action `dex.getOrder` Parameters](/tempo/actions/dex.getOrder#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`dex.getOrder`](/tempo/actions/dex.getOrder) --- --- url: /tempo/hooks/dex.usePlace.md --- # `dex.usePlace` Places a limit order on the Stablecoin DEX orderbook. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.usePlace.md","from":126,"to":7655} // @twoslash-cache: {"v":1,"hash":"dc89ef7c90b6e3e69c1c36d86e7178af7ac3a72d19bcb225b4b1bdc2a7afa924","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUoiaicACUnABmAK5gjowQYJxY4nAwAKpgjGhwwURhcTCInCKkpgoUnLDWLGFwZWBxzABGZJFlbYwKpmgAOrms7FzppJk5eUZQENYIegCycTJojFgm8Jyi5WiVipykMFhHmWBiaymcEDHbnC3tZJxtGHd9JKl0bGbn17dtERgnAAjBZOMFQV8UvI0JEAHRDIYAWk4ABE5k1OPg0GgsE0APT4oiMGDMOF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qhFg1g2hw3I39or+3XzhOApcLcbcncXnXl1d0nTwdicnl2pX6466Xk8pY0Dim8/gV8ogSAoAgQ8gqrKQeA7IrgrgQAA=="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' import { Tick } from 'viem/tempo' const placeSync = Hooks.dex.usePlaceSync() // Call `mutate` in response to user action (e.g. button click, form submission) placeSync.mutate({ amount: parseUnits('100', 6), tick: Tick.fromPrice('0.99'), token: '0x20c0000000000000000000000000000000000001', type: 'buy', }) console.log('Order ID:', placeSync.data?.orderId) // @log: Order ID: 123n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `dex.place` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/dex.usePlace.md","from":7992,"to":8631} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { parseUnits } from 'viem' import { Tick } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const place = Hooks.dex.usePlace() const { data: receipt } = useWaitForTransactionReceipt({ hash: place.data }) // Call `mutate` in response to user action (e.g. button click, form submission) place.mutate({ amount: parseUnits('100', 6), tick: Tick.fromPrice('0.99'), token: '0x20c0000000000000000000000000000000000001', type: 'buy', }) if (receipt) { const { args: { orderId } } = Actions.dex.place.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `dex.place` Return Type](/tempo/actions/dex.place#return-type) ### mutate/mutateAsync See [Wagmi Action `dex.place` Parameters](/tempo/actions/dex.place#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`dex.place`](/tempo/actions/dex.place) --- --- url: /tempo/hooks/dex.usePlaceFlip.md --- # `dex.usePlaceFlip` Places a flip order that automatically flips to the opposite side when filled. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.usePlaceFlip.md","from":155,"to":8394} // @twoslash-cache: {"v":1,"hash":"0b032ce2f26b3ba60b7d704cf92957c90fd7feb051b6dc255273d25ecb860c75","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUoiaicACUnABmAK5gjowQYJxY4nAwAKpgjGhwwURhcTCInCKkpgoUnLDWLGFwZWBxzABGZJFlbYwKpmgAOrms7FzppJk5eUZQENYIegCycTJojFgm8Jyi5WiVipykMFhHmWBiaymcEDHbnC3tZJxtGHd9JKl0bGbn17dtERgnAAjBZOMFQV8UvI0JEAHRDIYAWk4ABE5k1OPg0GgsE0APT4oiMGDMOFwfD42bzfFxNYmNbwfHjSa5fL+MQKBbIZAgOiiVhyfwsNgcTjANIZbJsuCcVyxUgQZicADkxNJKsRYBZ0umwRVABYAEwWFU1SSRIaEzjGix2+0OsAgAC6zuEml0BvUxnkShUiFBGnE2iCOqm7NkpnMwJsdlIDicUncnhweEIJHIGkCTBGYoAKoxrPx/CJxLoAOzSH2KZRIA1BrQ6PAFov+ExmJBG2P2Rx+FzJ6heNO+TMBeh4awpERpGQOGAAMRMWAAyhhEmUDII4bBaHC4pkAAqz6wLperxJwgBKOjipDAea8AB4AMIpGK9GoJfiQADuYAAfCWHpIMCoGyL6tYBgAzA2IZ4Bsc6Lus57WG2UZ1t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b0gIpNXwMvsVQAb13PATkfwcJvAdLhLg0SQXiDsywMMkAL+B3gW1EMoL0HCJ0f0kLPrhxVwZzScWAA3SEu2JHb3MWemSWa/WWCEgWBHMHGE1HdUZgOWYoqE0/ZHWEtHUkfP2/Slngwr6RV/TiEqR2D+IrxIN2eGa0Z8LjW1HFN26y1IKmKcdy3qJ4G5VII03Q5t4BIOVIVGOuGoGj5ntoSWC1OGCBVv/5fzFOH2Erc5LHDrRAu0PHEuOeXZJcfZXE/ogkjuLuHuNOJ7h/0YxU0Q2eH2Qs3b1edeGmSAHAD7QXcG/stC8Arwj4J8c+M3xbr+0VQ4fP+EtAKRR88c+/Srhj2CgRVDeECfwJglEBIBQAgQeQMeRSCe8EArgVwEAA==="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' import { Tick } from 'viem/tempo' const placeFlipSync = Hooks.dex.usePlaceFlipSync() // Call `mutate` in response to user action (e.g. button click, form submission) placeFlipSync.mutate({ amount: parseUnits('100', 6), flipTick: Tick.fromPrice('1.01'), tick: Tick.fromPrice('0.99'), token: '0x20c0000000000000000000000000000000000001', type: 'buy', }) console.log('Flip order ID:', placeFlipSync.data?.orderId) // @log: Flip order ID: 456n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `dex.placeFlip` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/dex.usePlaceFlip.md","from":8735,"to":9430} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { parseUnits } from 'viem' import { Tick } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const placeFlip = Hooks.dex.usePlaceFlip() const { data: receipt } = useWaitForTransactionReceipt({ hash: placeFlip.data }) // Call `mutate` in response to user action (e.g. button click, form submission) placeFlip.mutate({ amount: parseUnits('100', 6), flipTick: Tick.fromPrice('1.01'), tick: Tick.fromPrice('0.99'), token: '0x20c0000000000000000000000000000000000001', type: 'buy', }) if (receipt) { const { args: { orderId } } = Actions.dex.placeFlip.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `dex.placeFlip` Return Type](/tempo/actions/dex.placeFlip#return-type) ### mutate/mutateAsync See [Wagmi Action `dex.placeFlip` Parameters](/tempo/actions/dex.placeFlip#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`dex.placeFlip`](/tempo/actions/dex.placeFlip) --- --- url: /tempo/hooks/dex.useSell.md --- # `dex.useSell` Sells a specific amount of tokens on the Stablecoin DEX orderbook. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.useSell.md","from":138,"to":7269} // @twoslash-cache: {"v":1,"hash":"ae5fe3560e82c82e12f7f413d98649d47715c71ac035ce263b44bcd061feddc4","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUoiaicACUnABmAK5gjowQYJxY4nAwAKpgjGhwwURhcTCInCKkpgoUnLDWLGFwZWBxzABGZJFlbYwKpmgAOrms7FzppJk5eUZQENYIegCycTJojFgm8Jyi5WiVipykMFhHmWBiaymcEDHbnC3tZJxtGHd9JKl0bGbn17dtERgnAAjBZOMFQV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q/SLQ/Q4w2qRlFqatJZKYypikMMtREFryKaYkG+kQBYPHPHHaK7QVgBAaOVl7S/BVrfMYC6f7YHYRs4FuKHUBh1r7f1fwuWEzNpO5FAgZDApdPYm4sFF4qgm7UgAaBeG7pNitik/gkU9YBk6tneBeJxCHm1ttrXrrowlHtEFAL6mUCogLGonqpIk1NonNF8vonM2gP6fKH4gkAElGFElXW9noPMlWsArmtsjCmaqcK3iQNtBM2IGNFqqCgE1qEMIcxEFwIalCmcxCfAJc6ijczsOqfcximAIAc896kc28ycyakWF83flcz6rcwC8yg88C080AUCOC+UJC583vLC7876nc0i0C4E+Lo0waCVpfIgFgl7nRL6t0+XsHcaLk9rsMxHnrt1tHrMxogszNEs8JCsxooPrEos7oqkJy5IsSzel6GXkk57gXngGKwwCXsBT084AaDkwM9XkMxHZHgbhVMK18twBEPgGUN9FHH5fpa4Pmps86jAIElXIK3oIaxSEZkTcUvq8JE7pS6oBNhS8CBBHK3oNNDoga0a3S6rsHaoI+FermLAF+I9gzqDCzhDJmU9DDHDKSGwIjOFgzuTmDLFsm+ztTTNZ00Nb+CzB5PFAZJzEjNaIOHWgctUsMXoTi3dJYSaU8CK+CNQQoHCM8CLFcOtLAfwDULqZi20DDNsgtEPJ03CK+hrPzFhtBu7ArqlubH7AHPzHNv1i7G7Izp7PqD7Ou9bPzD7jBpHInlbqnlezbonIHPjEXru+ezHNey+zlkaPnEXEW9aU9fqD2O67vHYBSIgH7DO382pPBXlKs3CEG7ywtE6/gJXSAMvKIEgKAIENVAtN7ggK4K4EAA="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' const sellSync = Hooks.dex.useSellSync() // Call `mutate` in response to user action (e.g. button click, form submission) sellSync.mutate({ amountIn: parseUnits('100', 6), minAmountOut: parseUnits('95', 6), tokenIn: '0x20c0000000000000000000000000000000000001', tokenOut: '0x20c0000000000000000000000000000000000002', }) console.log('Transaction hash:', sellSync.data?.receipt.transactionHash) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `dex.sell` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/dex.useSell.md","from":7605,"to":8123} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' import { useWaitForTransactionReceipt } from 'wagmi' const sell = Hooks.dex.useSell() const { data: receipt } = useWaitForTransactionReceipt({ hash: sell.data }) // Call `mutate` in response to user action (e.g. button click, form submission) sell.mutate({ amountIn: parseUnits('100', 6), minAmountOut: parseUnits('95', 6), tokenIn: '0x20c0000000000000000000000000000000000001', tokenOut: '0x20c0000000000000000000000000000000000002', }) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `dex.sell` Return Type](/tempo/actions/dex.sell#return-type) ### mutate/mutateAsync See [Wagmi Action `dex.sell` Parameters](/tempo/actions/dex.sell#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`dex.sell`](/tempo/actions/dex.sell) --- --- url: /tempo/hooks/dex.useSellQuote.md --- # `dex.useSellQuote` Gets the quote for selling a specific amount of tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.useSellQuote.md","from":132,"to":5744} // @twoslash-cache: {"v":1,"hash":"e032bbb5ac251a0290eacf6fd15a7b454e27c2398bf4e185fb4d8d10e5253e5b","data":"N4Igdg9gJgpgziAXAbVAF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EQmQNxVCNCdCQwDYEwXATW2wX2RalQiuG4/6x4Q+wW2wVhKcqchZgmO5YGfYbQIgeQFBKQsaVMwGLAlh4gVqYW7uMQwQokkQNOsWhpiuYAzEpmjOwkcQjmoFYuQ+KWoFok3O/QMQcIokHmaAXmW8wQ9405n0/x2wu2yOkox4smjBxsFBvKCupYsG+psWdOCWf0SWLYzO1mGWdm7O2WXOlFGFXm3mlF1FaAglSIwYUQ8IhupstRvRGkVimcqgPRexYeKoMl5wZQUeduNQKlsImJKe5xjaSsZQ6gWeGmoJdRyxLxWliAceWlopul/xZQllnARl/uJl9xcCWoBO5FPFgltFMWmyhpVpEF5mLFaWNmHFHOOWhylhvFPmAl7AiuQl8VpYIlWgiSossuQI8uSVe0fKnI6pvCpgg4/gRAFgcIwIZVdonpkKDqMko0Lq/otUgUviZuYZcqjUckMZ0SuKCZegvRIUSaJSXAhkmGxkjY6aegVkn4NkxE9k5CjkVEvMQsT4dqAqy0gicKJUwZwUMiQSUgbVSi/qbU3gnI/gpheALV1VYkIiIqQilgKqegFijC1qnCUAZQkgkgzEYKMqY8+1zgK0PCGksATA5S4oWcso8obyDsnxLsbsHsbAXsDyoNvy4N9sHy6ozA3ydRjyVEZQ/Vdsmcv0OcecUihcMAxcHc/iaARiyNDcdocerc7cpcUqNcqoS8Fg1goKnNXN3NPNI068U83c2qrNg87NvNYt4t9oRo68m8tJzxSlj1ViRwHC04VlNQ/VW8/g6CgkiAoAgQ6s3SkqCArgrgQAA==="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' const { data: quote } = Hooks.dex.useSellQuote({ amountIn: parseUnits('100', 6), tokenIn: '0x20c0000000000000000000000000000000000001', tokenOut: '0x20c0000000000000000000000000000000000002', }) console.log('Amount received:', quote) // @log: Amount received: 99700000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `dex.getSellQuote` Return Type](/tempo/actions/dex.getSellQuote#return-type) ## Parameters See [Wagmi Action `dex.getSellQuote` Parameters](/tempo/actions/dex.getSellQuote#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`dex.getSellQuote`](/tempo/actions/dex.getSellQuote) --- --- url: /tempo/hooks/dex.useTickLevel.md --- # `dex.useTickLevel` Gets the tick level information at a specific tick on the Stablecoin DEX orderbook. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.useTickLevel.md","from":160,"to":5909} // @twoslash-cache: {"v":1,"hash":"57b65b077fbeb672f0d0226a0c174adf10d17a4561575135f580ae6d087d726d","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHJwAKozW/P4i4roALOrG8koqiAka4tpBkdH+JmZIAIw2dqQOTlLunjh4hCTkGoF4ABRYpBA4HBgAlJxQomKInDl5/AAyMCQyAHQASjoArqRgAGqiMkswnAA+nEtgsABmpjBQ/lAQ1gh64fg7MqIinHBL1tbwcMdLMjIYnFI8AgMhIUAGQ1EnGO7E4yh2AEdtqQMLMADpgDEY+6PZ5cN4fL4/P4AoFwEFgiFiaGw+GcJFkVFYzFgHGcJ4vAmfODfX7/QHA0HnKlQmGkOEPenIpks7GSjn497c3kkgXkoXgwbUsUSxHS9Gy1nyvGvJVEvmkwWUrWi2mShko2axTS6ADs0hSimUSEy1GyOjwNoKZyQAGYyvZHH5EAAOGrULz1XxNAL0PDWCBgF5yGYjMZRSbTGBzRZoFbrTbbPYHI4w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xiApkoAdRlpBb+BECUq8xErJydl2r/grxOqSLrigJBBT6jkKLbhxh9pkTTmbxUTDlMpLgyB5gCQJSaSeTBTiTViHAnBnCNj4J3x3DGichmhdgWhqh9iaiQjpTDj6i1r/iqDrh9lqCur3WJSyAhgupdqcJ1quhTnbX+BjGLgSaY3pHXVPhWBBqth5Q/Xuy94uZRrFBgDD6iBNH5W82kJiAyATCMBIiSxNwYAjBEogpy3lSuCQKUxPXRgkT9wZiwBMAvacATTvjQzaLL5rQbS7J3TLKwQTQuwbKsznSXTXQVIQD3ThWAyQgjA/XQxwxKQqTTwA3Fjoy0wfwExEwkzWBy2h1h3h0R1h1UzyzoKGJYocqAq4r8z4ox3iySzSyywwDCyKzVEEllUuzs1L4/ViH+DcaiBICgCBDyBlqZgsIICuCuBAA==="} import { Hooks } from 'wagmi/tempo' import { Tick } from 'viem/tempo' const { data: level } = Hooks.dex.useTickLevel({ base: '0x20c0000000000000000000000000000000000001', tick: Tick.fromPrice('1.001'), isBid: true, }) console.log('Tick level:', level) // @log: Tick level: { head: 1n, tail: 5n, totalLiquidity: 1000000000n } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `dex.getTickLevel` Return Type](/tempo/actions/dex.getTickLevel#return-type) ## Parameters See [Wagmi Action `dex.getTickLevel` Parameters](/tempo/actions/dex.getTickLevel#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`dex.getTickLevel`](/tempo/actions/dex.getTickLevel) --- --- url: /tempo/hooks/dex.useWatchFlipOrderPlaced.md --- # `dex.useWatchFlipOrderPlaced` Watches for flip order placed events on the Stablecoin DEX. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.useWatchFlipOrderPlaced.md","from":147,"to":4937} // @twoslash-cache: {"v":1,"hash":"ec2db8af3c2ec972afbe7d0d286151f1c33da31056ce694679eda2d35e5d89ec","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXLC0UZq6ACyxSYrKSH0ZWjp47f4mZkhFILb2jn6IAGxV1F61vg0B9HgAZgCuYI6MEGCcB3AwAOqiaLYAYiZYAPKksKQACjIOMFAAPABhM57RgKAB8AAosPZmDoyHAAPyITjAAA6504WPmpgAklBkZwwAdmAAjMicAA+FzAsFBZigAG4MVisZkkSj0ZjWaz2B98YTSWDTFxqUKFCLkABdKlEg4yGSyo50/JMlk81nMUT8MiEgAGFloABJgCJSKYFK49bKDcbTWhzYordLZcSFUraTB6X9mdyNWgBPJ9YaTWaLVabSH7Y7LXqXdS3YrqcqvarfTzXB6VQz06y9qQIMwAEIyCDWfiC4VgUU07M+9VYs4AUVIBdIhMhkLIbZRLbbAEpOABecGcIgQRhQQfJz3eqBZ1M5hucNgKwkOg4wBdz7dp5erqYKXHVshEUQyQnEskUmd1+e3xf1v1anXtlG20MO8PWh9z3ONsAnkYV53jIb5fgJFFO3ZFEAHc7keZ43g+cDrD+AA6ABBLQ4AoThSwUOCEPwICQJQn40KgdCABkIAUQcRzHCcp13Jc/QDHUwGDO0wydH9a0fNU/WsEEwUJYEwFBBRWKfHl5FEUk5EgzhST4ORRHOX9VRkoTXH7FFx0nDEwFEOE4BhNCLiuW57hIpDQK+Ci/n8KAywQPQck4PZ2E4eDbItLznk4PkKSwJy4WrTgYBIas4G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luKYDSaNPnBkNlEgLlGzKYGhP4EQBYOhErDGRYBYAYWzIXMrALLQnzILJAkwnRDYZzPLG3IrErCgtUOgnwjrO4UPFTKPDbOPH6JPNPCpCfPPIvA1h+NGN+OvIGGAFvJ+DGFaHvHohqbPNWGfHABfFAFfNorfMuCNA/HKNeC/MuG/MBJ/LOU/GQP/JQroErLEMsGmWAhYVAjAo3OYHYa3Igh3KoK4KzCJLAM0OUrVHNA1F5AWIkm1Plp1D1DAH1D9HNAtHQEtNZKtHXFLJRNtOqLXB7A7H8FBOyC7D7MOKODtGdFyasi1DBBZu9JiJ9GAHpP4MPKIEgKAIEPIJYmcHgOVCAK4K4EAA==="} import { Hooks } from 'wagmi/tempo' Hooks.dex.useWatchFlipOrderPlaced({ onFlipOrderPlaced: (args, log) => { console.log('args:', args) }, }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `dex.watchFlipOrderPlaced` Parameters](/tempo/actions/dex.watchFlipOrderPlaced#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`dex.placeFlip`](/tempo/actions/dex.placeFlip) * [`dex.watchFlipOrderPlaced`](/tempo/actions/dex.watchFlipOrderPlaced) --- --- url: /tempo/hooks/dex.useWatchOrderCancelled.md --- # `dex.useWatchOrderCancelled` Watches for order cancelled events on the Stablecoin DEX. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.useWatchOrderCancelled.md","from":144,"to":4616} // @twoslash-cache: {"v":1,"hash":"ee48b5f79e7f2895e840942af571c220f1e3dff682b0163666b36294801e6325","data":"N4Igdg9gJgpgziAXAbVAFwJ4A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TkKSGzZlTRTKAOESacH5mDbJqTGqFVlQJ4qsgm85JgiRWVHe4v0B1hBdAVr9b2l1UjnTumXfRlckD+3DrXZw3RG7eGbgnIIYJKXQADDr7KNCOAIjGAPED4DAJcQaOpYBDiKsHaBaZ9cAiUeCM8CMVzAAal+gYnqBNG42PyoFIknjwDr2lQ5mUn3XyRonpX50HCmEyk4AAFkZQXJFIsxMhCQtVRYoISQYEMctQlxAV8BhVHJGA1ouBLFpFhUfUWBxBkEgCQCSNBZZRuNmo2twt/kEE9V9558RBBF4szh+4qxMxxEn4X4mJUl0lcM9gwRYg/Rg0Nktk60wB4g6ko0pgDgeknDC0QCY0nDYhItBQ9hpxYh01RkzMwQIV2DoQeJBYq0zVeC+EEkOY0l4sZBpwy0600AlFJ8Nkw0V8YBI0GlCCY0WljlTlE0LlrJUjQjxlUiMi7h6iTlSonksch04AOcQEZkrRltVBqcHcZcPwjg0BEQz150lxBirQlcPsVdEQJjhjOB1B7EKCOd1EBiujhir05ipiQ968r4hjERFi91v0tce9VJqoXUswUiXI0jGjsj1lQ0tkI1/I9lijY0yid8k1Llqjbkxk6ja0Gj/imikoqImJK0sxTBGiOJxJlYpIkAZIjpTBJx/AiALBpxfo0SLALAT8joz8/oo45Yrphhb8ggVwH9TpdYX8FZDZAZjYP945wZv8rZVpbYFw2QUpGInZEEXY3Y84FZYh/YfZ5ZyTS4ghg53pzAn8a59YZhVBXBDoPxYBmhSFdI/IDJdR9RoEzIiNLIbIYA7Jqo/IAo6AgpsIMYs4dxIpop1ZzT4oUYWQ8YyYgwQx7YCVVjFETIBwr1SpKoKBYJ8CQBrZRAkBQBAh5AD4zg8B1IQBXBXAgA==="} import { Hooks } from 'wagmi/tempo' Hooks.dex.useWatchOrderCancelled({ onOrderCancelled: (args, log) => { console.log('args:', args) }, }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `dex.watchOrderCancelled` Parameters](/tempo/actions/dex.watchOrderCancelled#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`dex.cancel`](/tempo/actions/dex.cancel) * [`dex.watchOrderCancelled`](/tempo/actions/dex.watchOrderCancelled) --- --- url: /tempo/hooks/dex.useWatchOrderFilled.md --- # `dex.useWatchOrderFilled` Watches for order filled events on the Stablecoin DEX. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.useWatchOrderFilled.md","from":138,"to":4756} // @twoslash-cache: {"v":1,"hash":"d6ebca7ccec7392508f050d98ee570f2e62a86cf7af165696dace79303079a4f","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXLC0UZq6ACyxSYrKSH0ZWjp47f4mZkhFILb2jn6IAGxV1F61vg0B9HgAZgCuYI6MEGCcB3AwAOqiaLYA8qSwpABijDJyUAA8AMJne0YCgAfAAKLD2Zg6MhwAD8iE4wAAOudOGj5qYAJJQeGcMAHZgAIzInAAPhcwLBAWYoABuFFotGZOEI5GoxmM9gvbG4wlA0xccl8hQC5AAXTJeIOn0lRyp+TpDI5jOYon4ZFxAAMLLQACTAESkUwKVyayXavUGtBGxSm8WS/Ey8lymDUmCK9mcVyStnKznPMg8hHCgWSkNgND28mOmSyymuhX0z0c1Xq0hanX6w3G03mzNWm0mzVRqVOinymlJv1osRpjOW7O2s3ki1Z6054sS6PS2PO+Nuj0c719iv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BqOhCPkg8nnG8mdjICxITFBk0ngeyiepQTAOegijQtekKiKvemKk+pcRsbKpcTcXcICcKt9MqrbrhnALHsYtSquK7qoAHtpvxjgkcGgAiEJlRtxMiRGN3lvoxnEiiQiOoAst4bHu0kiTCaiWJliWgDie4fJtSYSTriSYgQNEjEuoBBcftFccCXcWysepymemTLym8Sih8Ywd8WtL8W+qSgCZBkCXKSCZxEBplKBoBKYMCQdM1IfOvCgGgaYBFP4EQBYCxErCaRYBYJwZLNwcrErOkMAorGAqMBAn/HrOYBIZfNIcrAULIZsJPHbIobPDzAvD7EvH7CvO6IHOvFwfXF6ZvM3IrBIUIUEKfK6eIYPMbMPAUKoK4BLDgrAM0MEhNDkJVN6JONOOJn5itOtDAJtEjMWVdHQDdFcHjN/OGZ9OdN3HFF8AeMyMHBJFJLeC9KnpQk3tRGJrDKiPDGAL5P4HPKIEgKAIEPIAImcHgENCAK4K4EAA="} import { Hooks } from 'wagmi/tempo' Hooks.dex.useWatchOrderFilled({ onOrderFilled: (args, log) => { console.log('args:', args) }, }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `dex.watchOrderFilled` Parameters](/tempo/actions/dex.watchOrderFilled#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`dex.buy`](/tempo/actions/dex.buy) * [`dex.watchOrderFilled`](/tempo/actions/dex.watchOrderFilled) --- --- url: /tempo/hooks/dex.useWatchOrderPlaced.md --- # `dex.useWatchOrderPlaced` Watches for order placed events on the Stablecoin DEX. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.useWatchOrderPlaced.md","from":138,"to":4844} // @twoslash-cache: {"v":1,"hash":"3e7dca1cf113bef29341a671f24d7e6ec1d9eec74f78c78ceefe4f494ee9551f","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXLC0UZq6ACyxSYrKSH0ZWjp47f4mZkhFILb2jn6IAGxV1F61vg0B9HgAZgCuYI6MEGCcB3AwAOqiaLYA8qSwpAAKMg4wUAA8AMJne0YCgAfAAKLD2Zg6MhwAD8iE4wAAOudOGj5qYAJJQeGcMAHZgAIzInAAPhcwLBAWYoABuFFotGZOEI5GoxmM9gvbG4wlA0xccl8hQC5AAXTJeIOMhkkqOVPydIZHMZzFE/DIuIABhZaAASYAiUimBSuLWSnX6w1oY2KM3iyX4mVyykwalfenslVoATybW6g1Gk1mi0B62201ah3kp2y8nyt2Kz0c1wuhU05OMvakCDMABCMgg1n4vP5YEFFPTHuVaLOAFFSDnSLjQaCyE2EQ2mwBKTgAXmBnCIEEYUF78dd7qgacTGZrnDYMtxNoOMBnU/XSfni6mCkx5bIRFEMlx+KJJInVenl9n1a9ao1zYRlsDNuD5pvU8ztbATxe70+HEEVbZkEQAdzuR5njIADrC+AA6ABBLQ4AoThCwUcDIPwP8YI+OCoHggAZCAFF7AchxHMdNznL0fQ1MB/StIM7Q/StbyVL1rABIFcX+MBAQUGi7w5eRREJOQgM4Qk+DkURzk/RVhM41xuwRYdRxRMBRChOAITgi4rlue4cOgt58K+fwoCLBA9ByTg9nYTgIJMk1OC5EksAsqFy04GASHLOB3POZQ1wAETrAANeD/DEBRbOQZAQDoHSvNwKgtUytA4FoFEQlaRFwkMThU2zXNOAAcgghRmEYAB6GgWgqlEUUOY40FOc5EKwLBQV7Nk0Ry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zzg9xgB9yvgRhmhDxcLkmNzlhTwzxzzSQLxLy5krz8BrwEgbxbwgIxwFC7xRy0xyESFBCXypzmByGZx3w5yqCuAkzcSwDNDBKFRDQlQOQ5i2JVTea1QNQwBNS3RDQjR0BjRGSTTJwzRzRJyGwETATMi6wmz9iDhzQbQYnF4VSgQiYXSohXRgCqT+DlyiBICgCBDyCiJnB4DZQgCuCuBAA==="} import { Hooks } from 'wagmi/tempo' Hooks.dex.useWatchOrderPlaced({ onOrderPlaced: (args, log) => { console.log('args:', args) }, }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `dex.watchOrderPlaced` Parameters](/tempo/actions/dex.watchOrderPlaced#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`dex.place`](/tempo/actions/dex.place) * [`dex.watchOrderPlaced`](/tempo/actions/dex.watchOrderPlaced) --- --- url: /tempo/hooks/dex.useWithdraw.md --- # `dex.useWithdraw` Withdraws tokens from the Stablecoin DEX to your wallet. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/dex.useWithdraw.md","from":132,"to":6780} // @twoslash-cache: {"v":1,"hash":"1ba49397fce40202581f9380b2e1c849c02f8b39dbc63f623cec1edd321703c9","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUoiaicACUnABmAK5gjowQYJxY4nAwAKpgjGhwwURhcTCInCKkpgoUnLDWLGFwZWBxzABGZJFlbY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YeIdIckc4bCNPofDfCnsvqQHS2yzPTYdEEnqqtfANA/HfuwQauWz0DfT/pISnmUWkVkTOigakhgakT8XWpADcfkXCWcdgebrys4jfAQ30fg1PSCFAe8YfujCnpm2Q1UHm2sfqoq3JKat/o/ScdOgCakm4AiHwDKBRlDgrOjNcGTUQdNRgBcQzh8fQb0EKYpGU0krSUgYUSdH7ofE3EKrXkxOifGw6fCWaZUHiYPESaQ14jfEwR3VzFgEAlp3FFfllF83qiJmhlJnJlJDYCpg82WZCx8wJmVACw1EUq5hXoYT3JAhliChLgYUVmumtAnAkMWTyR/1MEhXBgT2iKeE6fBE1wUDhGeB1iuEelZ34BqGFrobaFJlmSujrnoWfh7AvQdnVhg3ODKEOYIxVC9gizfEiF9idgm0axDjDgsGsG6ypepftBjiJYTnOaSN9pVH8Y8cnjsApADoervp3pMf0jhFia4ThDybZZSFGdWvPR0FMcQFAECBqiunGwQFcFcCAA==="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' const withdrawSync = Hooks.dex.useWithdrawSync() // Call `mutate` in response to user action (e.g. button click, form submission) withdrawSync.mutate({ amount: parseUnits('100', 6), token: '0x20c0000000000000000000000000000000000001', }) console.log('Transaction hash:', withdrawSync.data?.receipt.transactionHash) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `dex.withdraw` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/dex.useWithdraw.md","from":7120,"to":7555} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' import { useWaitForTransactionReceipt } from 'wagmi' const withdraw = Hooks.dex.useWithdraw() const { data: receipt } = useWaitForTransactionReceipt({ hash: withdraw.data }) // Call `mutate` in response to user action (e.g. button click, form submission) withdraw.mutate({ amount: parseUnits('100', 6), token: '0x20c0000000000000000000000000000000000001', }) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `dex.withdraw` Return Type](/tempo/actions/dex.withdraw#return-type) ### mutate/mutateAsync See [Wagmi Action `dex.withdraw` Parameters](/tempo/actions/dex.withdraw#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`dex.withdraw`](/tempo/actions/dex.withdraw) --- --- url: /tempo/actions/dex.watchFlipOrderPlaced.md --- # `dex.watchFlipOrderPlaced` Watches for flip order placed events on the Stablecoin DEX. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.watchFlipOrderPlaced.md","from":147,"to":5292} // @twoslash-cache: {"v":1,"hash":"546bd06c6d922c9812fee931dd4652721a211f4c197b95a0862ff50f70b8b057","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qQDqW/YZYGhD/ACiJMcASnorpGAAKl6l5VKI6rK1yqoaLTp6eDWm22ankFisAGYBo5nKNGhNqM8DDM/NQAkxWOwuEZBMIXtp9AAOT4Kb4NGraNp4HEmLrgpBQkD2GEjPrwjyIqbI3xzNELAz5LGcW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IkrI2tAFEGvhsiVmVgAPypD3IYDhiJiBFxZPShAnSvq+FgAYDIAmRVicBuzuQ7YADUvQ64swFUvWuhVAHK3sh+dSr0X4hmFKUa0yoW3Q/ynAAAsmYgIB+OVjoEAk2MeCGg8gOJGOMp6OGJMtMueLkEkCWFwBGpiuEFOirCwJINkp4boCcpkjer1lAFMriDxoMTMQsp9GIFMtDkIIoqECsIuH4nLsonigSupgkEEBCBEOBnqmIRPGAOoCyrBt0CsEKjccRmVgoTcRCKDkPAkImBCE6lhnIOdkEMDK0A0d0rHDRjem0ZGkcdDnIImBRgxpsiIXqpBkajBmytkRajymgEhjaihvanCf8dhnCYiVsGSbiUNNlkxmAMJnAA3kUFfNFCgiXtoRJjEFfKkOZgpuGByccJQTPg7oyccKkFYXVr5mfuruyZfCKQNMKcqtPrkakHydfJwGKQZhKUZrSSHvAR+gOPikSRScibqrBGidBudKaliQhlashnanhESc6jKqSfRuSS6ZSaVORiuNRgOBYBSbiHeC0FwSgC+JHv2KUEQNYImL0FGdYNYHoWzOKBzOoJKCYaLLwngPwmCEqFYZXLjKMJzKQtMOQk4U3PtMWG3KVHZGPBuGQL3DfIPMcGAhPFPHvAvEvCcEfCfGPNvIoK2QfB2avOvGPN2DKaqbfPfGPM/K/P3O/AoPcmAgIH/AAkAiAmAgkHaJAkuTAiufAkFGwvDgjFKJgmYXgLglmVYDmQQjYZqCgoWdyBInyOYYgUCDWMVC7HEe7BOAmW8FzMYbnO8CeQYC+SCGXL0AjFeeqCQuDDELABiMzNxLFMIJRIDIJMJHhHpBAOxPGnVGistHxAJGhImFoVkJJAgcsMBUsgpDxPFLQIlAwkbAVHmBlAzFlBZEXCOIxeOCVI+BbFVB3JvB3uJqPqhPrHKVSSNP5ONPASpg7GBKQAli9HBGmEfLkBRfgL5KUAdOIEgKAAEIoHYkIHgEeCAK4K4EAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.dex.watchFlipOrderPlaced(config, { onFlipOrderPlaced(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.watchFlipOrderPlaced.md","from":5378,"to":5407} type ReturnType = () => void ``` Returns a function to unsubscribe from the event. ## Parameters ### onFlipOrderPlaced * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.watchFlipOrderPlaced.md","from":5531,"to":5991} declare function onFlipOrderPlaced(args: Args, log: Log): void type Args = { /** ID of the placed order */ orderId: bigint /** Address that placed the order */ maker: Address /** Address of the base token */ token: Address /** Amount of tokens in the order */ amount: bigint /** Whether this is a buy order */ isBid: boolean /** Price tick for the order */ tick: number /** Target tick to flip to when filled */ flipTick: number } ``` Callback to invoke when a flip order is placed. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.watchFlipOrderPlaced.md","from":6094,"to":6315} type Args = { /** Filter by order ID */ orderId?: bigint | bigint[] | null /** Filter by maker address */ maker?: Address | Address[] | null /** Filter by token address */ token?: Address | Address[] | null } ``` Filter parameters for the event subscription. ### maker (optional) * **Type:** `Address` Address of the maker to filter events. ### token (optional) * **Type:** `Address` Address of the token to filter events. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `(error: Error) => void` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Whether to use polling. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`dex.watchFlipOrderPlaced`](https://viem.sh/tempo/actions/dex.watchFlipOrderPlaced) --- --- url: /tempo/actions/dex.watchOrderCancelled.md --- # `dex.watchOrderCancelled` Watches for order cancelled events on the Stablecoin DEX. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.watchOrderCancelled.md","from":142,"to":5136} // @twoslash-cache: {"v":1,"hash":"1aec0eda0f46341180a0b333aee616ad8d50c79358e60da62345f78224a573d1","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qQDqW/YZYGhD/ACiJMcASnorpGAAKl6l5VKI6rK1yqoaLTp6eDWm22ankFisAGYBo5nKNGhNqM8DDM/NQAkxWOwuEZBMIXtp9AAOT4Kb4NGraNp4HEmLrgpBQkD2GEjPrwjyIqbI3xzNELAz5LGcWC0fEVGQ1Un1Bl/KkGEV0nqIRnM06sxAAJkqCMwXJ8s1KNH5IASa34uM4wPsAHlSLBSGlxGBeDA5AooAAeI5ZAB8QQ6yVS3uSFE4WEczD0ZDgqRpwgAdCL41b8Lb7Y7na73fGAAoRqOkOBe4pKH0RPYHfBHE7DC6KNA3NB3R5eXJgcSRuDhl2WytpsgZl1umBQUpQCC8BAGfYg+CcBLsTjse3RJ1DuRbC0wS5oOBLsCcVQwTgAETOAA144bxEop8hkCA6B2sApSgADD+73KCwrAaKkGAthgYMlFDfA0DQLBOFcedSAgZhOAAcgAAU2JRmEYAB6GIAMQ79MV/Q8YExaDYPgpDUJvDDsPYGBsIcCw4DwvICK4P84z3GCEjghCULQ6icLomhMWY3IljiEtOAAXn/QCaBAoJgFyThogY4RUmQYS2AeeA0EsNAAF0KGUw8hmEApd1SJSDxUzhNOIth40YKADNScD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orIm4w57Q25UhO4KFjhQNXBT4l4SRMCGgJ5JS8AZ5UYrBRSF4iCIR2RJh34DRyDq4pF5ZMAlZW524DTu5TTNRrAJ5L53guZAhlwyA24ZSmRH51RKhegSDuR3SVTFhgogRKx8obYhD7YUZgYE4tQL4LTfhr5uZMyQRZ5ehR5HT1RrBXAgYYhYAMR6Z2JIphBSJvpeJ+IsItIIBmIfw2IJlZouIeIkJ4x4CshRIZdyYQoUxwoOJopaBYo94dYD4UoaY0oTJs4Epc4oACpbwjYypG4bIVIYcv1Wo2V1wRxOpupCoijdSoAssVJ+pBoJdssLYgJSAhM7ooIUxKFcgKz7BPJSgtpxAkBQAAhFBCEhA8BdwQBXBXAgA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.dex.watchOrderCancelled(config, { onOrderCancelled(args, log) { console.log('Order cancelled:', args.orderId) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.watchOrderCancelled.md","from":5222,"to":5251} type ReturnType = () => void ``` Returns a function to unsubscribe from the event. ## Parameters ### onOrderCancelled * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.watchOrderCancelled.md","from":5374,"to":5506} declare function onOrderCancelled(args: Args, log: Log): void type Args = { /** ID of the cancelled order */ orderId: bigint } ``` Callback to invoke when an order is cancelled. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.watchOrderCancelled.md","from":5608,"to":5696} type Args = { /** Order ID to filter events */ orderId?: bigint | bigint[] | null } ``` Filter options for the event. ### orderId (optional) * **Type:** `bigint` Order ID to filter events. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.watchOrderCancelled.md","from":5940,"to":5985} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`dex.watchOrderCancelled`](https://viem.sh/tempo/actions/dex.watchOrderCancelled) --- --- url: /tempo/actions/dex.watchOrderFilled.md --- # `dex.watchOrderFilled` Watches for order filled events on the Stablecoin DEX. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.watchOrderFilled.md","from":136,"to":4993} // @twoslash-cache: {"v":1,"hash":"31f40edcd3e0cb0dd5299ece3d0406a3ef9a70aba1beaad5bca49c399a7dd538","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qQDqW/YZYGhD/ACiJMcASnorpGAAKl6l5VKI6rK1yqoaLTp6eDWm22ankFisAGYBo5nKNGhNqM8DDM/NQAkxWOwuEZBMIXtp9AAOT4Kb4NGraNp4HEmLrgpBQkD2GEjPrwjyIqbI3xzNELAz5LGcWC0fEVGQ1Un1Bl/KkGEV0nqIRnM06sxAAJkqCMwXJ8s1KNH5IASa34uM4wPsAHlSLBSAAxRhyBRQAA8RyyAD4gh1kqlPckKJwsI5mHoyHBUjThAA6EWxq34W32p0umBQWMABTDEdIcA9xSUXoiewO+COJ2GF0UaBuaDuj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o+OzldjEGsFwKJJzKLv/keqsccKkCBlesGLsWgLPjxvnqkMcakHAcksIbho4mblBJcf7scacfPhcTcnsZwNcbJgMjhosfePwomt2J0mMTMe0R8kBF0SWutACn0ZWqCjWpCshGMXCmcpMROtMRibMRlAOoJmRGOjMdOrvueAfhYF2KUEQNYLGL0NSdYNYEASHNXI0CSDTA0IvP8MvDlLAfAXDL0FvJMLvAaKgXnPNHmEXBlCPDaGPEHBXKYCAX0ISBqNTGSEgI3EvHgC3GCEqHAazCyHDBqNzEgbzHvHyNAdjL5EmGlAbIwcbFAFPBvBqOAayb8EDByYCH5CCEnL0BHO3OvDYK4O9DELABiMTAxEFMIHhI9GxBxMhMpBADRK+PRA0sNMxKxNBLGH/lkHxBzuaUCP5KJIxCFLQGFKPAnK6DFATHFLpPHJFHVOlGeGrLlIVLpLJJ9kenLP7nMS1C5O1GAEZjrN+KQLRidMBEmPArkHmSCE5KUAtOIEgKAAEIoOAkIHgOuCAK4K4EAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.dex.watchOrderFilled(config, { onOrderFilled(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.watchOrderFilled.md","from":5079,"to":5108} type ReturnType = () => void ``` Returns a function to unsubscribe from the event. ## Parameters ### onOrderFilled * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.watchOrderFilled.md","from":5228,"to":5537} declare function onOrderFilled(args: Args, log: Log): void type Args = { /** ID of the filled order */ orderId: bigint /** Address that placed the order */ maker: Address /** Amount of tokens filled */ amountFilled: bigint /** Whether the order was partially filled */ partialFill: boolean } ``` Callback to invoke when an order is filled. ### maker (optional) * **Type:** `Address` Address of the maker to filter events. ### orderId (optional) * **Type:** `bigint` Order ID to filter events. ### taker (optional) * **Type:** `Address` Address of the taker to filter events. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.watchOrderFilled.md","from":5965,"to":6010} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Whether to use polling. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`dex.watchOrderFilled`](https://viem.sh/tempo/actions/dex.watchOrderFilled) --- --- url: /tempo/actions/dex.watchOrderPlaced.md --- # `dex.watchOrderPlaced` Watches for order placed events on the Stablecoin DEX. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.watchOrderPlaced.md","from":138,"to":5195} // @twoslash-cache: {"v":1,"hash":"2279834665a0cfd3fb844984d371abd87f4fb79413544bf125a15d46b41d1004","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qQDqW/YZYGhD/ACiJMcASnorpGAAKl6l5VKI6rK1yqoaLTp6eDWm22ankFisAGYBo5nKNGhNqM8DDM/NQAkxWOwuEZBMIXtp9AAOT4Kb4NGraNp4HEmLrgpBQkD2GEjPrwjyIqbI3xzNELAz5LGcWC0fEVGQ1Un1Bl/KkGEV0nqIRnM06sxAAJk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VibgWrbhWqhjVKujBi1L1K7i5BJC5hcBrK/LhAuoiwsCSD+IaG6ATK+Jzr5ZQB1K4h4b5FVEtJXRiB1JXZCDMKhArCTiKJITGKmLcqcYJBBAQgRCXpCpkFtxgDqAYr3rdArBkpTGgYRYMFTEQgnYNwJCxgQhqo/pyCjZBAvStBxH5LexwZzopE2pAoPhXZyCxhQZIa9IkFCrXpip3pYqeEyoEpoAvoKpvrKq3G7G/q3EPFbCgk/HNS+YoZgCkZwBx5FAbyBRcxB7cFUYxAbypCSZMbBjonHAQFV5y4InHCpBSEJb6Yj5s5onrzEmNREnsqV7eGpC4mbycCklCbkkiYwlG635bqdjAqAnglPGCrASvG3obSSqfFPpyqvpKooSAnqoMogmIZgnKkQmZSQYziwadgWDgm4ihzAxYEoBXjm4dilBEDWCxi9CWnWDWB8FhzvyNAki0wNC4L/D4K5SSHSHwy9BkKTCUIGiKEFwLQ5glyZRlzjyzhVw1zby7wtxtwdwzx9wDwnALxLwtyTyKCJlzwpnDyjwtwtjUkskxnHCXwBxwBHzRmnwKA+ylkCA3x3wPxPwvxoJ9CEgag0xkhIC/x4J4AAJghKhSFswsjwwag8xyF8xUJ8jiH35AiljpRGw2GmwDj2n6CkLCHOm/DAxumAj+Qggpy9BRzALEI2CuAfQxCwAYgkyMTBTCD4RPTsScQoQqQQC0RvgMRfIjQsRsQwSxhcFZD8R37LCzkgiBRMShS0DhSILKypSxSEzxR6SJxRTpjyyH6VRRDFRySUnF7QSly0mQmtSuQdS35sZ6w/ikBOanQgRJgLy5DAX2DOSlCLTiBICgABCKCKJCB4AbggCuCuBAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.dex.watchOrderPlaced(config, { onOrderPlaced(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.watchOrderPlaced.md","from":5281,"to":5310} type ReturnType = () => void ``` Returns a function to unsubscribe from the event. ## Parameters ### onOrderPlaced * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.watchOrderPlaced.md","from":5430,"to":5823} declare function onOrderPlaced(args: Args, log: Log): void type Args = { /** ID of the placed order */ orderId: bigint /** Address that placed the order */ maker: Address /** Address of the base token */ token: Address /** Amount of tokens in the order */ amount: bigint /** Whether this is a buy order */ isBid: boolean /** Price tick for the order */ tick: number } ``` Callback to invoke when an order is placed. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.watchOrderPlaced.md","from":5922,"to":6143} type Args = { /** Filter by order ID */ orderId?: bigint | bigint[] | null /** Filter by maker address */ maker?: Address | Address[] | null /** Filter by token address */ token?: Address | Address[] | null } ``` Filter parameters for the watch subscription. ### maker (optional) * **Type:** `Address` Address of the maker to filter events. ### token (optional) * **Type:** `Address` Address of the token to filter events. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `(error: Error) => void` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`dex.watchOrderPlaced`](https://viem.sh/tempo/actions/dex.watchOrderPlaced) --- --- url: /tempo/actions/dex.withdraw.md --- # `dex.withdraw` Withdraws tokens from the Stablecoin DEX to your wallet. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/dex.withdraw.md","from":132,"to":5739} // @twoslash-cache: {"v":1,"hash":"023ba6e6ceee483261ba554408e01773012c9493ad2b5216c866b9cc71fec07f","data":"N4Igdg9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su2WRORr0NEFCGRE9jRk3EEPZv6ZlLkRsAlmNqGekBjLWZzIfnIFCODsDJOi2ZiMJidmJt2RdldmgDJrdvJmRtudOXRtuXuWgE+XCAGJEIMqYdzLji3MINwnPIQf+K4eUSkQWHPCUELlTlUKBScD8SIbkSUNBXVIBA6s6f0D+VriBSYgeA8ohbBfaQhVhSUMheHlBmhSfOqEtqtludSLuewBDmgAeYJkeUdiJqeehueSLNdhSTeQshcfebRo+XRcDC+W+QDr7sTMjE+UkPTKyFsszIjjuCyEQNYPvPvNaAyd8mSr2B6JSiBEpDSngL2jyUyjpHQsmD4uyqKQYHgVBLVEeNnHDM1LVNkveA1LDPbJAtXqSpONIBSsBDRBybIrZR+MZexJCjpBRKysKcwqZMEEimQCimAo1EkAABLhD4AlCcxbxsEYHKCuAwkgCyoGBpUkjVIHSvTQzJVCDeXz62K6UArUp0S0oOX2wlVqAMoJgmU0KySuAoIFiwBMCHK2yRRSgyj6wKji7GxkaJzWxDWiiZJnJjVOyXLpICyCLdDnITVQg0n+xXJ4GijBX7jSydygxcAjUDy0BDzxQkLJTjz+yTyZzOKmLHKMjaiKgLwPK9i1yZx0obzYrWC8CEpA3A02j/CHxgCuBNya4jopFuUQIOAkiIAPKHWfiVXuVnBtXWkgDfziBICgABBLRJB4DMiuCuBAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { config } from './config' const { receipt } = await Actions.dex.withdrawSync(config, { amount: parseUnits('100', 6), token: '0x20c0000000000000000000000000000000000001', }) console.log('Transaction hash:', receipt.transactionHash) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `dex.withdraw` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.withdraw.md","from":6081,"to":6418} import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' import { parseUnits } from 'viem' const hash = await Actions.dex.withdraw(config, { amount: parseUnits('100', 6), token: '0x20c0000000000000000000000000000000000001', }) const receipt = await waitForTransactionReceipt(config, { hash }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/dex.withdraw.md","from":6445,"to":6526} type ReturnType = { /** Transaction receipt */ receipt: TransactionReceipt } ``` ## Parameters ### amount * **Type:** `bigint` Amount of tokens to withdraw. ### token * **Type:** `Address` Address of the token to withdraw. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`dex.withdraw`](https://viem.sh/tempo/actions/dex.withdraw) --- --- url: /tempo/actions/faucet.fund.md --- # `faucet.fund` Funds an account with an initial amount of tokens on Tempo's testnet. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/faucet.fund.md","from":142,"to":4900} // @twoslash-cache: {"v":1,"hash":"2a334c0a8b0b464e60d225d6b8c383a129c837283be2bd8d4d6de2830fe35d4e","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinA5w+PCpCQCuYFAAdABKelukYABqoVu4otr66rK1yqpIzdStetPh66bdVgDMA0czlGjQm1C8018c2oASYrHYXCMgmEpXKUjGlXkdWeiBq2jaeCRJi6Fn+gKGwKQACZemDMFMDDM/DCFgZ8gjOAlxFteB8bhU+tYqVing1XviPgYuTy+WZSUgASB7ECRtTxh5wQyfLNSjRWSBtmB+MjOTsoAAeDKJZIAPiCHWSqStWQonCwjmYejIcFSwFynAD0QcFgAklAAPypMBbZgAIzInAAPpwzTAkpYoABuf2BpwxHZoVJ8fNgLjJ7hQKCkeBwbNgVwRVIABVIEGYjDgMHNROEe2lvLQfbNh2OpwuciuNtyYHEnrg7t5pt2pSgEF4CAMADEzXBOOIwHveCWuAB3RiqPcHiznxihPfMCAFzgQBKcTtcNAQADWiiCkVyQicAAKjA8IAOS7jQYiWIOuriEoG7IMgIB0LOWAKKUAAG2FoHAuTsoUwDRNW4g0M6ySuvgaBoFgnCuJyrbMJwYEAAInvB7YAPQxNWYH4fChGcDQ8J0QxbbMWxHGMNx7AwNxwbCHxeQCVwRE9ru9EJIxEnsUoXE8XJwlsEpuRLHExRKJwAC8xEwKRMDkUoQR+geQbiBYPqcMgRkQCB0F6AAuhQOZoEMwgFLhvo5gG3mg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ACEUEOyEHRIQFcFcCAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const hashes = await Actions.faucet.fund(config, { account: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef', }) console.log('Transaction hashes:', hashes) // @log: Transaction hashes: ['0x...', '0x...'] ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Synchronous Usage Use `fundSync` to wait for the transactions to be included on a block before returning: ```ts twoslash // {"path":"/vercel/path0/site/tempo/actions/faucet.fund.md","from":5091,"to":9795} // @twoslash-cache: {"v":1,"hash":"4cb3e4d43afd1edf434898c4fbf7dd960d22cef1a4ff558f529b06bca056f27f","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogvCZcpDC8MIxYaHCInABmAK5gUADKGGC8AHQASnqJpGAAauJyibii2voALACs8ooqaogAHFqSuoFhEVExlGYWVgBMdg6kTjTkiABs7p44eIQk5P70TKzsXEaCwv1ikvrTI2aNqhrtOnp42yb95pZIx/aOzlNDAMxz1F6LvivUAXWbA4CXEiQiDEqBw0thOyjOMwunTw8TBELug0eoxekyQ7wAjF9MAsDEs/AC1gYkpljGAEsk0hleAAeADCQnijCUAD4ABTBMCcpRxdmCrkUThYRzMPRkWKcYAAHTpnFVzwsAEkoAB+OJgRLMABGZE4AB9OAyYJzLFAANzK1WqpzBZJoOJ8F1gLjm7hQKBhOBwe0q1UCGUQRJoXWcfVGk3my3WmBQM0WlJWwZ25WuACUcQACqQIMxGHAYMybs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IsLohaMCJ0HvASHYDvlshWUFHGNpA9lxgwiQCwmRgsAiH6CIGsCyHxAOOsGsAb09mb2mHqExgRHeE70CFR170FmeCllxFaGH3plHwpBFmqkQl6HlGpEZCbEAmAjbHKC5mhFY2ODbwRBxm0EDhAB+OQgePDkHyGFqDeLWP6FazwHuLOKQHxGkEhNOGaFhGozwDyB6GQlCiolLxfWEQNGNCV04HxA+DAFXzX3Yj6hPlwVpPpLIDiGZPeFZM4DX3/FcGil7xxieIjiQGsDFLsDESBH0iokrBMgUm4g7RUmsnCkcgiOEFCFql+IanECai2CMhMGrDRDrH+OHB6jFCUD6nimDi9DiHfFGjWnmkWnWndOWgWlmg9L9I2i2gqnyJRwTXfHJLqliBpwRJiAqn6FenECQFAACEUF2yEDwD6FcFcCAA=="} import type { Config } from 'wagmi' export const config = {} as Config // ---cut--- import { Actions } from 'wagmi/tempo' const receipts = await Actions.faucet.fundSync(config, { account: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef', }) console.log('Receipts:', receipts) // @log: Receipts: [{ blockNumber: 123n, ... }, { blockNumber: 123n, ... }] ``` ## Return Type ### fund ```ts // {"path":"/vercel/path0/site/tempo/actions/faucet.fund.md","from":9832,"to":9866} type ReturnType = readonly Hash[] ``` Returns an array of transaction hashes for the funding transactions. ### fundSync ```ts // {"path":"/vercel/path0/site/tempo/actions/faucet.fund.md","from":9961,"to":10009} type ReturnType = readonly TransactionReceipt[] ``` Returns an array of transaction receipts after the transactions are confirmed. ## Parameters ### account * **Type:** `Account | Address` Account to fund with testnet tokens. ### timeout (fundSync only) * **Type:** `number` * **Default:** `10000` Timeout in milliseconds to wait for transaction confirmation. ## Viem * [`faucet.fund`](https://viem.sh/tempo/actions/faucet.fund) --- --- url: /tempo/hooks/faucet.useFund.md --- # `faucet.useFund` Hook for funding an account with testnet tokens on Tempo's testnet. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/faucet.useFund.md","from":142,"to":5793} // @twoslash-cache: {"v":1,"hash":"1a95b41c202f29f8ef89605e6082e91c25c3ea600cf822463485a078a7ff5484","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6INYQYCKcAGYArmBQiDx8ggB0EaJR1jpJUXAwAGIxUEkASjpRpGAAKl4APADCoRGMChScMfyQAO5gAHz+IuK6ACwAzLLySiqIgxri2kHRsf4mZkgATDZ2pA5OSABs7p44eIQk5BqBTKzsXAaCfZq6qlbG48pqM1o6eLdGy+brwU22z8iAAjMMDtQvMdfGcAvRLmwOJE0hkGMIHmpdmNFG9ENjqLMvnpUukvrJTP8NvZHCDQW4PFCjnoTn5zgiSTFHIxQq0cvlYnUGk0Wm1Oj0ABRYezMHRkOAAfniPxSqMy2TyBSSAAUZXLSHAhWBGs1WmB2hAut0AJTKxJwVVktBZflakpoMqVGr1Y0is0Wq0AHTAYFEsrg0oyfM1iyoUAg1gQelukXYkQKpgUnFEYGz1hCMS4HUYymzudMJcYohk2eYEELnAgEU4OS4aAE8glcGtwd5FRgVwA5HBODQRGZnf4xAok8hkCA6GGsHJ/AADddoOC0YMsJFcYAJQycVyRUgQZicQcdUQKZiMAD0NCHweDC25vIAglgsBLrZxgMGnCcCEYT7pwzBRGINAtIwcDavIUCZsenAALyHskpJoi6MZQL+L65pwpClOUnASoBQGcNUABGkHtmA5EUY2YC1CY1j8ChwC/qh3TgZBog0BKB4OAWYBoPEg4WLQsCiFAVEwDAERJEpg7HtargMRRiFwKIVFyFAHGwfBsSZupBFAd0GlAQKUCcB++b1qJGnVPeNFoHRFkET2YCmeuq4gAAuhQ87SlszD+CFYb6iOAC0nC6qFUVJAFQUgERHrlEYACyfFoDyuZEXAUQyJO/mBSA/QSPiowvLikwAOwfHMeAatZSyUms1JbLSzirPsjKYMyPinFOFx6CB4QLHE6EOph6qur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WceI1O8OpfOUDcDenCICUYYa0U7JDS7e8MJMAOqLDKTZYKICjTsgHf3PDTs4YffeXRSYYdTRjLyCUHeWYIMytLrAPL+PhADOs0/GQFIaHficdLEkTds67B0STaTRMe7BpR7JTF7e8Tc6c5jTc0HUgGHR8mHaKWYbsfTfCXHOAUIxpIlNCVQTw3XaowcK2eIYXSnFoK2f4x09osCzgdQYlV00IqVTI/nMC8XCVQsGCworC82BCtQ5Co+dcfCTbEOMDW8l83cls/c87UTI8ns08vDAjC8mkq8lTW8j7JjB8nctAKiojd8kHNMCHEOUwfivKHuQkPuFAJE0wDIfwIgCwJIUEZSiwCwVk8qTEN/DkrkpAaqD5XkwnAUlwIU7qJAPaMUmEYaSUvAc4yaO0QwR0LCFqN0JaZWGAVaP0MUS0Hoe4HaN/QYA6GqI6KYHk86WMYwdqEy26QFEEYYYFfqUFIaNkeEKU8Nb6WFU1XxeIAWd0T0UWM5EObGF2PGaxBVfFZVVtLgIxcBSBCpAqEVEgGyHxMQVMfODNbRMAOHYMSqmWaqgpTeOqlreARq9xFqvxR8mpIBUIbq9NEOKqlsAakxKuDBTHJqrK1qyahhYuGa/CHqwRBamqwa0xYatasa3xNqqazqySx5NYVQaqalEKk6AyoIca4y6QGK4UqYUUxKwaacfwHgvAIytku6j6x6vEZ4VvQOLYMIbYcOOwOAYOdo5ACSWgdUzC1G9G/yYy0EUEUy+6UUsqEIWAREa4f8aaZCCIM8C8K8G8O8R8AcNgQcIgrwyaMglUWaZ0Fy2IPCNNWnWoGbPeHKCzT9VatgMIMPDUDGOG3kCUZdBQAzVyOiYCVifgLyAWb5QSciJlfC1G6SWSeSCIfWuSBSY2w2s2021bA2hScXYMVwLyFCodECioGG7Sd+BGpGxATCgWcaryfwJLUQJAUAQIeQI1UIPATcEAVwVwIAA="} 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) // @log: Transaction hashes: ['0x...', '0x...'] ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Synchronous Usage Use `useFundSync` to wait for the transactions to be included on a block before returning: ```ts twoslash // {"path":"/vercel/path0/site/tempo/hooks/faucet.useFund.md","from":5985,"to":11758} // @twoslash-cache: {"v":1,"hash":"70c6e7579f56d5a55b4b8b81f596b6b59a686064ee970a2e241dca8d21b48c36","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6INYQYCKcAGYArmBQAMoYYNaIPHyCAHQRolHWOulRcDAAYjHxidbpAEo6UaRgACpeADwAwqERjAoUnDH8kADuYAB8/iLiugAsAMyy8koqiAAcGuLaQdGxCUn+JmZIAEw2dqQOTkgAbO6eOHiEJOQagUys7FwGgqOauqoTs4rKahWWh0eHeRl25kOwWOpz8iAAjAB2K7ULy3XwPAL0Z5sDiRbK5BjCL4XKzGOYAxDnIFrPBZHIg2SmSFHeyOOH7KYozA3PR3PyPbF6DaORihHqFEqbcqtdqdbq9AbDAAUWHszB0ZDgAH4UmDMgS8gViqUthUAArqzWkOCysAdLo9MB9CCDIYASj1aTgBoZaHyktN5SqNTqjRwdodCudSqGAB0wGBRBq4GrchKTdLtlQoBBrAg9O9IuxIqVTApOKIwJXrCEYlx+oxlJXq6Ym4xRDJK8wIPXOBAIpxClw0AJ5Mq4O6E+L6jAXgByOCcGgiMz+zjVNC1MLL/AwZcnMKnMXV0gwXKMLBoH3+MQKAvIZAgOjJrByfwAAy/19oCZYuK4YBUkMThXEiUgIGYTh536UQFGYRgAHoaAXB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v8FsLwGVzxoOAmEtOpUsAKr0GqAvCvAuNQDcR/S0iwzLlIM4HhE5DAEjLclAnDkFrzH4BFq1lIBSAlqmCls4CjNAiKl6oWn6qRgOnGhCFgBxFeCIlujYgiAgighgjggQmQjnDYHnGUIYvmvUP1Hun9EqqeiEhnX1xaH+wwT6jo1LVPHgDYDCE72NGqU+RnXmvSHpVMmkgtUsmslsnskcmcgiAzqchchzqzvzrzoh0zpck9wTFcFynEq/XYp5vST5sQGkvjrOtyn8HG1ECQFAECHkEzVCDwGvBAFcFcCAA="} 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) // @log: Receipts: [{ blockNumber: 123n, ... }, { blockNumber: 123n, ... }] ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `faucet.fund` Return Type](/tempo/actions/faucet.fund#return-type) ### mutate/mutateAsync See [Wagmi Action `faucet.fund` Parameters](/tempo/actions/faucet.fund#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`faucet.fund`](/tempo/actions/faucet.fund) --- --- url: /tempo/actions/fee.getUserToken.md --- # `fee.getUserToken` Gets the user's default fee token preference. [Learn more about fees](https://docs.tempo.xyz/protocol/fees) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/fee.getUserToken.md","from":185,"to":5517} // @twoslash-cache: {"v":1,"hash":"5479b50dafab06e9b134224ed428649f20a0a0eb27d506ae6e901fff4d3d8fab","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJ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gidajkQjQGjFgHIgQQRtgApuxzhZ4hoawnh8QpRtdehFpSQGhfglRAgDzNgVzNR1z2QEZJhvAJAlBSgi8lzEUryfoKEvFAYyQCi0Y8AAAxRjcsdSNyFWfeVIacOKBKXgVKTCrC7CnC3CvC1KLAgyVIawTSVwcoj4Nc7UGwVwWaGIWADED6IibyYQBCMiJCSrVCECcSCAPCK8QiOVCqUiciacM4dIrIBiG05YF8rgdidycQTyHgZinqGMLacsEKZ6KWSyNxSM2KWgdQSoNkKACENKNIXgRoRoCESoNIdKAnaQNkNKcQCEJ+InSoSoAAIV4GkBgHUDSmkDSgSGsCfhsyfifiylYRyhDIxTaOnFgvO0dCjIDGkpylKFanECQFAACEUA9iEDwHPBAFcFcCAA=="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const result = await Actions.fee.getUserToken(config, { account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', }) console.log('Fee token:', result) // @log: Fee token: { address: '0x20c0000000000000000000000000000000000000', id: 0n } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/fee.getUserToken.md","from":5603,"to":5727} type ReturnType = { /** Address of the fee token */ address: Address /** ID of the fee token */ id: bigint } | null ``` Returns `null` if the user has not set a default fee token. ## Parameters ### account * **Type:** `Address` Account address. ## Viem * [`fee.getUserToken`](https://viem.sh/tempo/actions/fee.getUserToken) --- --- url: /tempo/actions/fee.setUserToken.md --- # `fee.setUserToken` Sets the user's default fee token preference. [Learn more about fees](https://docs.tempo.xyz/protocol/fees) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/fee.setUserToken.md","from":185,"to":5268} // @twoslash-cache: {"v":1,"hash":"f0b0a406d4ab0b85a6a931aef7b66a18557d4e63a6f5cf4303ff3b1ade02ff54","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinKQwvDCMWGipACpDwsOCYABKaxtbpeVSiAAc/bXKqhotOnp4q+ubDPIWVgDMA0czlGNwm1C8018c2oASYrHYXCMR1MV300lkD3qz2orTeBiRJi6vyQAJA9iBIyQACZGmDMFMDDM/DCFgZ8gjOAkYLhRNp9L1rDUFI8GqTtG08FyeWZiYhSeShsCSZU6RDGVDSjRWSAEgBXMD8I6cOB6ACqJtIOwgAGtFABlDAGgA8GUSyQAfEEOslUq6shROFhHMw9GQ4KkCcIAHRSqMmtDmshW21gB0GqMABWDodIcBdxSU7oiqQzpAgzEYJqdwFynDrnF1FtSAANrLQACTAMSkCxKVzNgDctfraBtihbbc73d7/aHYHrKzOX12+zghyEp0+WznrnduTA4hDcCD62NZotyftjt4pSgEF4CAMdr0cE4qhgDYtAHJX7AEuJdTkLgpTfMcwCjXJcgAOQgGhdnwStOEQ8RjWvfAy0gRtOHXedVHELgAHdxEYNBXwSdg33wD80FXHDQNyAAjD8LF4ORdVgKBOCEbDOAYuR72tXiYHI1ZFzQXVSDyZQeNWY8TBgKNNXEJRH2QZAQDoQ8sAUUpmz00jcnZQpgGiVZ8JgP1kgDfA0DQLBOFcTky2YTgvwAASIpQKwAehiVYv0M+FjLfGB4Qcpzy1cjzlJ8vyYF8hwLDgAK8iCrgTMjV9HISZyos82L2Himh4RS3IljiAtOAAXlMmBzMspQghredokS4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QIMjQ6gNw0g1g4gDEvAf4CZSZKZaZGZWZOZwkeZyZqZ6ZmZ2ZuZiZ5ZhZVZJZCQd+GIuJHcT+osMQsAcIzsGUbMWUEULk56MUPSXUEAKURk6ULsyQ4UOUkUX4UYe+dspUmOywJkbJXAjkZ0F0iIfZt0CkysF4asBor0ds70I0YE30OcvAJcN5t5hcvQEMO0ZmixMi4uEZBp0ZDgsZqx65UY1pOEdpZmpQxM4gSAoAAQigp8QgeApEIArgrgQAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { receipt } = await Actions.fee.setUserTokenSync(config, { token: '0x20c0000000000000000000000000000000000001', }) console.log('Transaction hash:', receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `fee.setUserToken` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/fee.setUserToken.md","from":5614,"to":6020} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.fee.setUserToken(config, { token: '0x20c0000000000000000000000000000000000001', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args } = viem_Actions.fee.setUserToken.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/fee.setUserToken.md","from":6047,"to":6224} type ReturnType = { /** Address of the user */ user: Address /** Address of the token set */ token: Address /** Transaction receipt */ receipt: TransactionReceipt } ``` ## Parameters ### token * **Type:** `Address | bigint` Address or ID of the TIP-20 token to use for fees. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`fee.setUserToken`](https://viem.sh/tempo/actions/fee.setUserToken) --- --- url: /tempo/hooks/fee.useSetUserToken.md --- # `fee.useSetUserToken` Sets the user's default fee token preference. [Learn more about fees](https://docs.tempo.xyz/protocol/fees) ## Usage ::: code-group ```ts [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/fee.useSetUserToken.md","from":179,"to":390} import { Hooks } from 'wagmi/tempo' const setUserToken = Hooks.fee.useSetUserToken() // Call `mutate` in response to user action setUserToken.mutate({ token: '0x20c0000000000000000000000000000000000001', }) ``` ```ts [wagmi.config.ts] filename="wagmi.config.ts" // {"path":"/vercel/path0/site/tempo/hooks/fee.useSetUserToken.md","from":446,"to":758} // @noErrors import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `fee.setUserToken` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/fee.useSetUserToken.md","from":1050,"to":1564} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const setUserToken = Hooks.fee.useSetUserToken() const { data: receipt } = useWaitForTransactionReceipt({ hash: setUserToken.data }) // Call `mutate` in response to user action (e.g. button click, form submission) setUserToken.mutate({ token: '0x20c0000000000000000000000000000000000001', }) if (receipt) { const { args } = Actions.fee.setUserToken.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `fee.setUserToken` Return Type](/tempo/actions/fee.setUserToken#return-type) ### mutate/mutateAsync See [Wagmi Action `fee.setUserToken` Parameters](/tempo/actions/fee.setUserToken#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`fee.setUserToken`](/tempo/actions/fee.setUserToken) --- --- url: /tempo/hooks/fee.useUserToken.md --- # `fee.useUserToken` Gets the user's default fee token preference. [Learn more about fees](https://docs.tempo.xyz/protocol/fees) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/fee.useUserToken.md","from":184,"to":7694} // @twoslash-cache: {"v":1,"hash":"b8231de1b5901110cbc0e94b2094ed4e055d2895dce944b0b9737724513705ec","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIA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TDAWgXgX5iQX0y7H6UajgOMtzgjKWzIVaqXHSviXOCYXTKPGKtex4XjT+SEUt7EWCUmTyR6RZILw+UnK3CQhsgJgchkgpiUibBsX8gcV0uahgRMeyhwWscCW7RCXGAiWcckstgahuDkt2U4VKshDyVkD+yApQBJBf7fI+LaXxKcX0sSh6cNg4vfgPIcdWXOBihktSV6BiAKBUucw0vsfae7hihwVdJzjMsCd6DstU5KzaxJAWAmdrilhiUWfOB3F6y2iwADiFxFQbSCArQVS4I3b1RNQtRsBtQqMkGTSbBJAEUyT1frRsQcQaQwAkV7Q1zKxeJnQXRXSPhigahQDviqDYTWATgThgTYRPQG6SAaiqCiDviSIGhihigABC1gkgMAxskgqgzQFgkidWkikir0VMJu177ZWXis8gSlpMiA12vX3ohM3LVZr3Gh73nLn3uXv3glhMDyJu/gcCogSAoAgQ8g/8doeAOUIArgrgQAA=="} import { Hooks } from 'wagmi/tempo' const { data: userToken } = Hooks.fee.useUserToken({ account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', }) console.log('Fee token address:', userToken?.address) // @log: Fee token address: 0x20c0000000000000000000000000000000000000 console.log('Fee token ID:', userToken?.id) // @log: Fee token ID: 0n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `fee.getUserToken` Return Type](/tempo/actions/fee.getUserToken#return-type) ## Parameters See [Wagmi Action `fee.getUserToken` Parameters](/tempo/actions/fee.getUserToken#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`fee.getUserToken`](/tempo/actions/fee.getUserToken) --- --- url: /tempo/hooks/fee.useWatchSetUserToken.md --- # `fee.useWatchSetUserToken` Watches for user token set events on the Fee Manager. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/fee.useWatchSetUserToken.md","from":140,"to":4636} // @twoslash-cache: {"v":1,"hash":"f9462d4450dd5426fccf47a3f9f6bfcb416366af2a61b5019d81726cd9f71789","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXABmMLjCmroALLFJispIAxlaOngdXcb5SEUgtvaOfogAbFXUXrW+DQH0kwCuYI6MEGCcB3AwAOqiaLYAyjoAqlekACoC8gA8AMJnbUYCgAfAAKLD2Zg6MhwAD8iE4wAAOudOGjFqYAJJQeGcMAHZgAIzInAAPhcwLBAWYoABuFFotGZOEI5GoxmMy5kXEAAwstAAJMARKRTApXDyyZw+YLhWhRYoJcgALpS/EyGRSo5U/J0hkcxloL5gXn8oUisUSqUy83yy08lVqg4arWUmDUmB69mcVyunU0+netqkCDMABCMgg1n4uMJQNMXHJ2vdusDHLOAFFSCHSLjQaCyDmEVmcwBKTgAXmBnCIEEYUHLSbdHqgfpTAf1aLYGtx8oOMDbLcHqc7nG7JkUmLATiIohkuPxRJJTf9nuHHe9Z1eZE+/HkTzQedBzIRAHc7o8Xm9d/IAHQAQS0cAonEjCjPF/wB+3H2Nt4AMhACjllWNZ1g266emmjLWACQK4v8YCAgokFehy8iiIScg4gihJ8HIojnCu7ZrsRLaBq4pYIrW9YomAohQnAELWAOXK3PcX5Xjuxr+FAUYIHoOScG07CcOeHFihcbycEae7nFcXAwCQ05wLe/hiAoAnIMgIB0AxWByP4PLGWgcC0CiIStIi4SGD6wkhswnAAOTngozCMAA9DQLROSiKJtEcJxnJw95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kFSn1BNiZgPARByk0lplZkrGrF9gZT3gtychPFfUalagoDWlIJAE9lECQFAECHkE/jODwFMhAFcFcCAA"} import { Hooks } from 'wagmi/tempo' Hooks.fee.useWatchSetUserToken({ onUserTokenSet: (args, log) => { console.log('args:', args) }, }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `fee.watchSetUserToken` Parameters](/tempo/actions/fee.watchSetUserToken#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`fee.setUserToken`](/tempo/actions/fee.setUserToken) * [`fee.watchSetUserToken`](/tempo/actions/fee.watchSetUserToken) --- --- url: /tempo/actions/fee.watchSetUserToken.md --- # `fee.watchSetUserToken` Watches for user token set events on the Fee Manager. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/fee.watchSetUserToken.md","from":136,"to":5055} // @twoslash-cache: {"v":1,"hash":"466d1d7e9b6e662521a4dfa3841e61d192d4a41ddd5d17120f2190e4200b7515","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qUFRALwAfJxEEIxQpeVSiOqytcqqGi06enhrm9tq8hZWAMwDjmco0aE2oXmmvjm1ACTFY7C4RkEwku2n0AA47goHg0ato2nhES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sAGEYtEOkvSn6PYtkj6KoZyrkEkBmFwFkvwj4i6pzCwJIEIrQboNEk4WPg5lAE4kiFeo4d4h4rtAIHNGtO/KECsP2GgrBOQkamMhMqBgkEEL8BEE2mCp/jumAOoDsh2t0CsFcjkfOspocjkb8J1jJgkGGL8FimOnIGVEEC6q0IYZdDqhupmuYRaDkhouMv1nIBGNulsIEu/mCi2lCu2nsgct2vAL2pAQOuigMfUeOgMSuqQDumgOsZsW1KVISvereI+j0o5DEGsFwAJNvOrtnq+mBKcbOKkGhn+j6HcWgNvt7qTkUGcakHgWbFRjRhlDcS8UVM8V8rOG8fIakECZwD8XBnpuntVNIqWnpNeMsdsSMRkWMX+BMW2pNLCjMccnMX2iiosfBMsdii8mscMVsVSbsaLMuoOOutWBYGiWtG7EfLfigKeLzlWKUEQNYGGL0AKdYNYIge7CgeoN7D3IfP3CfAlLgfgSDL0PKDfFDKQWzHgEnONCnN4qLOnDpJnNnBYnXEXDUo3M3FXKOM2LXAXCaSXE3BXDZFvCgWiBHBgcPFgQYIPP9FYHgZHJSHTPKNvCqWqEyOqQYL9u8L2PmPxIWIIU6QqPKOgVKTcB6SAJGZ8GfA9AqXTNYK4DdDELALCFjDRO5MIFhCdExCxPBPJBABRGyslH0q1PRIxOBGGLAVkFxMccjE5NGK5LRJ5OUkrHGALM2IFKjMFCpEHGvJFHoCLEePLIlMlFXH4jcWnDHqVCpNZK3GVIFqrO+KQDxqOP+NGI3LkOmfYHsKUENOIEgKAAEIoGgkIHgHOCAK4K4EAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.fee.watchSetUserToken(config, { onUserTokenSet(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onUserTokenSet * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/fee.watchSetUserToken.md","from":5265,"to":5442} declare function onUserTokenSet(args: Args, log: Log): void type Args = { /** Address of the user */ user: Address /** Address of the new fee token */ token: Address } ``` Callback to invoke when a user token is set. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/fee.watchSetUserToken.md","from":5542,"to":5716} type Args = { /** Address of the user to filter by */ user?: Address | Address[] | null /** Address of the token to filter by */ token?: Address | Address[] | null } ``` Optional filters for the event. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/fee.watchSetUserToken.md","from":5888,"to":5933} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`fee.watchSetUserToken`](https://viem.sh/tempo/actions/fee.watchSetUserToken) --- --- url: /tempo/actions/nonce.getNonce.md --- # `nonce.getNonce` Gets the nonce for an account and nonce key. This is useful for managing multiple nonce lanes for parallel transaction submission. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/nonce.getNonce.md","from":206,"to":5008} // @twoslash-cache: {"v":1,"hash":"95821029487d78766a2dcd7ccfe1331d8bf3d401ae5c2d46c01fcfe2b5f0f262","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYp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8mwp+t0KmJwAALLzwCCbjao6CKh2goaPJ6LWjhCxhi6oEcq5BJABhcCvJ8JVqAwsCSCRy366BKITg6osZQAWQf4CyMHhBrw95iAWQVbwL8YFhnwsDjZXzhKDIsE4wJBBBPARDupTId55pgDqC5I6DFIWCKg1LaFJpYZFLaFPC+a7AJAuhPAuhRp6ZBB/KtBEEKqEpZo6o2iqxBIKHbhBZyAuhJx5poDiJt5TKepzILL6H+olJrIbIhrbIIT+H2EHLtL+FBEXgZHrKtCRBSwNq7hNrQ7LAKzw7nBY5z5c5vgKypA7r9pWgKxZ4O5FAQyXDmJIFoAroyKVHVHy4NGnoq457NE4ypCtGLqPoJKV4ywWpdiDLJFZGhGTL3gRHepRH5IxGrJlKT6ho7LJFRptLpG5qZGHHZE6DbRJxIJITZpZEFoLg14oCrj/Z0ggBEDWAui9BvHWDWCL69QMiiiXTaxDQCgb54Btrb7VwigSiH5SgrRkh/SLDB7ahbA7BGxL64i4j5w6wNDsj6xlzahgkgC75vR4i4iWwGASBKClBbYgmiKQh9S9a4gAmFy2DkiBA+wbCcCVC4hgCVy9DMmEnmwEg9QxCwBAgnQ4RWQmB4QESHrwR/h8QQAYTfKcAngpRSkwRvguiz5ZCURFGNbajw5mTiAWSYyqg2RJjVjagOT7ROTCSGxoAeReTqCclQBPDnBpC8CNCNBPCVBpDWDnBabSDoniBPCbBiiVCVAABCvA0gMA6g5w0g5wCQ1gmwRamwmwfkwk5coU4UukemnRra66b4bJiA8uPIempQRU4gSAoAAQig68QgeA+4IArgrgQAA"} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const nonce = await Actions.nonce.getNonce(config, { account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', nonceKey: 1n, }) console.log('Nonce:', nonce) // @log: Nonce: 42n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/nonce.getNonce.md","from":5094,"to":5119} type ReturnType = bigint ``` The current nonce value for the given account and nonce key. ## Parameters ### account * **Type:** `Address` Account address to get the nonce for. ### nonceKey * **Type:** `bigint` Nonce key (must be > 0, key 0 is reserved for protocol nonces). ## Viem * [`nonce.getNonce`](https://viem.sh/tempo/actions/nonce.getNonce) --- --- url: /tempo/hooks/nonce.useNonce.md --- # `nonce.useNonce` Hook for getting the nonce for an account and nonce key. This is useful for managing multiple nonce lanes for parallel transaction submission. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/nonce.useNonce.md","from":217,"to":5019} // @twoslash-cache: {"v":1,"hash":"0f0dff491f1f51aaa648ec0523093330756da7886231a68a5880eae563132b80","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUWKQQOBwYAJScUKJiiJwARowKplwAPpwArmCwAGamMFD+UBDWCHoAKvgwnDKiIpxwOdbW8HAFOTIyGJyk8BAyJFBxCaKcBeycyvUAjjlkGAB0ADpgGxu19Y3Nre2d3b39g3DDo+NiUzNznIvL65vPOw1NXAcdcF09fQNDIxKV0m01Iszq9yWpFWWxeEL2HzaXx+J3+50BY3i11B4IWUJhz228PeLSRR1+pwBlyxINuEIe0JW/hE4l0ABZ1MZ5EoVIg2RpxNogjT/CYzEgAEw2OykBxOJAADncnhweEIJHIGkCeGsEDAzUgYA6SVS6TAWVy+RgRTMpSo5UqeFeCNJh2+xz+ZwuQJpNzBdwZq2Zml0qgAjLJuco1AKtDo8IaOqLipLpfZHH5EGG2crqF41b5NQF6ExWO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HPDXQhSq2CDuGcNcLsTTUMlRy8OaWKPcgWxkBWCvQSGyUgOxRqPHTrkJUIRnTJQpQXSpWXQWMGKhQWOWLQHONJkFDflLlhH/TgBd0UUrkR1UHNyExI2ikTjQCSEo2g3Ai+NvxZxQyQUmk4HUHTzMIIw13eMj0+MrkQFowBIHzv0TxBPNCSHBNw340z1/wl2eGbTbXmLfEWPONWKxWHRxU2MaJeR2I+T2JwMOJSmOPpUhTOPYGvQuPZISCuK0DfjUnPXqEvS5OSPrg7jsiQAcmFlMAUhACIAsBWDDAVIsAsBIIbk/lrGkEbCln6xljoOA0YLAUHCVHYM1jvCnGLCCDh3nmBggjNFXitBtBKE3iIWJH2DJHdApDRG9ExAmDUgDHxFFLIKQDDAVG/ijG3F1MAQVlkBTDFkNMzAlBHhNNvDEAUH8HJzwH1LVPIMkCsC1ObDzMnjwCBiSDZAlDABAU1OYKHiQCvCFl1FgFLFsUCm6kEHagKEijowSiSlShgHShX0qhbJpCSAsnCi6jQgwnllwiGiWm7nRJihmjXDLKgHPFUEAmsFrFrHPDZEAgsFUDK0kAlFUFEHPGSAVDZDZAACFrBJAYA1xVBJBVACgLBkg71khkgFologEMANotoUYqsXc0kPiSzaMlwqt/AYlRAkBQBAh5AmE9Q8BvIQBXBXAgA==="} import { Hooks } from 'wagmi/tempo' const { data: nonce } = Hooks.nonce.useNonce({ account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', nonceKey: 1n, }) console.log('Nonce:', nonce) // @log: Nonce: 42n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `nonce.getNonce` Return Type](/tempo/actions/nonce.getNonce#return-type) ## Parameters See [Wagmi Action `nonce.getNonce` Parameters](/tempo/actions/nonce.getNonce#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`nonce.getNonce`](/tempo/actions/nonce.getNonce) --- --- url: /tempo/hooks/nonce.useWatchNonceIncremented.md --- # `nonce.useWatchNonceIncremented` Hook for watching nonce incremented events. This event is emitted whenever a transaction is executed using a specific nonce key. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/nonce.useWatchNonceIncremented.md","from":219,"to":4913} // @twoslash-cache: {"v":1,"hash":"3c41f7db5af5a58ed8f5640547d78b93c2c5a437602369ef24ea876941670c37","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXJBg1rjCmroALLFJispqGpk6eO2d/iZmSEUgtvaOfogAbFXUXrW+DQH0eABmAK4daIwQYJxHcDAA6qJotgByF50Akh2kMMzyNFAAPABhC4HRgKAB8AAosPYfk44AB+RCcYAAHUunExi1MbygSM4YCOzAARmROAAfK5gWCgsxQADc6MxmMyiORaIxzOZDmsEBOaHxAAMLLQACTAESkUwKVyCimcYViiVoKWKWXIAC68sJMhk8pONPyDKZXOZkxgAGkYBh8cSwaYuJS7QoHZrtUddfrqTBaTBjZzOK4vYa6YyAwdSBBmAAhGQQaz8W32sCOqkhv1hrkXACipEjpHxkMhZHzyNz+YAlJwALzgzhECCMKBVykGn1G4Pt0MmzFsXX4lVHGCd31QEdGzPMvszBQfJxEUQyfGEklk1ve0fj7sBi4vDowD7WL4/FN+wuQ1nIgDuD2erwPn2+vz9ADoAIJaOAUThxhTX2/4Hu7yPiefwvgAMhAChVrW9a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xVH9d484jVd4r4tAOEkKYGPVSGCmH3BnHRfkZnVQGPFfAfQaJeFMZEKTJjb8AkjlZAqfMk5EdQfZGIzPThPEqkuTMkifC/TjDEwkzgGkwTfTBfCmSGbdYcN4s4D4uEn4oVP4u9cVQEx9YE2VIlMEhVb9CaKEgDRlWE9gZDeEzUh4REz8GDBSeDYcRDHUjowyUYEyJAMyAWDSPhIgCwF8XWR0iwCwcQgWCuPWAoeQzBCWHuTQXBYwKCFQ4WLWH+HWfWbQyhEBc2fQqebmWeT8dkZCHkPkTk1eZUVUGUQUI+Hea0c+B0HMk+M+UJA+K+FBXQXWXoKwMWR+VQnBRQ9+TucwNQ4hHWAoVQVwfmXkWAZoFJLqLaXqCMKMeTMLMaSab4NgGaT/LaF8HaBWd2eBUuP4M6E0VuI6Jcv0ZEW6Eye6MOGsOseeQvBk8TS8OTYGcGCgUmYIkAOEUQJAUAQIeQcqC4PAFqEAVwVwIAA=="} import { Hooks } from 'wagmi/tempo' Hooks.nonce.useWatchNonceIncremented({ onNonceIncremented: (args, log) => { console.log('args:', args) }, }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `nonce.watchNonceIncremented` Parameters](/tempo/actions/nonce.watchNonceIncremented#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`nonce.getNonce`](/tempo/actions/nonce.getNonce) * [`nonce.watchNonceIncremented`](/tempo/actions/nonce.watchNonceIncremented) --- --- url: /tempo/actions/nonce.watchNonceIncremented.md --- # `nonce.watchNonceIncremented` Watches for nonce incremented events. This event is emitted whenever a transaction is executed using a specific nonce key. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/nonce.watchNonceIncremented.md","from":211,"to":5256} // @twoslash-cache: {"v":1,"hash":"d6c088363c7a29ffdad7dc923554c75831017d0aa12ea1177d8bb4c8f55ce3f0","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qUFRALwAfJxEEIxQpeVSiOqytcqqGi06enhrm9tq8hZWAMwDjmco0aE2oXmmvjm1ACTFY7C4RkEwku2n0AA47goHg0ato2nhESYuj8kP8QPZASM+iCPGCpgYZn5oQsDPl4ZxIGBeLhRKiZDUsfUkABWZ74gyc7nEnqIMkUoZApAAJkqoMw9J8s1KNBZIASa34SM4H3sADkhNyAJJc0gwZiKGhQAA8GUSyUOQQ6yVSrqyFE4WEc9pGcFShOEADpJTAIyb8OauTBrbxbfawI6IwAFIN6MhwF3FJSHCK7A7HU7nXJgcT2uCB7nGrZmi1Jm12h0wC5UKAQXgIAwAdSb+HgnAS7A5Lc4FhT7fTnc4MBI6bgEe14iU/eQyBAsCwtt4W07pQAKvhGHAxwbjGBOA5LwAjGCKTh7g9HqABiBiAC03DkChKKQEAALLQGQWwQBGnCWlw6yMABnBPpwqa+J+FicOIV5oCstonHmSJrgAuhQO50DWWAKKUAAGtFoHAuRsoUwDRLaR6+sk/r4GgaBYJwrhjsBzCcAA5AAApsSjMIwAD0MS2iJjFwsxnA0HC/GCRAwniZJ0lyewMByQ4FhwIpeTKVwLHhpeAkJEJokSRuenyYZalsGZuRLHEhacPsrEwOxhZBMAuScNExnCKkyBuRAJGhapQzCAU9GpCFt5hZw0V2mwEbnERqTcbxew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YS8CCmbw7x7wPKHzHzPwNbRjXy3xIRfxPznxvwfwVkmLfzlREIyHSCgJBlICgJUIQJ+xqEjz8xazMIJl2ziwqHLDvDDili+Tlg+FNnKi/DyHYiKGdlvB1SfBQJUy9nmyCxkwxCwCwgqxWRNTCAaR4zaS6SyQxRmRMSWSAovS2T2QiQRiiFZAeRYmjkrkDJ+TWQtSJhtSBw4J1w9TPT9TxQ9ydS4IhwhARx1pJwLTnwi4KYLwj7HSlQlTnQnSdbxxHikClYOJ8RxiHy5BjmfB7ClDBjiBICgABCKC6JCB4D0QgCuCuBAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.nonce.watchNonceIncremented(config, { onNonceIncremented(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onNonceIncremented * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/nonce.watchNonceIncremented.md","from":5470,"to":5721} declare function onNonceIncremented(args: Args, log: Log): void type Args = { /** Address of the account */ account: Address /** Nonce key that was incremented */ nonceKey: bigint /** New nonce value after increment */ newNonce: bigint } ``` Callback to invoke when a nonce is incremented. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/nonce.watchNonceIncremented.md","from":5824,"to":5994} type Args = { /** Address of the account to filter by */ account?: Address | Address[] | null /** Nonce key to filter by */ nonceKey?: bigint | bigint[] | null } ``` Optional filters for the event. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/nonce.watchNonceIncremented.md","from":6166,"to":6211} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`nonce.watchNonceIncremented`](https://viem.sh/tempo/actions/nonce.watchNonceIncremented) --- --- url: /tempo/actions/policy.create.md --- # `policy.create` Creates a new transfer policy for token access control. [Learn more about transfer policies](https://docs.tempo.xyz/protocol/tip403/overview) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/policy.create.md","from":216,"to":5539} // @twoslash-cache: {"v":1,"hash":"e0c93d427169d0944a1d8b51a79fe35242cf5f9a3229dd7529118fcdd9ec4d11","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinGzmvBgAklCpAEbJFgyi2voAHP21yqpIJy06enirjOtbXRZWAMwDjs6jJxPUXmmvjm1ACi1iKwgawwABUvKkwABXZg7PxlY4yc4KS4NXq2aite4GR7rOFTeRvJCfED2b4jPp/DwAqYGGZomgLAxLLikGC8GCMLBoVIwobCYaCMAAJT5AqFpXKUkQeOp2PqGlubTwvP5gsOZkpiGptKGPyp1n+mBZPlmpQ5gXy7C4RklpkV+l6ACYsXUrogatotQYXSZXj0jV9TfTEJVGZNvGyQfamKwnZDoQqMcrPbILuqmpqiSASRgwx9I8MXIgAKyNS2A1nAu1ggwJRFgfiS6K88Q0ADKGA7AB4MolkgA+IIdZKpUdZCgrRzMPRkOCpEPCAB0Jc3vB7/cHvE3AAUlyvSHAR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VgCEggh3g3kzDvULDZMwB1B5UdBVULBEQ9U4ShM8i6M4T3h2MDgEhNx3g40LUQcggNNWhliutJBINODNjXwkVOVYIKc5BNwZNewAVoTupyN/VA0kTaN6MYYmNI1WMjUmSiSrUmTWS0BJS9ZWhIhM09NaoDMstlgYh2xWZOBqwB9ssgtVSQ5UhQtbMFxdS0BCCgCY8ig1TUhqxH8Msm8nkdT7U9Tf9jTTTpDUhjSrSbTU0oDNDYI6Z0NeIuVRTJT2SvVOSLDuTqNeSQ01UBSPCo02NRSuNLUJT2BZMpS0zewZSdBIh+pesHpApJT5NtCSoypMkGVSgiBrBNxegazrBrAAijh653hE544GhqQ25AgXlojYie5M44xmQh4TFkwuQIQSwthdh9gQ4FEqRPQdE1Q/QdFOyHg+ZngoAezOF9E6wkjrQJAlBSgLc8BuymylR3h3h5zm4Ej+EDBjxVy2kNhPdUhegwBojjQ+zowLRI4YhYAUxq5MYuZZdLp1obopZtojVIYIBjpGozp3osg1prohphpNwfCPoXplSYLxyH8lIyRX1spGIuA+o2YOZnRuZeZoQBZ+IDwOwRYPoxYwJmEF54BwYwIvxho15KgN4t4d494D4j4T4z4L4r4b575H5n5X535P4f4dgFYWKRpQFwFIF1BoFYF4EoBEFkFUF0FMFsFcF8FCFiETgZLgZEZkZJYpFZZN0jKlY68XcgtbzoQCNHzf9MKQdSgF1xAkBQAAhFBMkhA8BHIQBXBXAgA"} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { policyId, policyType, receipt } = await Actions.policy.createSync(config, { addresses: [ '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', ], type: 'whitelist', }) console.log('Policy ID:', policyId) // @log: Policy ID: 1n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `policy.create` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.create.md","from":5882,"to":6382} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.policy.create(config, { addresses: [ '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', ], type: 'whitelist', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args: { policyId } } = viem_Actions.policy.create.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.create.md","from":6409,"to":6683} type ReturnType = { /** ID of the created policy */ policyId: bigint /** Type of the policy (0 = whitelist, 1 = blacklist) */ policyType: number /** Transaction receipt */ receipt: TransactionReceipt /** Address that created the policy */ updater: Address } ``` ## Parameters ### type * **Type:** `'whitelist' | 'blacklist'` Type of policy to create. A `whitelist` policy only allows listed addresses, while a `blacklist` policy allows all except listed addresses. ### addresses (optional) * **Type:** `Address[]` Optional array of addresses to initialize the policy with. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`policy.create`](https://viem.sh/tempo/actions/policy.create) --- --- url: /tempo/actions/policy.getData.md --- # `policy.getData` Gets the data for a transfer policy, including its type and admin address. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/policy.getData.md","from":150,"to":7000} // @twoslash-cache: {"v":1,"hash":"7be8148a546f6e73e327ea871b234bea4c43f38a349d04fbe07fd29b5c985e9a","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinOJQzBapAAbWtAAkwGKkFkqum6VQELwIBtxrFitQUKTwcAB0peVSiAAc/bXKqiQAFYWjo9HhVuswF0LFYAMwDRzOUbfCbULzTXxzagBRaxTiYHCpAAKEHMvAwABUMVQLlc8KTyRgCV53qJtPpvt95HVAYhKqC2nhCbh5LCkAiQPYkSM+kC0SLMbNSjQFgZ8uwuEZBMIPhy+tZJQoAQ0atohTd+DrTN14YihsiJdYFRiDDM/Di1SANYU2Ey9RU+r0/sb6khmtRWuCDH7GBSYT1EJLpQ7ZUnUR50VM3ViVbiDAkAK5gK1CThtAAi4gkAB4MolkgA+IIdZKpetZCicLCOZh6MhwVLakyvWMU16V6viV7E3v90hwOvFJSNiIk0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9ZPmgWkGDZUwjZAW4YkIt6dcd7/4AwvgtMC9Z6bBLiDB4XYIIWuJUMaBzAxAy8Hn/moZnR3oYhYAmBOkJIeBGooJGJDJWJi1FIzJApNIiIBXFoDI5I2JXg08sgbILLiJz7k0vAZJnJxA6oGoh83gno2o0BAJxBOpMZuprxtZUhehRpchSpga1as06XmRIQNgki3WwBxoBm4iXXEWbqkiRRxpSh9pxAkBQAAhFB44hBhQEBXBXAgA=="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { admin, type } = await Actions.policy.getData(config, { policyId: 1n, }) console.log('Policy admin:', admin) // @log: Policy admin: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb console.log('Policy type:', type) // @log: Policy type: whitelist ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.getData.md","from":7086,"to":7205} type ReturnType = { /** Address of the policy admin */ admin: Address /** Type of policy */ type: PolicyType } ``` ## Parameters ### policyId * **Type:** `bigint` ID of the policy to query. ## Viem * [`policy.getData`](https://viem.sh/tempo/actions/policy.getData) --- --- url: /tempo/actions/policy.isAuthorized.md --- # `policy.isAuthorized` Checks if an address is authorized by a transfer policy. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/policy.isAuthorized.md","from":137,"to":4988} // @twoslash-cache: {"v":1,"hash":"d89a8bdb355ed397122134203ceb623b3e34be73a444f2615bf50197c0945485","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg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bBfWTr9VOeAggvugFEbnpbd/ZKgwAflSLIr0pUwm7zRKEMa3YO2yOQDpTMnAiAQC7iJgA1L0AFsxKESMx8XYBYDB48kNHxB00BG4dksEL1uglFOAABZVuAQe8EVHQdYX0DdaIdZAcPsSWfYL0WAo5XIJIZMLgURYhI5duFgSQQ8CDKDdhThUVUWKAUKO/X5Kg8IWDRvMQUKZzIQfOVseAWDFgDrBeRxZxYDBIIIQECII1JpWvGNMAdQMJC1bodYVJFQ/1KDaJFQwEWzJ2BIYMQEMZN1OQSqIINaVoLAzlHuaFVgggrZJDJxZzOQYMKNGNNAGhavJpE1Npc1CJKJa1PpPvQZR1VCdw8w91dwrwv8eI21VoSIWZT7R8b7JrGIY0f7TgdUaHEfI/WCLIyBVIadOtL0YotAQ3OPJnVISo1IE6JDKA49chQo+ogXSo6ojbDdOo0pEo3I87ZovPR8F+JVAcNwgQDwxI3wxpUCAIs1YsTpEI2JMIgZB1YZaI8ZfJOI9gbwxItqZI4NdgJuSiMxRIuNAvS8a8PuE0XAKgIgawYMXoJ4nEcff2SfJ4VWCUBoSkcOG6UtJffWNfEUDfGELfdkTGUGQcHaa0I4E4M4C4CffQJJS6NWWfafdGCOW6SsXcB6MwJ6RAZfPGA2QEawUEgwCQJQUoabPAAEpEukdUNGNEyUXECmPAClfyYcfYVIdRNsXWbEIEt6Mk/aGIWAREGGZicKYQViYiBdMiVCVSeiD8JiKxVqCCNiGCWCYMYfLIASH7KEu6LkzhIKEKMKTLYsVKCsIcXEqABKcGJKAyRmQqYqdQD6KADUNIXgRoRoQESoNIawdUaTaQJ4dUcQQEQ4EUSoSoAAIV4GkBgHUHVGkHVASGsEOATUOEOHKgMjtkyl6BylyC8jdwKLHVgg5O2nugOAF0NJtMqlKHBXECQFAACEUD7iEDwFfBAFcFcCAA=="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const isAuthorized = await Actions.policy.isAuthorized(config, { user: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', policyId: 1n, }) console.log('Is authorized:', isAuthorized) // @log: Is authorized: true ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.isAuthorized.md","from":5074,"to":5100} type ReturnType = boolean ``` ## Parameters ### policyId * **Type:** `bigint` Policy ID. ### user * **Type:** `Address` User address to check. ## Viem * [`policy.isAuthorized`](https://viem.sh/tempo/actions/policy.isAuthorized) --- --- url: /tempo/actions/policy.modifyBlacklist.md --- # `policy.modifyBlacklist` Modifies the blacklist for a blacklist-type transfer policy. Requires policy admin role. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/policy.modifyBlacklist.md","from":172,"to":5627} // @twoslash-cache: {"v":1,"hash":"6c776f607178f89d5334ea2398757c8b3ee4db029caff53ec164954928f7b409","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinKQwvDCMWGipACpDwsOCYABKaxtbpeVSiAAc/bXKqhotOnp4q+ubDPIWVgDMA0czlGNwm1C8018c2oASYrHYXCMR1MV300lkD3qz2orTeBiRJi6vyQAJA9iBIyQACZGmDMFMDDM/DCFgZ8gjOGxzLwMJdtPpetYagpHg1mjjXoEuYweUSeohSeShsCSZU6RDGVDSjRWSAEgBXMD8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SQgCuCuBAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { receipt } = await Actions.policy.modifyBlacklistSync(config, { address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', policyId: 1n, restricted: true, }) console.log('Transaction hash:', receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `policy.modifyBlacklist` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.modifyBlacklist.md","from":5979,"to":6435} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.policy.modifyBlacklist(config, { address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', policyId: 1n, restricted: true, }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args } = viem_Actions.policy.modifyBlacklist.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.modifyBlacklist.md","from":6462,"to":6791} type ReturnType = { /** Address that was added/removed from blacklist */ account: Address /** ID of the policy */ policyId: bigint /** Transaction receipt */ receipt: TransactionReceipt /** Whether the address is restricted */ restricted: boolean /** Address that modified the blacklist */ updater: Address } ``` ## Parameters ### address * **Type:** `Address` Target account address to add or remove from the blacklist. ### policyId * **Type:** `bigint` ID of the blacklist policy to modify. ### restricted * **Type:** `boolean` Whether the address should be restricted (`true`) or unrestricted (`false`). ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`policy.modifyBlacklist`](https://viem.sh/tempo/actions/policy.modifyBlacklist) --- --- url: /tempo/actions/policy.modifyWhitelist.md --- # `policy.modifyWhitelist` Modifies the whitelist for a whitelist-type transfer policy. Requires policy admin role. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/policy.modifyWhitelist.md","from":172,"to":5604} // @twoslash-cache: {"v":1,"hash":"952192056f8028f108ce757f5c41d5167a39f17553d4a449338c09baaef8c103","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinKQ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owo+pa5khaphpMosoYwjCshZpFTJLuzao4YEZEQ+LUY2xMZkwkIqJcYswCZy4iZhxYEl5Ugso14N4t5d595D5Khj5T5z5L5r5b574n4X434P4v5f5/5WZzLGEiFpzeY2ZlERFehKZgZ7tIsHl59ILjyTQHBYLT9uyYwjyhJHz7tShNZxAkBQAAhFBgkhA8BgoQBXBXAgA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { receipt } = await Actions.policy.modifyWhitelistSync(config, { address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', allowed: true, policyId: 1n, }) console.log('Transaction hash:', receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `policy.modifyWhitelist` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.modifyWhitelist.md","from":5956,"to":6409} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.policy.modifyWhitelist(config, { address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', allowed: true, policyId: 1n, }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args } = viem_Actions.policy.modifyWhitelist.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.modifyWhitelist.md","from":6436,"to":6759} type ReturnType = { /** Address that was added/removed from whitelist */ account: Address /** Whether the address is allowed */ allowed: boolean /** ID of the policy */ policyId: bigint /** Transaction receipt */ receipt: TransactionReceipt /** Address that modified the whitelist */ updater: Address } ``` ## Parameters ### address * **Type:** `Address` Target account address to add or remove from the whitelist. ### allowed * **Type:** `boolean` Whether the address should be allowed (`true`) or disallowed (`false`). ### policyId * **Type:** `bigint` ID of the whitelist policy to modify. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`policy.modifyWhitelist`](https://viem.sh/tempo/actions/policy.modifyWhitelist) --- --- url: /tempo/actions/policy.setAdmin.md --- # `policy.setAdmin` Sets the admin for a transfer policy. Requires current policy admin role. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/policy.setAdmin.md","from":150,"to":5432} // @twoslash-cache: {"v":1,"hash":"983f569302010026098cc5bbf73d68463318d1076985854dbfdfd589c471fed0","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYww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p5W8go1pPBrgMsMQsAcInsy0L0X2xUiUPkTGqUIKw0EAuUsqIFeMCUpUSUvkYY5BLsdUBuywNkIZXAnkD0T0iIr0zM70n0sYb4P0f0LsAMnYecqQvkxcpc5clc1ctc9cjczcrc7cnc3cfcA8Q8I8Y8E808jYiMnYn8qQvQEMp09W2JyScey5nZX2q+65JeeFYYHZLE3Z9WpQNM4gSAoAAQignCQgeA1EIArgrgQAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { receipt } = await Actions.policy.setAdminSync(config, { admin: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', policyId: 1n, }) console.log('Transaction hash:', receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `policy.setAdmin` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.setAdmin.md","from":5777,"to":6197} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.policy.setAdmin(config, { admin: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', policyId: 1n, }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args } = viem_Actions.policy.setAdmin.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.setAdmin.md","from":6224,"to":6460} type ReturnType = { /** Address of the new admin */ admin: Address /** ID of the policy */ policyId: bigint /** Transaction receipt */ receipt: TransactionReceipt /** Address that updated the admin */ updater: Address } ``` ## Parameters ### admin * **Type:** `Address` Address to set as the new policy admin. ### policyId * **Type:** `bigint` ID of the policy to update. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`policy.setAdmin`](https://viem.sh/tempo/actions/policy.setAdmin) --- --- url: /tempo/hooks/policy.useCreate.md --- # `policy.useCreate` Creates a new transfer policy for token access control. [Learn more about transfer policies](https://docs.tempo.xyz/protocol/tip403/overview) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/policy.useCreate.md","from":218,"to":6466} // @twoslash-cache: {"v":1,"hash":"e13be9674f34cecb6d1efe8ccab1940abeb9e94a06d019450df7b8523742032d","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylan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JVFVNVDVLVHVPVA1I1E1M1C1K1c8FfOhx1Z1V1aGd1T1b1X1f1QNd1ENMNCNKNGNENeNSQRNERxKaqPSK6LydtXyOnLR1wUBr40zdk4iXe1sfe0q1OYBioS2vUd6bIVWOQ/wV/UQJAUAQIeQL9UIPAdcEAVwVwIAA="} import { Hooks } from 'wagmi/tempo' const createSync = Hooks.policy.useCreateSync() // Call `mutate` in response to user action (e.g. button click, form submission) createSync.mutate({ addresses: [ '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', ], type: 'whitelist', }) console.log('Policy ID:', createSync.data?.policyId) // @log: Policy ID: 1n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `policy.create` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/policy.useCreate.md","from":6807,"to":7397} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const create = Hooks.policy.useCreate() const { data: receipt } = useWaitForTransactionReceipt({ hash: create.data }) // Call `mutate` in response to user action (e.g. button click, form submission) create.mutate({ addresses: [ '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', ], type: 'whitelist', }) if (receipt) { const { args: { policyId } } = Actions.policy.create.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `policy.create` Return Type](/tempo/actions/policy.create#return-type) ### mutate/mutateAsync See [Wagmi Action `policy.create` Parameters](/tempo/actions/policy.create#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`policy.create`](/tempo/actions/policy.create) --- --- url: /tempo/hooks/policy.useData.md --- # `policy.useData` Gets the data for a transfer policy, including its type and admin address. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/policy.useData.md","from":149,"to":7194} // @twoslash-cache: {"v":1,"hash":"a27f67c0f419f67e0995e3865a87b2d08d15ce406ed36312f2acb9580f1cc1e3","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUWKQQOBwYAJScUKJiiJzAADpgnBmcolDMpkkAglBQpPBwANxpmZyYOEkAChAm1hgAKl4VYK6cAD6cAK5gsABmpjBQ/lAQ1gh6LfgwnDKiIpxwfdbWpUN9MjIYnCVwjSRQcQminEPs1fOcAI59ZBgAdGlvYHMLSytrG1s7ewO8GOYzOYku12UCweT1eYHen0Wyy4v02cDg212+0OINO8XBV1IN2hj1IL3eaUR3xR6zRGIB2OBMhOYIuhOJ91J5PhPKpyNWtP+WKBR2ZoPxbMhtxhZOe/hE4l0ABZ1MZ5EoVIglRpxNoghL/CYzEgAEw2OykBxOJAADncnhweEIJHIGkCeGsEDAKzYTQwABFzklUulMtlcmACkVDuVKpkajB6o1GM02jgOl1egNhqNxlRJtM8HyfoL0ZjATixXjzhCiVDObD5ZpdKoAIyydXKJCtqzUXU6PC+lMB86G0am832Rx+RCtpX26heJ2+V0BehMVjsLgGQRNxVIABsB47ii7iFVmj1eB3RiN5jNIFsU+tiBNbg8i8demdfjd670LBsBwnBDs0e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xxaA4D66rLnA6xhNwNE9zLZ6rL+xAxnLZDnePLfLDGV9Ys7wLVtxH8eRcJjxq+2LzFuLclBLNR1yxLdxjRZLH8FLcJ4J3Uy1RI0JL8G1pAwJW1jD0+qJsSGJWJOJPY+JEsD+RJrYB4qoSjrcppJjNJlpGEmjtpHciATJOTTpIBkcX+D0XJzQPJlk8UXpAp9kqUoptjrQ2UnQUp2Y2cuYvTq8Xw/IqIQoFYTILIEo2p0oXI5cj+3YNovrnYmoJplJn+5plUxgVpobz4M4Jokbn4uTbJ1j0cEQZAccaUtQYpWUOAebMphbNBfTbUU7aiZjZtijLbSA2o7bQQREwb5gvbDJgc2TQ7eAiJRjSsgbhjhJ8jJoFgFJfrlg+TegWbq7SQm0emNAJgIgP+zsWj4bABdsnosAG4pCc0N4P0K0vGFuO0+0h0bAx0Cd9OT0EoSQnb4IXQ/06kmk3s5w4McYCcSQrYCMOUtmINRuZ6b7/J5uGHogvMCUtmb1xub7YktHbUukvMCYtm/gQiogSAoAgQ8gZ8Xo57CArgrgQAA="} import { Hooks } from 'wagmi/tempo' const { data: policyData } = Hooks.policy.useData({ policyId: 1n, }) console.log('Policy admin:', policyData?.admin) // @log: Policy admin: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb console.log('Policy type:', policyData?.type) // @log: Policy type: whitelist ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `policy.getData` Return Type](/tempo/actions/policy.getData#return-type) ## Parameters See [Wagmi Action `policy.getData` Parameters](/tempo/actions/policy.getData#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`policy.getData`](/tempo/actions/policy.getData) --- --- url: /tempo/hooks/policy.useIsAuthorized.md --- # `policy.useIsAuthorized` Checks if an address is authorized by a transfer policy. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/policy.useIsAuthorized.md","from":139,"to":4981} // @twoslash-cache: {"v":1,"hash":"8b9aa7de863db2bb7feb28203f7e1e641e9774ded5f3aee5221a9605f2ab7693","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUWKQQOBwYAJScUKJiiJwARnxyomCcAD6cAK5gsABmpjBQ/lAQ1gh6ACr4MJwyoiKccLnW1vBwhbkyMhicpPAQMiRQcQminIXsnMoNAI65ZBgAdAA6YJubdQ1NLW0dXT19A0NwI2MTYtOz85xLKxtbL7uNzVyHnXDdvf2Dw1GpWuUxmpDm9Qey1Ia22r0h+0+7W+v1OAIuQPG8RuYIhi2hsJeOwRH1ayOOfzOgKu2NBd0hjxhq38InEugALOpjPIlCpEOyNOJtEFaf4TGYkAAmGx2UgOJxIAAc7k8ODwhBI5A0gTw1ggYBajDgAEFcsp2IwAF6lJKpEYwDLZPIFGDFMxlKgVKp4N6IslHH4nf7nS7A2m3cH3RlrFmaXSqACMsh5yiQCel1CFOiYJrNhFIVtKYpKUpl9kcfkQCfZKuoXnVvi1AXoTFY7C4BkEsbZSAAbIrk4pU4guZphXhO0ZxeYM7ZywrEABmBO1zBqvQavzalt6FhsDicNgmawYbsSRAAdgF3KHfN7gq02b0R8YJ+LEsQs9l8sri4vq/rDdG38GgdxAHowEcRh9TyOAYAASVzc0C2tKAAB4AGF9WKBQKBSNIHTAAA+UJ7GYHQyDgAB+JJJ1WF8T1WXI4MQ01kMLKBVgABTIijSDgTDsMYXD8PtDIiOiWi+EEeiRlfNZmIQpD8w41YACUdFyU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sAsEwLrh7EyybhTD5HwPbiCFQ3IKIJADnC9gXGVH9jXDfmAnoN1B1yNAJkOmulEhMkzhdDdCLFUNcl9FJC+ApDRBDExBBA8ijAJEPmwKlAsHwPPmHHTGII7lNMig4nVMoN/GoL1MAkzAUH8CxzwDVNlPPElFwMHAvisGbCCEDVEHDKJj02WHIOkE1O/GfksFcDNj1FgFbC0VKi2kEDWkKFqnwxajak6hgG6nHwNC4BmkmCSDDN1mBGqk2joniiYn2jNJdmOgeiegaleivElCgEXFUAwmsF7F7EXHZAwgsFUHS0kElFUFEEXGSEVF9gACFrBJAYALxVBJBVBCgLBkhD1khkhPoHo74LSEw7pWZsswSUkni8yCybQ8MhzCZShst/B3FRAkBQBAh5A8F9Q8B8oQBXBXAgA="} import { Hooks } from 'wagmi/tempo' const { data: isAuthorized } = Hooks.policy.useIsAuthorized({ user: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', policyId: 1n, }) console.log('Is authorized:', isAuthorized) // @log: Is authorized: true ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `policy.isAuthorized` Return Type](/tempo/actions/policy.isAuthorized#return-type) ## Parameters See [Wagmi Action `policy.isAuthorized` Parameters](/tempo/actions/policy.isAuthorized#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`policy.isAuthorized`](/tempo/actions/policy.isAuthorized) --- --- url: /tempo/hooks/policy.useModifyBlacklist.md --- # `policy.useModifyBlacklist` Modifies the blacklist for a blacklist-type transfer policy. Requires policy admin role. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/policy.useModifyBlacklist.md","from":174,"to":6763} // @twoslash-cache: {"v":1,"hash":"8612238fb35eb7ea94d9d2808311c32ba32c9e01a54e93a2838af6a38747928f","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6INYQYCKczNCMAGYYAEIyDvwmIgDKGGDWiDx8ggB0bCbWGHkArnAwALJRsQlJKWjpmXkASjqlpGAAKl4APADCodGMChScpWD8kADuYAB8/iLiugAsAMyy8koqiACM0tTi2kGRUDHxidbJjGkZ1v4mZkgATDZ2pA5OSABs7p44eEIJHIGkCTFY7C4BkEi00um+6mMW2Uag0Rx0eGhRke5lewXenz8iGeAA4/tQvIDfCCAvRwWwOJxCoxirDlkgAOy7TaKFGIb5orQYvTM1myUy4t72RxEtYrcmYAF6IF+UF0vTRCaORihcYVapnWqXa63TIDIYjMYTKYQWZzAAUWHszB0ZDgAH5sliChAiiVylUahd6jdGnc8gAFZ2u0hwc1gYajcaTGbzACUXtycB9frK+qDdSuDSa1la7U6PRw8cTVpTtvmAB0wGBRC64E7rDA9YHDcGi6GS/4oBBrAg9NDONF2BEg6YFJxREzfSyMJwAEbGhp5JtNgByEBo2S6+BunFPi7gd3wpFCEHKnEIAk4ylEXGmokYaDgk+nyi7aA+MJPh1MAmzQCB1y7UxrBkUpYCgThdUXDcR34SCp1ILtMLQDowDnBdOEw9tQgqPJ/DEBQx2QZAQDoVssDkfwAAMWK/WgmxYBkuGAHJDE4VxJxvZhOAAcnfBRmEYAB6GgIREncEy1NAQM4ABBLAsHtNNOGAJtOE4EIwm4iJSjEGgxhuCN5DORR+M4ABeXj8lFf1817QsTTDTItIU/TsNwzh7T0/TOF6NdTPA0CwBCkLQn6Ip+Hs4AtIcuYTLMmB7R4lyAEkoGyZ4wDGUQoCgIi4GyESLFoPJapEsYiIAlka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LO8xHOz3eAfOo5IujCEun+MuhSCursKujZPlOAOup9Ruwu18RcFuqJUusAculwruheau3u/uvOmQAuzgZu38dVJZMu8W74SWkmnYbe2WvAfWpWmm11LWVQdWi9RUT1TW+C7W5TKdR9AeaO0O8OmxSeJ+8WjkADX9HYIC/evQR+gYo+yCokMtDW2DdwhCu+3WtqHuMeABbgBefAOud2huJ/B27FeO1VGAa+YaAjd+BBuAGBCAEFGg+RF+gBD+rdb+8CxEP+6gchkCAhlQMDam4B5wb4DkGCiifwf4vASmgm8GNYctKWnYADCBtOhh3UOwQh7IaqXYZ4OUVQDh79CwQaawK+eRxR5RyQVRtcdR7BzRlYJRyGHRtRjRhRox7R3R/R6IJWtdWmyDaCkGEIWAekSEHSJyb8ASaIISaAlcySGSb3NgeSKs/k1mhWksC470FyZmZGXmneO4HyKKB/foBPZRB1bFUwJ9NgMIUQgMG5GxQKVPBQMnDaSKAyBKMYIqnutcSSORECII8JxWXeaJTKI2hcYNcxSqCNKNGNONBNJNFYFNM+9NTNbNXNfNQtYtUtctStatWteqYKE2zgXYIqYKYDDuN9dqDePaIIqU1DJ0oAsO2BiO6KaRpBqAppvmpWPIfW90KIqOgYvIYQoCGxJhoI/wag0QJAUAQIeQVG0IPAL8EAVwVwIAA"} import { Hooks } from 'wagmi/tempo' const modifyBlacklistSync = Hooks.policy.useModifyBlacklistSync() // Call `mutate` in response to user action (e.g. button click, form submission) modifyBlacklistSync.mutate({ address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', policyId: 1n, restricted: true, }) console.log('Transaction hash:', modifyBlacklistSync.data?.receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `policy.modifyBlacklist` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/policy.useModifyBlacklist.md","from":7113,"to":7686} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const modifyBlacklist = Hooks.policy.useModifyBlacklist() const { data: receipt } = useWaitForTransactionReceipt({ hash: modifyBlacklist.data }) // Call `mutate` in response to user action (e.g. button click, form submission) modifyBlacklist.mutate({ address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', policyId: 1n, restricted: true, }) if (receipt) { const { args } = Actions.policy.modifyBlacklist.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `policy.modifyBlacklist` Return Type](/tempo/actions/policy.modifyBlacklist#return-type) ### mutate/mutateAsync See [Wagmi Action `policy.modifyBlacklist` Parameters](/tempo/actions/policy.modifyBlacklist#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`policy.modifyBlacklist`](/tempo/actions/policy.modifyBlacklist) --- --- url: /tempo/hooks/policy.useModifyWhitelist.md --- # `policy.useModifyWhitelist` Modifies the whitelist for a whitelist-type transfer policy. Requires policy admin role. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/policy.useModifyWhitelist.md","from":174,"to":6752} // @twoslash-cache: {"v":1,"hash":"7679b70c1a9955fc42af8bd9929c68a4bdb7d8b9fde73dc5c771f97554c0150a","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRg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axbgJefAOuJ2hue/V2tFaO5VbCOOnDL+WBuAWBCAf5aguRYO6xIWktLG6WRECWvAACJ+kOsAHBlQXdJAQmo+rWb4DkP8yifwA4vAfGtGyGdYdNchpAd9JwvDYhspOwXB7IOqPYZ4OUVQdhkkN9EaawW+ORhRpRlRyCNR7CDR1YRR6GbR3R6IfRwx5RiwVR2+AmldYmrWX8sGEIWAekSEPSFyE8ISaIEScAng6SOSd3NgRSWKWmnedGHySkn0NyVmVGdmvecMPyWKW/AYUlJRe1NFUwXukiMIYQ7sH8OhkKRPBQYnLaGKIyZKcYDK7S6SWRECXw0J6W8MPISJHKXWhcINMxGqcNSNaNWNeNRNVYZNE+tNDNLNHNPNAtItEtMtCtKtGtJqMKLdWdbIedGACgMKfWzgPYUqA6Xwxa8LZU7oCRtSKR+BsA+ppWfePILWj0UIsO7ovIGh6B4BBh3w/wKg0QJAUAQIeQGjUIahhAVwVwIAA"} import { Hooks } from 'wagmi/tempo' const modifyWhitelistSync = Hooks.policy.useModifyWhitelistSync() // Call `mutate` in response to user action (e.g. button click, form submission) modifyWhitelistSync.mutate({ address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', allowed: true, policyId: 1n, }) console.log('Transaction hash:', modifyWhitelistSync.data?.receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `policy.modifyWhitelist` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/policy.useModifyWhitelist.md","from":7102,"to":7672} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const modifyWhitelist = Hooks.policy.useModifyWhitelist() const { data: receipt } = useWaitForTransactionReceipt({ hash: modifyWhitelist.data }) // Call `mutate` in response to user action (e.g. button click, form submission) modifyWhitelist.mutate({ address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', allowed: true, policyId: 1n, }) if (receipt) { const { args } = Actions.policy.modifyWhitelist.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `policy.modifyWhitelist` Return Type](/tempo/actions/policy.modifyWhitelist#return-type) ### mutate/mutateAsync See [Wagmi Action `policy.modifyWhitelist` Parameters](/tempo/actions/policy.modifyWhitelist#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`policy.modifyWhitelist`](/tempo/actions/policy.modifyWhitelist) --- --- url: /tempo/hooks/policy.useSetAdmin.md --- # `policy.useSetAdmin` Sets the admin for a transfer policy. Requires current policy admin role. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/policy.useSetAdmin.md","from":152,"to":6479} // @twoslash-cache: {"v":1,"hash":"fbe0fb128f663b81203c3f14323f7bbd58a2ebdc7f33ada3627157b6f722bbb1","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6INYQYCKccDoAglDMpgDKGGDWiDx8ggB0bCbWGBkArpHx0bEJSdYZAEo6+aRgACpeADwAwqEAZowKFJz5YPyQAO5gAHz+IuK6ACwAzLLySiqIAIw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q0qsq8qiqUwyqqq6qmq2quqUw+qhqxqpq5qlq1qD4JeFkYNnAywkUbUuBrlNGYJ9QN9A8d97dUJSjjoPNRopBpNWhGQK9qd1469+AuB/gE+ogSAoAgQ8ga6oQeAh4IArgrgQAA=="} import { Hooks } from 'wagmi/tempo' const setAdminSync = Hooks.policy.useSetAdminSync() // Call `mutate` in response to user action (e.g. button click, form submission) setAdminSync.mutate({ admin: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', policyId: 1n, }) console.log('Transaction hash:', setAdminSync.data?.receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `policy.setAdmin` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/policy.useSetAdmin.md","from":6822,"to":7338} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const setAdmin = Hooks.policy.useSetAdmin() const { data: receipt } = useWaitForTransactionReceipt({ hash: setAdmin.data }) // Call `mutate` in response to user action (e.g. button click, form submission) setAdmin.mutate({ admin: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', policyId: 1n, }) if (receipt) { const { args } = Actions.policy.setAdmin.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `policy.setAdmin` Return Type](/tempo/actions/policy.setAdmin#return-type) ### mutate/mutateAsync See [Wagmi Action `policy.setAdmin` Parameters](/tempo/actions/policy.setAdmin#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`policy.setAdmin`](/tempo/actions/policy.setAdmin) --- --- url: /tempo/hooks/policy.useWatchAdminUpdated.md --- # `policy.useWatchAdminUpdated` Watches for policy admin update events on the TIP403 Registry. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/policy.useWatchAdminUpdated.md","from":150,"to":4753} // @twoslash-cache: {"v":1,"hash":"c97041b0026ec81821f4e52786e61b498aaf99fd2e23ce80fa9483d396001836","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXGwm1hhRmroALLFJispIAGwamTp47Yyd/iZmSEUgtvaOfogjVdRetb4NAfR4AGYArmCOjBBgnCdwMADqomi2AIJQzKYAqlhQTzBQAB4AMJXI6MBQAPgAFFh7MwdGQ4AB+RCcYAAHWunGxK1MAEkoCjOGATswAEZkTgAHxuYFgYLMUAA3JjsdjMsjURisWy2dNOgSiWTwaYuDThQpRcgALrU4knGQyOVnen5Zms3lsk4/P6kIkAAwstAAJMARKRTApXPq5YaTWa0BbFNaZXKSYrlXSYAz/iyeZrRO9TAajabzZbrbbQw6nVb9a6ae6lTSVd61X7ea5ParGRm2UdSBBmAAhGQQaz8IUisBi2k530a7FXACipELetRUKhZHbqNb7YAlJwALwQzhECCMKBDlNen1QbNp3ONzjtGREx0nGCL+c79MrteWvE1shEUTr1Ek8mU2f1he3pcN/1XN4fMDfX40QmdqEc1EAdye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NYIe1Op+vxaAqI6gZS+htx4SbxwKNY80Px0JaA/xWesG9xMJnAoJqGTG6GYA70G0ta240yBxZxCxcK/aiKQ69kqKGx462x2K06eKryBxJKvyxxp6pxrJ5xnUWkOkh624pgZxF6L+zkSArkCMpg0k/gRAFg4ElM0pFgFgWBCMOBVMmMh86MEc2MAcxg2EFBVB18FM+B9Buws8zMzBqcwMGc0EXIB440Aoc0rE1YaA1cxcTgdc9of21o1cU0YArp5csYHpzc2Brs6WEcHc6M3cGpfc0EOpZMI8FMBQd88MpEsAzQOioUpUEUWkhYYicUmmSUKUbAaUU+pU4E5UlUdwJ0yEss9UjUGoQcik9UnYHIksCsI4Y4Wc5irxkSMUf4hGS0a0FAL0ahIAacogSAoAgQ8gOCVweA/kIArgrgQAA="} import { Hooks } from 'wagmi/tempo' Hooks.policy.useWatchAdminUpdated({ onAdminUpdated: (args, log) => { console.log('args:', args) }, }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `policy.watchAdminUpdated` Parameters](/tempo/actions/policy.watchAdminUpdated#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`policy.setAdmin`](/tempo/actions/policy.setAdmin) * [`policy.watchAdminUpdated`](/tempo/actions/policy.watchAdminUpdated) --- --- url: /tempo/hooks/policy.useWatchBlacklistUpdated.md --- # `policy.useWatchBlacklistUpdated` Watches for blacklist update events on the TIP403 Registry. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/policy.useWatchBlacklistUpdated.md","from":151,"to":4834} // @twoslash-cache: {"v":1,"hash":"2b35d7c59b68fad10378a67e4629e5fec424fa0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6pGo7hLosJ1ZY5fxOotRo47J5zARuwuRlZtYyIS5gk4SK9kpAIuN1ptoKAvpbCQAC5RAkBQBAh5B2Erg8AwoQBXBXAgA"} import { Hooks } from 'wagmi/tempo' Hooks.policy.useWatchBlacklistUpdated({ onBlacklistUpdated: (args, log) => { console.log('args:', args) }, }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `policy.watchBlacklistUpdated` Parameters](/tempo/actions/policy.watchBlacklistUpdated#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`policy.modifyBlacklist`](/tempo/actions/policy.modifyBlacklist) * [`policy.watchBlacklistUpdated`](/tempo/actions/policy.watchBlacklistUpdated) --- --- url: /tempo/hooks/policy.useWatchCreate.md --- # `policy.useWatchCreate` Watches for policy creation events on the TIP403 Registry. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/policy.useWatchCreate.md","from":140,"to":4682} // @twoslash-cache: {"v":1,"hash":"410c78052455bb6978da5eacfc5719ebc1462a6449aaa6683f5090198fea83d5","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXGwm1hhRmroALLFJispIAGwamTp47Yyd/iZmSEUgtvaOfogjVdRetb4NAfR4AGYArmCOjBBgnCdwMADqomi2AMKkME8wADwvV0eMCgAfAAKLD2Z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AefR1FWTUADEZClfAHEZPeYTqTgAAWUlCMmch7EyDxADUNhJSARDXiVGiglVUtSSkYC+i4Ekn7BDUtV0iNEXVIAOhILILEzGidDz1WnWzxUsIcVTQfxEHMXqyuGvmnG7CwRYDezwS6R6TfSOGBFiELArV+X+UXTAHiGWXrXmBOEORSNHTIMbRSNiEqz5COAQliB7URRkDC2BHpU0IhHMjGlnRjTBA/FaSiPqxkAQh2kXTQHcSv1+WrVfxgDrVWWEMbU2XgBbV/2hU7XaPKKRXaK6KeEWJbXGgxU52PTgHV1oUeVjGe1UClyt26lCnwjODQDhAgwfVGhONjEd3R2d2QVOLhHUFSSkPVx8SOOuLOJg0+NuJLwX0+KeLJ1eLAFulmizR7G6VmOWN6J+SrX+VrQsmBVGKbQmNbShQ7RilmN7WuQWIXSWLxJWMaknXUhnR7FMGWOOn3xsiQDsjBlMHEn8CIAsAQjhhZIsAsFALBnNnhltkGBgMXgmCCAgiQJQK9lbiQDhl9l3n9mwNJgODwMHk+kjkahPE9HPDjmvFjCTgfFTnSnTnOS/Gzn+lzhAiuinl0ElJLj5NhmriXjrkahFI3jQMWFUFcFBnwlgGaBkT8nykCkDGDFgxEyilildTYAShb3ygQkKjRnHn5gqkVCdlqkGigCzEZG5lQnQnLGjj13eLcVCmPBg3GmmgoCukEJACHlECQFAECHkEgSuDwA8hAFcFcCAA="} import { Hooks } from 'wagmi/tempo' Hooks.policy.useWatchCreate({ onPolicyCreated: (args, log) => { console.log('args:', args) }, }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `policy.watchCreate` Parameters](/tempo/actions/policy.watchCreate#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`policy.create`](/tempo/actions/policy.create) * [`policy.watchCreate`](/tempo/actions/policy.watchCreate) --- --- url: /tempo/hooks/policy.useWatchWhitelistUpdated.md --- # `policy.useWatchWhitelistUpdated` Watches for whitelist update events on the TIP403 Registry. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/policy.useWatchWhitelistUpdated.md","from":151,"to":4826} // @twoslash-cache: {"v":1,"hash":"2c18a2554a7d5904a09f15c11717794915bec94d2536640e09fff9a27cdf3002","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXGwm1hhRmroALLFJispIAGwamTp47Yyd/iZmSEUgtvaOfogjVdRetb4NAfR4AGYArmCOjBBgnCdwMADqomi29/iMNCYiAKpYUE8wUAAPABhK5HRgKAB8AAosPZmDoyHAAPyITjAAA6104OJWpgAklBUZwwCdmAAjMicAA+NzAsHBZigAG4sTicZkUWjMdj2ezpp1CcTyRDTFxaSKFGLkABdGkkk4yGTys4M/Istl89knX7/UjEgAGFloABJgCJSKYFK4DfKjabzWhLYobbL5aSlSr6TBGQDWbytQ5rBAzmhDcazRarTa7RHHc7rQa3bSPcraaqfer/XzXF61Uzs+yjqQIMwAEIyCDWfjC0VgcV0/N+zU4q4AUVIJf1aOh0LIXbRHa7AEpOABeSGcIgQRhQUfp72+qB5zMFlucdoyYlOk4wFdL/dZ9ebq34+tkIiiLdo0kUqkLpvLh+r5sBq6vd4wT5oH5/GhEntoU5NEAHcnheN4PkYb5dX/AA6ABBLQ4AoThKwUUDwPwD8oJgv8ATggAZCAFFHCcpxnOdDzXANgzAcEFGJUF6IhajXz5eRRHJOQAM4ck+D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0rrqMpbruSsp3H7qPFHo8ovHZRvHCq4qfH/rfFim/HITvrmTfp7imA/FAYQHeRIC+RoymAqT+BEAWBwQMw6lzx0Fox+yMHhyfy4w/wTBBAALxzmDLzbypzOAMzpwQKZwnycwHCiH5wQxFzITcjHiTQzAYDlx8R1hoCty1xOBdwOjo42itxBjEmRmNwJgxn9zYZDzLR8SjzjyfSvy6AMy9AMyDBfyIDLy/zEwgDrzWk8HJx0xpyqCuCozBiwDNBeKxR1QJSmQlhGJpROaZQ5QwB5Q7R1RwQNRNR3AXTYRqxywAjdSajRz2SPzDzDachKxazjiTglxR71IYbATcbrTYibQSSWEgAFyiBICgCBDyCcJXB4DhQgCuCuBAA=="} import { Hooks } from 'wagmi/tempo' Hooks.policy.useWatchWhitelistUpdated({ onWhitelistUpdated: (args, log) => { console.log('args:', args) }, }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `policy.watchWhitelistUpdated` Parameters](/tempo/actions/policy.watchWhitelistUpdated#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`policy.modifyWhitelist`](/tempo/actions/policy.modifyWhitelist) * [`policy.watchWhitelistUpdated`](/tempo/actions/policy.watchWhitelistUpdated) --- --- url: /tempo/actions/policy.watchAdminUpdated.md --- # `policy.watchAdminUpdated` Watches for policy admin update events on the TIP403 Registry. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/policy.watchAdminUpdated.md","from":148,"to":5138} // @twoslash-cache: {"v":1,"hash":"00763990b98b4efbcf9bd7321d9ba2c95d1dae5db8d2d85db9dc52b8f2ca0034","data":"N4Igdg9gJgpg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FXiRHCspDRB+PRHslNOBB9GxEmFQeTHxGbkTL5BmAFIxCFBuBFM/GrC1HFOTAlLpGnGOJeZ1NrPlNXNPGHihoUjBMrJXt8d1O5G1nlkbD3HptdKBBmMvLkF2fYE5KUOtOIEgKAAEIoKwkIHgCeCAK4K4EAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.policy.watchAdminUpdated(config, { onAdminUpdated(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onAdminUpdated * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.watchAdminUpdated.md","from":5348,"to":5576} declare function onAdminUpdated(args: Args, log: Log): void type Args = { /** ID of the policy */ policyId: bigint /** Address that updated the admin */ updater: Address /** Address of the admin */ admin: Address } ``` Callback to invoke when a policy admin is updated. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.watchAdminUpdated.md","from":5682,"to":5909} type Args = { /** Filter by policy ID */ policyId?: bigint | bigint[] | null /** Filter by updater address */ updater?: Address | Address[] | null /** Filter by admin address */ admin?: Address | Address[] | null } ``` Optional filter arguments for the event. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.watchAdminUpdated.md","from":6090,"to":6135} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`policy.watchAdminUpdated`](https://viem.sh/tempo/actions/policy.watchAdminUpdated) --- --- url: /tempo/actions/policy.watchBlacklistUpdated.md --- # `policy.watchBlacklistUpdated` Watches for blacklist update events on the TIP403 Registry. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/policy.watchBlacklistUpdated.md","from":151,"to":5213} // @twoslash-cache: {"v":1,"hash":"9b1d65086b67741e13cb6c063a4e3c7d1060b98061ad9be94ac501be7904f5a6","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qQDqW/YZYGhD/ACiJMcASnorpGAAKl6l5VKI6rK1yqoaLTp6eDWm22ankFisAGYBo5nKNGhNqM8DDM/NQAkxWOwuEZBMIXtp9AAOT4Kb4NGraNp4HEmLrgpBQkD2GEjPrwjyIqbI3xzNELAz5LGcNjmXgYfEVGQ1Un1JDNaitAEGEWMMV0nqIRnM06sxAAJkqCMwXJ8s1KNH5IASa34uM4wPsACE5E4ANbmMQAVSwUC2MCgAB4jlkAHxBDrJVLB5IUYWOZh6MhwVI04QAOhVYrTDvwzrdHrQ3t9NCgaYACvHE6Q4EHikoQxE9gd8EcTsMLoo0Dc0HdHl5cmBxAm4FgnDB7c287x3YwvT6/VBSlAILwEAZ9iD4JwEuxOAAjF3Tgurec0TgwS5oOBp83iJRr5DIEB0IdYBSlAAGX6vuUFhWA0SkDAfrRkosb4GgaBYJwrjbqQEDMJwADkAACmxKMwjAAPQxEBSG/pi/6cDQmIwXBCHIWhd6YTh7AwDhDgWHA+F5IRXAAamcBkQk8GIah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SGpJE1pLEyRKtzf03XHEBTBJhI+P5Sgm+NvWvHFX+KlTxVhL4LfUVTBNVTpUhMQ2hI1NhPhO3F3Fg3HAsBhJQ0IIfCfHtzoVKCIGsDTF6BtOsGsDEOTkfkJD1AzllE1D+FzjMAqkUOUIrg5irmASJlrk0Ibl2irBbhKmshHk7h7lSH13UWOCPjsi6lSnP0nhnjnhOH3kPhHnXkZK3gER3izIXgPmXhHlPmzPPnjKvgUBvjvlQT6GkCUK+HdPfkVE/hKl9LLhZDxj1HFjUOJjlnrkFg/yBGbCKmdmcLdgxjBhTj1AhGkNflkNwQMHHJBG/l6FsB7LFlGGsFcFBhiFgAxGZg4iimEG4l4iH2omwm0hYgdVqg+UWlgj+j4jTCEKyDEnf2WHXJaVkk4hijigSngVjjRgXHSgZkylMnziPFtnRmKnvAtkqjblXjz2o26SQj1kH3hKGn8im3K3tjHlcyemghzH3lyF/PwC8lKD2nECQFAACEUAUSEDwCvBAFcFcCAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.policy.watchBlacklistUpdated(config, { onBlacklistUpdated(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onBlacklistUpdated * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.watchBlacklistUpdated.md","from":5427,"to":5732} declare function onBlacklistUpdated(args: Args, log: Log): void type Args = { /** Address of the account */ account: Address /** ID of the policy */ policyId: bigint /** Whether the account is restricted */ restricted: boolean /** Address that updated the blacklist */ updater: Address } ``` Callback to invoke when a blacklist is updated. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.watchBlacklistUpdated.md","from":5835,"to":6066} type Args = { /** Filter by policy ID */ policyId?: bigint | bigint[] | null /** Filter by updater address */ updater?: Address | Address[] | null /** Filter by account address */ account?: Address | Address[] | null } ``` Optional filter arguments to narrow the events being watched. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.watchBlacklistUpdated.md","from":6268,"to":6313} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`policy.watchBlacklistUpdated`](https://viem.sh/tempo/actions/policy.watchBlacklistUpdated) --- --- url: /tempo/actions/policy.watchCreate.md --- # `policy.watchCreate` Watches for policy creation events on the TIP403 Registry. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/policy.watchCreate.md","from":138,"to":5059} // @twoslash-cache: {"v":1,"hash":"4175566a55e750e5214e1ba28bd900a36c6ad75d45fe9a2ac4e16980d28c414b","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qQDqW/YZYGhD/ACiJMcASnorpGAAKl6l5VKI6rK1yqoaLTp6eDWm22ankFisAGYBo5nKNGhNqM8DDM/NQAkxWOwuEZBMIXtp9AAOT4Kb4NGraNp4HEmLrgpBQkD2GEjPrwjyIqbI3xzNELAz5LGcNjmXgY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6ArChiWI5J5LtitgNy8xBjrBGq8q5BJDZhcCspjLhBurMwsCSAzhMG6BJJiIZqOZQDuK4i3reFhG+LbRiDuL9ZCA/yhArCjhUKg60LrQgpkYJBBAQgRBtrQr/77pgDqCHI9rdArD3JlFLoaaQFlEQidZFwJDRgQj4qTpyCZZBBXqtBWGVh6rboZoOFsrTJHj9ZyDRjrr7poDhK/7QodrwrdrHLKGoqXJoCDqYrDo4qTGdFTqTEzFbBHGbGlSyZHoP4njy7/YxBrBcBsTey65e7oa3HHCpBYaAZBivFoCt4kaqGpDfGpC+yGyaFMYhIvH/JvEp7fG/HB7kaAmcDAmGYMay7KJlrtgzJ7EnHzFQrPhLFdqrhIprH9ropDrYogR7EEqfKHF7rHG0mnFRRroThbrtgWAnGHpP5bg7hC4fylBEDWDRi9CCnWDWDoEuz9yNAkiPQNCMhjx4BXw/RWAkEzxRxuwUHxzPyMxDRZhpxRQZzNw2xuR5ypAFyELHBNweYrAVxVw1x1yvIWlqStztxcxdwwA9wHx9CEh6iexnyjyKjjxRTEHkyzzRzezqnLyakGD/ZAjFgRSKxiEqwhzin6B6h6g4HSl4FykGAxkgiTy9Anwqm6jWCuBXQxCwAYhoyEROTCAkRkSp4oQgTCS4QXgETDJtRvjHTkTRjIFZD0QK5wy2SJgOREQuTTgeQ7xeQ+TIx+SySBxuTBwCw15ZRRApS8Rw7obpwp5nHlQmRVQy7k6yxVxCZ0IviJhEK5A5n2BGSlDDTiBICgABCKBYJCB4ArggCuCuBAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.policy.watchCreate(config, { onPolicyCreated(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onPolicyCreated * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.watchCreate.md","from":5270,"to":5504} declare function onPolicyCreated(args: Args, log: Log): void type Args = { /** ID of the created policy */ policyId: bigint /** Type of policy */ type: PolicyType /** Address that created the policy */ updater: Address } ``` Callback to invoke when a policy is created. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.watchCreate.md","from":5604,"to":5761} type Args = { /** Filter by policy ID */ policyId?: bigint | bigint[] | null /** Filter by updater address */ updater?: Address | Address[] | null } ``` Optional filter arguments to narrow which events to watch. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.watchCreate.md","from":5960,"to":6005} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`policy.watchCreate`](https://viem.sh/tempo/actions/policy.watchCreate) --- --- url: /tempo/actions/policy.watchWhitelistUpdated.md --- # `policy.watchWhitelistUpdated` Watches for whitelist update events on the TIP403 Registry. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/policy.watchWhitelistUpdated.md","from":151,"to":5197} // @twoslash-cache: {"v":1,"hash":"e8df301eda13d3e824a0f6ebe0befaea3f9f427a3290ede59f525defedbfdb9e","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6AC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AA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.policy.watchWhitelistUpdated(config, { onWhitelistUpdated(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onWhitelistUpdated * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.watchWhitelistUpdated.md","from":5411,"to":5710} declare function onWhitelistUpdated(args: Args, log: Log): void type Args = { /** Address of the account */ account: Address /** Whether the account is allowed */ allowed: boolean /** ID of the policy */ policyId: bigint /** Address that updated the whitelist */ updater: Address } ``` Callback to invoke when a whitelist is updated. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.watchWhitelistUpdated.md","from":5813,"to":6044} type Args = { /** Filter by policy ID */ policyId?: bigint | bigint[] | null /** Filter by updater address */ updater?: Address | Address[] | null /** Filter by account address */ account?: Address | Address[] | null } ``` Optional filter arguments for the watch. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/policy.watchWhitelistUpdated.md","from":6225,"to":6270} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`policy.watchWhitelistUpdated`](https://viem.sh/tempo/actions/policy.watchWhitelistUpdated) --- --- url: /tempo/actions/reward.claim.md --- # `reward.claim` Claims accumulated rewards for the caller. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/reward.claim.md","from":116,"to":5067} // @twoslash-cache: {"v":1,"hash":"63fa687fe50fa183122469b6de0ff02764948fafd9737817ff79121a442b3050","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinKQwvDCMWGipACpDwsOCYABKaxtbpVAQvAgGO/gwnGj7cIdCK2ebDKLa+gAc/VqylUGhaOj0eFW6y+XQsVgAzANHM5Rn8JtQvNNfHNqAEmKx2FwjEdTOUpGNZED6qDqK0IQZiSZYT1EIiQPZkSMkAAmRrozBTAwzPy4hYGfKEj4Ad0kUFKZP0vWsNQUwIazVp4MCqxlpDl8jhSDZHKGKKNlX5mKF2NKNDFIASAFcwPwjtE5OIWABlDAugA8GUSyQAfEEOslUoGshROFhHMw9GQ4KlGcIAHQ62Vp3ge72+3hpgAK8cTpDgAeKSmDEVShdIEGYjDgMD9Oc9zB9LrTpzQjtIYAAaqFHTBg7kwOIE3A4+t3e3O7xLtdbiA0rnmHBOE5eI7mI6PTQoNLZZuEuwtx9eJtGIouOIwEeZYw0Kfz+HSMxxMYwGnbeIlLcyDICAdCTlgCilAABtBL65BKhTANEqxfjAUbJDG+BoGgWCcK4nAJPWzCcAA5AAAjKSiNgA9DEqzEXBBIIU8MAErh+GESR5H/tRtEwDRDgWHA9F5IxXCIamm54QRDacRRPHsHxNAEsJuRLHElacAAvEhMAoWhShBMAuScNEAnCKkyBKWwOzwGglhoAAuhQxlPC8BQvqkRlgCZJmWSxbBpowUAOakmHYUEETOd5uFRa4ES5KpsQfHA+5cNp4hPkSromBmMC6lA2brgu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BGJLjMkGxNJERMRGmLHujCpLNqjJwIhLsVsGxOlJlDwH6blPlIVPOPmCVOjGVC5ELLVCRBLM1LLLWXWdYH1LkHFIFh9nYXsNdIcVTrKXDhmY9ISYcQyQNKUJtOIEgKAAEIoLHEIHgC+CAK4K4EAA=="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { receipt } = await Actions.reward.claimSync(config, { token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `reward.claim` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/reward.claim.md","from":5409,"to":5680} import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.reward.claim(config, { token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/reward.claim.md","from":5707,"to":5788} type ReturnType = { /** Transaction receipt */ receipt: TransactionReceipt } ``` ## Parameters ### token * **Type:** `Address` Address of the TIP-20 token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`reward.claim`](https://viem.sh/tempo/actions/reward.claim) --- --- url: /tempo/actions/reward.distribute.md --- # `reward.distribute` Distributes tokens to opted-in holders. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/reward.distribute.md","from":118,"to":5766} // @twoslash-cache: {"v":1,"hash":"68cfc834c7b00e507b2686e4d8050a386080048e317a40941faee9b9d01b80bc","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScAGYArmD8gmCcWJJwMACiqmRBevhkiJxipBZKFJzxjGgA/IUAOiAA7jCMDZwAPpwNSs2tIBGFAEaMShZodWAsbBwpaZnZ5FRQELwIBgDCQiQccJziRWglypykMFin6WASxskQ0Zx5ZJxoEJxgscxkjLyhnL0AdBMJgBaTgAERWcEK+DQaCwUIA9AiiIwYMx/nB8AjlqsEbEBOYBPAEalSOksvlFtRxEo1shkCA6OJWApKCApuwuMBZmT5pTOK4YqQIMxOAByFFosVAsCk8kLIJigAsACZrGKIhMkZxVdY9fqDYaDWAQABdU2ibT6JWaM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/Y+V6prg4i6YsAyUfSic6UuwgowcQKYcgmrcEAccvsCc/S3oy241qckozAc1w1hcZYgKooYo/wQpRcoKBc3IEV5QQkZA5QPC2k9sJcj8R8r0JUZ840UA30LMV8/09Mt8Rc5Qw86+TVOkuKOQYorVGoICo8wqkCzKrKbVMNBoyCK8G89uVRnO3A/1LF5QEVG8bIYM4gSAoAAQ3MSQQqCArgrgQAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseEther } from 'viem' import { config } from './config' const { amount, funder, receipt } = await Actions.reward.distributeSync(config, { amount: parseEther('1000'), token: '0x20c0000000000000000000000000000000000000', }) console.log('Amount:', amount) // @log: Amount: 1000000000000000000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `reward.distribute` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/reward.distribute.md","from":6113,"to":6604} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { parseEther } from 'viem' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.reward.distribute(config, { amount: parseEther('1000'), token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args: { funder, amount } } = viem_Actions.reward.distribute.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/reward.distribute.md","from":6631,"to":6827} type ReturnType = { /** Total amount distributed */ amount: bigint /** Address that funded the distribution */ funder: Address /** Transaction receipt */ receipt: TransactionReceipt } ``` ## Parameters ### amount * **Type:** `bigint` The amount of tokens to distribute. Must be greater than 0. ### token * **Type:** `Address` Address of the TIP-20 token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`reward.distribute`](https://viem.sh/tempo/actions/reward.distribute) --- --- url: /tempo/actions/reward.getUserRewardInfo.md --- # `reward.getUserRewardInfo` Gets reward information for a specific account. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/reward.getUserRewardInfo.md","from":133,"to":9603} // @twoslash-cache: {"v":1,"hash":"2817cf8eb4e4b47b5f84b40187d076c43f7a53bee576d8d38d3d92985fa42e8f","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSu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WECelnJEZYfNTaPxDlv8SsHcszWvLI4OCQFYJghWIrBDmhQ+hIkqSUrYGrKxxLg1FWMUYkveFVYND1WlJLVjSVc56ty0BLMIRBk5JnFtKRbOpCW1rJlt3KqZJKid0hqOdguipYtgWSLK1lm25ZP1nZj1IQMkQVpT6KaWlrJtfS2bSNgGXtK78nScbSWmj3n4pst4RwjNicPgJnDIeR/EvmAELYWthh1rXzhMP87eVAu2ZGGnMOGELDG2Sw0sj6xWGttgKWmDtn7De4YDe2V7EAK2XbKdkR29AsQf2EZyTshyZ7Wdq0zUEWgNBk8FdiGCfK6DSmywcOJiBhg10FkBIA9owLmZYjKQOInsFhAjjUirmvA0uAGHvICCjIQgx8CILab9g7QaYFgTYGfa9MsId4Y9HYhpF7k7QVwawGYkaDSB+yio5UeYjVH5NVBXAipr6EnL8Dk4MQWAEwFqqpRz4i4ESIFFqjZQ8seUETLNDKhOQLRGsGqHVFCjvhMmWQNqJ3wtFbsfgBwaOFuHZHMhgxsoZcheUyg9R1o4gb6L9CtGYQtwOENAHhHzggw9wYMLqBDHWh4x/4q5YmLQFGbjNJm0zWZvM0WY8hlmqzdZps22a7N9mhzY5qc3OZHAZY+0KGNSKJjwxEYygvsf2IxjtjxoT0IxoYJfyyCBmK5VUAGQbBnkpxcsaHqllkHcod2abRct8HkEJxdhPpWQSvD0R4gZxbIqkcyDlilBTY4gJAKAACCKAakQgPAPZBACuBXAQAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { rewardBalance, rewardPerToken, rewardRecipient } = await Actions.reward.getUserRewardInfo(config, { account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) console.log('Reward recipient:', rewardRecipient) // @log: Reward recipient: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb console.log('Reward balance:', rewardBalance) // @log: Reward balance: 1000000000000000000n console.log('Reward per token:', rewardPerToken) // @log: Reward per token: 385802469135802469135n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/reward.getUserRewardInfo.md","from":9689,"to":9971} type ReturnType = { /** Accumulated reward balance claimable by the account */ rewardBalance: bigint /** Reward per token checkpoint for the account */ rewardPerToken: bigint /** Current reward recipient address (zero address if opted out) */ rewardRecipient: Address } ``` ## Parameters ### account * **Type:** `Address` Address of the account to get reward info for. ### token * **Type:** `Address` Address of the TIP-20 token. ## Viem * [`reward.getUserRewardInfo`](https://viem.sh/tempo/actions/reward.getUserRewardInfo) --- --- url: /tempo/actions/reward.setRecipient.md --- # `reward.setRecipient` Sets or changes the reward recipient for a token holder. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/reward.setRecipient.md","from":137,"to":7724} // @twoslash-cache: {"v":1,"hash":"fbddd9bb5f6273cdad3f5a5527a9ec016a6ae4f6251d0c70ea8374e2f635bb69","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinIRysKSpAAbWtAAkwGKkFkqum6VQELwIBgAq+DCcaBAA1oorEGtknOJQUKTwcE4AHdCJw4HpHvdGKROP8gZIoLCYLxGFhGIoGKJtPoABz9WrKVRIZrUVp6aYfdZdCxWADMA0czlGOIm1C8FNmpRoCwMSy4/14MFRa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322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { holder, receipt, recipient } = await Actions.reward.setRecipientSync(config, { recipient: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) console.log('Holder:', holder) // @log: Holder: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 console.log('Recipient:', recipient) // @log: Recipient: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Opt Out of Rewards Set `recipient` to the zero address to opt out from rewards distribution: ```ts twoslash // {"path":"/vercel/path0/site/tempo/actions/reward.setRecipient.md","from":7902,"to":9934} // @twoslash-cache: {"v":1,"hash":"352385a25dd040388468da70eb96fdefa557efcc59a10ea4590405622b87794e","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70TKzsXEaCwqXlUojqsrXKqhotOnp4qyZdFlYAzAOOzqONE9Re075z1AGLBVykMADukigG20+gAHDUFPsGs1qK0TgZfgDSED5JckDcQPY7iM+pUnpgpgYZn4PgsDAkAK5gfhrThwPQAJRgvEYWEYijQAGUMNSADwZRLJAB8QQ6yVSAqyFE4WEczD0ZDgqTOwgAdIjAar6WgmSy2RzudTVQAFOUK0hwfnFJRCiKpY2kCDMRj03na3Ws9lgLk83iqploCmkMAANVCFJgQtyYHE8rgst4MDpjOZnoNvtKUAgvAQBk5ejgnHY0QcyngnFUSY1yM4vz1Xq4CWL4grEAA1opOIQ5LBSJxxGAoJwAYw0IWm32xaRmOJjGBVaUJEpc8hkCA6LGsApSgADPdj3L5ZacYDRX6zmCS5LS/BoNBYTiuTgJR3MTgAcgAAgClM6APQxL876HkshSnjQSyPs+r4ft+4i/owAHsDAAEOBYcDAXkoFcKeKqFk+L5OrBP7/oBKEQWwmG5PEYhFIKSicAAvGeMAXleShBMAuScCW4joakyAURAAAq8BoJYaAALoUNxFZDMI3xKiesk8YJMBLKqjBQJJqS3veQQRDJYA8e4uSuBEuTUbEtbwBSchcMx4gjisNImOq/yau6qb6t6hq8KK1rSlxxk2fWHKpO+1i0OIACsvC8FcvDWFc0jSJUAAiABCMUAEbWFA0jcDFMAAKJQOlvTWGk4g5eImXWKCvRXI06igtwaTvkZPFoO2igRVFABM1hJdYo1jeNE2TVNU29J1ZkWWAe47iA0lrrKQzMKUYoMQAtOk1oLqtIDrbGpQnfKIyFntpobeacCHRQa6/IGwamMJ+BJmg8lwMMtJ1jArJcAOQ4wCQ3qcFAs7iId0llCCMiVPIdQHIgvQwtobR4F5YW+RmqI9IgGJYkM9xIANvT4i8RJvIunwGCEYSRHRtHbRK1ogd8dGdKI8Oo70/R7PUSDo3C7TWhcBNE4MwwuIToKU4SPizLTZLBFgjo4BwGBRHWabeqk2QgFF00m6bZujYbwIVH0A0YpCQtjEcmMIt5DYS1YiOYtLpOIANCveMS7w0KrQTqxAmuYFEPUdmABtG7QQ0jebyem5bPPW6joIDUjUJIDFTvwtQvVgO7ee3CTOK+64sMxLAXzHrhrnCFBhFvu+JGIUJmFHmBXPJC3MHvqqSH0VRMbOTwTf3dWUBaimOM+tSAX0UFsm6z5aD9bQKc72bc0hdHfUfoNw272f437+ZpQXeISCgAEihwGseBjiAriuEAA"} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' await Actions.reward.setRecipientSync(config, { recipient: '0x0000000000000000000000000000000000000000', token: '0x20c0000000000000000000000000000000000000', }) ``` ### Delegate Rewards Set `recipient` to another address to delegate your rewards to them: ```ts twoslash // {"path":"/vercel/path0/site/tempo/actions/reward.setRecipient.md","from":10046,"to":12138} // @twoslash-cache: {"v":1,"hash":"47f5abecdba9b37d942876b7098a742d3423c65e8a06c57e478266e3647d4535","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70TKzsXEaCwqXlUojqsrXKqhotOnp4qyZdFlYAzAOOzqONE9Re075z1AGLBVykMADukigG20+gAHDUFPsGs1qK0TgZfgDSED5JckDcQPY7iM+pUnpgpgYZn4PgsDAkAK5gfhrThwPQAJRgvEYWEYijQAGUMNSADwZRLJAB8QQ6yVSAqyFE4WEczD0ZDgqTOwgAdIjAar6WgmSy2RzudTVQAFOUK0hwfnFJRCiKpY2kCDMRj03na3Ws9lgLk83iqploCmkMAANVCFJgQtyYHE8rgst4MDpjOZnoNvtKUAgvAQBk5ejgnHY0QcyngnFUSY1yM4vz1Xq4CWL4grEAA1opOIQ5LBSJxxGAoJwAYw0IWm32xaRmOJjGBVaUJEpc8hkCA6LGsApSgADPdj3L5ZacYDRX6zmCS5LS/BoNBYTiuTgJR3MTgAcgAAgClM6APQxL876HkshSnjQSyPs+r4ft+4i/owAHsDAAEOBYcDAXkoFcKeKqFk+L5OrBP7/oBKEQWwmG5PEYhFIKSicAAvGeMAXleShBMAuScCW4joakyAURAAAq8BoJYaAALoUNxFZDMI3xKiesk8YJMBLKqjBQJJqS3veQQRDJYA8e4uSuBEuTUbEtbwBSchcMx4gjisNImOq/yau6qb6t6hq8KK1rSlxxk2fWHKpO+1i0OIACsvC8FcvDWFc0jSJUAAiABCMUAEbWFA0jcDFMAAKJQOlvTWGk4g5eImXWKCvRXI06igtwaTvkZPFoO2igRVFABM1hJdYo1jeNE2TVNU29J1ZkWWAe47iA0lrrKQzMKUYoMQAtOk1oLqtIDrbGpQnfKIyFntpobeacCHRQa6/IGwamMJ+BJmg8lwMMtJ1jArJcAOQ4wCQ3qcFAs7iId0llCCMiVPIdQHIgvQwtobR4F5YW+RmqI9IgGJYkM9xIANvT4i8RJvIunwGCEYSRHRtHbRK1ogd8dGdKI8Oo70/R7PUSDo3C7TWhcBNE4MwwuIToKU4SPizLTZLBFgjo4BwGBRHWabeqk2QgFFsXxYlyWpRl2V5QVRWleVlXVbV9WNc1rXtYbwIVH0A0YpCQtjEcmMIt5DYS1YiOYtLpOIANCveMS7w0KrQTqxAmuYFEPUdmABtG7QQ0jdNRfF9NHs817qOggNSNQkgMWB/C1C9WAYd17cJM4jHriwzEsBfMeuGucIUGEW+74kYhQmYUeYFc8kI8we+qpIfRVExs5PBD/d1ZQFqKY4z61IBfRQWybrPloP10VxQlSUpWlWW5flhXFWVFVVTVdUNU1LVtR1XWtmzlfAuJdQFgOsHNMA5lSgXXEEgUAARFBwDWHgMcIBXCuCAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' await Actions.reward.setRecipientSync(config, { recipient: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', token: '0x20c0000000000000000000000000000000000000', }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `reward.setRecipient` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/reward.setRecipient.md","from":12428,"to":12921} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.reward.setRecipient(config, { recipient: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args: { holder, recipient } } = viem_Actions.reward.setRecipient.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/reward.setRecipient.md","from":12948,"to":13196} type ReturnType = { /** Token holder address who set their reward recipient */ holder: Address /** Transaction receipt */ receipt: TransactionReceipt /** Reward recipient address (zero address indicates opt-out) */ recipient: Address } ``` ::: tip Rewards are automatically distributed to the current recipient before changing. This happens during any balance-changing operation (transfers, mints, burns). ::: ## Parameters ### recipient * **Type:** `Address` The reward recipient address. Use zero address to opt out of rewards. ### token * **Type:** `Address` The TIP20 token address. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`reward.setRecipient`](https://viem.sh/tempo/actions/reward.setRecipient) --- --- url: /tempo/hooks/reward.useClaim.md --- # `reward.useClaim` Claims accumulated rewards for the caller. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/reward.useClaim.md","from":118,"to":6057} // @twoslash-cache: {"v":1,"hash":"9473592640bf3f33afde9fa50fd54b096479002e7102d5dd65de5dc109750e9f","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6INYQYCKc1jKiLADKGGDWiDx8ggB0pDAA7uJQqQCucDAAwlGx8dapAEo6eaRgACpeADxFoQBmjAoUnHlg/JCZYAB8/iLiugAsAMyy8koqLhri2kGR0cxxCf4mZkgATDZ2pA5OSABs7p44eIQk5BqBTKzsXAaCo5q6qurGc8pqSy0OjwbyMO3MB2CRxOfkQAEYAByXaheG6+e4BehPNgcTgZbKkKAfcbnOGzRT/RBnQErPD4nLbUwQw72RywvYTZGYa56W5+B5YvRtXqORihHqFErrTbWFrtTrdXr9CCDIYACiw9mYOjIcAA/ElQeksjl8pLShtyqkAApanWkOBysAdLo9PoDYYASkNKTgxoJuQKxQtMqqNTqjRwTpdivdKuGAB0wGBRNq4JrrDAJcHpeV/FAINYEHo3pw2uwIhbTApOA5rHlmHkojQoHiTYS4LWwK3sow0NWyxWQs7GKRmKJ+6FUv4xApi8hkCA6KmsHJ/AADTdoOC0JMsHFcYDJQycVxl0gQZicADk2QUzEYAHoaM9r0mk8KEpOwJwAIJYLA1U9ThgCTTgIlCcIj0bMQaCSNYygSU9OAAXmPNJ6UJM0c0Q6wgPfH82zQWofzVMDwM4JoACM8jQNBxVCEpGGsfgUOAIDUKGStcwSNVQMIijOHo/h5CSa8LFoPYLGsCxZLk+SFMUpTlLhN8BNPT1XCGcjBKlFhOGqAM4B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G3W3uXTVwg0V/WwjbLpQhCwDYgvAgR9TIRtAXhXi3hS4PjPj+ZsBqRKFhKSXP5GgDTYRlQyj4RsHvZFApY1zLzMYjoVVsBhCK5Bg2yy2kRxIKDUbmT0QawmAsTdArbsJUQPjlwJTR7aUVDLJ8TkTnJgBiQ3LSSPL90D0WCI62TR7nl5qrn1Ay03XG4K3XmSWpBZV6jGhfWpCM3F0s34DR7+Bs6iBICgCBDyD0qhB4DbggCuCuBAA=="} import { Hooks } from 'wagmi/tempo' const claimSync = Hooks.reward.useClaimSync() // Call `mutate` in response to user action (e.g. button click, form submission) claimSync.mutate({ token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', claimSync.data?.receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `reward.claim` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/reward.useClaim.md","from":6397,"to":6757} import { Hooks } from 'wagmi/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const claim = Hooks.reward.useClaim() const { data: receipt } = useWaitForTransactionReceipt({ hash: claim.data }) // Call `mutate` in response to user action (e.g. button click, form submission) claim.mutate({ token: '0x20c0000000000000000000000000000000000000', }) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `reward.claim` Return Type](/tempo/actions/reward.claim#return-type) ### mutate/mutateAsync See [Wagmi Action `reward.claim` Parameters](/tempo/actions/reward.claim#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`reward.claim`](/tempo/actions/reward.claim) --- --- url: /tempo/hooks/reward.useDistribute.md --- # `reward.useDistribute` Distributes tokens to opted-in holders. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/reward.useDistribute.md","from":120,"to":6547} // @twoslash-cache: {"v":1,"hash":"59eb218042188d5a1a816d7393c55eedf583a5a887465c49947319b9a1e69626","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUoiaicACUnABmAK5gjowQYJxY4nAwAKLKZME6+GSInCKkpgoUnAmMaAD8xQA6IADuMIxNnAA+nE0Kre0gkcUARowKpmgNYCxsHGkZ2bnkVFAQ1gh6AMIpJBxwnKIlaGWKnKQwWOeZYGJoyakQMZwFZJxoEJxgccxkjNZhnH6ADoplMALScAAiazgxXwaDQWFhAHpkURGDBmEC4Phkat1si4ncTHd4Mj0qRMjlCstqKIFBtkMgQHRRKw5P4ZuwuMB5pTFjTOK5YqQIMxOABydGYiWgsAUqlLYISgAsACYLBLIlNUZx1RYDYajcajWAQABdc3CTS6FXqYzyJQqRAARisdK0OjwCoFflkpnMLpsdlIDicUncnhweEIu38NHoeGsKREnCgjFKjGGRJgAGUMIligZBEDzs1xFAgXFMpCM8cszn84kgQAlHRxUhgAAqXgAPNswDExpUEvxIM0wAA+fwicS6ADs89kjuUSBdKo04m0QXTmezNCb1n8JjMSAAzMH7I4/IgAGyR6heGO+WkJoJcubFoyziQuDcOxRV0Qe1NG3PAv2PANz0vUNr2cNUzwfTBoz0WM/QCRM9A/LgywrGcbTXA1l0A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8S0GsPAgiG4guSmGmWmgpGuWtAVGsEdGjg/KHgpKUwVG+4DqTcOxFAVi0wRKZxCwIEF0F2g0VSsOAieiM8d0eTZ0BiJTPAJQgyl0Iy9dFiZmILVeKyjecUgBNBKudyAyeuH6CuNBIBYKJBR+eSUcbuRzdSu0LS4ef8QO8eZONBEOsOkyzTBCKOvTIuPdLePtPeNMJle6cuqeDOzsMBdNJKboBIYhAMWhEAX9LLJhd7LgNpDFLpbFK4WLEgKqRlMQPKGahRE5dqOUKYbLCetFb1TFARG/eAee/FJew4Tg+FMZDeqMre8eiISelVCJGew+8fBe1u5e8+45KDK+uUbeu+3e6erFZ+4+xeplFei+9e62z2idHOX21zJAEu3SvAU+yu/zG8M8SOnTDtHdULQzJukzFupdcmkdcYG4QhAemAEhYZDLBKsewAwdEmFBNOqhtS88W8StP2itUeBdQhhgNOQMKu5iG8FUFUOusQBQfwXUoO8HfO88ecUtOBywXdIIXaehoh8mOzY0M0PhtcDOauliJeUOZMWAJgavSad6fYVjdjeaekJaFaTENgDaRjI9X0ORSxuaTjGUMU3MxhyeZ6N6L8WuCsFOjuw8AGKM3UTYIA2JX2IvUwf2NgJZJooyClThMGCnBQLPHWVIN7P4fgSoP6tFYYJaCJe4A2eOzu2tYIPGQmVR4dFTZUdRrUKWM6LzCzSUazCwYWDR7p40SWKYWWLx4mjmlRrmzw8ppuU+2oIEHhg2fwGyUQJAUAQIeQSalIPAEaEAVwVwIAA"} import { Hooks } from 'wagmi/tempo' import { parseEther } from 'viem' const distributeSync = Hooks.reward.useDistributeSync() // Call `mutate` in response to user action (e.g. button click, form submission) distributeSync.mutate({ amount: parseEther('1000'), token: '0x20c0000000000000000000000000000000000000', }) console.log('Amount:', distributeSync.data?.amount) // @log: Amount: 1000000000000000000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `reward.distribute` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/reward.useDistribute.md","from":6892,"to":7487} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { parseEther } from 'viem' import { useWaitForTransactionReceipt } from 'wagmi' const distribute = Hooks.reward.useDistribute() const { data: receipt } = useWaitForTransactionReceipt({ hash: distribute.data }) // Call `mutate` in response to user action (e.g. button click, form submission) distribute.mutate({ amount: parseEther('1000'), token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const { args: { funder, amount } } = Actions.reward.distribute.extractEvent(receipt.logs) } ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `reward.distribute` Return Type](/tempo/actions/reward.distribute#return-type) ### mutate/mutateAsync See [Wagmi Action `reward.distribute` Parameters](/tempo/actions/reward.distribute#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`reward.distribute`](/tempo/actions/reward.distribute) --- --- url: /tempo/hooks/reward.useSetRecipient.md --- # `reward.useSetRecipient` Sets or changes the reward recipient for a token holder. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/reward.useSetRecipient.md","from":139,"to":8799} // @twoslash-cache: {"v":1,"hash":"6ec8763ed98425976535a0643a503c69b548f0ee8e4e50dad055f48586543f87","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwF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NVEJAzIJlTeTMVwMdBCCwAKQwIDCE7yoj9Afwf4QCFvBAjgR4cbAKCKB1t5TVPq6QAIk6Bd4IxI+DvdiEMWjx+Q0En8RhCNlMAC0j6kQbjCmE7gvBxEZoNZAoB6yNRmo/RRgNJBGBsVZuIEF+NtDwL6DXoOQDFGpH4jGoWIKUWgMylZTspOU3KXlPykFTCpRU4qSVNKllTypVAiqZVKqnVRFROIUaV1ABFSjpRfUdQ+oRYHKGuA8C6PPSv+F4Cx1EApeSIQ7xyDI07QSufTqQDwKk8/c9A7oWdV6H9DnQ1MPAv4H9iiAkAoAQIPIG7ShA8A94EAK4FcBAA=="} import { Hooks } from 'wagmi/tempo' const setRecipientSync = Hooks.reward.useSetRecipientSync() // Call `mutate` in response to user action (e.g. button click, form submission) setRecipientSync.mutate({ recipient: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) console.log('Holder:', setRecipientSync.data?.holder) // @log: Holder: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 console.log('Recipient:', setRecipientSync.data?.recipient) // @log: Recipient: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `reward.setRecipient` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/reward.useSetRecipient.md","from":9146,"to":9747} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const setRecipient = Hooks.reward.useSetRecipient() const { data: receipt } = useWaitForTransactionReceipt({ hash: setRecipient.data }) // Call `mutate` in response to user action (e.g. button click, form submission) setRecipient.mutate({ recipient: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const { args: { holder, recipient } } = Actions.reward.setRecipient.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `reward.setRecipient` Return Type](/tempo/actions/reward.setRecipient#return-type) ### mutate/mutateAsync See [Wagmi Action `reward.setRecipient` Parameters](/tempo/actions/reward.setRecipient#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`reward.setRecipient`](/tempo/actions/reward.setRecipient) --- --- url: /tempo/hooks/reward.useUserRewardInfo.md --- # `reward.useUserRewardInfo` Gets reward information for a specific account. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/reward.useUserRewardInfo.md","from":132,"to":9792} // @twoslash-cache: {"v":1,"hash":"b99d265574b0d65166a26926a44acc97a9953933b2ed8abd0b6af7abb3256072","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6INYQYCKcUKJiiJzAADpgnEmcpDAA7uJQAEow1oxYjPJoMQAGFrQAJMAipKYKriUA3AnJKemZAApkACoC8jEARowKpmjNicmpGaRQAEKiMqJg1jCDw6PjrpwAPpwArmCwAGamMFD+UBDWCHrd+DCci+Fwe9YrcHBHezIyGG1wEBkJCgESiok4R3YnGUDwAjnsyBgAHT+ETiXQAFnUxnkShUiAxGnE2iCkTE/hMZiQACYbHZSA4nEgABzuT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Qg+EhAK4FcBAA"} import { Hooks } from 'wagmi/tempo' const { data } = Hooks.reward.useUserRewardInfo({ account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) console.log('Reward recipient:', data?.rewardRecipient) // @log: Reward recipient: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb console.log('Reward balance:', data?.rewardBalance) // @log: Reward balance: 1000000000000000000n console.log('Reward per token:', data?.rewardPerToken) // @log: Reward per token: 385802469135802469135n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `reward.getUserRewardInfo` Return Type](/tempo/actions/reward.getUserRewardInfo#return-type) ## Parameters See [Wagmi Action `reward.getUserRewardInfo` Parameters](/tempo/actions/reward.getUserRewardInfo#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`reward.getUserRewardInfo`](/tempo/actions/reward.getUserRewardInfo) --- --- url: /tempo/hooks/reward.useWatchRewardDistributed.md --- # `reward.useWatchRewardDistributed` Watches for reward distributed events. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/reward.useWatchRewardDistributed.md","from":131,"to":4875} // @twoslash-cache: {"v":1,"hash":"802abf398fe8f0c7b5d0b17bdfce85c29d28ef5e8d8bbd8b8bebd7ceec8598b4","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4ro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i/tempo' Hooks.reward.useWatchRewardDistributed({ onRewardDistributed: (args, log) => { console.log('args:', args) }, token: '0x20c0000000000000000000000000000000000000', }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `reward.watchRewardDistributed` Parameters](/tempo/actions/reward.watchRewardDistributed#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`reward.distribute`](/tempo/actions/reward.distribute) * [`reward.watchRewardDistributed`](/tempo/actions/reward.watchRewardDistributed) --- --- url: /tempo/hooks/reward.useWatchRewardRecipientSet.md --- # `reward.useWatchRewardRecipientSet` Watches for reward recipient set events when token holders change their reward recipient. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/reward.useWatchRewardRecipientSet.md","from":183,"to":4993} // @twoslash-cache: {"v":1,"hash":"28f0780d1d18e58ea2ba233fff27ee55459d9d43aeb92be79062c38ef7f6b813","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXKQwAO7iUFGaugAssUmKykgAbBqZOnjtXaQ9eWZIRSC29o5+iGNV1F61vg0B9HgAZgCuYI6MEGCcZ3AwAOqiaLYASp3dH9aMWIzyaAAyjoADwAYRuJ0YCgAfAAKLD2Zg6MhwAD8iE4wAAOrdOPi1qYAJJQDGcMBnZgAIzInAAPncwLAoWYoABuXH4/GZ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SjLihUYvJqpZLybVzioACy/oRUAUM4mQlI0MBCSqbCja/SIEGSWSeq+UjAxMXASkg4jaaaM6LA4g1ikh0h9mN0AY4WX0RUNwEGMRRSF06BIgmSf2u+J204Mi6U8i+CVyNyBGJwcIsQjYK6tK9K36YA8QwK26K4ZwiKbR960hu6bRsQy2OYJwv4sQAqaAWKIOcIeqN0WgvhNhlanaiIaSZySi1ym2Mgv4X6LwFSiBtK66OBMAW6oKFhu6kKHKXKR6vKmUWxkxWK2KWxuxaALxpM60Yq+u8GcA/ueihK505uqgTuEeyGVEFwaAmIjGHGIEYJ64b+1hH+sJEJnA6goy9h/utSoJ/xEJ10SJ8J9eSJmIqJlGYmreaMT0o6c+4o9xLx+xNKa69Km6rkzK5xe6VxJBx6KK9x56zx7A36rxfJLw7xQEz6Jk76M4pgLxv6YBnkSA3kDMpgCk/gRAFgv400apI0NBDMWcVWKwcgIwQCkwPMQQYE7B5gXB9cZ8q8TcHguw18iCd8whXcRMvcxs/c4Yg8V2aoc8SOyok8ScZ0yJI8vpE8yMv8ug00/Q6Q+pBcnBRpu8IA+8ECcZdcEsjcl8tpcsCCbcQheAas6mZAmAzYeEUcYAhEnoY8boXsoY5ClCkqVCRIFMg0iipZN0UAUARaRgjMEZqg2cjBaQ8ZoCJZ8gZp4wUCPBywrg9MVEsAzQPi0UNUcU8YiYyUqU6UWUMAOUT0NU7WakDUDwf0785cgZHUXUZcrUn8d4VYPI1syEqE7YXUW0IJ5SSUT410t0eI90eIw5vUyUA0Q0U0gFQFQFc0yMZhIA3cogSAoAgQ8gvCNweAoUIArgrgQAA=="} import { Hooks } from 'wagmi/tempo' Hooks.reward.useWatchRewardRecipientSet({ onRewardRecipientSet: (args, log) => { console.log('args:', args) }, token: '0x20c0000000000000000000000000000000000000', }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `reward.watchRewardRecipientSet` Parameters](/tempo/actions/reward.watchRewardRecipientSet#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`reward.setRecipient`](/tempo/actions/reward.setRecipient) * [`reward.watchRewardRecipientSet`](/tempo/actions/reward.watchRewardRecipientSet) --- --- url: /tempo/actions/reward.watchRewardDistributed.md --- # `reward.watchRewardDistributed` Watches for reward distributed events. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/reward.watchRewardDistributed.md","from":129,"to":5308} // @twoslash-cache: {"v":1,"hash":"468089c03999f8f886d48f18ae80edff227a04649f0e95be6e2f75637d974e5d","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qQDqW/YZYGhD/ACiJMcASnorpGAAKl6l5VKI6rK1yqoaLTp6eDWm22ankFisAGYBo5nKNGhNqM8DDM/NQAkxWOwuEZBMIXtp9AAOT4Kb4NGraNp4HEmLrgpBQkD2GEjPrwjyIqbI3xzNELAz5LGcUgwTakKD4ioyGqk+pIZrUVoAgwisUSsE9RCM5mnVmIABMlQRmC5PlmpRo/JACTW/FxnGB9huaoAIowxKRGAAjFY0KAAHiOWQAfEEOslUkHkhROFhHMw9GQ4KkacIAHSqyRQNOO/DOrNuj3e30wbMABXjidIcEDxSUwYiewO+COJ2GF0UaBuaDujy8uTA4gTcDjvBgDub+fFh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T4Eg0wIQpVX05BBsggC1WhYjOwo0R0n9kjDV+iLs5A0xIMtgmkCC2UT0uVz04V3CBUUU0Bb0RV71xVridi31ri7i0BgTLp1p3NYNkCPwHcycYgD4wptY/d2CiM4TjhUgRMqMYxUTqUQCN9UhsTUg4EllfCdMGlBMEICTVpsS185NPD8T940TOAiSostM7d/El1xwPl/jgSHjWUIJniz1LxeV3jr0hU70xVMJ/jpUSUgT2AoMQS5StgwTuogNtwwNxwINFTwYrwWg0CUAHwJFblcAqAiBrA0xehzSyouDJYpR+sO4BCGhGQn4DBUENQrBxDMFu5pZv4ZDph8F5Dh5AEx4W0XYRod4Z454F5l5V5Zx14t4d4hwGTD5nET5jhz5L4bTK5pA5YEFH5hDn5uoxD34vT9RtZcE/S5C+QAELYyBMAogspcowAozaAV4CcN4mF45fUHgy0yxip05Gy1ooAoAa1TAeCe5ehbAvg5REBxDnTqAcpFA0EahPS9QfTORZD2Yh4VY+ZgpcxOoI4rDo5qYxyDRpB+gpzBCSZlYgRmw0FehzyVzGZrBXBMYYhYAMQxY2IIphBOJuJEI+JMJNImIfxWJ7kLpoIkYeI0w2CsgRJHcdybyQQwp2Ioo1RYowF3YW4/RUphZ0pjIm4CwIEUp1pfYBowzvJlIBkiMJ5VpwTNoGp+y8pEJCpipSoap2KOL2L6ptpBtqsQ5AJSAbMspIJcx5FchEL7APJShXpxAkBQAAhFAJEhA8ALwQBXBXAgA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.reward.watchRewardDistributed(config, { onRewardDistributed(args, log) { console.log('args:', args) }, token: '0x20c0000000000000000000000000000000000000', }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onRewardDistributed * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/reward.watchRewardDistributed.md","from":5523,"to":5720} declare function onRewardDistributed(args: Args, log: Log): void type Args = { /** Total amount distributed */ amount: bigint /** Address that funded the distribution */ funder: Address } ``` Callback to invoke when a reward is distributed. ### token * **Type:** `Address` Address of the TIP-20 token to watch. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/reward.watchRewardDistributed.md","from":5897,"to":5978} type Args = { /** Filter by funder address */ funder?: Address | Address[] } ``` Optional filters to narrow down events by funder address. ## Viem * [`reward.watchRewardDistributed`](https://viem.sh/tempo/actions/reward.watchRewardDistributed) --- --- url: /tempo/actions/reward.watchRewardRecipientSet.md --- # `reward.watchRewardRecipientSet` Watches for reward recipient set events when token holders change their reward recipient. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/reward.watchRewardRecipientSet.md","from":181,"to":5370} // @twoslash-cache: {"v":1,"hash":"7c5c4a80757b69fb0cc9e78c15e065ab4f7f1e8dca7ffc4ca8ae3da467de30df","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qQDqW/YZYGhD/ACiJMcASnorpGAAKl6l5VKI6rK1yqoaLTp6eDWm22ankFisAGYBo5nKNGhNqM8DDM/NQAkxWOwuEZBMIXtp9AAOT4Kb4NGraNp4HEmLrgpBQkD2GEjPrwjyIqbI3xzNELAz5LGcUgwTakKD4ioyGqk+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JXheJsm+PxpClatUoZt0PspwAALKSICAvhBY6ArDxjZJzILJjixjlKfLRiVLVJmLCzVhcAWqfLNJ9rSIsCSC+K6G6AjJeJzpZZQBVK4jYbFF1ENLwwCDdgQxMKhArDrhm7oTGLdr/KAqsYJBBAQgRCXr8qUFwZgDqCor3rdArDEpzFAaBYnZzEQiHaKYJCpgQhKpoA0pDZBCOqtDJFehJq9pzqZGWojEXZyCpiwZbCdLkH8rXrCp3rop+GSq4poAvqypvpkoPGHE0q0oPHPFoCQlXQbQRCaqEYfjO7k4xBrDu6cB6xB58HkYonHCpCiZubRg4loBQEBGy5EmpByGbIhE6btJF4ITklrREkkn77knok67UmYGG4O5gBboH5vggmQmvF8oQQfG3qXhio/FPrSqvryqYQglfoQnsBwZQlKlbAwndRgZbhQZjgwaqkQxXgtA4EoAPhm4vKEEgBEDWCpi9DWllSCEyxSgDYKiyikw4L/B4L9QyFyEDwsgszywgLcjmhqFTyvRVhzzdQLzeRLwTSrzny0DbxE77xHwnwihdy4mCIXyJk3zJn3zoI3YkhYKEKKjulfzdRenyF6j6iGzKHGyUJ8g8zuLWyYBRBZS5RgBxkJlXxJk8LJwhoPB1pljFTZxtnrRQBQAtqmDCHDzyxKzNzemfwGCtmKAyE1D/wKEjw1kUJBn1mLBBRAjNidQxyOHxzqh4yOn6jSCMgukSHFlqwgD7kggyG9Cvxrl6jWCuC4wxCwAYiSxsQRTCCcTcSIR8SYSaRMQ/isRvKXTQRow8Spi8FZAiQu6CzBQ5hhTsRRRqixTwKexpnhypRizpTGQdz5iILdyuzL7TRRCjTKSs7kbzxrSwlbQNTDl5SISFTFSlQ1TcU8XcX1Q7RDbVYRyASkA2ZZSQQ5jXy5APn2AeSlBvTiBICgABCKBm5CB4AXggCuCuBAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.reward.watchRewardRecipientSet(config, { onRewardRecipientSet(args, log) { console.log('args:', args) }, token: '0x20c0000000000000000000000000000000000000', }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onRewardRecipientSet * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/reward.watchRewardRecipientSet.md","from":5586,"to":5840} declare function onRewardRecipientSet(args: Args, log: Log): void type Args = { /** Token holder address who set their reward recipient */ holder: Address /** New reward recipient address (zero address indicates opt-out) */ recipient: Address } ``` Callback to invoke when a reward recipient is set. ### token * **Type:** `Address` Address of the TIP-20 token to watch. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/reward.watchRewardRecipientSet.md","from":6019,"to":6161} type Args = { /** Filter events by holder address */ holder?: Address /** Filter events by recipient address */ recipient?: Address } ``` Optional filters for the event. ## Viem * [`reward.watchRewardRecipientSet`](https://viem.sh/tempo/actions/reward.watchRewardRecipientSet) --- --- url: /tempo/actions/token.approve.md --- # `token.approve` Approves a spender to transfer TIP-20 tokens on behalf of the caller. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.approve.md","from":144,"to":6264} // @twoslash-cache: {"v":1,"hash":"ac90d56fef4b8b0bb0fdd99d1f3d9e38719b2c463becd75cdc590e023c1e0813","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScAGYArmD8gmCcWJJwMACqYIxocEFEobEwiJxipBZKFJywvCyhcCVgscwARmQRJS2MShZoADrZrOxcq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tZk1BIXIFCE7nTIxhhZiFVvLrVvhcrqrs1urm1lrgJfRb1gJcJWgGpXCAGJENCMHubKHtvMIDoktBEf+DsbCZ8TqAWL/JwFXonlUFZScHqUuaiA5ctIBL3tlpCckZHoqK5YgEiq5U5WyQ2NZe5Tfs5v0LaX0VvLzgLvxdSEJewM7mgKJRVuJbLtVlJQFjJQ7GrtGe1nFkpfrqlqpUlXTBpVpdbizPbn8I7mVWcDrKyF8gbN7juCyEQNYFCP8F1daMmQmmmfqDYjaj6JRGmngGRgWcSm6oZKhJ6kokyoWhuIZW+NtEeP9FQgdNtN0veLtFzNTCtR+I1amUZP+MmlYnarmTQjBBSnBFNS4jShRNkuZAWr6gYH4v6mykEhQntEkAABLhD4DNStQdT+FKA9TbV4D/UkgbJ8l/rrXUwWppnmJZk+gAQ5nCKDx7VnBQ1qCpJ3WcRyIKRPVNUsi5HjVl6I1GTqBDVxJIC2CLUGC7VUIMkkglCtT/D6jGT/i9jqBtjSDWDiAtC8CwDRAc1c08180C1C0i1i26jc28382C3C1yyy3y2S1K0i2TVTjsT3WGQKIcIFiwBMCAoZxRTZwewKj16Fxxa9xpwm2ihkrm25yW3XJ22GK2x5Tgp5xQjxk1wwqhGihXVcAygHxHxcBm3nxaRXy3TiL3R3w1wPzfx9rWWO06iAhQj/hIq9jLwDSOrcpKj8qCrCqiriqSrSqyryqKrKqqoapao6p6oGrGqmpfwbSxRgCvytThqxrd0922gt0gJbzeXwmKhM37UOCs1IpB0xTw3Y0A2bwsi4LiBICgABBQxJB4DMiuCuBAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { config } from './config' const { receipt } = await Actions.token.approveSync(config, { amount: parseUnits('10.5', 6), spender: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.approve` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/token.approve.md","from":6607,"to":7131} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.token.approve(config, { amount: parseUnits('10.5', 6), spender: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args } = viem_Actions.token.approve.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.approve.md","from":7158,"to":7395} type ReturnType = { /** Address of the token owner */ owner: Address /** Address of the spender */ spender: Address /** Amount of tokens approved */ amount: bigint /** Transaction receipt */ receipt: TransactionReceipt } ``` ## Parameters ### amount * **Type:** `bigint` Amount of tokens to approve. ### spender * **Type:** `Address` Address of the spender. ### token * **Type:** `Address | bigint` Address or ID of the TIP-20 token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`token.approve`](https://viem.sh/tempo/actions/token.approve) --- --- url: /tempo/actions/token.burn.md --- # `token.burn` Burns TIP-20 tokens from the caller's balance. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.burn.md","from":118,"to":5918} // @twoslash-cache: {"v":1,"hash":"e5eb311ca3488bbee0e7931eefae4e3f14d1d9b3f00dad2aa580098254b3ae39","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScAGYArmD8gmCcWJJwMACqYIxocEFEobEwiJxipBZKFJywvCyhcCVgscwARmQRJS2MShZoADrZrOxcqaTpWTmmUBC8CAYAsrFyAljm8JzipWjlypykMFj76WASxskQ0RucTa1knC0YVz0kyXRsliecF/fhMJwAjNZOEFAW8hIo0BEAHQDAYAWk4ABEZg1OPg0GgsA0APTYoiMGDMKFwfDY6azbGxATmATwbGjcbZXKUajiJRzZDIEB0cSsBQslhsDicYApNKZJlwTiuGKkCDMTgAcnxhMVsLADIlkyCioALAAmayKqrSCIDXGcA3Wa0221gEAAXQdom0+l1mjMihUakQgK0kl0gU1E2Z8gsVn+dgcpCcNHIiGk7k8ODwhBI5H89DwITCkU4vBMXALYGi3RKAGEhKWlANBcN81Xuiyx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1q1FMG1uoc1C1S1K1a1B1R1O1p1FMflD4AV8YeCkCBYsATASytsvkUojsmyxseGCc1sr1ooHyH1csWyqoYSQsDC3QGyzsioUIpJAcuyWBooPl+4sszcrcXA71XcskQUIUi0vAA8AcQ89URiLUgNOogIUIj4xyvYZcycRK888K1giKaKLNrNNoK8YA1c2xAFuOOofUA0hk41SVxyyNaA/ko1Qg9VNcLI984gSAoAAQigyqQgeAzIrgrgQAA=="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { config } from './config' const { receipt } = await Actions.token.burnSync(config, { amount: parseUnits('10.5', 6), token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.burn` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/token.burn.md","from":6258,"to":6719} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.token.burn(config, { amount: parseUnits('10.5', 6), token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args } = viem_Actions.token.burn.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.burn.md","from":6746,"to":6934} type ReturnType = { /** Amount of tokens burned */ amount: bigint /** Address tokens were burned from */ from: Address /** Transaction receipt */ receipt: TransactionReceipt } ``` ## Parameters ### amount * **Type:** `bigint` Amount of tokens to burn. ### memo (optional) * **Type:** `Hex` Memo to include in the transfer. ### token * **Type:** `Address | bigint` Address or ID of the TIP-20 token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`token.burn`](https://viem.sh/tempo/actions/token.burn) --- --- url: /tempo/actions/token.burnBlocked.md --- # `token.burnBlocked` Burns TIP-20 tokens from a blocked address. Requires the `BURN_BLOCKED` role. [Learn more about token roles](https://docs.tempo.xyz/protocol/tip403/spec) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.burnBlocked.md","from":232,"to":6337} // @twoslash-cache: {"v":1,"hash":"4c6f4c6c8a9a3012b0d32258ab141ad46f5a27fb53da72d2d92aecbf86789fa0","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT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EBd1vPCFKDdLEByH4KEHTSSRgxYECOHRYySzX2iCCDIgw0dOWUF3NzAHUDsx0AlwsFiG8zQu1yrIOTQrIgC16GiChDIkV1CwHiCEdx3KKmrw2DuxJzFBPOZhgvan4LkChFN3NzQEI2QsxBy2F3yywvF0l1K2lwqzlx2UCKovCy4t4uxiUtKwDEiFmUGIVm9yHmEHEUmj8P/EWJBP90VALGPghPDyqDMpODVJnJKGsqmkAmPxi1bx0vbxMocsQD+QctsvhIbHMqctTxcv6FNJaMHkZz+B0y4p4vYD4oEqyyEsF1y1Eoc3Es1il2DMq382ivqzC0UtiuUoKtUp0DzFN3PWNxLCKqSFFlZDOUlntx3BZCIGsChH+FautGjM9TjP1A9FhR9GUS1QMDQwzPhXDUMlQiNWjXxSsjTN0rQQ/CPGQUpnWiWnKXvBWhQTskWg/BqtjKMn/B9T6o0BTNoW2pghDQjCzLGs4QonCQLOmosXNVsSiArk2qSAAAlwh8AOoupepXClBBo1q8BPqSR2liZYZXrKZlU4zewsyjqgCTqNIlqg4Qa1BAlMz9VOEFI7qDBTkWQUi8BhquqjJ1BergIfQsyCUDANrKY38SQSgup/h9RjJDF1A2xpBrBxAWheBYBogmaWbew2aOauaebOZ+bdRWb2bObubebxbJbhaZbOYRqfVrr4xuEiECxYAmBbkA4EopQQ4Xk3Z/MS4/YdbRQkV9bDZXlVRilVZZFuhnkw5FQoRwzk4PlvDRQzquAZRx5J4uA9akog154GEzoLoEg15k4N5D5q1zKLadRAQoR/w/lewu5RoyVr5aAaV9Q6UGUmUWU2UOUuUeU+UBUhURUxUJUpUZV5UWgD5L4g0M6HU3Vm6W7bQ6775B4oiTKabUEHB6a/kvakpkazhUaB4WQIFxAkBQAAhFBm0hA8BmRXBXAgA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { config } from './config' const { receipt } = await Actions.token.burnBlockedSync(config, { amount: parseUnits('10.5', 6), from: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.burnBlocked` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/token.burnBlocked.md","from":6684,"to":7213} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.token.burnBlocked(config, { amount: parseUnits('10.5', 6), from: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args } = viem_Actions.token.burnBlocked.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.burnBlocked.md","from":7240,"to":7428} type ReturnType = { /** Amount of tokens burned */ amount: bigint /** Address tokens were burned from */ from: Address /** Transaction receipt */ receipt: TransactionReceipt } ``` ## Parameters ### amount * **Type:** `bigint` Amount of tokens to burn. ### from * **Type:** `Address` Address to burn tokens from. ### token * **Type:** `Address | bigint` Address or ID of the TIP-20 token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`token.burnBlocked`](https://viem.sh/tempo/actions/token.burnBlocked) --- --- url: /tempo/actions/token.changeTransferPolicy.md --- # `token.changeTransferPolicy` Changes the transfer policy for a TIP-20 token. Requires the default admin role. [Learn more about transfer policies](https://docs.tempo.xyz/protocol/tip403/spec) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.changeTransferPolicy.md","from":250,"to":5483} // @twoslash-cache: {"v":1,"hash":"782fbb9e3637fb97aaa75c17e78a39fa8f7ff7754db53d7b3ab76722d9c43fad","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinKQwvDCMWGipACpDwsOCYABKaxtbpeVSiAAc/bXKqhotOnp4q+ubDPIWVgDMA0czlGNwm1C8018c2oASYrHYXCMR1MV300lkD3qz2orTeBiRJi6vyQAJA9iBIyQACZ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PFZUjEcWGXDB0NcX5VyCSFLC4C4nZXCA9SrhYEkDESYNU0SSzTwigCgGEj4PpW8LUl8O+i3DEGEgGyEEAVCENBwVoVBwYUmWmVbwSCCD+FCU/yhW/23TAHUH2R0FOQsENFuXKIXWYN7XKL+BxT3ASETD+HHQJTkCyyCHPVaCsPjWNUzTBwcNyWKSmQGzkETC3V7HiRKOijbThQRWqJ7T7XgAHWgOHWxWmO6MJWmLmLQCOOZlaEiApXvW8hl3+xiGND+k4HFB10QxfTfVuK1lSAwz/XDDeLQGbyIwP1SB+NSElGKVo3oyiS9yBMTx+L+MDzbyBIeLZzBLAApnenLSrX7D2KOIWMhSWO/xWK7TWORTOU2MHQxR2MeT2InQ+UOPYG3WOLpN7FOJ0BDjEiUQ3USEZLOzshaHvxQBcjwX6VKCIGsETF6DFO3mQITnbm+3uFNnTlJBwOtmCQILHndlBDIPpBLh1BnkWE+mVlPAImkhBhOBPAuGlOuCpHFEvnlKwJvgMANPNLMGJFuDVILj+D+Ffl9mZHLjwErmrjIEXgVgOBNIAAlwh8ABwhxRxPtlBpwoFwI8Bwy4BXEIAEg4JGJdoQyztT59AaRLYr4O57TqBjSztky1AfhFRCDBhiCkBKhegvSJAlBSgMc8AVSLS8y7hU4xQkAu5fSDBvwZIHAUzUghxeh0DKhrT1AbhpBrBxAtxeBYAEhxy/hJzGhpzZz5zFyDIVy1yNy5yFylzdypyZyDztyEgR4hQ3SSDXB9YYhYA4RY4jpgYzsOoypEpcMqpHl1oIAmoeVnzGZSoupyokpEx4CI5hpZdlhApHSuA4p/pAZEQTSxZl5IZUc7ZYYAJ4ZEYI5kZ5xB51xNxOBiZcZUZFB0YN5rAt4j4aLaL94cYXostwTAkvdByTSh8RzE9YLkxSyjhyystSh+ZxAkBQAAhFA8EhAZQEBXBXAgA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { receipt } = await Actions.token.changeTransferPolicySync(config, { policyId: 1n, token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.changeTransferPolicy` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/token.changeTransferPolicy.md","from":5839,"to":6281} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.token.changeTransferPolicy(config, { policyId: 1n, token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args } = viem_Actions.token.changeTransferPolicy.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.changeTransferPolicy.md","from":6308,"to":6510} type ReturnType = { /** ID of the new transfer policy */ newPolicyId: bigint /** Transaction receipt */ receipt: TransactionReceipt /** Address that updated the policy */ updater: Address } ``` ## Parameters ### policyId * **Type:** `bigint` New transfer policy ID. ### token * **Type:** `Address | bigint` Address or ID of the TIP-20 token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`token.changeTransferPolicy`](https://viem.sh/tempo/actions/token.changeTransferPolicy) --- --- url: /tempo/actions/token.create.md --- # `token.create` Creates a new TIP-20 token, and assigns the admin role to the calling account. [Learn more](https://docs.tempo.xyz/protocol/tip20/overview) ## Usage Use the `token.create` action on the Wagmi `config` to create and deploy a new TIP-20 token. ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.create.md","from":307,"to":9752} // @twoslash-cache: {"v":1,"hash":"bac950d77bf219845f78904458b22c83c87e562f6ef3fc715d1a2f1ce5643b37","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinOJQzBapAAbWtAAkwGKkFkqum6XlUogAHP21yqpIAKwtOnp4q+tgXRZWAMwDjmcoyuE2oXmmvjm1ACi1inFIMF4MEYWDQqQAKkNhMNBGAAEqI5Go0pQCC8BAGTHibH8XHwwkotAAOnO2n0Vyu8jqD0QNW0bTwCKRjO+PUQ/xA9kBIz6j1BmCmBhmfmhCwMSy4aAg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bR0iVyjYelY2cEeNjGzABJsLSQZJ6hm3PhqsYyB3dYQmXC4Bti2B7UtmdRa4VtbyGPB8ljzLInlTaH5V2p+HvbfQ22h/FsnCFHI9t2G0AgdguyMLDku2o7YgVOTxHrtICUvPIQtmXIjkJ2IAwkZOzX4OFB4IcHdkWzhElsrhRXE9u10x53VYRe7N8giK/LIiAKC0ZrDtBdpu0hA4FEFhsx9pIgf2iFZCoAgA4YVWKRCfDvhQeIQtQWZgFxDYLPDkdgQ6Q+8O0FopOhRIZ0cSEmGw5uhHgsSWFp821GHgLRBYKwX0BSFwcxwIDewSzEcFFI8AkHW0eKEaA4VMwNgVZCAEjBdxUglQEjtYJqSpC7Bn8GILACYCoZqY8cKKCLAZjix3sLMYmCbD5iQxMxk8emGLCxjYwmQRxLIPLGv7QwnEMEEKIyFBxOhWx+YemNHFjiNgE4u8JOKAlwjpxlYmcISGhxxh+CAhoicRJImkSyJ5EiiZRKonURaIdEeiAxEYhMTmJYwvcViMEhbhtxsYncHuKXFaa5xq4hcDIKwGapHidxfSdSAMirhpAbxfsfuHQ1pZ3ZEWyLedIu3bFgAncfPbGN4I2AmEnE/498QtmjE/i6orop3KUDXjiAkAoAAIIoE+RCA8As0EAK4FcBAA=="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { admin, receipt, token, tokenId } = await Actions.token.createSync(config, { admin: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', currency: 'USD', name: 'My Company USD', symbol: 'CUSD', }) console.log('Address:', token) // @log: Address: 0x20c0000000000000000000000000000000000004 console.log('Admin:', admin) // @log: Admin: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb console.log('ID:', tokenId) // @log: ID: 4n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.create` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/token.create.md","from":10094,"to":10575} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.token.create(config, { admin: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', currency: 'USD', name: 'My Company USD', symbol: 'CUSD', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args: { token, tokenId } } = viem_Actions.token.create.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.create.md","from":10602,"to":11085} type ReturnType = { /** Address of the admin that was granted the admin role */ admin: Address /** Currency code of the token */ currency: string /** Name of the token */ name: string /** Address of the quote token */ quoteToken: Address /** Transaction receipt */ receipt: TransactionReceipt /** Symbol of the token */ symbol: string /** Address of the deployed TIP-20 token */ token: Address /** ID of the deployed TIP-20 token */ tokenId: bigint } ``` ## Parameters ### admin * **Type:** `Address` Admin address for the token. ### currency * **Type:** `string` Currency code for the token. ### name * **Type:** `string` Name of the token. ### quoteToken (optional) * **Type:** `Address | bigint` Quote token address or ID. ### symbol * **Type:** `string` Symbol of the token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`token.create`](https://viem.sh/tempo/actions/token.create) --- --- url: /tempo/actions/token.getAllowance.md --- # `token.getAllowance` Gets the amount of tokens that a spender is approved to transfer on behalf of an owner. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.getAllowance.md","from":167,"to":5783} // @twoslash-cache: {"v":1,"hash":"39248a39ac64c814f65ae5d23e0ffb2fb9d2135d90759bdd100c74ba402498d5","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinKFyEADu4mC8MKkARskWDKLa+uqytcqqMi06enirG1s7XRZWAMwDjs6jjRPUXmmvjm1ACTFY7C4RkEwlK5SkYxqCiuDRq2jaeGhJlePUQnxA9m+IyQACZKv9MFMDDM/KCFgZ8pDOGgIABrRRw059awAVnkdWuiD51Fa9wMLPZYBxHy+Qx+SHeJIpgOpwNKNHpIASAFdtsYwJw2tw5GtNtsYAAeDKJZIAPiCHWSqWtWQonCwjmYejIcFSWOEADoJYoA0aTU9zQGAAqe72kOBW4pKW0RVJR0gQZiMOCW/1wINskNh03PGABgBKem1pDAADVQtqYLbcm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bwOcGkPtGNfxG5ElLQAuLwMZQ9Y9U9c9S9Q9WNaZGUROTuelexY4TFTsBlKUI1OIEgKAAEIoM7EIHgBeCAK4K4EAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const allowance = await Actions.token.getAllowance(config, { account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', spender: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', token: '0x20c0000000000000000000000000000000000000', }) console.log('Allowance:', allowance) // @log: Allowance: 10500000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.getAllowance.md","from":5869,"to":5914} type ReturnType = bigint // Allowance amount ``` ## Parameters ### account * **Type:** `Address` Account address. ### spender * **Type:** `Address` Address of the spender. ### token * **Type:** `Address | bigint` Address or ID of the TIP20 token. ## Viem * [`token.getAllowance`](https://viem.sh/tempo/actions/token.getAllowance) --- --- url: /tempo/actions/token.getBalance.md --- # `token.getBalance` Gets the token balance of an address. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.getBalance.md","from":115,"to":5464} // @twoslash-cache: {"v":1,"hash":"be2aaf71065dae41e98187e9334b07b0203145c233743016fbab053ac04a5f67","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWa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BACRGevjC6nlH+NRBhEBD6M0VkKxGGcsO+S2C5G5B5DqN5LOH5GgNhcaIFGdJzJpIYhTFFDFOoJUMSFAC8HCGkLwI0I0C8JUGkNYHCJotIMSHCOIC8CsGkpUJUPqLwNIDAOoHCNIHCAkNYCsNFisCsAlIpC4sBDFFOLwARVFdFTFbFXFVFcFWAElLWWJfynGUpVsIgMwRJTALzqUEXOIEgKAAEIoGbEILBQgK4K4EAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const balance = await Actions.token.getBalance(config, { account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) console.log('Balance:', balance) // @log: Balance: 10500000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.getBalance.md","from":5550,"to":5593} type ReturnType = bigint // Balance amount ``` ## Parameters ### account * **Type:** `Address` Account address. ### token * **Type:** `Address | bigint` Address or ID of the TIP20 token. ## Viem * [`token.getBalance`](https://viem.sh/tempo/actions/token.getBalance) --- --- url: /tempo/actions/token.getMetadata.md --- # `token.getMetadata` Gets the metadata for a TIP-20 token, including name, symbol, decimals, currency, and total supply. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.getMetadata.md","from":178,"to":13503} // @twoslash-cache: {"v":1,"hash":"17796bba722c896e3ea092096ebfba46eb5bcfc91851eb26e942755800833739","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBz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O+4/4G5zLKGd0VGkABGADrKDj0GaHR8fivHHoMiVhyHsk5FI6Urtxy4qjieMoMMrhyTHZlWx1ZWcdaVroTldlAvECchOdB0TgwZFXELnspCN8WLoMCyqcJ0uiRTRRRz3wqxqZGsW/C05gTf4rB48ewYYDUSYK0iZchMVSh6qkJFsGzkIfLDSAAD0ZKQ8AcPFsq5QOuq1ZAZkVPg5d4AGYYruglCHKg1gG8n8rV0gRwQSUU9GwfPbBkQjoRsI2EdfCSGPwuwqRa4FrgxBYA7YdeFjFNhDR7oeMZ6AZlhg/QeYEANGA9QA6hTcYUMF6ORFkJZAKYwg+sfrENjIMTYFONlNZ27hVwJAdsJeA7EFgWwXYiIcaLwHCP9GBjgx/o57HVgo7FNcFJA+cEXz1i+C8Kn2JZPUymdkV+naYzbHIhoH5j8yl6Nwv3qrGe45EeqJsfE0a6NVexlowxHVWcgjjim/w78hsNTG8IMx6wxRx9ilBK4SAUAAEEUAB4hAeAXaCAFcCuAgAA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const metadata = await Actions.token.getMetadata(config, { token: '0x20c0000000000000000000000000000000000000', }) console.log('Currency:', metadata.currency) // @log: Currency: USD console.log('Decimals:', metadata.decimals) // @log: Decimals: 18 console.log('Name:', metadata.name) // @log: Name: United States Dollar console.log('Symbol:', metadata.symbol) // @log: Symbol: USD console.log('Total Supply:', metadata.totalSupply) // @log: Total Supply: 1000000000000000000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.getMetadata.md","from":13589,"to":13794} type ReturnType = { currency: string decimals: number name: string paused?: boolean quoteToken?: Address supplyCap?: bigint symbol: string totalSupply: bigint transferPolicyId?: bigint } ``` ## Parameters ### token * **Type:** `Address | bigint` Address or ID of the TIP-20 token. ## Viem * [`token.getMetadata`](https://viem.sh/tempo/actions/token.getMetadata) --- --- url: /tempo/actions/token.grantRoles.md --- # `token.grantRoles` Grants a role to an address. Requires the admin role for the role being granted. [Learn more about token roles](https://docs.tempo.xyz/protocol/tip403/spec) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.grantRoles.md","from":234,"to":5656} // @twoslash-cache: {"v":1,"hash":"5e8451097f9633d21d3a3cdfc8f44501a3bb693043aa17e5311b84bfc53aca06","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinKQwvDCMWGipACpDwsOCYABKaxtbpeVSiAAc/bXKqhotOnp4q+ubDPIWVgDMA0czlGNwm1C8018c2oAUWsU4RFCAFcYKlVuIoEI5BhOMBcpwCSsIApUgADay0AAkwDEpAsSlcpIA3PjCU4YkiwNtOOSqTS0HTlIyWWBCZw4IpYKQyRTqbT6cLWQSHHBjsTUZwAEYQdXiMAi1zIAC6l20+mktge9SQAFYXm08Ii5Ciur8kACQPYgSM+uowZgpgYZn4YQsDPl2FwjEdTFd9L1rM0rU9EDVtA6DNGTK6eogPV6hsD3X9/RCg1DSjQwyAI4U0BAANaKU0VPq9SryOopu3UVpvAz1ptgHP/QGFn2ISq9UuBnyzSuwgwJTn8I6cJT7NBqhRwADKGDAvAAPBlEskAHxBDrJVKnrIUThYRzMPRkOCpLPCAB0g8UX43epbuqe4HrwX4AArPq+pBwCexRKOeESpOBp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rH1rlL8pM5yBfgKafS/JGEBq0YhphownMbaoxpxocaJrmq0k4kZq0kMloAikmytCRD5omYd5wAr5FCciUycA2iT4RFf69QchcipDxbOYPgaloC4GZaSGpB6mpB2jlIlZlafJWbqkuqal/56kGn367LGm2nchmkhZoBiqlbt6kjEy4YEakgCkilMn+ptSsn0bslqqcnRq6quGcZJoCl8Z2rCnsCKaimpmfTik6BNzOTTJyaJAZmq5ZQtAaEoAFSpKsqlBEDWBfi9C1nQK+G6LXCyQ3DDzBHFy9ivCBDfLTwxHWITighfxlhzgOKLiejwhOgohogfSYhgDYhwx/QEiPwyh8gW4MjMjwzsiukrlygCgKgbmLniiSiC48iyj8iCjrkihigqi4SpDai6j6gExnxNn6B/CJiYLdhmKOiUS9mzwThCKJHljJGOIGBUKAI0Lbynaqjqh3k6gKB6ioLui9BtmjyphflBjhC4S/mxHjhlx/CDmkJ4ASBKClAR54A9kvnugGofkNCWggUgC4TMSAToqpACguhRFWC9D3D9nxGuDJwxCwBMAHQ1R0yq4nRLQ9QpZrTmogwQB7TVSzRGyLRnTLS9RfieFtz3Rd7LC1RhxfAPiTluSdRUw0xRghzuxKT/gsTATsycxtzcysiPywzIDyxHxKwqzSygICy0CQJIJ+X+UIIiwQz0LeXMKsLsKcLcK8L8KCLCKiLiKSIyJyIKJKIqJqKaKahBVgCEy27n7WmMUswsV/6GXIDWBGi8aYXqjqylAOziBICgABCKCpJCBEUICuCuBAA=="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { receipt, value } = await Actions.token.grantRolesSync(config, { roles: ['issuer'], token: '0x20c0000000000000000000000000000000000000', to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', }) console.log('Role granted:', value[0].hasRole) // @log: Role granted: true ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.grantRoles` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/token.grantRoles.md","from":6002,"to":6477} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.token.grantRoles(config, { roles: ['issuer'], token: '0x20c0000000000000000000000000000000000000', to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', }) const receipt = await waitForTransactionReceipt(config, { hash }) const events = viem_Actions.token.grantRoles.extractEvents(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.grantRoles.md","from":6504,"to":6911} type ReturnType = { /** Transaction receipt */ receipt: TransactionReceipt /** Array of role membership update events */ value: readonly { /** Role identifier */ role: Hex /** Address that received the role */ account: Address /** Address that granted the role */ sender: Address /** Whether the role was granted (true) or revoked (false) */ hasRole: boolean }[] } ``` ## Parameters ### roles * **Type:** `("defaultAdmin" | "pause" | "unpause" | "issuer" | "burnBlocked")[]` Roles to grant. ### token * **Type:** `Address | bigint` Address or ID of the TIP20 token. ### to * **Type:** `Address` Address to grant the role to. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`token.grantRoles`](https://viem.sh/tempo/actions/token.grantRoles) --- --- url: /tempo/actions/token.hasRole.md --- # `token.hasRole` Checks if an address has a specific role for a TIP-20 token. [Learn more about token roles](https://docs.tempo.xyz/protocol/tip403/spec) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.hasRole.md","from":211,"to":5806} // @twoslash-cache: {"v":1,"hash":"85a38813b3282ff4bd2875a74fa06ec2d675d0c901545edfa0dbfa76002d3c25","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinA5wAEoQCqkARhCbMOJgpeVSiOqytcqqGi06etPhGwpdFlYAzAOOzqONE9Re018c2oASYrHYXCMgmEx20+mkAFZ5HVrmdbm08FCTC8eogPiB7F8RkgAEwkv6YKYGGZ+EELAz5CGcNAQADWilhFT61nxCiuDSR1Fa9wMLPZR3kryQ+MJQ2+0usFIB1KBpRo9JACQArmB+NCVo99gAeDKJZIAPiCHWSqVNWQonCwjmYejIcFSWOEADoxYovasnjAvQAFZ2u0hwE3FJTmiKpYOkCDMRhwGBGz1wH1sv0B/ZetZ6LWkMAANVCWpg5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NYNsB9tsNsBVBlMZTBDFflOlJcooMNQeLwNJW9e9R9Z9V9d9QjBVFVNmbgTTlFVKrlLFcZfkS1dXqUMNOIEgKAAEIoG3EIHgK+CAK4K4EAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const hasRole = await Actions.token.hasRole(config, { account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', role: 'issuer', token: '0x20c0000000000000000000000000000000000011', }) console.log('Has issuer role:', hasRole) // @log: Has issuer role: true ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.hasRole.md","from":5892,"to":5954} type ReturnType = boolean // Whether the account has the role ``` ## Parameters ### account * **Type:** `Address` Address to check for the role. ### role * **Type:** `"defaultAdmin" | "pause" | "unpause" | "issuer" | "burnBlocked"` Role to check. ### token * **Type:** `Address | bigint` Address or ID of the TIP-20 token. ## Viem * [`token.hasRole`](https://viem.sh/tempo/actions/token.hasRole) --- --- url: /tempo/actions/token.mint.md --- # `token.mint` Mints new TIP-20 tokens to a recipient. Requires the `ISSUER` role. [Learn more about roles](https://docs.tempo.xyz/protocol/tip20/spec#role-based-access-control) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.mint.md","from":234,"to":6254} // @twoslash-cache: {"v":1,"hash":"46f1c80e43ab006ecc429ac40c2ea48df2c7b1c8e47b608bc34a4be0659f09aa","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMV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yjOGVfMwkM16GiChEwgZzMzLiCEVx7Kim2I2Fm2BzFBHPRmvLylwLkChH53FzQG/SVK8wJx8z80/LJwpxCyp3C1p36QMMgos0wpwv5kYpCwDEiAaXLi1zgF6MoQal0MfEaPT310VALDHiuItyqBEpOE5JrJKEksamfGT1s0+JKPfSErksQGOTkukoRIbFEoUqHzs0KPVARz+F40wuwrF35nws80xG8yJxIsUzIv5mC1C2pwiwM3Mri3MwYssrQGYrhFYr5zBiF1mwsGYqSFpn9ElOmXlx3BZCIGsChH+CSutBtP1XtP+G0TYTfBwgFUCE/Q9P+UwT+QgntXwRsRlTdI9g6j/CPA/hhgGk6k5XtN1FyqdPwgQW4RqpvHQSKu9JomwWwklS0mlWdQMGkTlAhQURynqstgAAlwh8B8pCoSoVClAKoolZg8AFqSQsk/pno45P4zhmrVJHweUxJmFOrpJZqzgdq1BeqXkbVsFhJhrWQlAWRnC8ACr0rVItEjUkAvSxqQBupepDIHASQShCp/h9Q1IWF1A2xpBrBxAWheBYBohobYbex4bEbkbUb8YMbdQ4aEakaUa0aCaiacbSb8ZCrobirfTXBwECxYAmAllzYfIpQZQtZNldYDMo5TZWbRQPkObxYFQtlVQwluZ6FugNlRaoQLSvZdktDRRuquAZRa564uB2a/JzU25go5pO4vZu4R4hdRKhadRAQoRHxjlewC5Y4IA55aAEV9QkUUU0UMVdQsUcU8UCUiUSUyVKVqVaV6VGUWU2Vh4Z5zUHa1UdUY7Y7bRw6l4CSFihKQajrMlwalrjkVa/Ibqkg7qy4WQb5xAkBQAAg9okg8BmRXBXAgA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { config } from './config' const { receipt } = await Actions.token.mintSync(config, { amount: parseUnits('10.5', 6), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.mint` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/token.mint.md","from":6594,"to":7107} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.token.mint(config, { amount: parseUnits('10.5', 6), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args } = viem_Actions.token.mint.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.mint.md","from":7134,"to":7318} type ReturnType = { /** Amount of tokens minted */ amount: bigint /** Transaction receipt */ receipt: TransactionReceipt /** Address tokens were minted to */ to: Address } ``` ## Parameters ### amount * **Type:** `bigint` Amount of tokens to mint. ### memo (optional) * **Type:** `Hex` Memo to include in the mint. ### to * **Type:** `Address` Address to mint tokens to. ### token * **Type:** `Address | bigint` Address or ID of the TIP-20 token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`token.mint`](https://viem.sh/tempo/actions/token.mint) --- --- url: /tempo/actions/token.pause.md --- # `token.pause` Pauses a TIP-20 token, preventing all transfers. Requires the `PAUSE` role. [Learn more about token roles](https://docs.tempo.xyz/protocol/tip403/spec) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.pause.md","from":224,"to":5001} // @twoslash-cache: {"v":1,"hash":"a6393fccb27fa70eaa319de7e39d7a619889bb2d3f5ab63be266ef0351e444c4","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinIxwAAriAK5wMFCpAEYQEAriYKXlUogAHP21yqpIVy06ekzrWztQXRZWAMwDjmcoyuE2oXmmvjm1ACi1inFIMF4MEYWDQqQAKkNhMNBGAAEqI5Go87afTSW4Ke4NGraNp4BFIlEMeQ/JD/ED2QEjPogjxgqYGGZ+aELAz5dhcIy40wXfS9ayyO71DTPOkGKUmb49RDszlDIFsxqgzACnyzUo0UUgcWFNAQADWihJFT6vRqlOViA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io7r7Vq1oxDFGpCLqtq1jVGswp6QZHaNFoilGPbnqXpCIs5tGIC/RFFNGc6p7c6jR9EdE6JdEg6vbA46r6oaRJFpEhGDJhHN4REOpRHTK5KxHuoLJeqVJJFrINKpHsAprpGnHGSZE6AawCTQKJqJAXH5YyRl4KRKRfZIilBEDWBti9A/Gxwz4mwuhlzyhL5UjOy2wvCBDcJFzb5hily8gH4QhH4ijtBwirCvifAHBHAnBBg8xAl/h/hPA5wNBEn5yBDolZhfCb4qgchwmyx/hGieyxi2xKClDdZ4DQmAmXD8xEmCwNC2Aol4BMrXiYkUSHhFyKg76lzyzcwxCwBMCpT6QXT5aZThQ5RrrRSVLdTJR6RBSaxZBhTZSORORtgT46wlQFHLAGQUlqK1h0z3y2QnRnSSiXT4zXRix3SQyPQDRhzORRzWAxwpxBnBmJy/SbRqbdEzo1pzrClix7ADE2mfBqalAjjiBICgABCKCLxCB4BEQgCuCuBAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { isPaused, receipt } = await Actions.token.pauseSync(config, { token: '0x20c0000000000000000000000000000000000000', }) console.log('Is paused:', isPaused) // @log: Is paused: true ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.pause` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/token.pause.md","from":5342,"to":5738} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.token.pause(config, { token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args } = viem_Actions.token.pause.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.pause.md","from":5765,"to":5961} type ReturnType = { /** Whether the token is paused */ isPaused: boolean /** Transaction receipt */ receipt: TransactionReceipt /** Address that paused the token */ updater: Address } ``` ## Parameters ### token * **Type:** `Address | bigint` Address or ID of the TIP-20 token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`token.pause`](https://viem.sh/tempo/actions/token.pause) --- --- url: /tempo/actions/token.renounceRoles.md --- # `token.renounceRoles` Renounces one or more roles from the caller's address. [Learn more about token roles](https://docs.tempo.xyz/protocol/tip403/spec) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.renounceRoles.md","from":211,"to":5491} // @twoslash-cache: {"v":1,"hash":"30d2bdf2635250f6359f0da611ced8b75cdd1e915d48aa5fa8de4385cdfaa662","data":"N4Igdg9gJg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G4FM3EAwGPB2AvHqUbNSDAGiMCmhDcIMAAHE9Aq1PIHSikIAEhLVJAhgMAVU5s1EZIlzmAVyIpLBlNkhx0VE/I1UDIlA/ZlgWMlpO0Y5EpfhwoLAelRJJyTykECFGh7TGykAkxnS8Bdz2zxCJxB4eyJAlBSh+cYLCMQLPt1An5YKbAyEBICI2JcJ1goBUhegp4Ex3TS5JDE4YhYAmAzUFozoVpLo1pJNNpcVwYIBDo6oFoDYWKroBpvxWDW4noHdlgGoQ4vhHxAzPIepaZ6Yowg5XY1IAINwOZdwuYeZW4+ZWQd4N9ZZD4FYlYJYdEhwhZQFrBwF4EbLbKYFxYVZidc9G9OIiKtxSK29ZL5z05VZSg7ZxAkBQAAhFApEhA8AXIQBXBXAgA"} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { receipt, value } = await Actions.token.renounceRolesSync(config, { roles: ['issuer'], token: '0x20c0000000000000000000000000000000000000', }) console.log('Roles renounced:', value.length) // @log: Roles renounced: 1 ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.renounceRoles` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/token.renounceRoles.md","from":5840,"to":6269} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.token.renounceRoles(config, { roles: ['issuer'], token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) const events = viem_Actions.token.renounceRoles.extractEvents(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.renounceRoles.md","from":6296,"to":6708} type ReturnType = { /** Transaction receipt */ receipt: TransactionReceipt /** Array of role membership update events */ value: readonly { /** Address that renounced the role */ account: Address /** Whether the role was granted (true) or revoked (false) */ hasRole: boolean /** Role identifier */ role: Hex /** Address that initiated the change */ sender: Address }[] } ``` ## Parameters ### roles * **Type:** `("defaultAdmin" | "pause" | "unpause" | "issuer" | "burnBlocked")[]` Roles to renounce. ### token * **Type:** `Address | bigint` Address or ID of the TIP-20 token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`token.renounceRoles`](https://viem.sh/tempo/actions/token.renounceRoles) --- --- url: /tempo/actions/token.revokeRoles.md --- # `token.revokeRoles` Revokes one or more roles from an address. Requires the admin role for each role being revoked. [Learn more about token roles](https://docs.tempo.xyz/protocol/tip403/spec) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.revokeRoles.md","from":250,"to":5786} // @twoslash-cache: {"v":1,"hash":"4331bbb216753b0e0d034449438e7597cb718b5c0bcc79635d29f21308e5a7b9","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinKQwvDCMWGipACpDwsOCYABKaxtbpeVSiAAc/bXKqhotOnp4q+ubDPIWVgDMA0czlGNwm1C8018c2oAUWsU4RFCAFcYKlVuIoEI5BhOMBcpwCSsIApUgADay0AAkwDEpAsSlcpIA3PjCU4YkiwNtOOSqTS0HTlIyWWBCZw4IpYKQyRTqbT6cLWQSHHBjsTUZwAEYQdXiMAi1zIAC6l20+mktge9SQAFYXm08Ii5Ciur8kACQPYgSM+uowZgpgYZn4YQsDPl2FwjEdTFd9L1rM0rU9EDVtA6DNGTK6eogPV6hsD3X9/RCg1DSjQwyAI4U0BAANaKU0VPq9SryOopu3UVpvAz1ptgHP/QGFn2ISq9UuBnyzSuwgwJTn8I4rGBERswNUKOAAZQwYF4AB4MolkgA+IIdZKpM9ZCicLCOZh6MhwVJZ4QAOkHim/qybk2O7wAeR7fgACi+b6kHAp7FEoF4RKkEGkBAzCMBKx6AVuIH7oevDfqcaBIqQYAAGrIjAF65GA4ivnAz7rOuQHbuq+FHqUmK8AgBinKxcCcOIRIKJwCTsEJnA7AAkhBABM1icH+YDfrkuQAHIQDQuz4JhnB6cJcAEfgaGQEigmHEISkOFwADu4iMGggniaQ1kwEp+xwJZor1rkmruRYvDOrAUCcFZwmanIEC8A2WowC57mrCRZH0pJqyMSYMDfpW4hKLxyDICAdD0VgCilKSFVObktZcMA0TojQ97JI++BoGgWCcK4YlocwnA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hKAhUGSnKpQRA1g34vQ9Zai/hBi1wckNwqCyYDQHo08eAfyc8cRdiE4oIYidcpCaRkRywToKIaIn0mIYA2I8M/0BIfCMofIVuDIzICM7I7pq5coAoCom5S54okowuPIso/IgoG5IoYoKoIEqQ2ouo+ohMrCLZ+gfwCYXCDQFirwgQU50RZgboYwC8E4fwSRI5Tikii4wQFCVC+8Hus5WIGA3Aha4gGAx4OwF4vyXY+AqQYASx/k0IfRBgAA4noN+u5KEQ8hAAkM+pIEMBgCWljiUpJHhcwARWFJYIVskOhkUj5GWrpEoEHMsIFgtHHJwLAEkMNvpKKGinRahaWanIYu+WPNhZPDwr2apTEVYAOfgovKPMkQOLlKUFHr2fFmwu6Cap+UgJaFInxOxCxFuFAKkL0HPL0PcIOYka4CnDELAEwIdLVPTOrqdMtL1BlutNaqDBAPtDVHNCbEtIfP1N+N4Z3A9D3ssHVBHF8I+H+UtNTLTFGGHJ7MpABBuLhOzARFzJ3DzKyIfFLLQOfJfNfLfPfI/M/K/O/J/N/L/P/EAiAmAhAlArAvAqLKyHwnDMgIrIwirGrLLPzP1MotYKorostStVoiNWAETPbpfraXhA5U2E5QAX+VhVnJrKUE7OIEgKAAEIoBkkIHgE5CAK4K4EAA"} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { receipt, value } = await Actions.token.revokeRolesSync(config, { from: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', roles: ['issuer'], token: '0x20c0000000000000000000000000000000000000', }) console.log('Roles revoked:', value.length) // @log: Roles revoked: 1 ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.revokeRoles` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/token.revokeRoles.md","from":6133,"to":6612} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.token.revokeRoles(config, { from: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', roles: ['issuer'], token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) const events = viem_Actions.token.revokeRoles.extractEvents(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.revokeRoles.md","from":6639,"to":7045} type ReturnType = { /** Transaction receipt */ receipt: TransactionReceipt /** Array of role membership update events */ value: readonly { /** Role identifier */ role: Hex /** Address that had role revoked */ account: Address /** Address that revoked the role */ sender: Address /** Whether the role was granted (true) or revoked (false) */ hasRole: boolean }[] } ``` ## Parameters ### from * **Type:** `Address` Address to revoke the role from. ### roles * **Type:** `("defaultAdmin" | "pause" | "unpause" | "issuer" | "burnBlocked")[]` Roles to revoke. ### token * **Type:** `Address | bigint` Address or ID of the TIP-20 token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`token.revokeRoles`](https://viem.sh/tempo/actions/token.revokeRoles) --- --- url: /tempo/actions/token.setRoleAdmin.md --- # `token.setRoleAdmin` Sets the admin role for another role. Requires the current admin role for the target role. [Learn more about token roles](https://docs.tempo.xyz/protocol/tip403/spec) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.setRoleAdmin.md","from":246,"to":5570} // @twoslash-cache: {"v":1,"hash":"d9c54665ca890ceb4e883643fe63cb29f5ad11e7649208e7a46fe48ce88991c9","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinKQwvDCMWGipACpDwsOCYABKaxtbpeVSiAAc/bXKqhotOnp4q+ubDPIWVgDMA0czlGNwm1C8018c2oASYrHYXCMR1MV300lkD3qz2orTeBiRJi6vyQAJA9iBIyQACZGmDMFMDDM/DCFgZ8gjOGgIABrRSXbT6XrWGoKR4NACsLzaeC5vLARJ6iFJ5KGwJJlTpEMZUNKNFZIASAFcwPwjpw4HpjhAFNwoMwLABlDAmgA8GUSyQAfEEOslUu6shROFhHMw9GQ4KkCcIAHSyxQxi1oK02u2O528GMABVD4dIcDdxSUnoiqSzpAg9otLqTKZgtvtYCdJpjpzQhtIYAAaqFDTBPbkwOIw3AQ+tzZbrfW002M6UoBBeAgDA69HBOfgYJxxDOVlPOA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Yw4tAF45GVoSITlf9OSQDOaC2IoY0FaTgcUe3FvWPGIQE1IGjODIMCEnmCfF/VPKvOE7YYE6Xew4TDJcEmVHmRAEvFEhE4zKfVIFE1ISURpDEvXeXXXTtLqGSB4l444zFU4pA84mdS44ledV5clIgu4gFB4zdcFZ49gG9V4kUuCd4nQM2NCQxS9RIcUr7ASFoUAlAMSThWZUoIgawGMXoHUq+Kg8ea4KkcUOed2BoUkJgwIRJVgpuTWUELgrUfWZkKORYeaVmL4XYbCXCU4T4C4Q0/QKkdQD+cuBoGoS094M4L4G0leCkIOP4P4YBJ0yOI2YIbuXuROBmJmL7AACXCHwFSBkjujp1h04lcChksMwQMFzLgGCQgASA3CAkcyzKOELiNJuBFBDL6GXnDIMCbJwmZmrLUB+EVDYNXmbkqF6ETIkCUFKAZzwGtP9JJGsFNIYJsD4IMD2EZn7K+zCxrNSDul6AR0qHFEaHUHfmsHEAIl4EzkPL+GPNPPPMvOvOYlvPvLPOkAvKvJvKPJPPfM/OfISAbl6HuHYM1h1iFhiFgDhHtkimZmik8hMkY18gBRqggFCiUgigdmSA8lii8lMhjDIKtjSj+OWBUndK2A8lWnWkRDgp2jlH2mTEVhnGOlOitnOl+hnFTlMkzmzmWjzlBhemQTMhHjIAEuPkUBunPmsEvkflkrkrvlBnBh3xj3z1Mk3ObJggcD3JL3IrQDjC9IHLzLq1KHxnECQFAACEUE4SEBlAQFcFcCAA=="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { receipt } = await Actions.token.setRoleAdminSync(config, { adminRole: 'defaultAdmin', role: 'issuer', token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.setRoleAdmin` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/token.setRoleAdmin.md","from":5918,"to":6375} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.token.setRoleAdmin(config, { adminRole: 'defaultAdmin', role: 'issuer', token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args } = viem_Actions.token.setRoleAdmin.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.setRoleAdmin.md","from":6402,"to":6665} type ReturnType = { /** New admin role identifier */ newAdminRole: Hex /** Transaction receipt */ receipt: TransactionReceipt /** Role identifier that had its admin updated */ role: Hex /** Address that updated the role admin */ sender: Address } ``` ## Parameters ### adminRole * **Type:** `"defaultAdmin" | "pause" | "unpause" | "issuer" | "burnBlocked"` New admin role. ### role * **Type:** `"defaultAdmin" | "pause" | "unpause" | "issuer" | "burnBlocked"` Role to set admin for. ### token * **Type:** `Address | bigint` Address or ID of the TIP20 token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`token.setRoleAdmin`](https://viem.sh/tempo/actions/token.setRoleAdmin) --- --- url: /tempo/actions/token.setSupplyCap.md --- # `token.setSupplyCap` Sets the supply cap for a TIP-20 token. Requires the default admin role. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.setSupplyCap.md","from":152,"to":5817} // @twoslash-cache: {"v":1,"hash":"3425b57e63dd869d50e97fa72c6063375687c2cec9e58782eaf2d9e3f31e96b3","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScAGYArmD8gmCcWJJwMACqYIxocEFEobEwiJxipBZKFJywvCyhcCVgscwARmQRJS2MShZoADrZrOxcqaTpWTmmUBC8CAYAsrFyAljm8JzipWjlypykMFj76WASxskQ0RucTa1knC0YVz0kyXRsliecF/fhMJwAjNZOEFAW8hIo0BEAHQDAYAWk4ABEZg1OPg0GgsA0APTYoiMGDMKFwfDY6azbGxATmATwbGjcbZXKUajiJRzZDIEB0cSsBQslhsDicYApNKZJlwTiuGKkCDMTgAcnxhMVsLADIlkyCioALAAmayKqrSCIDXGcA3Wa0221gEAAXQdom0+l1mjMihUakQgK0kl0gU1E2Z8gsVn+dgcpCcNHIiGk7k8ODwhBI5H89DwITCkU4vBMXALYGi3RKAGEhKWlANBcN81XuiyxJJ9AAOSOe5SqJAAN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7VNoAKvYXcpclKu8tAdKzKENkNtoR8t8A8wRc6dRjV24zVR4rVLFE2mVT1WAA8LIkC4gSAoAAQigNqQgeAzIrgrgQAA"} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { config } from './config' const { newSupplyCap, receipt } = await Actions.token.setSupplyCapSync(config, { supplyCap: parseUnits('1000000', 6), token: '0x20c0000000000000000000000000000000000000', }) console.log('New supply cap:', newSupplyCap) // @log: New supply cap: 1000000000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.setSupplyCap` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/token.setSupplyCap.md","from":6165,"to":6648} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.token.setSupplyCap(config, { supplyCap: parseUnits('1000000', 6), token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args } = viem_Actions.token.setSupplyCap.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.setSupplyCap.md","from":6675,"to":6873} type ReturnType = { /** New supply cap value */ newSupplyCap: bigint /** Transaction receipt */ receipt: TransactionReceipt /** Address that updated the supply cap */ updater: Address } ``` ## Parameters ### supplyCap * **Type:** `bigint` Maximum total supply allowed for the token. ### token * **Type:** `Address | bigint` Address or ID of the TIP-20 token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`token.setSupplyCap`](https://viem.sh/tempo/actions/token.setSupplyCap) --- --- url: /tempo/actions/token.transfer.md --- # `token.transfer` Transfers TIP-20 tokens from the caller to a recipient. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.transfer.md","from":131,"to":6123} // @twoslash-cache: {"v":1,"hash":"dec220aff49bf6fbcd09bc1c824e3f8dc091edf7bd95fbbb92e4c24833c8f7ec","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScAGYArmD8gmCcWJJwMACqYIxocEFEobEwiJxipBZKFJywvCyhcCVgscwARmQRJS2MShZoADrZrOxcqaTpWTmmUBC8CAYAsrFyAljm8JzipWjlypykMFj76WASxskQ0RucTa1knC0YVz0kyXRsliecF/fhMJ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VUxYU4Wk556wy/QYVJDowMlYwvwWA7gshEDWBQj/BeXWgqlirqn6jiKvg+g4QHJ4B7oGlEJGkqQQSmkwJMq3J6nGw/jXidy9SngqxgCXgXz/gvx3iqQfzELakDh/wgApV/iRU0oQLYQqosLMoGDsJygPI8LewZVnAAAS4Q+AJQ+MDc2h3BSgrg9JIASZBgnVJIoS10e0b0H0BK6pj4xKwV94EkMq/8p8mV41agJyvoUV5yKkwkKqzSLIuh4VIuc1qkYiWpPoRC6qBg6V70mV3eJIJQDc/w+oakj4vY6gbY0g1g4gLQvAsA0Qb1H1X1P1f1ANQNINuon131v1/1gN0M0NsN4NCNQNBpP80VECUCz8BYsATAvSSs/kUoMoosIyEsom7sCshNooTiQypN6spS1N2C5MyUwyCoioUICppsEyghoo5Vl8Mo2cucXAxNgUE0xcACBUCQFcpsVcrcrqHFdNeQiogIUIj4cyvYccXszy9ctAHy+oXyPyfyAKuoQKIKYKEKUKMK8KiKyKqK6KmKOKLQLcAcRcdcPK1gfKwqPtvtNort/coJlFou91Z8Dgz1cyAtaAJcbVSQm1KcLIm84gSAoAAQk0SQsqCArgrgQAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { config } from './config' const { receipt } = await Actions.token.transferSync(config, { amount: parseUnits('10.5', 6), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.transfer` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/token.transfer.md","from":6467,"to":6988} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { parseUnits } from 'viem' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.token.transfer(config, { amount: parseUnits('10.5', 6), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args } = viem_Actions.token.transfer.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.transfer.md","from":7015,"to":7271} type ReturnType = { /** Amount of tokens transferred */ amount: bigint /** Address tokens were transferred from */ from: Address /** Transaction receipt */ receipt: TransactionReceipt /** Address tokens were transferred to */ to: Address } ``` ## Parameters ### amount * **Type:** `bigint` Amount of tokens to transfer. ### to * **Type:** `Address` Address to transfer tokens to. ### token * **Type:** `Address | bigint` Address or ID of the TIP-20 token. ### memo (optional) * **Type:** `Hex` Optional memo to attach to the transfer event. ### from (optional) * **Type:** `Address` Address to transfer tokens from. When specified, transfers tokens from the given address (requires prior approval). Defaults to the caller's address. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`token.transfer`](https://viem.sh/tempo/actions/token.transfer) --- --- url: /tempo/actions/token.unpause.md --- # `token.unpause` Unpauses a TIP-20 token, allowing transfers to resume. Requires the `UNPAUSE` role. [Learn more about token roles](https://docs.tempo.xyz/protocol/tip403/spec) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.unpause.md","from":234,"to":5042} // @twoslash-cache: {"v":1,"hash":"acbdcb03cf8c56a50bc60fe3d4d353742e327ae6fa423ee3dd905872a93fd690","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinIxwAAriAK5wMFCpAEYQEAriYKXlUogAHP21yqpIVy06ekzrWztQXRZWAMwDjmcoyuE2oXmmvjm1ACi1inFIMF4MEYWDQqQAKkNhMNBGAAEqI5Go87afTSW4Ke4NGraNp4BFIlEMeQ/JD/ED2QEjPogjxgqYGGZ+aELAz5dhcIy40wXfS9ayyO71DTPOkGKUmb49RDszlDIFsxqgzACnyzUo0UUgcWFNAQADWihJFT6vRqlOViAArKrXgY7Y6ziztbrBsMXIhKpVjeDBZCLTCDAlNmB+LjOCmsB8YABlDCpgA8GUSyQAfEEOslUsWshROFmhsw9GQ4KkNcIAHQBxQdzPZvOpjsbRvN0hwIvFJSliK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HM1S1PSXIwo+I8ZRI3vZIr1VIxZIpDIwNNZENOpXIlpdpAo9gHNIox4yyEonQfWMSBBTNRIF4irJSBvNSDSYHJEUoIgawDsXoCExONfa2F0KuXoECHfT0dkYuPAARY/CuFWXkSYOuc0BuWEGo1YDYbRA4I4E4IMAWOE4WWwB2BoJ4ffNUa0d4bRDEjkMMSuECI0S/U0CQJQUoEbNEltbOfQcpGk0WBoGk2/AwHlesbMPYFyUIHYMuRUU/SuNWfmGIWAJgbKUyO6CrfKWKIqfdRKOpQaTKEyCKA2LIGKQqdyDyDsJfY2Kqao5YMyIkuUusJmF+ZyK6G6SUe6JpR6WWdcVMN6Y2D6MaKOTyOOawBODOeMhM1OEGfafTCY1dVojyGU+8T4GYusd07RfTUofFcQJAUAAIRQNeIQPACiEAVwVwIAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const { isPaused, receipt } = await Actions.token.unpauseSync(config, { token: '0x20c0000000000000000000000000000000000000', }) console.log('Is paused:', isPaused) // @log: Is paused: false ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.unpause` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/actions/token.unpause.md","from":5385,"to":5785} import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.token.unpause(config, { token: '0x20c0000000000000000000000000000000000000', }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args } = viem_Actions.token.unpause.extractEvent(receipt.logs) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/tempo/actions/token.unpause.md","from":5812,"to":6010} type ReturnType = { /** Whether the token is paused */ isPaused: boolean /** Transaction receipt */ receipt: TransactionReceipt /** Address that unpaused the token */ updater: Address } ``` ## Parameters ### token * **Type:** `Address | bigint` Address or ID of the TIP-20 token. ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. ## Viem * [`token.unpause`](https://viem.sh/tempo/actions/token.unpause) --- --- url: /tempo/hooks/token.useApprove.md --- # `token.useApprove` Approves a spender to transfer TIP-20 tokens on behalf of the caller. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useApprove.md","from":146,"to":11650} // @twoslash-cache: {"v":1,"hash":"2bf003f5493f7e541fe74b232dddbd8b378080a8e7358ad94560ea26b9b9c7a7","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGi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gbsAEklzp6cGEQecG4mELtGZC2jkd03pVF2eQC+FAoOQVYDU6KE1QdG3Qklj2xxAnQaQIQXbEDBz9YiW/RMEIckO5g7+pYKOJpQbBQDEBhYDNl+8NsGOV+KxHBGeyGaA8bOYgD8HOzfq/DIIMEOyFhDAIfMOsFELwZhQz4A4C+NviobJDaGUECwGBFBEZC3BOGKxVnMpFcR/8NI8xZ1jKE9ZKh4oaocHLaFiJ6hcjZocaP6wYj4lHQ+Rpoxmb8ZehyiDZJY0GE7QRheSsYUMHlATDcRSzdkbMKuH7Dbhywn4asL+FPCzhmwi4ZkyqbXDamhwhpccICbNKNhLw7YW8JqWfC6l3Sxpo8O9QAjWlrwy4R0tqVeNvhEyppVMrSbLNVA0Iq2Q+ngZ6BIR72aMPbMj5wjeIpi05mBnCUojyhyS4RHUPSU4jFm0wjxRsvxwp9g+1WRRoEodlPhjQ0fQGLH00jx8FA6yo0J9j9lp9iwfWYRKHKNDjZJs02WbPNkWzLZVs62LbDtj2wHYjsJ2M7BdjaDvVMMXy5wCAivS5hYAf4YTOKHCGygYscWDGIDGxi4xSQbAAmOFkpUpZosaMeLOqGYBJYWZuDY+OeRsUHx7Fx8EWPtGtAjgciUMd9Dq28a/R5WUkF1MknBCFEFAGbJOArDTwUt+ANQROtkzaDYwdke0dOCEJChwh30xsKWFn3UTsrGMKoUEHCFUB2xnwkQCgFLFaGqhoVsKiOQiujnIr45qKpORitTnYqM5bQM0FLCMgWwocFgGHIjnjUJr7QEajOOnBYHt0M+O87oXbFNUOJ/GOkOENavTiCTHiQc9EbPS3RWK4Qeau5MHKLWUKIVFUFhNmsrXVrFG6cfwBXFEBIBQAgQeQJrhSAuyEArgVwEAA="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' const approveSync = Hooks.token.useApproveSync() // Call `mutate` in response to user action (e.g. button click, form submission) approveSync.mutate({ amount: parseUnits('10.5', 6), spender: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) console.log('Approved amount:', approveSync.data?.amount) // @log: Approved amount: 10500000n console.log('Owner:', approveSync.data?.owner) // @log: Owner: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb console.log('Spender:', approveSync.data?.spender) // @log: Spender: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.approve` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/token.useApprove.md","from":11991,"to":12636} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { parseUnits } from 'viem' import { useWaitForTransactionReceipt } from 'wagmi' const approve = Hooks.token.useApprove() const { data: receipt } = useWaitForTransactionReceipt({ hash: approve.data }) // Call `mutate` in response to user action (e.g. button click, form submission) approve.mutate({ amount: parseUnits('10.5', 6), spender: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const { args: { amount, owner, spender } } = Actions.token.approve.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `token.approve` Return Type](/tempo/actions/token.approve#return-type) ### mutate/mutateAsync See [Wagmi Action `token.approve` Parameters](/tempo/actions/token.approve#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`token.approve`](/tempo/actions/token.approve) --- --- url: /tempo/hooks/token.useBurn.md --- # `token.useBurn` Burns TIP-20 tokens from the caller's balance. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useBurn.md","from":120,"to":9097} // @twoslash-cache: {"v":1,"hash":"5b6d09a09c9cff3e14ddc9584d71dec809880c31569d5f43fb47e4d50b5f31db","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUoiaicACUnABmAK5gjowQYJxY4nAwAKpgjGhwwURhcTCInCKkpgoUnLDWLGFwZWBxzABGZJFlbYwKpmgAOrms7FzppJk5eUZQENYIegCycTJojFgm8Jyi5WiVipykMFhHmWBiaymcEDHbnC3tZJxtGHd9JKl0bGbn17dtERgnAAjBZOMFQV8UvI0JEAHRDIYAWk4ABE5k1OPg0GgsE0APT4oiMGDMOFwfD42bzfFxNYmNbwfHjSa5fL+MQKBbIZAgOiiVhyfwsNgcTjANIZbJsuCcVyxUgQZicADkxNJKsRYBZ0umwRVABYAEwWFU1SSRIaEzjGix2+0OsAgAC6zuEml0BvUxnkShUiFBGnE2iCOqm7NkpnMwJsdlIDicUncnhweEIJHIGkCeGsKREzzipDAAGUMIkygZBHC0AJ5HC4pkAEKFktl6xwgBKOhbABUvAAeADCKRivRqCX4kAA7mAAHz+ETiXQAdmXsl9yiQAA4g1odHg2i3S4l/CYzEgAMyx+yOPyIABsyeoXjTvkzAXoTBGYsrRkXEkQLcdx9RRN0Qb1NBDPBf1PKNL2veNb2cYFlyfTBUz0dM/CzT89BFUZOBrfh5AXD0pANddQP9CDg33PQiJIyNz0QK8QFsG9E0QI0LzQl9MLfDlsz0eJEkuVIGxgZsi2PawhxHMdOAnac52CcYBR0Mg4AAfgrPgqwYsB6ybI82zhAAFexmA0iY5LAUdqkUs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2tsDTezrcwHfSEHXnSHcX7DxzRm0i1m7HaiwLfoYnYW2LfSFLWnRnXLeOZDJOSPYbarerXef267Xrfbc+mt4Ba7e7SUZbbZ3s9Bbbc+ogEf5bCf5iGf5O47+v77RD/7ZDIHVLaHY5fC6j0zZ0ts2M/RlkLUZpJ0l+KdFfloCQzCM62pgBtqw1B6NJV0pdFpBXSro2wCeMVFiPeHAyk8x4iWQDMYFiLi86efdXKiY2Gxy9l405HeuWH5gT0hYU9PeEFEPiol56p8RelFAvjzgOenJKwG1n9CPwKeL8PeOQMl690v0MvUxmfQKyWNogujW+t7Afr0Jn6rGVwBwi4Sf0da39N9JA29gAMREwDHaJIjADgMREUDexgalgZONremUZBlIy2boNFUfDeRoIyYaWoiGbDCRmwWcGUMxksjLBjIAEa6MvBHiURsQwOjsN/BqDGRm4LkahD6GijXKMo0bYxC/BnDQITw0wa0NkhCjRhko28FRDC6uAi8FuG54b0tGYg3RpIMypS8qOsgmgfIIsaQJ7C1UdQbQGYSaDY0NgxxtYlUYXhJAm6HnogBqGdZhI1UeoT3U4hr1j6nIFnupDZ5kCBBBoCwB4zGFCDaBMyToZwGdjLhjQUANxoOGsD3h7wF4A0IOBF6ElJARoVQKIAvBtAtwBoA0I2GsCSAYAy4LnqoBiAWA2gSiNoG0E7qxYGhvdf+CulzCwAvw+OcUEwNlDygH66MAGFjBxikg2A+MOzHCK8wE5ER1UVUOqGYAeYcuDAinHzF/CCw6wg8N+OLAOjWhBwnBKZOkmvymBgUP0B5hJHWjmDwQnUBQJywThXAzo5OfgDUGZpcM2gWMMZPtBTiki4QB6U2LLCF7IZWQ3mUEHCFUB+Z7wkQCgLLAdiqgKsFgKrPVmNEmj7QZoIYK4BTjTsbaAvK6ELz8yyjdGWkOENYxTjRF+2uwpUPfxqCOjrUzoh+inH8Clw9GiAUAIEHkB+EUgXWBAK4FcBAA"} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' const burnSync = Hooks.token.useBurnSync() // Call `mutate` in response to user action (e.g. button click, form submission) burnSync.mutate({ amount: parseUnits('10.5', 6), token: '0x20c0000000000000000000000000000000000000', }) console.log('Burned amount:', burnSync.data?.amount) // @log: Burned amount: 10500000n console.log('From:', burnSync.data?.from) // @log: From: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.burn` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/token.useBurn.md","from":9435,"to":9998} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { parseUnits } from 'viem' import { useWaitForTransactionReceipt } from 'wagmi' const burn = Hooks.token.useBurn() const { data: receipt } = useWaitForTransactionReceipt({ hash: burn.data }) // Call `mutate` in response to user action (e.g. button click, form submission) burn.mutate({ amount: parseUnits('10.5', 6), token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const { args: { amount, from } } = Actions.token.burn.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `token.burn` Return Type](/tempo/actions/token.burn#return-type) ### mutate/mutateAsync See [Wagmi Action `token.burn` Parameters](/tempo/actions/token.burn#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`token.burn`](/tempo/actions/token.burn) --- --- url: /tempo/hooks/token.useBurnBlocked.md --- # `token.useBurnBlocked` Burns blocked TIP-20 tokens from a specific address. Requires appropriate permissions. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useBurnBlocked.md","from":167,"to":7326} // @twoslash-cache: {"v":1,"hash":"0df2568dc9b4097277b953d5c3f9968dc9462d150265a4dbab251c23f27cd1be","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUoiaicACUnABmAK5gjowQYJxY4nAwAKpgjGhwwURhcTCInCKkpgoUnLDWLGFwZWBxzABGZJFlbYwKpmgAOrms7FzppJk5eUZQENYIegCycTJojFgm8Jyi5WiVipykMFhHmWBiaymcEDHbnC3tZJxtGHd9JKl0bGbn17dtERgnAAjBZOMFQV8UvI0JEAHRDIYAWk4ABE5k1OPg0GgsE0APT4oiMGDMOFwfD42bzfFxNYmNbwfHjSa5fL+MQKBbIZAgOiiVhyfwsNgcTjANIZbJsuCcVyxUgQZicADkxNJKsRYBZ0umwRVABYAEwWFU1SSRIaEzjGix2+0OsAgAC6zuEml0BvUxnkShUiFBGnE2iCOqm7NkpnMwJsdlIDicUncnhweEIJHIGkCeGsKREzzipDAACEZHN+DAoABlDCJMoGQRwtACeRwuKZYuFktl6wV6u16xwgBKOi7ABUvAAeADCKRivRqCX4kAA7mAAHz+ETiXQAdl3sl9yiQwO9mhDeDaXdL5crNcS/hMZiQAGZY/ZHH5EAA2ZPULxpr4mYBPQTAjGKDZGNuEguN6ciKMeiBnsGOh4JBj5Rq+77xp+zhGgaf6YKmejpn4WagXoIqjJwzYVk67o7ieFgxj6CH+shWioXotHyBhz6IG+IC2B+iYCRYhEASRQEctmejxIklypO2MCdkWN69neA4znOC6cEuq4bsE4wCjoZBwAA/PWfCNjxYBth2149n296DgACvYzCmRM2lgPO1R6WAy4QGu65dDw1lwE2LZ2c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FAqighwiqDezfiRAUBawaOqgTZTYzZzYLZLYrZrYbZbY7Z7YHZHYnZnYXZXY3Z3ZmhazQ5uy0Dw6o5bvbsOgrvVzRt+ub6OX6gcsouZJ2A8vezVuRtwgjPmRwg3NNj4s3SEtVz+DdyjOICgCBDyBOEpD44ICuCuBAA="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' const burnBlockedSync = Hooks.token.useBurnBlockedSync() // Call `mutate` in response to user action (e.g. button click, form submission) burnBlockedSync.mutate({ amount: parseUnits('10.5', 6), from: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', burnBlockedSync.data?.receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.burnBlocked` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/token.useBurnBlocked.md","from":7671,"to":8305} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { parseUnits } from 'viem' import { useWaitForTransactionReceipt } from 'wagmi' const burnBlocked = Hooks.token.useBurnBlocked() const { data: receipt } = useWaitForTransactionReceipt({ hash: burnBlocked.data }) // Call `mutate` in response to user action (e.g. button click, form submission) burnBlocked.mutate({ amount: parseUnits('10.5', 6), from: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const { args } = Actions.token.burnBlocked.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `token.burnBlocked` Return Type](/tempo/actions/token.burnBlocked#return-type) ### mutate/mutateAsync See [Wagmi Action `token.burnBlocked` Parameters](/tempo/actions/token.burnBlocked#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`token.burnBlocked`](/tempo/actions/token.burnBlocked) --- --- url: /tempo/hooks/token.useChangeTransferPolicy.md --- # `token.useChangeTransferPolicy` Changes the transfer policy for a TIP-20 token. Requires appropriate permissions. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useChangeTransferPolicy.md","from":171,"to":6573} // @twoslash-cache: {"v":1,"hash":"c50850524110b7ca9c0fc4ed621eb980504ba6bbaaa0473aa617fef54500dfa5","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6INYQYCKctqKKMAAqpFFwAGZkAAoQJtYYAMoYYNaIPHyCAHRoAvLFAK5wMADCdtFxCcmkaRnZudbFAEo6laRgMV4APLWhiYwKFJyVYPyQAO5gAHz+IuK6ACwAzLLySiqIAEybGuLaQZGN8WEtbYyZOXn+JmZIRzZ28Y5+iABs7k8ODwhBI5A0gSYrHYXAMgjWml0AHYrMZ9so1GctDo8HCjK9zB9gl8HE4kNttoDqF4Qb5wQF6FC2BxOGV+PIERskEi/ntFBjEOpqOccXo2RzZKZCZ97D9nNs3B5qcC9KC/BDGXpErNHIxQjMavUotomrdUukHh08qNxpNprN5hAlssABRYezMHRkOAAfgKeNK5TAVUNDRNNyS5vaTy6KQ9XtIcBtYAmUxmc0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MIWFhQ2EUBEyCJkyiALBihho1qa1mzhBWy9DhphozUBQOyey8A5N+yaChySQRz0Yc1PVJyp08BTTt4TZo4YxhZwp7xxZopnr4oYxZZ0oN4j5mxVYVg209DtgO10QcZ9YRRLhjZSYXqKZ7UByLrh1fgKQbraQ2Ypy8BC0A0vZOAnlRACgi4SpKhS5y5K4a464txG5+4So24O4how1czTk6acpB5VkR4Lwx505J5Oa+4rpOBL5Zhr4pRX47z909BD0+MuANlfFtQdl2J0gSBSJCbRrFlolgxTJCMhEZaaMeVtlcVoVt0VaCboJzwkINaylQgk8daBw9a5atkFajalaZBTa1bLaolrataio7bOAHaDbnaOd4BlaDkPalwvbf4bbQbwb9rOyBRobrU8BCazrBzrYrrVA0YMbHYsb7q9BcbPYHIOaIjR4Eh0IJ5pF+aY6/hB1O1DhuyYa8Bi605U6UbnVnA/hNhs6J1vUOZXYkMi18aICwhy6wBuBF58BKbaBa4yjFBXB0VhbAk6Ixa35Jb9AJ6yJilH8FEeaMIY6kQhQ66Bzu1G6xRd7Qhx64AVAkbzr066YkRR0gRvBeJ/AhiTry8Y7JBMZIbRzsapbz6Mo7Ar6ChOphojhtgGYa60ZJALA5prBr4wGIHVAoGYG4GEHwHIGkRoHYGcJ4G6JEHMHsG0G6JU6iRhy6Y7YkYQhYAmQYRHIwpvxVJEh1I58ly9JDIuc2ATITSninr4afrOh6iAwIoQwhxrh+HpZEoJD6DagFcVFIZbsfwMp2I2AwgoDixLlbFMoVMFBTsTpCpeMHh+BphdL9acI9J5EMIJC+Go4BGZZbUWpspg0MBQ1RoKBso2otJK0LBq1m0/H/GG1eorppHHiQry9R8YpR78DgHcq4bbHJHihCafQFDK6IjSgAHL78AJD/AH9RAkBQBAh5Af1Qg8AEIQBXBXAgA==="} import { Hooks } from 'wagmi/tempo' const changeTransferPolicySync = Hooks.token.useChangeTransferPolicySync() // Call `mutate` in response to user action (e.g. button click, form submission) changeTransferPolicySync.mutate({ policyId: 1n, token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', changeTransferPolicySync.data?.receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.changeTransferPolicy` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/token.useChangeTransferPolicy.md","from":6927,"to":7501} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const changeTransferPolicy = Hooks.token.useChangeTransferPolicy() const { data: receipt } = useWaitForTransactionReceipt({ hash: changeTransferPolicy.data }) // Call `mutate` in response to user action (e.g. button click, form submission) changeTransferPolicy.mutate({ policyId: 1n, token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const { args } = Actions.token.changeTransferPolicy.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `token.changeTransferPolicy` Return Type](/tempo/actions/token.changeTransferPolicy#return-type) ### mutate/mutateAsync See [Wagmi Action `token.changeTransferPolicy` Parameters](/tempo/actions/token.changeTransferPolicy#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`token.changeTransferPolicy`](/tempo/actions/token.changeTransferPolicy) --- --- url: /tempo/hooks/token.useCreate.md --- # `token.useCreate` Creates a new TIP-20 token, and assigns the admin role to the calling account. [Learn more](https://docs.tempo.xyz/protocol/tip20/overview) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useCreate.md","from":215,"to":11155} // @twoslash-cache: {"v":1,"hash":"3d490a002c7e2f3cbae101c3273591aa8fdaec268e90c4041b25fc475f2316e1","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6INYQYCKc1qQwojQAyhhg1og8fIIAdGgC8mkArnAwAMJRMTDxiWkASjo5pGAAKl4APAWhAGaMChScOWD8kADuYAB8/iLiugAsAMyy8koqiACMVtTi2kGR0XEJ1v4mZkgATDZ2pA5OSABs7p44eIQk5BqBTKzsXAaCo5q6qpezimUag0ax0eE+Rn25mOwVO5z8SzcHmoXnuvieAXorzYHE4mX48m+4yuMLkgIW6lWWjBenxhNkpmhJ3sjgRh1UNxRdz0Dz8zyxelaPUcjFC3XyRS2pR2zTaHS6PT6EEGQwAFFh7MwdGQ4AB+ZIQjJZMC5CXFbblAAKmu1pDgsrA7U63V6A2GAEoDak4EaCSa8oVzdLylU0DV6k0Wo75S6lSqADpgMCiLVwDXWGDiwNSsq7KhQCDWBB6T6cVrsCLm0wKTiiThmfqcOoASUthwseONaUTiYAchAaMk6vhGHBOKPa5w4Dt8KRQhA8pxCAI8XYuP1RIw0GPy6RV5m0GcwudRWBE5lOAAjTOmawyHKwKCcMV1y8yQv8K8wXeZqJh2rVpOURpqE+RpP4YgKMWyDICAdAplgcj+AABqh260ImLA4lwwApIYnCuGWc7MJwADkG4KMwjAAPQ0G8pE9o6wpoKenAAIJYFgqrupwwCJpwESgThnDMDkYg0F0o6WvIUCAYRAC8eHpHS/pmjmOzcYxAl/uGnCqvxAmcI0l5iZkZ5gIZhmhAUJjWPw8nANxnDyUMIliSUqq4cmWr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fNSDDRr7w0F4DfPGHGEJgNS7Cm9ZqV3yeipde+vU8qVWxPqWDKa/MSfvIOn6iAGac/FWjf11qtxBaigvmioM36WRt+ItM/mLW7RxxT+UtSNLLQHnn8la8/eerfz1qa0n+bcl/vrXNof9jaX/U2mAF/7oZ/+NtdQcfE0GO03BldJgZANYGYDYBnA+ASnToHp0iBJ81AWfJjpsDKBjcrgQgODp3zGBj8qOhgJgEcCA6uAj+S3UIHfyIBv88+f/KoFXygFN8ngQXMkBPUCpgg8tHgBEGRz7o0ckwW32rlrlxudcuQZmkf7a0l5S/NQXbWAEILyuWNHevoOIU9TSpD0cqVMCRDxzqpF9LUFnwjk5SJgvXEOVVz5hsQta1/B2BqjMFQApgqgAoNYFJhTAJgBQCwKoCUKSB2QogKYJeCugTAJgY8awJIBgAapVAkgVQK0AsCXgp4l4S8ITRZgxyBprgU6CEFgDYh3gvEcGgRCIh/4AxSBKiLRBlxsAGIKnaGJWGr78ZFIhoSGlXwznWBNI5kYfAUCNwyJdoSw0wGwIYb5BoEAYI5GYj0hGYFA72TqGZBkx8Z+AXQWygskvBURxEp4NQqX3KBGpPIBkY/ilHShZQQoBkfuf5ECgtBWAnmTgBlGygUADI+/MiAUD6WtKwArgNQsrzpZX86uDXJZMrKCWRK0g/tXUEjDADVKfRH+GZc2E6l1Ve+yy25KssUEbKFZpEIRU/z2XBKDlYgVZfQrUL+B/8ogJAKAECDyBf0oQKqQgFcCuAgAA"} import { Hooks } from 'wagmi/tempo' const createSync = Hooks.token.useCreateSync() // Call `mutate` in response to user action (e.g. button click, form submission) createSync.mutate({ currency: 'USD', name: 'My Company USD', symbol: 'CUSD', }) console.log('Token address:', createSync.data?.token) // @log: Token address: 0x20c0000000000000000000000000000000000004 console.log('Token ID:', createSync.data?.tokenId) // @log: Token ID: 4n console.log('Admin:', createSync.data?.admin) // @log: Admin: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.create` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/token.useCreate.md","from":11495,"to":12018} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const create = Hooks.token.useCreate() const { data: receipt } = useWaitForTransactionReceipt({ hash: create.data }) // Call `mutate` in response to user action (e.g. button click, form submission) create.mutate({ currency: 'USD', name: 'My Company USD', symbol: 'CUSD', }) if (receipt) { const { args: { token, tokenId, admin } } = Actions.token.create.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `token.create` Return Type](/tempo/actions/token.create#return-type) ### mutate/mutateAsync See [Wagmi Action `token.create` Parameters](/tempo/actions/token.create#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`token.create`](/tempo/actions/token.create) --- --- url: /tempo/hooks/token.useGetAllowance.md --- # `token.useGetAllowance` Gets the amount of tokens that a spender is approved to transfer on behalf of an owner. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useGetAllowance.md","from":169,"to":5732} // @twoslash-cache: {"v":1,"hash":"b0c37f5d3bb0182fd912e817d276901fd1c5110436708118f3f541db520ed0f9","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQA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8lYyV1WyYoz8ZAVhwcEge0cSeM+yzs2MhNElrtxNJN7sZNyojzlyqMjzTy0BPyOZBQ4BohylMc4psdzRLiUkuAZpVAvDVcGiwKkh+cKd0IwLViuikhYLOB1BFcgMBiQLoL8cDdYLhckKATii140KMK2csLqiqZYRls1tDzAJjzPzzzuMjteNrzhzkM7z0MHz6SHtZNXzXtKMPz2AIcvyRKEgfytA/y7IQd6gwdxK4CKkxBgokBQpVZTAswqAiALAVhoxdKLALB2TKkWwpw9xWxeTeROlqBLk8Au0hSulHxFQ+lJT6UPkdRLi/ITZLRMJUlYkHESgRUahiR9gyQfQKQ0QAxMQJg7JQx8QcUTKJRJBTlOxCVpBrL9ZUxFY0ThxFQHKnlWxnLvBlL/BeDbL8cdxdAl8Ox4xeQrA3L1ksqkhowLBVADK2rrwzZbxmq8qxTXAVZdRYBaws40pZpBBJoCg8oRce5SoKoYAqoLjuoRqaR9SsrJoZoyIsVFojYsq1pzoWldpbpaA9w2QJQoAnxVBEJrBWxWwXxEIWqu9JAJRVBRAnxkgFQ2Q2QAAhawSQGAPcVQSQVQAoCwZIaHZIZIR6Daa5MgQ6vcZfSQPcBGiwRCGMBUaMU66wJ8SCCwZqxCPcKAHG5IVqmACwKAaMfG6wRGxCBUSGjqLFQ6jyawNq5mlm1mtm9m5myG56BajlHnA3Y2aSRAYXTy6SPvfwOtUQJAUAQIeQOePUPABKEAVwVwIAA"} import { Hooks } from 'wagmi/tempo' const { data: allowance } = Hooks.token.useGetAllowance({ account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', spender: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', token: '0x20c0000000000000000000000000000000000000', }) console.log('Allowance:', allowance) // @log: Allowance: 10500000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `token.getAllowance` Return Type](/tempo/actions/token.getAllowance#return-type) ## Parameters See [Wagmi Action `token.getAllowance` Parameters](/tempo/actions/token.getAllowance#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`token.getAllowance`](/tempo/actions/token.getAllowance) --- --- url: /tempo/hooks/token.useGetBalance.md --- # `token.useGetBalance` Gets the token balance of an address. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useGetBalance.md","from":117,"to":5413} // @twoslash-cache: {"v":1,"hash":"c7528612435a35df89295a7a12ef72ca886311a30623cf9079ae2b6b2e88aefc","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUWKQQOBwYAJScUKJiiJwARowKplwAPpwArmCwAGamMFD+UBDWCHoAKvgwnDKiIpxwOdbW8HAFOTIyGJyk8BAyJFBxCaKcBeycyvUAjjlkGAB0ADpgGxu19Y3Nre2d3b39g3DDo+NiUzNznIvL65vPOw1NXAcdcF09fQNDIxKV0m01Iszq9yWpFWWxeEL2HzaXx+J3+50BY3i11B4IWUJhz228PeLSRR1+pwBlyxINuEIe0JW/hE4l0ABZ1MZ5EoVIg2RpxNogjT/CYzEgAEw2OykBxOJAADncnhweEIJHIGkCeGsEDAzWSokaYA6SVS6TAWVy+RgRTMpSo5UqeFeCNJh2+xz+ZwuQJpNzBdwZq2Zml0qgAjLJucokAB2AVaHR4Q3Gjqi4qS6X2Rx+RARtnK6heNW+TUBehMVjsLgGQSh1lIABsAGZo4pY4hOZohXg60YxeYpSBbDn5YgJU2i5hVXp1X4tZW9Cw2BxZgJ5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 'wagmi/tempo' const { data: balance } = Hooks.token.useGetBalance({ account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) console.log('Balance:', balance) // @log: Balance: 10500000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `token.getBalance` Return Type](/tempo/actions/token.getBalance#return-type) ## Parameters See [Wagmi Action `token.getBalance` Parameters](/tempo/actions/token.getBalance#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`token.getBalance`](/tempo/actions/token.getBalance) --- --- url: /tempo/hooks/token.useGetMetadata.md --- # `token.useGetMetadata` Gets the metadata for a TIP-20 token, including name, symbol, decimals, currency, and total supply. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useGetMetadata.md","from":180,"to":13885} // @twoslash-cache: {"v":1,"hash":"ba0d6e59f59bb9a5429e5c8f90558913930bfe2f294f96336382a6252f972e31","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUWKQQOBwYAJScUKJiiJzAADpgnBmc1gCupKTy1hhJIqSmCgDcaZlxMNYsojJwSWDZzABGZJXpmQCO2RA0ACoC8gD8SQAGFrQAJMAlZa4TnAA+nNlgsABmpjBQXdVgoswwxWiligeZWKLZcHvjnG18cqLpaxvbu1Cr65swOzM+yqmTg2SwWBkGAAwqIsI82owFKYuB9/oC9r9P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KhrbBy5MzkxyjVuyY1Yk/cvGoc5HlTaSameheQUleclJYAPzi+WzWBd1JIXAtRFxorFqd6ekl1fhgolEMUjNa1znWpQUNqDGDc9nbt3bVkVz1ZXEqTRVO5+Vau7SwobUSHUzqWum/WXGOpCkTcp1glGdTN3IUa7F1glZdfFPXVzrkpMReltuu6Ms5ej19foy2o512TCpKFC9dGkq4THzuFUpBckJQVhU6D9UnDC+re4tSPuX3DKtfh95wy/1nNJQz1DfZbR9DWUYDRytA1ubGVAEcaZNJg2QQt4NG9HnNJDjdVw4qGs+FOhjiXwsN9PJOLbx2nVBpqVPA6cRs40nTeYTPd6RxtJNUaQEmJzIA3Blj0a2NaARjc9I7hqxheH8G6vpt42PUpeAmjyFOG8igy/I4MxcIOAk3LiWVq42TWIZADIz9eeh5zQqkRSqbCOxhkjppqiB4pwE3PHk6KccjDAlIvEBkKZvd6BIlTqgFU77zCgRRteQQTk4dQwC6HoTOpgHnqfhMHQuVVAaDnoCUOCGRonUuGSKqCDWnUM3ppIP8ZSopnUzaZtM8dEkOnQwofUGE84DdIfJfwsAMqO2lkRdRFEjoFRK7m0R6IDEbAIxF3tqIOJgIGdcFBWd8QjxAkoKW2ONPCQghR40SaYEwmsDpnRzY58c6OYSRyh78I65JkTXRMtUXcuvLpMjxiCzm+KzvKiEufGldJk49+ChWojFUgJtzkGrpLjP3PbGjNGPJoCefBRdJ7NF5hdfGciyJnbz/SL04XHvz+BEoSAUAIEHkCeo/weAcRCAFcCuAgAA=="} import { Hooks } from 'wagmi/tempo' const { data: metadata } = Hooks.token.useGetMetadata({ token: '0x20c0000000000000000000000000000000000000', }) console.log('Currency:', metadata?.currency) // @log: Currency: USD console.log('Name:', metadata?.name) // @log: Name: United States Dollar console.log('Symbol:', metadata?.symbol) // @log: Symbol: USD console.log('Decimals:', metadata?.decimals) // @log: Decimals: 18 console.log('Total Supply:', metadata?.totalSupply) // @log: Total Supply: 1000000000000000000000n ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `token.getMetadata` Return Type](/tempo/actions/token.getMetadata#return-type) ## Parameters See [Wagmi Action `token.getMetadata` Parameters](/tempo/actions/token.getMetadata#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`token.getMetadata`](/tempo/actions/token.getMetadata) --- --- url: /tempo/hooks/token.useGrantRoles.md --- # `token.useGrantRoles` Grants roles to an address for a TIP-20 token. Requires appropriate permissions. [Learn more about token roles](https://docs.tempo.xyz/protocol/tip403/spec) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useGrantRoles.md","from":236,"to":6643} // @twoslash-cache: {"v":1,"hash":"f4391afb0618a6365e397f75dd69c90dea54e09d9cd37c91d8c93575a93d1dde","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6INYQYCKcCqSiYGgAShBycADKGGDWiDx8ggB0aALy2QCucDAA4lEx8YkpadmxOoWkYAAqXgA8AMKhAGaMChSchWD8kADuYAB8/iLiugAsAMyy8koqiACMcxri2kGR0XEJ8DXW/iZmSABMNnZRjn6IAGzunjh4hCTkGoFMrOxcBkE000ukeVmMK2Uam2Wh0eEBRnO5muwVuDicVwWL2oXnevi+AXovzYHE4eX48mBsyQj0ey0UUMQ6moOzhenJlNkpmRN3s92clzcHhxbz0Hz83yJem6Q0cjFCgxK5QOVWOqWsnR6fQGQxGEHGEwAFFh7MwdGQ4AB+DII3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() // Call `mutate` in response to user action (e.g. button click, form submission) grantRolesSync.mutate({ to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', roles: ['issuer'], token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', grantRolesSync.data?.receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.grantRoles` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/token.useGrantRoles.md","from":6987,"to":7567} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const grantRoles = Hooks.token.useGrantRoles() const { data: receipt } = useWaitForTransactionReceipt({ hash: grantRoles.data }) // Call `mutate` in response to user action (e.g. button click, form submission) grantRoles.mutate({ to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', roles: ['issuer'], token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const events = Actions.token.grantRoles.extractEvents(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `token.grantRoles` Return Type](/tempo/actions/token.grantRoles#return-type) ### mutate/mutateAsync See [Wagmi Action `token.grantRoles` Parameters](/tempo/actions/token.grantRoles#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`token.grantRoles`](/tempo/actions/token.grantRoles) --- --- url: /tempo/hooks/token.useHasRole.md --- # `token.useHasRole` Checks if an address has a specific role for a TIP-20 token. [Learn more about token roles](https://docs.tempo.xyz/protocol/tip403/spec) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useHasRole.md","from":213,"to":5731} // @twoslash-cache: {"v":1,"hash":"306dac353c73a78bf54e64cd30cbda4af1447f271833545285c0d219109fa181","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUWKQQOBwYAJScUKJiiJwARnxyomCcAD6cAK5gsABmpjBQ/lAQ1gh6ACr4MJwyoiKccLnW1vBwhbkyMhicpPAQMiRQcQminIXsnMoNAI65ZBgAdAA6YJubdQ1NLW0dXT19A0NwI2MTYtOz85xLKxtbL7uNzVyHnXDdvf2Dw1GpWuUxmpDm9Qey1Ia22r0h+0+7W+v1OAIuQPG8RuYIhi2hsJeOwRH1ayOOfzOgKu2NBd0hjxhq38InEugALOpjPIlCpEOyNOJtEFaf4TGYkAAmGx2UgOJxIAAc7k8ODwhBI5A0gTw1ggYBadjgACURjAkqkzRlsnkCjBimYylQKlU8G9EWSjj8Tv9zpdgbTbuD7oy1izNLpVABGWQ85RIADsgq0OnVzVNcjFJSlMvsjj8iCj7JV1C86t8WoC9CYrHYXAMgnDbKQADYAMyxxTxxBczTCvANozi8zSkC2PMKxCSlslzBqvQavza6t6FhsDhzATyJsSRAt6Tcrt83tC1N6NBbsBZiVT3Ny/PONuS2dlhcV/w0FcgHpgRyMfV5HAMDcOmZoADwAML6sUCgUCkaQwBkAB8oT2MwOhkHASSDqsF78PIqy5EBIEmmaqwAApoRhpBwJB0GMLB8FWmASHRNhfCCLhl6EcRoFyKsxo6LkpBgAAaqIMj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' const { data: hasRole } = Hooks.token.useHasRole({ account: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', role: 'issuer', token: '0x20c0000000000000000000000000000000000011', }) console.log('Has issuer role:', hasRole) // @log: Has issuer role: true ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `token.hasRole` Return Type](/tempo/actions/token.hasRole#return-type) ## Parameters See [Wagmi Action `token.hasRole` Parameters](/tempo/actions/token.hasRole#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action * [`token.hasRole`](/tempo/actions/token.hasRole) --- --- url: /tempo/hooks/token.useMint.md --- # `token.useMint` Mints new TIP-20 tokens to a recipient. Requires the `ISSUER` role. [Learn more about roles](https://docs.tempo.xyz/protocol/tip20/spec#role-based-access-control) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useMint.md","from":236,"to":9397} // @twoslash-cache: {"v":1,"hash":"81309f31f44049ff315a55266231b03aaae8e5d9663c808078d1f3aa60a60d20","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUoiaicACUnABmAK5gjowQYJxY4nAwAKpgjGhwwURhcTCInCKkpgoUnLDWLGFwZWBxzABGZJFlbYwKpmgAOrms7FzppJk5eUZQENYIegCycTJojFgm8Jyi5WiVipykMFhHmWBiaymcEDHbnC3tZJxtGHd9JKl0bGbn17dtERgnAAjBZOMFQV8UvI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wTaoYYwyZ1ComOUHJiMT8YtDyhDjFJh0PSaZN6h0TRobE2aG2NAmlQpxiqjCZuMTGEw3oVMNyauDPeBoP9J4M96W8ggFTcZraXD6bVZmV1WPqENuwVZaEMQ7hjGiUZmtihgKTYV6BOpDMTqZTasL4Lt63gTeIDTkC71Ug6CFALw1QDsJ95WB5mIAKROsBJACMasdWBrE1haxtYOsXWHrH1gGxDYRsY2CbFNhmxzYFsbQI6t6D8HnU10uYWAJ+BozigYGsoVzO5lhhvQEYSMNgCjAcy0i0s9I6GB5nVDMBvMSArRKvESDzkfw7MWsP3GFHWBeYqMa0AOGzQzJNYpBUwDUKegctxIhqXxOCELQKBA2scSWD7jtz8Aag3tIJm0ELATJVoScYhnCCPTaxhYQfJzBhgKAqhQQcIVQCbDvCRAKAwsGhPrFoC1YjQ9WRrM1laztZOs3WSQL1n6yDZhso2cbJNmmyzZ5si2M0L6K8gOxaAz2T7DmNzEOg0xycJOKQKeIB8DoQfE2DaI8YaQ4QozJOI8X+4wir8MITujUErHWpqx1YJOP4GLiiAkAoAQIPIDgCrRQcCAVwK4CAA="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' const mintSync = Hooks.token.useMintSync() // Call `mutate` in response to user action (e.g. button click, form submission) mintSync.mutate({ amount: parseUnits('10.5', 6), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) console.log('Minted amount:', mintSync.data?.amount) // @log: Minted amount: 10500000n console.log('Recipient:', mintSync.data?.to) // @log: Recipient: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.mint` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/token.useMint.md","from":9735,"to":10348} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { parseUnits } from 'viem' import { useWaitForTransactionReceipt } from 'wagmi' const mint = Hooks.token.useMint() const { data: receipt } = useWaitForTransactionReceipt({ hash: mint.data }) // Call `mutate` in response to user action (e.g. button click, form submission) mint.mutate({ amount: parseUnits('10.5', 6), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const { args: { amount, to } } = Actions.token.mint.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `token.mint` Return Type](/tempo/actions/token.mint#return-type) ### mutate/mutateAsync See [Wagmi Action `token.mint` Parameters](/tempo/actions/token.mint#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`token.mint`](/tempo/actions/token.mint) --- --- url: /tempo/hooks/token.usePause.md --- # `token.usePause` Pauses a TIP-20 token, preventing transfers. Requires appropriate permissions. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.usePause.md","from":153,"to":6131} // @twoslash-cache: {"v":1,"hash":"b185b955305cbee6f008ea6d7efc12dbee30325aec9fb62314d68f7658e4fa9c","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6INYQYCKcWKIArnAwAMoYYNaIPHyCAHRoAvL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c1bNcjjLbHjUiHcg7TDfcp7Q8mi48rQU8osEse7U8R7UgZ7PcZuCGVuFAf4s8QEogCwdIGEYS6FQk4QYkw/VQKwC5Ck6YHFW5YwcnWkhYYlPaN5BENGDkFkrGNkvAVYnWZIGSL0OSY0DMF6N6dSD6GAQ2H6aMf6CSwkQ/GaDFH4eYcGFaFYDaOGR5cwcGF5dS6ESYSYMlHSnkdEdkl1AmIFJxFxemby16IMEMaWTZC2boK2ekF2TUt2PlRxYpcIL+XpOeP+PJH8BlEga8ZxMQJihxTOKBUIV7INPKpWLgQqn+EqrLeAcq8BKqqsNceReqo0KiJqtMfK1qtJTRGuTqtzCq2K6q/qt+BRIaoyEazgMatRIqya0qrqmQWa3qmqgan2Bq1FXYdFUGeYc5TyvAXqlS/yyEBkxAKYUKlEXSiKvAf5aKomTgd8VMS/bsbcUKG+MACoX67mE6w/SQYkWSskOaBSqGH65RMG3yuktS5GJAcYNwLSk6TGcKgvd6qKwFL6h3HcIG7gJWfAFIGCLyCg8A2KDJNKojF8TKnld2MmuAWOCAEhZQQcYmwGnmcGnYSQcGckskGECkSGPFAG3cUINmlQZG1SgKtG8kGaZ6vQICfwKgvAetcGyYIGc6xkvSvQGoKWoGnXdmlILyJaSYcYVQWaOESQCwMKawK2K2m2u2h2p2l2nYa222mae2x2o8Z2l8V232/2z2l8FSmEKGxWh6o6caEIWATEJ4NiYyzCbCAPAo63YiMiHLNgSiFY6wwyxA/UUy56W6awZSIyNHRoJrZePqRTQ9b6+ANgMIJ3PISxU25UHtBQSTTKQyLiCyfgToactRI8YiOePcGvQy9Ie5VybSEFTyWgSFJFFe1ehFBnfKGvIC2tbI420OPmuiOwc2/I6e3q7UdIBGy/TIE2nmWWmvfwGqUQJAUAQIeQOVUIakBAVwVwIAA="} import { Hooks } from 'wagmi/tempo' const pauseSync = Hooks.token.usePauseSync() // Call `mutate` in response to user action (e.g. button click, form submission) pauseSync.mutate({ token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', pauseSync.data?.receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.pause` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/token.usePause.md","from":6470,"to":6953} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const pause = Hooks.token.usePause() const { data: receipt } = useWaitForTransactionReceipt({ hash: pause.data }) // Call `mutate` in response to user action (e.g. button click, form submission) pause.mutate({ token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const { args } = Actions.token.pause.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `token.pause` Return Type](/tempo/actions/token.pause#return-type) ### mutate/mutateAsync See [Wagmi Action `token.pause` Parameters](/tempo/actions/token.pause#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`token.pause`](/tempo/actions/token.pause) --- --- url: /tempo/hooks/token.useRenounceRoles.md --- # `token.useRenounceRoles` Renounces roles from the caller for a TIP-20 token. [Learn more about token roles](https://docs.tempo.xyz/protocol/tip403/spec) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useRenounceRoles.md","from":210,"to":6413} // @twoslash-cache: {"v":1,"hash":"b76e1df0be1a3b2792bb8c4a1ab224f7963d06a0ffa907fcd104f996453f6d0e","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6INYQYCKcpPIQAK5g1jAAShBycADKGHGIPHyCAHRoAvK50XCJUbHxSSnpcbkJOtGkYAAqXgA8AMKhAGaMChScsfyQAO5gAHz+IuK6ACwAzLLySiqIAIwA7Bri2kGRkBWJyfA11v4mZkgATDZ2pA5OSABs7p44eIQk5BqBTKzsXAMgimml0T0WxmWyjU2y0OjwQKMF3MN2CdwefkQVxeHmoXg+vm+AXofzYHE4BX48hBM2e0khimhiHU1B28L0lOpslMKNu9kcmPmV1eePeek+fh+JL03QqaEYoUGpXqBziR2qGWsnR6fQGQ1GEwAFFh7MwdGQ4AB+LKI/KFMDFZXlNVVE6a3IABVN5tIcG1YF6/UGYGGEDG4wAlDacnA7VSHSUyqrKsc0u76mhGi12l0A7rg6HwwAdMBgURmuAm+JKpMxF2p07+KAQawIPRAzjddgRZ3WUwKCKpzvd0ScZoASQ9VwsFPtuRLJYAchAaFlmvhGHBOJvOKO4Jr8KRQjEt4QBBS7FwRqJGGgt13SBeYBT7mEHgqwCWCpwAEbP0zWDI0SwFAnCKqOP4yC2/C/jAD7PpEmZNP2u49pWoSlLk/hiAobbIMgIB0OWWByP4AAGFF3rQJYsGSXDANkhicK4nZHswnAAOTXgozCMAA9DQ/wcQuAZyh+nAAIJYFghoRpwwAlpwnAhGE9GcMw0RiDQAybh68hQChLEALyMXknIJk6ybqm6cSySJSmIVmnCGopSmcG0P6aQUn5gG5bmhB0JjWPwRnALJnBGeM6maaINCGgx5lZBxFi0LkaUcQMR4pFkyAcZucDRGQHEALrMRGriuX5BlwKIkEwFAoW6fp/YVb5bnjJVbkqnW1aunAnVtHxnloN5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Pulutu8e4euCTm1EAMnm4M+6EIWAUkAEeSbGZiViefUPKU3iASG7NgYSfElo3atq8o20XGFqnWQmWyL/DfDoIHUBc6RjbcXyK6NgMIIfRMXJWuw0cHBQTLYabyZSIKfgAYFCkmn8XiABD8L/K+x+9qvFeKVyJlW3XKdlIqOaVyRKTiHVCwPVM1Mh8h41DKSaZ+5igrcHM46utuJO8SOweukPFBuq3ISGy0XIcW8JC2fIGu5Oh2r/fwBOUQJAUAQIeQBtCOjkBAVwVwIAA="} import { Hooks } from 'wagmi/tempo' const renounceRolesSync = Hooks.token.useRenounceRolesSync() // Call `mutate` in response to user action (e.g. button click, form submission) renounceRolesSync.mutate({ roles: ['issuer'], token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', renounceRolesSync.data?.receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.renounceRoles` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/token.useRenounceRoles.md","from":6760,"to":7303} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const renounceRoles = Hooks.token.useRenounceRoles() const { data: receipt } = useWaitForTransactionReceipt({ hash: renounceRoles.data }) // Call `mutate` in response to user action (e.g. button click, form submission) renounceRoles.mutate({ roles: ['issuer'], token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const events = Actions.token.renounceRoles.extractEvents(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `token.renounceRoles` Return Type](/tempo/actions/token.renounceRoles#return-type) ### mutate/mutateAsync See [Wagmi Action `token.renounceRoles` Parameters](/tempo/actions/token.renounceRoles#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`token.renounceRoles`](/tempo/actions/token.renounceRoles) --- --- url: /tempo/hooks/token.useRevokeRoles.md --- # `token.useRevokeRoles` Revokes roles from an address for a TIP-20 token. Requires appropriate permissions. [Learn more about token roles](https://docs.tempo.xyz/protocol/tip403/spec) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useRevokeRoles.md","from":240,"to":6685} // @twoslash-cache: {"v":1,"hash":"feffa8dd71c04910b36e8e796cdfdc9026dde663ac6793cf3241ca53a1f00b9f","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6INYQYCKcpDBEAjAAShBycADKGGDWiDx8ggB0aDFg2QCucHFRMfGJKWnZsTqFpGAAKl4APADCoQBmjAoUnIVg/JAA7mAAfP4i4roALADMsvJKKogAjOrU4tpBkdH8cQnwVdb+JmZIAEw2dqQOTkgAbO6eOHiEJOQagUys7FwGgkmml0D1Wi0UyjUGi2OjwAKMZ3MV2CNzufkQFxmz2oXjevk+AXoPzYHE4eX2YCB00eAHZwcsoZstLC9OT5KdTEjrvZHOi5hZsZhXnp3n4vkS9J0Bo5GKF+iVansDpVUtZ2l0en0BkMIKMxgAKLD2Zg6MhwAD8GXhuXyRQVZX2FSOquyAAVjabSHB1WBur1+oMRuMAJRWrJwG0Uu2lJ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QeXWPlKeflk1AVWgQVPYUB7AH4yepAqej4x8mweZ58P6aQRZRAFg2QqwB19aQ5naT04qFq70Kwr005eACmc5awC546Qsn0U6eIM6m5eArpLscYxwYYhgkY8geMDorsxwHs0EKYZMxsGY2oacMa+hDwvalqzMA6MIOwwNP1qo91qwj15KQsY5r1Ys71gheA/q5aEkFSYgGQ31usRMnsYAPsMKmcAw2cnIJc35ZcB6ZSay4Q0SdCDCiyV0CQJAf4FNfYl4wSPCBQvEuYh63NXAvN/8/NPO8AQtKSot81EtWioQ6eRGXNwc8tkyfNcSyt6Owt5SlSGt3CWtUtbkMtetPNhtitxt8EqtItFt4tVtNc2tcNBhNqfaH0ftN1egotWNONS5zgMwbgq53qRaH1egpNcsEkkQJYkRc4d4tUeCYAtQKdFsPtkgVg/tk5tqaNOdDAJK854MOaagqgBN65dKyMUsV6AaFat4rcGdls3Awc+AGQ+EcUkxFRrU0yTNw24ErNe65cndcAvcEA6in+AC6dD4oQediNl16KKNv0eArd94mdk9Kg5dD1ldE6YqtdqE/gjRt1U+cNMwLMhdSABdxNegjQC9mdZBU9GQcUqwFw4qqgDwPa+ddU1g2cn939v9n0/9r4gD4EwDMwP9f9FgADQDX9MDoD4DkDnQWNr0T1y5rg90IQsAxIfwkk2MNEdE7KTELEbEnEfObAPELpUJ1NmMfx1ouM/06NNN1gFkbknebQKuIC50T2QW8EbAYQyBxkeSL9+oumCgV2w0rkskPk/AyUKeUSdZbE/8j40hDDccRKkU9kDqaUtAvK/Kgqwqoq4qkq0qsqFw8qiqyqqq6qmq2quq+qhqr4SU9kaawaxp+U/84apUFA9k0UTENaFgdaba4TETza7jYArg0hhVcm3JT9bdi97kdgb9WUWjbs2Qot5o2Qyd4SFsuQz9HdXd0h/gH+ogSAoAgQ8gP6S9rICArgrgQAA==="} import { Hooks } from 'wagmi/tempo' const revokeRolesSync = Hooks.token.useRevokeRolesSync() // Call `mutate` in response to user action (e.g. button click, form submission) revokeRolesSync.mutate({ from: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', roles: ['issuer'], token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', revokeRolesSync.data?.receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.revokeRoles` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/token.useRevokeRoles.md","from":7030,"to":7617} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const revokeRoles = Hooks.token.useRevokeRoles() const { data: receipt } = useWaitForTransactionReceipt({ hash: revokeRoles.data }) // Call `mutate` in response to user action (e.g. button click, form submission) revokeRoles.mutate({ from: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', roles: ['issuer'], token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const events = Actions.token.revokeRoles.extractEvents(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `token.revokeRoles` Return Type](/tempo/actions/token.revokeRoles#return-type) ### mutate/mutateAsync See [Wagmi Action `token.revokeRoles` Parameters](/tempo/actions/token.revokeRoles#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`token.revokeRoles`](/tempo/actions/token.revokeRoles) --- --- url: /tempo/hooks/token.useSetRoleAdmin.md --- # `token.useSetRoleAdmin` Sets the admin role for a specific role on a TIP-20 token. Requires appropriate permissions. [Learn more about token roles](https://docs.tempo.xyz/protocol/tip403/spec) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useSetRoleAdmin.md","from":250,"to":6583} // @twoslash-cache: {"v":1,"hash":"c4dfbc1c2509d94e1eda6bf007b494a3199ae8c05d6345fb80ca7a05858d98eb","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6INYQYCKccDoAShByAIJQzKYAyhhg1og8fIIAdGgC8jkArpHJ0bEwCUlgqek5UTpFpGAAKl4APADCoQBmjAoUnEVg/JAA7mAAfP4i4roALADMsvJKKogAjABsGuLaQZFoMfGJKWnW/iZmSABMNnakDk5IW+6eOHiEJOQagUys7C4BkEM00ui2d2Mq2Ual2Wh0eGBRiu5khtnsjj8iBuqje1C8n18PwC9H+bA4nHy/HkoLmLwAHCtFDDEOpqHsEXoqTTZKZUfcMc9EIsNnjMB89F8/L9SXoesNHIxQkNSuUTtVatYur1+oNhqMIBNJgAKLD2Zg6MhwAD8mSReQKYGKqqOFSqZzqAAVzZbSHBtWA+gMhiNxlMAJR27JwB3Up0lGBlV3qj3WeqNZptHABoN60OGqYAHTAYFEFrgZusMBVibVlVONXO/igEGsCD0wM4PXYER0aFMCkp+GrogbnFIFS7PdEERw1kYfWs48npk4M5aAElPTcLJTHTli8WAHIQGiZFr4RhwThXtcRc74CeQEqcQgCIeiLhjUSMNDX7ukEO1ZoI8YRPEqYDFvknAAEbVqY1gyEUsBQJwyozjBMitvwsEwAB1akBmYADnehEVqEkQ5P4YgKO2yDICAdBllgcj+AABhxf60MWLDklwwBZIYnCuF2E7MJwADk34KEkAD0NAAhJh6B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XKINLaYNi6FqsahEVY1h54oE/UPyYADQrtvsetiwWwSq01LIFZ71QQLt6SftTKtZ9ZWIqgrwTZ4ott4aRBeA4NRsOkIEU8ntv03Aqc+AmQbEJUFRER40OyyNVWeEaNo6PcedcAS8EAYym+yCHt4EoQ/tUMhtcMZaHIQQWdYEXtddKg0dS1sdzgWw8wjaNE/gVReAC141xZkgy1wd6wpZqdegLQrdXt4B9dmQJUGwNwT18dIskgFgA01g9cB9R9WwJ9Z9MEF9eEV98wx99Ip959l9h9z9N9r9d9D9PQP1xa/1asrgIMIQsAZIgIukzk14IkPQYkkk0kckCkbASkSpu1sNXk6QiR9orkzotYp1cNPkMU2enQoF6CP0625mqt5EYQz+CYtS29xojyCg82600UhkSU/AgwklWSMESQSCEEdBn1mDaYDK+UoUGqpgLUkkkq0qS0FUoUvqNUSC9qCjsUhUkkSaFgKaOaujejmaajrgdBAVXGOJm92dbdQUdgu9jUwjUcZN1orBcCkdQM/dOdEEQ9dB/gG+ogSAoAgQ8ga67dXICArgrgQAA==="} import { Hooks } from 'wagmi/tempo' const setRoleAdminSync = Hooks.token.useSetRoleAdminSync() // Call `mutate` in response to user action (e.g. button click, form submission) setRoleAdminSync.mutate({ adminRole: 'defaultAdmin', role: 'issuer', token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', setRoleAdminSync.data?.receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.setRoleAdmin` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/token.useSetRoleAdmin.md","from":6929,"to":7494} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const setRoleAdmin = Hooks.token.useSetRoleAdmin() const { data: receipt } = useWaitForTransactionReceipt({ hash: setRoleAdmin.data }) // Call `mutate` in response to user action (e.g. button click, form submission) setRoleAdmin.mutate({ adminRole: 'defaultAdmin', role: 'issuer', token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const { args } = Actions.token.setRoleAdmin.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `token.setRoleAdmin` Return Type](/tempo/actions/token.setRoleAdmin#return-type) ### mutate/mutateAsync See [Wagmi Action `token.setRoleAdmin` Parameters](/tempo/actions/token.setRoleAdmin#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`token.setRoleAdmin`](/tempo/actions/token.setRoleAdmin) --- --- url: /tempo/hooks/token.useSetSupplyCap.md --- # `token.useSetSupplyCap` Sets the supply cap for a TIP-20 token. Requires appropriate permissions. [Learn more about roles](https://docs.tempo.xyz/protocol/tip20/spec#role-based-access-control) ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useSetSupplyCap.md","from":250,"to":7121} // @twoslash-cache: {"v":1,"hash":"d3b1cd4a14575e906a78bb7cbc3171540f904daf431667513fb951963d8d9fc1","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6IAAUoiaicACUnABmAK5gjowQYJxY4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hOYKpDWo5DNqlDSqnyWDdD3OeDwDOwXh0qbDTkHDBOqDEQ6D1DfDE8AjjDhDIjxDQR7Wn4C8JV3WSAE9qWfWIATDog89n9EkqgDVKYU2xWFJbVZWgDFCE8FU9pS08YN0d0KQw4DjfCajwkkg0CpVKE5V+6egRwHjDA6CJ4C9o2zgqgAEjVt602rV/9Njz6djV0LjQS3AEQ+AZQWMvslZMZrg8aNiCQdiUYHiW1yDegGTFIcmyg60qTt0QSXj/6AGfjyW3EaWeA9TrjYAVTKgYTAYETR8f4p4BoK9nI/g1ZeAc9192jl6k9/oAGVjeg44zjDT/idgFIZQvsUCY90Tu4C8kgFgDC1gdiOzXop4+zhzxzpzRouzFzBzRzbQJz8DZzezDz1z8D1VB8i99Vrgq6uYsAkEZO4o8sggpMnm5MfRiM1MtMpIbADMzmILAW7mZM3m6ozAfmu5+Yz9qCqZMEisrYB9KCtUmsD01olYNyiyuSfut+qQMMeY0e4RTw3T4IMuCgcIzwJsVwb0dO/ANQ0tQcbQ1MMy90NcOLBih6Hs+sYG+iZQyL2GKoYcDogcp4kQFA+sVWPstA9WLWureryr6rtcNcwdOuuFKz10az48GzWTgc4rukcIBj1kcIwT8qfCTYqz3TvTNc/gvchjiAoAgQ8gERKQnTCArgrgQAA==="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' const setSupplyCapSync = Hooks.token.useSetSupplyCapSync() // Call `mutate` in response to user action (e.g. button click, form submission) setSupplyCapSync.mutate({ supplyCap: parseUnits('1000000', 6), token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', setSupplyCapSync.data?.receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.setSupplyCap` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/token.useSetSupplyCap.md","from":7467,"to":8058} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { parseUnits } from 'viem' import { useWaitForTransactionReceipt } from 'wagmi' const setSupplyCap = Hooks.token.useSetSupplyCap() const { data: receipt } = useWaitForTransactionReceipt({ hash: setSupplyCap.data }) // Call `mutate` in response to user action (e.g. button click, form submission) setSupplyCap.mutate({ supplyCap: parseUnits('1000000', 6), token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const { args } = Actions.token.setSupplyCap.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `token.setSupplyCap` Return Type](/tempo/actions/token.setSupplyCap#return-type) ### mutate/mutateAsync See [Wagmi Action `token.setSupplyCap` Parameters](/tempo/actions/token.setSupplyCap#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`token.setSupplyCap`](/tempo/actions/token.setSupplyCap) --- --- url: /tempo/hooks/token.useTransfer.md --- # `token.useTransfer` Transfers TIP-20 tokens from the caller to a recipient. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useTransfer.md","from":133,"to":11392} // @twoslash-cache: {"v":1,"hash":"7775daec2b381b6bcd7a8eff1994271be08a51ae7321b1edd956fd4293c96767","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsV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ch8QvIVUKSE1CUhpiNIQY1KFCMc0FQoRVY2SGKpxFxQjIVEOMYCLmG4jYRQUNqFKL6hkivhdIoCEaKLG8i0RYotuR6LGhqgCwHwL/ltDsZnjFVGLPMGvZuIRoPYTrzWxDDyIow8YcAEmHTCyGnCqxZdgxmCQAFZ4KbMQuBCkKLBzgfiYtlJlUAVe59SmfvVya2LfMtM/YS2AgBlAmZRoLLDljywFYisJWMrBViqw1Y6sDWJrC1jawdYusPWNoPNQnQEyzergAdLmFgCAQVc4oBBZjA2EmZcY+MQmKSDYAkwdM/S4LLKEMzGZVQ6oZgOZmOlyCuyIEcWJZHCiMKZYcsUmNaHHChp2kQSZAqYBYaAxYW8kSsYsnBDRoFAGrTOFrCtw65+ANQU2iozaD4wmkJ0POHILhAzpbYKsdJvHRmX6hQQcIVQG7DfCRAKAKsZLI7FoAZZClLMkpezPKVcyqlvM2pQLIaXCzmlZoWFRRAdi7YLA+2E7GSvJX2h8V+cPOOeIW5f0eoB6c4IgDdi/LrGRkOEECrziLz6ZSoZlesRQVsqTaxmLlfLJVC5K+VVUbZefEFX1g84/geuKICQCgBAg8gIQikDPAIBXArgIAA="} import { Hooks } from 'wagmi/tempo' import { parseUnits } from 'viem' const transferSync = Hooks.token.useTransferSync() // Call `mutate` in response to user action (e.g. button click, form submission) transferSync.mutate({ amount: parseUnits('10.5', 6), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) console.log('Transfer amount:', transferSync.data?.amount) // @log: Transfer amount: 10500000n console.log('From:', transferSync.data?.from) // @log: From: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb console.log('To:', transferSync.data?.to) // @log: To: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.transfer` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/token.useTransfer.md","from":11734,"to":12373} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { parseUnits } from 'viem' import { useWaitForTransactionReceipt } from 'wagmi' const transfer = Hooks.token.useTransfer() const { data: receipt } = useWaitForTransactionReceipt({ hash: transfer.data }) // Call `mutate` in response to user action (e.g. button click, form submission) transfer.mutate({ amount: parseUnits('10.5', 6), to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const { args: { amount, from, to } } = Actions.token.transfer.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `token.transfer` Return Type](/tempo/actions/token.transfer#return-type) ### mutate/mutateAsync See [Wagmi Action `token.transfer` Parameters](/tempo/actions/token.transfer#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`token.transfer`](/tempo/actions/token.transfer) --- --- url: /tempo/hooks/token.useUnpause.md --- # `token.useUnpause` Unpauses a TIP-20 token, allowing transfers to resume. Requires appropriate permissions. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useUnpause.md","from":165,"to":6179} // @twoslash-cache: {"v":1,"hash":"d93f9e8e1b5b8ad9644753f33d39aaff041fc2bd4761737cbca90bbd074879b5","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQ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aJW8WsAVWrvfwZ0UQJAUAQIeQA1CWxkBAVwVwIAA="} import { Hooks } from 'wagmi/tempo' const unpauseSync = Hooks.token.useUnpauseSync() // Call `mutate` in response to user action (e.g. button click, form submission) unpauseSync.mutate({ token: '0x20c0000000000000000000000000000000000000', }) console.log('Transaction hash:', unpauseSync.data?.receipt.transactionHash) // @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `token.unpause` action and wait for inclusion manually: ```ts // {"path":"/vercel/path0/site/tempo/hooks/token.useUnpause.md","from":6520,"to":7013} import { Hooks } from 'wagmi/tempo' import { Actions } from 'viem/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const unpause = Hooks.token.useUnpause() const { data: receipt } = useWaitForTransactionReceipt({ hash: unpause.data }) // Call `mutate` in response to user action (e.g. button click, form submission) unpause.mutate({ token: '0x20c0000000000000000000000000000000000000', }) if (receipt) { const { args } = Actions.token.unpause.extractEvent(receipt.logs) ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `token.unpause` Return Type](/tempo/actions/token.unpause#return-type) ### mutate/mutateAsync See [Wagmi Action `token.unpause` Parameters](/tempo/actions/token.unpause#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action * [`token.unpause`](/tempo/actions/token.unpause) --- --- url: /tempo/hooks/token.useWatchAdminRole.md --- # `token.useWatchAdminRole` Watches for role admin update events on TIP20 tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useWatchAdminRole.md","from":137,"to":4971} // @twoslash-cache: {"v":1,"hash":"149a552ec742b4dd66646f0d767625b9e60928a7afe48d207c20bce63c3d7530","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXGgC8lGaugAssUmKymoamTp47fydeWZIRSC29o5+iABsVdRetb4NAfR4AGYArmCOjBBgnIdwMADqomi2AIJQzKYAShByADwAwuf7jAUAD4ABRYezMHRkOAAfkQnGAAB0LpxUQtTABJKBwzhgQ7MABGZE4AB9LmBYACzFAANzI1GozKw+FIlEMhmkT4wHEAAwstAAJMARKRTApXDzSZw+YLhWhRYoJcgALpSvEyGRS46U/K0+nshlmADuz1eYA+cl5/KFIrFEqlMpt8rtPJVasOGq1FJgVJgerZBuu3tIVtltsVkrJjrlCvFrtVZPVmrJ2p9urpAdcXp11Iz7P2nOYACEZBBrPwcQTAaYuCnvb7/ezzgBRUickPwkEgsjt+Gt9sASk4AF4gZwiBBGFAh3Wc37s2nc/rUWwNTj5YcYAuG9v08vOKuTIoMWAnERRDIcXjCcTZ4v53eG3mGecLTBTaYAKpYKD3P04rsmXhI17ieF53i5AA6R4tDgChOFLBRgNA/AP3NKCABkIAUIdR3HSdp13JcAwmeQcQAFQ6MAsQAeVIZ4oFIeA4CIv1nzRf5ARxP4wABBRWMbBl5FEAk5GxeECT4ORRAuR9dQEjNXAHeEJynZEwFESE4HBawtyuW4ULQt9/CgMsED0HJOH2dhOBAh58DFThyIxAA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aAyKJAaKImUwXSfwIgCwSCamHUiwCwBgomCOHmKwd+WOGbL+IIRCXg8wJeABQQ5YFgkQsBE+EWCQmuNGeuFWRuAMZuaUfuNuCUDuY0YaXuf08eWMIM/cYeW7cMp0SMnkKeRgkmamWIPOeec0u0zg7+NeP+fg+0wuPeVQZ0rYCuN0vAcWLTMgTAIcLyCiKiWieiKARiOdC2P0K2fBPABiXNFiGyDEOnJ1fYFI5yNyDyPqZ+XQamHoFYGOKmdIbMoILyG0pAGcgs3eWYVwQmeBWAZoJxbKHqPKKyQsLjBzSqaqNgWqODMAHqSCPqZmNWfWEaMaVOd8dOBWKATsJkbWbCXCMcMaZabBMvDaICTjY6FEU6FELyeEYqfkdyawfUhCxCpC5ClC1C/Uw6cGKwkAWuUQJAUAQIeQJhc4cYBAVwVwIAA=="} import { Hooks } from 'wagmi/tempo' Hooks.token.useWatchAdminRole({ onRoleAdminUpdated: (args, log) => { console.log('args:', args) }, token: '0x20c0000000000000000000000000000000000000', }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `token.watchAdminRole` Parameters](/tempo/actions/token.watchAdminRole#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`token.setRoleAdmin`](/tempo/actions/token.setRoleAdmin) * [`token.watchAdminRole`](/tempo/actions/token.watchAdminRole) --- --- url: /tempo/hooks/token.useWatchApprove.md --- # `token.useWatchApprove` Watches for token approval events on TIP20 tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useWatchApprove.md","from":132,"to":4824} // @twoslash-cache: {"v":1,"hash":"1549f2859212b937c8657167655eeec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8acHMekamT8b8SsQqKqCYmxfyfcADDqRELqRELSGEfyPkdSawQk+chcxcpc5clcwktqJiGgkAD2UQJAUAQIeQBBc4cYBAVwVwIAA"} import { Hooks } from 'wagmi/tempo' Hooks.token.useWatchApprove({ onApproval: (args, log) => { console.log('args:', args) }, token: '0x20c0000000000000000000000000000000000000', }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `token.watchApprove` Parameters](/tempo/actions/token.watchApprove#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`token.approve`](/tempo/actions/token.approve) * [`token.watchApprove`](/tempo/actions/token.watchApprove) --- --- url: /tempo/hooks/token.useWatchBurn.md --- # `token.useWatchBurn` Watches for token burn events on TIP20 tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useWatchBurn.md","from":125,"to":4714} // @twoslash-cache: {"v":1,"hash":"6bdef3454b786456322850b22fda9f6b5e83f7c766139b4da151ac51f819efe7","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXGgC8lGaugAssUmKymoamTp47fydeWZIRSC29o5+iABsVdRetb4NAfR4AGYArmCOjBBgnIdwMADqomi2AEKHpGAAPADC5/uMCgB8AAosPZmDoyHAAPyITjAAA6F04iIWpgAklAoZwwIdmAAjMicAA+lzAsB+Z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YA8QWS7qVYhwFS2hMad+nq2hsQzmjo+wk4sQGyjSimAInyuBoIwk5MqaKqJBDyihHmMgk4iamaaAfCreIyzqA+MAbqOS3cnqBS8yiyfqKyFkPhdhzSPh/h9waRCymURyIONacAROj8ustYvWqgqOl6c6Vces0Ii6naC4FRtYCu9uA6WClRnA6gOMZ6ROwi5RhR+sq6dRnSmeSu/R0IbRE6+yGu72khhqhYQSSRGRQRwyTqYyrqIkUyURXqsRE+/qqySRIaTSqRGa6RhxmRkUtEkG7AhYpgGR2aVeEkSAUki0pghE/gRAFgk4W07xFgFgC+i0dM20FgfMVszMLsdsqcS4O+K0507sl0O0x+WwEsT05+Mso08sc4DIJ4ysEoPIasMoGsnIWsuEPRBs68RsqEMcugXsjM601su+oJQQjs0w5ge+bsgszgBQqgcJfsCJuwSJb0ZAmAEYvkl414d4D4T4PKb4iM5IyMPceAj4z41qdEKIc2SK+wzBrEHEXEvkNMvxS+O0a0QJm06QKcQQvkEJVJLJOc0WrgC0VcsAzQ8CWk3kukZobIBkxkMGZklkMA1k+U3kk42ph0EMciIUnMv0dIoM24u4MYisoqHc4uQ4q6mUuUFAOovk0IhkPInE1gXxuZeZ+ZBZhZRZXx6UqEEBIAssogSAoAgQ8gi85w4wCArgrgQAA==="} import { Hooks } from 'wagmi/tempo' Hooks.token.useWatchBurn({ onBurn: (args, log) => { console.log('args:', args) }, token: '0x20c0000000000000000000000000000000000000', }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `token.watchBurn` Parameters](/tempo/actions/token.watchBurn#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`token.burn`](/tempo/actions/token.burn) * [`token.watchBurn`](/tempo/actions/token.watchBurn) --- --- url: /tempo/hooks/token.useWatchCreate.md --- # `token.useWatchCreate` Watches for new TIP20 token creation events on the TIP20 Factory. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useWatchCreate.md","from":146,"to":4766} // @twoslash-cache: {"v":1,"hash":"ac42775d21c15bba9530036c843c3f7209edb0afc3fa66af279c7dfb7b6482f6","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXGgC8lGaugAssUmKymoamTp47fydeWZIRSC29o5+iABsVdRetb4NAfR4AGYArmCOjBBgnIdwMADqomi2AMKkMPcwADyP5/uMCgB8AAosPZmDoyHAAPyITjAAA6F04iIWpgAklAoZwwIdmAAjMicAA+lzAsB+ZigAG54YjEZlIdC4QiaTSJvIMQADCy0AAkwBEpFMClc7MJnE5PL5aAFimFyAAuqKsTIZKLjqT8pTqcyWR0wGiMTjfqYuETDQpjfLFYdlaqSTAyTBNUzOK5beryVTnftSBBmAAhGQQaz8A1GsAm4nux2e5nnACipB9pAxAIBZCT0ITSYAlJwALx/ThECCMKC5olq+0at1Vj1axFsZUYqWHGA1h1QdsamM0xsmRQo8NkIiiGQYrG4/EVu0drt153nAAquuerxo6Ohqbp0IA7vcni83gA6ACCWjgFE4gYUu/3+FXx4AMhAFLmC0WS2W59H65xrN9fgxL4wB+BRvydZl5FEHE5A3TgcT4ORRAuaco07VDax/MBXGzaFi1LeEwFEUE4GBaw2yuW47wfGh/CgIMED0HJOH2dhOD3B58EFTEYB3ThFxRAAFAoLE4VkwDgP9D3XI9/DEBRGOQZAQDoYisDkfx2S0tA4FoeEQlaGFw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YB5VY3pjAXwCCro/ph4AYHpjZqgp475IZqCbZtp7Z0ZHZnRnYxRC5JQ05PYnZdRfZ4Iww0BA5MdU445fwI4o4ZBHSw5fwE5Ex5BrAU4i005M5s5c5dRq4i5zT65nRy5K5QyzSPYIzXBN5dA1SVhd4O5ZSe5zxFSiDz4AYCgr4zp/xYBmhtEjJgpTJvRfQ8NlM7JHIYBnJ6pgpQpdRwprhuo15CZYotQNYwAUZNw6RcYXw3xCw4oMobiP1LJtxcMqoEQapsJZCQBbZRAkBQBAh5BMFzhxgEBXBXAgA="} import { Hooks } from 'wagmi/tempo' Hooks.token.useWatchCreate({ onTokenCreated: (args, log) => { console.log('args:', args) }, }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `token.watchCreate` Parameters](/tempo/actions/token.watchCreate#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`token.create`](/tempo/actions/token.create) * [`token.watchCreate`](/tempo/actions/token.watchCreate) --- --- url: /tempo/hooks/token.useWatchMint.md --- # `token.useWatchMint` Watches for token mint events on TIP20 tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useWatchMint.md","from":125,"to":4710} // @twoslash-cache: {"v":1,"hash":"bca02bde7cbd2b13b68198315831f106355326a3a7bb259d3bedb8adc457d8c2","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1O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XJkKnr7RbKPB9xWSSR5iZBYgCqPjWAnJ5hAhEL6jTgkJkIPLmSMADRcC4SFgircqPwsDiBvxn4X6gYqwdZ4YFRWTnB5oUG0LjzN4iCkLpbFpgBea5hrwsDtZbyyKtLtr7D/CxDBgWo9J9KJpgDxAJL2rliHB5LKGhoX6OrKGxBzIvD7AjixDeqVK5b/CUpoEgi8QqzIoyq4HnKSGsj2YyAjgJr3DMK149LWod4wB2pJJNyOppLjKTJuozJFKuFmHVKuEeFoBxGDRBSbLfalpwCY4XxqxVgtaqAw786VqvjqxQgTqNrTgFFViS7m4dqIKFGcDqDbxQGY6CL5GZEawzplGNKJ7S7tFQh1EDq7pDoF6sgZSap5geJRFxFeHdJWp9K2p8RDJBFOqhED7uqzJRFLJVKxHsCJrxFbH3CJGTiRoVTsB5jxq7HsHuRF5CRIAiTTSmDYT+BEAWAjgrTPEWAWAT7TTkyrQWDszGw0y2zmxxyzgr5zSHQOzHRrTb5bCCw3T76iz9QSyTj0ghQywigcjywSiKysjKyqw1F2jzzazwShy6DOxUyLQmyr6AlBBWzTDmBr72xczOAFCqBQnuwwm7BwkPRkCYChhuSnjnhQBXg3h3gPhPgwzNx4DCnMqPgUTIhjayr7DUH0RMQsRuSkyfFT5rQLR/HLTpCxxBBuQglkkMmpxBauBTSviwDNDgIqQuTqRGgmgPy6TAaGTGRsCmSCEuQjhqnbSAxVi+QahMwazqa0h/TribiRhSyIJ5FMLaR9gzrJTwipTwhuRQjaQcjMTWBvHZk5m5l5n5kFlvGJTwRAEgBiyiBICgCBDyATznDjAICuCuBAA==="} import { Hooks } from 'wagmi/tempo' Hooks.token.useWatchMint({ onMint: (args, log) => { console.log('args:', args) }, token: '0x20c0000000000000000000000000000000000000', }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `token.watchMint` Parameters](/tempo/actions/token.watchMint#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`token.mint`](/tempo/actions/token.mint) * [`token.watchMint`](/tempo/actions/token.watchMint) --- --- url: /tempo/hooks/token.useWatchRole.md --- # `token.useWatchRole` Watches for role membership update events on TIP20 tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useWatchRole.md","from":137,"to":4833} // @twoslash-cache: {"v":1,"hash":"2a04f664116ac7d0cf34ca591cad47cbc06e1aab303131a088a76159faf54e6c","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXGgC8lGaugAssUmKymoamTp47fydeWZIRSC29o5+iABsVdRetb4NAfR4AGYArmCOjBBgnIdwMADqomi2AEoQcgA8AMLn+4wKAHwAFFh7MwdGQ4AB+RCcYAAHQunARC1MAEkoJDOGBDswAEZkTgAH0uYFg3zMUAA3HCEQjMhCobD4dTqaQXjB0QADCy0AAkwBEpFMClc7IJnE5PL5aAFimFyAAuqLMTIZKLjiT8hSqUzqQ5rBBjmgOVzefzBcLReKTVKzez5YrDsrVcSYKSYJrGdrrs7SEaJaaZSLCZbJdKhbaFYSlSrCWqXRrKR7XE71WSE0z9izmAAhGQQaz8dHYn6mLgx52u91M84AUVILJ9UP+/zI9ahtfrAEpOABeX6cIgQRhQLtllNu5Nx1NahFsZXoqWHGATivL+PTzizkyKZFgJxEUQydGYnF40eT8dnitp6nnZ5yACqWCg9zd6KbtKhAHd7k9WQA6ABB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DYtAKEdQYhcQtXOaPYnKM424xDN4i44QrDN4u48nR4vfGKPafNJcZomqVo+Yrov5HooFZtPyMFQYjtEYrtWFHtBFSYwdW5GYldOYnEhY4CWdIyBdJcUweY9dA/IKJAEKNGUwFSfwIgCwP8fGJkiwCwUAtGX2AmfGKwHGeuBOJueAreeeaYcwFApObuZwQmTArYbOdmXA/OKGIucWEuSWMuYCBeDGQmUOOuIOTGAUzeVuEU5AmmZOOmAoVQaUweWU3YeU7mMgTALsByPCAiYiUiciT1aiDWN0LWH+PAMiCiStIyZEEHWVfYCwyyGyOyDqDU3QEOAOXk3U9IDeIIByJA1YE0iU2YVwVGPUWAZoORFKNqdKAyTMJDCTQqEqR2NgcqPwtqP8DqMmVUmAPqLUKOGAIWUaRsWkWWZWHsPsfqaaAJO9D8RDTaeEbaeEByKEHKLkWyawVkhcxcpc5clc1c1k9ab6fgkAAuUQJAUAQIeQBBc4cYBAVwVwIAA=="} import { Hooks } from 'wagmi/tempo' Hooks.token.useWatchRole({ onRoleUpdated: (args, log) => { console.log('args:', args) }, token: '0x20c0000000000000000000000000000000000000', }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `token.watchRole` Parameters](/tempo/actions/token.watchRole#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`token.grantRoles`](/tempo/actions/token.grantRoles) * [`token.watchRole`](/tempo/actions/token.watchRole) --- --- url: /tempo/hooks/token.useWatchTransfer.md --- # `token.useWatchTransfer` Watches for token transfer events on TIP20 tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/hooks/token.useWatchTransfer.md","from":133,"to":4822} // @twoslash-cache: {"v":1,"hash":"f4621a5648e0a663badc09437893499eb743897952bf9f61a7fc56fc1e4f1550","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIAJCCAawRU4aAIYckATioAbGGADmafEgCsVMaQUwGiELwFCQMxmFyIADFQDG+caOs1yiSQF8K6bOYLEylanS6ICxsHDx8gv4i4roAzADssvJKKojq1OLaQQaRsqbmAEw2dqQOTkgW7p44eIQk5BqBTKzsXGgC8lGaugAssUmKymoamTp47fydeWZIRSC29o5+iABsVdRetb4NAfR4AGYArmCOjBBgnIdwMADqomi2ACqlYHD7ZAA8AMLn+4wKAD4ABRYezMHRkOAAfkQnGAAB0LpxkQtTABJKAwzhgQ7MABGZE4AB9LmBYH8zFAANyI5HIzLQ2EIpF0un7UgQZhYgAGFloABJgCJSKYFK5ucTOLyBUK0CLFOLkABdSU4mQySXHcn5am01l09o8vmC4Wi8WS6UmuVm7nK1WHdWaskwCkwXUsziuJ3ayk0j3szkAIRkEGs/CxeP+pi4JK1Lp1ftZ5wAoqQOaQsUCgWR07DU+mAJScAC8AM4RAgjCgRdjztdUG98d9euRbHVWLlhxgjfrPYTLc4bZMijRYCcRFEMixOPxhNrPrdfebHvOz1Er3eGdhWYZsIA7vcni83mQAHQAQS0cAonBDCn3h/wa43Z4AMhAFEXS+XK9Wl27EwNDowCxR5gIxAB5UhzygKBSHgOB/3dVlrF+f4sR+MA/gUJDAOReRRDxORMVhPE+DkdckNwxFXALWEKyrREwFEcE4FBaxuyuW5H2fE8digUMED0HJOH2dhOAPB58FFThHjRAAFAoLE4CZ5BU49N04GASDHOBT38MQFCE5BkBAOgWKwOR/G5Gy0DgWhERCVo4XCQxPVEjlmE4AByA8FGYRgAHoaBabzEURI4TjQM4LnPLAsCBItmWRHI9NUsBTy4u4pN4zcgWSulVw0sggQZJKBxRc44AgORTzvIFvNyshEG8m8yoHdw9Vo8KkXgtBDlIC4PigRgiABbLbBksTS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MFDAKFD1KlKeBGUDMTHLPlHqPrHxNuAyOTLTCWGWAVJVKMRrt5LuD+u1EiJ1EiOlLCN5HyEpNYASTObOXOfOQuYuQSa1DRFQSAM7KIEgKAIEPIF/OcOMAgK4K4EAA=="} import { Hooks } from 'wagmi/tempo' Hooks.token.useWatchTransfer({ onTransfer: (args, log) => { console.log('args:', args) }, token: '0x20c0000000000000000000000000000000000000', }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ## Parameters See [Wagmi Action `token.watchTransfer` Parameters](/tempo/actions/token.watchTransfer#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action * [`token.transfer`](/tempo/actions/token.transfer) * [`token.watchTransfer`](/tempo/actions/token.watchTransfer) --- --- url: /tempo/actions/token.watchAdminRole.md --- # `token.watchAdminRole` Watches for role admin update events on TIP20 tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.watchAdminRole.md","from":135,"to":5281} // @twoslash-cache: {"v":1,"hash":"c420598bc27431292ec1a4b52f62cd46424331fc2b9c562b34ffb419fe3f27be","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qQDqW/YZYGhD/ACiJMcASnorpGAAKl6l5VKI6rK1yqoa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ArgrgQAA=="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.token.watchAdminRole(config, { token: 1n, // Token ID or address onRoleAdminUpdated(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onRoleAdminUpdated * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchAdminRole.md","from":5495,"to":5753} declare function onRoleAdminUpdated(args: Args, log: Log): void type Args = { /** The role whose admin role is being changed */ role: Hex /** The new admin role */ newAdminRole: Hex /** The address that initiated the change */ sender: Address } ``` Callback to invoke when a role admin is updated. ### token * **Type:** `Address | bigint` Address or ID of the TIP20 token to watch. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchAdminRole.md","from":5944,"to":6146} type Args = { /** Filter by role */ role?: Hex | Hex[] | null /** Filter by new admin role */ newAdminRole?: Hex | Hex[] | null /** Filter by sender */ sender?: Address | Address[] | null } ``` Optional filter arguments to narrow down the events to watch. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchAdminRole.md","from":6348,"to":6393} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`token.watchAdminRole`](https://viem.sh/tempo/actions/token.watchAdminRole) --- --- url: /tempo/actions/token.watchApprove.md --- # `token.watchApprove` Watches for token approval events on TIP20 tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.watchApprove.md","from":130,"to":5175} // @twoslash-cache: {"v":1,"hash":"a50530b6c3dfb0005748890f9451c15c1c16886305459d01bf4b5b8957109244","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qQDqW/YZYGhD/ACiJMcASnorpGAAKl6l5VKI6rK1yqoaLTp6eDWm22ankFisAGYBo5nKNGhNqM8DDM/NQAkxWOwuEZBMIXtp9AAOT4Kb4NGraNp4HEmLrgpBQkD2GEjPrwjyIqbI3xzNELAz5LGcNAQADWinxFRkNVJ9SQAFY/lSDCLxWA6T1EIzmadWYgAEyVBGYLk+WalGj8kAJNb8XGcYH2bhYLCkXwAHiOWQAfEEOslUl7khROFhHMw9GQ4KkacIAHSqxRxx34Z2u3xxgAK4cjpDgnuKSm9ET2B3wRxOwwuijQNzQd0eXlyYHEEbgYd4MAdZbTbpIpSgEF4CAM+xB8E4CXYnAeAElM/rrMKxYpOOIXX3QpwYJc0HA4xbxEoR8hkCA6K2sApSgADO973KCwrAaKkGBbGBBpQh/BoNBYThXEnN1mE4AByAABTYlGYRgAHoYjfMDH0xZ9hRgTFAOAiBQMg6DYIQ9gYAQhwLDgZC8lQrgX1jOAsISEDwKgo8CMQ4iaExCjciWOJC04ABeV93xoL8gmAXJOGiUjhFSZAOLYABdCgJOFIZhAKPdUnEsBJMkuSMLYONGCgBTUl/f8ggiZSdMA6zXAiXJuNiVYNjLASeDtEwExXMBkx7DdfD9QsQ20yShF7YhQlSEIdDgE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KAuoDKNIZQjAubDQr9FYIoUgnqK9I7NMCwnyFggvGQEvLFFpBfBAOvGQFvDvPvHTsfGfBfFfAsqmXfOmY/EfC/Nme/GuIotSWEv/McEAiQn0NIN3E9FArIXArFAoXQnqPqPKBGdyOodGYsM5ECGWNFMnM4WnFAHWWDlIWSL8P6YEEOSCEPL0O3EoXqCDDdDELABiOjDRJ5MIPRIxJpixPBPJBABRE+NRICu1EBCdLhHGIIVkFxH7vDC5CmO5LRN5GqH5AQiHEFCjCFCpBzKkNYGANZGFGAIVKEDFMeJHElCvGWUMriYHIPgiRVHZEtnVvHB+KQD5iKABCmM/LkAufYJZKUCNOIEgKAAEIoJYkIHgHuCAK4K4EAA=="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.token.watchApprove(config, { token: 0n, onApproval(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onApproval * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchApprove.md","from":5381,"to":5600} declare function onApproval(args: Args, log: Log): void type Args = { /** Amount approved */ amount: bigint /** Address of the token owner */ owner: Address /** Address of the spender */ spender: Address } ``` Callback to invoke when tokens are approved. ### token * **Type:** `Address | bigint` Address or ID of the TIP20 token to watch. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchApprove.md","from":5787,"to":5953} type Args = { /** Filter by token owner address */ owner?: Address | Address[] | null /** Filter by spender address */ spender?: Address | Address[] | null } ``` Filter events by owner and/or spender addresses. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchApprove.md","from":6142,"to":6187} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`token.watchApprove`](https://viem.sh/tempo/actions/token.watchApprove) --- --- url: /tempo/actions/token.watchBurn.md --- # `token.watchBurn` Watches for token burn events on TIP20 tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.watchBurn.md","from":123,"to":5109} // @twoslash-cache: {"v":1,"hash":"964634b1472c31080644e57c6495fef8eddfe7936d04a402712785277c2e7797","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qQDqW/YZYGhD/ACiJMcASnorpGAAKl6l5VKI6rK1yqoaLTp6eDWm22ankFisAGYBo5nKNGhNqM8DDM/NQAkxWOwuEZBMIXtp9AAOT4Kb4NGraNp4HEmLrgpBQkD2GEjPrwjyIqbI3xzNELAz5LGcNAQADWinxFRkNVJ9SQAFY/lSDCLxWA6T1EIzmadWYgAEyVBGYLk+WalGj8kAJNb8XGcYH2ABCdzAAB4jlkAHxBDrJVKe5IUThYRzMPRkOCpGnCAB0qsUscd+Bd91jAAUwxHSHAPcUlF6InsDvgjidhhdFGgbmhXU8cLkwOJw3BQ7wYA6S6n1VQoBBeAgDPsQfBOAl2JwHgBJdP66zCsWKTgAI1dnBglzQcFjFvESkHyGQI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yrsbMWersQcWgC8Q1HlKZr+sAReIbqjjEOvC5PKPbuQXHhlMBP8ccKkExlhsGBCXiqnlYakHCakIqMnBJlJohmCciaXnCS/mnkRsiZwKiZ5k8pJt8U4kOh2Ncg8S8UcRSt+KcautuAypcSyjcXupyjBA8Xyuis8ewF+q8fyVsO8eFE+hOG+h2B+kKXNMXBIGASgEeKru2KUEQNYLGL0OqdYNYNQSrEfNILYGAg0BAmjIENAmCJqJwXAtwb0G3JMMguaKgjbD3B/CvOFOpMvMPKPOPFPPDnPIvMvKvOvJvNvMcHvAfLqfoHOIjEwYbNdNfOFBwXfC9OrLwdyA6QIYsA5ECCWKFCHNoeHFAIAqbJUAwYacwZAgYNmSCAbPDEmaMG9EdDELABiJDJRG5MIDRHRGXjhDBDJBAKRHeBREcvVH+MPCBLGGQVkOxEboDI5MmC5FRB5GqN5D/L5HVAFIpPTKkL0GAMGHhhOPTCvELMiopPXGTnlD7DFAPJZGJCTvRq7KXh8QVNZM1tlgHC+KQFpiKD+MmCIrkFWfYGZKUD1OIEgKAAEIoLwkIHgFuCAK4K4EAA"} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.token.watchBurn(config, { token: 1n, // or token address onBurn(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onBurn * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchBurn.md","from":5311,"to":5478} declare function onBurn(args: Args, log: Log): void type Args = { /** Address whose tokens were burned */ from: Address /** Amount burned */ amount: bigint } ``` Callback to invoke when tokens are burned. ### token * **Type:** `Address | bigint` Address or ID of the TIP20 token. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchBurn.md","from":5654,"to":5740} type Args = { /** Filter by burner address */ from?: Address | Address[] | null } ``` Optional filter arguments. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchBurn.md","from":5907,"to":5952} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`token.watchBurn`](https://viem.sh/tempo/actions/token.watchBurn) --- --- url: /tempo/actions/token.watchCreate.md --- # `token.watchCreate` Watches for new TIP20 token creation events on the TIP20 Factory. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.watchCreate.md","from":144,"to":5187} // @twoslash-cache: {"v":1,"hash":"0fc1ecb422e1310805039e9f9c6a825260c57e6ebb91bb88edd178eeb92819a4","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qQDqW/YZYGhD/ACiJMcASnorpGAAKl6l5VKI6rK1yqoaLTp6eDWm22ankFisAGYBo5nKNGhNqM8DDM/NQAkxWOwuEZBMIXtp9AAOT4Kb4NGraNp4HEmLrgpBQkD2GEjPrwjyIqbI3xzNELAz5LGcNAQADWinxFRkNVJ9SQAFY/lSDCLxWA6T1EIzmadWYgAEyVBGYLk+WalGj8kAJ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5BJC5hcDGqvLhDm6swsCSAeKqG6CDKuJjrHxQDlK4iYbZFlG1I7RiDlLnZCDUKhArDjhSJQQ6LlpfI/IsYJBBAQgRBHpcpEEwZgDqAIoXrdArB4rjH/qBY0HjEQiHYtwJCxgQhypvpyBDZBA2qtBRHVixoQZjoJEmq9HnZyCxggYwZoBtIEFconp8rnpIquEioYq3pMEPrSqXFbHvqXE3FbCAm3plRubwbIHXiO6k4xBrCu6cDygB7sGkYwnHCpAia0bBgoloDAFl6sZYmpCKhRY6515O5IlN74klRFCwk4nuGpD4nwla5ab25BJLqdjfK/HAn3GcrfhPFnrTSCpvHXpir3pSowS/HyoUoAnQZAnSkgnRTAZTjgadgWDAlwaoGHjHim4dilBEDWCxi9D6nWDWBcHYxSgvSNDeyoJajoIGCYJ/RWDiE4LAyezSEQyMwpzBDDQ5iZzRTZztx1zbxcK7yXxLyVxTy5weQNypBNyKLHDhlk5dza5LzxlDwjxjxJmTy1y8AzyKDzyLyZn+lrwbwwBbxnxBkXwE5hlHwnwWDnx7xXxKBVlgC3ymkeyEi2AEzPSvwfSBAfz2kKiUy/yxzyiulJxyEGCk5AiliRSKwWEqxhytn6D6i9D8FWkUg9mAiOQgify9AdkSF6igw3QxCwAYgYyUSuTCDoQnT0SMQwTSQQCkQPgUSYzJBXl0QgSxhsFZDsSknLBTkgjORUTuRqheQwI+R+SowBQKRByKAhxQACzz7ZRRCpSiTM6kZZyUmgkVRWRDZVayyuikDWYig/jJi9y5D/n2CmSlAjTiBICgABDri4h4C3ggCuCuBAA==="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.token.watchCreate(config, { onTokenCreated(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onTokenCreated * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchCreate.md","from":5397,"to":5809} declare function onTokenCreated(args: Args, log: Log): void type Args = { /** Address of the created token */ token: Address /** ID of the created token */ tokenId: bigint /** Name of the token */ name: string /** Symbol of the token */ symbol: string /** Currency of the token */ currency: string /** Quote token address */ quoteToken: Address /** Admin address */ admin: Address } ``` Callback to invoke when a new TIP20 token is created. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchCreate.md","from":5918,"to":6076} type Args = { /** Filter by token address(es) */ token?: Address | Address[] | null /** Filter by token ID(s) */ tokenId?: bigint | bigint[] | null } ``` Optional filter arguments to watch for specific tokens. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchCreate.md","from":6272,"to":6317} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`token.watchCreate`](https://viem.sh/tempo/actions/token.watchCreate) --- --- url: /tempo/actions/token.watchMint.md --- # `token.watchMint` Watches for token mint events on TIP20 tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.watchMint.md","from":125,"to":5129} // @twoslash-cache: {"v":1,"hash":"1e6861a9411f2b10135215821f2c629c4813bdfdb5bb1a235a11dc6a7b4e8738","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi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xz7BjJShOpxAkBQAAhFBWEhA8BNwQBXBXAgA"} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.token.watchMint(config, { token: '0x20c0000000000000000000000000000000000001', onMint(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onMint * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchMint.md","from":5331,"to":5496} declare function onMint(args: Args, log: Log): void type Args = { /** Address that received the tokens */ to: Address /** Amount minted */ amount: bigint } ``` Callback to invoke when tokens are minted. ### token * **Type:** `Address | bigint` Address or ID of the TIP20 token to watch. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchMint.md","from":5681,"to":5768} type Args = { /** Filter by recipient address */ to?: Address | Address[] | null } ``` Optional filter arguments. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchMint.md","from":5935,"to":5980} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`token.watchMint`](https://viem.sh/tempo/actions/token.watchMint) --- --- url: /tempo/actions/token.watchRole.md --- # `token.watchRole` Watches for role membership update events on TIP20 tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.watchRole.md","from":135,"to":5153} // @twoslash-cache: {"v":1,"hash":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AmI8IWIa8iJEIlIIBqI3w6JdlepcJ8IIIYwqCsheJTcEyCyQQvIGI/I1RAoPTI8eowp1JeZUgIJrBaBFCYxq9cNxZJZJ1lY1YNZtddZZx5w1R1Ix4YAJ4Kpw4R9CoogcoZJclwSN5q9Pi6pHJmtEsk5DxSBtMRRdwkx+FchRz7AbJSgppxAkBQAAhFB2EhA8BnwQBXBXAgA="} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.token.watchRole(config, { token: '0x...', // Address or ID of the TIP20 token onRoleUpdated(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onRoleUpdated * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchRole.md","from":5362,"to":5720} declare function onRoleUpdated(args: Args, log: Log): void type Args = { /** Role being updated */ role: Hex /** Account receiving or losing the role */ account: Address /** Address that updated the role */ sender: Address /** Whether the account has the role */ hasRole: boolean /** Type of role update */ type: 'granted' | 'revoked' } ``` Callback to invoke when a role membership is updated. ### token * **Type:** `Address | bigint` Address or ID of the TIP20 token. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchRole.md","from":5907,"to":6105} type Args = { /** Filter by role */ role?: Hex | Hex[] | null /** Filter by account */ account?: Address | Address[] | null /** Filter by sender */ sender?: Address | Address[] | null } ``` Filter parameters for the watch subscription. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchRole.md","from":6291,"to":6336} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`token.watchRole`](https://viem.sh/tempo/actions/token.watchRole) --- --- url: /tempo/actions/token.watchTransfer.md --- # `token.watchTransfer` Watches for token transfer events on TIP20 tokens. ## Usage ::: code-group ```ts twoslash [example.ts] // {"path":"/vercel/path0/site/tempo/actions/token.watchTransfer.md","from":133,"to":5175} // @twoslash-cache: {"v":1,"hash":"5deeee8975448d70c44695a3fbb88e51e915d6eeb68dabfc6d4cce676856c16d","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BLAWywlLQAIBBAYzUYQwCKnDQBDDkgCcVADYwwAczT4kAdioTSSmA0Qg+AoSJBzGYXIgAMVXvknj+ZGQF8K6bFYLEXWuvogABTi5uJwAJScvCZcMWAAZoxKiJwAwkJJSgA6YCxsHNGZyZQgYpL6ACyaZooqaogAbFqSuoHxWaXmlkgAjHYOpE405IjS7p44eIQk5P70ePFinACuYADu4mj2qQDqW/YZYGhD/ACiJMcASnorpGAAKl6l5VKI6rK1yqoaLTp6eDWm22ankFisAGYBo5nKNGhNqM8DDM/NQAkxWOwuEZBMIXtp9AAOT4Kb4NGraNp4HEmLrgpBQkD2GEjPrwjyIqbI3xzNELAz5LGcNAQADWinxFRkNVJ9SQAFY/lSDCLxWA6T1EIzmadWYgAEyVBGYLk+WalGj8kAJNb8XGcYH2B5DYQJMgAHiOWQAfEEOslUl7khROFhHMw9GQ4KkacIAHSqxRxx34Z3iV1kOMABXDkdIcE9xSU3oiewO+COJ2GF0UaBuaDujy8uTA4gjcDDvBgDvLaYzvKgEF4CAM+xB8E4CXYnAeAEks/rrMKxYphS64G7SJwYJc0HA4xbxEoR8hkCA6G2sApSgADO973KCwrAaKkGBbGBBpQh/BoNBYThXEnUgIGYTgAHIAAFNiUZhGAAehiN9wM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kUC/B5PKFHqIYxuBDEC/KkEppxiGASccEgWEVpGSa/JwIqKZhlrPr7rib3tSSVKSc/OSWPpSakKybSW3mZl7jeAkoet2G8QIB8XCT8eKv+P8S+vuPKsCcqmCb+hqghFCbqmyrCewJhvCdqVsIiXFIhtOKht2OhnqetK3BICQSgGeI7l2KUEQNYHGL0M6dYNYBIYbH/OoISN3MQlqIoQYOQmCJqKoVQnqL0JPJodMAwnyHPKgmQIvHFMvGfGvBfDvHvCcDfHfGfCKGmVfJmYfCfGfE/ISSEh/McN/Pgn0NIP0HIc9CAu9IEBAsGVYKGSyIDPqPKPAtGdobGUoXDK5CmDFGnO4ZnFAFWXTrIU9OSAGSAECOWJAr0LWWoXqMDDdDELABiGjNpJ5OtPREBGvMPgRAhApBAJRE+DRACskAxExBBHGCIVkNxEycsPOSCB5HRD5GqP5FguHMFMjKFKpDzKkL0GADZOFI8L+eVDHMlOlA/LnpXuBEvEPkiZVPZPNp1knB+KQB5iKABCmDfLkK+fYFZKUKNOIEgKAAEIoJokIHgHuCAK4K4EAA"} // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.token.watchTransfer(config, { token: 1n, onTransfer(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onTransfer * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchTransfer.md","from":5381,"to":5603} declare function onTransfer(args: Args, log: Log): void type Args = { /** Amount transferred */ amount: bigint /** Address sending the tokens */ from: Address /** Address receiving the tokens */ to: Address } ``` Callback to invoke when tokens are transferred. ### token * **Type:** `Address | bigint` Address or ID of the TIP20 token to watch. ### args (optional) * **Type:** `object` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchTransfer.md","from":5793,"to":5958} type Args = { /** Filter by sender address(es) */ from?: Address | Address[] | null /** Filter by recipient address(es) */ to?: Address | Address[] | null } ``` Optional filter to watch only transfers from or to specific addresses. ### fromBlock (optional) * **Type:** `bigint` Block to start listening from. ### onError (optional) * **Type:** `function` ```ts // {"path":"/vercel/path0/site/tempo/actions/token.watchTransfer.md","from":6169,"to":6214} declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) * **Type:** `true` Enable polling mode. ### pollingInterval (optional) * **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem * [`token.watchTransfer`](https://viem.sh/tempo/actions/token.watchTransfer) --- --- url: /tempo/connectors/webAuthn.md --- # `webAuthn` Connector for a WebAuthn EOA. ## Install ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/tempo/connectors/webAuthn.md","from":479,"to":528} pnpm add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/tempo/connectors/webAuthn.md","from":551,"to":603} npm install accounts@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/tempo/connectors/webAuthn.md","from":627,"to":676} yarn add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/tempo/connectors/webAuthn.md","from":699,"to":747} bun add accounts@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts [wagmi.config.ts] // {"path":"/vercel/path0/site/tempo/connectors/webAuthn.md","from":790,"to":1117} import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { webAuthn } from 'wagmi/tempo' // [!code focus] export const config = createConfig({ connectors: [webAuthn()], // [!code focus] chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` Use `webAuthn({ authUrl: '/api/webauthn' })` if you want registration and authentication challenges to come from a server endpoint instead of the default local browser ceremony. `webAuthn` is a thin wagmi wrapper around the root `accounts` package. ## Parameters ### authUrl (optional) * **Type:** `string` URL of a server-backed WebAuthn handler. ### ceremony (optional) * **Type:** `WebAuthnCeremony` Custom WebAuthn ceremony implementation. ### icon (optional) * **Type:** `` `data:image/${string}` `` Optional connector icon override. ### name (optional) * **Type:** `string` Optional connector display name. ### rdns (optional) * **Type:** `string` Optional reverse-DNS identifier. ### authorizeAccessKey (optional) * **Type:** `() => { expiry: number, ... }` Default access-key authorization parameters to attach to `wallet_connect`. --- --- url: /cli/api/plugins/actions.md --- # actions Plugin for type-safe VanillaJS actions. ## Import ```ts // {"path":"/vercel/path0/site/cli/api/plugins/actions.md","from":69,"to":114} import { actions } from '@wagmi/cli/plugins' ``` ## Usage ```ts{2,6} // {"path":"/vercel/path0/site/cli/api/plugins/actions.md","from":140,"to":294} import { defineConfig } from '@wagmi/cli' import { actions } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ actions(), ], }) ``` ## Configuration ```ts // {"path":"/vercel/path0/site/cli/api/plugins/actions.md","from":323,"to":379} import { type ActionsConfig } from '@wagmi/cli/plugins' ``` ### getActionName ``'legacy' | ((options: { contractName: string; type: 'read' | 'simulate' | 'watch' | 'write' }) => `use${string}`)`` * Function for setting custom hook names. * Defaults to `` `${type}${contractName}` ``. For example, `readErc20`, `simulateErc20`, `watchErc20Event`, `writeErc20`. * When `'legacy'` (deprecated), hook names are set to `@wagmi/cli@1` format. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/actions.md","from":772,"to":1081} import { defineConfig } from '@wagmi/cli' import { actions } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ actions({ getActionName({ contractName, type }) { // [!code focus] return `${contractName}__${type}` // [!code focus] }, // [!code focus] }), ], }) ``` ### overridePackageName `'@wagmi/core' | 'wagmi'` * Override detected import source. * Defaults to `'wagmi'` or `'@wagmi/core'` depending on which package is installed. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/actions.md","from":1264,"to":1478} import { defineConfig } from '@wagmi/cli' import { actions } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ actions({ overridePackageName: 'wagmi', // [!code focus] }), ], }) ``` --- --- url: /core/api/actions.md --- # Actions Actions for accounts, wallets, contracts, transactions, signing, ENS, and more. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions.md","from":323,"to":367} import { getConnection } from '@wagmi/core' ``` ## Available Actions --- --- url: /react/api/actions.md --- # Actions Sometimes the declarative nature of React Hooks doesn't work for parts of your app. For those cases, you can use Wagmi Core Actions directly! All the Wagmi Core Actions are importable using the `wagmi/actions` entrypoint. For example, you can use the `watchBlockNumber` action to watch for block number changes. ::: code-group ```ts [index.tsx] // {"path":"/vercel/path0/site/react/api/actions.md","from":358,"to":701} import { useConfig } from 'wagmi' import { watchBlockNumber } from 'wagmi/actions' import { useEffect } from 'react' function App() { const config = useConfig() useEffect(() => { return watchBlockNumber(config, { onBlockNumber(blockNumber) { console.log('Block number changed!', blockNumber) }, }) }, []) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` See the [Wagmi Core docs](/core/api/actions) for more info on what actions are available. --- --- url: /solid/api/actions.md --- # Actions `@wagmi/solid` exports all of the actions from `@wagmi/core`. These actions can be used for lower-level control or when you need to interact with Wagmi outside of Solid components. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/actions.md","from":210,"to":277} import { getBalance, sendTransaction } from '@wagmi/solid/actions' ``` ## Usage ```ts // {"path":"/vercel/path0/site/solid/api/actions.md","from":298,"to":449} import { getBalance } from '@wagmi/solid/actions' import { config } from './config' const balance = await getBalance(config, { address: '0x...', }) ``` ## Available Actions See the [`@wagmi/core` Actions docs](/core/api/actions) for the full list of available actions and their documentation. ## When to Use Actions vs Primitives **Use Primitives when:** * You need reactive data in your Solid components * You want automatic caching and refetching * You're building UI that displays blockchain data **Use Actions when:** * You need imperative control over when data is fetched * You're working outside of Solid components * You need to chain multiple operations together * You're building utilities or helper functions ## Example: Using Actions with Primitives ```tsx // {"path":"/vercel/path0/site/solid/api/actions.md","from":1077,"to":1566} import { useConnection } from '@wagmi/solid' import { signMessage } from '@wagmi/solid/actions' import { config } from './config' function SignMessage() { const connection = useConnection() const handleSign = async () => { if (!connection.address) return const signature = await signMessage(config, { message: 'Hello, World!', }) console.log('Signature:', signature) } return ( ) } ``` --- --- url: /vue/api/actions.md --- # Actions Sometimes the declarative nature of Vue Composables doesn't work for parts of your app. For those cases, you can use Wagmi Core Actions directly! All the Wagmi Core Actions are importable using the `@wagmi/vue/actions` entrypoint. For example, you can use the `watchBlockNumber` action to watch for block number changes. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/actions.md","from":368,"to":759} ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` See the [Wagmi Core docs](/core/api/actions) for more info on what actions are available. --- --- url: /AGENTS.md --- # Agent Guidelines Agent guidance for the Wagmi documentation site. > **Communication Style**: Be brief, concise. Maximize information density, minimize tokens. Incomplete sentences acceptable when clear. Remove filler words. Prioritize clarity over grammar. ## Tempo * All Tempo documentation must be added under the `/tempo` sidebar item. ## Wagmi Actions * **All documentation must be based on their corresponding Wagmi actions** from `@wagmi/core/tempo` (`packages/core/src/tempo/`) * Make sure you update `site/tempo/actions/index.md` for new actions ### Query Actions ````md // {"path":"/vercel/path0/site/AGENTS.md","from":589,"to":1466} # `namespace.action` description ## Usage ::: code-group ```ts twoslash [example.ts] // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' import { tempoTestnet } from 'wagmi/chains' export const config = {} as Config // @filename: example.ts // ---cut--- import { Actions } from 'wagmi/tempo' import { config } from './config' const result = await Actions.amm.action(config, { foo: '0x...', bar: 123n, }) console.log('Result:', result) // @log: Result: 10500000000000000000n ``` <<< @/snippets/react/config-tempo.ts{ts} [config.ts] ::: ## Return Type `bigint` description ## Parameters ### foo - **Type:** `Address` description ### bar - **Type:** `bigint` description ### baz (optional) - **Type:** `Hex` description ## Viem - [`namespace.action`](https://viem.sh/tempo/actions/namespace.action) ```` ### Mutation Actions ````md // {"path":"/vercel/path0/site/AGENTS.md","from":1501,"to":3127} # `namespace.action` description ## Usage ::: code-group ```ts twoslash [example.ts] // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' import { tempoTestnet } from 'wagmi/chains' export const config = {} as Config // ---cut--- // @filename: example.ts import { Actions } from 'wagmi/tempo' import { config } from './config' const result = await Actions.namespace.actionSync(config, { foo: '0x...', bar: 123n, }) console.log('Foo:', result.foo) // @log: Foo: 5250000000000000000n ``` <<< @/snippets/react/config-tempo.ts{ts} [config.ts] ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `namespace.action` action and wait for inclusion manually: ```ts import { Actions as viem_Actions } from 'viem/tempo' import { Actions } from 'wagmi/tempo' import { waitForTransactionReceipt } from 'wagmi/actions' const hash = await Actions.namespace.action(config, { foo: '0x...', bar: 123n, }) const receipt = await waitForTransactionReceipt(config, { hash }) const { args: { baz } } = viem_Actions.namespace.action.extractEvent(receipt.logs) ``` ## Return Type description ```ts type ReturnType = { /** description */ baz: bigint } ``` ## Parameters ### foo - **Type:** `Address` description ### bar - **Type:** `bigint` description ## Viem - [`namespace.action`](https://viem.sh/tempo/actions/namespace.action) ```` ### Watch Actions ````md // {"path":"/vercel/path0/site/AGENTS.md","from":3159,"to":4629} # `namespace.watchAction` description ## Usage ::: code-group ```ts twoslash [example.ts] // @filename: config.ts // @errors: 2322 import type { Config } from 'wagmi' import { tempoTestnet } from 'wagmi/chains' export const config = {} as Config // ---cut--- // @filename: example.ts import { Actions } from 'wagmi/tempo' import { config } from './config' const unwatch = Actions.namespace.watchAction(config, { onAction(args, log) { console.log('args:', args) }, }) // Later, stop watching unwatch() ``` <<< @/snippets/react/config-tempo.ts{ts} [config.ts] ::: ## Return Type `() => void` Returns a function to unsubscribe from the event. ## Parameters ### onAction - **Type:** `function` ```ts declare function onBurn(args: Args, log: Log): void type Args = { /** description */ foo: bigint /** description */ barBaz: bigint } ``` Callback to invoke when action occurs. ### fromBlock (optional) - **Type:** `bigint` Block to start listening from. ### onError (optional) - **Type:** `function` ```ts declare function onError(error: Error): void ``` The callback to call when an error occurred when trying to get for a new block. ### poll (optional) - **Type:** `true` Enable polling mode. ### pollingInterval (optional) - **Type:** `number` Polling frequency (in ms). Defaults to Client's pollingInterval config. ## Viem - [`namespace.action`](https://viem.sh/tempo/actions/namespace.action) ```` ## Wagmi Hooks * **All documentation must be based on their corresponding Wagmi hooks** from `wagmi/tempo` (`packages/react/src/tempo/`) * Make sure you update `site/tempo/hooks/index.md` for new actions ### Query Hooks An example of a generated hook set can be found in `hooks/amm.useLiquidityBalance.ts`. Template example: ````md // {"path":"/vercel/path0/site/AGENTS.md","from":4971,"to":5879} # `namespace.useHook` description ## Usage ::: code-group ```ts twoslash [example.ts] import { Hooks } from 'wagmi/tempo' const { data: result } = Hooks.namespace.useHook({ foo: '0x...', bar: 123n, }) console.log('Result:', resut) // @log: Result: ... ``` <<< @/snippets/react/config-tempo.ts{ts} [config.ts] ::: ## Return Type See [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook return types. ### data See [Wagmi Action `namespace.action` Return Type](/tempo/actions/namespace.action#return-type) ## Parameters See [Wagmi Action `namespace.action` Parameters](/tempo/actions/namespace.action#parameters) ### query See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery) for more info hook parameters. ## Action - [`namespace.action`](/tempo/actions/namespace.action) ```` ### Mutation Hooks ````md // {"path":"/vercel/path0/site/AGENTS.md","from":5912,"to":7969} # `namespace.useHook` description ## Usage ::: code-group ```ts twoslash [example.ts] import { Hooks } from 'wagmi/tempo' const actionNameSync = Hooks.namespace.useHookSync() // Call `mutate` in response to user action (e.g. button click, form submission) actionNameSync.mutate({ foo: '0x...', bar: 123n, }) console.log('Received baz:', actionNameSync.data?.baz) // @log: Received baz: ... ``` <<< @/snippets/react/config-tempo.ts{ts} [config.ts] ::: ### Asynchronous Usage The example above uses a `*Sync` variant of the action, that will wait for the transaction to be included before returning. If you are optimizing for performance, you should use the non-sync `amm.burn` action and wait for inclusion manually: ```ts import { Actions } from 'viem/tempo' import { Hooks } from 'wagmi/tempo' import { useWaitForTransactionReceipt } from 'wagmi' const actionName = Hooks.namespace.useHook() const { data: receipt } = useWaitForTransactionReceipt({ hash: actionName.data }) // Call `mutate` in response to user action (e.g. button click, form submission) actionName.mutate({ foo: '0x...', bar: 123n, }) if (receipt) { const { args: { baz } } = Actions.namespace.action.extractEvent(receipt.logs) } ``` ## Return Type See [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook return types. ### data See [Wagmi Action `namespace.action` Return Type](/tempo/actions/namespace.action#return-type) ### mutate/mutateAsync See [Wagmi Action `namespace.action` Parameters](/tempo/actions/namespace.action#parameters) ## Parameters ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ### mutation See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation) for more info hook parameters. ## Action - [`namespace.action`](/tempo/actions/namespace.action) ```` ### Watch Hooks ````md // {"path":"/vercel/path0/site/AGENTS.md","from":7999,"to":8733} # `namespace.useWatchHook` description ## Usage ::: code-group ```ts twoslash [example.ts] import { Hooks } from 'wagmi/tempo' Hooks.amm.useWatchHook({ onAction(args, log) { console.log('args:', args) }, }) ``` <<< @/snippets/react/config-tempo.ts{ts} [config.ts] ::: ## Parameters See [Wagmi Action `namespace.watchAction` Parameters](/tempo/actions/namespace.watchAction#parameters) ### config `Config | undefined` [`Config`](https://wagmi.sh/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](https://wagmi.sh/react/api/WagmiProvider). ## Action - [`namespace.action`](/tempo/actions/namespace.action) - [`namespace.watchAction`](/tempo/actions/namespace.watchAction) ```` --- --- url: /core/api/connectors/baseAccount.md --- # baseAccount Connector for the [Base Account SDK](https://github.com/base/account-sdk). ## Import ```ts-vue import { baseAccount } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add @base-org/account@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { baseAccount } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [mainnet, sepolia], connectors: [baseAccount()], // [!code hl] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` :::warning Before going to production, it is highly recommended to set an [`appName`](#appname) and [`appLogoUrl`](#applogourl) for your application that can be displayed upon connection to the wallet. ::: ## Parameters ```ts-vue import { type baseAccountParameters } from '{{connectorsPackageName}}' ``` Check out the [Base Account SDK docs](https://www.base.org/build/base-account) for more info. ### appName `string` Application name. ```ts-vue import { baseAccount } from '{{connectorsPackageName}}' const connector = baseAccount({ appName: 'My Wagmi App', // [!code focus] }) ``` ### appLogoUrl `string | null | undefined` Application logo image URL; favicon is used if unspecified. ```ts-vue import { baseAccount } from '{{connectorsPackageName}}' const connector = baseAccount({ appName: 'My Wagmi App', appLogoUrl: 'https://example.com/myLogoUrl.png', // [!code focus] }) ``` --- --- url: /react/api/connectors/baseAccount.md --- # baseAccount Connector for the [Base Account SDK](https://github.com/base/account-sdk). ## Import ```ts-vue import { baseAccount } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add @base-org/account@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { baseAccount } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [mainnet, sepolia], connectors: [baseAccount()], // [!code hl] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` :::warning Before going to production, it is highly recommended to set an [`appName`](#appname) and [`appLogoUrl`](#applogourl) for your application that can be displayed upon connection to the wallet. ::: ## Parameters ```ts-vue import { type baseAccountParameters } from '{{connectorsPackageName}}' ``` Check out the [Base Account SDK docs](https://www.base.org/build/base-account) for more info. ### appName `string` Application name. ```ts-vue import { baseAccount } from '{{connectorsPackageName}}' const connector = baseAccount({ appName: 'My Wagmi App', // [!code focus] }) ``` ### appLogoUrl `string | null | undefined` Application logo image URL; favicon is used if unspecified. ```ts-vue import { baseAccount } from '{{connectorsPackageName}}' const connector = baseAccount({ appName: 'My Wagmi App', appLogoUrl: 'https://example.com/myLogoUrl.png', // [!code focus] }) ``` --- --- url: /shared/connectors/baseAccount.md --- # baseAccount Connector for the [Base Account SDK](https://github.com/base/account-sdk). ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/baseAccount.md","from":267,"to":323} import { baseAccount } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/shared/connectors/baseAccount.md","from":550,"to":608} pnpm add @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/shared/connectors/baseAccount.md","from":631,"to":692} npm install @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/shared/connectors/baseAccount.md","from":716,"to":774} yarn add @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/shared/connectors/baseAccount.md","from":797,"to":854} bun add @base-org/account@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/baseAccount.md","from":883,"to":1253} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { baseAccount } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [mainnet, sepolia], connectors: [baseAccount()], // [!code hl] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` :::warning Before going to production, it is highly recommended to set an [`appName`](#appname) and [`appLogoUrl`](#applogourl) for your application that can be displayed upon connection to the wallet. ::: ## Parameters ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/baseAccount.md","from":1490,"to":1561} import { type baseAccountParameters } from '{{connectorsPackageName}}' ``` Check out the [Base Account SDK docs](https://www.base.org/build/base-account) for more info. ### appName `string` Application name. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/baseAccount.md","from":1713,"to":1849} import { baseAccount } from '{{connectorsPackageName}}' const connector = baseAccount({ appName: 'My Wagmi App', // [!code focus] }) ``` ### appLogoUrl `string | null | undefined` Application logo image URL; favicon is used if unspecified. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/baseAccount.md","from":1970,"to":2157} import { baseAccount } from '{{connectorsPackageName}}' const connector = baseAccount({ appName: 'My Wagmi App', appLogoUrl: 'https://example.com/myLogoUrl.png', // [!code focus] }) ``` --- --- url: /solid/api/connectors/baseAccount.md --- # baseAccount Connector for the [Base Account SDK](https://github.com/base/account-sdk). ## Import ```ts-vue import { baseAccount } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add @base-org/account@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { baseAccount } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [mainnet, sepolia], connectors: [baseAccount()], // [!code hl] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` :::warning Before going to production, it is highly recommended to set an [`appName`](#appname) and [`appLogoUrl`](#applogourl) for your application that can be displayed upon connection to the wallet. ::: ## Parameters ```ts-vue import { type baseAccountParameters } from '{{connectorsPackageName}}' ``` Check out the [Base Account SDK docs](https://www.base.org/build/base-account) for more info. ### appName `string` Application name. ```ts-vue import { baseAccount } from '{{connectorsPackageName}}' const connector = baseAccount({ appName: 'My Wagmi App', // [!code focus] }) ``` ### appLogoUrl `string | null | undefined` Application logo image URL; favicon is used if unspecified. ```ts-vue import { baseAccount } from '{{connectorsPackageName}}' const connector = baseAccount({ appName: 'My Wagmi App', appLogoUrl: 'https://example.com/myLogoUrl.png', // [!code focus] }) ``` --- --- url: /vue/api/connectors/baseAccount.md --- # baseAccount Connector for the [Base Account SDK](https://github.com/base/account-sdk). ## Import ```ts-vue import { baseAccount } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add @base-org/account@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add @base-org/account@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { baseAccount } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [mainnet, sepolia], connectors: [baseAccount()], // [!code hl] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` :::warning Before going to production, it is highly recommended to set an [`appName`](#appname) and [`appLogoUrl`](#applogourl) for your application that can be displayed upon connection to the wallet. ::: ## Parameters ```ts-vue import { type baseAccountParameters } from '{{connectorsPackageName}}' ``` Check out the [Base Account SDK docs](https://www.base.org/build/base-account) for more info. ### appName `string` Application name. ```ts-vue import { baseAccount } from '{{connectorsPackageName}}' const connector = baseAccount({ appName: 'My Wagmi App', // [!code focus] }) ``` ### appLogoUrl `string | null | undefined` Application logo image URL; favicon is used if unspecified. ```ts-vue import { baseAccount } from '{{connectorsPackageName}}' const connector = baseAccount({ appName: 'My Wagmi App', appLogoUrl: 'https://example.com/myLogoUrl.png', // [!code focus] }) ``` --- --- url: /cli/api/plugins/blockExplorer.md --- # blockExplorer Plugin for fetching ABIs from block explorers that supports the `?module=contract&action=getabi` API format. ## Import ```ts // {"path":"/vercel/path0/site/cli/api/plugins/blockExplorer.md","from":144,"to":195} import { blockExplorer } from '@wagmi/cli/plugins' ``` ## Usage ```ts{2,6-14} // {"path":"/vercel/path0/site/cli/api/plugins/blockExplorer.md","from":224,"to":592} import { defineConfig } from '@wagmi/cli' import { blockExplorer } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ blockExplorer({ baseUrl: 'https://api.etherscan.io/v2/api', contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], }), ], }) ``` ## Configuration ```ts // {"path":"/vercel/path0/site/cli/api/plugins/blockExplorer.md","from":621,"to":683} import { type BlockExplorerConfig } from '@wagmi/cli/plugins' ``` ### apiKey `string | undefined` API key for block explorer. Appended to the request URL as query param `&apikey=${apiKey}`. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/blockExplorer.md","from":821,"to":1251} import { defineConfig } from '@wagmi/cli' import { blockExplorer } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ blockExplorer({ apiKey: process.env.ETHERSCAN_API_KEY, // [!code focus] baseUrl: 'https://api.etherscan.io/v2/api', contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], }), ], }) ``` ### baseUrl `string` Base URL for block explorer. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/blockExplorer.md","from":1315,"to":1700} import { defineConfig } from '@wagmi/cli' import { blockExplorer } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ blockExplorer({ baseUrl: 'https://api.etherscan.io/v2/api', // [!code focus] contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], }), ], }) ``` ### cacheDuration `number | undefined` Duration in milliseconds to cache ABIs. Defaults to `1_800_000` (30 minutes). ```ts // {"path":"/vercel/path0/site/cli/api/plugins/blockExplorer.md","from":1831,"to":2246} import { defineConfig } from '@wagmi/cli' import { blockExplorer } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ blockExplorer({ baseUrl: 'https://api.etherscan.io/v2/api', cacheDuration: 300_000, // [!code focus] contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], }), ], }) ``` ### chainId `number | undefined` Chain ID for block explorer. Appended to the request URL as query param `&chainId=${chainId}`. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/blockExplorer.md","from":2388,"to":2836} import { defineConfig } from '@wagmi/cli' import { blockExplorer } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ blockExplorer({ apiKey: process.env.ETHERSCAN_API_KEY, baseUrl: 'https://api.etherscan.io/v2/api', chainId: 1, // [!code focus] contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], }), ], }) ``` ### contracts `{ name: string; address?: Address | Record | undefined }[]` Contracts to fetch ABIs for. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/blockExplorer.md","from":2972,"to":3442} import { defineConfig } from '@wagmi/cli' import { blockExplorer } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ blockExplorer({ baseUrl: 'https://api.etherscan.io/v2/api', contracts: [ // [!code focus] { // [!code focus] name: 'Wagmigotchi', // [!code focus] address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', // [!code focus] }, // [!code focus] ], // [!code focus] }), ], }) ``` ### getAddress `((config: { address: Address | Record }) => Address) | undefined` * Function to get address from contract config. * Defaults to `({ address }) => typeof address === 'string' ? address : Object.values(address)[0]`. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/blockExplorer.md","from":3703,"to":4277} import { defineConfig } from '@wagmi/cli' import { blockExplorer } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ blockExplorer({ baseUrl: 'https://api.etherscan.io/v2/api', contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], getAddress({ address }) { // [!code focus] if (typeof address === 'string') return address // [!code focus] return Object.values(address)[0] // [!code focus] }, // [!code focus] }), ], }) ``` ### name `string` * Name of source. * Defaults to `'Block Explorer'`. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/blockExplorer.md","from":4361,"to":4771} import { defineConfig } from '@wagmi/cli' import { blockExplorer } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ blockExplorer({ baseUrl: 'https://api.etherscan.io/v2/api', contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], name: 'Etherscan', // [!code focus] }), ], }) ``` --- --- url: /core/api/actions/call.md --- # call Action for executing a new message call immediately without submitting a transaction to the network. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/call.md","from":237,"to":272} import { call } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/call.md","from":319,"to":576} import { call } from '@wagmi/core' import { config } from './config' await call(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts twoslash // {"path":"/vercel/path0/site/core/api/actions/call.md","from":656,"to":1134} // @twoslash-cache: {"v":1,"hash":"f9d98dd791931821ca041f2ffa5df1409ff16b6299b7878935aa5d977af43747","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAMJtWABWalmAWxg1ScADwBjCGABm7AOa86NMFDjC1mnQF5jG7QD5eFka3GSZcskYBkw/M3ZgAklASUrLyKiY2ADpg7NJYEKRowqJBLvIIVHBokgyIAIwALFSsMGBaaPhIBVRZpFpyeA5Owa4KlCAcYLiIAAxUyt5SyvKV+QC+ALp90F0gMXEJvMD82DBJjikhbryjvOqkENK8AOQAAgDuzFrS7AD0qqQwR20hzEigeiVw7Gp4aAijoyAA"} import { type CallParameters } from '@wagmi/core' ``` ### account `Account | Address | undefined` The Account to call from. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/call.md","from":1244,"to":1518} import { call } from '@wagmi/core' import { config } from './config' await call(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', // [!code focus] data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### data `` `0x${string}` | undefined `` A contract hashed method call with encoded args. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/call.md","from":1693,"to":1967} import { call } from '@wagmi/core' import { config } from './config' await call(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### to `Address | undefined` The contract address or recipient. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/call.md","from":2116,"to":2390} import { call } from '@wagmi/core' import { config } from './config' await call(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### accessList `AccessList | undefined` The access list. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/call.md","from":2532,"to":2893} import { call } from '@wagmi/core' import { config } from './config' await call(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', accessList: [ // [!code focus:6] { address: '0x1', storageKeys: ['0x1'], }, ], data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gas `bigint | undefined` The gas provided for transaction execution. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/call.md","from":3051,"to":3344} import { call } from '@wagmi/core' import { config } from './config' await call(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', gas: 1_000_000n, // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gasPrice `bigint | undefined` The price (in wei) to pay per gas. Only applies to [Legacy Transactions](https://viem.sh/docs/glossary/terms#legacy-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/call.md","from":3593,"to":3929} import { call } from '@wagmi/core' import { parseGwei } from 'viem' import { config } from './config' await call(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', gasPrice: parseGwei('20'), // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxFeePerGas `bigint | undefined` Total fee per gas (in wei), inclusive of `maxPriorityFeePerGas`. Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/call.md","from":4216,"to":4556} import { call } from '@wagmi/core' import { parseGwei } from 'viem' import { config } from './config' await call(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', maxFeePerGas: parseGwei('20'), // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxPriorityFeePerGas `bigint | undefined` Max priority fee per gas (in wei). Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/call.md","from":4821,"to":5201} import { call } from '@wagmi/core' import { parseGwei } from 'viem' import { config } from './config' await call(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', maxFeePerGas: parseGwei('20'), maxPriorityFeePerGas: parseGwei('2'), // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### nonce `number | undefined` Unique number identifying this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/call.md","from":5361,"to":5649} import { call } from '@wagmi/core' import { config } from './config' await call(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', nonce: 420, // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### value `bigint | undefined` Value (in wei) sent with this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/call.md","from":5808,"to":6142} import { call } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' await call(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `number | undefined` The block number to perform the call against. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/call.md","from":6310,"to":6610} import { call } from '@wagmi/core' import { config } from './config' await call(config, { blockNumber: 15121123n, // [!code focus] account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` The block tag to perform the call against. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/call.md","from":6822,"to":7116} import { call } from '@wagmi/core' import { config } from './config' await call(config, { blockTag: 'safe', // [!code focus] account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` The block tag to perform the call against. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/call.md","from":7301,"to":7643} import { call } from '@wagmi/core' import { config } from './config' import { mainnet } from '@wagmi/core/chains' await call(config, { chainId: mainnet.id, // [!code focus] account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts twoslash // {"path":"/vercel/path0/site/core/api/actions/call.md","from":7724,"to":8190} // @twoslash-cache: {"v":1,"hash":"21d9f77d5084c8206ac7e44980e375eda94c1b843ad4d776e3c3ed3a076f7de7","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAMJtWAJRhoArqTAAVbDF4BeXsAA6YXtt5RmaZol4AJOrwA+vKWFgAzdmBhQA3JoC+m9gFssEUmmFRCWlZBRxKEDgDfyQARgAWKlYYMABzNHw4xOpmUlTJPBFWcUkZeUUIjkckAAYqAGN8XOZ6mnJEBLcAXQboXEQQb19/NX5FQOLgsrClN15bUggvXgByAAEAd2ZUr3YAenq/GBWIr0lmJFA6GjA4dggwPDQENzcgA==="} import { type CallReturnType } from '@wagmi/core' ``` `{ data: 0x${string} }` The call data. ## Error ```ts twoslash // {"path":"/vercel/path0/site/core/api/actions/call.md","from":8261,"to":8966} // @twoslash-cache: {"v":1,"hash":"b8acbdeab78439603d8a045b8f32426b8530ecc55b9057e0cccd65e1da03193a","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAMJtWAUVKkIpACrYYvALy8A8gFt2aADwjW42jADGAVzTsIYCVNnyKvADohDzY3BiOAfLwBkvYPbBeIN5nVxhEXgAFZlI3AEFDQwhjMDQraTlBAB9eAEkwIjZ2KDioKFJ4OHSbbN4EpJS0AGU0ZhohCwAzDkM0yQz5Xhz8mgBzMhVTFU6AJWYwcerMhRym9gAvGDFaQxgYKDhosvYFtc2lwZyL2pa2mDi4OHZRsDUYVI6wbvZe65W8gpFKAAIQwNDgABl3qM0Pg/kNeAA6ZG8ABsAEZeGppApkYiEQBxGBoABy0C2/VIM2JxlIYGWAG4AgBfALsNRYaRoYSiP6UEBwVqkBiIdEAFiorGhsKQ6IAzFQheMRSBdOJKct+RwwLhEAAGKiGfAxZi9MiysXMgC6hvJeHZnOFfn4gzV8OZvE6UjUvAA5AABADuzFGGgA9EkKr7+W9WkhQHQaGAnhY8GgEMzmUA=="} import { type CallErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`call`](https://viem.sh/docs/actions/public/call) --- --- url: /core/guides/chain-properties.md --- # Chain Properties Some chains support additional properties related to blocks and transactions. This is powered by Viem's [formatters](https://viem.sh/docs/chains/formatters) and [serializers](https://viem.sh/docs/chains/serializers). For example, Celo, ZkSync, OP Stack chains support all additional properties. In order to use these properties in a type-safe way, there are a few things you should be aware of. ## Narrowing Parameters When you pass your `config` to an action, you are ready to access chain-specific properties! For example, Celo's `feeCurrency` is available. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/guides/chain-properties.md","from":615,"to":902} import { parseEther } from 'viem' import { simulateContract } from '@wagmi/core' import { config } from './config' const result = await simulateContract(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), feeCurrency: '0x…', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { base, celo, mainnet } from '@wagmi/core/chains' export const config = createConfig({ chains: [base, celo, mainnet], transports: { [base.id]: http(), [celo.id]: http(), [mainnet.id]: http(), }, }) ``` This is great, but if you have multiple chains that support additional properties, your autocomplete could be overwhelmed with all of them. By setting the `chainId` property to a specific value (e.g. `celo.id`), you can narrow parameters to a single chain. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/guides/chain-properties.md","from":1259,"to":1653} import { parseEther } from 'viem' import { simulateContract } from '@wagmi/core' import { celo } from 'wagmi/chains' const result = await simulateContract({ to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), chainId: celo.id, // [!code focus] feeCurrency: '0x…', // [!code focus] // ^? (property) feeCurrency?: `0x${string}` | undefined // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { base, celo, mainnet } from '@wagmi/core/chains' export const config = createConfig({ chains: [base, celo, mainnet], transports: { [base.id]: http(), [celo.id]: http(), [mainnet.id]: http(), }, }) ``` ## Narrowing Return Types Return types can also have chain-specific properties attached to them. There are a couple approaches for extracting these properties. ### `chainId` Parameter Not only can you use the `chainId` parameter to [narrow parameters](#narrowing-parameters), you can also use it to narrow the return type. ::: code-group ```ts [index.tsx] // {"path":"/vercel/path0/site/core/guides/chain-properties.md","from":2080,"to":2397} import { waitForTransactionReceipt } from '@wagmi/core' import { zkSync } from '@wagmi/core/chains' const result = await waitForTransactionReceipt({ chainId: zkSync.id, hash: '0x16854fcdd0219cacf5aec5e4eb2154dac9e406578a1510a6fc48bd0b67e69ea9', }) result.logs // ^? (property) logs: ZkSyncLog[] | undefined ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { base, celo, mainnet } from '@wagmi/core/chains' export const config = createConfig({ chains: [base, celo, mainnet], transports: { [base.id]: http(), [celo.id]: http(), [mainnet.id]: http(), }, }) ``` ### `chainId` Data Property Wagmi internally will set a `chainId` property on return types that you can use to narrow results. The `chainId` is determined from the `chainId` parameter or global state (e.g. connector). You can use this property to help TypeScript narrow the type. ::: code-group ```ts [index.tsx] // {"path":"/vercel/path0/site/core/guides/chain-properties.md","from":2779,"to":3116} import { waitForTransactionReceipt } from '@wagmi/core' import { zkSync } from '@wagmi/core/chains' const result = await waitForTransactionReceipt({ hash: '0x16854fcdd0219cacf5aec5e4eb2154dac9e406578a1510a6fc48bd0b67e69ea9', }) if (result.chainId === zkSync.id) { result.logs // ^? (property) logs: ZkSyncLog[] | undefined } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { base, celo, mainnet } from '@wagmi/core/chains' export const config = createConfig({ chains: [base, celo, mainnet], transports: { [base.id]: http(), [celo.id]: http(), [mainnet.id]: http(), }, }) ``` ## Troubleshooting If chain properties aren't working, make sure [TypeScript](/core/guides/faq#type-inference-doesn-t-work) is configured correctly. Not all chains have additional properties, to check which ones do, see the [Viem repo](https://github.com/wevm/viem/tree/main/src/chains) (chains that have a top-level directory under [`src/chains`](https://github.com/wevm/viem/tree/main/src/chains) support additional properties). --- --- url: /react/guides/chain-properties.md --- # Chain Properties Some chains support additional properties related to blocks and transactions. This is powered by Viem's [formatters](https://viem.sh/docs/chains/formatters) and [serializers](https://viem.sh/docs/chains/serializers). For example, Celo, ZkSync, OP Stack chains all support additional properties. In order to use these properties in a type-safe way, there are a few things you should be aware of. ::: tip Make sure you follow the TypeScript guide's [Config Types](/react/typescript#config-types) section before moving on. The easiest way to do this is to use [Declaration Merging](/react/typescript#declaration-merging) to "register" your `config` globally with TypeScript. ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { base, celo, mainnet } from 'wagmi/chains' export const config = createConfig({ chains: [base, celo, mainnet], transports: { [base.id]: http(), [celo.id]: http(), [mainnet.id]: http(), }, }) declare module 'wagmi' { interface Register { config: typeof config } } ``` ## Narrowing Parameters Once your Config is registered with TypeScript, you are ready to access chain-specific properties! For example, Celo's `feeCurrency` is available. ::: code-group ```ts [index.tsx] // {"path":"/vercel/path0/site/react/guides/chain-properties.md","from":971,"to":1210} import { parseEther } from 'viem' import { useSimulateContract } from 'wagmi' const result = useSimulateContract({ to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), feeCurrency: '0x…', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { base, celo, mainnet } from 'wagmi/chains' export const config = createConfig({ chains: [base, celo, mainnet], transports: { [base.id]: http(), [celo.id]: http(), [mainnet.id]: http(), }, }) declare module 'wagmi' { interface Register { config: typeof config } } ``` This is great, but if you have multiple chains that support additional properties, your autocomplete could be overwhelmed with all of them. By setting the `chainId` property to a specific value (e.g. `celo.id`), you can narrow parameters to a single chain. ::: code-group ```ts [index.tsx] // {"path":"/vercel/path0/site/react/guides/chain-properties.md","from":1569,"to":1957} import { parseEther } from 'viem' import { useSimulateContract } from 'wagmi' import { celo } from 'wagmi/chains' const result = useSimulateContract({ to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), chainId: celo.id, // [!code focus] feeCurrency: '0x…', // [!code focus] // ^? (property) feeCurrency?: `0x${string}` | undefined // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { base, celo, mainnet } from 'wagmi/chains' export const config = createConfig({ chains: [base, celo, mainnet], transports: { [base.id]: http(), [celo.id]: http(), [mainnet.id]: http(), }, }) declare module 'wagmi' { interface Register { config: typeof config } } ``` ## Narrowing Return Types Return types can also have chain-specific properties attached to them. There are a couple approaches for extracting these properties. ### `chainId` Parameter Not only can you use the `chainId` parameter to [narrow parameters](#narrowing-parameters), you can also use it to narrow the return type. ::: code-group ```ts [index.tsx] // {"path":"/vercel/path0/site/react/guides/chain-properties.md","from":2385,"to":2690} import { useWaitForTransactionReceipt } from 'wagmi' import { zkSync } from 'wagmi/chains' const { data } = useWaitForTransactionReceipt({ chainId: zkSync.id, hash: '0x16854fcdd0219cacf5aec5e4eb2154dac9e406578a1510a6fc48bd0b67e69ea9', }) data?.logs // ^? (property) logs: ZkSyncLog[] | undefined ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { base, celo, mainnet } from 'wagmi/chains' export const config = createConfig({ chains: [base, celo, mainnet], transports: { [base.id]: http(), [celo.id]: http(), [mainnet.id]: http(), }, }) declare module 'wagmi' { interface Register { config: typeof config } } ``` ### `chainId` Data Property Wagmi internally will set a `chainId` property on return types that you can use to narrow results. The `chainId` is determined from the `chainId` parameter or global state (e.g. connector). You can use this property to help TypeScript narrow the type. ::: code-group ```ts [index.tsx] // {"path":"/vercel/path0/site/react/guides/chain-properties.md","from":3073,"to":3397} import { useWaitForTransactionReceipt } from 'wagmi' import { zkSync } from 'wagmi/chains' const { data } = useWaitForTransactionReceipt({ hash: '0x16854fcdd0219cacf5aec5e4eb2154dac9e406578a1510a6fc48bd0b67e69ea9', }) if (data?.chainId === zkSync.id) { data?.logs // ^? (property) logs: ZkSyncLog[] | undefined } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { base, celo, mainnet } from 'wagmi/chains' export const config = createConfig({ chains: [base, celo, mainnet], transports: { [base.id]: http(), [celo.id]: http(), [mainnet.id]: http(), }, }) declare module 'wagmi' { interface Register { config: typeof config } } ``` ## Troubleshooting If chain properties aren't working, make sure [TypeScript](/react/guides/faq#type-inference-doesn-t-work) is configured correctly. Not all chains have additional properties, to check which ones do, see the [Viem repo](https://github.com/wevm/viem/tree/main/src/chains) (chains that have a top-level directory under [`src/chains`](https://github.com/wevm/viem/tree/main/src/chains) support additional properties). --- --- url: /vue/guides/chain-properties.md --- # Chain Properties Some chains support additional properties related to blocks and transactions. This is powered by Viem's [formatters](https://viem.sh/docs/chains/formatters) and [serializers](https://viem.sh/docs/chains/serializers). For example, Celo, ZkSync, OP Stack chains support all support additional properties. In order to use these properties in a type-safe way, there are a few things you should be aware of. ::: tip Make sure you follow the TypeScript guide's [Config Types](/vue/typescript#config-types) section before moving on. The easiest way to do this is to use [Declaration Merging](/vue/typescript#declaration-merging) to "register" your `config` globally with TypeScript. ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { base, celo, mainnet } from '@wagmi/vue/chains' export const config = createConfig({ chains: [base, celo, mainnet], transports: { [base.id]: http(), [celo.id]: http(), [mainnet.id]: http(), }, }) declare module '@wagmi/vue' { interface Register { config: typeof config } } ``` ## Narrowing Parameters Once your Config is registered with TypeScript, you are ready to access chain-specific properties! For example, Celo's `feeCurrency` is available. ::: code-group ```ts [index.tsx] // {"path":"/vercel/path0/site/vue/guides/chain-properties.md","from":973,"to":1217} import { parseEther } from 'viem' import { useSimulateContract } from '@wagmi/vue' const result = useSimulateContract({ to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), feeCurrency: '0x…', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { base, celo, mainnet } from '@wagmi/vue/chains' export const config = createConfig({ chains: [base, celo, mainnet], transports: { [base.id]: http(), [celo.id]: http(), [mainnet.id]: http(), }, }) declare module '@wagmi/vue' { interface Register { config: typeof config } } ``` This is great, but if you have multiple chains that support additional properties, your autocomplete could be overwhelmed with all of them. By setting the `chainId` property to a specific value (e.g. `celo.id`), you can narrow parameters to a single chain. ::: code-group ```ts [index.tsx] // {"path":"/vercel/path0/site/vue/guides/chain-properties.md","from":1574,"to":1972} import { parseEther } from 'viem' import { useSimulateContract } from '@wagmi/vue' import { celo } from '@wagmi/vue/chains' const result = useSimulateContract({ to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), chainId: celo.id, // [!code focus] feeCurrency: '0x…', // [!code focus] // ^? (property) feeCurrency?: `0x${string}` | undefined // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { base, celo, mainnet } from '@wagmi/vue/chains' export const config = createConfig({ chains: [base, celo, mainnet], transports: { [base.id]: http(), [celo.id]: http(), [mainnet.id]: http(), }, }) declare module '@wagmi/vue' { interface Register { config: typeof config } } ``` ## Narrowing Return Types Return types can also have chain-specific properties attached to them. There are a couple approaches for extracting these properties. ### `chainId` Parameter Not only can you use the `chainId` parameter to [narrow parameters](#narrowing-parameters), you can also use it to narrow the return type. ::: code-group ```ts [index.tsx] // {"path":"/vercel/path0/site/vue/guides/chain-properties.md","from":2398,"to":2713} import { useWaitForTransactionReceipt } from '@wagmi/vue' import { zkSync } from '@wagmi/vue/chains' const { data } = useWaitForTransactionReceipt({ chainId: zkSync.id, hash: '0x16854fcdd0219cacf5aec5e4eb2154dac9e406578a1510a6fc48bd0b67e69ea9', }) data?.logs // ^? (property) logs: ZkSyncLog[] | undefined ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { base, celo, mainnet } from '@wagmi/vue/chains' export const config = createConfig({ chains: [base, celo, mainnet], transports: { [base.id]: http(), [celo.id]: http(), [mainnet.id]: http(), }, }) declare module '@wagmi/vue' { interface Register { config: typeof config } } ``` ### `chainId` Data Property Wagmi internally will set a `chainId` property on return types that you can use to narrow results. The `chainId` is determined from the `chainId` parameter or global state (e.g. connector). You can use this property to help TypeScript narrow the type. ::: code-group ```ts [index.tsx] // {"path":"/vercel/path0/site/vue/guides/chain-properties.md","from":3094,"to":3428} import { useWaitForTransactionReceipt } from '@wagmi/vue' import { zkSync } from '@wagmi/vue/chains' const { data } = useWaitForTransactionReceipt({ hash: '0x16854fcdd0219cacf5aec5e4eb2154dac9e406578a1510a6fc48bd0b67e69ea9', }) if (data?.chainId === zkSync.id) { data?.logs // ^? (property) logs: ZkSyncLog[] | undefined } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { base, celo, mainnet } from '@wagmi/vue/chains' export const config = createConfig({ chains: [base, celo, mainnet], transports: { [base.id]: http(), [celo.id]: http(), [mainnet.id]: http(), }, }) declare module '@wagmi/vue' { interface Register { config: typeof config } } ``` ## Troubleshooting If chain properties aren't working, make sure [TypeScript](/vue/guides/faq#type-inference-doesn-t-work) is configured correctly. Not all chains have additional properties, to check which ones do, see the [Viem repo](https://github.com/wevm/viem/tree/main/src/chains) (chains that have a top-level directory under [`src/chains`](https://github.com/wevm/viem/tree/main/src/chains) support additional properties). --- --- url: /core/api/chains.md --- # Chains ## Import Import via the `'@wagmi/core/chains'` entrypoint (proxies all chains from `'viem/chains'`). ```ts // {"path":"/vercel/path0/site/core/api/chains.md","from":309,"to":354} import { mainnet } from '@wagmi/core/chains' ``` ## Available Chains Chain definitions as of `viem@{{viemVersion}}`. For `viem@latest`, visit the [Viem repo](https://github.com/wevm/viem/blob/main/src/chains/index.ts). ## Create Chain Import the `Chain` type from Viem and create a new object that is asserted `as const` and `satisfies` the type. You can also use the `defineChain` function from Viem. ::: code-group ```ts twoslash [as const satisfies Chain] // @twoslash-cache: {"v":1,"hash":"b104f720769e0d28b42cc38edb3952d146e5b9902d8a7bead95767460071c100","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAML5m7MAB4AZhFIBbZmhqk4vOjTBRVIsWABishUrKqAPrwCummFPEwovALzDR4g/MXKzl67bD2KXgBjCzg0CDk1ehhNVQAlGCDZKAkw0nEAc0CrAGtIAHcwAD5ecytYP3snXgSk0hS0zOywPIhCkrLfOygS52AAHTBeYd4AI1YIIJyAUVosCdITAH5EXgGhkc3kHJgMVcawDIBdVZ1xACEJqdn52TIAbkHNzYrmC1Y0U9cwS8mZuYWDyeIwAvqUfBVuo8NsMkmA0KRmEE0HAVrwAAqLJTsKQYCTrZ4jba7fYIzInFy6IQQeGI5HggmE57IOAQCykIIwACSUFWYAsclGZApZzA1NpSLQ4PKNihwMJYM6kP8UGhmzBADI1vLnjE4AkMuw0hg0aLxQjJdKuiq1Uy9QBVMDsEgqNgJVmsF2m77mulSpWym06zZyd5odhBNisADM3qpNIt9IDlVVOpBHQhgfstuGADp87wAJy8OR3Xj53M53hSGDwONuWtwaSGTwmK3K+wZmUp6EgwbsORYWRS0WUEBhZikBiIACMABYqKwYhk0PgkABWKhoScZGDTkCjxd2JAABioQVEfrISHnIIo6GwuEQBGI1636jwcLCJd0/k+axBMcJynJA5wADkXZdVyQAB2Lcdz3PAFHEP8xw4fwkAAJnPS9JWvWdozvB8cDwQgXTHGh6DwAQYGCGlvz6QCqGA6cADYFxAJdDmgxBN2oBD9y/BgjwwxBsJAC9Jzw8gxMLIjqEfPAyFIWQgO3EDEBgs9OKgtdEELc9oCfGdo1Y7TbC45g5CfEBxFgWhcxRMd2CgJTSFIABaEyzI8sCYI8wsKI/Z8ABVH14AByYAQQi3goAgeBeEgKU4EUI1cX4fBaLoHBkSqGjItFCLc2BMLBCimLeCNEsjTgTJMtomRWAmfJ6qwFScCndhEqkFTIgKiKitWFzAjAKyYFGtKSCEdlFjAIIMECUgsCCe1SFYBBIJIVg3JU8gRKfcTJKvGTo3XeSaNI199uoYKQBYDguD4ArRWbDxjBUKINC0Sk3BbD7vG7bpqlFdwjC8dssygQIQjCCIvpiH7amSVIyUOZpWnaSGU2qZH6lR9J0Z8THimx7pem1GExiuf5bkWFQ0UZQliT2XgDmOL5dF+a4ATuUgqxeGw3g+TmLhpm5AX5tMyaDKm4UTFE0UxPdw1xfFgyJHZWfZkUfQTP0GQ15nWXZTkeT5AUhVIXX4wlJNMx7I3eEVB25SpzVKaZNQwH1GBDWNesxX1y1kzdr2HSdF1UtYd0IE9MhA99EPXdlr3Qw+CMo1jUWg7t/0U+zNMu2tQuqYrIsSzLCsqxrOsc70Rs3vBttQ5VYuO1TMA+ydQdh1+sA1MnacwO0riVz0vj1N3fdD0448xJwqS8pkudzqOQzYDwAchynNZ+HC0VnerPrIqIbq5AiwZBhyvuhJ/FC92qaLeC4OifZStK4FsRLZ+s7ckFAOoPU7AaTUQQCCEEQA="} // @errors: 1360 import { type Chain } from 'viem' export const mainnet = {} as const satisfies Chain ``` ```ts twoslash [defineChain] // @twoslash-cache: {"v":1,"hash":"51816265e78622b289e1e5f943b76d80bfbe0a867d81b51ec6327613f6e28499","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvWP3ZgYAYXzM5AHn4RSAW2ZoapOLzo0wUQ0pVgAYpp16ycCrxGS4aZ8rlH6MU+c9g6ra6+nAAfGGMIgGIHpbcsQAKpDB67PwYqgCCcHDsAOaBFmrCMnIwUGFO0ZYRADpg7FpYmu5l8sVglCBuzKQMiACcVKy++Wj4SACMU1Ro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QWAiIWpCsNDr4wCQrBw/d5AHZsR2QdzhzkIgnZLScOKfbAeCTa0qozeUnThvwZsU0QxtaOTDQNHQU3uE8LyAR8vAALz5x0ASMFT3DdMD8xIKAxhxhIXTXFDIAnCcQA=="} // @errors: 2345 import { defineChain } from 'viem' export const mainnet = defineChain({}) ``` ::: Now, add the missing required properties to the object until the error goes away. ::: code-group ```ts twoslash [as const satisfies Chain] // @twoslash-cache: {"v":1,"hash":"7eb538e5797ec32b451699fd0f71747694cdee2f09698daad95d805d237f68ce","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAML5m7MAB4AZhFIBbZmhqk4vOjTBRVIsWABishUrKqAPrwCummFPEwovALzDR4g/MXKzl67bD2KXgBjCzg0CDk1ehhNVQAlGCDZKAkw0nEAc0CrAGtIAHcwAD5ecytYP3snXgSk0hS0zOywPIhCkrLfOygS52AAHTBeYd4AI1YIIJyAUVosCdITAH5EXgGhkc3kHJgMVcawDIBdVZ1xACEJqdn52TIAbkHNzYrmC1Y0U9cwS8mZuYWDyeIwAvqUfBVuo8NsMkmA0KRmEE0HAVrwAAqLJTsKQYCTrZ4jba7fYIzInFy6IQQeGI5HggmE57IOAQCykIIwACSUFWYAsclGZApZzA1NpSLQ4PKNihwMJYM6kP8UGhmzBADI1vLnjE4AkMuw0hg0aLxQjJdKuiq1Uy9QBVMDsEgqNgJVmsF2m77mulSpWym06zZyd5odhBNisADM3qpNIt9IDlVVOpBHQhgfstuGADp87wAJy8OR3Xj53M53hSGDwONuWtwaSGTwmK3K+wZmUp6EgwbsORYWRS0WUEBhZikBiIACMABYqKwYhk0PgkABWKhoScZGDTkCjxd2JAABioQVEfrISHnIIo6GwuEQBGI1636jwcLCJd0/k+2phXhFmYKAaVYDBeHYXleBnKtgNAsBwN4MBmDkGBVn6EBplXMgYAFTC4JgECwIglDwxIIR2UWMAgj2ACmSAoiEKQlC0IwrCcNIAjgxGeCSN4OAMEF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wwDkwHSUzUy0z0yMzMwziszsw3SczMC0mFQb7CzqTb6SwnSbh0k6guGQasn97slYmbSRiSmjCwAnjrivQnSjDRiXR4aiwnQngHQaQaQMxCgHTMC1Y5InSXSGkzjymEiKn2DqRzjRiGaXQnhjGASImyzHFghcCk4fpSjQzhhwC2DwApFUBoTbhICgDqB6irJ4AHIggghAA==="} import { type Chain } from 'viem' export const mainnet = { id: 1, name: 'Ethereum', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { default: { http: ['https://eth.merkle.io'] }, }, blockExplorers: { default: { name: 'Etherscan', url: 'https://etherscan.io' }, }, contracts: { ensRegistry: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', }, ensUniversalResolver: { address: '0xE4Acdd618deED4e6d2f03b9bf62dc6118FC9A4da', blockCreated: 16773775, }, multicall3: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 14353601, }, }, } as const satisfies Chain ``` ```ts twoslash [defineChain] // @twoslash-cache: {"v":1,"hash":"9dd120cd705dc697124cfe3fa80116ed4046ca81c57ffb5daa2cfd0b2775f253","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvWP3ZgYAYXzM5AHn4RSAW2ZoapOLzo0wUQ0pVgAYpp16ycCrxGS4aZ8rlH6MU+c9g6ra6+nAAfGGMIgGIHpbcsQAKpDB67PwYqgCCcHDsAOaBFmrCMnIwUGFO0ZYRADpg7FpYmu5l8sVglCBuzKQMiACcVKy++Wj4SACMU1RoffmpeO2KAd0c8kgADFQ1pMxiZEiDAL4U6Ni4iATER3PGeC5gbrw6cvJoscANvL+8AEasCAiADWAFFaFggSkDF8fn8ESlmFBJKwMNIYPxmIJWJ9eN8pAiib8kSiwGjeGBmFoYLE6iAwRMHCJmGB6QBueHExEwZGo9GCUisOkEPRYOCIAD0ktS+GZrIAdBIOVyiSdOYTfurVU80PsxBL8aqeX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VbeIVXeWwxIuWVwpwM+AGJItyfI8GB+aGQ2NIkkZGFtJjP4fTYAXga9ZAVwqzATEdemdDVwlmSo+EM4eEeTAWGEOo34BojFGWJI06MLMAUoizVo/jArEzITCAVw3owkfowkSnA0SWFXXrX7XnVwiRfnU3YXC3abcXG3EsfIl+Kov4WvAxUPZOPBX4A4yxfvI7BPE7ZPc7cfdPa7C8a4qsFQp7U/VZG41UEghJSCH7Z4pgv/Q0Q4lCVgoAsHTgyHCAmHOHGAxHOAhiQE4kYE/PdAnHW4rUW4jYk4bgboGkeYJAUAYwC0CQLoa4ThEAE4E4IAA="} import { defineChain } from 'viem' export const mainnet = defineChain({ id: 1, name: 'Ethereum', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { default: { http: ['https://eth.merkle.io'] }, }, blockExplorers: { default: { name: 'Etherscan', url: 'https://etherscan.io' }, }, contracts: { ensRegistry: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', }, ensUniversalResolver: { address: '0xE4Acdd618deED4e6d2f03b9bf62dc6118FC9A4da', blockCreated: 16773775, }, multicall3: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 14353601, }, }, }) ``` ::: The more properties you add, the better the chain will be to use with Wagmi. Most of these attributes exist within the [`ethereum-lists/chains` repository](https://github.com/ethereum-lists/chains/tree/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains). * `id`: The chain ID for the network. This can be found by typing the network name into [ChainList](https://chainlist.org). Example: "Ethereum Mainnet" has a Chain ID of `1`. * `name`: Human-readable name for the chain. Example: "Ethereum Mainnet" * `nativeCurrency`: The native currency of the chain. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L20-L24). * `rpcUrls`: At least one public, credible RPC URL. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L4-L18). * `blockExplorers`: A set of block explorers for the chain. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L30-L36). * `contracts`: A set of deployed contracts for the chain. If you are deploying one of the following contracts yourself, make sure it is verified. * `multicall3` is optional, but it's address is most likely `0xca11bde05977b3631167028862be2a173976ca11` – you can find the deployed block number on the block explorer. Check out [`mds1/multicall`](https://github.com/mds1/multicall#multicall3-contract-addresses) for more info. * `ensRegistry` is optional – not all Chains have a ENS Registry. See [ENS Deployments](https://docs.ens.domains/ens-deployments) for more info. * `ensUniversalResolver` is optional – not all Chains have a ENS Universal Resolver. * `sourceId`: Source Chain ID (e.g. the L1 chain). * `testnet`: Whether or not the chain is a testnet. --- --- url: /react/api/chains.md --- # Chains Viem `Chain` objects. More info at the [Viem docs](https://viem.sh/docs/chains/introduction). ## Import Import via the `'wagmi/chains'` entrypoint (proxies all chains from `'viem/chains'`). ```ts // {"path":"/vercel/path0/site/react/api/chains.md","from":398,"to":437} import { mainnet } from 'wagmi/chains' ``` ## Available Chains Chain definitions as of `viem@{{viemVersion}}`. For `viem@latest`, visit the [Viem repo](https://github.com/wevm/viem/blob/main/src/chains/index.ts). ## Create Chain Import the `Chain` type from Viem and create a new object that is asserted `as const` and `satisfies` the type. You can also use the `defineChain` function from Viem. ::: code-group ```ts twoslash [as const satisfies Chain] // @twoslash-cache: {"v":1,"hash":"b104f720769e0d28b42cc38edb3952d146e5b9902d8a7bead95767460071c100","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAML5m7MAB4AZhFIBbZmhqk4vOjTBRVIsWABishUrKqAPrwCummFPEwovALzDR4g/MXKzl67bD2KXgBjCzg0CDk1ehhNVQAlGCDZKAkw0nEAc0CrAGtIAHcwAD5ecytYP3snXgSk0hS0zOywPIhCkrLfOygS52AAHTBeYd4AI1YII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aZNQwH1GBDWNesxX1y1kzdr2HSdF1UtYd0IE9MhA99EPXdlr3Qw+CMo1jUWg7t/0U+zNMu2tQuqYrIsSzLCsqxrOsc70Rs3vBttQ5VYuO1TMA+ydQdh1+sA1MnacwO0riVz0vj1N3fdD0448xJwqS8pkudzqOQzYDwAchynNZ+HC0VnerPrIqIbq5AiwZBhyvuhJ/FC92qaLeC4OifZStK4FsRLZ+s7ckFAOoPU7AaTUQQCCEEQA="} // @errors: 1360 import { type Chain } from 'viem' export const mainnet = {} as const satisfies Chain ``` ```ts twoslash [defineChain] // @twoslash-cache: {"v":1,"hash":"51816265e78622b289e1e5f943b76d80bfbe0a867d81b51ec6327613f6e28499","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvWP3ZgYAYXzM5AHn4RSAW2ZoapOLzo0wUQ0pVgAYpp16ycCrxGS4aZ8rlH6MU+c9g6ra6+nAAfGGMIgGIHpbcsQAKpDB67PwYqgCCcHDsAOaBFmrCMnIwUGFO0ZYRADpg7FpYmu5l8sVglCBuzKQMiACcVKy++Wj4SACMU1RoffmpeO2KAd0c8kgADFQ1pMxiZEiDAL4U6Ni4iATER3PGeC5gbrw6cvJoscANvL+8AEasCAiADWAFFaFggSkDAB+L4/P5I5AgmAYWJuUhyfIAXVinQAQkDQRCoZoyABuRFI34yZiCVifXiE4ngyHQynU3gnXgAH14pRgsnkUD5AtMQvKUCpUj+TzQ+zEcHhvG+sppvGQtAxCuxeOZAQUkgVB3c/LVGo1yDgEEEpBEMAAklBYmBBFp/mR9Z0jWATWIxYLhRUZZbuYGJcHpVykb44AAlGD5diYjAqn3GxVm8UraPqmlxgCqjRIBjYiZtrFL6cNmdNEdzoctWgZ4hEbFYAGYa5Zff7s0GpU3fjz+YORcPeOwXbw3R7OfmAHTL3gADle5N4y8Xk/4MHgPbkVn3cFU27CDclE4aJ26vX6SAALMMQKMwONJogAOxzBZLa5vGAHzrOUSAAEy7MoWZHIgUydmcFw4HghClt0ND0EwbCcDw0hXqsliqJ0NjaCEDhOJ0hEBMRdihBEUQxAaBFEcE9gGGECSqlygLAmyZIwsqCL5siqLorwmJ6viAREjxpIcqQk5InSraSZY0kkuy5LyVyo45nhopjpGQ5cvKWYCZxQl/FqOpYu+3q1n6WZihaYaWTadoOs6rrup6pB2b2dYBgZjYxn8OnjiGIW/HGibJqmh5gH2jlBXpCl/EWJYOOW8AQFWZDxYl9bJVGqW/C2jLsO2rBdvlAUDoZ175mF9URUuK6DBuKRbsuu4nvFx7wGey4XkVRlgCcDRNC0/S4cGnR3vMD6IAArC+b4ftMszUH+AwgCsc0jKBiAQSAeymjBYHwec1CXHgZCkJo819AMX6bWtEzgbs0BXBdj5LVQshvswWhXCAciwLQi5oAgVDTrdpCkAAtD9S0I6uq5I2hDzXFkpD5O6vjuBA/C8JgOC8AA5MAJzk1OhiQO4XB5IUzCAjAJMQLwWB9EDqRkLwRMk5cFMUcxJGseE5OLoiAAqQuU9TtOvCmeTviT+BsxoVUQAA7tinP3Tg/TsPAAj3Vogtk+TItUSxtHk7E05OGAPNO7o7AkAodopKIGBOKQWAiIWpCsNDr4wCQrBw/d5AHZsR2QdzhzkIgnZLScOKfbAeCTa0qozeUnThvwZsU0QxtaOTDQNHQU3uE8LyAR8vAALz5x0ASMFT3DdMD8xIKAxhxhIXTXFDIAnCcQA=="} // @errors: 2345 import { defineChain } from 'viem' export const mainnet = defineChain({}) ``` ::: Now, add the missing required properties to the object until the error goes away. ::: code-group ```ts twoslash [as const satisfies Chain] // @twoslash-cache: {"v":1,"hash":"7eb538e5797ec32b451699fd0f71747694cdee2f09698daad95d805d237f68ce","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAML5m7MAB4AZhFIBbZmhqk4vOjTBRVIsWABishUrKqAPrwCummFPEwovALzDR4g/MXKzl67bD2KXgBjCzg0CDk1ehhNVQAlGC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u4EYF4Ntg4M4KKBAa2MAXDiqIECEGEBECATEGAbUMkKkM9s0K0O0NAdUNgfULgQWvgQUMUNAb0D7q7sanyj3oKvmsKkGr8NcG7kCE3t7qKGweKoqtpNAVWKRiiGiJiHuOGLiPiCDEwYMp5mNAyCDDumyByNyNBD1sKHIS+kgdmOfoIZelqPrsMOnmxpobBiBkGE3uFh3lFu5gBqYZxh2KmE3ofmrJtvIdoU4eqF2Fxp4SMBWEWCWGWGfoBDWHWCKnoI2AAZAW2B4d4Y4b2P2IOMOEGgjmSrfgwsJoeNNk+C/smswlXDOCCEcOeNAK/AOEOFOGsL/oIKKDrNWJHJEAAOREDsAwByCNGDCDB0AVFShfhSgOxgB/jVCMg06HzAh5qNEB6LACiNEUDjEc5QI0K2SCJlSTGcSzFi6mKrCTFSQbHy49KaQ6xzEbBq5jJLre7AC8BG4eSNER6IABSW6hQ269SNFHBHHAh3jAh0HpRmQLQXErHbFTHdRLwbFh63HtT3GdSC7AlgAvHvEbCfEbDCG/E6jGHiYe73a8CNH54F67RF6nTnRXS3T3SPTPSvTvSfTfS/T/SzFpjHGbBWGuY2Fd4Yk55rTbFD44x4wEwaREykwwDkwHSUzUy0z0yMzMwziszsw3SczMC0mFQb7CzqTb6SwnSbh0k6guGQasn97slYmbSRiSmjCwAnjrivQnSjDRiXR4aiwnQngHQaQaQMxCgHTMC1Y5InSXSGkzjymEiKn2DqRzjRiGaXQnhjGASImyzHFghcCk4fpSjQzhhwC2DwApFUBoTbhICgDqB6irJ4AHIggghAA==="} import { type Chain } from 'viem' export const mainnet = { id: 1, name: 'Ethereum', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { default: { http: ['https://eth.merkle.io'] }, }, blockExplorers: { default: { name: 'Etherscan', url: 'https://etherscan.io' }, }, contracts: { ensRegistry: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', }, ensUniversalResolver: { address: '0xE4Acdd618deED4e6d2f03b9bf62dc6118FC9A4da', blockCreated: 16773775, }, multicall3: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 14353601, }, }, } as const satisfies Chain ``` ```ts twoslash [defineChain] // @twoslash-cache: {"v":1,"hash":"9dd120cd705dc697124cfe3fa80116ed4046ca81c57ffb5daa2cfd0b2775f253","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvWP3ZgYAYXzM5AHn4RSAW2ZoapOLzo0wUQ0pVgAYpp16ycCrxGS4aZ8rlH6MU+c9g6ra6+nAAfGGMIgGIHpbcsQAKpDB67PwYqgCCcHDsAOaBFmrCMnIwUGFO0ZYRADpg7FpYmu5l8sVglCBuzKQMiACcVKy++Wj4SACMU1RoffmpeO2KAd0c8kgADFQ1pMxiZEiDAL4U6Ni4iATER3PGeC5gbrw6cvJoscANvL+8AEasCAiADWAFFaFggSkDF8fn8ESlmFBJKwMNIYPxmIJWJ9eN8pAiib8kSiwGjeGBmFoYLE6iAwRMHCJmGB6QBueHExEwZGo9GCUisOkEPRYOCIAD0ktS+GZrIAdBIOVyiSdOYTfurVU80PsxBL8aqeXzyejfHAAEowfLsNykDBwzXckm8skU5FQFK5EVbWhbAOBoNbBQAJjBWwA7AAWRQANkGWS2UCs/1Dg0GkYAQlk4wpI1BQzApjAVc6Edry39SfyjM8AKqNEgGNjWuAQVjNp0uk3u9Ge72G+l+sHRrIiKBQONTAAcsDBABFY3HC/wtgBmf6Df78OOhqAiaezqwKRPRqDMMs96tu2uA4EghRImhQWJTOORyPrz8AVg1LsrF0azNV4cXEFlWFYddu2vXhgI9SdB19WgWRmf5YC2H9M0jf51zjdcZg/LZQxnGc93+GBQ2YKYv0zONUKmK9YPg9F71BJ9eRfN9o3XH88K2KZ/25QC/hE352FfXhBNVKkaRFRk5RSQQtCY34qXEEgFEFFJREdI0q1dU0KVk2leHpBSyFUokWN4OAMC0f4O3kgAVAAJKze1rWARCaNhDVnIStUC3gFVC3g41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DI32CiA7KODmosOmi309FnUgOr36yszBcxzu2HmjnJdA/Vy5mmqPNdPei3ne3+cBjG7I+R/slFB1UaHDR9Is14Vw2VldxrrjmI8xChnSA4xM/89Rp1unXXLbjqtoxG3SDc/+ztix+2rE51sfnexjjnElzceXTxVcfE1zM6rNHTdJLPbbpE6XOqqpE5J41UMC7yd4CD82OACd2xh481uz3YGfe6/rfr11hu3Yx+zjYvOBcHFFxcaXdxFcM83a1TLj9YG9zl6QM72LeA3c0+mMBqFoHve+Z101zvAe+C55Cfn8Jv4s05vV05unLmj+PagB5yTrft8Nco3vrLjbQLxO+xHhCA3du96Bwwiwk/HBwIme2IlInIkomolokjHomokYmzzuwfHRyeyx34lx2nRn3KR/B/EkyvyrxdxADiXAkSXXDNUry8zOS12rUayPT1wPxESj0BwQOB1BxALwjAKImhygPh1gPgJmDtwJwGB/EjHwKdxc1X1qjaVDDqSf3bzf0Cw/1vwx25V4gwKzXwhqivw6Wrzk3uzzwoPp03zI29xZl2GgHjXyVaHxCKRWksENgECmS0F4AAHIiB2AYAtBXCGgGg6ACl3AngXgOoPheAABeOw1YSwRgZ6BZCgeEZeVwuWNebw+IwkAVbeIVXeWwxIuWVwpwM+AGJItyfI8GB+aGQ2NIkkZGFtJjP4fTYAXga9ZAVwqzATEdemdDVwlmSo+EM4eEeTAWGEOo34BojFGWJI06MLMAUoizVo/jArEzITCAVw3owkfowkSnA0SWFXXrX7XnVwiRfnU3YXC3abcXG3EsfIl+Kov4WvAxUPZOPBX4A4yxfvI7BPE7ZPc7cfdPa7C8a4qsFQp7U/VZG41UEghJSCH7Z4pgv/Q0Q4lCVgoAsHTgyHCAmHOHGAxHOAhiQE4kYE/PdAnHW4rUW4jYk4bgboGkeYJAUAYwC0CQLoa4ThEAE4E4IAA="} import { defineChain } from 'viem' export const mainnet = defineChain({ id: 1, name: 'Ethereum', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { default: { http: ['https://eth.merkle.io'] }, }, blockExplorers: { default: { name: 'Etherscan', url: 'https://etherscan.io' }, }, contracts: { ensRegistry: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', }, ensUniversalResolver: { address: '0xE4Acdd618deED4e6d2f03b9bf62dc6118FC9A4da', blockCreated: 16773775, }, multicall3: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 14353601, }, }, }) ``` ::: The more properties you add, the better the chain will be to use with Wagmi. Most of these attributes exist within the [`ethereum-lists/chains` repository](https://github.com/ethereum-lists/chains/tree/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains). * `id`: The chain ID for the network. This can be found by typing the network name into [ChainList](https://chainlist.org). Example: "Ethereum Mainnet" has a Chain ID of `1`. * `name`: Human-readable name for the chain. Example: "Ethereum Mainnet" * `nativeCurrency`: The native currency of the chain. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L20-L24). * `rpcUrls`: At least one public, credible RPC URL. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L4-L18). * `blockExplorers`: A set of block explorers for the chain. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L30-L36). * `contracts`: A set of deployed contracts for the chain. If you are deploying one of the following contracts yourself, make sure it is verified. * `multicall3` is optional, but it's address is most likely `0xca11bde05977b3631167028862be2a173976ca11` – you can find the deployed block number on the block explorer. Check out [`mds1/multicall`](https://github.com/mds1/multicall#multicall3-contract-addresses) for more info. * `ensRegistry` is optional – not all Chains have a ENS Registry. See [ENS Deployments](https://docs.ens.domains/ens-deployments) for more info. * `ensUniversalResolver` is optional – not all Chains have a ENS Universal Resolver. * `sourceId`: Source Chain ID (e.g. the L1 chain). * `testnet`: Whether or not the chain is a testnet. --- --- url: /solid/api/chains.md --- # Chains Viem `Chain` objects. More info at the [Viem docs](https://viem.sh/docs/chains/introduction). ## Import Import via the `'@wagmi/solid/chains'` entrypoint (proxies all chains from `'viem/chains'`). ```ts // {"path":"/vercel/path0/site/solid/api/chains.md","from":405,"to":451} import { mainnet } from '@wagmi/solid/chains' ``` ## Available Chains Chain definitions as of `viem@{{viemVersion}}`. For `viem@latest`, visit the [Viem repo](https://github.com/wevm/viem/blob/main/src/chains/index.ts). ## Create Chain Import the `Chain` type from Viem and create a new object that is asserted `as const` and `satisfies` the type. You can also use the `defineChain` function from Viem. ::: code-group ```ts twoslash [as const satisfies Chain] // @twoslash-cache: {"v":1,"hash":"b104f720769e0d28b42cc38edb3952d146e5b9902d8a7bead95767460071c100","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAML5m7MAB4AZhFIBbZmhqk4vOjTBRVIsWABishUrKqAPrwCummFPEwovALzDR4g/MXKzl67bD2KXgBjCzg0CDk1ehhNVQAlGCDZKAkw0nEAc0CrAGtIAHcwAD5ecytYP3snXgSk0hS0zOywPIhCkrLfOygS52AAHTBeYd4AI1YIIJyAUVosCdITAH5EXgGhkc3kHJgMVcawDIBdVZ1xACEJqdn52TIAbkHNzYrmC1Y0U9cwS8mZuYWDyeIwAvqUfBVuo8NsMkmA0KRmEE0HAVrwAAqLJTsKQYCTrZ4jba7fYIzInFy6IQQeGI5HggmE57IOAQCykIIwACSUFWYAsclGZApZzA1NpSLQ4PKNihwMJYM6kP8UGhmzBADI1vLnjE4AkMuw0hg0aLxQjJdKuiq1Uy9QBVMDsEgqNgJVmsF2m77mulSpWym06zZyd5odhBNisADM3qpNIt9IDlVVOpBHQhgfstuGADp87wAJy8OR3Xj53M53hSGDwONuWtwaSGTwmK3K+wZmUp6EgwbsORYWRS0WUEBhZikBiIACMABYqKwYhk0PgkABWKhoScZGDTkCjxd2JAABioQVEfrISHnIIo6GwuEQBGI1636jwcLCJd0/k+axBMcJynJA5wADkXZdVyQAB2Lcdz3PAFHEP8xw4fwkAAJnPS9JWvWdozvB8cDwQgXTHGh6DwAQYGCGlvz6QCqGA6cADYFxAJdDmgxBN2oBD9y/BgjwwxBsJAC9Jzw8gxMLIjqEfPAyFIWQgO3EDEBgs9OKgtdEELc9oCfGdo1Y7TbC45g5CfEBxFgWhcxRMd2CgJTSFIABaEyzI8sCYI8wsKI/Z8ABVH14AByYAQQi3goAgeBeEgKU4EUI1cX4fBaLoHBkSqGjItFCLc2BMLBCimLeCNEsjTgTJMtomRWAmfJ6qwFScCndhEqkFTIgKiKitWFzAjAKyYFGtKSCEdlFjAIIMECUgsCCe1SFYBBIJIVg3JU8gRKfcTJKvGTo3XeSaNI199uoYKQBYDguD4ArRWbDxjBUKINC0Sk3BbD7vG7bpqlFdwjC8dssygQIQjCCIvpiH7amSVIyUOZpWnaSGU2qZH6lR9J0Z8THimx7pem1GExiuf5bkWFQ0UZQliT2XgDmOL5dF+a4ATuUgqxeGw3g+TmLhpm5AX5tMyaDKm4UTFE0UxPdw1xfFgyJHZWfZkUfQTP0GQ15nWXZTkeT5AUhVIXX4wlJNMx7I3eEVB25SpzVKaZNQwH1GBDWNesxX1y1kzdr2HSdF1UtYd0IE9MhA99EPXdlr3Qw+CMo1jUWg7t/0U+zNMu2tQuqYrIsSzLCsqxrOsc70Rs3vBttQ5VYuO1TMA+ydQdh1+sA1MnacwO0riVz0vj1N3fdD0448xJwqS8pkudzqOQzYDwAchynNZ+HC0VnerPrIqIbq5AiwZBhyvuhJ/FC92qaLeC4OifZStK4FsRLZ+s7ckFAOoPU7AaTUQQCCEEQA="} // @errors: 1360 import { type Chain } from 'viem' export const mainnet = {} as const satisfies Chain ``` ```ts twoslash [defineChain] // @twoslash-cache: {"v":1,"hash":"51816265e78622b289e1e5f943b76d80bfbe0a867d81b51ec6327613f6e28499","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgA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dpCkAAtD9S0I6uq5I2hDzXFkpD5O6vjuBA/C8JgOC8AA5MAJzk1OhiQO4XB5IUzCAjAJMQLwWB9EDqRkLwRMk5cFMUcxJGseE5OLoiAAqQuU9TtOvCmeTviT+BsxoVUQAA7tinP3Tg/TsPAAj3Vogtk+TItUSxtHk7E05OGAPNO7o7AkAodopKIGBOKQWAiIWpCsNDr4wCQrBw/d5AHZsR2QdzhzkIgnZLScOKfbAeCTa0qozeUnThvwZsU0QxtaOTDQNHQU3uE8LyAR8vAALz5x0ASMFT3DdMD8xIKAxhxhIXTXFDIAnCcQA=="} // @errors: 2345 import { defineChain } from 'viem' export const mainnet = defineChain({}) ``` ::: Now, add the missing required properties to the object until the error goes away. ::: code-group ```ts twoslash [as const satisfies Chain] // @twoslash-cache: {"v":1,"hash":"7eb538e5797ec32b451699fd0f71747694cdee2f09698daad95d805d237f68ce","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAML5m7MAB4AZhFIBbZmhqk4vOjTBRVIsWABishUrKqAPrwCummFPEwovALzDR4g/MXKzl67bD2KXgBjCzg0CDk1ehhNVQAlGCDZKAkw0nEAc0CrAGtIAHcwAD5ecytYP3snXgSk0hS0zOywPIhCkrLfOygS52AAHTBeYd4AI1YIIJyAUVosCdITAH5EXgGhkc3kHJgMVcawDIBdVZ1xACEJqdn52TIAbkHNzYrmC1Y0U9cwS8mZuYWDyeIwAvqUfBVuo8NsMkmA0KRmEE0HAVrwAAqLJTsKQYCTrZ4jba7fYIzInFy6IQQeGI5HggmE57IOAQCykIIwACSUFWYAsclGZApZzA1NpSLQ4PKNihwMJYM6kP8UGhmzBADI1vLnjE4AkMuw0hg0aLxQjJdKuiq1Uy9QBVMDsEgqNgJVmsF2m77mulSpWym06zZyd5odhBNisADM3qpNIt9IDlVVOpBHQhgfstuGADp87wAJy8OR3Xj53M53hSGDwONuWtwaSGTwmK3K+wZmUp6EgwbsORYWRS0WUEB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49KaQ6xzEbBq5jJLre7AC8BG4eSNER6IABSW6hQ269SNFHBHHAh3jAh0HpRmQLQXErHbFTHdRLwbFh63HtT3GdSC7AlgAvHvEbCfEbDCG/E6jGHiYe73a8CNH54F67RF6nTnRXS3T3SPTPSvTvSfTfS/T/SzFpjHGbBWGuY2Fd4Yk55rTbFD44x4wEwaREykwwDkwHSUzUy0z0yMzMwziszsw3SczMC0mFQb7CzqTb6SwnSbh0k6guGQasn97slYmbSRiSmjCwAnjrivQnSjDRiXR4aiwnQngHQaQaQMxCgHTMC1Y5InSXSGkzjymEiKn2DqRzjRiGaXQnhjGASImyzHFghcCk4fpSjQzhhwC2DwApFUBoTbhICgDqB6irJ4AHIggghAA==="} import { type Chain } from 'viem' export const mainnet = { id: 1, name: 'Ethereum', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { default: { http: ['https://eth.merkle.io'] }, }, blockExplorers: { default: { name: 'Etherscan', url: 'https://etherscan.io' }, }, contracts: { ensRegistry: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', }, ensUniversalResolver: { address: '0xE4Acdd618deED4e6d2f03b9bf62dc6118FC9A4da', blockCreated: 16773775, }, multicall3: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 14353601, }, }, } as const satisfies Chain ``` ```ts twoslash [defineChain] // @twoslash-cache: {"v":1,"hash":"9dd120cd705dc697124cfe3fa80116ed4046ca81c57ffb5daa2cfd0b2775f253","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvWP3ZgYAYXzM5AHn4RSAW2ZoapOLzo0wUQ0pVgAYpp16ycCrxGS4aZ8rlH6MU+c9g6ra6+nAAfGGMIgGIHpbcsQAKpDB67PwYqgCCcHDsAOaBFmrCMnIwUGFO0ZYRADpg7FpYmu5l8sVglCBuzKQMiACcVKy++Wj4SACMU1RoffmpeO2KAd0c8kgADFQ1pMx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xALwjAKImhygPh1gPgJmDtwJwGB/EjHwKdxc1X1qjaVDDqSf3bzf0Cw/1vwx25V4gwKzXwhqivw6Wrzk3uzzwoPp03zI29xZl2GgHjXyVaHxCKRWksENgECmS0F4AAHIiB2AYAtBXCGgGg6ACl3AngXgOoPheAABeOw1YSwRgZ6BZCgeEZeVwuWNebw+IwkAVbeIVXeWwxIuWVwpwM+AGJItyfI8GB+aGQ2NIkkZGFtJjP4fTYAXga9ZAVwqzATEdemdDVwlmSo+EM4eEeTAWGEOo34BojFGWJI06MLMAUoizVo/jArEzITCAVw3owkfowkSnA0SWFXXrX7XnVwiRfnU3YXC3abcXG3EsfIl+Kov4WvAxUPZOPBX4A4yxfvI7BPE7ZPc7cfdPa7C8a4qsFQp7U/VZG41UEghJSCH7Z4pgv/Q0Q4lCVgoAsHTgyHCAmHOHGAxHOAhiQE4kYE/PdAnHW4rUW4jYk4bgboGkeYJAUAYwC0CQLoa4ThEAE4E4IAA="} import { defineChain } from 'viem' export const mainnet = defineChain({ id: 1, name: 'Ethereum', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { default: { http: ['https://eth.merkle.io'] }, }, blockExplorers: { default: { name: 'Etherscan', url: 'https://etherscan.io' }, }, contracts: { ensRegistry: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', }, ensUniversalResolver: { address: '0xE4Acdd618deED4e6d2f03b9bf62dc6118FC9A4da', blockCreated: 16773775, }, multicall3: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 14353601, }, }, }) ``` ::: The more properties you add, the better the chain will be to use with Wagmi. Most of these attributes exist within the [`ethereum-lists/chains` repository](https://github.com/ethereum-lists/chains/tree/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains). * `id`: The chain ID for the network. This can be found by typing the network name into [ChainList](https://chainlist.org). Example: "Ethereum Mainnet" has a Chain ID of `1`. * `name`: Human-readable name for the chain. Example: "Ethereum Mainnet" * `nativeCurrency`: The native currency of the chain. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L20-L24). * `rpcUrls`: At least one public, credible RPC URL. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L4-L18). * `blockExplorers`: A set of block explorers for the chain. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L30-L36). * `contracts`: A set of deployed contracts for the chain. If you are deploying one of the following contracts yourself, make sure it is verified. * `multicall3` is optional, but it's address is most likely `0xca11bde05977b3631167028862be2a173976ca11` – you can find the deployed block number on the block explorer. Check out [`mds1/multicall`](https://github.com/mds1/multicall#multicall3-contract-addresses) for more info. * `ensRegistry` is optional – not all Chains have a ENS Registry. See [ENS Deployments](https://docs.ens.domains/ens-deployments) for more info. * `ensUniversalResolver` is optional – not all Chains have a ENS Universal Resolver. * `sourceId`: Source Chain ID (e.g. the L1 chain). * `testnet`: Whether or not the chain is a testnet. --- --- url: /tempo/chains.md --- # Chains The following Tempo chains are available: ```ts // {"path":"/vercel/path0/site/tempo/chains.md","from":59,"to":203} import { tempo, // [!code hl] tempoDevnet, // [!code hl] tempoLocalnet, // [!code hl] tempoTestnet, // [!code hl] } from 'wagmi/chains' ``` ## Default Fee Token It is possible to set a default fee token for a Tempo chain by adding a `feeToken` property as an extension to the chain. Once set, all transactions will use this token as the default fee token, unless an override is provided at the transaction level. ```ts // {"path":"/vercel/path0/site/tempo/chains.md","from":490,"to":618} import { tempo } from 'wagmi/chains' const chain = tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001', }) ``` --- --- url: /vue/api/chains.md --- # Chains Viem `Chain` objects. More info at the [Viem docs](https://viem.sh/docs/chains/introduction). ## Import Import via the `'@wagmi/vue/chains'` entrypoint (proxies all chains from `'viem/chains'`). ```ts // {"path":"/vercel/path0/site/vue/api/chains.md","from":403,"to":447} import { mainnet } from '@wagmi/vue/chains' ``` ## Available Chains Chain definitions as of `viem@{{viemVersion}}`. For `viem@latest`, visit the [Viem repo](https://github.com/wevm/viem/blob/main/src/chains/index.ts). ## Create Chain Import the `Chain` type from Viem and create a new object that is asserted `as const` and `satisfies` the type. You can also use the `defineChain` function from Viem. ::: code-group ```ts twoslash [as const satisfies Chain] // @twoslash-cache: {"v":1,"hash":"b104f720769e0d28b42cc38edb3952d146e5b9902d8a7bead95767460071c100","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAML5m7MAB4AZhFIBbZmhqk4vOjTBRVIsWABishUrKqAPrwCummFPEwovALzDR4g/MXKzl67bD2KXgBjCzg0CDk1ehhNVQAlGCDZKAkw0nEAc0CrAGtIAHcwAD5ecytYP3snXgSk0hS0zOywPIhCkrLfOygS52AAHTBeYd4AI1YIIJyAUVosCdITAH5EXgGhkc3kHJgMVcawDIBdVZ1xACEJqdn52TIAbkHNzYrmC1Y0U9cwS8mZuYWDyeIwAvqUfBVuo8NsMkmA0KRmEE0HAVrwAAqLJTsKQYCTrZ4jba7fYIzInFy6IQQeGI5HggmE57IOAQCykIIwACSUFWYAsclGZApZzA1NpSLQ4PKNihwMJYM6kP8UGhmzBADI1vLnjE4AkMuw0hg0aLxQjJdKuiq1Uy9QBVMDsEgqNgJVmsF2m77mulSpWym06zZyd5odhBNisADM3qpNIt9IDlVVOpBHQhgfstuGADp87wAJy8OR3Xj53M53hSGDwONuWtwaSGTwmK3K+wZmUp6EgwbsORYWRS0WUEBhZikBiIACMABYqKwYhk0PgkABWKhoScZGDTkCjxd2JAABioQVEfrISHnIIo6GwuEQBGI1636jwcLCJd0/k+axBMcJynJA5wADkXZdVyQAB2Lcdz3PAFHEP8xw4fwkAAJnPS9JWvWdozvB8cDwQgXTHGh6DwAQYGCGlvz6QCqGA6cADYFxAJdDmgxBN2oBD9y/BgjwwxBsJAC9Jzw8gxMLIjqEfPAyFIWQgO3EDEBgs9OKgtdEELc9oCfGdo1Y7TbC45g5CfEBxFgWhcxRMd2CgJTSFIABaEyzI8sCYI8wsKI/Z8ABVH14AByYAQQi3goAgeBeEgKU4EUI1cX4fBaLoHBkSqGjItFCLc2BMLBCimLeCNEsjTgTJMtomRWAmfJ6qwFScCndhEqkFTIgKiKitWFzAjAKyYFGtKSCEdlFjAIIMECUgsCCe1SFYBBIJIVg3JU8gRKfcTJKvGTo3XeSaNI199uoYKQBYDguD4ArRWbDxjBUKINC0Sk3BbD7vG7bpqlFdwjC8dssygQIQjCCIvpiH7amSVIyUOZpWnaSGU2qZH6lR9J0Z8THimx7pem1GExiuf5bkWFQ0UZQliT2XgDmOL5dF+a4ATuUgqxeGw3g+TmLhpm5AX5tMyaDKm4UTFE0UxPdw1xfFgyJHZWfZkUfQTP0GQ15nWXZTkeT5AUhVIXX4wlJNMx7I3eEVB25SpzVKaZNQwH1GBDWNesxX1y1kzdr2HSdF1UtYd0IE9MhA99EPXdlr3Qw+CMo1jUWg7t/0U+zNMu2tQuqYrIsSzLCsqxrOsc70Rs3vBttQ5VYuO1TMA+ydQdh1+sA1MnacwO0riVz0vj1N3fdD0448xJwqS8pkudzqOQzYDwAchynNZ+HC0VnerPrIqIbq5AiwZBhyvuhJ/FC92qaLeC4OifZStK4FsRLZ+s7ckFAOoPU7AaTUQQCCEEQA="} // @errors: 1360 import { type Chain } from 'viem' export const mainnet = {} as const satisfies Chain ``` ```ts twoslash [defineChain] // @twoslash-cache: {"v":1,"hash":"51816265e78622b289e1e5f943b76d80bfbe0a867d81b51ec6327613f6e28499","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvWP3ZgYAYXzM5AHn4RSAW2ZoapOLzo0wUQ0pVgAYpp16ycCrxGS4aZ8rlH6MU+c9g6ra6+nAAfGGMIgG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5OLoiAAqQuU9TtOvCmeTviT+BsxoVUQAA7tinP3Tg/TsPAAj3Vogtk+TItUSxtHk7E05OGAPNO7o7AkAodopKIGBOKQWAiIWpCsNDr4wCQrBw/d5AHZsR2QdzhzkIgnZLScOKfbAeCTa0qozeUnThvwZsU0QxtaOTDQNHQU3uE8LyAR8vAALz5x0ASMFT3DdMD8xIKAxhxhIXTXFDIAnCcQA=="} // @errors: 2345 import { defineChain } from 'viem' export const mainnet = defineChain({}) ``` ::: Now, add the missing required properties to the object until the error goes away. ::: code-group ```ts twoslash [as const satisfies Chain] // @twoslash-cache: {"v":1,"hash":"7eb538e5797ec32b451699fd0f71747694cdee2f09698daad95d805d237f68ce","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAML5m7MAB4AZhFIBbZmhqk4vOjTBRVIsWABishUrKqAPrwCummFPEwovALzDR4g/MXKzl67bD2KXgBjCzg0CDk1ehhNVQAlGCDZKAkw0nEAc0CrAGtIAHcwAD5ecytYP3snXgSk0hS0zOywPIhCkrLfOygS52AAHTBeYd4AI1YIIJyAUVosCdITAH5EXgGhkc3kHJgMVcawDIBdVZ1xACEJqdn52TIAbkHNzYrmC1Y0U9cwS8mZuYWDyeIwAvqUfBVuo8NsMkmA0KRmEE0HAVrwAAqLJTsKQYCTrZ4jba7fYIzInFy6IQQeGI5HggmE57IOAQCykIIwACSUFWYAsclGZApZzA1NpSLQ4PKNihwMJYM6kP8UGhmzBADI1vLnjE4AkMuw0hg0aLxQjJdKuiq1Uy9QBVMDsEgqNgJVmsF2m77mulSpWym06zZyd5odhBNisADM3qpNIt9IDlVVOpBHQhgfstuGADp87wAJy8OR3Xj53M53hSGDwONuWtwaSGTwmK3K+wZmUp6EgwbsORYWRS0WUEBhZikBiIACMABYqKwYhk0PgkABWKhoScZGDTkCjxd2JAABioQVEfrISHnIIo6GwuEQBGI1636jwcLCJd0/k+2phXhFmYKAaVYDBeHYXleBnKt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DCG/E6jGHiYe73a8CNH54F67RF6nTnRXS3T3SPTPSvTvSfTfS/T/SzFpjHGbBWGuY2Fd4Yk55rTbFD44x4wEwaREykwwDkwHSUzUy0z0yMzMwziszsw3SczMC0mFQb7CzqTb6SwnSbh0k6guGQasn97slYmbSRiSmjCwAnjrivQnSjDRiXR4aiwnQngHQaQaQMxCgHTMC1Y5InSXSGkzjymEiKn2DqRzjRiGaXQnhjGASImyzHFghcCk4fpSjQzhhwC2DwApFUBoTbhICgDqB6irJ4AHIggghAA==="} import { type Chain } from 'viem' export const mainnet = { id: 1, name: 'Ethereum', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { default: { http: ['https://eth.merkle.io'] }, }, blockExplorers: { default: { name: 'Etherscan', url: 'https://etherscan.io' }, }, contracts: { ensRegistry: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', }, ensUniversalResolver: { address: '0xE4Acdd618deED4e6d2f03b9bf62dc6118FC9A4da', blockCreated: 16773775, }, multicall3: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 14353601, }, }, } as const satisfies Chain ``` ```ts twoslash [defineChain] // @twoslash-cache: {"v":1,"hash":"9dd120cd705dc697124cfe3fa80116ed4046ca81c57ffb5daa2cfd0b2775f253","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvWP3ZgYAYXzM5AHn4RSAW2ZoapOLzo0wUQ0pVgAYpp16ycCrxGS4aZ8rlH6MU+c9g6ra6+nAAfGGMIgGIHpbcsQAKpDB67PwYqgCCcHDsAOaBFmrCMnIwUGFO0ZYRADpg7FpYmu5l8sVglCBuzKQMiACcVKy++Wj4SACMU1RoffmpeO2KAd0c8kgADFQ1pMxiZEiDAL4U6Ni4iATER3PGeC5gbrw6cvJoscANvL+8AEasCAiADWAFFaFggSkDF8fn8ESlmFBJKwMNIYPxmIJWJ9eN8pAiib8kSiwGj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jXyVaHxCKRWksENgECmS0F4AAHIiB2AYAtBXCGgGg6ACl3AngXgOoPheAABeOw1YSwRgZ6BZCgeEZeVwuWNebw+IwkAVbeIVXeWwxIuWVwpwM+AGJItyfI8GB+aGQ2NIkkZGFtJjP4fTYAXga9ZAVwqzATEdemdDVwlmSo+EM4eEeTAWGEOo34BojFGWJI06MLMAUoizVo/jArEzITCAVw3owkfowkSnA0SWFXXrX7XnVwiRfnU3YXC3abcXG3EsfIl+Kov4WvAxUPZOPBX4A4yxfvI7BPE7ZPc7cfdPa7C8a4qsFQp7U/VZG41UEghJSCH7Z4pgv/Q0Q4lCVgoAsHTgyHCAmHOHGAxHOAhiQE4kYE/PdAnHW4rUW4jYk4bgboGkeYJAUAYwC0CQLoa4ThEAE4E4IAA="} import { defineChain } from 'viem' export const mainnet = defineChain({ id: 1, name: 'Ethereum', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { default: { http: ['https://eth.merkle.io'] }, }, blockExplorers: { default: { name: 'Etherscan', url: 'https://etherscan.io' }, }, contracts: { ensRegistry: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', }, ensUniversalResolver: { address: '0xE4Acdd618deED4e6d2f03b9bf62dc6118FC9A4da', blockCreated: 16773775, }, multicall3: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 14353601, }, }, }) ``` ::: The more properties you add, the better the chain will be to use with Wagmi. Most of these attributes exist within the [`ethereum-lists/chains` repository](https://github.com/ethereum-lists/chains/tree/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains). * `id`: The chain ID for the network. This can be found by typing the network name into [ChainList](https://chainlist.org). Example: "Ethereum Mainnet" has a Chain ID of `1`. * `name`: Human-readable name for the chain. Example: "Ethereum Mainnet" * `nativeCurrency`: The native currency of the chain. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L20-L24). * `rpcUrls`: At least one public, credible RPC URL. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L4-L18). * `blockExplorers`: A set of block explorers for the chain. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L30-L36). * `contracts`: A set of deployed contracts for the chain. If you are deploying one of the following contracts yourself, make sure it is verified. * `multicall3` is optional, but it's address is most likely `0xca11bde05977b3631167028862be2a173976ca11` – you can find the deployed block number on the block explorer. Check out [`mds1/multicall`](https://github.com/mds1/multicall#multicall3-contract-addresses) for more info. * `ensRegistry` is optional – not all Chains have a ENS Registry. See [ENS Deployments](https://docs.ens.domains/ens-deployments) for more info. * `ensUniversalResolver` is optional – not all Chains have a ENS Universal Resolver. * `sourceId`: Source Chain ID (e.g. the L1 chain). * `testnet`: Whether or not the chain is a testnet. --- --- url: /core/api/connectors/coinbaseWallet.md --- # coinbaseWallet Connector for the [Coinbase Wallet SDK](https://github.com/coinbase/coinbase-wallet-sdk). ## Import ```ts-vue import { coinbaseWallet } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { coinbaseWallet } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [mainnet, sepolia], connectors: [coinbaseWallet()], // [!code hl] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` :::warning Before going to production, it is highly recommended to set an [`appName`](#appname) and [`appLogoUrl`](#applogourl) for your application that can be displayed upon connection to the wallet. ::: ## Parameters ```ts-vue import { type CoinbaseWalletParameters } from '{{connectorsPackageName}}' ``` Check out the [Coinbase Wallet SDK docs](https://github.com/coinbase/coinbase-wallet-sdk) for more info. ### appName `string` Application name. ```ts-vue import { coinbaseWallet } from '{{connectorsPackageName}}' const connector = coinbaseWallet({ appName: 'My Wagmi App', // [!code focus] }) ``` ### appLogoUrl `string | null | undefined` Application logo image URL; favicon is used if unspecified. ```ts-vue import { coinbaseWallet } from '{{connectorsPackageName}}' const connector = coinbaseWallet({ appName: 'My Wagmi App', appLogoUrl: 'https://example.com/myLogoUrl.png', // [!code focus] }) ``` ### preference Preference for the type of wallet to display. ```ts-vue import { coinbaseWallet } from '{{connectorsPackageName}}' const connector = coinbaseWallet({ appName: 'My Wagmi App', preference: { // [!code focus] options: 'smartWalletOnly' // [!code focus] }, // [!code focus] }) ``` #### attribution ``{ auto?: boolean | undefined; dataSuffix?: `0x${string}` | undefined }`` This option only applies to Coinbase Smart Wallet. When a valid data suffix is supplied, it is appended to the `initCode` and `executeBatch` calldata. Coinbase Smart Wallet expects a 16 byte hex string. If the data suffix is not a 16 byte hex string, the Smart Wallet will ignore the property. If auto is true, the Smart Wallet will generate a 16 byte hex string from the apps origin. #### keysUrl `string` * The URL for the keys popup. * By default, `https://keys.coinbase.com/connect` is used for production. Use `https://keys-dev.coinbase.com/connect` for development environments. #### options `"all" | "eoaOnly" | "smartWalletOnly"` Preference for the type of wallet to display. * `'eoaOnly'`: Uses EOA Browser Extension or Mobile Coinbase Wallet. * `'smartWalletOnly'`: Displays Smart Wallet popup. * `'all'` (default): Supports both `'eoaOnly'` and `'smartWalletOnly'` based on context. --- --- url: /react/api/connectors/coinbaseWallet.md --- # coinbaseWallet Connector for the [Coinbase Wallet SDK](https://github.com/coinbase/coinbase-wallet-sdk). ## Import ```ts-vue import { coinbaseWallet } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { coinbaseWallet } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [mainnet, sepolia], connectors: [coinbaseWallet()], // [!code hl] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` :::warning Before going to production, it is highly recommended to set an [`appName`](#appname) and [`appLogoUrl`](#applogourl) for your application that can be displayed upon connection to the wallet. ::: ## Parameters ```ts-vue import { type CoinbaseWalletParameters } from '{{connectorsPackageName}}' ``` Check out the [Coinbase Wallet SDK docs](https://github.com/coinbase/coinbase-wallet-sdk) for more info. ### appName `string` Application name. ```ts-vue import { coinbaseWallet } from '{{connectorsPackageName}}' const connector = coinbaseWallet({ appName: 'My Wagmi App', // [!code focus] }) ``` ### appLogoUrl `string | null | undefined` Application logo image URL; favicon is used if unspecified. ```ts-vue import { coinbaseWallet } from '{{connectorsPackageName}}' const connector = coinbaseWallet({ appName: 'My Wagmi App', appLogoUrl: 'https://example.com/myLogoUrl.png', // [!code focus] }) ``` ### preference Preference for the type of wallet to display. ```ts-vue import { coinbaseWallet } from '{{connectorsPackageName}}' const connector = coinbaseWallet({ appName: 'My Wagmi App', preference: { // [!code focus] options: 'smartWalletOnly' // [!code focus] }, // [!code focus] }) ``` #### attribution ``{ auto?: boolean | undefined; dataSuffix?: `0x${string}` | undefined }`` This option only applies to Coinbase Smart Wallet. When a valid data suffix is supplied, it is appended to the `initCode` and `executeBatch` calldata. Coinbase Smart Wallet expects a 16 byte hex string. If the data suffix is not a 16 byte hex string, the Smart Wallet will ignore the property. If auto is true, the Smart Wallet will generate a 16 byte hex string from the apps origin. #### keysUrl `string` * The URL for the keys popup. * By default, `https://keys.coinbase.com/connect` is used for production. Use `https://keys-dev.coinbase.com/connect` for development environments. #### options `"all" | "eoaOnly" | "smartWalletOnly"` Preference for the type of wallet to display. * `'eoaOnly'`: Uses EOA Browser Extension or Mobile Coinbase Wallet. * `'smartWalletOnly'`: Displays Smart Wallet popup. * `'all'` (default): Supports both `'eoaOnly'` and `'smartWalletOnly'` based on context. --- --- url: /shared/connectors/coinbaseWallet.md --- # coinbaseWallet Connector for the [Coinbase Wallet SDK](https://github.com/coinbase/coinbase-wallet-sdk). ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/coinbaseWallet.md","from":285,"to":344} import { coinbaseWallet } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/shared/connectors/coinbaseWallet.md","from":597,"to":658} pnpm add @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/shared/connectors/coinbaseWallet.md","from":681,"to":745} npm install @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/shared/connectors/coinbaseWallet.md","from":769,"to":830} yarn add @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/shared/connectors/coinbaseWallet.md","from":853,"to":913} bun add @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/coinbaseWallet.md","from":942,"to":1318} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { coinbaseWallet } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [mainnet, sepolia], connectors: [coinbaseWallet()], // [!code hl] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` :::warning Before going to production, it is highly recommended to set an [`appName`](#appname) and [`appLogoUrl`](#applogourl) for your application that can be displayed upon connection to the wallet. ::: ## Parameters ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/coinbaseWallet.md","from":1555,"to":1629} import { type CoinbaseWalletParameters } from '{{connectorsPackageName}}' ``` Check out the [Coinbase Wallet SDK docs](https://github.com/coinbase/coinbase-wallet-sdk) for more info. ### appName `string` Application name. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/coinbaseWallet.md","from":1792,"to":1934} import { coinbaseWallet } from '{{connectorsPackageName}}' const connector = coinbaseWallet({ appName: 'My Wagmi App', // [!code focus] }) ``` ### appLogoUrl `string | null | undefined` Application logo image URL; favicon is used if unspecified. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/coinbaseWallet.md","from":2055,"to":2248} import { coinbaseWallet } from '{{connectorsPackageName}}' const connector = coinbaseWallet({ appName: 'My Wagmi App', appLogoUrl: 'https://example.com/myLogoUrl.png', // [!code focus] }) ``` ### preference Preference for the type of wallet to display. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/coinbaseWallet.md","from":2351,"to":2579} import { coinbaseWallet } from '{{connectorsPackageName}}' const connector = coinbaseWallet({ appName: 'My Wagmi App', preference: { // [!code focus] options: 'smartWalletOnly' // [!code focus] }, // [!code focus] }) ``` #### attribution ``{ auto?: boolean | undefined; dataSuffix?: `0x${string}` | undefined }`` This option only applies to Coinbase Smart Wallet. When a valid data suffix is supplied, it is appended to the `initCode` and `executeBatch` calldata. Coinbase Smart Wallet expects a 16 byte hex string. If the data suffix is not a 16 byte hex string, the Smart Wallet will ignore the property. If auto is true, the Smart Wallet will generate a 16 byte hex string from the apps origin. #### keysUrl `string` * The URL for the keys popup. * By default, `https://keys.coinbase.com/connect` is used for production. Use `https://keys-dev.coinbase.com/connect` for development environments. #### options `"all" | "eoaOnly" | "smartWalletOnly"` Preference for the type of wallet to display. * `'eoaOnly'`: Uses EOA Browser Extension or Mobile Coinbase Wallet. * `'smartWalletOnly'`: Displays Smart Wallet popup. * `'all'` (default): Supports both `'eoaOnly'` and `'smartWalletOnly'` based on context. --- --- url: /vue/api/connectors/coinbaseWallet.md --- # coinbaseWallet Connector for the [Coinbase Wallet SDK](https://github.com/coinbase/coinbase-wallet-sdk). ## Import ```ts-vue import { coinbaseWallet } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add @coinbase/wallet-sdk@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { coinbaseWallet } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [mainnet, sepolia], connectors: [coinbaseWallet()], // [!code hl] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` :::warning Before going to production, it is highly recommended to set an [`appName`](#appname) and [`appLogoUrl`](#applogourl) for your application that can be displayed upon connection to the wallet. ::: ## Parameters ```ts-vue import { type CoinbaseWalletParameters } from '{{connectorsPackageName}}' ``` Check out the [Coinbase Wallet SDK docs](https://github.com/coinbase/coinbase-wallet-sdk) for more info. ### appName `string` Application name. ```ts-vue import { coinbaseWallet } from '{{connectorsPackageName}}' const connector = coinbaseWallet({ appName: 'My Wagmi App', // [!code focus] }) ``` ### appLogoUrl `string | null | undefined` Application logo image URL; favicon is used if unspecified. ```ts-vue import { coinbaseWallet } from '{{connectorsPackageName}}' const connector = coinbaseWallet({ appName: 'My Wagmi App', appLogoUrl: 'https://example.com/myLogoUrl.png', // [!code focus] }) ``` ### preference Preference for the type of wallet to display. ```ts-vue import { coinbaseWallet } from '{{connectorsPackageName}}' const connector = coinbaseWallet({ appName: 'My Wagmi App', preference: { // [!code focus] options: 'smartWalletOnly' // [!code focus] }, // [!code focus] }) ``` #### attribution ``{ auto?: boolean | undefined; dataSuffix?: `0x${string}` | undefined }`` This option only applies to Coinbase Smart Wallet. When a valid data suffix is supplied, it is appended to the `initCode` and `executeBatch` calldata. Coinbase Smart Wallet expects a 16 byte hex string. If the data suffix is not a 16 byte hex string, the Smart Wallet will ignore the property. If auto is true, the Smart Wallet will generate a 16 byte hex string from the apps origin. #### keysUrl `string` * The URL for the keys popup. * By default, `https://keys.coinbase.com/connect` is used for production. Use `https://keys-dev.coinbase.com/connect` for development environments. #### options `"all" | "eoaOnly" | "smartWalletOnly"` Preference for the type of wallet to display. * `'eoaOnly'`: Uses EOA Browser Extension or Mobile Coinbase Wallet. * `'smartWalletOnly'`: Displays Smart Wallet popup. * `'all'` (default): Supports both `'eoaOnly'` and `'smartWalletOnly'` based on context. --- --- url: /cli/api/commands.md --- # Commands ## Available Commands * [`init`](/cli/api/commands/init) Creates configuration file. * [`generate`](/cli/api/commands/generate) Generates code based on configuration, using `contracts` and `plugins`. ## Display Info ### `-h`, `--help` Show help message when `-h`, `--help` flags appear. ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/cli/api/commands.md","from":334,"to":352} pnpm wagmi --help ``` ```bash [npm] // {"path":"/vercel/path0/site/cli/api/commands.md","from":371,"to":388} npx wagmi --help ``` ```bash [yarn] // {"path":"/vercel/path0/site/cli/api/commands.md","from":408,"to":426} yarn wagmi --help ``` ```bash [bun] // {"path":"/vercel/path0/site/cli/api/commands.md","from":445,"to":462} bun wagmi --help ``` ::: ### `-v`, `--version` Show version number when `-v`, `--version` flags appear. ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/cli/api/commands.md","from":582,"to":603} pnpm wagmi --version ``` ```bash [npm] // {"path":"/vercel/path0/site/cli/api/commands.md","from":622,"to":642} npx wagmi --version ``` ```bash [yarn] // {"path":"/vercel/path0/site/cli/api/commands.md","from":662,"to":683} yarn wagmi --version ``` ```bash [bun] // {"path":"/vercel/path0/site/cli/api/commands.md","from":702,"to":722} bun wagmi --version ``` ::: --- --- url: /react/comparisons.md --- # Comparison There are multiple options when it comes to React libraries for Ethereum that help manage wallet connections, provide utility methods/hooks, etc. ::: tip Comparisons strive to be as accurate and as unbiased as possible. If you use any of these libraries and feel the information could be improved, feel free to suggest changes. ::: ## Overview | | [wagmi](https://github.com/wagmi-dev/wagmi) | [web3-react](https://github.com/NoahZinsmeister/web3-react) | [useDApp](https://github.com/EthWorks/useDApp) | | -------------------- | :---------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------- | | GitHub Stars | ![wagmi star count](https://img.shields.io/github/stars/wagmi-dev/wagmi?colorB=27292E\&label=) | ![web3-react star count](https://img.shields.io/github/stars/Uniswap/web3-react?colorB=27292E\&label=) | ![useDApp star count](https://img.shields.io/github/stars/EthWorks/useDApp?colorB=27292E\&label=) | | Open Issues | ![wagmi issue count](https://img.shields.io/github/issues/wagmi-dev/wagmi?colorB=27292E\&label=) | ![web3-react issue count](https://img.shields.io/github/issues/Uniswap/web3-react?colorB=27292E\&label=) | ![useDApp issue count](https://img.shields.io/github/issues/EthWorks/useDApp?colorB=27292E\&label=) | | Downloads | ![wagmi downloads](https://img.shields.io/npm/dw/wagmi?colorB=27292E\&label=) | ![web3-react downloads](https://img.shields.io/npm/dw/@web3-react/core?colorB=27292E\&label=) | ![useDApp downloads](https://img.shields.io/npm/dw/@usedapp/core?colorB=27292E\&label=) | | License | ![wagmi license](https://img.shields.io/github/license/wagmi-dev/wagmi?colorB=27292E\&label=) | ![web3-react license](https://img.shields.io/github/license/Uniswap/web3-react?colorB=27292E\&label=) | ![useDApp license](https://img.shields.io/github/license/EthWorks/useDApp?colorB=27292E\&label=) | | Their Comparison | – | none | none | | Supported Frameworks | React, Vanilla JS | React | React | | Documentation | ✅ | 🛑 | ✅ | | TypeScript | ✅ | 🔶 | 🔶 | | EIP-6963 Support | ✅ | 🔴 | 🔴 | | Test Suite | ✅ | 🔶 | 🔶 | | Examples | ✅ | 🔶 | ✅ | ::: details Comparison Key 1. Documentation * Comprehensive documentation for all library features ✅ * No documentation 🔴 2. Typescript * Infer types from ABIs, EIP-712 Typed Data, etc. ✅ * Can add types with explicit generics, type annotations, etc. 🔶 3. Test Suite * Runs against forked Ethereum network(s) ✅ * Mocking functionality (i.e. RPC calls) is 🔶 4. EIP-6963 Support * Fully compatible with EIP-6963 ✅ * Not compatible with EIP-6963 🔴 5. Examples * Has multiple examples ✅ * Has single example 🔶 ::: ## [Wagmi](https://github.com/wagmi-dev/wagmi) ### Pros * 20+ hooks for working with wallets, ENS, contracts, transactions, signing, etc. * Built-in wallet connectors for injected providers (EIP-6963 support), WalletConnect, MetaMask, Coinbase Wallet * Caching, request deduplication, and persistence powered by TanStack Query * Auto-refresh data on wallet, block, and network changes * Multicall support * Test suite running against forked Ethereum networks * TypeScript ready (infer types from ABIs and EIP-712 Typed Data) * Extensive documentation and examples * Used by Coinbase, Stripe, Shopify, Uniswap, Optimism, ENS, Sushi, and [many more](https://github.com/wagmi-dev/wagmi/discussions/201) * MIT License ### Cons * Not as many built-in connectors as `web3-react` ## [web3-react](https://github.com/Uniswap/web3-react) ### Pros * Supports many different connectors (conceptually similar to Wagmi's connectors) * Basic hooks for managing account ### Cons * Need to set up connectors and method for connecting wallet on your own * Need to install connectors separately * Almost no tests or documentation; infrequent updates * GPL-3.0 License ## [useDApp](https://github.com/EthWorks/useDApp) ### Pros * Auto-refresh on new blocks and wallet changes * Multicall support * Transaction notifications * Chrome extension and Firefox add-on * MIT License ### Cons * Non-standard hook API --- --- url: /vue/api/composables.md --- # Composables Vue Composables for accounts, wallets, contracts, transactions, signing, ENS, and more. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables.md","from":336,"to":379} import { useConnection } from '@wagmi/vue' ``` ## Available Composables --- --- url: /cli/config/options.md --- # Config Options Configuration options for Wagmi CLI. ## contracts `ContractConfig[] | undefined` Array of contracts to use when running [commands](/cli/api/commands). `abi` and `name` are required, all other properties are optional. ### address `Address | Record | undefined` Contract address or addresses. Accepts an object `{ [chainId]: address }` for targeting specific chains. ::: code-group ```ts {6,11-14} [wagmi.config.ts] // {"path":"/vercel/path0/site/cli/config/options.md","from":457,"to":739} export default { out: 'src/generated.ts', contracts: [ { abi: […], address: '0x…', name: 'MyCoolContract', }, { abi: […], address: { 1: '0xfoo…', 5: '0xbar…', }, name: 'MyCoolMultichainContract' } ], } ``` ::: ### abi `Abi` ABI for contract. Used by [plugins](/cli/api/plugins) to generate code base on properties. ::: code-group ```ts {5} [wagmi.config.ts] // {"path":"/vercel/path0/site/cli/config/options.md","from":899,"to":1023} export default { out: 'src/generated.ts', contracts: [ { abi: […], name: 'MyCoolContract' }, ], } ``` ::: ### name `string` Name of contract. Must be unique. Used by [plugins](/cli/api/plugins) to name generated code. ::: code-group ```ts {6} [wagmi.config.ts] // {"path":"/vercel/path0/site/cli/config/options.md","from":1190,"to":1314} export default { out: 'src/generated.ts', contracts: [ { abi: […], name: 'MyCoolContract' }, ], } ``` ::: ## out `string` Path to output generated code. Must be unique per config. Use an [Array Config](/cli/config/configuring-cli#array-config) for multiple outputs. ::: code-group ```ts {2} [wagmi.config.ts] // {"path":"/vercel/path0/site/cli/config/options.md","from":1529,"to":1653} export default { out: 'src/generated.ts', contracts: [ { abi: […], name: 'MyCoolContract' }, ], } ``` ::: ## plugins `Plugin[] | undefined` Plugins to use and their configuration. Wagmi CLI has multiple [built-in plugins](/cli/api/plugins) that are used to manage ABIs, generate code, etc. ::: code-group ```ts {1,5-20} [wagmi.config.ts] // {"path":"/vercel/path0/site/cli/config/options.md","from":1898,"to":2353} import { etherscan, react } from '@wagmi/cli/plugins' export default { out: 'src/generated.js', plugins: [ etherscan({ apiKey: process.env.ETHERSCAN_API_KEY, chainId: 5, contracts: [ { name: 'EnsRegistry', address: { 1: '0x314159265dd8dbb310642f98f50c066173c1259b', 5: '0x112234455c3a32fd11230c42e7bccd4a84e02010', }, }, ], }), react(), ], } ``` ::: --- --- url: /cli/config/configuring-cli.md --- # Configuring CLI When running `wagmi` from the command line, `@wagmi/cli` will automatically try to resolve a config file named `wagmi.config.js` or `wagmi.config.ts` inside the project root. The most basic config file looks like this: ::: code-group ```js [wagmi.config.js] // {"path":"/vercel/path0/site/cli/config/configuring-cli.md","from":278,"to":317} export default { // config options } ``` ::: Note `@wagmi/cli` supports using ES modules syntax in the config file even if the project is not using native Node ESM, e.g. `"type": "module"` in package.json. In this case, the config file is auto pre-processed before load. You can also explicitly specify a config file to use with the `--config`/`-c` CLI option (resolved relative to the current directory): ```bash // {"path":"/vercel/path0/site/cli/config/configuring-cli.md","from":697,"to":725} wagmi --config my-config.js ``` To scaffold a config file quickly, check out the [`init`](/cli/api/commands/init) command. ## Config Intellisense Since Wagmi CLI ships with TypeScript typings, you can use your editor's intellisense with [JSDoc](https://jsdoc.app) type hints: ::: code-group ```js [wagmi.config.js] // {"path":"/vercel/path0/site/cli/config/configuring-cli.md","from":1016,"to":1087} /** @type {import('@wagmi/cli').Config} */ export default { // ... } ``` ::: Alternatively, you can use the `defineConfig` utility which should provide intellisense without the need for JSDoc annotations: ::: code-group ```js [wagmi.config.js] // {"path":"/vercel/path0/site/cli/config/configuring-cli.md","from":1264,"to":1349} import { defineConfig } from '@wagmi/cli' export default defineConfig({ // ... }) ``` ::: Wagmi CLI also directly supports TypeScript config files. You can use `wagmi.config.ts` with the `defineConfig` helper as well. ## Conditional Config If the config needs to conditionally determine options based on the environment, it can export a function instead: ::: code-group ```js [wagmi.config.js] // {"path":"/vercel/path0/site/cli/config/configuring-cli.md","from":1665,"to":1862} export default defineConfig(() => { if (process.env.NODE_ENV === 'dev') { return { // dev specific config } } else { return { // production specific config } } }) ``` ::: ## Async Config If the config needs to call async function, it can export a async function instead: ::: code-group ```js [wagmi.config.js] // {"path":"/vercel/path0/site/cli/config/configuring-cli.md","from":2012,"to":2120} export default defineConfig(async () => { const data = await asyncFunction() return { // ... } }) ``` ::: This can be useful for resolving external resources from the network or filesystem that are required for configuration ahead of running a command. ## Array Config The config can also be represented either as a pre-defined array or returned as an array from a function: ::: code-group ```js [wagmi.config.js] // {"path":"/vercel/path0/site/cli/config/configuring-cli.md","from":2440,"to":2519} export default defineConfig([ { // config 1 }, { // config 2 }, ]) ``` ::: ## Environment Variables Environmental Variables can be obtained from `process.env` as usual. Note that Wagmi CLI doesn't load `.env` files by default as the files to load can only be determined after evaluating the config. However, you can use the exported `loadEnv` utility to load the specific `.env` files if needed. ::: code-group ```js [wagmi.config.js] // {"path":"/vercel/path0/site/cli/config/configuring-cli.md","from":2891,"to":3096} import { defineConfig, loadEnv } from '@wagmi/cli' export default defineConfig(() => { const env = loadEnv({ mode: process.env.NODE_ENV, envDir: process.cwd(), }) return { // ... } }) ``` ::: --- --- url: /core/api/actions/connect.md --- # connect Action for connecting accounts with [connectors](/core/api/connectors). ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/connect.md","from":217,"to":255} import { connect } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/connect.md","from":302,"to":484} import { connect } from '@wagmi/core' import { injected } from '@wagmi/connectors' import { config } from './config' const result = await connect(config, { connector: injected() }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/connect.md","from":555,"to":608} import { type ConnectParameters } from '@wagmi/core' ``` ### chainId `number | undefined` Chain ID to connect to. Not all connectors support connecting directly to a `chainId` (e.g. they don't support programmatic chain switching). In those cases, the connector will connect to whatever chain the connector's provider is connected to. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/connect.md","from":927,"to":1197} import { connect } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { injected } from '@wagmi/connectors' import { config } from './config' const result = await connect(config, { chainId: mainnet.id, // [!code focus] connector: injected(), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `CreateConnectorFn | Connector` [Connector](/core/api/connectors) to connect with. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/connect.md","from":1379,"to":1598} import { connect } from '@wagmi/core' import { injected } from '@wagmi/connectors' // [!code focus] import { config } from './config' const result = await connect(config, { connector: injected(), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### withCapabilities `boolean | undefined` * Exposes [capabilities](https://eips.ethereum.org/EIPS/eip-7846#capabilities) on return type. * Defaults to `false`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/connect.md","from":1844,"to":2117} import { connect } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { injected } from '@wagmi/connectors' import { config } from './config' const result = await connect(config, { connector: injected(), withCapabilities: true, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/connect.md","from":2189,"to":2242} import { type ConnectReturnType } from '@wagmi/core' ``` ::: tip When [`withCapabilities: false | undefined`](#withcapabilities): ```ts // {"path":"/vercel/path0/site/core/api/actions/connect.md","from":2326,"to":2395} type ConnectReturnType = { accounts: readonly Address[] // ... } ``` When [`withCapabilities: true`](#withcapabilities): ```ts // {"path":"/vercel/path0/site/core/api/actions/connect.md","from":2457,"to":2578} type ConnectReturnType = { accounts: readonly { address: Address; capabilities: Record }[] // ... } ``` ::: ### accounts `readonly [Address, ...Address[]]` Connected accounts from connector. ### chainId `number` Connected chain ID from connector. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/connect.md","from":2748,"to":2800} import { type ConnectErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` --- --- url: /react/guides/connect-wallet.md --- # Connect Wallet The ability for a user to connect their wallet is a core function for any Dapp. It allows users to perform tasks such as: writing to contracts, signing messages, or sending transactions. Wagmi contains everything you need to get started with building a Connect Wallet module. To get started, you can either use a [third-party library](#third-party-libraries) or [build your own](#build-your-own). ## Third-party Libraries You can use a pre-built Connect Wallet module from a third-party library such as: * [ConnectKit](https://docs.family.co/connectkit) - [Guide](https://docs.family.co/connectkit/getting-started) * [Dynamic](https://www.dynamic.xyz/) - [Guide](https://docs.dynamic.xyz/quickstart) * [Privy](https://privy.io) - [Guide](https://docs.privy.io/guide/react/wallets/usage/wagmi) The above libraries are all built on top of Wagmi, handle all the edge cases around wallet connection, and provide a seamless Connect Wallet UX that you can use in your Dapp. ## Build Your Own Wagmi provides you with the Hooks to get started building your own Connect Wallet module. It takes less than five minutes to get up and running with Browser Wallets, WalletConnect, and Coinbase Wallet. ### 1. Configure Wagmi Before we get started with building the functionality of the Connect Wallet module, we will need to set up the Wagmi configuration. Let's create a `config.ts` file and export a `config` object. ::: code-group ```tsx [config.ts] // {"path":"/vercel/path0/site/react/guides/connect-wallet.md","from":1471,"to":1929} import { http, createConfig } from 'wagmi' import { base, mainnet, optimism } from 'wagmi/chains' import { injected, metaMask, safe, walletConnect } from 'wagmi/connectors' const projectId = '' export const config = createConfig({ chains: [mainnet, base], connectors: [ injected(), walletConnect({ projectId }), metaMask(), safe(), ], transports: { [mainnet.id]: http(), [base.id]: http(), }, }) ``` ::: In the above configuration, we want to set up connectors for Injected (browser), WalletConnect (browser + mobile), MetaMask, and Safe wallets. This configuration uses the **Mainnet** and **Base** chains, but you can use whatever you want. ::: warning Make sure to replace the `projectId` with your own WalletConnect Project ID, if you wish to use WalletConnect! [Get your Project ID](https://cloud.reown.com/) ::: ### 2. Wrap App in Context Provider Next, we will need to wrap our React App with Context so that our application is aware of Wagmi & React Query's reactive state and in-memory caching. ::: code-group ```tsx [app.tsx] // {"path":"/vercel/path0/site/react/guides/connect-wallet.md","from":2580,"to":3068} // 1. Import modules import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { WagmiProvider } from 'wagmi' import { config } from './config' // 2. Set up a React Query client. const queryClient = new QueryClient() function App() { // 3. Wrap app with Wagmi and React Query context. return ( {/** ... */} ) } ``` ```tsx [config.ts] // {"path":"/vercel/path0/site/react/guides/connect-wallet.md","from":3092,"to":3550} import { http, createConfig } from 'wagmi' import { base, mainnet, optimism } from 'wagmi/chains' import { injected, metaMask, safe, walletConnect } from 'wagmi/connectors' const projectId = '' export const config = createConfig({ chains: [mainnet, base], connectors: [ injected(), walletConnect({ projectId }), metaMask(), safe(), ], transports: { [mainnet.id]: http(), [base.id]: http(), }, }) ``` ::: ### 3. Display Wallet Options After that, we will create a `WalletOptions` component that will display our connectors. This will allow users to select a wallet and connect. Below, we are rendering a list of `connectors` retrieved from `useConnect`. When the user clicks on a connector, the `connect` function will connect the users' wallet. ::: code-group ```tsx [wallet-options.tsx] // {"path":"/vercel/path0/site/react/guides/connect-wallet.md","from":3948,"to":4305} import * as React from 'react' import { Connector, useConnect, useConnectors } from 'wagmi' export function WalletOptions() { const { connect } = useConnect() const connectors = useConnectors() return connectors.map((connector) => ( )) } ``` ```tsx [app.tsx] // {"path":"/vercel/path0/site/react/guides/connect-wallet.md","from":4327,"to":4813} // 1. Import modules import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { WagmiProvider } from 'wagmi' import { config } from './config' // 2. Set up a React Query client. const queryClient = new QueryClient() function App() { // 3. Wrap app with Wagmi and React Query context. return ( {/* ... */} ) } ``` ```tsx [config.ts] // {"path":"/vercel/path0/site/react/guides/connect-wallet.md","from":4837,"to":5295} import { http, createConfig } from 'wagmi' import { base, mainnet, optimism } from 'wagmi/chains' import { injected, metaMask, safe, walletConnect } from 'wagmi/connectors' const projectId = '' export const config = createConfig({ chains: [mainnet, base], connectors: [ injected(), walletConnect({ projectId }), metaMask(), safe(), ], transports: { [mainnet.id]: http(), [base.id]: http(), }, }) ``` ::: ### 4. Display Connection Lastly, if an connection is made, we want to show some basic information, like the connected address and ENS name and avatar. Below, we are using hooks like `useConnection`, `useEnsAvatar` and `useEnsName` to extract this information. We are also utilizing `useDisconnect` to show a "Disconnect" button so a user can disconnect their wallet. ::: code-group ```tsx [connection.tsx] // {"path":"/vercel/path0/site/react/guides/connect-wallet.md","from":5717,"to":6264} import { useConnection, useDisconnect, useEnsAvatar, useEnsName } from 'wagmi' export function Connection() { const { address } = useConnection() const { disconnect } = useDisconnect() const { data: ensName } = useEnsName({ address }) const { data: ensAvatar } = useEnsAvatar({ name: ensName! }) return (
{ensAvatar && ENS Avatar} {address &&
{ensName ? `${ensName} (${address})` : address}
}
) } ``` ```tsx [wallet-options.tsx] // {"path":"/vercel/path0/site/react/guides/connect-wallet.md","from":6297,"to":7081} import * as React from 'react' import { Connector, useConnect, useConnectors } from 'wagmi' export function WalletOptions() { const { connect } = useConnect() const connectors = useConnectors() return connectors.map((connector) => ( connect({ connector })} /> )) } function WalletOption({ connector, onClick, }: { connector: Connector onClick: () => void }) { const [ready, setReady] = React.useState(false) React.useEffect(() => { ;(async () => { const provider = await connector.getProvider() setReady(!!provider) })() }, [connector]) return ( ) } ``` ```tsx [app.tsx] // {"path":"/vercel/path0/site/react/guides/connect-wallet.md","from":7103,"to":7589} // 1. Import modules import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { WagmiProvider } from 'wagmi' import { config } from './config' // 2. Set up a React Query client. const queryClient = new QueryClient() function App() { // 3. Wrap app with Wagmi and React Query context. return ( {/* ... */} ) } ``` ```tsx [config.ts] // {"path":"/vercel/path0/site/react/guides/connect-wallet.md","from":7613,"to":8071} import { http, createConfig } from 'wagmi' import { base, mainnet, optimism } from 'wagmi/chains' import { injected, metaMask, safe, walletConnect } from 'wagmi/connectors' const projectId = '' export const config = createConfig({ chains: [mainnet, base], connectors: [ injected(), walletConnect({ projectId }), metaMask(), safe(), ], transports: { [mainnet.id]: http(), [base.id]: http(), }, }) ``` ::: ### 5. Wire it up! Finally, we can wire up our Wallet Options and Connection components to our application's entrypoint. ::: code-group ```tsx [app.tsx] // {"path":"/vercel/path0/site/react/guides/connect-wallet.md","from":8237,"to":8977} import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { WagmiProvider, useConnection } from 'wagmi' import { config } from './config' import { Connection } from './connection' // [!code ++] import { WalletOptions } from './wallet-options' // [!code ++] const queryClient = new QueryClient() function ConnectWallet() { // [!code ++] const { isConnected } = useConnection() // [!code ++] if (isConnected) return // [!code ++] return // [!code ++] } // [!code ++] function App() { return ( // [!code ++] ) } ``` ```tsx [connection.tsx] // {"path":"/vercel/path0/site/react/guides/connect-wallet.md","from":9006,"to":9553} import { useConnection, useDisconnect, useEnsAvatar, useEnsName } from 'wagmi' export function Connection() { const { address } = useConnection() const { disconnect } = useDisconnect() const { data: ensName } = useEnsName({ address }) const { data: ensAvatar } = useEnsAvatar({ name: ensName! }) return (
{ensAvatar && ENS Avatar} {address &&
{ensName ? `${ensName} (${address})` : address}
}
) } ``` ```tsx [wallet-options.tsx] // {"path":"/vercel/path0/site/react/guides/connect-wallet.md","from":9586,"to":10370} import * as React from 'react' import { Connector, useConnect, useConnectors } from 'wagmi' export function WalletOptions() { const { connect } = useConnect() const connectors = useConnectors() return connectors.map((connector) => ( connect({ connector })} /> )) } function WalletOption({ connector, onClick, }: { connector: Connector onClick: () => void }) { const [ready, setReady] = React.useState(false) React.useEffect(() => { ;(async () => { const provider = await connector.getProvider() setReady(!!provider) })() }, [connector]) return ( ) } ``` ```tsx [config.ts] // {"path":"/vercel/path0/site/react/guides/connect-wallet.md","from":10394,"to":10852} import { http, createConfig } from 'wagmi' import { base, mainnet, optimism } from 'wagmi/chains' import { injected, metaMask, safe, walletConnect } from 'wagmi/connectors' const projectId = '' export const config = createConfig({ chains: [mainnet, base], connectors: [ injected(), walletConnect({ projectId }), metaMask(), safe(), ], transports: { [mainnet.id]: http(), [base.id]: http(), }, }) ``` ::: ### Playground Want to see the above steps all wired up together in an end-to-end example? Check out the below StackBlitz playground. --- --- url: /solid/guides/connect-wallet.md --- # Connect Wallet This guide covers how to connect and disconnect wallets using `@wagmi/solid`. ## Overview Connecting a wallet allows your app to interact with the user's Ethereum accounts. Wagmi provides primitives to handle the entire connection flow. ## Connecting Use the `useConnect` primitive to connect a wallet: ```tsx // {"path":"/vercel/path0/site/solid/guides/connect-wallet.md","from":333,"to":691} import { useConnect } from '@wagmi/solid' import { injected } from '@wagmi/solid/connectors' function Connect() { const connect = useConnect() return ( ) } ``` ## Displaying Available Connectors Use the `useConnectors` primitive to get a list of configured connectors: ```tsx // {"path":"/vercel/path0/site/solid/guides/connect-wallet.md","from":814,"to":1291} import { useConnect, useConnectors } from '@wagmi/solid' import { For } from 'solid-js' function Connect() { const connect = useConnect() const connectors = useConnectors() return (
{(connector) => ( )}
) } ``` ## Checking Connection Status Use the `useConnection` primitive to check if a wallet is connected: ```tsx // {"path":"/vercel/path0/site/solid/guides/connect-wallet.md","from":1404,"to":1716} import { useConnection } from '@wagmi/solid' import { Show } from 'solid-js' function ConnectionStatus() { const connection = useConnection() return ( Not connected

} >

Connected to {connection.address}

) } ``` ## Disconnecting Use the `useDisconnect` primitive to disconnect: ```tsx // {"path":"/vercel/path0/site/solid/guides/connect-wallet.md","from":1796,"to":2050} import { useDisconnect } from '@wagmi/solid' function Disconnect() { const disconnect = useDisconnect() return ( ) } ``` ## Complete Example Here's a complete example combining all the pieces: ```tsx // {"path":"/vercel/path0/site/solid/guides/connect-wallet.md","from":2136,"to":3262} import { useConnect, useConnection, useConnectors, useDisconnect } from '@wagmi/solid' import { For, Show } from 'solid-js' function WalletConnection() { const connection = useConnection() const connectors = useConnectors() const connect = useConnect() const disconnect = useDisconnect() return (

Connect your wallet:

{(connector) => ( )} {connect.isError &&

Error: {connect.error?.message}

}
} >

Connected: {connection.address}

Chain ID: {connection.chainId}

) } ``` ## Connection Effects Use `useConnectionEffect` to react to connection state changes: ```tsx // {"path":"/vercel/path0/site/solid/guides/connect-wallet.md","from":3362,"to":3628} import { useConnectionEffect } from '@wagmi/solid' function ConnectionLogger() { useConnectionEffect(() => ({ onConnect(data) { console.log('Connected!', data) }, onDisconnect() { console.log('Disconnected!') }, })) return null } ``` ## Next Steps * [useConnect](/solid/api/primitives/useConnect) - Learn more about the connect primitive * [useDisconnect](/solid/api/primitives/useDisconnect) - Learn more about the disconnect primitive * [useConnection](/solid/api/primitives/useConnection) - Learn more about connection state --- --- url: /vue/guides/connect-wallet.md --- # Connect Wallet The ability for a user to connect their wallet is a core function for any Dapp. It allows users to perform tasks such as: writing to contracts, signing messages, or sending transactions. Wagmi contains everything you need to get started with building a Connect Wallet module. To get started, follow the [build your own](#build-your-own) walkthrough. ## Build Your Own Wagmi provides you with the Composables to get started building your own Connect Wallet module. It takes less than five minutes to get up and running with Browser Wallets, WalletConnect, and Coinbase Wallet. ### 1. Configure Wagmi Before we get started with building the functionality of the Connect Wallet module, we will need to set up the Wagmi configuration. Let's create a `config.ts` file and export a `config` object. ::: code-group ```tsx [config.ts] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":855,"to":1328} import { http, createConfig } from '@wagmi/vue' import { base, mainnet, optimism } from '@wagmi/vue/chains' import { injected, metaMask, safe, walletConnect } from '@wagmi/vue/connectors' const projectId = '' export const config = createConfig({ chains: [mainnet, base], connectors: [ injected(), walletConnect({ projectId }), metaMask(), safe(), ], transports: { [mainnet.id]: http(), [base.id]: http(), }, }) ``` ::: In the above configuration, we want to set up connectors for Injected (browser), WalletConnect (browser + mobile), MetaMask, and Safe wallets. This configuration uses the **Mainnet** and **Base** chains, but you can use whatever you want. ::: warning Make sure to replace the `projectId` with your own WalletConnect Project ID, if you wish to use WalletConnect! [Get your Project ID](https://cloud.walletconnect.com/) ::: ### 2. Inject the WagmiPlugin onto your App Next, we will need to inject our App with plugins so that our application is aware of Wagmi & Vue Query's reactive state and in-memory caching. ::: code-group ```ts [main.ts] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":1988,"to":2360} // 1. Import modules. import { VueQueryPlugin } from '@tanstack/vue-query' import { WagmiPlugin } from '@wagmi/vue' import { createApp } from 'vue' import App from './App.vue' import { config } from './wagmi' createApp(App) // 2. Inject the Wagmi plugin. .use(WagmiPlugin, { config }) // 3. Inject the Vue Query plugin. .use(VueQueryPlugin, {}) .mount('#app') ``` ```vue [App.vue] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":2382,"to":2441} ``` ```ts [config.ts] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":2464,"to":2937} import { http, createConfig } from '@wagmi/vue' import { base, mainnet, optimism } from '@wagmi/vue/chains' import { injected, metaMask, safe, walletConnect } from '@wagmi/vue/connectors' const projectId = '' export const config = createConfig({ chains: [mainnet, base], connectors: [ injected(), walletConnect({ projectId }), metaMask(), safe(), ], transports: { [mainnet.id]: http(), [base.id]: http(), }, }) ``` ::: ### 3. Display Wallet Options After that, we will create a `Connect` component that will display our connectors. This will allow users to select a wallet and connect. Below, we are rendering a list of `connectors` retrieved from `useConnect`. When the user clicks on a connector, the `connect` function will connect the users' wallet. ::: code-group ```vue [Connect.vue] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":3322,"to":3678} ``` ```vue [App.vue] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":3700,"to":3759} ``` ```ts [main.ts] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":3780,"to":4152} // 1. Import modules. import { VueQueryPlugin } from '@tanstack/vue-query' import { WagmiPlugin } from '@wagmi/vue' import { createApp } from 'vue' import App from './App.vue' import { config } from './wagmi' createApp(App) // 2. Inject the Wagmi plugin. .use(WagmiPlugin, { config }) // 3. Inject the Vue Query plugin. .use(VueQueryPlugin, {}) .mount('#app') ``` ```ts [config.ts] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":4175,"to":4648} import { http, createConfig } from '@wagmi/vue' import { base, mainnet, optimism } from '@wagmi/vue/chains' import { injected, metaMask, safe, walletConnect } from '@wagmi/vue/connectors' const projectId = '' export const config = createConfig({ chains: [mainnet, base], connectors: [ injected(), walletConnect({ projectId }), metaMask(), safe(), ], transports: { [mainnet.id]: http(), [base.id]: http(), }, }) ``` ::: ### 4. Display Connection Lastly, if an connection is made, we want to show some basic information, like the connected address and ENS name and avatar. Below, we are using hooks like `useConnection`, `useEnsAvatar` and `useEnsName` to extract this information. We are also utilizing `useDisconnect` to show a "Disconnect" button so a user can disconnect their wallet. ::: code-group ```vue [Connection.vue] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":5070,"to":5421} ``` ```vue [Connect.vue] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":5447,"to":5803} ``` ```vue [App.vue] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":5825,"to":5884} ``` ```ts [main.ts] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":5905,"to":6277} // 1. Import modules. import { VueQueryPlugin } from '@tanstack/vue-query' import { WagmiPlugin } from '@wagmi/vue' import { createApp } from 'vue' import App from './App.vue' import { config } from './wagmi' createApp(App) // 2. Inject the Wagmi plugin. .use(WagmiPlugin, { config }) // 3. Inject the Vue Query plugin. .use(VueQueryPlugin, {}) .mount('#app') ``` ```ts [config.ts] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":6300,"to":6773} import { http, createConfig } from '@wagmi/vue' import { base, mainnet, optimism } from '@wagmi/vue/chains' import { injected, metaMask, safe, walletConnect } from '@wagmi/vue/connectors' const projectId = '' export const config = createConfig({ chains: [mainnet, base], connectors: [ injected(), walletConnect({ projectId }), metaMask(), safe(), ], transports: { [mainnet.id]: http(), [base.id]: http(), }, }) ``` ::: ### 5. Wire it up! Finally, we can wire up our Connect and Connection components to our application's entrypoint. ::: code-group ```vue [App.vue] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":6932,"to":7267} ``` ```vue [Connection.vue] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":7296,"to":7647} ``` ```vue [Connect.vue] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":7673,"to":8029} ``` ```ts [main.ts] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":8050,"to":8422} // 1. Import modules. import { VueQueryPlugin } from '@tanstack/vue-query' import { WagmiPlugin } from '@wagmi/vue' import { createApp } from 'vue' import App from './App.vue' import { config } from './wagmi' createApp(App) // 2. Inject the Wagmi plugin. .use(WagmiPlugin, { config }) // 3. Inject the Vue Query plugin. .use(VueQueryPlugin, {}) .mount('#app') ``` ```ts [config.ts] // {"path":"/vercel/path0/site/vue/guides/connect-wallet.md","from":8445,"to":8918} import { http, createConfig } from '@wagmi/vue' import { base, mainnet, optimism } from '@wagmi/vue/chains' import { injected, metaMask, safe, walletConnect } from '@wagmi/vue/connectors' const projectId = '' export const config = createConfig({ chains: [mainnet, base], connectors: [ injected(), walletConnect({ projectId }), metaMask(), safe(), ], transports: { [mainnet.id]: http(), [base.id]: http(), }, }) ``` ::: ### Playground Want to see the above steps all wired up together in an end-to-end example? Check out the below StackBlitz playground. --- --- url: /core/api/connectors.md --- # Connectors Connectors for popular wallet providers and protocols. ## Import Available via the `'@wagmi/connectors'` package. ```ts // {"path":"/vercel/path0/site/core/api/connectors.md","from":410,"to":455} import { injected } from '@wagmi/connectors' ``` ## Built-In Connectors ::: tip Some connectors require third-party packages. See the "Install" section on each connector's page for more info on license, version, and more. ::: --- --- url: /react/api/connectors.md --- # Connectors Connectors for popular wallet providers and protocols. ## Import Import via the `'wagmi/connectors'` entrypoint. ```ts // {"path":"/vercel/path0/site/react/api/connectors.md","from":410,"to":454} import { injected } from 'wagmi/connectors' ``` ## Available Connectors ::: tip Some connectors require third-party packages. See the "Install" section on each connector's page for more info on license, version, and more. ::: --- --- url: /solid/api/connectors.md --- # Connectors Connectors for popular wallet providers and protocols. ## Import Import via the `'@wagmi/solid/connectors'` entrypoint. ```ts // {"path":"/vercel/path0/site/solid/api/connectors.md","from":417,"to":468} import { injected } from '@wagmi/solid/connectors' ``` ## Available Connectors ::: tip Some connectors require third-party packages. See the "Install" section on each connector's page for more info on license, version, and more. ::: --- --- url: /tempo/connectors.md --- # Connectors Supported Tempo connectors are thin Wagmi wrappers around the root `accounts` package. * [**`tempoWallet`**](/tempo/connectors/tempoWallet) Connector for the Tempo Wallet dialog * [**`webAuthn`**](/tempo/connectors/webAuthn) Connector for a WebAuthn EOA * [**`dangerous_secp256k1`**](/tempo/connectors/dangerous_secp256k1) Connector for a secp256k1 (private key) EOA --- --- url: /vue/api/connectors.md --- # Connectors Connectors for popular wallet providers and protocols. ## Import Import via the `'@wagmi/vue/connectors'` entrypoint. ```ts // {"path":"/vercel/path0/site/vue/api/connectors.md","from":413,"to":462} import { injected } from '@wagmi/vue/connectors' ``` ## Available Connectors ::: tip Some connectors require third-party packages. See the "Install" section on each connector's page for more info on license, version, and more. ::: --- --- url: /dev/contributing.md --- # Contributing Thanks for your interest in contributing to Wagmi! Please take a moment to review this document **before submitting a pull request.** ## Overview This guide is intended to help you get started with contributing. By following these steps, you will understand the development process and workflow. If you want to contribute, but aren't sure where to start, you can create a [new discussion](https://github.com/wevm/wagmi/discussions/new/choose). :::warning **Please ask first before starting work on any significant new features. This includes things like adding new hooks, actions, connectors, etc.** It's never a fun experience to have your pull request declined after investing time and effort into a new feature. To avoid this from happening, we request that contributors first create a [feature request](https://github.com/wevm/wagmi/discussions/new?category=ideas) to discuss any API changes or significant new ideas. ::: ## 1. Cloning the repository To start contributing to the project, clone it to your local machine using git: ```bash // {"path":"/vercel/path0/site/dev/contributing.md","from":1247,"to":1291} git clone https://github.com/wevm/wagmi.git ``` Or the [GitHub CLI](https://cli.github.com): ```bash // {"path":"/vercel/path0/site/dev/contributing.md","from":1350,"to":1375} gh repo clone wevm/wagmi ``` ## 2. Installing Node.js and pnpm Wagmi uses Node.js with [pnpm workspaces](https://pnpm.io/workspaces) to manage multiple projects. You can run the following command in your terminal to check your local Node.js version. ```bash // {"path":"/vercel/path0/site/dev/contributing.md","from":1611,"to":1619} node -v ``` If **`node@{{nodeVersion}}`** is not installed, you can install via [fnm](https://github.com/Schniz/fnm) or from the [official website](https://nodejs.org). Once Node.js is installed, run the following to install [Corepack](https://nodejs.org/api/corepack.html). Corepack automatically installs and manages **`{{packageManager}}`**. ```bash // {"path":"/vercel/path0/site/dev/contributing.md","from":1967,"to":1983} corepack enable ``` ## 3. Installing dependencies Once in the project's root directory, run the following command to install pnpm (via Corepack) and the project's dependencies: ```bash // {"path":"/vercel/path0/site/dev/contributing.md","from":2155,"to":2168} pnpm install ``` After the install completes, pnpm links packages across the project for development and [git hooks](https://github.com/toplenboren/simple-git-hooks) are set up. ## 4. Adding the env variables The [dev playgrounds](#_5-running-the-dev-playgrounds) and [test suite](#_6-running-the-test-suite) require environment variables to be set. Copy over the following environment variables to `.env`, and fill them out. ```bash // {"path":"/vercel/path0/site/dev/contributing.md","from":2593,"to":2912} VITE_MAINNET_FORK_URL=https://eth.merkle.io VITE_OPTIMISM_FORK_URL=https://mainnet.optimism.io NEXT_PUBLIC_WC_PROJECT_ID=3fbb6bba6f1de962d911bb5b5c9dba88 NUXT_PUBLIC_WC_PROJECT_ID=3fbb6bba6f1de962d911bb5b5c9dba88 VITE_WC_PROJECT_ID=3fbb6bba6f1de962d911bb5b5c9dba88 NEXT_TELEMETRY_DISABLED=1 NUXT_TELEMETRY_DISABLED=1 ``` You might want to change `*_FORK_URL` to a paid RPC provider for better performance. ## 5. Running the dev playgrounds To start the local development playgrounds, run one of the following commands. These commands run playground apps, located at `./playgrounds`, that are set up for trying out code while making changes. ```bash // {"path":"/vercel/path0/site/dev/contributing.md","from":3248,"to":3659} pnpm dev # `wagmi` playground pnpm dev:core # `@wagmi/core` playground pnpm dev:create-wagmi # `create-wagmi` cli tool pnpm dev:cli # `@wagmi/cli` tool pnpm dev:next # `wagmi` playground with Next.js pnpm dev:nuxt # `@wagmi/vue` playground with Nuxt.js pnpm dev:react # `wagmi` playground (same as `pnpm dev`) pnpm dev:vue # `@wagmi/vue` playground ``` Once a playground dev server is running, you can make changes to any of the package source files (e.g. `packages/react`) and it will automatically update the playground. ## 6. Running the test suite Wagmi uses [Vitest](https://vitest.dev) to run tests and [Prool](https://github.com/wevm/prool) to execute tests against locally running chain forks. First, make sure you have Docker ([OrbStack](https://orbstack.dev) works great!) and install [Anvil](https://github.com/foundry-rs/foundry/tree/master/crates/anvil) via [Foundryup](https://book.getfoundry.sh/getting-started/installation). ```bash // {"path":"/vercel/path0/site/dev/contributing.md","from":4263,"to":4317} curl -L https://foundry.paradigm.xyz | bash foundryup ``` You'll also need to install [Playwright](https://playwright.dev/) browser binaries: ```bash // {"path":"/vercel/path0/site/dev/contributing.md","from":4415,"to":4444} pnpm exec playwright install ``` Next, make sure you have set up your [env variables](#_4-adding-the-env-variables). Now you are ready to run the tests! You have the following options for running tests: * `pnpm test [package?]` — runs tests in watch mode * `pnpm test:cov` — runs tests and reports coverage When adding new features or fixing bugs, it's important to add test cases to cover the new or updated behavior. If snapshot tests fail, you can run the `test:update` command to update the snapshots. ## 7. Writing documentation Documentation is crucial to helping developers of all experience levels use Wagmi. Wagmi uses [VitePress](https://vitepress.dev) for the documentation site (located at `./site`). To start the site in dev mode, run: ```bash // {"path":"/vercel/path0/site/dev/contributing.md","from":5178,"to":5192} pnpm docs:dev ``` Try to keep documentation brief and use plain language so folks of all experience levels can understand. If you think something is unclear or could be explained better, you are welcome to open a pull request. ## 8. Submitting a pull request When you're ready to submit a pull request, you can follow these naming conventions: * Pull request titles use the [Imperative Mood](https://en.wikipedia.org/wiki/Imperative_mood) (e.g., `Add something`, `Fix something`). * [Changesets](#versioning) use past tense verbs (e.g., `Added something`, `Fixed something`). When you submit a pull request, GitHub will automatically lint, build, and test your changes. If you see an ❌, it's most likely a bug in your code. Please, inspect the logs through the GitHub UI to find the cause. **Please make sure that "Allow edits from maintainers" is enabled so the core team can make updates to your pull request if necessary.** ## 9. Versioning When adding new features or fixing bugs, we'll need to bump the package versions. We use [Changesets](https://github.com/changesets/changesets) to do this. ::: tip Only changes to the codebase that affect the public API or existing behavior (e.g. bugs) need changesets. ::: Each changeset defines which packages should be published and whether the change should be a major/minor/patch release, as well as providing release notes that will be added to the changelog upon release. To create a new changeset, run `pnpm changeset`. This will run the Changesets CLI, prompting you for details about the change. You’ll be able to edit the file after it’s created — don’t worry about getting everything perfect up front. Even though you can technically use any markdown formatting you like, headings should be avoided since each changeset will ultimately be nested within a bullet list. Instead, bold text should be used as section headings. If your PR is making changes to an area that already has a changeset (e.g. there’s an existing changeset covering theme API changes but you’re making further changes to the same API), you should update the existing changeset in your PR rather than creating a new one. ### Releasing to npm The first time a PR with a changeset is merged after a release, a new PR will automatically be created called `chore: version packages`. Any subsequent PRs with changesets will automatically update this existing version packages PR. Merging this PR triggers the release process by publishing to npm and cleaning up the changeset files. ### Creating a snapshot release If a PR has changesets, you can create a [snapshot release](https://github.com/changesets/changesets/blob/main/docs/snapshot-releases.md) by [manually dispatching](https://github.com/wevm/wagmi/actions/workflows/canary.yml) the Canary workflow. This publishes a tagged version to npm with the PR branch name and timestamp. ## 10. Updating dependencies Use [Taze](https://github.com/antfu/taze) by running: ```bash // {"path":"/vercel/path0/site/dev/contributing.md","from":8148,"to":8316} pnpm deps # prints outdated deps pnpm deps patch # print outdated deps with new patch versions pnpm deps -w # updates deps (best done with clean working tree) ``` Update GitHub Actions via [Actions Up!](https://github.com/azat-io/actions-up) by running: ```bash // {"path":"/vercel/path0/site/dev/contributing.md","from":8421,"to":8434} pnpm deps:ci ``` [Socket](https://socket.dev) checks pull requests for vulnerabilities when new dependencies and versions are added, but you should also be vigilant! When updating dependencies, you should check release notes and source code as well as lock versions when possible. --- --- url: /core/api/utilities/cookieToInitialState.md --- # cookieToInitialState Helper to convert a cookie string into [initial state](/react/api/WagmiProvider#initialstate). ## Import ```ts-vue import { cookieToInitialState } from '{{packageName}}' ``` ## Usage ::: code-group ```ts-vue [server.ts] import { cookieToInitialState } from '{{packageName}}' import config from './config' function handler(req: Request) { const initialState = cookieToInitialState(config, req.headers.cookie) // ... } ``` ```ts-vue [config.ts] import { createConfig, http, cookieStorage, createStorage } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], ssr: true, storage: createStorage({ storage: cookieStorage, }), transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: ## Parameters ### config `Config` Wagmi Config ### cookie `string | null | undefined` The cookie string. ## Return Type `State` Initial state. --- --- url: /react/api/utilities/cookieToInitialState.md --- # cookieToInitialState Helper to convert a cookie string into [initial state](/react/api/WagmiProvider#initialstate). ## Import ```ts-vue import { cookieToInitialState } from '{{packageName}}' ``` ## Usage ::: code-group ```ts-vue [server.ts] import { cookieToInitialState } from '{{packageName}}' import config from './config' function handler(req: Request) { const initialState = cookieToInitialState(config, req.headers.cookie) // ... } ``` ```ts-vue [config.ts] import { createConfig, http, cookieStorage, createStorage } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], ssr: true, storage: createStorage({ storage: cookieStorage, }), transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: ## Parameters ### config `Config` Wagmi Config ### cookie `string | null | undefined` The cookie string. ## Return Type `State` Initial state. --- --- url: /shared/utilities/cookieToInitialState.md --- # cookieToInitialState Helper to convert a cookie string into [initial state](/react/api/WagmiProvider#initialstate). ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/utilities/cookieToInitialState.md","from":204,"to":259} import { cookieToInitialState } from '{{packageName}}' ``` ## Usage ::: code-group ```ts-vue [server.ts] // {"path":"/vercel/path0/site/shared/utilities/cookieToInitialState.md","from":312,"to":514} import { cookieToInitialState } from '{{packageName}}' import config from './config' function handler(req: Request) { const initialState = cookieToInitialState(config, req.headers.cookie) // ... } ``` ```ts-vue [config.ts] // {"path":"/vercel/path0/site/shared/utilities/cookieToInitialState.md","from":541,"to":913} import { createConfig, http, cookieStorage, createStorage } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], ssr: true, storage: createStorage({ storage: cookieStorage, }), transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: ## Parameters ### config `Config` Wagmi Config ### cookie `string | null | undefined` The cookie string. ## Return Type `State` Initial state. --- --- url: /cli/create-wagmi.md --- # create-wagmi ## Overview create-wagmi is a command line interface (CLI) for scaffolding new Wagmi projects. ## Usage ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/cli/create-wagmi.md","from":153,"to":171} pnpm create wagmi ``` ```bash [npm] // {"path":"/vercel/path0/site/cli/create-wagmi.md","from":189,"to":213} npm create wagmi@latest ``` ```bash [yarn] // {"path":"/vercel/path0/site/cli/create-wagmi.md","from":232,"to":250} yarn create wagmi ``` ```bash [bun] // {"path":"/vercel/path0/site/cli/create-wagmi.md","from":268,"to":285} bun create wagmi ``` ::: ## Options ### `-t`, `--template` You can specify a custom [template](#templates) by passing the `--template`/`-t` flag: ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/cli/create-wagmi.md","from":448,"to":482} pnpm create wagmi --template next ``` ```bash [npm] // {"path":"/vercel/path0/site/cli/create-wagmi.md","from":500,"to":540} npm create wagmi@latest --template next ``` ```bash [yarn] // {"path":"/vercel/path0/site/cli/create-wagmi.md","from":559,"to":593} yarn create wagmi --template next ``` ```bash [bun] // {"path":"/vercel/path0/site/cli/create-wagmi.md","from":611,"to":644} bun create wagmi --template next ``` ::: ### `--bun`/`--npm`/`--pnpm`/`--yarn` Use a specific package manager to install dependencies. By default, `create-wagmi` will use the package manager you used to run the command. ### `-h`, `--help` Prints the help message. ### `-v`, `--version` Prints the CLI version. ## Templates `create-wagmi` currently comes with the following templates: * `next`: A Next.js Wagmi project. * `nuxt`: A Nuxt Wagmi project. * `vite-react`: A Vite (React) Wagmi project. * `vite-vanilla`: A Vite Wagmi Core project. * `vite-vue`: A Vite (Vue) Wagmi project. If you do not specify the template on the command line, you will be prompted to select a framework and variant. * **React** : A React project. * **Vite** : A React + Vite Wagmi project (`vite-react`). * **Next** : A React + Next Wagmi project (`next`). * **Vue**: A Vue project. * **Vite**: A Vue + Vite Wagmi project (`vite-vue`). * **Nuxt**: A Vue + Nuxt Wagmi project (`nuxt`). * **Vanilla**: A Vite Wagmi project without React (`vite-vanilla`). --- --- url: /core/api/createConfig.md --- # createConfig Creates new [`Config`](#config) object. ## Import ```ts-vue import { createConfig } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: tip Integrating a Viem Client Instead of using [`transports`](#transports), it's possible to provide a function that returns a Viem [`Client`](https://viem.sh/docs/clients/custom) via the [`client`](#client) property for more fine-grained control over Wagmi's internal `Client` creation. ```ts-vue {3,7-9} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { createClient } from 'viem' const config = createConfig({ chains: [mainnet, sepolia], client({ chain }) { return createClient({ chain, transport: http() }) }, }) ``` ::: ## Parameters ```ts-vue import { type CreateConfigParameters } from '{{packageName}}' ``` ### chains `readonly [Chain, ...Chain[]]` * Chains used by the `Config`. * See Chains for more details about built-in chains and the `Chain` type. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### connectors `CreateConnectorFn[] | undefined` Connectors used by the `Config`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { injected } from '{{connectorsPackageName}}' // [!code focus] const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### multiInjectedProviderDiscovery `boolean | undefined` * Enables discovery of injected providers via [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) using the [`mipd`](https://github.com/wevm/mipd) library and converting to injected connectors. * Defaults to `true`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], multiInjectedProviderDiscovery: false, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### ssr `boolean | undefined` Flag to indicate if the config is being used in a server-side rendering environment. Defaults to `false`. ```ts-vue import { createConfig, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], ssr: true, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### storage `Storage | null | undefined` * `Storage` used by the config. Persists `Config`'s [`State`](#state-1) between sessions. * Defaults to `createStorage({ storage: typeof window !== 'undefined' && window.localStorage ? window.localStorage : noopStorage })`. ```ts-vue import { createConfig, createStorage, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], storage: createStorage({ storage: window.localStorage }), // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### syncConnectedChain `boolean | undefined` * Keep the [`State['chainId']`](#chainid) in sync with the current connection. * Defaults to `true`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], syncConnectedChain: false, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` *** ### batch `{ multicall?: boolean | { batchSize?: number | undefined; wait?: number | undefined } | undefined } | { [_ in chains[number]["id"]]?: { multicall?: boolean | { batchSize?: number | undefined; wait?: number | undefined } | undefined } | undefined } | undefined` * Batch settings. See [Viem docs](https://viem.sh/docs/clients/custom#batch-optional) for more info. * Defaults to `{ multicall: true }`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], batch: { multicall: true }, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### cacheTime `number | { [_ in chains[number]['id']]?: number | undefined } | undefined` * Frequency in milliseconds for polling enabled features. See [Viem docs](https://viem.sh/docs/clients/public#cachetime-optional) for more info. * Defaults to [`pollingInterval`](#pollinginterval) or `4_000`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], cacheTime: 4_000, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### pollingInterval `number | { [_ in chains[number]['id']]?: number | undefined } | undefined` * Frequency in milliseconds for polling enabled features. See [Viem docs](https://viem.sh/docs/clients/custom#pollinginterval-optional) for more info. * Defaults to `4_000`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], pollingInterval: 4_000, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### transports `Record` Mapping of [chain IDs](#chains) to `Transport`s. This mapping is used internally when creating chain-aware Viem [`Client`](https://viem.sh/docs/clients/custom) objects. See the Transport docs for more info. ```ts-vue import { createConfig, fallback, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { // [!code focus] [mainnet.id]: fallback([ // [!code focus] http('https://...'), // [!code focus] http('https://...'), // [!code focus] ]), // [!code focus] [sepolia.id]: http('https://...'), // [!code focus] }, // [!code focus] }) ``` *** ### client `(parameters: { chain: chains[number] }) => Client` Function for creating new Viem [`Client`](https://viem.sh/docs/clients/custom) to be used internally. Exposes more control over the internal `Client` creation logic versus using the [`transports`](#transports) property. ```ts-vue import { createClient, http } from 'viem' // [!code focus] import { createConfig } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], client({ chain }) { // [!code focus] return createClient({ chain, transport: http('https://...') }) // [!code focus] }, // [!code focus] }) ``` ::: warning When using this option, you likely want to pass `parameters.chain` straight through to [`createClient`](https://viem.sh/docs/clients/custom#createclient) to ensure the Viem `Client` is in sync with any active connections. ::: ## Return Type ```ts-vue import { type Config } from '{{packageName}}' ``` ## Config Object responsible for managing Wagmi state and internals. ```ts-vue import { type Config } from '{{packageName}}' ``` ### chains `readonly [Chain, ...Chain[]]` [`chains`](#chains) passed to `createConfig`. ### connectors `readonly Connector[]` Connectors set up from passing [`connectors`](#connectors) and [`multiInjectedProviderDiscovery`](#multiinjectedproviderdiscovery) to `createConfig`. ### state `State` The `Config` object's internal state. See [`State`](#state-1) for more info. ### storage `Storage | null` [`storage`](#storage) passed to `createConfig`. ### getClient `(parameters?: { chainId?: chainId | chains[number]['id'] | undefined }): Client>` Creates new Viem [`Client`](https://viem.sh/docs/clients/custom) object. ::: code-group ```ts-vue [index.ts] import { config } from './config' const client = config.getClient({ chainId: 1 }) ``` ```ts-vue [config.ts] import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ### setState `(value: State | ((state: State) => State)) => void` Updates the `Config` object's internal state. See [`State`](#state-1) for more info. ::: code-group ```ts-vue [index.ts] import { mainnet } from '{{packageName}}/chains' import { config } from './config' config.setState((x) => ({ ...x, chainId: x.current ? x.chainId : mainnet.id, })) ``` ```ts-vue [config.ts] import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ::: warning Exercise caution when using this method. It is intended for internal and advanced use-cases only. Manually setting state can cause unexpected behavior. ::: ### subscribe `(selector: (state: State) => state, listener: (selectedState: state, previousSelectedState: state) => void, options?: { emitImmediately?: boolean | undefined; equalityFn?: ((a: state, b: state) => boolean) | undefined } | undefined) => (() => void)` Listens for state changes matching the `selector` function. Returns a function that can be called to unsubscribe the listener. ::: code-group ```ts-vue [index.ts] import { config } from './config' const unsubscribe = config.subscribe( (state) => state.chainId, (chainId) => console.log(`Chain ID changed to ${chainId}`), ) unsubscribe() ``` ```ts-vue [config.ts] import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ## State ```ts-vue import { type State } from '{{packageName}}' ``` ### chainId `chains[number]['id']` Current chain ID. When `syncConnectedChain` is `true`, `chainId` is kept in sync with the current connection. Defaults to first chain in [`chains`](#chains). ### connections `Map` Mapping of unique connector identifier to [`Connection`](#connection) object. ### current `string | undefined` Unique identifier of the current connection. ### status `'connected' | 'connecting' | 'disconnected' | 'reconnecting'` Current connection status. * `'connecting'` attempting to establish connection. * `'reconnecting'` attempting to re-establish connection to one or more connectors. * `'connected'` at least one connector is connected. * `'disconnected'` no connection to any connector. ## Connection ```ts-vue import { type Connection } from '{{packageName}}' ``` ### accounts `readonly [Address, ...Address[]]` Array of addresses associated with the connection. ### chainId `number` Chain ID associated with the connection. ### connector `Connector` Connector associated with the connection. --- --- url: /react/api/createConfig.md --- # createConfig Creates new [`Config`](#config) object. ## Import ```ts-vue import { createConfig } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: tip Integrating a Viem Client Instead of using [`transports`](#transports), it's possible to provide a function that returns a Viem [`Client`](https://viem.sh/docs/clients/custom) via the [`client`](#client) property for more fine-grained control over Wagmi's internal `Client` creation. ```ts-vue {3,7-9} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { createClient } from 'viem' const config = createConfig({ chains: [mainnet, sepolia], client({ chain }) { return createClient({ chain, transport: http() }) }, }) ``` ::: ## Parameters ```ts-vue import { type CreateConfigParameters } from '{{packageName}}' ``` ### chains `readonly [Chain, ...Chain[]]` * Chains used by the `Config`. * See Chains for more details about built-in chains and the `Chain` type. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### connectors `CreateConnectorFn[] | undefined` Connectors used by the `Config`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { injected } from '{{connectorsPackageName}}' // [!code focus] const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### multiInjectedProviderDiscovery `boolean | undefined` * Enables discovery of injected providers via [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) using the [`mipd`](https://github.com/wevm/mipd) library and converting to injected connectors. * Defaults to `true`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], multiInjectedProviderDiscovery: false, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### ssr `boolean | undefined` Flag to indicate if the config is being used in a server-side rendering environment. Defaults to `false`. ```ts-vue import { createConfig, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], ssr: true, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### storage `Storage | null | undefined` * `Storage` used by the config. Persists `Config`'s [`State`](#state-1) between sessions. * Defaults to `createStorage({ storage: typeof window !== 'undefined' && window.localStorage ? window.localStorage : noopStorage })`. ```ts-vue import { createConfig, createStorage, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], storage: createStorage({ storage: window.localStorage }), // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### syncConnectedChain `boolean | undefined` * Keep the [`State['chainId']`](#chainid) in sync with the current connection. * Defaults to `true`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], syncConnectedChain: false, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` *** ### batch `{ multicall?: boolean | { batchSize?: number | undefined; wait?: number | undefined } | undefined } | { [_ in chains[number]["id"]]?: { multicall?: boolean | { batchSize?: number | undefined; wait?: number | undefined } | undefined } | undefined } | undefined` * Batch settings. See [Viem docs](https://viem.sh/docs/clients/custom#batch-optional) for more info. * Defaults to `{ multicall: true }`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], batch: { multicall: true }, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### cacheTime `number | { [_ in chains[number]['id']]?: number | undefined } | undefined` * Frequency in milliseconds for polling enabled features. See [Viem docs](https://viem.sh/docs/clients/public#cachetime-optional) for more info. * Defaults to [`pollingInterval`](#pollinginterval) or `4_000`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], cacheTime: 4_000, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### pollingInterval `number | { [_ in chains[number]['id']]?: number | undefined } | undefined` * Frequency in milliseconds for polling enabled features. See [Viem docs](https://viem.sh/docs/clients/custom#pollinginterval-optional) for more info. * Defaults to `4_000`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], pollingInterval: 4_000, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### transports `Record` Mapping of [chain IDs](#chains) to `Transport`s. This mapping is used internally when creating chain-aware Viem [`Client`](https://viem.sh/docs/clients/custom) objects. See the Transport docs for more info. ```ts-vue import { createConfig, fallback, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { // [!code focus] [mainnet.id]: fallback([ // [!code focus] http('https://...'), // [!code focus] http('https://...'), // [!code focus] ]), // [!code focus] [sepolia.id]: http('https://...'), // [!code focus] }, // [!code focus] }) ``` *** ### client `(parameters: { chain: chains[number] }) => Client` Function for creating new Viem [`Client`](https://viem.sh/docs/clients/custom) to be used internally. Exposes more control over the internal `Client` creation logic versus using the [`transports`](#transports) property. ```ts-vue import { createClient, http } from 'viem' // [!code focus] import { createConfig } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], client({ chain }) { // [!code focus] return createClient({ chain, transport: http('https://...') }) // [!code focus] }, // [!code focus] }) ``` ::: warning When using this option, you likely want to pass `parameters.chain` straight through to [`createClient`](https://viem.sh/docs/clients/custom#createclient) to ensure the Viem `Client` is in sync with any active connections. ::: ## Return Type ```ts-vue import { type Config } from '{{packageName}}' ``` ## Config Object responsible for managing Wagmi state and internals. ```ts-vue import { type Config } from '{{packageName}}' ``` ### chains `readonly [Chain, ...Chain[]]` [`chains`](#chains) passed to `createConfig`. ### connectors `readonly Connector[]` Connectors set up from passing [`connectors`](#connectors) and [`multiInjectedProviderDiscovery`](#multiinjectedproviderdiscovery) to `createConfig`. ### state `State` The `Config` object's internal state. See [`State`](#state-1) for more info. ### storage `Storage | null` [`storage`](#storage) passed to `createConfig`. ### getClient `(parameters?: { chainId?: chainId | chains[number]['id'] | undefined }): Client>` Creates new Viem [`Client`](https://viem.sh/docs/clients/custom) object. ::: code-group ```ts-vue [index.ts] import { config } from './config' const client = config.getClient({ chainId: 1 }) ``` ```ts-vue [config.ts] import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ### setState `(value: State | ((state: State) => State)) => void` Updates the `Config` object's internal state. See [`State`](#state-1) for more info. ::: code-group ```ts-vue [index.ts] import { mainnet } from '{{packageName}}/chains' import { config } from './config' config.setState((x) => ({ ...x, chainId: x.current ? x.chainId : mainnet.id, })) ``` ```ts-vue [config.ts] import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ::: warning Exercise caution when using this method. It is intended for internal and advanced use-cases only. Manually setting state can cause unexpected behavior. ::: ### subscribe `(selector: (state: State) => state, listener: (selectedState: state, previousSelectedState: state) => void, options?: { emitImmediately?: boolean | undefined; equalityFn?: ((a: state, b: state) => boolean) | undefined } | undefined) => (() => void)` Listens for state changes matching the `selector` function. Returns a function that can be called to unsubscribe the listener. ::: code-group ```ts-vue [index.ts] import { config } from './config' const unsubscribe = config.subscribe( (state) => state.chainId, (chainId) => console.log(`Chain ID changed to ${chainId}`), ) unsubscribe() ``` ```ts-vue [config.ts] import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ## State ```ts-vue import { type State } from '{{packageName}}' ``` ### chainId `chains[number]['id']` Current chain ID. When `syncConnectedChain` is `true`, `chainId` is kept in sync with the current connection. Defaults to first chain in [`chains`](#chains). ### connections `Map` Mapping of unique connector identifier to [`Connection`](#connection) object. ### current `string | undefined` Unique identifier of the current connection. ### status `'connected' | 'connecting' | 'disconnected' | 'reconnecting'` Current connection status. * `'connecting'` attempting to establish connection. * `'reconnecting'` attempting to re-establish connection to one or more connectors. * `'connected'` at least one connector is connected. * `'disconnected'` no connection to any connector. ## Connection ```ts-vue import { type Connection } from '{{packageName}}' ``` ### accounts `readonly [Address, ...Address[]]` Array of addresses associated with the connection. ### chainId `number` Chain ID associated with the connection. ### connector `Connector` Connector associated with the connection. --- --- url: /shared/createConfig.md --- # createConfig Creates new [`Config`](#config) object. ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":215,"to":262} import { createConfig } from '{{packageName}}' ``` ## Usage ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":287,"to":593} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: tip Integrating a Viem Client Instead of using [`transports`](#transports), it's possible to provide a function that returns a Viem [`Client`](https://viem.sh/docs/clients/custom) via the [`client`](#client) property for more fine-grained control over Wagmi's internal `Client` creation. ```ts-vue {3,7-9} // {"path":"/vercel/path0/site/shared/createConfig.md","from":910,"to":1202} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { createClient } from 'viem' const config = createConfig({ chains: [mainnet, sepolia], client({ chain }) { return createClient({ chain, transport: http() }) }, }) ``` ::: ## Parameters ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":1236,"to":1298} import { type CreateConfigParameters } from '{{packageName}}' ``` ### chains `readonly [Chain, ...Chain[]]` * Chains used by the `Config`. * See Chains for more details about built-in chains and the `Chain` type. ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":1504,"to":1827} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### connectors `CreateConnectorFn[] | undefined` Connectors used by the `Config`. ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":1972,"to":2393} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { injected } from '{{connectorsPackageName}}' // [!code focus] const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### multiInjectedProviderDiscovery `boolean | undefined` * Enables discovery of injected providers via [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) using the [`mipd`](https://github.com/wevm/mipd) library and converting to injected connectors. * Defaults to `true`. ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":2738,"to":3102} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], multiInjectedProviderDiscovery: false, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### ssr `boolean | undefined` Flag to indicate if the config is being used in a server-side rendering environment. Defaults to `false`. ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":3256,"to":3609} import { createConfig, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], ssr: true, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### storage `Storage | null | undefined` * `Storage` used by the config. Persists `Config`'s [`State`](#state-1) between sessions. * Defaults to `createStorage({ storage: typeof window !== 'undefined' && window.localStorage ? window.localStorage : noopStorage })`. ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":3948,"to":4363} import { createConfig, createStorage, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], storage: createStorage({ storage: window.localStorage }), // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### syncConnectedChain `boolean | undefined` * Keep the [`State['chainId']`](#chainid) in sync with the current connection. * Defaults to `true`. ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":4527,"to":4879} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], syncConnectedChain: false, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` *** ### batch `{ multicall?: boolean | { batchSize?: number | undefined; wait?: number | undefined } | undefined } | { [_ in chains[number]["id"]]?: { multicall?: boolean | { batchSize?: number | undefined; wait?: number | undefined } | undefined } | undefined } | undefined` * Batch settings. See [Viem docs](https://viem.sh/docs/clients/custom#batch-optional) for more info. * Defaults to `{ multicall: true }`. ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":5312,"to":5665} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], batch: { multicall: true }, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### cacheTime `number | { [_ in chains[number]['id']]?: number | undefined } | undefined` * Frequency in milliseconds for polling enabled features. See [Viem docs](https://viem.sh/docs/clients/public#cachetime-optional) for more info. * Defaults to [`pollingInterval`](#pollinginterval) or `4_000`. ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":5982,"to":6325} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], cacheTime: 4_000, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### pollingInterval `number | { [_ in chains[number]['id']]?: number | undefined } | undefined` * Frequency in milliseconds for polling enabled features. See [Viem docs](https://viem.sh/docs/clients/custom#pollinginterval-optional) for more info. * Defaults to `4_000`. ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":6613,"to":6962} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], pollingInterval: 4_000, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### transports `Record` Mapping of [chain IDs](#chains) to `Transport`s. This mapping is used internally when creating chain-aware Viem [`Client`](https://viem.sh/docs/clients/custom) objects. See the Transport docs for more info. ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":7334,"to":7806} import { createConfig, fallback, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { // [!code focus] [mainnet.id]: fallback([ // [!code focus] http('https://...'), // [!code focus] http('https://...'), // [!code focus] ]), // [!code focus] [sepolia.id]: http('https://...'), // [!code focus] }, // [!code focus] }) ``` *** ### client `(parameters: { chain: chains[number] }) => Client` Function for creating new Viem [`Client`](https://viem.sh/docs/clients/custom) to be used internally. Exposes more control over the internal `Client` creation logic versus using the [`transports`](#transports) property. ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":8139,"to":8512} import { createClient, http } from 'viem' // [!code focus] import { createConfig } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], client({ chain }) { // [!code focus] return createClient({ chain, transport: http('https://...') }) // [!code focus] }, // [!code focus] }) ``` ::: warning When using this option, you likely want to pass `parameters.chain` straight through to [`createClient`](https://viem.sh/docs/clients/custom#createclient) to ensure the Viem `Client` is in sync with any active connections. ::: ## Return Type ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":8782,"to":8828} import { type Config } from '{{packageName}}' ``` ## Config Object responsible for managing Wagmi state and internals. ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":8914,"to":8960} import { type Config } from '{{packageName}}' ``` ### chains `readonly [Chain, ...Chain[]]` [`chains`](#chains) passed to `createConfig`. ### connectors `readonly Connector[]` Connectors set up from passing [`connectors`](#connectors) and [`multiInjectedProviderDiscovery`](#multiinjectedproviderdiscovery) to `createConfig`. ### state `State` The `Config` object's internal state. See [`State`](#state-1) for more info. ### storage `Storage | null` [`storage`](#storage) passed to `createConfig`. ### getClient `(parameters?: { chainId?: chainId | chains[number]['id'] | undefined }): Client>` Creates new Viem [`Client`](https://viem.sh/docs/clients/custom) object. ::: code-group ```ts-vue [index.ts] // {"path":"/vercel/path0/site/shared/createConfig.md","from":9704,"to":9787} import { config } from './config' const client = config.getClient({ chainId: 1 }) ``` ```ts-vue [config.ts] // {"path":"/vercel/path0/site/shared/createConfig.md","from":9814,"to":10127} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ### setState `(value: State | ((state: State) => State)) => void` Updates the `Config` object's internal state. See [`State`](#state-1) for more info. ::: code-group ```ts-vue [index.ts] // {"path":"/vercel/path0/site/shared/createConfig.md","from":10351,"to":10520} import { mainnet } from '{{packageName}}/chains' import { config } from './config' config.setState((x) => ({ ...x, chainId: x.current ? x.chainId : mainnet.id, })) ``` ```ts-vue [config.ts] // {"path":"/vercel/path0/site/shared/createConfig.md","from":10547,"to":10860} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ::: warning Exercise caution when using this method. It is intended for internal and advanced use-cases only. Manually setting state can cause unexpected behavior. ::: ### subscribe `(selector: (state: State) => state, listener: (selectedState: state, previousSelectedState: state) => void, options?: { emitImmediately?: boolean | undefined; equalityFn?: ((a: state, b: state) => boolean) | undefined } | undefined) => (() => void)` Listens for state changes matching the `selector` function. Returns a function that can be called to unsubscribe the listener. ::: code-group ```ts-vue [index.ts] // {"path":"/vercel/path0/site/shared/createConfig.md","from":11478,"to":11657} import { config } from './config' const unsubscribe = config.subscribe( (state) => state.chainId, (chainId) => console.log(`Chain ID changed to ${chainId}`), ) unsubscribe() ``` ```ts-vue [config.ts] // {"path":"/vercel/path0/site/shared/createConfig.md","from":11684,"to":11997} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ## State ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":12027,"to":12072} import { type State } from '{{packageName}}' ``` ### chainId `chains[number]['id']` Current chain ID. When `syncConnectedChain` is `true`, `chainId` is kept in sync with the current connection. Defaults to first chain in [`chains`](#chains). ### connections `Map` Mapping of unique connector identifier to [`Connection`](#connection) object. ### current `string | undefined` Unique identifier of the current connection. ### status `'connected' | 'connecting' | 'disconnected' | 'reconnecting'` Current connection status. * `'connecting'` attempting to establish connection. * `'reconnecting'` attempting to re-establish connection to one or more connectors. * `'connected'` at least one connector is connected. * `'disconnected'` no connection to any connector. ## Connection ```ts-vue // {"path":"/vercel/path0/site/shared/createConfig.md","from":12848,"to":12898} import { type Connection } from '{{packageName}}' ``` ### accounts `readonly [Address, ...Address[]]` Array of addresses associated with the connection. ### chainId `number` Chain ID associated with the connection. ### connector `Connector` Connector associated with the connection. --- --- url: /solid/api/createConfig.md --- # createConfig Creates new [`Config`](#config) object. ## Import ```ts-vue import { createConfig } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: tip Integrating a Viem Client Instead of using [`transports`](#transports), it's possible to provide a function that returns a Viem [`Client`](https://viem.sh/docs/clients/custom) via the [`client`](#client) property for more fine-grained control over Wagmi's internal `Client` creation. ```ts-vue {3,7-9} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { createClient } from 'viem' const config = createConfig({ chains: [mainnet, sepolia], client({ chain }) { return createClient({ chain, transport: http() }) }, }) ``` ::: ## Parameters ```ts-vue import { type CreateConfigParameters } from '{{packageName}}' ``` ### chains `readonly [Chain, ...Chain[]]` * Chains used by the `Config`. * See Chains for more details about built-in chains and the `Chain` type. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### connectors `CreateConnectorFn[] | undefined` Connectors used by the `Config`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { injected } from '{{connectorsPackageName}}' // [!code focus] const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### multiInjectedProviderDiscovery `boolean | undefined` * Enables discovery of injected providers via [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) using the [`mipd`](https://github.com/wevm/mipd) library and converting to injected connectors. * Defaults to `true`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], multiInjectedProviderDiscovery: false, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### ssr `boolean | undefined` Flag to indicate if the config is being used in a server-side rendering environment. Defaults to `false`. ```ts-vue import { createConfig, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], ssr: true, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### storage `Storage | null | undefined` * `Storage` used by the config. Persists `Config`'s [`State`](#state-1) between sessions. * Defaults to `createStorage({ storage: typeof window !== 'undefined' && window.localStorage ? window.localStorage : noopStorage })`. ```ts-vue import { createConfig, createStorage, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], storage: createStorage({ storage: window.localStorage }), // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### syncConnectedChain `boolean | undefined` * Keep the [`State['chainId']`](#chainid) in sync with the current connection. * Defaults to `true`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], syncConnectedChain: false, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` *** ### batch `{ multicall?: boolean | { batchSize?: number | undefined; wait?: number | undefined } | undefined } | { [_ in chains[number]["id"]]?: { multicall?: boolean | { batchSize?: number | undefined; wait?: number | undefined } | undefined } | undefined } | undefined` * Batch settings. See [Viem docs](https://viem.sh/docs/clients/custom#batch-optional) for more info. * Defaults to `{ multicall: true }`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], batch: { multicall: true }, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### cacheTime `number | { [_ in chains[number]['id']]?: number | undefined } | undefined` * Frequency in milliseconds for polling enabled features. See [Viem docs](https://viem.sh/docs/clients/public#cachetime-optional) for more info. * Defaults to [`pollingInterval`](#pollinginterval) or `4_000`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], cacheTime: 4_000, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### pollingInterval `number | { [_ in chains[number]['id']]?: number | undefined } | undefined` * Frequency in milliseconds for polling enabled features. See [Viem docs](https://viem.sh/docs/clients/custom#pollinginterval-optional) for more info. * Defaults to `4_000`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], pollingInterval: 4_000, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### transports `Record` Mapping of [chain IDs](#chains) to `Transport`s. This mapping is used internally when creating chain-aware Viem [`Client`](https://viem.sh/docs/clients/custom) objects. See the Transport docs for more info. ```ts-vue import { createConfig, fallback, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { // [!code focus] [mainnet.id]: fallback([ // [!code focus] http('https://...'), // [!code focus] http('https://...'), // [!code focus] ]), // [!code focus] [sepolia.id]: http('https://...'), // [!code focus] }, // [!code focus] }) ``` *** ### client `(parameters: { chain: chains[number] }) => Client` Function for creating new Viem [`Client`](https://viem.sh/docs/clients/custom) to be used internally. Exposes more control over the internal `Client` creation logic versus using the [`transports`](#transports) property. ```ts-vue import { createClient, http } from 'viem' // [!code focus] import { createConfig } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], client({ chain }) { // [!code focus] return createClient({ chain, transport: http('https://...') }) // [!code focus] }, // [!code focus] }) ``` ::: warning When using this option, you likely want to pass `parameters.chain` straight through to [`createClient`](https://viem.sh/docs/clients/custom#createclient) to ensure the Viem `Client` is in sync with any active connections. ::: ## Return Type ```ts-vue import { type Config } from '{{packageName}}' ``` ## Config Object responsible for managing Wagmi state and internals. ```ts-vue import { type Config } from '{{packageName}}' ``` ### chains `readonly [Chain, ...Chain[]]` [`chains`](#chains) passed to `createConfig`. ### connectors `readonly Connector[]` Connectors set up from passing [`connectors`](#connectors) and [`multiInjectedProviderDiscovery`](#multiinjectedproviderdiscovery) to `createConfig`. ### state `State` The `Config` object's internal state. See [`State`](#state-1) for more info. ### storage `Storage | null` [`storage`](#storage) passed to `createConfig`. ### getClient `(parameters?: { chainId?: chainId | chains[number]['id'] | undefined }): Client>` Creates new Viem [`Client`](https://viem.sh/docs/clients/custom) object. ::: code-group ```ts-vue [index.ts] import { config } from './config' const client = config.getClient({ chainId: 1 }) ``` ```ts-vue [config.ts] import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ### setState `(value: State | ((state: State) => State)) => void` Updates the `Config` object's internal state. See [`State`](#state-1) for more info. ::: code-group ```ts-vue [index.ts] import { mainnet } from '{{packageName}}/chains' import { config } from './config' config.setState((x) => ({ ...x, chainId: x.current ? x.chainId : mainnet.id, })) ``` ```ts-vue [config.ts] import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ::: warning Exercise caution when using this method. It is intended for internal and advanced use-cases only. Manually setting state can cause unexpected behavior. ::: ### subscribe `(selector: (state: State) => state, listener: (selectedState: state, previousSelectedState: state) => void, options?: { emitImmediately?: boolean | undefined; equalityFn?: ((a: state, b: state) => boolean) | undefined } | undefined) => (() => void)` Listens for state changes matching the `selector` function. Returns a function that can be called to unsubscribe the listener. ::: code-group ```ts-vue [index.ts] import { config } from './config' const unsubscribe = config.subscribe( (state) => state.chainId, (chainId) => console.log(`Chain ID changed to ${chainId}`), ) unsubscribe() ``` ```ts-vue [config.ts] import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ## State ```ts-vue import { type State } from '{{packageName}}' ``` ### chainId `chains[number]['id']` Current chain ID. When `syncConnectedChain` is `true`, `chainId` is kept in sync with the current connection. Defaults to first chain in [`chains`](#chains). ### connections `Map` Mapping of unique connector identifier to [`Connection`](#connection) object. ### current `string | undefined` Unique identifier of the current connection. ### status `'connected' | 'connecting' | 'disconnected' | 'reconnecting'` Current connection status. * `'connecting'` attempting to establish connection. * `'reconnecting'` attempting to re-establish connection to one or more connectors. * `'connected'` at least one connector is connected. * `'disconnected'` no connection to any connector. ## Connection ```ts-vue import { type Connection } from '{{packageName}}' ``` ### accounts `readonly [Address, ...Address[]]` Array of addresses associated with the connection. ### chainId `number` Chain ID associated with the connection. ### connector `Connector` Connector associated with the connection. --- --- url: /vue/api/createConfig.md --- # createConfig Creates new [`Config`](#config) object. ## Import ```ts-vue import { createConfig } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: tip Integrating a Viem Client Instead of using [`transports`](#transports), it's possible to provide a function that returns a Viem [`Client`](https://viem.sh/docs/clients/custom) via the [`client`](#client) property for more fine-grained control over Wagmi's internal `Client` creation. ```ts-vue {3,7-9} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { createClient } from 'viem' const config = createConfig({ chains: [mainnet, sepolia], client({ chain }) { return createClient({ chain, transport: http() }) }, }) ``` ::: ## Parameters ```ts-vue import { type CreateConfigParameters } from '{{packageName}}' ``` ### chains `readonly [Chain, ...Chain[]]` * Chains used by the `Config`. * See Chains for more details about built-in chains and the `Chain` type. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### connectors `CreateConnectorFn[] | undefined` Connectors used by the `Config`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { injected } from '{{connectorsPackageName}}' // [!code focus] const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### multiInjectedProviderDiscovery `boolean | undefined` * Enables discovery of injected providers via [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) using the [`mipd`](https://github.com/wevm/mipd) library and converting to injected connectors. * Defaults to `true`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], multiInjectedProviderDiscovery: false, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### ssr `boolean | undefined` Flag to indicate if the config is being used in a server-side rendering environment. Defaults to `false`. ```ts-vue import { createConfig, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], ssr: true, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### storage `Storage | null | undefined` * `Storage` used by the config. Persists `Config`'s [`State`](#state-1) between sessions. * Defaults to `createStorage({ storage: typeof window !== 'undefined' && window.localStorage ? window.localStorage : noopStorage })`. ```ts-vue import { createConfig, createStorage, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], storage: createStorage({ storage: window.localStorage }), // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### syncConnectedChain `boolean | undefined` * Keep the [`State['chainId']`](#chainid) in sync with the current connection. * Defaults to `true`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], syncConnectedChain: false, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` *** ### batch `{ multicall?: boolean | { batchSize?: number | undefined; wait?: number | undefined } | undefined } | { [_ in chains[number]["id"]]?: { multicall?: boolean | { batchSize?: number | undefined; wait?: number | undefined } | undefined } | undefined } | undefined` * Batch settings. See [Viem docs](https://viem.sh/docs/clients/custom#batch-optional) for more info. * Defaults to `{ multicall: true }`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], batch: { multicall: true }, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### cacheTime `number | { [_ in chains[number]['id']]?: number | undefined } | undefined` * Frequency in milliseconds for polling enabled features. See [Viem docs](https://viem.sh/docs/clients/public#cachetime-optional) for more info. * Defaults to [`pollingInterval`](#pollinginterval) or `4_000`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], cacheTime: 4_000, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### pollingInterval `number | { [_ in chains[number]['id']]?: number | undefined } | undefined` * Frequency in milliseconds for polling enabled features. See [Viem docs](https://viem.sh/docs/clients/custom#pollinginterval-optional) for more info. * Defaults to `4_000`. ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], pollingInterval: 4_000, // [!code focus] transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ### transports `Record` Mapping of [chain IDs](#chains) to `Transport`s. This mapping is used internally when creating chain-aware Viem [`Client`](https://viem.sh/docs/clients/custom) objects. See the Transport docs for more info. ```ts-vue import { createConfig, fallback, http } from '{{packageName}}' // [!code focus] import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { // [!code focus] [mainnet.id]: fallback([ // [!code focus] http('https://...'), // [!code focus] http('https://...'), // [!code focus] ]), // [!code focus] [sepolia.id]: http('https://...'), // [!code focus] }, // [!code focus] }) ``` *** ### client `(parameters: { chain: chains[number] }) => Client` Function for creating new Viem [`Client`](https://viem.sh/docs/clients/custom) to be used internally. Exposes more control over the internal `Client` creation logic versus using the [`transports`](#transports) property. ```ts-vue import { createClient, http } from 'viem' // [!code focus] import { createConfig } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' const config = createConfig({ chains: [mainnet, sepolia], client({ chain }) { // [!code focus] return createClient({ chain, transport: http('https://...') }) // [!code focus] }, // [!code focus] }) ``` ::: warning When using this option, you likely want to pass `parameters.chain` straight through to [`createClient`](https://viem.sh/docs/clients/custom#createclient) to ensure the Viem `Client` is in sync with any active connections. ::: ## Return Type ```ts-vue import { type Config } from '{{packageName}}' ``` ## Config Object responsible for managing Wagmi state and internals. ```ts-vue import { type Config } from '{{packageName}}' ``` ### chains `readonly [Chain, ...Chain[]]` [`chains`](#chains) passed to `createConfig`. ### connectors `readonly Connector[]` Connectors set up from passing [`connectors`](#connectors) and [`multiInjectedProviderDiscovery`](#multiinjectedproviderdiscovery) to `createConfig`. ### state `State` The `Config` object's internal state. See [`State`](#state-1) for more info. ### storage `Storage | null` [`storage`](#storage) passed to `createConfig`. ### getClient `(parameters?: { chainId?: chainId | chains[number]['id'] | undefined }): Client>` Creates new Viem [`Client`](https://viem.sh/docs/clients/custom) object. ::: code-group ```ts-vue [index.ts] import { config } from './config' const client = config.getClient({ chainId: 1 }) ``` ```ts-vue [config.ts] import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ### setState `(value: State | ((state: State) => State)) => void` Updates the `Config` object's internal state. See [`State`](#state-1) for more info. ::: code-group ```ts-vue [index.ts] import { mainnet } from '{{packageName}}/chains' import { config } from './config' config.setState((x) => ({ ...x, chainId: x.current ? x.chainId : mainnet.id, })) ``` ```ts-vue [config.ts] import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ::: warning Exercise caution when using this method. It is intended for internal and advanced use-cases only. Manually setting state can cause unexpected behavior. ::: ### subscribe `(selector: (state: State) => state, listener: (selectedState: state, previousSelectedState: state) => void, options?: { emitImmediately?: boolean | undefined; equalityFn?: ((a: state, b: state) => boolean) | undefined } | undefined) => (() => void)` Listens for state changes matching the `selector` function. Returns a function that can be called to unsubscribe the listener. ::: code-group ```ts-vue [index.ts] import { config } from './config' const unsubscribe = config.subscribe( (state) => state.chainId, (chainId) => console.log(`Chain ID changed to ${chainId}`), ) unsubscribe() ``` ```ts-vue [config.ts] import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http('https://mainnet.example.com'), [sepolia.id]: http('https://sepolia.example.com'), }, }) ``` ::: ## State ```ts-vue import { type State } from '{{packageName}}' ``` ### chainId `chains[number]['id']` Current chain ID. When `syncConnectedChain` is `true`, `chainId` is kept in sync with the current connection. Defaults to first chain in [`chains`](#chains). ### connections `Map` Mapping of unique connector identifier to [`Connection`](#connection) object. ### current `string | undefined` Unique identifier of the current connection. ### status `'connected' | 'connecting' | 'disconnected' | 'reconnecting'` Current connection status. * `'connecting'` attempting to establish connection. * `'reconnecting'` attempting to re-establish connection to one or more connectors. * `'connected'` at least one connector is connected. * `'disconnected'` no connection to any connector. ## Connection ```ts-vue import { type Connection } from '{{packageName}}' ``` ### accounts `readonly [Address, ...Address[]]` Array of addresses associated with the connection. ### chainId `number` Chain ID associated with the connection. ### connector `Connector` Connector associated with the connection. --- --- url: /core/api/createConnector.md --- # createConnector Creates new [`CreateConnectorFn`](#parameters). ## Import ```ts // {"path":"/vercel/path0/site/core/api/createConnector.md","from":85,"to":131} import { createConnector } from '@wagmi/core' ``` ## Usage ```ts // {"path":"/vercel/path0/site/core/api/createConnector.md","from":152,"to":359} import { createConnector } from '@wagmi/core' export type InjectedParameters = {} export function injected(parameters: InjectedParameters = {}) { return createConnector((config) => ({ // ... })) } ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/createConnector.md","from":385,"to":438} import { type CreateConnectorFn } from '@wagmi/core' ``` Read [Creating Connectors](/dev/creating-connectors) for more info on the `CreateConnectorFn` type. --- --- url: /core/api/createStorage.md --- # createStorage Creates new [`Storage`](#storage) object. ## Import ```ts-vue import { createStorage } from '{{packageName}}' ``` ## Usage ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) ``` ## Parameters ```ts-vue import { type CreateStorageParameters } from '{{packageName}}' ``` ### deserialize `((value: string) => T) | undefined` * Function to deserialize data from storage. * Defaults to `deserialize`. ```ts-vue import { createStorage, deserialize } from '{{packageName}}' // [!code focus] const storage = createStorage({ deserialize, // [!code focus] storage: localStorage, }) ``` ::: warning If you use a custom `deserialize` function, make sure it can handle `bigint` and `Map` values. ::: ### key `string | undefined` * Key prefix to use when persisting data. * Defaults to `'wagmi'`. ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ key: 'my-app', // [!code focus] storage: localStorage, }) ``` ### serialize `((value: T) => string) | undefined` * Function to serialize data for storage. * Defaults to `serialize`. ```ts-vue import { createStorage, serialize } from '{{packageName}}' // [!code focus] const storage = createStorage({ serialize, // [!code focus] storage: localStorage, }) ``` ::: warning If you use a custom `serialize` function, make sure it can handle `bigint` and `Map` values. ::: ### storage `{ getItem(key: string): string | null | undefined | Promise; setItem(key: string, value: string): void | Promise; removeItem(key: string): void | Promise; }` * Storage interface to use for persisting data. * Defaults to `localStorage`. * Supports synchronous and asynchronous storage methods. ```ts-vue import { createStorage } from '{{packageName}}' // Using IndexedDB via https://github.com/jakearchibald/idb-keyval // [!code focus] import { del, get, set } from 'idb-keyval' // [!code focus] const storage = createStorage({ storage: { // [!code focus] async getItem(name) { // [!code focus] return get(name)// [!code focus] }, // [!code focus] async setItem(name, value) { // [!code focus] await set(name, value) // [!code focus] }, // [!code focus] async removeItem(name) { // [!code focus] await del(name) // [!code focus] }, // [!code focus] }, // [!code focus] }) ``` ## Return Type ```ts-vue import { type Storage } from '{{packageName}}' ``` ## Storage Object responsible for persisting Wagmi `State` and other data. ```ts-vue import { type Storage } from '{{packageName}}' ``` ### getItem `getItem(key: string, defaultValue?: value | null | undefined): value | null | Promise` ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) const recentConnectorId = storage.getItem('recentConnectorId') // [!code focus] ``` ### setItem `setItem(key: string, value: any): void | Promise` ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) storage.setItem('recentConnectorId', 'foo') // [!code focus] ``` ### removeItem `removeItem(key: string): void | Promise` ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) storage.removeItem('recentConnectorId') // [!code focus] ``` --- --- url: /react/api/createStorage.md --- # createStorage Creates new [`Storage`](#storage) object. ## Import ```ts-vue import { createStorage } from '{{packageName}}' ``` ## Usage ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) ``` ## Parameters ```ts-vue import { type CreateStorageParameters } from '{{packageName}}' ``` ### deserialize `((value: string) => T) | undefined` * Function to deserialize data from storage. * Defaults to `deserialize`. ```ts-vue import { createStorage, deserialize } from '{{packageName}}' // [!code focus] const storage = createStorage({ deserialize, // [!code focus] storage: localStorage, }) ``` ::: warning If you use a custom `deserialize` function, make sure it can handle `bigint` and `Map` values. ::: ### key `string | undefined` * Key prefix to use when persisting data. * Defaults to `'wagmi'`. ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ key: 'my-app', // [!code focus] storage: localStorage, }) ``` ### serialize `((value: T) => string) | undefined` * Function to serialize data for storage. * Defaults to `serialize`. ```ts-vue import { createStorage, serialize } from '{{packageName}}' // [!code focus] const storage = createStorage({ serialize, // [!code focus] storage: localStorage, }) ``` ::: warning If you use a custom `serialize` function, make sure it can handle `bigint` and `Map` values. ::: ### storage `{ getItem(key: string): string | null | undefined | Promise; setItem(key: string, value: string): void | Promise; removeItem(key: string): void | Promise; }` * Storage interface to use for persisting data. * Defaults to `localStorage`. * Supports synchronous and asynchronous storage methods. ```ts-vue import { createStorage } from '{{packageName}}' // Using IndexedDB via https://github.com/jakearchibald/idb-keyval // [!code focus] import { del, get, set } from 'idb-keyval' // [!code focus] const storage = createStorage({ storage: { // [!code focus] async getItem(name) { // [!code focus] return get(name)// [!code focus] }, // [!code focus] async setItem(name, value) { // [!code focus] await set(name, value) // [!code focus] }, // [!code focus] async removeItem(name) { // [!code focus] await del(name) // [!code focus] }, // [!code focus] }, // [!code focus] }) ``` ## Return Type ```ts-vue import { type Storage } from '{{packageName}}' ``` ## Storage Object responsible for persisting Wagmi `State` and other data. ```ts-vue import { type Storage } from '{{packageName}}' ``` ### getItem `getItem(key: string, defaultValue?: value | null | undefined): value | null | Promise` ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) const recentConnectorId = storage.getItem('recentConnectorId') // [!code focus] ``` ### setItem `setItem(key: string, value: any): void | Promise` ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) storage.setItem('recentConnectorId', 'foo') // [!code focus] ``` ### removeItem `removeItem(key: string): void | Promise` ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) storage.removeItem('recentConnectorId') // [!code focus] ``` --- --- url: /shared/createStorage.md --- # createStorage Creates new [`Storage`](#storage) object. ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/createStorage.md","from":169,"to":217} import { createStorage } from '{{packageName}}' ``` ## Usage ```ts-vue // {"path":"/vercel/path0/site/shared/createStorage.md","from":242,"to":348} import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) ``` ## Parameters ```ts-vue // {"path":"/vercel/path0/site/shared/createStorage.md","from":378,"to":441} import { type CreateStorageParameters } from '{{packageName}}' ``` ### deserialize `((value: string) => T) | undefined` * Function to deserialize data from storage. * Defaults to `deserialize`. ```ts-vue // {"path":"/vercel/path0/site/shared/createStorage.md","from":645,"to":816} import { createStorage, deserialize } from '{{packageName}}' // [!code focus] const storage = createStorage({ deserialize, // [!code focus] storage: localStorage, }) ``` ::: warning If you use a custom `deserialize` function, make sure it can handle `bigint` and `Map` values. ::: ### key `string | undefined` * Key prefix to use when persisting data. * Defaults to `'wagmi'`. ```ts-vue // {"path":"/vercel/path0/site/shared/createStorage.md","from":1042,"to":1185} import { createStorage } from '{{packageName}}' const storage = createStorage({ key: 'my-app', // [!code focus] storage: localStorage, }) ``` ### serialize `((value: T) => string) | undefined` * Function to serialize data for storage. * Defaults to `serialize`. ```ts-vue // {"path":"/vercel/path0/site/shared/createStorage.md","from":1380,"to":1547} import { createStorage, serialize } from '{{packageName}}' // [!code focus] const storage = createStorage({ serialize, // [!code focus] storage: localStorage, }) ``` ::: warning If you use a custom `serialize` function, make sure it can handle `bigint` and `Map` values. ::: ### storage `{ getItem(key: string): string | null | undefined | Promise; setItem(key: string, value: string): void | Promise; removeItem(key: string): void | Promise; }` * Storage interface to use for persisting data. * Defaults to `localStorage`. * Supports synchronous and asynchronous storage methods. ```ts-vue // {"path":"/vercel/path0/site/shared/createStorage.md","from":2020,"to":2635} import { createStorage } from '{{packageName}}' // Using IndexedDB via https://github.com/jakearchibald/idb-keyval // [!code focus] import { del, get, set } from 'idb-keyval' // [!code focus] const storage = createStorage({ storage: { // [!code focus] async getItem(name) { // [!code focus] return get(name)// [!code focus] }, // [!code focus] async setItem(name, value) { // [!code focus] await set(name, value) // [!code focus] }, // [!code focus] async removeItem(name) { // [!code focus] await del(name) // [!code focus] }, // [!code focus] }, // [!code focus] }) ``` ## Return Type ```ts-vue // {"path":"/vercel/path0/site/shared/createStorage.md","from":2666,"to":2713} import { type Storage } from '{{packageName}}' ``` ## Storage Object responsible for persisting Wagmi `State` and other data. ```ts-vue // {"path":"/vercel/path0/site/shared/createStorage.md","from":2860,"to":2907} import { type Storage } from '{{packageName}}' ``` ### getItem `getItem(key: string, defaultValue?: value | null | undefined): value | null | Promise` ```ts-vue // {"path":"/vercel/path0/site/shared/createStorage.md","from":3038,"to":3224} import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) const recentConnectorId = storage.getItem('recentConnectorId') // [!code focus] ``` ### setItem `setItem(key: string, value: any): void | Promise` ```ts-vue // {"path":"/vercel/path0/site/shared/createStorage.md","from":3310,"to":3477} import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) storage.setItem('recentConnectorId', 'foo') // [!code focus] ``` ### removeItem `removeItem(key: string): void | Promise` ```ts-vue // {"path":"/vercel/path0/site/shared/createStorage.md","from":3557,"to":3720} import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) storage.removeItem('recentConnectorId') // [!code focus] ``` --- --- url: /solid/api/createStorage.md --- # createStorage Creates new [`Storage`](#storage) object. ## Import ```ts-vue import { createStorage } from '{{packageName}}' ``` ## Usage ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) ``` ## Parameters ```ts-vue import { type CreateStorageParameters } from '{{packageName}}' ``` ### deserialize `((value: string) => T) | undefined` * Function to deserialize data from storage. * Defaults to `deserialize`. ```ts-vue import { createStorage, deserialize } from '{{packageName}}' // [!code focus] const storage = createStorage({ deserialize, // [!code focus] storage: localStorage, }) ``` ::: warning If you use a custom `deserialize` function, make sure it can handle `bigint` and `Map` values. ::: ### key `string | undefined` * Key prefix to use when persisting data. * Defaults to `'wagmi'`. ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ key: 'my-app', // [!code focus] storage: localStorage, }) ``` ### serialize `((value: T) => string) | undefined` * Function to serialize data for storage. * Defaults to `serialize`. ```ts-vue import { createStorage, serialize } from '{{packageName}}' // [!code focus] const storage = createStorage({ serialize, // [!code focus] storage: localStorage, }) ``` ::: warning If you use a custom `serialize` function, make sure it can handle `bigint` and `Map` values. ::: ### storage `{ getItem(key: string): string | null | undefined | Promise; setItem(key: string, value: string): void | Promise; removeItem(key: string): void | Promise; }` * Storage interface to use for persisting data. * Defaults to `localStorage`. * Supports synchronous and asynchronous storage methods. ```ts-vue import { createStorage } from '{{packageName}}' // Using IndexedDB via https://github.com/jakearchibald/idb-keyval // [!code focus] import { del, get, set } from 'idb-keyval' // [!code focus] const storage = createStorage({ storage: { // [!code focus] async getItem(name) { // [!code focus] return get(name)// [!code focus] }, // [!code focus] async setItem(name, value) { // [!code focus] await set(name, value) // [!code focus] }, // [!code focus] async removeItem(name) { // [!code focus] await del(name) // [!code focus] }, // [!code focus] }, // [!code focus] }) ``` ## Return Type ```ts-vue import { type Storage } from '{{packageName}}' ``` ## Storage Object responsible for persisting Wagmi `State` and other data. ```ts-vue import { type Storage } from '{{packageName}}' ``` ### getItem `getItem(key: string, defaultValue?: value | null | undefined): value | null | Promise` ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) const recentConnectorId = storage.getItem('recentConnectorId') // [!code focus] ``` ### setItem `setItem(key: string, value: any): void | Promise` ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) storage.setItem('recentConnectorId', 'foo') // [!code focus] ``` ### removeItem `removeItem(key: string): void | Promise` ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) storage.removeItem('recentConnectorId') // [!code focus] ``` --- --- url: /vue/api/createStorage.md --- # createStorage Creates new [`Storage`](#storage) object. ## Import ```ts-vue import { createStorage } from '{{packageName}}' ``` ## Usage ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) ``` ## Parameters ```ts-vue import { type CreateStorageParameters } from '{{packageName}}' ``` ### deserialize `((value: string) => T) | undefined` * Function to deserialize data from storage. * Defaults to `deserialize`. ```ts-vue import { createStorage, deserialize } from '{{packageName}}' // [!code focus] const storage = createStorage({ deserialize, // [!code focus] storage: localStorage, }) ``` ::: warning If you use a custom `deserialize` function, make sure it can handle `bigint` and `Map` values. ::: ### key `string | undefined` * Key prefix to use when persisting data. * Defaults to `'wagmi'`. ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ key: 'my-app', // [!code focus] storage: localStorage, }) ``` ### serialize `((value: T) => string) | undefined` * Function to serialize data for storage. * Defaults to `serialize`. ```ts-vue import { createStorage, serialize } from '{{packageName}}' // [!code focus] const storage = createStorage({ serialize, // [!code focus] storage: localStorage, }) ``` ::: warning If you use a custom `serialize` function, make sure it can handle `bigint` and `Map` values. ::: ### storage `{ getItem(key: string): string | null | undefined | Promise; setItem(key: string, value: string): void | Promise; removeItem(key: string): void | Promise; }` * Storage interface to use for persisting data. * Defaults to `localStorage`. * Supports synchronous and asynchronous storage methods. ```ts-vue import { createStorage } from '{{packageName}}' // Using IndexedDB via https://github.com/jakearchibald/idb-keyval // [!code focus] import { del, get, set } from 'idb-keyval' // [!code focus] const storage = createStorage({ storage: { // [!code focus] async getItem(name) { // [!code focus] return get(name)// [!code focus] }, // [!code focus] async setItem(name, value) { // [!code focus] await set(name, value) // [!code focus] }, // [!code focus] async removeItem(name) { // [!code focus] await del(name) // [!code focus] }, // [!code focus] }, // [!code focus] }) ``` ## Return Type ```ts-vue import { type Storage } from '{{packageName}}' ``` ## Storage Object responsible for persisting Wagmi `State` and other data. ```ts-vue import { type Storage } from '{{packageName}}' ``` ### getItem `getItem(key: string, defaultValue?: value | null | undefined): value | null | Promise` ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) const recentConnectorId = storage.getItem('recentConnectorId') // [!code focus] ``` ### setItem `setItem(key: string, value: any): void | Promise` ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) storage.setItem('recentConnectorId', 'foo') // [!code focus] ``` ### removeItem `removeItem(key: string): void | Promise` ```ts-vue import { createStorage } from '{{packageName}}' const storage = createStorage({ storage: localStorage }) storage.removeItem('recentConnectorId') // [!code focus] ``` --- --- url: /dev/creating-connectors.md --- # Creating Connectors Thanks for your interest in adding a new connector to Wagmi! Please take a moment to review this document **before starting work on a new connector.** ## Overview This guide details how to create new connectors and upstream them back into Wagmi. By following these steps, you will understand the development process, workflow, and requirements for new connectors. **Not all connectors will be accepted into Wagmi** for a variety of reasons outlined in this document. In addition, for connector requests to be accepted, the team creating the connector must [sponsor Wagmi](https://github.com/sponsors/wevm). It takes time and effort to maintain third-party connectors. Wagmi is an OSS project that depends on sponsors and grants to continue our work. Please get in touch via if you have questions about sponsoring. ::: warning **Please ask first before starting work on a new connector.** To avoid having your pull request declined after investing time and effort into a new connector, we ask that contributors create a [Connector Request](https://github.com/wevm/wagmi/discussions/new?category=connector-request) before starting work. This ensures the connector solves for an important or general use-case of interest to Wagmi users and is well supported by the Wagmi and connector teams. ::: ## 1. Follow the contributing guide Check out the [Contributing Guide](/dev/contributing) to get your local development environment set up and learn more about the contributing workflow. ## 2. Create a new file for the connector Create a new file in `packages/connectors/src` named after the connector you want to add. For example, if you want to add Foo, you would create a file named `foo.ts`. File names should be camel-cased and as short as possible. ## 3. Create the connector object. Import `createConnector` from `@wagmi/core` and export a new function that accepts a parameters object and returns the `createConnector` result. This is the base of all connectors. The name of the connector name should be the same as the file name. ```ts // {"path":"/vercel/path0/site/dev/creating-connectors.md","from":2109,"to":2305} import { createConnector } from '@wagmi/core' export type FooBarBazParameters = {} export function fooBarBaz(parameters: FooBarBazParameters = {}) { return createConnector((config) => ({})) } ``` ## 4. Add the missing properties to the object Now that the base of the connector is set up, you should see a type error that looks something like this: ```ts twoslash // {"path":"/vercel/path0/site/dev/creating-connectors.md","from":2480,"to":4138} // @twoslash-cache: {"v":1,"hash":"51529c3efa008aca29b1a99d6189d29f0675b46bfd307c0fa712fc44cfd1d5b5","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIBjUjGY0AwhDBgY/NBFIAeAK5gA1pADuYCrwBK0uVHlw0pdmADm25WoiaAfNr38DRk2cu9rGsA96ihIjDiktKypABiYEqq3o76pIbGphZWMbY+cc4JrskeXul2hYyCwmISUjJykYh+AWUhlRFR+ZqZLknuqTb2bdkdKZ5p9nbcNf6lQeWhVc1DWrrxiW4DLRkLWUu5Xd6FADpg7AC2WHJoAnWTDWGUIMbMpAyIAAxUrDAWaPhIAIwArFRoe7mGCPEAlQLBCrXV5mXDPKj8fD3ZgyMhIJ4AXwo6GwcIIxDRALooMYWGRhxBZD4zjAADN2OYasB9rxWQIkWY4DUAlAJKwMLxkKIOfMAHTi4XMMzIAC6MoA3Cy2TBDuw0DRSDUAKKq9VkeSQ6akLUkMBoACyzCwdkVYDZvGMcmYwIA/EylfbWSoYBgav1zLbPWzgWgAJI0Q41eTegXE95QOAO5YeIhsRQwXhxsAJ3iMADKYWdMHDKstWF4ADJ1u1k9sCtxkDGZdpYLTmIpWGgAGppjNZnOp1jp3gAH14YA7rFHg1bsKgdkYMZqMZbMDbHe7vbdvFb7c7PaHGbHylnUigfAAvHZc7uNwfh/3ExPWFOXbxB8Ox8+pzUPzA+GOAAKpAQKqcAwPIt77r2mb0PGT6Trwb5/tO368L+vY2h6nrgWGEZRjGsE0Nmib+toKGPrmBZOsCJaHGWlbVtk4qiiMjY+jKqGTguS68Cu769hhh6XteRAQOwUDTsBoHsOB8hiRJWF2kGvBCIcBJ0TUi4+n6yYie+4mSUBIFgRBCnzoGbIYlxL7Tiea5zpZrImMwYBwCcDxwNuTguBOhwAEZkNoAAqpCue5pzXse2YOWetoYjcdwPD8ADsrzvOYnxIAAbACQIgngNL0uYNwcFI6IIkiYWouQiDfClWI4jgeBkCB5BUEljwAEwABzpR8XyIAALAi0Bwl1KVDS8ID0m8YDMBSeBmLAtCimgCBUBJLWkKQAC0E1Tbt3xPENu1DTcND0HgwW4rwADkwAYndvCybwYFwO4vCfBmtIQC+tifVgIE4A87DwLwtImV9t0PYKtC6bkMo1Ks8qqcIvJgPyL00tu/p2TF9JxWjzAY1jEkI+4qM8nyArzRSFMWFT6M06pUBubjybTtTmMCv6sr46eMBQEzJMs5gOAMwGDogooWDbowjD6dJpnyYZIwC7FQuoyxvDfF1b1yBmLGoxI5rwHARby4wFJwBbwI1NJRASWQZu20W+nmQBM6a8LvBPTUEnaHTMDaOLIcCFMMjaK5kk9QbQiiqVMAkKw21taVsIVWCVUohqSC9RizZgmNhUXIajQK0VDL6Ywj3cNwNwUoCSCgFmH0SHg60gBiGJAA=="} // @errors: 2740 import { createConnector } from '@wagmi/core' // ---cut--- createConnector((config) => ({})) ``` The type error tells you what properties are missing from `createConnector`'s return type. Add them all in! #### Properties * `icon`: Optional icon URL for the connector. * `id`: The ID for the connector. This should be camel-cased and as short as possible. Example: `fooBarBaz`. * `name`: Human-readable name for the connector. Example: `'Foo Bar Baz'`. * `rdns`: Optional reverse DNS for the connector. This is used to filter out duplicate [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) injected providers when `createConfig#multiInjectedProviderDiscovery` is enabled. #### Methods * `connect`: Function for connecting the connector. * `disconnect`: Function for disconnecting the connector. * `getAccounts`: Function that returns the connected accounts for the connector. * `getChainId`: Function that returns the connected chain ID for the connector. * `getProvider`: Function that returns the underlying provider interface for internal use throughout the connector. * `isAuthorized`: Function that returns whether the connector has connected previously and is still authorized. * `setup`: Optional function for running when the connector is first created. * `switchChain`: Optional function for switching the connector's active chain. #### Events * `onAccountsChanged`: Function for subscribing to account changes internally in the connector. * `onChainChanged`: Function for subscribing to chain changes internally in the connector. * `onConnect`: Function for subscribing to connection events internally in the connector. * `onDisconnect`: Function for subscribing to disconnection events internally in the connector. * `onMessage`: Optional function for subscribing to messages internally in the connector. #### Parameters `createConnector` also has the following config properties you can use within the connector: * `chains`: List of chains configured by the user. * `emitter`: Emitter for emitting events. Used to sync connector state with Wagmi `Config`. The following events are available: * `change`: Emitted when the connected accounts or chain changes. * `connect`: Emitted when the connector connects. * `disconnect`: Emitted when the connector disconnects. * `error`: Emitted when the connector receives an error. * `message`: Emitted when the connector receives a message. * `storage`: Optional storage configured by the user. Defaults to wrapper around localStorage. ::: tip If you plan to use a third-party SDK, it should have minimal dependencies (limit bundle size, supply chain attacks, etc.) and use the most permissive license possible (ideally MIT). Any third-party packages, should also have [`"sideEffects": false`](https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-free) in their `package.json` file for maximum tree-shakability support. ::: ::: tip All address values returned and emitted by the connector should be checksummed using Viem's [`getAddress`](https://viem.sh/docs/utilities/getAddress). ::: ## 5. Export the connector Export the connector from `packages/connectors/src/exports/index.ts` in alphabetic order. ```ts // {"path":"/vercel/path0/site/dev/creating-connectors.md","from":7253,"to":7296} export { fooBarBaz } from './fooBarBaz.js' ``` ## 6. Try out the connector and add tests While building a connector, it can be useful to try it out with Wagmi. You can use the [development playgrounds](/dev/contributing#_5-running-the-dev-playgrounds) for testing your changes. Ideally, you should also be able to add tests for the connector in a `connectorName.test.ts` file. This isn't always easy so at a minimum please create a test file with instructions for how to test the connector manually. The test file should include actual tests or "instruction tests" for the following: * How to connect the connector. * How to disconnect the connector. * How to switch the connector's active chain (if applicable). Remember to include all info required to test the connector, like software to install (browser extension, mobile app, etc.), smart contracts to interact with/deploy, etc. Finally, you should also update the test file in `packages/connectors/src/exports/index.test.ts` to include the new connector. You can do this manually or by running: ```bash // {"path":"/vercel/path0/site/dev/creating-connectors.md","from":8319,"to":8382} pnpm test:update packages/connectors/src/exports/index.test.ts ``` ## 7. Add your team to CODEOWNERS It is critical that connectors are updated in a timely manner and actively maintained so that users of Wagmi can rely on them in production settings. The Wagmi core team will provide as much assistance as possible to keep connectors up-to-date with breaking changes from Wagmi, but it is your responsibility to ensure that any dependencies and issues/discussions related to the connector are handled in a timely manner. If issues are not resolved in a timely manner, the connector may be removed from Wagmi. In support of this goal, add at least one member of your team to the [CODEOWNERS](https://github.com/wevm/wagmi/blob/main/.github/CODEOWNERS) file so that you get notified of pull requests, issues, etc. related to the connector. You can add your team like this: ``` // {"path":"/vercel/path0/site/dev/creating-connectors.md","from":9199,"to":9245} /packages/connectors/src/fooBarBaz @tmm @jxom ``` For more info about GitHub code owners, check out the [GitHub Documentation](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners). ## 8. Document the connector The connector should be documented. Follow the step on [writing documentation](/dev/contributing#_7-writing-documentation) to get set up with running the docs site locally and add the required pages. ## 9. Create a changeset Now that the connector works and has tests, it's time to create a changeset to prepare for release. Run the following to create a changeset: ```bash // {"path":"/vercel/path0/site/dev/creating-connectors.md","from":9871,"to":9886} pnpm changeset ``` The changeset should be a `patch` applied to the `@wagmi/connectors` repository with the description `Added [ConnectorName]`, For example, `Added Foo Bar Baz`. ## 10. Create a pull request The connector is ready to go! Create a [pull request](/dev/contributing#_8-submitting-a-pull-request) and the connector should make it into a future release of Wagmi after some review. --- --- url: /core/api/transports/custom.md --- # custom The `custom` Transport connects to a JSON-RPC API via custom. Wraps Viem's [`custom` Transport](https://viem.sh/docs/clients/transports/custom). ## Import ```ts-vue import { custom } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, custom // [!code hl] } from '{{packageName}}' import { mainnet } from '{{packageName}}/chains' import { customRpc } from './rpc' export const config = createConfig({ chains: [mainnet], connectors: [injected()], transports: { [mainnet.id]: custom({ // [!code hl] async request({ method, params }) { // [!code hl] const response = await customRpc.request(method, params) // [!code hl] return response // [!code hl] } // [!code hl] }) // [!code hl] }, }) ``` ## Parameters ### provider `{ request({ method: string, params: unknown[] }): Promise }` An [EIP-1193 `request` function](https://eips.ethereum.org/EIPS/eip-1193#request) function. ```ts import { customRpc } from './rpc' const transport = custom({ async request({ method, params }) { // [!code focus:3] const response = await customRpc.request(method, params) return response } }) ``` ### key (optional) `string` A key for the Transport. Defaults to `"custom"`. ```ts const transport = custom( provider, { key: 'windowProvider', // [!code focus] } ) ``` ### name (optional) `string` A name for the Transport. Defaults to `"Ethereum Provider"`. ```ts const transport = custom( provider, { name: 'Window Ethereum Provider', // [!code focus] } ) ``` ### retryCount (optional) `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts const transport = custom(provider, { retryCount: 5, // [!code focus] }) ``` ### retryDelay (optional) `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts const transport = custom(provider, { retryDelay: 100, // [!code focus] }) ``` --- --- url: /react/api/transports/custom.md --- # custom The `custom` Transport connects to a JSON-RPC API via custom. Wraps Viem's [`custom` Transport](https://viem.sh/docs/clients/transports/custom). ## Import ```ts-vue import { custom } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, custom // [!code hl] } from '{{packageName}}' import { mainnet } from '{{packageName}}/chains' import { customRpc } from './rpc' export const config = createConfig({ chains: [mainnet], connectors: [injected()], transports: { [mainnet.id]: custom({ // [!code hl] async request({ method, params }) { // [!code hl] const response = await customRpc.request(method, params) // [!code hl] return response // [!code hl] } // [!code hl] }) // [!code hl] }, }) ``` ## Parameters ### provider `{ request({ method: string, params: unknown[] }): Promise }` An [EIP-1193 `request` function](https://eips.ethereum.org/EIPS/eip-1193#request) function. ```ts import { customRpc } from './rpc' const transport = custom({ async request({ method, params }) { // [!code focus:3] const response = await customRpc.request(method, params) return response } }) ``` ### key (optional) `string` A key for the Transport. Defaults to `"custom"`. ```ts const transport = custom( provider, { key: 'windowProvider', // [!code focus] } ) ``` ### name (optional) `string` A name for the Transport. Defaults to `"Ethereum Provider"`. ```ts const transport = custom( provider, { name: 'Window Ethereum Provider', // [!code focus] } ) ``` ### retryCount (optional) `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts const transport = custom(provider, { retryCount: 5, // [!code focus] }) ``` ### retryDelay (optional) `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts const transport = custom(provider, { retryDelay: 100, // [!code focus] }) ``` --- --- url: /shared/transports/custom.md --- # custom The `custom` Transport connects to a JSON-RPC API via custom. Wraps Viem's [`custom` Transport](https://viem.sh/docs/clients/transports/custom). ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/transports/custom.md","from":240,"to":281} import { custom } from '{{packageName}}' ``` ## Usage ```ts-vue // {"path":"/vercel/path0/site/shared/transports/custom.md","from":306,"to":832} import { createConfig, custom // [!code hl] } from '{{packageName}}' import { mainnet } from '{{packageName}}/chains' import { customRpc } from './rpc' export const config = createConfig({ chains: [mainnet], connectors: [injected()], transports: { [mainnet.id]: custom({ // [!code hl] async request({ method, params }) { // [!code hl] const response = await customRpc.request(method, params) // [!code hl] return response // [!code hl] } // [!code hl] }) // [!code hl] }, }) ``` ## Parameters ### provider `{ request({ method: string, params: unknown[] }): Promise }` An [EIP-1193 `request` function](https://eips.ethereum.org/EIPS/eip-1193#request) function. ```ts // {"path":"/vercel/path0/site/shared/transports/custom.md","from":1037,"to":1244} import { customRpc } from './rpc' const transport = custom({ async request({ method, params }) { // [!code focus:3] const response = await customRpc.request(method, params) return response } }) ``` ### key (optional) `string` A key for the Transport. Defaults to `"custom"`. ```ts // {"path":"/vercel/path0/site/shared/transports/custom.md","from":1335,"to":1428} const transport = custom( provider, { key: 'windowProvider', // [!code focus] } ) ``` ### name (optional) `string` A name for the Transport. Defaults to `"Ethereum Provider"`. ```ts // {"path":"/vercel/path0/site/shared/transports/custom.md","from":1532,"to":1636} const transport = custom( provider, { name: 'Window Ethereum Provider', // [!code focus] } ) ``` ### retryCount (optional) `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts // {"path":"/vercel/path0/site/shared/transports/custom.md","from":1757,"to":1831} const transport = custom(provider, { retryCount: 5, // [!code focus] }) ``` ### retryDelay (optional) `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts // {"path":"/vercel/path0/site/shared/transports/custom.md","from":2115,"to":2191} const transport = custom(provider, { retryDelay: 100, // [!code focus] }) ``` --- --- url: /solid/api/transports/custom.md --- # custom The `custom` Transport connects to a JSON-RPC API via custom. Wraps Viem's [`custom` Transport](https://viem.sh/docs/clients/transports/custom). ## Import ```ts-vue import { custom } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, custom // [!code hl] } from '{{packageName}}' import { mainnet } from '{{packageName}}/chains' import { customRpc } from './rpc' export const config = createConfig({ chains: [mainnet], connectors: [injected()], transports: { [mainnet.id]: custom({ // [!code hl] async request({ method, params }) { // [!code hl] const response = await customRpc.request(method, params) // [!code hl] return response // [!code hl] } // [!code hl] }) // [!code hl] }, }) ``` ## Parameters ### provider `{ request({ method: string, params: unknown[] }): Promise }` An [EIP-1193 `request` function](https://eips.ethereum.org/EIPS/eip-1193#request) function. ```ts import { customRpc } from './rpc' const transport = custom({ async request({ method, params }) { // [!code focus:3] const response = await customRpc.request(method, params) return response } }) ``` ### key (optional) `string` A key for the Transport. Defaults to `"custom"`. ```ts const transport = custom( provider, { key: 'windowProvider', // [!code focus] } ) ``` ### name (optional) `string` A name for the Transport. Defaults to `"Ethereum Provider"`. ```ts const transport = custom( provider, { name: 'Window Ethereum Provider', // [!code focus] } ) ``` ### retryCount (optional) `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts const transport = custom(provider, { retryCount: 5, // [!code focus] }) ``` ### retryDelay (optional) `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts const transport = custom(provider, { retryDelay: 100, // [!code focus] }) ``` --- --- url: /vue/api/transports/custom.md --- # custom The `custom` Transport connects to a JSON-RPC API via custom. Wraps Viem's [`custom` Transport](https://viem.sh/docs/clients/transports/custom). ## Import ```ts-vue import { custom } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, custom // [!code hl] } from '{{packageName}}' import { mainnet } from '{{packageName}}/chains' import { customRpc } from './rpc' export const config = createConfig({ chains: [mainnet], connectors: [injected()], transports: { [mainnet.id]: custom({ // [!code hl] async request({ method, params }) { // [!code hl] const response = await customRpc.request(method, params) // [!code hl] return response // [!code hl] } // [!code hl] }) // [!code hl] }, }) ``` ## Parameters ### provider `{ request({ method: string, params: unknown[] }): Promise }` An [EIP-1193 `request` function](https://eips.ethereum.org/EIPS/eip-1193#request) function. ```ts import { customRpc } from './rpc' const transport = custom({ async request({ method, params }) { // [!code focus:3] const response = await customRpc.request(method, params) return response } }) ``` ### key (optional) `string` A key for the Transport. Defaults to `"custom"`. ```ts const transport = custom( provider, { key: 'windowProvider', // [!code focus] } ) ``` ### name (optional) `string` A name for the Transport. Defaults to `"Ethereum Provider"`. ```ts const transport = custom( provider, { name: 'Window Ethereum Provider', // [!code focus] } ) ``` ### retryCount (optional) `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts const transport = custom(provider, { retryCount: 5, // [!code focus] }) ``` ### retryDelay (optional) `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts const transport = custom(provider, { retryDelay: 100, // [!code focus] }) ``` --- --- url: /core/api/actions/deployContract.md --- # deployContract Action for deploying a contract to the network, given bytecode, and constructor arguments. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":288,"to":333} import { deployContract } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":380,"to":635} import { deployContract } from '@wagmi/core' import { wagmiAbi } from './abi' import { config } from './config' const result = await deployContract(config, { abi: wagmiAbi, bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', }) ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":654,"to":788} export const wagmiAbi = [ ... { inputs: [], stateMutability: "nonpayable", type: "constructor", }, ... ] as const ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Deploying with Constructor Args ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":906,"to":1178} import { deployContract } from '@wagmi/core' import { wagmiAbi } from './abi' import { config } from './config' const result = await deployContract(config, { abi: wagmiAbi, args: [69420], bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', }) ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":1197,"to":1361} export const wagmiAbi = [ ... { inputs: [{ name: "x", type: "uint32" }], stateMutability: "nonpayable", type: "constructor", }, ... ] as const; ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":1433,"to":1493} import { type DeployContractParameters } from '@wagmi/core' ``` ### abi `Abi` The contract's ABI. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":1567,"to":1856} import { deployContract } from '@wagmi/core' import { wagmiAbi } from './abi' import { config } from './config' const result = await deployContract(config, { abi: wagmiAbi, // [!code focus] args: [69420], bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', }) ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":1875,"to":2039} export const wagmiAbi = [ ... { inputs: [{ name: "x", type: "uint32" }], stateMutability: "nonpayable", type: "constructor", }, ... ] as const; ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### account `Address | Account | undefined` Account to use when deploying a contract. Throws if account is not found on [`connector`](#connector). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":2271,"to":2617} import { deployContract } from '@wagmi/core' import { wagmiAbi } from './abi' import { config } from './config' const result = await deployContract(config, { abi: wagmiAbi, account: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] args: [69420], bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', }) ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":2636,"to":2800} export const wagmiAbi = [ ... { inputs: [{ name: "x", type: "uint32" }], stateMutability: "nonpayable", type: "constructor", }, ... ] as const; ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### args `readonly unknown[] | undefined` * Arguments to pass when deploying the contract. * Inferred from [`abi`](#abi). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":3007,"to":3296} import { deployContract } from '@wagmi/core' import { wagmiAbi } from './abi' import { config } from './config' const result = await deployContract(config, { abi: wagmiAbi, args: [69420], // [!code focus] bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', }) ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":3315,"to":3479} export const wagmiAbi = [ ... { inputs: [{ name: "x", type: "uint32" }], stateMutability: "nonpayable", type: "constructor", }, ... ] as const; ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### bytecode `Hex` The contract's bytecode. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":3608,"to":3897} import { deployContract } from '@wagmi/core' import { wagmiAbi } from './abi' import { config } from './config' const result = await deployContract(config, { abi: wagmiAbi, args: [69420], bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', // [!code focus] }) ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":3916,"to":4080} export const wagmiAbi = [ ... { inputs: [{ name: "x", type: "uint32" }], stateMutability: "nonpayable", type: "constructor", }, ... ] as const; ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` * Connector to use when deploying a contract. * Defaults to current connector. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":4282,"to":4643} import { getConnection, deployContract } from '@wagmi/core' import { wagmiAbi } from './abi' import { config } from './config' const { connector } = getConnection(config) const result = await deployContract(config, { abi: wagmiAbi, args: [69420], bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', connector, // [!code focus] }) ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":4662,"to":4826} export const wagmiAbi = [ ... { inputs: [{ name: "x", type: "uint32" }], stateMutability: "nonpayable", type: "constructor", }, ... ] as const; ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":4898,"to":4958} import { type DeployContractReturnType } from '@wagmi/core' ``` [`Hash`](https://viem.sh/docs/glossary/types#hash) Transaction hash. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/deployContract.md","from":5050,"to":5109} import { type DeployContractErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Viem * [`deployContract`](https://viem.sh/docs/contract/deployContract) --- --- url: /core/api/utilities/deserialize.md --- # deserialize Deserialize function that supports `bigint` and `Map`. ## Import ```ts-vue import { deserialize } from '{{packageName}}' ``` ## Usage ```ts-vue import { deserialize } from '{{packageName}}' const result = deserialize('{"foo":"wagmi","bar":{"__type":"bigint","value":"123"}}') ``` ## Parameters ### value `string` The string to deserialize. ### reviver `(key: string, value: any) => any` A custom reviver function for handling standard values. ## Return Type `unknown` Parsed value. --- --- url: /react/api/utilities/deserialize.md --- # deserialize Deserialize function that supports `bigint` and `Map`. ## Import ```ts-vue import { deserialize } from '{{packageName}}' ``` ## Usage ```ts-vue import { deserialize } from '{{packageName}}' const result = deserialize('{"foo":"wagmi","bar":{"__type":"bigint","value":"123"}}') ``` ## Parameters ### value `string` The string to deserialize. ### reviver `(key: string, value: any) => any` A custom reviver function for handling standard values. ## Return Type `unknown` Parsed value. --- --- url: /shared/utilities/deserialize.md --- # deserialize Deserialize function that supports `bigint` and `Map`. ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/utilities/deserialize.md","from":155,"to":201} import { deserialize } from '{{packageName}}' ``` ## Usage ```ts-vue // {"path":"/vercel/path0/site/shared/utilities/deserialize.md","from":226,"to":359} import { deserialize } from '{{packageName}}' const result = deserialize('{"foo":"wagmi","bar":{"__type":"bigint","value":"123"}}') ``` ## Parameters ### value `string` The string to deserialize. ### reviver `(key: string, value: any) => any` A custom reviver function for handling standard values. ## Return Type `unknown` Parsed value. --- --- url: /vue/api/utilities/deserialize.md --- # deserialize Deserialize function that supports `bigint` and `Map`. ## Import ```ts-vue import { deserialize } from '{{packageName}}' ``` ## Usage ```ts-vue import { deserialize } from '{{packageName}}' const result = deserialize('{"foo":"wagmi","bar":{"__type":"bigint","value":"123"}}') ``` ## Parameters ### value `string` The string to deserialize. ### reviver `(key: string, value: any) => any` A custom reviver function for handling standard values. ## Return Type `unknown` Parsed value. --- --- url: /core/api/actions/disconnect.md --- # disconnect Action for disconnecting connections. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/disconnect.md","from":192,"to":233} import { disconnect } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/disconnect.md","from":280,"to":381} import { disconnect } from '@wagmi/core' import { config } from './config' await disconnect(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/disconnect.md","from":452,"to":508} import { type DisconnectParameters } from '@wagmi/core' ``` ### connector `Connector | undefined` [Connector](/core/api/connectors) to disconnect with. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/disconnect.md","from":640,"to":850} import { disconnect, getConnection } from '@wagmi/core' import { config } from './config' const { connector } = getConnection(config) const result = await disconnect(config, { connector, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/disconnect.md","from":916,"to":971} import { type DisconnectErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` --- --- url: /core/guides/error-handling.md --- # Error Handling Every module in Wagmi Core exports an accompanying error type which you can use to strongly type your `catch` statements. These types come in the form of `ErrorType`. For example, the `getBlockNumber` action exports a `GetBlockNumberErrorType` type. Unfortunately, [TypeScript doesn't have an abstraction for typed exceptions](https://github.com/microsoft/TypeScript/issues/13219), so the most pragmatic & vanilla approach would be to explicitly cast error types in the `catch` statement. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/core/guides/error-handling.md","from":552,"to":1306} import { type GetBlockNumberErrorType, getBlockNumber } from '@wagmi/core' import { config } from './config' try { const blockNumber = await getBlockNumber(config) } catch (e) { const error = e as GetBlockNumberErrorType error.name // ^? (property) name: "Error" | "ChainDisconnectedError" | "HttpRequestError" | "InternalRpcError" | "InvalidInputRpcError" | "InvalidParamsRpcError" | "InvalidRequestRpcError" | "JsonRpcVersionUnsupportedError" | ... 16 more ... | "WebSocketRequestError" if (error.name === 'InternalRpcError') error.code // ^? (property) code: -32603 if (error.name === 'HttpRequestError') error.headers // ^? (property) headers: Headers error.status // ^? (property) status: number } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: tip If you are using [Wagmi Hooks](/react/api/hooks), errors are [already strongly typed](/react/guides/error-handling) via the `error` property. ::: --- --- url: /react/guides/error-handling.md --- # Error Handling The `error` property in Wagmi Hooks is strongly typed with it's corresponding error type. This enables you to have granular precision with handling errors in your application. You can discriminate the error type by using the `name` property on the error object. ::: code-group ```tsx twoslash [index.tsx] // {"path":"/vercel/path0/site/react/guides/error-handling.md","from":325,"to":5892} // @twoslash-cache: {"v":1,"hash":"f5cf0003ac91d32dabedd71106481b4f3cd10de7f641dff78f479b328c2716e9","data":"N4Igdg9gJgpgziAXAbVAFwJ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QNgyjlmp5dacE3GP58Fr5xgb5wBCE74iFiFH7cEBhkhn4yFQDf536KGSFP5yEqHsBqGf6aF/6GH9BAH6FaEfl9BBnORUHbFwHWmQSWGx4Niq4lnIQYFtZa4Vlp5JlekwA+l+l6gBlBnd7TnNqzmxSRngWQVLkgRyhrkz4jpXG9aL73k7kCGb7EofmiGIESHnmXkX7XlyG3kP73nKGYiqEf4aHfnvlHk6Ffk34GFCXgGZlwTCgWkUHAXhkIFgWFmNgEUeYuSrlJCGjQCOLcIbJVx8IhZNxmgCDEQaC8AADkRIJI7AZloIoIzoYg0qHoXoPoVcsM/mwAw4Fw7gBURlzgJiAiGQPotlmM8kUwZIbawVkV6C0V70SSjAoV4VWwTgjgzgZlWeOedEZlfA1c9M3uHltBvAvlqWUVnMNILCHwvAugiBfQ7oehnwawqWhUe47wNIUAh8fM0ehuwAtBZouguI1VsMZosMcVCVbayVqVtZVG6ONGOaWVrl4c7lyZ64RV8kwVnMzsZVrClV1Vzw8KG4dJgQ9ZbVLgKZwASFvV/Vh+IImMQ1mM+I38oIZoSIj00EiAoA5gwQB5kgeAhktAIAZoZoQAA=="} // @noErrors import { useBlockNumber } from 'wagmi' function App() { const { data, error } = useBlockNumber() // ^? error?.name // ^? if (error?.name === 'HttpRequestError') { const { status } = error // ^? return
A HTTP error occurred. Status: {status}
} if (error?.name === 'LimitExceededRpcError') { const { code } = error // ^? return
Rate limit exceeded. Code: {code}
} // ... } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` --- --- url: /solid/guides/error-handling.md --- # Error Handling `@wagmi/solid` provides comprehensive error handling through typed errors and TanStack Query's error states. ## Query Errors When using query primitives, errors are available through the `error` property: ```tsx // {"path":"/vercel/path0/site/solid/guides/error-handling.md","from":233,"to":575} import { useBalance } from '@wagmi/solid' function Balance() { const balance = useBalance(() => ({ address: '0x...', })) return (
{balance.isError && (

Error: {balance.error?.message}

)} {balance.isSuccess && (

Balance: {balance.data?.formatted}

)}
) } ``` ## Mutation Errors For mutation primitives like `useConnect` or `useDisconnect`, you can handle errors similarly: ```tsx // {"path":"/vercel/path0/site/solid/guides/error-handling.md","from":703,"to":1218} import { useConnect } from '@wagmi/solid' import { injected } from '@wagmi/solid/connectors' function Connect() { const connect = useConnect() const handleConnect = () => { connect.mutate( { connector: injected() }, { onError(error) { console.error('Failed to connect:', error.message) }, } ) } return (
{connect.isError &&

Error: {connect.error?.message}

}
) } ``` ## Error Types Wagmi exports specific error types that you can use for more granular error handling: ```tsx // {"path":"/vercel/path0/site/solid/guides/error-handling.md","from":1333,"to":1809} import { useConnect, ConnectorNotFoundError } from '@wagmi/solid' function Connect() { const connect = useConnect() const handleConnect = () => { connect.mutate( { connector: injected() }, { onError(error) { if (error instanceof ConnectorNotFoundError) { console.error('Wallet not installed') } else { console.error('Unknown error:', error.message) } }, } ) } // ... } ``` ## Common Errors ### ConnectorNotFoundError Thrown when trying to use a connector that isn't available (e.g., MetaMask not installed). ### ChainNotConfiguredError Thrown when trying to use a chain that isn't configured in your Wagmi config. ### ConnectorAlreadyConnectedError Thrown when trying to connect with a connector that's already connected. ## Further Reading * [Wagmi Errors](/solid/api/errors) * [TanStack Query Error Handling](https://tanstack.com/query/latest/docs/framework/solid/guides/queries#error-handling) --- --- url: /vue/guides/error-handling.md --- # Error Handling The `error` property in Wagmi Composables is strongly typed with it's corresponding error type. This enables you to have granular precision with handling errors in your application. You can discriminate the error type by using the `name` property on the error object. ::: code-group ```vue twoslash [index.vue] // {"path":"/vercel/path0/site/vue/guides/error-handling.md","from":331,"to":5471} // @twoslash-cache: {"v":1,"hash":"26fedaeea151ddba71fa403843f00ead34374f64e5dd13dafc27e1465b3af479","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAhVhBEBr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LUzwGyCYeKUkRRn6+cdgOJm5251Je5B5zZuIx5oI5ZdZw6GyfQSItUzASAoA5gwQcAqKeARAdYIA+5QAA==="} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` --- --- url: /core/api/errors.md --- # Errors Error classes used by Wagmi. ## BaseError Error class extended by all errors. ```ts-vue import { BaseError } from '{{packageName}}' ``` ## Config ### ConnectorAccountNotFoundError When an account does not exist on the connector or is unable to be used. ```ts-vue import { ConnectorAccountNotFoundError } from '{{packageName}}' ``` ### ConnectorAlreadyConnectedError When a connector is already connected. ```ts-vue import { ConnectorAlreadyConnectedError } from '{{packageName}}' ``` ### ConnectorChainMismatchError When the Wagmi Config is out-of-sync with the connector's active chain ID. This is rare and likely an upstream wallet issue. ```ts-vue import { ConnectorChainMismatchError } from '{{packageName}}' ``` ### ChainNotConfiguredError When a chain is not configured. You likely need to add the chain to `Config['chains']`. ```ts-vue import { ChainNotConfiguredError } from '{{packageName}}' ``` ### ConnectorNotConnectedError When a connector is not connected. ```ts-vue import { ConnectorNotConnectedError } from '{{packageName}}' ``` ### ConnectorNotFoundError When a connector is not found or able to be used. ```ts-vue import { ConnectorNotFoundError } from '{{packageName}}' ``` ### ConnectorUnavailableReconnectingError During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`. All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored. This error commonly occurs for connectors that asynchronously inject after reconnection has already started. ```ts-vue import { ConnectorUnavailableReconnectingError } from '{{packageName}}' ``` ## Connector ### ProviderNotFoundError When a connector's provider is not found or able to be used. ```ts-vue import { ProviderNotFoundError } from '{{packageName}}' ``` ### SwitchChainNotSupportedError When switching chains is not supported by connectors. ```ts-vue import { SwitchChainNotSupportedError } from '{{packageName}}' ``` --- --- url: /react/api/errors.md --- # Errors Error classes used by Wagmi. ## BaseError Error class extended by all errors. ```ts-vue import { BaseError } from '{{packageName}}' ``` ## Config ### ConnectorAccountNotFoundError When an account does not exist on the connector or is unable to be used. ```ts-vue import { ConnectorAccountNotFoundError } from '{{packageName}}' ``` ### ConnectorAlreadyConnectedError When a connector is already connected. ```ts-vue import { ConnectorAlreadyConnectedError } from '{{packageName}}' ``` ### ConnectorChainMismatchError When the Wagmi Config is out-of-sync with the connector's active chain ID. This is rare and likely an upstream wallet issue. ```ts-vue import { ConnectorChainMismatchError } from '{{packageName}}' ``` ### ChainNotConfiguredError When a chain is not configured. You likely need to add the chain to `Config['chains']`. ```ts-vue import { ChainNotConfiguredError } from '{{packageName}}' ``` ### ConnectorNotConnectedError When a connector is not connected. ```ts-vue import { ConnectorNotConnectedError } from '{{packageName}}' ``` ### ConnectorNotFoundError When a connector is not found or able to be used. ```ts-vue import { ConnectorNotFoundError } from '{{packageName}}' ``` ### ConnectorUnavailableReconnectingError During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`. All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored. This error commonly occurs for connectors that asynchronously inject after reconnection has already started. ```ts-vue import { ConnectorUnavailableReconnectingError } from '{{packageName}}' ``` ## Connector ### ProviderNotFoundError When a connector's provider is not found or able to be used. ```ts-vue import { ProviderNotFoundError } from '{{packageName}}' ``` ### SwitchChainNotSupportedError When switching chains is not supported by connectors. ```ts-vue import { SwitchChainNotSupportedError } from '{{packageName}}' ``` ## React ### WagmiProviderNotFoundError When a Wagmi hook is used outside of a [`WagmiProvider`](/react/api/WagmiProvider). ```ts // {"path":"/vercel/path0/site/react/api/errors.md","from":288,"to":339} import { WagmiProviderNotFoundError } from 'wagmi' ``` --- --- url: /solid/api/errors.md --- # Errors `@wagmi/solid` exports error types that can be used for type-safe error handling. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/errors.md","from":110,"to":217} import { BaseError, ChainNotConfiguredError, ConnectorNotFoundError, // ... } from '@wagmi/solid' ``` ## Base Error All Wagmi errors extend from `BaseError`: ```ts // {"path":"/vercel/path0/site/solid/api/errors.md","from":286,"to":509} import { BaseError } from '@wagmi/solid' try { // Wagmi operation } catch (error) { if (error instanceof BaseError) { console.error('Wagmi error:', error.message) console.error('Details:', error.details) } } ``` ## Available Errors ### ChainNotConfiguredError Thrown when trying to use a chain that isn't configured in your Wagmi config. ```ts // {"path":"/vercel/path0/site/solid/api/errors.md","from":649,"to":882} import { ChainNotConfiguredError } from '@wagmi/solid' try { // Operation with unconfigured chain } catch (error) { if (error instanceof ChainNotConfiguredError) { console.error('Chain not configured:', error.message) } } ``` ### ConnectorNotFoundError Thrown when trying to use a connector that doesn't exist or isn't available. ```ts // {"path":"/vercel/path0/site/solid/api/errors.md","from":999,"to":1198} import { ConnectorNotFoundError } from '@wagmi/solid' try { // Connect operation } catch (error) { if (error instanceof ConnectorNotFoundError) { console.error('Wallet not installed') } } ``` ### ConnectorAlreadyConnectedError Thrown when trying to connect with a connector that's already connected. ```ts // {"path":"/vercel/path0/site/solid/api/errors.md","from":1319,"to":1531} import { ConnectorAlreadyConnectedError } from '@wagmi/solid' try { // Connect operation } catch (error) { if (error instanceof ConnectorAlreadyConnectedError) { console.error('Already connected') } } ``` ### ProviderNotFoundError Thrown when the connector's provider is not found. ```ts // {"path":"/vercel/path0/site/solid/api/errors.md","from":1621,"to":1817} import { ProviderNotFoundError } from '@wagmi/solid' try { // Provider operation } catch (error) { if (error instanceof ProviderNotFoundError) { console.error('Provider not found') } } ``` ### SwitchChainNotSupportedError Thrown when the connector doesn't support programmatic chain switching. ```ts // {"path":"/vercel/path0/site/solid/api/errors.md","from":1935,"to":2160} import { SwitchChainNotSupportedError } from '@wagmi/solid' try { // Switch chain operation } catch (error) { if (error instanceof SwitchChainNotSupportedError) { console.error('Chain switching not supported') } } ``` ## More Errors See the [`@wagmi/core` Errors docs](/core/api/errors) for the full list of available error types. --- --- url: /vue/api/errors.md --- # Errors Error classes used by Wagmi. ## BaseError Error class extended by all errors. ```ts-vue import { BaseError } from '{{packageName}}' ``` ## Config ### ConnectorAccountNotFoundError When an account does not exist on the connector or is unable to be used. ```ts-vue import { ConnectorAccountNotFoundError } from '{{packageName}}' ``` ### ConnectorAlreadyConnectedError When a connector is already connected. ```ts-vue import { ConnectorAlreadyConnectedError } from '{{packageName}}' ``` ### ConnectorChainMismatchError When the Wagmi Config is out-of-sync with the connector's active chain ID. This is rare and likely an upstream wallet issue. ```ts-vue import { ConnectorChainMismatchError } from '{{packageName}}' ``` ### ChainNotConfiguredError When a chain is not configured. You likely need to add the chain to `Config['chains']`. ```ts-vue import { ChainNotConfiguredError } from '{{packageName}}' ``` ### ConnectorNotConnectedError When a connector is not connected. ```ts-vue import { ConnectorNotConnectedError } from '{{packageName}}' ``` ### ConnectorNotFoundError When a connector is not found or able to be used. ```ts-vue import { ConnectorNotFoundError } from '{{packageName}}' ``` ### ConnectorUnavailableReconnectingError During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`. All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored. This error commonly occurs for connectors that asynchronously inject after reconnection has already started. ```ts-vue import { ConnectorUnavailableReconnectingError } from '{{packageName}}' ``` ## Connector ### ProviderNotFoundError When a connector's provider is not found or able to be used. ```ts-vue import { ProviderNotFoundError } from '{{packageName}}' ``` ### SwitchChainNotSupportedError When switching chains is not supported by connectors. ```ts-vue import { SwitchChainNotSupportedError } from '{{packageName}}' ``` --- --- url: /core/api/actions/estimateFeesPerGas.md --- # estimateFeesPerGas Returns an estimate for the fees per gas (in wei) for a transaction to be likely included in the next block. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/estimateFeesPerGas.md","from":287,"to":336} import { estimateFeesPerGas } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateFeesPerGas.md","from":383,"to":515} import { estimateFeesPerGas } from '@wagmi/core' import { config } from './config' const result = await estimateFeesPerGas(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/estimateFeesPerGas.md","from":586,"to":650} import { type EstimateFeesPerGasParameters } from '@wagmi/core' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateFeesPerGas.md","from":786,"to":1008} import { estimateFeesPerGas } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const result = await estimateFeesPerGas(config, { chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### type `'legacy' | 'eip1559'` * Fee value type. * Defaults to `'eip1559'` ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateFeesPerGas.md","from":1169,"to":1335} import { estimateFeesPerGas } from '@wagmi/core' import { config } from './config' const result = estimateFeesPerGas(config, { type: 'legacy', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/estimateFeesPerGas.md","from":1407,"to":1471} import { type EstimateFeesPerGasReturnType } from '@wagmi/core' ``` [`FeeValues`](https://viem.sh/docs/glossary/types#feevalues) An estimate (in wei) for the fees per gas. ### gasPrice `bigint | undefined` * Gas price. * When [`type`](#type) is `'eip1559'`, value is `undefined`. ### maxFeePerGas `bigint | undefined` * Max fee per gas. * When [`type`](#type) is `'legacy'`, value is `undefined`. ### maxPriorityFeePerGas `bigint | undefined` * Max priority fee per gas. * When [`type`](#type) is `'legacy'`, value is `undefined`. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/estimateFeesPerGas.md","from":1966,"to":2029} import { type EstimateFeesPerGasErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`estimateFeesPerGas`](https://viem.sh/docs/actions/public/estimateFeesPerGas) --- --- url: /core/api/actions/estimateGas.md --- # estimateGas Action for estimating the gas necessary to complete a transaction without submitting it to the network. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":261,"to":303} import { estimateGas } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":350,"to":588} import { estimateGas } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await estimateGas(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":659,"to":716} import { type EstimateGasParameters } from '@wagmi/core' ``` ### accessList `AccessList | undefined` The access list. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":813,"to":1188} import { estimateGas } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await estimateGas(config, { accessList: [{ // [!code focus] address: '0x1', // [!code focus] storageKeys: ['0x1'], // [!code focus] }], // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### account `Address | Account | undefined` Account to use when estimating gas. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":1353,"to":1665} import { estimateGas } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await estimateGas(config, { account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` Chain ID to target when estimating gas. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":1847,"to":2170} import { estimateGas } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { parseEther } from 'viem' import { config } from './config' const result = await estimateGas(config, { chainId: mainnet.id, // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` Connector to estimate with. If no [`account`](#account) is provided, will use default account from connector. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":2403,"to":2757} import { getConnections, estimateGas } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const connections = getConnections(config) const result = await estimateGas(config, { connector: connections[0]?.connector, // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### data `` `0x${string}` | undefined `` A contract hashed method call with encoded args. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":2932,"to":3241} import { estimateGas } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await estimateGas(config, { data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gas `bigint | undefined` Gas provided for transaction execution. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":3395,"to":3685} import { estimateGas } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' const result = await estimateGas(config, { gas: parseGwei('20'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### gasPrice `bigint | undefined` The price in wei to pay per gas. Only applies to [Legacy Transactions](https://viem.sh/docs/glossary/terms#legacy-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":3937,"to":4232} import { estimateGas } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' const result = await estimateGas(config, { gasPrice: parseGwei('20'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxFeePerGas `bigint | undefined` Total fee per gas in wei, inclusive of [`maxPriorityFeePerGas`](#maxPriorityFeePerGas). Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":4542,"to":4841} import { estimateGas } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' const result = await estimateGas(config, { maxFeePerGas: parseGwei('20'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxPriorityFeePerGas `bigint | undefined` Max priority fee per gas in wei. Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":5104,"to":5443} import { estimateGas } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' const result = await estimateGas(config, { maxFeePerGas: parseGwei('20'), maxPriorityFeePerGas: parseGwei('2'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### nonce `number` Unique number identifying this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":5596,"to":5865} import { estimateGas } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await estimateGas(config, { nonce: 123, // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### to `Address | undefined` The transaction recipient or contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":6026,"to":6281} import { estimateGas } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await estimateGas(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### type `'legacy' | 'eip1559' | 'eip2930' | undefined` Optional transaction request type to narrow parameters. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":6478,"to":6752} import { estimateGas } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await estimateGas(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', type: 'eip1559', // [!code focus] value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### value `bigint | undefined` Value in wei sent with this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":6909,"to":7165} import { estimateGas } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await estimateGas(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":7237,"to":7294} import { type EstimateGasReturnType } from '@wagmi/core' ``` `bigint` The gas estimate in wei. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/estimateGas.md","from":7351,"to":7407} import { type EstimateGasErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`estimateGas`](https://viem.sh/docs/actions/public/estimateGas) --- --- url: /core/api/actions/estimateMaxPriorityFeePerGas.md --- # estimateMaxPriorityFeePerGas Returns an estimate for the max priority fee per gas (in wei) for a transaction to be likely included in the next block. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/estimateMaxPriorityFeePerGas.md","from":319,"to":378} import { estimateMaxPriorityFeePerGas } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateMaxPriorityFeePerGas.md","from":425,"to":577} import { estimateMaxPriorityFeePerGas } from '@wagmi/core' import { config } from './config' const result = await estimateMaxPriorityFeePerGas(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/estimateMaxPriorityFeePerGas.md","from":648,"to":712} import { type EstimateFeesPerGasParameters } from '@wagmi/core' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/estimateMaxPriorityFeePerGas.md","from":848,"to":1090} import { estimateMaxPriorityFeePerGas } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const result = await estimateMaxPriorityFeePerGas(config, { chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/estimateMaxPriorityFeePerGas.md","from":1162,"to":1226} import { type EstimateFeesPerGasReturnType } from '@wagmi/core' ``` `bigint` An estimate (in wei) for the max priority fee per gas. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/estimateMaxPriorityFeePerGas.md","from":1313,"to":1376} import { type EstimateFeesPerGasErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`estimateMaxPriorityFeePerGas`](https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas) --- --- url: /core/guides/ethers.md --- # Ethers.js Adapters It is recommended for projects to migrate to [Viem](https://viem.sh) when using Wagmi, but there are some cases where you might still need to use [Ethers.js](https://ethers.org) in your project: * You may want to **incrementally migrate** Ethers.js usage to Viem * Some **third-party libraries & SDKs** may only support Ethers.js * Personal preference We have provided reference implementations for Viem → Ethers.js adapters that you can copy + paste in your project. ## Client → Provider ### Reference Implementation Copy the following reference implementation into a file of your choice: ::: code-group ```ts [Ethers v5] // {"path":"/vercel/path0/site/core/guides/ethers.md","from":652,"to":1599} import { type Config, getClient } from '@wagmi/core' import { providers } from 'ethers' import type { Client, Chain, Transport } from 'viem' export function clientToProvider(client: Client) { const { chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } if (transport.type === 'fallback') return new providers.FallbackProvider( (transport.transports as ReturnType[]).map( ({ value }) => new providers.JsonRpcProvider(value?.url, network), ), ) return new providers.JsonRpcProvider(transport.url, network) } /** Action to convert a viem Public Client to an ethers.js Provider. */ export function getEthersProvider( config: Config, { chainId }: { chainId?: number } = {}, ) { const client = getClient(config, { chainId }) if (!client) return return clientToProvider(client) } ``` ```ts [Ethers v6] // {"path":"/vercel/path0/site/core/guides/ethers.md","from":1622,"to":2629} import { type Config, getClient } from '@wagmi/core' import { FallbackProvider, JsonRpcProvider } from 'ethers' import type { Client, Chain, Transport } from 'viem' export function clientToProvider(client: Client) { const { chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } if (transport.type === 'fallback') { const providers = (transport.transports as ReturnType[]).map( ({ value }) => new JsonRpcProvider(value?.url, network), ) if (providers.length === 1) return providers[0] return new FallbackProvider(providers) } return new JsonRpcProvider(transport.url, network) } /** Action to convert a viem Client to an ethers.js Provider. */ export function getEthersProvider( config: Config, { chainId }: { chainId?: number } = {}, ) { const client = getClient(config, { chainId }) if (!client) return return clientToProvider(client) } ``` ::: ### Usage Now you can use the `getEthersProvider` function in your components: ::: code-group ```ts [example.ts] // {"path":"/vercel/path0/site/core/guides/ethers.md","from":2755,"to":2909} import { getEthersProvider } from './ethers' import { config } from './config' function example() { const provider = getEthersProvider(config) ... } ``` ```ts [ethers.ts (Ethers v5)] // {"path":"/vercel/path0/site/core/guides/ethers.md","from":2944,"to":3892} import { type Config, getClient } from '@wagmi/core' import { providers } from 'ethers' import type { Client, Chain, Transport } from 'viem' export function clientToProvider(client: Client) { const { chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } if (transport.type === 'fallback') return new providers.FallbackProvider( (transport.transports as ReturnType[]).map( ({ value }) => new providers.JsonRpcProvider(value?.url, network), ), ) return new providers.JsonRpcProvider(transport.url, network) } /** Action to convert a viem Public Client to an ethers.js Provider. */ export function getEthersProvider( config: Config, { chainId }: { chainId?: number } = {}, ) { const client = getClient(config, { chainId }) if (!client) return return clientToProvider(client) } ``` ```ts [ethers.ts (Ethers v6)] // {"path":"/vercel/path0/site/core/guides/ethers.md","from":3927,"to":4934} import { type Config, getClient } from '@wagmi/core' import { FallbackProvider, JsonRpcProvider } from 'ethers' import type { Client, Chain, Transport } from 'viem' export function clientToProvider(client: Client) { const { chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } if (transport.type === 'fallback') { const providers = (transport.transports as ReturnType[]).map( ({ value }) => new JsonRpcProvider(value?.url, network), ) if (providers.length === 1) return providers[0] return new FallbackProvider(providers) } return new JsonRpcProvider(transport.url, network) } /** Action to convert a viem Client to an ethers.js Provider. */ export function getEthersProvider( config: Config, { chainId }: { chainId?: number } = {}, ) { const client = getClient(config, { chainId }) if (!client) return return clientToProvider(client) } ``` ::: ## Connector Client → Signer ### Reference Implementation Copy the following reference implementation into a file of your choice: ::: code-group ```ts [Ethers v5] // {"path":"/vercel/path0/site/core/guides/ethers.md","from":5111,"to":5914} import { Config, getConnectorClient } from '@wagmi/core' import { providers } from 'ethers' import type { Account, Chain, Client, Transport } from 'viem' export function clientToSigner(client: Client) { const { account, chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } const provider = new providers.Web3Provider(transport, network) const signer = provider.getSigner(account.address) return signer } /** Action to convert a Viem Client to an ethers.js Signer. */ export async function getEthersSigner( config: Config, { chainId }: { chainId?: number } = {}, ) { const client = await getConnectorClient(config, { chainId }) return clientToSigner(client) } ``` ```ts [Ethers v6] // {"path":"/vercel/path0/site/core/guides/ethers.md","from":5937,"to":6771} import { Config, getConnectorClient } from '@wagmi/core' import { BrowserProvider, JsonRpcSigner } from 'ethers' import type { Account, Chain, Client, Transport } from 'viem' export function clientToSigner(client: Client) { const { account, chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } const provider = new BrowserProvider(transport, network) const signer = new JsonRpcSigner(provider, account.address) return signer } /** Action to convert a viem Wallet Client to an ethers.js Signer. */ export async function getEthersSigner( config: Config, { chainId }: { chainId?: number } = {}, ) { const client = await getConnectorClient(config, { chainId }) return clientToSigner(client) } ``` ::: ### Usage Now you can use the `getEthersSigner` function in your components: ::: code-group ```ts [example.ts] // {"path":"/vercel/path0/site/core/guides/ethers.md","from":6895,"to":7045} import { getEthersSigner } from './ethers' import { config } from './config' function example() { const provider = getEthersSigner(config) ... } ``` ```ts [ethers.ts (Ethers v5)] // {"path":"/vercel/path0/site/core/guides/ethers.md","from":7080,"to":7883} import { Config, getConnectorClient } from '@wagmi/core' import { providers } from 'ethers' import type { Account, Chain, Client, Transport } from 'viem' export function clientToSigner(client: Client) { const { account, chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } const provider = new providers.Web3Provider(transport, network) const signer = provider.getSigner(account.address) return signer } /** Action to convert a Viem Client to an ethers.js Signer. */ export async function getEthersSigner( config: Config, { chainId }: { chainId?: number } = {}, ) { const client = await getConnectorClient(config, { chainId }) return clientToSigner(client) } ``` ```ts [ethers.ts (Ethers v6)] // {"path":"/vercel/path0/site/core/guides/ethers.md","from":7918,"to":8752} import { Config, getConnectorClient } from '@wagmi/core' import { BrowserProvider, JsonRpcSigner } from 'ethers' import type { Account, Chain, Client, Transport } from 'viem' export function clientToSigner(client: Client) { const { account, chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } const provider = new BrowserProvider(transport, network) const signer = new JsonRpcSigner(provider, account.address) return signer } /** Action to convert a viem Wallet Client to an ethers.js Signer. */ export async function getEthersSigner( config: Config, { chainId }: { chainId?: number } = {}, ) { const client = await getConnectorClient(config, { chainId }) return clientToSigner(client) } ``` ::: --- --- url: /react/guides/ethers.md --- # Ethers.js Adapters It is recommended for projects to migrate to [Viem](https://viem.sh) when using Wagmi, but there are some cases where you might still need to use [Ethers.js](https://ethers.org) in your project: * You may want to **incrementally migrate** Ethers.js usage to Viem * Some **third-party libraries & SDKs** may only support Ethers.js * Personal preference We have provided reference implementations for Viem → Ethers.js adapters that you can copy + paste in your project. ## Client → Provider ### Reference Implementation Copy the following reference implementation into a file of your choice: ::: code-group ```ts [Ethers v5] // {"path":"/vercel/path0/site/react/guides/ethers.md","from":652,"to":1629} import { providers } from 'ethers' import { useMemo } from 'react' import type { Chain, Client, Transport } from 'viem' import { Config, useClient } from 'wagmi' export function clientToProvider(client: Client) { const { chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } if (transport.type === 'fallback') return new providers.FallbackProvider( (transport.transports as ReturnType[]).map( ({ value }) => new providers.JsonRpcProvider(value?.url, network), ), ) return new providers.JsonRpcProvider(transport.url, network) } /** Hook to convert a viem Client to an ethers.js Provider. */ export function useEthersProvider({ chainId, }: { chainId?: number | undefined } = {}) { const client = useClient({ chainId }) return useMemo(() => (client ? clientToProvider(client) : undefined), [client]) } ``` ```ts [Ethers v6] // {"path":"/vercel/path0/site/react/guides/ethers.md","from":1652,"to":2688} import { FallbackProvider, JsonRpcProvider } from 'ethers' import { useMemo } from 'react' import type { Chain, Client, Transport } from 'viem' import { type Config, useClient } from 'wagmi' export function clientToProvider(client: Client) { const { chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } if (transport.type === 'fallback') { const providers = (transport.transports as ReturnType[]).map( ({ value }) => new JsonRpcProvider(value?.url, network), ) if (providers.length === 1) return providers[0] return new FallbackProvider(providers) } return new JsonRpcProvider(transport.url, network) } /** Action to convert a viem Client to an ethers.js Provider. */ export function useEthersProvider({ chainId }: { chainId?: number } = {}) { const client = useClient({ chainId }) return useMemo(() => (client ? clientToProvider(client) : undefined), [client]) } ``` ::: ### Usage Now you can use the `useEthersProvider` function in your components: ::: code-group ```ts [example.ts] // {"path":"/vercel/path0/site/react/guides/ethers.md","from":2814,"to":2928} import { useEthersProvider } from './ethers' function Example() { const provider = useEthersProvider() ... } ``` ```ts [ethers.ts (Ethers v5)] // {"path":"/vercel/path0/site/react/guides/ethers.md","from":2963,"to":3940} import { providers } from 'ethers' import { useMemo } from 'react' import type { Chain, Client, Transport } from 'viem' import { Config, useClient } from 'wagmi' export function clientToProvider(client: Client) { const { chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } if (transport.type === 'fallback') return new providers.FallbackProvider( (transport.transports as ReturnType[]).map( ({ value }) => new providers.JsonRpcProvider(value?.url, network), ), ) return new providers.JsonRpcProvider(transport.url, network) } /** Hook to convert a viem Client to an ethers.js Provider. */ export function useEthersProvider({ chainId, }: { chainId?: number | undefined } = {}) { const client = useClient({ chainId }) return useMemo(() => (client ? clientToProvider(client) : undefined), [client]) } ``` ```ts [ethers.ts (Ethers v6)] // {"path":"/vercel/path0/site/react/guides/ethers.md","from":3975,"to":5011} import { FallbackProvider, JsonRpcProvider } from 'ethers' import { useMemo } from 'react' import type { Chain, Client, Transport } from 'viem' import { type Config, useClient } from 'wagmi' export function clientToProvider(client: Client) { const { chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } if (transport.type === 'fallback') { const providers = (transport.transports as ReturnType[]).map( ({ value }) => new JsonRpcProvider(value?.url, network), ) if (providers.length === 1) return providers[0] return new FallbackProvider(providers) } return new JsonRpcProvider(transport.url, network) } /** Action to convert a viem Client to an ethers.js Provider. */ export function useEthersProvider({ chainId }: { chainId?: number } = {}) { const client = useClient({ chainId }) return useMemo(() => (client ? clientToProvider(client) : undefined), [client]) } ``` ::: ## Connector Client → Signer ### Reference Implementation Copy the following reference implementation into a file of your choice: ::: code-group ```ts [Ethers v5] // {"path":"/vercel/path0/site/react/guides/ethers.md","from":5188,"to":6038} import { providers } from 'ethers' import { useMemo } from 'react' import type { Account, Chain, Client, Transport } from 'viem' import { Config, useConnectorClient } from 'wagmi' export function clientToSigner(client: Client) { const { account, chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } const provider = new providers.Web3Provider(transport, network) const signer = provider.getSigner(account.address) return signer } /** Hook to convert a Viem Client to an ethers.js Signer. */ export function useEthersSigner({ chainId }: { chainId?: number } = {}) { const { data: client } = useConnectorClient({ chainId }) return useMemo(() => (client ? clientToSigner(client) : undefined), [client]) } ``` ```ts [Ethers v6] // {"path":"/vercel/path0/site/react/guides/ethers.md","from":6061,"to":6946} import { BrowserProvider, JsonRpcSigner } from 'ethers' import { useMemo } from 'react' import type { Account, Chain, Client, Transport } from 'viem' import { type Config, useConnectorClient } from 'wagmi' export function clientToSigner(client: Client) { const { account, chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } const provider = new BrowserProvider(transport, network) const signer = new JsonRpcSigner(provider, account.address) return signer } /** Hook to convert a viem Wallet Client to an ethers.js Signer. */ export function useEthersSigner({ chainId }: { chainId?: number } = {}) { const { data: client } = useConnectorClient({ chainId }) return useMemo(() => (client ? clientToSigner(client) : undefined), [client]) } ``` ::: ### Usage Now you can use the `useEthersSigner` function in your components: ::: code-group ```ts [example.ts] // {"path":"/vercel/path0/site/react/guides/ethers.md","from":7070,"to":7178} import { useEthersSigner } from './ethers' function example() { const signer = useEthersSigner() ... } ``` ```ts [ethers.ts (Ethers v5)] // {"path":"/vercel/path0/site/react/guides/ethers.md","from":7213,"to":8065} import { providers } from 'ethers' import { useMemo } from 'react' import type { Account, Chain, Client, Transport } from 'viem' import { Config, useConnectorClient } from 'wagmi' export function clientToSigner(client: Client) { const { account, chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } const provider = new providers.Web3Provider(transport, network) const signer = provider.getSigner(account.address) return signer } /** Action to convert a Viem Client to an ethers.js Signer. */ export function useEthersSigner({ chainId }: { chainId?: number } = {}) { const { data: client } = useConnectorClient({ chainId }) return useMemo(() => (client ? clientToSigner(client) : undefined), [client]) } ``` ```ts [ethers.ts (Ethers v6)] // {"path":"/vercel/path0/site/react/guides/ethers.md","from":8100,"to":8985} import { BrowserProvider, JsonRpcSigner } from 'ethers' import { useMemo } from 'react' import type { Account, Chain, Client, Transport } from 'viem' import { type Config, useConnectorClient } from 'wagmi' export function clientToSigner(client: Client) { const { account, chain, transport } = client const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, } const provider = new BrowserProvider(transport, network) const signer = new JsonRpcSigner(provider, account.address) return signer } /** Hook to convert a viem Wallet Client to an ethers.js Signer. */ export function useEthersSigner({ chainId }: { chainId?: number } = {}) { const { data: client } = useConnectorClient({ chainId }) return useMemo(() => (client ? clientToSigner(client) : undefined), [client]) } ``` ::: --- --- url: /cli/api/plugins/etherscan.md --- # etherscan Plugin for fetching ABIs from [Etherscan](https://etherscan.io) and adding into `contracts` config. ## Import ```ts // {"path":"/vercel/path0/site/cli/api/plugins/etherscan.md","from":131,"to":178} import { etherscan } from '@wagmi/cli/plugins' ``` ## Usage ```ts{2,6-14} // {"path":"/vercel/path0/site/cli/api/plugins/etherscan.md","from":207,"to":580} import { defineConfig } from '@wagmi/cli' import { etherscan } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ etherscan({ apiKey: process.env.ETHERSCAN_API_KEY, chainId: 1, contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], }), ], }) ``` ## Configuration ```ts // {"path":"/vercel/path0/site/cli/api/plugins/etherscan.md","from":609,"to":667} import { type EtherscanConfig } from '@wagmi/cli/plugins' ``` ### apiKey `string` Etherscan API key. Etherscan API keys are specific per network and include testnets (e.g. Ethereum Mainnet and Sepolia share same API key). ```ts // {"path":"/vercel/path0/site/cli/api/plugins/etherscan.md","from":841,"to":1231} import { defineConfig } from '@wagmi/cli' import { etherscan } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ etherscan({ apiKey: process.env.ETHERSCAN_API_KEY, // [!code focus] chainId: 1, contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], }), ], }) ``` ### cacheDuration `number | undefined` * Duration in milliseconds to cache ABIs. * Defaults to `1_800_000` (30 minutes). ```ts // {"path":"/vercel/path0/site/cli/api/plugins/etherscan.md","from":1366,"to":1786} import { defineConfig } from '@wagmi/cli' import { etherscan } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ etherscan({ apiKey: process.env.ETHERSCAN_API_KEY, cacheDuration: 300_000, // [!code focus] chainId: 1, contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], }), ], }) ``` ### chainId `number` Chain ID to use for fetching ABI. If [`address`](/cli/config/options#address) is an object, `chainId` is used to select the address. View supported chains on the [Etherscan docs](https://docs.etherscan.io/etherscan-v2/getting-started/supported-chains). ```ts // {"path":"/vercel/path0/site/cli/api/plugins/etherscan.md","from":2075,"to":2673} import { defineConfig } from '@wagmi/cli' import { etherscan } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ etherscan({ apiKey: process.env.ETHERSCAN_API_KEY, chainId: 1, // [!code focus] contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, { name: 'EnsRegistry', address: { 1: '0x314159265dd8dbb310642f98f50c066173c1259b', 5: '0x112234455c3a32fd11230c42e7bccd4a84e02010', }, }, ], }), ], }) ``` ### contracts `{ name: string; address?: Address | Record | undefined }[]` Contracts to fetch ABIs for. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/etherscan.md","from":2808,"to":3283} import { defineConfig } from '@wagmi/cli' import { etherscan } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ etherscan({ apiKey: process.env.ETHERSCAN_API_KEY, chainId: 1, contracts: [ // [!code focus] { // [!code focus] name: 'Wagmigotchi', // [!code focus] address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', // [!code focus] }, // [!code focus] ], // [!code focus] }), ], }) ``` ### tryFetchProxyImplementation `boolean | undefined` * Whether to try fetching proxy implementation address of the contract. * Defaults to `false`. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/etherscan.md","from":3446,"to":3875} import { defineConfig } from '@wagmi/cli' import { etherscan } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ etherscan({ apiKey: process.env.ETHERSCAN_API_KEY, chainId: 1, contracts: [ { name: 'FiatToken', address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', }, ], tryFetchProxyImplementation: true, // [!code focus] }), ], }) ``` --- --- url: /core/api/transports/fallback.md --- # fallback The `fallback` Transport consumes **multiple** Transports. If a Transport request fails, it will fall back to the next one in the list. Wraps Viem's [`fallback` Transport](https://viem.sh/docs/clients/transports/fallback). ## Import ```ts-vue import { fallback } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, fallback, // [!code hl] http, } from '{{packageName}}' import { mainnet } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet], connectors: [injected()], transports: { [mainnet.id]: fallback([ // [!code hl] http('https://foo-bar-baz.quiknode.pro/...'), // [!code hl] http('https://mainnet.infura.io/v3/...'), // [!code hl] ]) // [!code hl] }, }) ``` --- --- url: /react/api/transports/fallback.md --- # fallback The `fallback` Transport consumes **multiple** Transports. If a Transport request fails, it will fall back to the next one in the list. Wraps Viem's [`fallback` Transport](https://viem.sh/docs/clients/transports/fallback). ## Import ```ts-vue import { fallback } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, fallback, // [!code hl] http, } from '{{packageName}}' import { mainnet } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet], connectors: [injected()], transports: { [mainnet.id]: fallback([ // [!code hl] http('https://foo-bar-baz.quiknode.pro/...'), // [!code hl] http('https://mainnet.infura.io/v3/...'), // [!code hl] ]) // [!code hl] }, }) ``` --- --- url: /shared/transports/fallback.md --- # fallback The `fallback` Transport consumes **multiple** Transports. If a Transport request fails, it will fall back to the next one in the list. Wraps Viem's [`fallback` Transport](https://viem.sh/docs/clients/transports/fallback). ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/transports/fallback.md","from":320,"to":363} import { fallback } from '{{packageName}}' ``` ## Usage ```ts-vue // {"path":"/vercel/path0/site/shared/transports/fallback.md","from":388,"to":826} import { createConfig, fallback, // [!code hl] http, } from '{{packageName}}' import { mainnet } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet], connectors: [injected()], transports: { [mainnet.id]: fallback([ // [!code hl] http('https://foo-bar-baz.quiknode.pro/...'), // [!code hl] http('https://mainnet.infura.io/v3/...'), // [!code hl] ]) // [!code hl] }, }) ``` --- --- url: /solid/api/transports/fallback.md --- # fallback The `fallback` Transport consumes **multiple** Transports. If a Transport request fails, it will fall back to the next one in the list. Wraps Viem's [`fallback` Transport](https://viem.sh/docs/clients/transports/fallback). ## Import ```ts-vue import { fallback } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, fallback, // [!code hl] http, } from '{{packageName}}' import { mainnet } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet], connectors: [injected()], transports: { [mainnet.id]: fallback([ // [!code hl] http('https://foo-bar-baz.quiknode.pro/...'), // [!code hl] http('https://mainnet.infura.io/v3/...'), // [!code hl] ]) // [!code hl] }, }) ``` --- --- url: /vue/api/transports/fallback.md --- # fallback The `fallback` Transport consumes **multiple** Transports. If a Transport request fails, it will fall back to the next one in the list. Wraps Viem's [`fallback` Transport](https://viem.sh/docs/clients/transports/fallback). ## Import ```ts-vue import { fallback } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, fallback, // [!code hl] http, } from '{{packageName}}' import { mainnet } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet], connectors: [injected()], transports: { [mainnet.id]: fallback([ // [!code hl] http('https://foo-bar-baz.quiknode.pro/...'), // [!code hl] http('https://mainnet.infura.io/v3/...'), // [!code hl] ]) // [!code hl] }, }) ``` --- --- url: /core/guides/faq.md --- # FAQ / Troubleshooting Collection of frequently asked questions with ideas on how to troubleshoot and resolve them. ## How do I support the project? Wagmi is an open source software project and free to use. If you enjoy using Wagmi or would like to support Wagmi development, you can: * [Become a sponsor on GitHub](https://github.com/sponsors/wevm) * Send us crypto * Mainnet: 0x4557B18E779944BFE9d78A672452331C186a9f48 * Multichain: 0xd2135CfB216b74109775236E36d4b433F1DF507B * [Become a supporter on Drips](https://www.drips.network/app/projects/github/wevm/wagmi) If you use Wagmi at work, **consider asking your company to sponsor Wagmi**. This may not be easy, but **business sponsorships typically make a much larger impact on the sustainability of OSS projects** than individual donations, so you will help us much more if you succeed. ## Type inference doesn't work * Check that you set up TypeScript correctly with `"strict": true` in your `tsconfig.json` (TypeScript docs) * Check that you const-asserted any ABIs or Typed Data you are using. * Restart your language server or IDE, and check for type errors in your code. ## My wallet doesn't work If you run into issues with a specific wallet, try another before opening up an issue. There are many different wallets and it's likely that the issue is with the wallet itself, not Wagmi. For example, if you are using Wallet X and sending a transaction doesn't work, try Wallet Y and see if it works. ## `BigInt` Serialization Using native `BigInt` with `JSON.stringify` will raise a `TypeError` as [`BigInt` values are not serializable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json). There are two techniques to mitigate this: #### Lossless serialization Lossless serialization means that `BigInt` will be converted to a format that can be deserialized later (e.g. `69420n` → `"#bigint.69420"`). The trade-off is that these values are not human-readable and are not intended to be displayed to the user. Lossless serialization can be achieved with wagmi's `serialize` and `deserialize` utilities. ```tsx import { serialize, deserialize } from 'wagmi' const serialized = serialize({ value: 69420n }) // '{"value":"#bigint.69420"}' const deserialized = deserialize(serialized) // { value: 69420n } ``` #### Lossy serialization Lossy serialization means that the `BigInt` will be converted to a normal display string (e.g. `69420n` → `'69420'`). The trade-off is that you will not be able to deserialize the `BigInt` with `JSON.parse` as it can not distinguish between a normal string and a `BigInt`. This method can be achieved by modifying `JSON.stringify` to include a BigInt `replacer`: ```tsx const replacer = (key, value) => typeof value === 'bigint' ? value.toString() : value JSON.stringify({ value: 69420n }, replacer) // '{"value":"69420"}' ``` ## Is Wagmi production ready? Yes. Wagmi is very stable and is used in production by thousands of organizations, like [Stripe](https://stripe.com), [Shopify](https://shopify.com), [Coinbase](https://coinbase.com), [Uniswap](https://uniswap.org), [ENS](https://ens.domains), [Optimism](https://optimism.com). ## Is Wagmi strict with semver? Yes, Wagmi is very strict with [semantic versioning](https://semver.org) and we will never introduce breaking changes to the runtime API in a minor version bump. For exported types, we try our best to not introduce breaking changes in non-major versions, however, [TypeScript doesn't follow semver](https://www.learningtypescript.com/articles/why-typescript-doesnt-follow-strict-semantic-versioning) and often introduces breaking changes in minor releases that can cause Wagmi type issues. See the TypeScript docs for more information. ## How can I contribute to Wagmi? The Wagmi team accepts all sorts of contributions. Check out the [Contributing](/dev/contributing) guide to get started. If you are interested in adding a new connector to Wagmi, check out the [Creating Connectors](/dev/creating-connectors) guide. ## Anything else you want to know? Please create a new [GitHub Discussion thread](https://github.com/wevm/wagmi). You're also free to suggest changes to this or any other page on the site using the "Suggest changes to this page" button at the bottom of the page. --- --- url: /react/guides/faq.md --- # FAQ / Troubleshooting Collection of frequently asked questions with ideas on how to troubleshoot and resolve them. ## How do I support the project? Wagmi is an open source software project and free to use. If you enjoy using Wagmi or would like to support Wagmi development, you can: * [Become a sponsor on GitHub](https://github.com/sponsors/wevm) * Send us crypto * Mainnet: 0x4557B18E779944BFE9d78A672452331C186a9f48 * Multichain: 0xd2135CfB216b74109775236E36d4b433F1DF507B * [Become a supporter on Drips](https://www.drips.network/app/projects/github/wevm/wagmi) If you use Wagmi at work, **consider asking your company to sponsor Wagmi**. This may not be easy, but **business sponsorships typically make a much larger impact on the sustainability of OSS projects** than individual donations, so you will help us much more if you succeed. ## Type inference doesn't work * Check that you set up TypeScript correctly with `"strict": true` in your `tsconfig.json` (TypeScript docs) * Check that you const-asserted any ABIs or Typed Data you are using. * Restart your language server or IDE, and check for type errors in your code. ## My wallet doesn't work If you run into issues with a specific wallet, try another before opening up an issue. There are many different wallets and it's likely that the issue is with the wallet itself, not Wagmi. For example, if you are using Wallet X and sending a transaction doesn't work, try Wallet Y and see if it works. ## `BigInt` Serialization Using native `BigInt` with `JSON.stringify` will raise a `TypeError` as [`BigInt` values are not serializable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json). There are two techniques to mitigate this: #### Lossless serialization Lossless serialization means that `BigInt` will be converted to a format that can be deserialized later (e.g. `69420n` → `"#bigint.69420"`). The trade-off is that these values are not human-readable and are not intended to be displayed to the user. Lossless serialization can be achieved with wagmi's `serialize` and `deserialize` utilities. ```tsx import { serialize, deserialize } from 'wagmi' const serialized = serialize({ value: 69420n }) // '{"value":"#bigint.69420"}' const deserialized = deserialize(serialized) // { value: 69420n } ``` #### Lossy serialization Lossy serialization means that the `BigInt` will be converted to a normal display string (e.g. `69420n` → `'69420'`). The trade-off is that you will not be able to deserialize the `BigInt` with `JSON.parse` as it can not distinguish between a normal string and a `BigInt`. This method can be achieved by modifying `JSON.stringify` to include a BigInt `replacer`: ```tsx const replacer = (key, value) => typeof value === 'bigint' ? value.toString() : value JSON.stringify({ value: 69420n }, replacer) // '{"value":"69420"}' ``` ## Is Wagmi production ready? Yes. Wagmi is very stable and is used in production by thousands of organizations, like [Stripe](https://stripe.com), [Shopify](https://shopify.com), [Coinbase](https://coinbase.com), [Uniswap](https://uniswap.org), [ENS](https://ens.domains), [Optimism](https://optimism.com). ## Is Wagmi strict with semver? Yes, Wagmi is very strict with [semantic versioning](https://semver.org) and we will never introduce breaking changes to the runtime API in a minor version bump. For exported types, we try our best to not introduce breaking changes in non-major versions, however, [TypeScript doesn't follow semver](https://www.learningtypescript.com/articles/why-typescript-doesnt-follow-strict-semantic-versioning) and often introduces breaking changes in minor releases that can cause Wagmi type issues. See the TypeScript docs for more information. ## How can I contribute to Wagmi? The Wagmi team accepts all sorts of contributions. Check out the [Contributing](/dev/contributing) guide to get started. If you are interested in adding a new connector to Wagmi, check out the [Creating Connectors](/dev/creating-connectors) guide. ## Anything else you want to know? Please create a new [GitHub Discussion thread](https://github.com/wevm/wagmi). You're also free to suggest changes to this or any other page on the site using the "Suggest changes to this page" button at the bottom of the page. ## How does Wagmi work? Until there's a more in-depth write-up about Wagmi internals, here is the gist: * Wagmi is essentially a wrapper around [Viem](https://viem.sh) and TanStack Query that adds connector and multichain support. * [Connectors](/react/api/connectors) allow Wagmi and Ethereum accounts to communicate with each other. * The Wagmi [`Config`](/react/api/createConfig#config) manages connections established between Wagmi and Connectors, as well as some global state. [Connections](/react/api/createConfig#connection) come with one or more addresses and a chain ID. * If there are connections, the Wagmi `Config` listens for connection changes and updates the [`chainId`](/react/api/createConfig#chainid) based on the ["current" connection](/react/api/createConfig#current). (The Wagmi `Config` can have [many connections established](/react/api/createConfig#connections) at once, but only one connection can be the "current" connection. Usually this is the connection from the last connector that is connected, but can change based on event emitted from other connectors or through the [`useSwitchConnection`](/react/api/hooks/useSwitchConnection) hook and [`switchConnection`](/core/api/actions/switchConnection) action.) * If there are no connections, the Wagmi `Config` defaults the global state `chainId` to the first chain it was created with or last established connection. * The global `chainId` can be changed directly using the [`useSwitchChain`](/react/api/hooks/useSwitchChain) hook and [`switchChain`](/core/api/actions/switchChain) action. This works when there are no connections as well as for most connectors (not all connectors support chain switching). * Wagmi uses the global `chainId` (from the "current" connection or global state) to internally create Viem Client's, which are used by hooks and actions. * Hooks are constructed by TanStack Query options helpers, exported by the `'@wagmi/core/query'` entrypoint, and some additional code to wire up type parameters, hook into React Context, etc. * There are three types of hooks: query hooks, mutation hooks, and config hooks. Query hooks, like [`useCall`](/react/api/hooks/useCall), generally read blockchain state and mutation hooks, like [`useSendTransaction`](/react/api/hooks/useSendTransaction), usually change state through sending transactions via the "current" connection. Config hooks are for getting data from and managing the Wagmi `Config` instance, e.g. [`useChainId`](/react/api/hooks/useChainId) and `useSwitchConnection`. Query and mutation hooks usually have corresponding [Viem actions.](https://viem.sh) --- --- url: /vue/guides/faq.md --- # FAQ / Troubleshooting Collection of frequently asked questions with ideas on how to troubleshoot and resolve them. ## How do I support the project? Wagmi is an open source software project and free to use. If you enjoy using Wagmi or would like to support Wagmi development, you can: * [Become a sponsor on GitHub](https://github.com/sponsors/wevm) * Send us crypto * Mainnet: 0x4557B18E779944BFE9d78A672452331C186a9f48 * Multichain: 0xd2135CfB216b74109775236E36d4b433F1DF507B * [Become a supporter on Drips](https://www.drips.network/app/projects/github/wevm/wagmi) If you use Wagmi at work, **consider asking your company to sponsor Wagmi**. This may not be easy, but **business sponsorships typically make a much larger impact on the sustainability of OSS projects** than individual donations, so you will help us much more if you succeed. ## Type inference doesn't work * Check that you set up TypeScript correctly with `"strict": true` in your `tsconfig.json` (TypeScript docs) * Check that you const-asserted any ABIs or Typed Data you are using. * Restart your language server or IDE, and check for type errors in your code. ## My wallet doesn't work If you run into issues with a specific wallet, try another before opening up an issue. There are many different wallets and it's likely that the issue is with the wallet itself, not Wagmi. For example, if you are using Wallet X and sending a transaction doesn't work, try Wallet Y and see if it works. ## `BigInt` Serialization Using native `BigInt` with `JSON.stringify` will raise a `TypeError` as [`BigInt` values are not serializable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json). There are two techniques to mitigate this: #### Lossless serialization Lossless serialization means that `BigInt` will be converted to a format that can be deserialized later (e.g. `69420n` → `"#bigint.69420"`). The trade-off is that these values are not human-readable and are not intended to be displayed to the user. Lossless serialization can be achieved with wagmi's `serialize` and `deserialize` utilities. ```tsx import { serialize, deserialize } from 'wagmi' const serialized = serialize({ value: 69420n }) // '{"value":"#bigint.69420"}' const deserialized = deserialize(serialized) // { value: 69420n } ``` #### Lossy serialization Lossy serialization means that the `BigInt` will be converted to a normal display string (e.g. `69420n` → `'69420'`). The trade-off is that you will not be able to deserialize the `BigInt` with `JSON.parse` as it can not distinguish between a normal string and a `BigInt`. This method can be achieved by modifying `JSON.stringify` to include a BigInt `replacer`: ```tsx const replacer = (key, value) => typeof value === 'bigint' ? value.toString() : value JSON.stringify({ value: 69420n }, replacer) // '{"value":"69420"}' ``` ## Is Wagmi production ready? Yes. Wagmi is very stable and is used in production by thousands of organizations, like [Stripe](https://stripe.com), [Shopify](https://shopify.com), [Coinbase](https://coinbase.com), [Uniswap](https://uniswap.org), [ENS](https://ens.domains), [Optimism](https://optimism.com). ## Is Wagmi strict with semver? Yes, Wagmi is very strict with [semantic versioning](https://semver.org) and we will never introduce breaking changes to the runtime API in a minor version bump. For exported types, we try our best to not introduce breaking changes in non-major versions, however, [TypeScript doesn't follow semver](https://www.learningtypescript.com/articles/why-typescript-doesnt-follow-strict-semantic-versioning) and often introduces breaking changes in minor releases that can cause Wagmi type issues. See the TypeScript docs for more information. ## How can I contribute to Wagmi? The Wagmi team accepts all sorts of contributions. Check out the [Contributing](/dev/contributing) guide to get started. If you are interested in adding a new connector to Wagmi, check out the [Creating Connectors](/dev/creating-connectors) guide. ## Anything else you want to know? Please create a new [GitHub Discussion thread](https://github.com/wevm/wagmi). You're also free to suggest changes to this or any other page on the site using the "Suggest changes to this page" button at the bottom of the page. --- --- url: /cli/api/plugins/fetch.md --- # fetch Plugin for fetching and parsing ABIs from network resource with `fetch`. ## Import ```ts // {"path":"/vercel/path0/site/cli/api/plugins/fetch.md","from":100,"to":143} import { fetch } from '@wagmi/cli/plugins' ``` ## Usage ```ts{2,6-23} // {"path":"/vercel/path0/site/cli/api/plugins/fetch.md","from":172,"to":853} import { defineConfig } from '@wagmi/cli' import { fetch } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ fetch({ contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], request(contract) { if (!contract.address) throw new Error('address is required') const address = typeof contract.address === 'string' ? contract.address : Object.values(contract.address)[0] return { url: `https://api.etherscan.io/api?module=contract&action=getabi&address=${address}`, } }, }), ], }) ``` ## Configuration ```ts // {"path":"/vercel/path0/site/cli/api/plugins/fetch.md","from":883,"to":937} import { type FetchConfig } from '@wagmi/cli/plugins' ``` ### cacheDuration `number | undefined` * Duration in milliseconds to cache ABIs. * Defaults to `1_800_000` (30 minutes). ```ts // {"path":"/vercel/path0/site/cli/api/plugins/fetch.md","from":1072,"to":1800} import { defineConfig } from '@wagmi/cli' import { fetch } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ fetch({ cacheDuration: 300_000, // [!code focus] contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], request(contract) { if (!contract.address) throw new Error('address is required') const address = typeof contract.address === 'string' ? contract.address : Object.values(contract.address)[0] return { url: `https://api.etherscan.io/api?module=contract&action=getabi&address=${address}`, } }, }), ], }) ``` ### contracts `{ name: string; address?: Address | Record | undefined }[]` Contracts to fetch ABIs for. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/fetch.md","from":1935,"to":2719} import { defineConfig } from '@wagmi/cli' import { fetch } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ fetch({ contracts: [ // [!code focus] { // [!code focus] name: 'Wagmigotchi', // [!code focus] address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', // [!code focus] }, // [!code focus] ], // [!code focus] request(contract) { if (!contract.address) throw new Error('address is required') const address = typeof contract.address === 'string' ? contract.address : Object.values(contract.address)[0] return { url: `https://api.etherscan.io/api?module=contract&action=getabi&address=${address}`, } }, }), ], }) ``` ### getCacheKey `((config: { contract: { address: Address | Record | undefined; name: string } }) => string) | undefined` * Function for creating a cache key for contract. Contract data is cached at `~/.wagmi-cli/plugins/fetch/cache/`. * Defaults to `({ contract }) => JSON.stringify(contract)`. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/fetch.md","from":3047,"to":4015} import { defineConfig } from '@wagmi/cli' import { fetch } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ fetch({ contracts: [ { name: 'wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], getCacheKey({ contract }) { // [!code focus] if (typeof contract.address === 'string') // [!code focus] return `${name}:${contract.address}` // [!code focus] return `${name}:${JSON.stringify(contract.address)}` // [!code focus] }, // [!code focus] request(contract) { if (!contract.address) throw new Error('address is required') const address = typeof contract.address === 'string' ? contract.address : Object.values(contract.address)[0] return { url: `https://api.etherscan.io/api?module=contract&action=getabi&address=${address}`, } }, }), ], }) ``` ### name `string` * Name of source. * Defaults to `'Fetch'`. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/fetch.md","from":4090,"to":4813} import { defineConfig } from '@wagmi/cli' import { fetch } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ fetch({ contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], name: 'Etherscan', // [!code focus] request(contract) { if (!contract.address) throw new Error('address is required') const address = typeof contract.address === 'string' ? contract.address : Object.values(contract.address)[0] return { url: `https://api.etherscan.io/api?module=contract&action=getabi&address=${address}`, } }, }), ], }) ``` ### parse `((config: { response: Response }) => Abi | Promise) | undefined` * Function for parsing ABI from fetch response. * Defaults to `({ response }) => response.json()` ```ts // {"path":"/vercel/path0/site/cli/api/plugins/fetch.md","from":5006,"to":5949} import { defineConfig } from '@wagmi/cli' import { fetch } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ fetch({ contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], async parse({ response }) { // [!code focus] const json = await response.json() // [!code focus] if (json.status === '0') throw new Error(json.message) // [!code focus] return json.result // [!code focus] }, // [!code focus] request(contract) { if (!contract.address) throw new Error('address is required') const address = typeof contract.address === 'string' ? contract.address : Object.values(contract.address)[0] return { url: `https://api.etherscan.io/api?module=contract&action=getabi&address=${address}`, } }, }), ], }) ``` ### request `(config: { address?: Address | Record | undefined }) => { url: RequestInfo; init?: RequestInit | undefined } | Promise<{ url: RequestInfo; init?: RequestInit | undefined }>` Function for returning a request to fetch ABI from. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/fetch.md","from":6220,"to":7072} import { defineConfig } from '@wagmi/cli' import { fetch } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ fetch({ contracts: [ { name: 'Wagmigotchi', address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', }, ], request(contract) { // [!code focus] if (!contract.address) throw new Error('address is required') // [!code focus] const address = // [!code focus] typeof contract.address === 'string' // [!code focus] ? contract.address // [!code focus] : Object.values(contract.address)[0] // [!code focus] return { // [!code focus] url: `https://api.etherscan.io/api?module=contract&action=getabi&address=${address}`, // [!code focus] } // [!code focus] }, // [!code focus] }), ], }) ``` --- --- url: /cli/api/plugins/foundry.md --- # foundry Plugin for resolving ABIs from [Foundry](https://github.com/foundry-rs/foundry) projects. Supports [`watch`](/cli/api/commands/generate#w-watch) mode. ## Import ```ts // {"path":"/vercel/path0/site/cli/api/plugins/foundry.md","from":180,"to":225} import { foundry } from '@wagmi/cli/plugins' ``` ## Usage ```ts{2,6-8} // {"path":"/vercel/path0/site/cli/api/plugins/foundry.md","from":253,"to":449} import { defineConfig } from '@wagmi/cli' import { foundry } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ foundry({ project: '../hello_foundry', }), ], }) ``` ## Configuration ```ts // {"path":"/vercel/path0/site/cli/api/plugins/foundry.md","from":478,"to":534} import { type FoundryConfig } from '@wagmi/cli/plugins' ``` ### artifacts `string | undefined` * Project's artifacts directory. Same as your `foundry.toml`/`forge`s `--out` (`-o`) option. * Defaults to `'out/'`. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/foundry.md","from":700,"to":903} import { defineConfig } from '@wagmi/cli' import { foundry } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ foundry({ artifacts: 'out/', // [!code focus] }), ], }) ``` ### includeBroadcasts `boolean | undefined` Automatically detect contract deployments from Foundry's `run-latest.json` files in the `broadcast/` directory. * The `deployments` mapping can be used to override broadcast deployments for the same contract. * Broadcasts are read once when `wagmi generate` runs. To pick up new broadcast deployments after running deploy scripts, rerun the generate command. * Defaults to `false`. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/foundry.md","from":1344,"to":1553} import { defineConfig } from '@wagmi/cli' import { foundry } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ foundry({ includeBroadcasts: true, // [!code focus] }), ], }) ``` ### deployments `{ [key: string]: address?: Address | Record | undefined } | undefined` Mapping of addresses to attach to artifacts. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/foundry.md","from":1718,"to":2159} import { defineConfig } from '@wagmi/cli' import { foundry } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ foundry({ deployments: { // [!code focus] Counter: { // [!code focus] 1: '0x314159265dd8dbb310642f98f50c066173c1259b', // [!code focus] 5: '0x112234455c3a32fd11230c42e7bccd4a84e02010', // [!code focus] }, // [!code focus] }, // [!code focus] }), ], }) ``` ### exclude `string[] | undefined` Artifact files to exclude relative to `artifacts`. Supports glob patterns. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/foundry.md","from":2283,"to":3324} import { defineConfig } from '@wagmi/cli' import { foundry } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ foundry({ exclude: [ // [!code focus] // the following patterns are excluded by default // [!code focus] 'Common.sol/**', // [!code focus] 'Components.sol/**', // [!code focus] 'Script.sol/**', // [!code focus] 'StdAssertions.sol/**', // [!code focus] 'StdInvariant.sol/**', // [!code focus] 'StdError.sol/**', // [!code focus] 'StdCheats.sol/**', // [!code focus] 'StdMath.sol/**', // [!code focus] 'StdJson.sol/**', // [!code focus] 'StdStorage.sol/**', // [!code focus] 'StdUtils.sol/**', // [!code focus] 'Vm.sol/**', // [!code focus] 'console.sol/**', // [!code focus] 'console2.sol/**', // [!code focus] 'test.sol/**', // [!code focus] '**.s.sol/*.json', // [!code focus] '**.t.sol/*.json', // [!code focus] ], // [!code focus] }), ], }) ``` ### forge `{ clean?: boolean | undefined; build?: boolean | undefined; path?: string | undefined; rebuild?: boolean | undefined } | undefined` Options for `forge`. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/foundry.md","from":3502,"to":3891} import { defineConfig } from '@wagmi/cli' import { foundry } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ foundry({ forge: { // [!code focus] clean: true, // [!code focus] build: true, // [!code focus] path: 'path/to/forge', // [!code focus] rebuild: true, // [!code focus] }, // [!code focus] }), ], }) ``` #### clean * Remove build artifacts and cache directories on start up. * Defaults to `false`. #### build * Build Foundry project before fetching artifacts. * Defaults to `true`. #### path * Path to `forge` executable command. * Defaults to `forge`. #### rebuild * Rebuild every time a watched file or directory is changed. Used for setting up [`watch`](/cli/api/commands/generate#w-watch) mode. * Defaults to `true`. ### include `string[] | undefined` Artifact files to include relative to `artifacts`. Supports glob patterns. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/foundry.md","from":4440,"to":4775} import { defineConfig } from '@wagmi/cli' import { foundry } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ foundry({ include: [ // [!code focus] // the following patterns are included by default // [!code focus] '*.json', // [!code focus] ], // [!code focus] }), ], }) ``` ### namePrefix `string | undefined` Prefix to prepend to artifact names. Useful for preventing name collisions between contracts from other sources. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/foundry.md","from":4938,"to":5187} import { defineConfig } from '@wagmi/cli' import { foundry } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ foundry({ // [!code focus] namePrefix: 'HelloFoundry', // [!code focus] }), // [!code focus] ], }) ``` ### project `string | undefined` * Path to Foundry project. * Defaults to Foundry configuration using `forge config --json` command. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/foundry.md","from":5334,"to":5581} import { defineConfig } from '@wagmi/cli' import { foundry } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ foundry({ // [!code focus] project: '../hello_foundry', // [!code focus] }), // [!code focus] ], }) ``` --- --- url: /core/guides/framework-adapters.md --- # Framework Adapters Folks often ask if they can use Wagmi with other frameworks, like Svelte, Solid.js, and more. The short answer is — you already can! Wagmi Core is pure VanillaJS that you can use with any framework. For some, this answer is (understandably) unsatisfying as they want a tight integration between Wagmi Core and their favorite framework's reactivity system, e.g. what Wagmi is for React and Vue. Someday, we would love to support additional frameworks, but unfortunately the core team doesn't have time to build and support them in a high-quality way at the moment. This could change in the future with additional [sponsors](https://github.com/sponsors/wevm), reshuffling of the roadmap, or if someone from the community wants to lead the effort. In the meantime, here are some tips on how to create tighter bonds between Wagmi Core and other frameworks. ## Dependency Injection Once you create a Wagmi Config, you'll need to make sure your framework has access to it inside your higher-level functions (e.g. hooks for React, composables for Vue). For example, Wagmi uses [React Context](https://react.dev/learn/passing-data-deeply-with-context) to inject the Config into React Hooks and update it if it changes. This makes it so your users don't need to pass a Config object every time they use a hook. ## Reactivity Layer All frameworks approach reactivity in a different way. To hook into your favorite frameworks, reactivity system, it's often helpful to see what other popular libraries for your framework are doing. The most important thing to hook up Wagmi Core with your framework is to make sure changes to the Wagmi Config are tracked. This enables behavior, like switching chains or connecting accounts, to propagate throughout your app and update state. Check out [`useConnection`](https://github.com/wevm/wagmi/blob/main/packages/react/src/hooks/useConnection.ts), [`useChainId`](https://github.com/wevm/wagmi/blob/main/packages/react/src/hooks/useChainId.ts), [`useClient`](https://github.com/wevm/wagmi/blob/main/packages/react/src/hooks/useClient.ts), and [`useConnectorClient`](https://github.com/wevm/wagmi/blob/main/packages/react/src/hooks/useConnectorClient.ts) — versions of these for your framework are important to get right as they power a lot of internals. ## TanStack Query Wagmi uses [TanStack Query](https://tanstack.com/query) to enable caching, deduplication, persistence, and more in React and Vue applications. Normally, you would need to find a similar library for your framework, but the good news is TanStack Query supports other frameworks! (Svelte, Solid, and Angular at the time of writing.) To get started with your framework, install and set up the related TanStack Query adapter. Next, import query keys/functions and mutation functions from the `'@wagmi/core/query'` entrypoint. You can plug these directly into your framework's TanStack Query adapter functions. If you are building a library, you'll also want to make sure that you wire up generics correctly so type-inference and safety work correctly. The best way to make sure you are doing this correctly, is to see how we do this for React with Wagmi by checking out the [source code](https://github.com/wevm/wagmi/tree/main/packages/react/src/hooks). ## Testing If you are building a library, you'll want to write tests. Wagmi uses [React Testing Library](https://testing-library.com/docs/react-testing-library/intro) to test hooks. [Testing Library](https://testing-library.com) also supports other frameworks, like Svelte, Solid, and more. You can take a look at how the React tests work and do something similar for your code. ## Proxy Exports Wagmi proxies exports directly from Wagmi Core and [Viem](https://viem.sh) to make importing easier. You'll likely want to imitate this behavior for your framework. --- --- url: /cli/api/commands/generate.md --- # generate Generates code based on configuration, using `contracts` and `plugins`. ## Usage ```bash // {"path":"/vercel/path0/site/cli/api/commands/generate.md","from":103,"to":119} wagmi generate ``` ## Options ### -c, --config \ `string` Path to config file. ```bash // {"path":"/vercel/path0/site/cli/api/commands/generate.md","from":203,"to":243} wagmi generate --config wagmi.config.ts ``` ### -r, --root \ `string` Root path to resolve config from. ```bash // {"path":"/vercel/path0/site/cli/api/commands/generate.md","from":326,"to":361} wagmi generate --root path/to/root ``` ### -w, --watch `boolean` Watch for changes (for plugins that support watch mode). ```bash // {"path":"/vercel/path0/site/cli/api/commands/generate.md","from":460,"to":483} wagmi generate --watch ``` ### -h, --help Displays help message. ```bash // {"path":"/vercel/path0/site/cli/api/commands/generate.md","from":536,"to":558} wagmi generate --help ``` --- --- url: /core/api/actions/getBalance.md --- # getBalance Action for fetching native currency balance. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getBalance.md","from":199,"to":240} import { getBalance } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBalance.md","from":287,"to":460} import { getBalance } from '@wagmi/core' import { config } from './config' const balance = getBalance(config, { address: '0x4557B18E779944BFE9d78A672452331C186a9f48', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getBalance.md","from":531,"to":587} import { type GetBalanceParameters } from '@wagmi/core' ``` ### address `Address` Address to get balance for. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBalance.md","from":677,"to":867} import { getBalance } from '@wagmi/core' import { config } from './config' const balance = getBalance(config, { address: '0x4557B18E779944BFE9d78A672452331C186a9f48', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### blockNumber `bigint | undefined` Block number to get balance at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBalance.md","from":1026,"to":1242} import { getBalance } from '@wagmi/core' import { config } from './config' const balance = getBalance(config, { address: '0x4557B18E779944BFE9d78A672452331C186a9f48', blockNumber: 17829139n, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get balance at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBalance.md","from":1440,"to":1652} import { getBalance } from '@wagmi/core' import { config } from './config' const balance = getBalance(config, { address: '0x4557B18E779944BFE9d78A672452331C186a9f48', blockTag: 'latest', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBalance.md","from":1838,"to":2102} import { getBalance } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const balance = await getBalance(config, { address: '0x4557B18E779944BFE9d78A672452331C186a9f48', chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getBalance.md","from":2174,"to":2230} import { type GetBalanceReturnType } from '@wagmi/core' ``` ### decimals `number` Number of decimals for balance [`value`](#value). ### symbol `string` Symbol of native currency. ### value `bigint` Raw value of balance. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getBalance.md","from":2420,"to":2475} import { type GetBalanceErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getBalance`](https://viem.sh/docs/actions/public/getBalance) for native currency balances * [`multicall`](https://viem.sh/docs/contract/multicall) for token balances --- --- url: /core/api/actions/getBlobBaseFee.md --- # getBlobBaseFee Action for fetching the current blob base fee (in wei). ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlobBaseFee.md","from":222,"to":267} import { getBlobBaseFee } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBlobBaseFee.md","from":314,"to":443} import { getBlobBaseFee } from '@wagmi/core' import { config } from './config' const blobBaseFee = await getBlobBaseFee(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlobBaseFee.md","from":514,"to":574} import { type GetBlobBaseFeeParameters } from '@wagmi/core' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBlobBaseFee.md","from":710,"to":929} import { getBlobBaseFee } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const blobBaseFee = await getBlobBaseFee(config, { chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlobBaseFee.md","from":1001,"to":1061} import { type GetBlobBaseFeeReturnType } from '@wagmi/core' ``` `bigint` Current blob base fee (in wei). ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlobBaseFee.md","from":1125,"to":1184} import { type GetBlobBaseFeeErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getBlobBaseFee`](https://viem.sh/docs/actions/public/getBlobBaseFee) --- --- url: /core/api/actions/getBlock.md --- # getBlock Action for fetching information about a block at a block number, hash or tag. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlock.md","from":226,"to":265} import { getBlock } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBlock.md","from":312,"to":429} import { getBlock } from '@wagmi/core' import { config } from './config' const blockNumber = await getBlock(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlock.md","from":500,"to":554} import { type GetBlockParameters } from '@wagmi/core' ``` ### blockHash `` `0x${string}` `` Information at a given block hash. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBlock.md","from":663,"to":884} import { getBlock } from '@wagmi/core' import { config } from './config' const blockNumber = await getBlock(config, { blockHash: '0x89644bbd5c8d682a2e9611170e6c1f02573d866d286f006cbf517eec7254ec2d' // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint` Information at a given block number. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBlock.md","from":1035,"to":1196} import { getBlock } from '@wagmi/core' import { config } from './config' const blockNumber = await getBlock(config, { blockNumber: 42069n // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'` Information at a given block tag. Defaults to `'latest'`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBlock.md","from":1415,"to":1576} import { getBlock } from '@wagmi/core' import { config } from './config' const blockNumber = await getBlock(config, { blockTag: 'pending' // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBlock.md","from":1757,"to":1964} import { getBlock } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const blockNumber = await getBlock(config, { chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### includeTransactions `boolean` Whether or not to include transactions as objects. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBlock.md","from":2134,"to":2301} import { getBlock } from '@wagmi/core' import { config } from './config' const blockNumber = await getBlock(config, { includeTransactions: true // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlock.md","from":2373,"to":2427} import { type GetBlockReturnType } from '@wagmi/core' ``` [`Block`](https://viem.sh/docs/glossary/types#block) Information about the block. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlock.md","from":2532,"to":2585} import { type GetBlockErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getBlock`](https://viem.sh/docs/actions/public/getBlock) --- --- url: /core/api/actions/getBlockNumber.md --- # getBlockNumber Action for fetching the number of the most recent block seen. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlockNumber.md","from":228,"to":273} import { getBlockNumber } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBlockNumber.md","from":320,"to":449} import { getBlockNumber } from '@wagmi/core' import { config } from './config' const blockNumber = await getBlockNumber(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlockNumber.md","from":520,"to":580} import { type GetBlockNumberParameters } from '@wagmi/core' ``` ### cacheTime `number | undefined` Time in milliseconds that cached block number will remain in memory. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBlockNumber.md","from":724,"to":895} import { getBlockNumber } from '@wagmi/core' import { config } from './config' const blockNumber = await getBlockNumber(config, { cacheTime: 4_000, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBlockNumber.md","from":1076,"to":1295} import { getBlockNumber } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const blockNumber = await getBlockNumber(config, { chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlockNumber.md","from":1367,"to":1427} import { type GetBlockNumberReturnType } from '@wagmi/core' ``` `bigint` Most recent block number seen. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlockNumber.md","from":1490,"to":1549} import { type GetBlockNumberErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getBlockNumber`](https://viem.sh/docs/actions/public/getBlockNumber) * [`watchBlockNumber`](https://viem.sh/docs/actions/public/watchBlockNumber) --- --- url: /core/api/actions/getBlockTransactionCount.md --- # getBlockTransactionCount Action for fetching the number of Transactions at a block number, hash or tag. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlockTransactionCount.md","from":275,"to":330} import { getBlockTransactionCount } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBlockTransactionCount.md","from":377,"to":536} import { getBlockTransactionCount } from '@wagmi/core' import { config } from './config' const blockTransactionCount = await getBlockTransactionCount(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlockTransactionCount.md","from":607,"to":677} import { type GetBlockTransactionCountParameters } from '@wagmi/core' ``` ### cacheTime `number | undefined` Time in milliseconds that cached block transaction count will remain in memory. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBlockTransactionCount.md","from":832,"to":1033} import { getBlockTransactionCount } from '@wagmi/core' import { config } from './config' const blockTransactionCount = await getBlockTransactionCount(config, { cacheTime: 4_000, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBlockTransactionCount.md","from":1214,"to":1463} import { getBlockTransactionCount } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const blockTransactionCount = await getBlockTransactionCount(config, { chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlockTransactionCount.md","from":1535,"to":1605} import { type GetBlockTransactionCountReturnType } from '@wagmi/core' ``` `number` The number of Transactions at a block number ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getBlockTransactionCount.md","from":1682,"to":1751} import { type GetBlockTransactionCountErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getBlockTransactionCount`](https://viem.sh/docs/actions/public/getBlockTransactionCount) --- --- url: /core/api/actions/getBytecode.md --- # getBytecode Action for retrieving the bytecode at an address. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getBytecode.md","from":207,"to":249} import { getBytecode } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBytecode.md","from":296,"to":461} import { getBytecode } from '@wagmi/core' import { config } from './config' await getBytecode(config, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getBytecode.md","from":532,"to":589} import { type GetBytecodeParameters } from '@wagmi/core' ``` ### address `Address` The contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBytecode.md","from":673,"to":855} import { getBytecode } from '@wagmi/core' import { config } from './config' await getBytecode(config, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` The block number to check the bytecode at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBytecode.md","from":1020,"to":1228} import { getBytecode } from '@wagmi/core' import { config } from './config' await getBytecode(config, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', blockNumber: 16280770n, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` The block tag to check the bytecode at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBytecode.md","from":1437,"to":1639} import { getBytecode } from '@wagmi/core' import { config } from './config' await getBytecode(config, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', blockTag: 'safe', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` The chain ID to check the bytecode at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getBytecode.md","from":1820,"to":2070} import { getBytecode } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' await getBytecode(config, { chainId: mainnet.id, // [!code focus] address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getBytecode.md","from":2142,"to":2199} import { type GetBytecodeReturnType } from '@wagmi/core' ``` `Hex` The contract's bytecode. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getBytecode.md","from":2253,"to":2309} import { type GetBytecodeErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getCode`](https://viem.sh/docs/contract/getCode) --- --- url: /core/api/actions/getCallsStatus.md --- # getCallsStatus Action to fetch the status and receipts of a call batch that was sent via [`sendCalls`](/core/api/actions/sendCalls). [Read more.](https://github.com/ethereum/EIPs/blob/1663ea2e7a683285f977eda51c32cec86553f585/EIPS/eip-5792.md#wallet_getcallsstatus) ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getCallsStatus.md","from":417,"to":462} import { getCallsStatus } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getCallsStatus.md","from":509,"to":666} import { getCallsStatus } from '@wagmi/core' import { config } from './config' const status = await getCallsStatus(config, { id: '0x1234567890abcdef', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getCallsStatus.md","from":737,"to":797} import { type GetCallsStatusParameters } from '@wagmi/core' ``` ### connector `Connector | undefined` Connector to get call statuses with. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getCallsStatus.md","from":912,"to":1185} import { getConnections, getCallsStatus } from '@wagmi/core' import { config } from './config' const connections = getConnections(config) const status = await getCallsStatus(config, { connector: connections[0]?.connector, // [!code focus] id: '0x1234567890abcdef', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### id `string` Identifier of the call batch. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getCallsStatus.md","from":1316,"to":1490} import { getCallsStatus } from '@wagmi/core' import { config } from './config' const status = await getCallsStatus(config, { id: '0x1234567890abcdef', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getCallsStatus.md","from":1562,"to":1622} import { type GetCallsStatusReturnType } from '@wagmi/core' ``` `{ status: 'PENDING' | 'CONFIRMED', receipts: TransactionReceipt[] }` The status and receipts of the call batch. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getCallsStatus.md","from":1758,"to":1817} import { type GetCallsStatusErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getCallsStatus`](https://viem.sh/docs/actions/wallet/getCallsStatus) --- --- url: /core/api/actions/getCapabilities.md --- # getCapabilities Action to extract capabilities (grouped by chain ID) that a connected wallet supports (e.g. paymasters, session keys, etc). [Read more.](https://github.com/ethereum/EIPs/blob/815028dc634463e1716fc5ce44c019a6040f0bef/EIPS/eip-5792.md#wallet_getcapabilities) ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getCapabilities.md","from":430,"to":476} import { getCapabilities } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getCapabilities.md","from":523,"to":655} import { getCapabilities } from '@wagmi/core' import { config } from './config' const capabilities = await getCapabilities(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getCapabilities.md","from":726,"to":787} import { type GetCapabilitiesParameters } from '@wagmi/core' ``` ### account `Account | Address | undefined` Fetch capabilities for the provided account. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getCapabilities.md","from":916,"to":1127} import { getCapabilities } from '@wagmi/core' import { config } from './config' const capabilities = await getCapabilities(config, { account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` Connector to get capabilities from. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getCapabilities.md","from":1286,"to":1539} import { getConnections, getCapabilities } from '@wagmi/core' import { config } from './config' const connections = getConnections(config) const capabilities = await getCapabilities(config, { connector: connections[0]?.connector, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getCapabilities.md","from":1611,"to":1672} import { type GetCapabilitiesReturnType } from '@wagmi/core' ``` `bigint` Most recent block number seen. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getCapabilities.md","from":1735,"to":1795} import { type GetCapabilitiesErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getCapabilities`](https://viem.sh/docs/actions/wallet/getCapabilities) --- --- url: /core/api/actions/getChainId.md --- # getChainId Action for getting current chain ID. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getChainId.md","from":70,"to":111} import { getChainId } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getChainId.md","from":158,"to":269} import { getChainId } from '@wagmi/core' import { config } from './config' const chainId = getChainId(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getChainId.md","from":341,"to":397} import { type GetChainIdReturnType } from '@wagmi/core' ``` `number` Current chain ID from [`config.state.chainId`](/core/api/createConfig#chainid). ::: info Only returns chain IDs for chains configured via `createConfig`'s [`chains`](/core/api/createConfig#chains) parameter. If the active [connection](/core/api/createConfig#connection) [`chainId`](/core/api/createConfig#chainid-1) is not from a chain included in your Wagmi `Config`, `getChainId` will return the last configured chain ID. ::: --- --- url: /core/api/actions/getChains.md --- # getChains Action for getting configured chains. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getChains.md","from":69,"to":109} import { getChains } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getChains.md","from":156,"to":264} import { getChains } from '@wagmi/core' import { config } from './config' const chains = getChains(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getChains.md","from":336,"to":391} import { type GetChainsReturnType } from '@wagmi/core' ``` `readonly [Chain, ...Chain[]]` Chains from [`config.chains`](/core/api/createConfig#chains). --- --- url: /core/api/actions/getClient.md --- # getClient Action for getting Viem [`Client`](https://viem.sh/docs/clients/custom) instance. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getClient.md","from":113,"to":153} import { getClient } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getClient.md","from":200,"to":308} import { getClient } from '@wagmi/core' import { config } from './config' const client = getClient(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getClient.md","from":379,"to":434} import { type GetClientParameters } from '@wagmi/core' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when getting Viem Client. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getClient.md","from":576,"to":780} import { getClient } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const client = await getClient(config, { chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getClient.md","from":852,"to":907} import { type GetClientReturnType } from '@wagmi/core' ``` `Client` Viem [`Client`](https://viem.sh/docs/clients/custom) instance. --- --- url: /core/api/actions/getConnection.md --- # getConnection Action for getting current connection. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getConnection.md","from":74,"to":118} import { getConnection } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getConnection.md","from":165,"to":285} import { getConnection } from '@wagmi/core' import { config } from './config' const connection = getConnection(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getConnection.md","from":357,"to":416} import { type GetConnectionReturnType } from '@wagmi/core' ``` ### address `Address | undefined` * Connected address from connector. * Defaults to first address in [`addresses`](#addresses). ### addresses `readonly Address[] | undefined` Connected addresses from connector. ### chain `Chain | undefined` Connected chain from connector. If chain is not configured by config, it will be `undefined`. ### chainId `number | undefined` Connected chain id from connector. ### connector `Connector | undefined` Connected connector. ### isConnecting / isReconnecting / isConnected / isDisconnected `boolean` Boolean variables derived from [`status`](#status). ### status `'connecting' | 'reconnecting' | 'connected' | 'disconnected'` * `'connecting'` attempting to establish connection. * `'reconnecting'` attempting to re-establish connection to one or more connectors. * `'connected'` at least one connector is connected. * `'disconnected'` no connection to any connector. ::: info You can use `status` to narrow the return type. For example, when `status` is `'connected'` properties like `address` are guaranteed to be defined. ```ts twoslash // @twoslash-cache: {"v":1,"hash":"70621ff7ba048810d10cff60e35c82126a2beb12177fb38b972d09b620d6367c","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAmbDBkbQEsWidgHEYaAMIsefQWABK4gK6kwAFWy4qbAIakGiACxUANjDABzNPiQBGAAxU0ei+KbTeAlpRAn+PJEcQRnw9HT4yJEMAXwp0TTxCEnInOgMQAAosUggcfQwASnZdNCU4YQAdECh+OC4ZGigq9gAfdir6zxgmkFb2kFJeD1lLZraO4YFRkB9dfTsAVlNzKxtEADYnFzdEEBKynz8AxCCQsIjyRFsF2PicROJI1Pp3Vg5O2SF2YAqwdn/2DooFBBnByuwAILA0FwADcvwBgOh8Dg8GEgyBLBMGHYyChIJRFHYADpSfiYcgALqU+F/AFnfzCCShfx9JRgWAAM383VpiIZYAAklBhGAlABbABGZD59MmEFITPlpFl/1qUm4XRF7DQpCUMFV7HVk38FmEnJ0JlRhtqABFah9GubLdaEQDaopHabnVaDW7/vtwRNNREerTorNnPMjABmZaWax2IJR1zpL3eUw8uxUM6kcI0S4AJlu1ASuwAjvrSBgfDQXrsuGxOCavj86f8gQSwcJySjDZ2YWj2BioFicXjkWCiaTib2wVSaf7OCywEyV2yOTBuTwoIaBcLRRLpSql46FUqQ2gFTa4BqGt1hLr9Te755vewLb6b/a6pMHx+XT9dsjTgT0TUsH1XWAwNKmCP8w1+CNtCjAxDDjXwVkTK5k22NMWzAQ4syuHNQjzC4kGLSkc2gXBdn4Tl2AydMwGJQN2AAXk49gAHJHW6biijbf5mN+USwDEiTxKkyTJKQkBxXEHQkFANJzDgOQ8DQBBomiIA==="} import { type GetConnectionReturnType } from '@wagmi/core' const connection = {} as GetConnectionReturnType // ---cut--- if (connection.status === 'connected') { connection // ^? } ``` Or when status is `'disconnected'` properties like `address` are guaranteed to be `undefined`: ```ts twoslash // @twoslash-cache: {"v":1,"hash":"03f1cafa2983888b08080373baa176953254622dd97feb972d42875fedc5dd86","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAmbDBkbQEsWidgHEYaAMIsefQWABK4gK6kwAFWy4qbAIakGiACxUANjDABzNPiQBGAAxU0ei+KbTeAlpRAn+PJEcQRnw9HT4yJEMAXwp0TTxCEnInOgMQAAosUggcfQwASnZdNCU4YQAdECh+OC4ZGigq9gAfdir6zxgmkFb2kFJeD1lLZraO4YFRkB9dfTsAVlNzKxtEADYnFzdEEBKynz8AxCCQsIjyRFsF2PicROJI1Pp3Vg5O2SF2YAqwdn/2DooFBBnByuwlGBYAAzfzdADcvwBgOBoLg8GEkJhcKgiL+ALO/kxUJgsJ4uKRBNC/gAklBidjyXjkR80BBSAzSTjmQDalJuF16exoToTOief9aopWf4LMIRWKYBL2HzJrL5aLxZTJXAACK1VndYRoUhKJXa4rOUrgqo1OqTbpVPHRWbOeZGTa+FbWOxBN2udIy7ymOF2KhnUjhGiXABMt2oCV2AEczaQMD4aC9dlw2Jw1V8fvj/kCQfBwViuUyLSW0RiISSyQiLYSwJzGxSi5xqWA6W3uc3Juy+1XO6qBREhQqtaO4NK1ZYNYrlWOGurhZrzTP9fbx41jabN8j9jbqgaHT1na69AZDJ6zJYfVc/dtA/mwIdQ1dw6FIxckHGAF1w2gXBdn4aF2AyIMwAAOmPdgAF4kPYAByO1DSgFCikLf5oN+fCwAIojCJI4jiJdKgAFtxB0JBQDScw4DkPA0AQaJoiAA"} import { type GetConnectionReturnType } from '@wagmi/core' const connection = {} as GetConnectionReturnType // ---cut--- if (connection.status === 'disconnected') { connection // ^? } ``` ::: --- --- url: /core/api/actions/getConnections.md --- # getConnections Action for getting active connections. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getConnections.md","from":75,"to":120} import { getConnections } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getConnections.md","from":167,"to":290} import { getConnections } from '@wagmi/core' import { config } from './config' const connections = getConnections(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getConnections.md","from":362,"to":422} import { type GetConnectionsReturnType } from '@wagmi/core' ``` [`Connection[]`](/core/api/createConfig#connection) Active connections. --- --- url: /core/api/actions/getConnectorClient.md --- # getConnectorClient Action for getting a Viem [`Client`](https://viem.sh/docs/clients/custom) object for the current or provided connector. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getConnectorClient.md","from":298,"to":347} import { getConnectorClient } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getConnectorClient.md","from":394,"to":526} import { getConnectorClient } from '@wagmi/core' import { config } from './config' const client = await getConnectorClient(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getConnectorClient.md","from":597,"to":661} import { type GetConnectorClientParameters } from '@wagmi/core' ``` ### account `Address | Account | undefined` Account to use with client. Throws if account is not found on [`connector`](#connector). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getConnectorClient.md","from":834,"to":1045} import { getConnectorClient } from '@wagmi/core' import { config } from './config' const client = await getConnectorClient(config, { account: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use with client. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getConnectorClient.md","from":1219,"to":1441} import { getConnectorClient } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const client = await getConnectorClient(config, { chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` * Connector to get client for. * Defaults to current connector. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getConnectorClient.md","from":1628,"to":1881} import { getConnections, getConnectorClient } from '@wagmi/core' import { config } from './config' const connections = getConnections(config) const client = await getConnectorClient(config, { connector: connections[0]?.connector, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getConnectorClient.md","from":1953,"to":2009} import { type GetChainIdReturnType } from '@wagmi/core' ``` `Client` Viem [`Client`](https://viem.sh/docs/clients/custom) object for the current or provided connector. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getConnectorClient.md","from":2140,"to":2203} import { type GetConnectorClientErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` --- --- url: /core/api/actions/getConnectors.md --- # getConnectors Action for getting configured connectors. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getConnectors.md","from":77,"to":121} import { getConnectors } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getConnectors.md","from":168,"to":288} import { getConnectors } from '@wagmi/core' import { config } from './config' const connectors = getConnectors(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getConnectors.md","from":360,"to":419} import { type GetConnectorsReturnType } from '@wagmi/core' ``` `readonly Connector[]` Connectors from [`config.connectors`](/core/api/createConfig#connectors-1). --- --- url: /core/api/actions/getContractEvents.md --- # getContractEvents Action for fetching a list of contract event logs matching the provided parameters. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":259,"to":307} import { getContractEvents } from '@wagmi/core' ``` ## Usage By default, `getContractEvents` returns all matched events on the ABI. In practice, you must use scoping to filter for specific events. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":491,"to":713} import { getContractEvents } from '@wagmi/core' import { abi } from './abi' import { config } from './config' // Fetch event logs for every event on every ERC-20 contract. const logs = getContractEvents(config, { abi }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":820,"to":883} import { type GetContractEventsParameters } from '@wagmi/core' ``` ### abi `Abi` The contract's ABI. Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":1099,"to":1296} import { getContractEvents } from '@wagmi/core' import { abi } from './abi' // [!code focus] import { config } from './config' const logs = getContractEvents(config, { abi, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### address `Address | undefined` The contract's address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":1475,"to":1711} import { getContractEvents } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const logs = getContractEvents(config, { address: '0x6b175474e89094c44da98b954eedeac495271d0f', // [!code focus] abi, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### args `object | readonly unknown[] | undefined` * Logs can be scoped to given indexed arguments. * Inferred from [`abi`](#abi) and [`eventName`](#eventname). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":1993,"to":2374} import { getContractEvents } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const logs = getContractEvents(config, { abi, eventName: 'Transfer', args: { // [!code focus] from: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045', // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] }, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` Only indexed arguments in `event` are candidates for `args`. An argument can also be an array to indicate that other values can exist in the position: ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":2645,"to":3163} import { getContractEvents } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const logs = getContractEvents(config, { abi, eventName: 'Transfer', args: { from: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045', to: [ // [!code focus] '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] '0xa5cc3c03994db5b0d9a5eedd10cabab0813678ac', // [!code focus] '0xa152f8bb749c55e9943a3a0a3111d18ee2b3f94e', // [!code focus] ], // [!code focus] }, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockHash `` `0x${string}` | undefined `` * Block hash to include logs from. Mutually exclusive with `fromBlock`/`toBlock`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":3412,"to":3674} import { getContractEvents } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const logs = getContractEvents(config, { abi, blockHash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":3891,"to":4138} import { getContractEvents } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { abi } from './abi' import { config } from './config' const logs = getContractEvents(config, { abi, chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### eventName `string | undefined` * Event to filter for the contract. * Inferred from [`abi`](#abi). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":4361,"to":4565} import { getContractEvents } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const logs = getContractEvents(config, { abi, eventName: 'Approval', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### fromBlock `bigint | 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` * Block to start including logs from. Mutually exclusive with `blockHash`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":4856,"to":5056} import { getContractEvents } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const logs = getContractEvents(config, { abi, fromBlock: 69420n, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### strict `boolean | undefined` * Flag to only return logs that conform to the indexed & non-indexed arguments on the `event`, meaning that `args` will always be defined. Defaults to `false`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":5370,"to":5565} import { getContractEvents } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const logs = getContractEvents(config, { abi, strict: true, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### toBlock `bigint | 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` * Block to stop including logs from. Mutually exclusive with `blockHash`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":5853,"to":6051} import { getContractEvents } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const logs = getContractEvents(config, { abi, toBlock: 70120n, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":6159,"to":6222} import { type GetContractEventsReturnType } from '@wagmi/core' ``` A list of event logs. ## Type Inference With [`abi`](#abi) setup correctly, TypeScript will infer the correct types for [`eventName`](#eventname), [`args`](#args), and [`onLogs`](#onlogs) parameters. See the Wagmi [TypeScript docs](/core/typescript) for more information. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getContractEvents.md","from":6518,"to":6576} import { type GetContractEventsError } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getContractEvents`](https://viem.sh/docs/contract/getContractEvents) --- --- url: /core/api/actions/getEnsAddress.md --- # getEnsAddress Action for fetching ENS address for name. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsAddress.md","from":205,"to":249} import { getEnsAddress } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAddress.md","from":296,"to":489} import { getEnsAddress } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensAddress = getEnsAddress(config, { name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: warning Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use Viem's built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsAddress.md","from":1015,"to":1074} import { type GetEnsAddressParameters } from '@wagmi/core' ``` *** ### blockNumber `bigint | undefined` Block number to get ENS address at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAddress.md","from":1192,"to":1428} import { getEnsAddress } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensAddress = getEnsAddress(config, { blockNumber: 17829139n, // [!code focus] name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get ENS address at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAddress.md","from":1630,"to":1862} import { getEnsAddress } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensAddress = getEnsAddress(config, { blockTag: 'latest', // [!code focus] name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAddress.md","from":2048,"to":2332} import { getEnsAddress } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { normalize } from 'viem/ens' import { config } from './config' const ensAddress = await getEnsAddress(config, { chainId: mainnet.id, // [!code focus] name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### coinType `number | undefined` The [ENSIP-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution) coin type to fetch the address for. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAddress.md","from":2591,"to":2823} import { getEnsAddress } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensAddress = await getEnsAddress(config, { coinType: 60, // [!code focus] name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### name `string` Name to get the address for. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAddress.md","from":2955,"to":3171} import { getEnsAddress } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensAddress = await getEnsAddress(config, { name: normalize('wevm.eth'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### universalResolverAddress `Address | undefined` * Address of ENS Universal Resolver Contract. * Defaults to current chain's Universal Resolver Contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAddress.md","from":3420,"to":3710} import { getEnsAddress } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensAddress = await getEnsAddress(config, { name: normalize('wevm.eth'), universalResolverAddress: '0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsAddress.md","from":3782,"to":3841} import { type GetEnsAddressReturnType } from '@wagmi/core' ``` `string` ENS address. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsAddress.md","from":3886,"to":3944} import { type GetEnsAddressErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getEnsAddress`](https://viem.sh/docs/ens/actions/getEnsAddress) --- --- url: /core/api/actions/getEnsAvatar.md --- # getEnsAvatar Action for fetching ENS address for avatar. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsAvatar.md","from":204,"to":247} import { getEnsAvatar } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAvatar.md","from":294,"to":490} import { getEnsAvatar } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensAvatar = await getEnsAvatar(config, { name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: warning Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAvatar`. You can use Viem's built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsAvatar.md","from":1015,"to":1073} import { type GetEnsAvatarParameters } from '@wagmi/core' ``` *** ### assetGatewayUrls `{ ipfs?: string | undefined; arweave?: string | undefined } | undefined` Gateway urls to resolve IPFS and/or Arweave assets. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAvatar.md","from":1295,"to":1610} import { getEnsAvatar } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensAvatar = await getEnsAvatar(config, { assetGatewayUrls: { // [!code focus] ipfs: 'https://cloudflare-ipfs.com', // [!code focus] }, // [!code focus] name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` Block number to get avatar at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAvatar.md","from":1764,"to":2003} import { getEnsAvatar } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensAvatar = await getEnsAvatar(config, { blockNumber: 17829139n, // [!code focus] name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get avatar at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAvatar.md","from":2200,"to":2435} import { getEnsAvatar } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensAvatar = await getEnsAvatar(config, { blockTag: 'latest', // [!code focus] name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAvatar.md","from":2621,"to":2902} import { getEnsAvatar } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { normalize } from 'viem/ens' import { config } from './config' const ensAvatar = await getEnsAvatar(config, { chainId: mainnet.id, // [!code focus] name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gatewayUrls `string[] | undefined` A set of Universal Resolver gateways, used for resolving CCIP-Read requests made through the ENS Universal Resolver Contract. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAvatar.md","from":3152,"to":3414} import { getEnsAvatar } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensAvatar = await getEnsAvatar(config, { gatewayUrls: ['https://cloudflare-ipfs.com'] { // [!code focus] name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### name `string` Name to get the avatar for. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAvatar.md","from":3545,"to":3758} import { getEnsAvatar } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensAvatar = await getEnsAvatar(config, { name: normalize('wevm.eth'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### universalResolverAddress `Address | undefined` * Address of ENS Universal Resolver Contract. * Defaults to current chain's Universal Resolver Contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsAvatar.md","from":4007,"to":4294} import { getEnsAvatar } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensAvatar = await getEnsAvatar(config, { name: normalize('wevm.eth'), universalResolverAddress: '0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsAvatar.md","from":4366,"to":4424} import { type GetEnsAvatarReturnType } from '@wagmi/core' ``` `string | null` The avatar URI for ENS name. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsAvatar.md","from":4492,"to":4545} import { type getEnsAvatarError } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getEnsAvatar`](https://viem.sh/docs/ens/actions/getEnsAvatar) --- --- url: /core/api/actions/getEnsName.md --- # getEnsName Action for fetching primary ENS name for address. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsName.md","from":204,"to":245} import { getEnsName } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsName.md","from":292,"to":465} import { getEnsName } from '@wagmi/core' import { config } from './config' const ensName = getEnsName(config, { address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsName.md","from":536,"to":592} import { type GetEnsNameParameters } from '@wagmi/core' ``` ### address `Address` Address to get the name for. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsName.md","from":683,"to":879} import { getEnsName } from '@wagmi/core' import { config } from './config' const ensName = await getEnsName(config, { address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### blockNumber `bigint | undefined` Block number to get name at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsName.md","from":1035,"to":1251} import { getEnsName } from '@wagmi/core' import { config } from './config' const ensName = getEnsName(config, { address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', blockNumber: 17829139n, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get name at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsName.md","from":1446,"to":1658} import { getEnsName } from '@wagmi/core' import { config } from './config' const ensName = getEnsName(config, { address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', blockTag: 'latest', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsName.md","from":1844,"to":2108} import { getEnsName } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const ensName = await getEnsName(config, { address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### universalResolverAddress `Address | undefined` * Address of ENS Universal Resolver Contract. * Defaults to current chain's Universal Resolver Contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsName.md","from":2357,"to":2624} import { getEnsName } from '@wagmi/core' import { config } from './config' const ensName = await getEnsName(config, { address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', universalResolverName: '0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsName.md","from":2696,"to":2752} import { type GetEnsNameReturnType } from '@wagmi/core' ``` `string | null` The primary ENS name for the address. Returns `null` if address does not have primary name assigned. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsName.md","from":2892,"to":2947} import { type GetEnsNameErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getEnsName`](https://viem.sh/docs/ens/actions/getEnsName) --- --- url: /core/api/actions/getEnsResolver.md --- # getEnsResolver Action for fetching ENS resolver for name. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsResolver.md","from":209,"to":254} import { getEnsResolver } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsResolver.md","from":301,"to":497} import { getEnsResolver } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensResolver = getEnsResolver(config, { name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: warning Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsResolver`. You can use Viem's built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsResolver.md","from":1024,"to":1084} import { type GetEnsResolverParameters } from '@wagmi/core' ``` *** ### blockNumber `bigint | undefined` Block number to get resolver at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsResolver.md","from":1199,"to":1438} import { getEnsResolver } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensResolver = getEnsResolver(config, { blockNumber: 17829139n, // [!code focus] name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get resolver at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsResolver.md","from":1637,"to":1872} import { getEnsResolver } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensResolver = getEnsResolver(config, { blockTag: 'latest', // [!code focus] name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsResolver.md","from":2058,"to":2345} import { getEnsResolver } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { normalize } from 'viem/ens' import { config } from './config' const ensResolver = await getEnsResolver(config, { chainId: mainnet.id, // [!code focus] name: normalize('wevm.eth'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### name `string` Name to get the resolver for. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsResolver.md","from":2478,"to":2697} import { getEnsResolver } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensResolver = await getEnsResolver(config, { name: normalize('wevm.eth'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### universalResolverAddress `Address | undefined` * Address of ENS Universal Resolver Contract. * Defaults to current chain's Universal Resolver Contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsResolver.md","from":2946,"to":3239} import { getEnsResolver } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensResolver = await getEnsResolver(config, { name: normalize('wevm.eth'), universalResolverAddress: '0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsResolver.md","from":3311,"to":3371} import { type GetEnsResolverReturnType } from '@wagmi/core' ``` `Address` The address of the resolver. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsResolver.md","from":3433,"to":3488} import { type getEnsResolverError } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getEnsResolver`](https://viem.sh/docs/ens/actions/getEnsResolver) --- --- url: /core/api/actions/getEnsText.md --- # getEnsText Action for fetching a text record for a specified ENS name and key. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsText.md","from":222,"to":263} import { getEnsText } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsText.md","from":310,"to":516} import { getEnsText } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensText = getEnsText(config, { name: normalize('wevm.eth'), key: 'com.twitter', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: warning Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsText`. You can use Viem's built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsText.md","from":1039,"to":1095} import { type GetEnsTextParameters } from '@wagmi/core' ``` *** ### blockNumber `bigint | undefined` Block number to get the text at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsText.md","from":1210,"to":1459} import { getEnsText } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensText = getEnsText(config, { blockNumber: 17829139n, // [!code focus] name: normalize('wevm.eth'), key: 'com.twitter', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get the text at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsText.md","from":1658,"to":1903} import { getEnsText } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensText = getEnsText(config, { blockTag: 'latest', // [!code focus] name: normalize('wevm.eth'), key: 'com.twitter', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsText.md","from":2089,"to":2386} import { getEnsText } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { normalize } from 'viem/ens' import { config } from './config' const ensText = await getEnsText(config, { chainId: mainnet.id, // [!code focus] name: normalize('wevm.eth'), key: 'com.twitter', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### key `string` ENS key to get Text for. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsText.md","from":2513,"to":2742} import { getEnsText } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensText = await getEnsText(config, { name: normalize('wevm.eth'), key: 'com.twitter', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### name `string` Name to get the text for. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsText.md","from":2871,"to":3100} import { getEnsText } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensText = await getEnsText(config, { name: normalize('wevm.eth'), // [!code focus] key: 'com.twitter', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### universalResolverAddress `Address | undefined` * Address of ENS Universal Resolver Contract. * Defaults to current chain's Universal Resolver Contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getEnsText.md","from":3349,"to":3652} import { getEnsText } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' const ensText = await getEnsText(config, { name: normalize('wevm.eth'), key: 'com.twitter', universalResolverAddress: '0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsText.md","from":3724,"to":3780} import { type GetEnsTextReturnType } from '@wagmi/core' ``` `string | null` The text record for ENS name. Returns `null` if name does not have text assigned. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getEnsText.md","from":3902,"to":3953} import { type getEnsTextError } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getEnsText`](https://viem.sh/docs/ens/actions/getEnsText) --- --- url: /core/api/actions/getFeeHistory.md --- # getFeeHistory Action for fetching a collection of historical gas information. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getFeeHistory.md","from":227,"to":271} import { getFeeHistory } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getFeeHistory.md","from":318,"to":496} import { getFeeHistory } from '@wagmi/core' import { config } from './config' const feeHistory = await getFeeHistory(config, { blockCount: 4, rewardPercentiles: [25, 75] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getFeeHistory.md","from":567,"to":626} import { type GetFeeHistoryParameters } from '@wagmi/core' ``` ### blockCount `number` Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getFeeHistory.md","from":862,"to":1057} import { getFeeHistory } from '@wagmi/core' import { config } from './config' const feeHistory = await getFeeHistory(config, { blockCount: 4, // [!code focus] rewardPercentiles: [25, 75] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### rewardPercentiles `number[]` A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getFeeHistory.md","from":1330,"to":1525} import { getFeeHistory } from '@wagmi/core' import { config } from './config' const feeHistory = await getFeeHistory(config, { blockCount: 4, rewardPercentiles: [25, 75] // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` Highest number block of the requested range. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getFeeHistory.md","from":1692,"to":1913} import { getFeeHistory } from '@wagmi/core' import { config } from './config' const feeHistory = await getFeeHistory(config, { blockCount: 4, blockNumber: 1551231n, // [!code focus] rewardPercentiles: [25, 75], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag of the highest number block of the requested range. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getFeeHistory.md","from":2144,"to":2360} import { getFeeHistory } from '@wagmi/core' import { config } from './config' const feeHistory = await getFeeHistory(config, { blockCount: 4, blockTag: 'safe', // [!code focus] rewardPercentiles: [25, 75], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getFeeHistory.md","from":2541,"to":2805} import { getFeeHistory } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const feeHistory = await getFeeHistory(config, { blockCount: 4, chainId: mainnet.id, // [!code focus] rewardPercentiles: [25, 75], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getFeeHistory.md","from":2877,"to":2936} import { type GetFeeHistoryReturnType } from '@wagmi/core' ``` [`FeeHistory`](https://viem.sh/docs/glossary/types#feehistory) The fee history. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getFeeHistory.md","from":3039,"to":3097} import { type GetFeeHistoryErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getFeeHistory`](https://viem.sh/docs/actions/public/getFeeHistory) --- --- url: /core/api/actions/getGasPrice.md --- # getGasPrice Action for fetching the current price of gas (in wei). ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getGasPrice.md","from":212,"to":254} import { getGasPrice } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getGasPrice.md","from":301,"to":421} import { getGasPrice } from '@wagmi/core' import { config } from './config' const gasPrice = await getGasPrice(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getGasPrice.md","from":492,"to":549} import { type GetGasPriceParameters } from '@wagmi/core' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getGasPrice.md","from":685,"to":895} import { getGasPrice } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const gasPrice = await getGasPrice(config, { chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getGasPrice.md","from":967,"to":1024} import { type GetGasPriceReturnType } from '@wagmi/core' ``` `bigint` Current price of gas (in wei). ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getGasPrice.md","from":1087,"to":1143} import { type GetGasPriceErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getGasPrice`](https://viem.sh/docs/actions/public/getGasPrice) --- --- url: /core/api/actions/getProof.md --- # getProof Action for return the account and storage values of the specified account including the Merkle-proof. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getProof.md","from":250,"to":289} import { getProof } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getProof.md","from":336,"to":591} import { getProof } from '@wagmi/core' import { config } from './config' await getProof(config, { address: '0x4200000000000000000000000000000000000016', storageKeys: [ '0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99', ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getProof.md","from":662,"to":716} import { type GetProofParameters } from '@wagmi/core' ``` ### address `Address` The account address to get the proof for. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getProof.md","from":820,"to":1092} import { getProof } from '@wagmi/core' import { config } from './config' await getProof(config, { address: '0x4200000000000000000000000000000000000016', // [!code focus] storageKeys: [ '0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99', ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### storageKeys `` `0x${string}`[] `` Array of storage-keys that should be proofed and included. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getProof.md","from":1274,"to":1548} import { getProof } from '@wagmi/core' import { config } from './config' await getProof(config, { address: '0x4200000000000000000000000000000000000016', storageKeys: [ // [!code focus:3] '0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99', ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` Proof at a given block number. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getProof.md","from":1701,"to":1996} import { getProof } from '@wagmi/core' import { config } from './config' await getProof(config, { address: '0x4200000000000000000000000000000000000016', blockNumber: 42069n, // [!code focus] storageKeys: [ '0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99', ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Proof at a given block tag. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getProof.md","from":2193,"to":2487} import { getProof } from '@wagmi/core' import { config } from './config' await getProof(config, { address: '0x4200000000000000000000000000000000000016', blockTag: 'latest', // [!code focus] storageKeys: [ '0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99', ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` The ID of chain to get the proof for. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getProof.md","from":2667,"to":3009} import { getProof } from '@wagmi/core' import { config } from './config' import { optimism } from '@wagmi/core/chains' await getProof(config, { chainId: optimism.id, // [!code focus] address: '0x4200000000000000000000000000000000000016', storageKeys: [ '0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99', ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getProof.md","from":3081,"to":3135} import { type GetProofReturnType } from '@wagmi/core' ``` `Proof` Proof data. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getProof.md","from":3178,"to":3231} import { type GetProofErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getProof`](https://viem.sh/docs/actions/public/getProof) --- --- url: /core/api/actions/getPublicClient.md --- # getPublicClient Action for getting Viem [`PublicClient`](https://viem.sh/docs/clients/public) instance. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getPublicClient.md","from":125,"to":171} import { getPublicClient } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getPublicClient.md","from":218,"to":338} import { getPublicClient } from '@wagmi/core' import { config } from './config' const client = getPublicClient(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: warning If you want to optimize bundle size, you should use [`getClient`](/core/api/actions/getClient) along with Viem's [tree-shakable actions](https://viem.sh/docs/clients/custom#tree-shaking) instead. Since Public Client has all public actions attached directly to it. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getPublicClient.md","from":690,"to":745} import { type GetClientParameters } from '@wagmi/core' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when getting Viem Public Client. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getPublicClient.md","from":894,"to":1104} import { getPublicClient } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const client = getPublicClient(config, { chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getPublicClient.md","from":1176,"to":1237} import { type GetPublicClientReturnType } from '@wagmi/core' ``` `PublicClient | undefined` Viem [`PublicClient`](https://viem.sh/docs/clients/public) instance. --- --- url: /core/api/actions/getStorageAt.md --- # getStorageAt Action for returning the value from a storage slot at a given address. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getStorageAt.md","from":231,"to":274} import { getStorageAt } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getStorageAt.md","from":321,"to":503} import { getStorageAt } from '@wagmi/core' import { config } from './config' await getStorageAt(config, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: '0x0', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getStorageAt.md","from":574,"to":632} import { type GetStorageAtParameters } from '@wagmi/core' ``` ### address `Address` The contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getStorageAt.md","from":716,"to":915} import { getStorageAt } from '@wagmi/core' import { config } from './config' await getStorageAt(config, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', // [!code focus] slot: '0x0', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### slot `Hex` The storage position (as a hex encoded value). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getStorageAt.md","from":1062,"to":1261} import { getStorageAt } from '@wagmi/core' import { config } from './config' await getStorageAt(config, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: '0x0', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` The block number to check the storage at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getStorageAt.md","from":1425,"to":1650} import { getStorageAt } from '@wagmi/core' import { config } from './config' await getStorageAt(config, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', blockNumber: 16280770n, // [!code focus] slot: '0x0', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` The block tag to check the storage at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getStorageAt.md","from":1858,"to":2077} import { getStorageAt } from '@wagmi/core' import { config } from './config' await getStorageAt(config, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', blockTag: 'safe', // [!code focus] slot: '0x0', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` The chain ID to check the storage at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getStorageAt.md","from":2257,"to":2524} import { getStorageAt } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' await getStorageAt(config, { chainId: mainnet.id, // [!code focus] address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: '0x0', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getStorageAt.md","from":2596,"to":2654} import { type GetStorageAtReturnType } from '@wagmi/core' ``` `Hex` The value of the storage slot. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getStorageAt.md","from":2714,"to":2771} import { type GetStorageAtErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getStorageAt`](https://viem.sh/docs/contract/getStorageAt) --- --- url: /cli/getting-started.md --- # Getting Started ## Overview Wagmi CLI is a command line interface for managing ABIs (from Etherscan/block explorers, Foundry/Hardhat projects, etc.), generating code (e.g. React Hooks), and much more. It makes working with Ethereum easier by automating manual work so you can build faster. You can learn more about the rationale behind the project in the [Why Wagmi CLI](/cli/why) section. ## Manual Installation To manually add Wagmi CLI to your project, install the required packages. ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/cli/getting-started.md","from":524,"to":547} pnpm add -D @wagmi/cli ``` ```bash [npm] // {"path":"/vercel/path0/site/cli/getting-started.md","from":566,"to":600} npm install --save-dev @wagmi/cli ``` ```bash [yarn] // {"path":"/vercel/path0/site/cli/getting-started.md","from":620,"to":643} yarn add -D @wagmi/cli ``` ```bash [bun] // {"path":"/vercel/path0/site/cli/getting-started.md","from":662,"to":684} bun add -D @wagmi/cli ``` ::: ## Create Config File Run the `init` command to generate a configuration file: either `wagmi.config.ts` if TypeScript is detected, otherwise `wagmi.config.js`. You can also create the configuration file manually. See [Configuring CLI](/cli/config/configuring-cli) for more info. ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/cli/getting-started.md","from":1004,"to":1020} pnpm wagmi init ``` ```bash [npm] // {"path":"/vercel/path0/site/cli/getting-started.md","from":1039,"to":1054} npx wagmi init ``` ```bash [yarn] // {"path":"/vercel/path0/site/cli/getting-started.md","from":1074,"to":1090} yarn wagmi init ``` ```bash [bun] // {"path":"/vercel/path0/site/cli/getting-started.md","from":1109,"to":1124} bun wagmi init ``` ::: The generated configuration file will look something like this: ::: code-group ```ts [wagmi.config.ts] // {"path":"/vercel/path0/site/cli/getting-started.md","from":1237,"to":1372} import { defineConfig } from '@wagmi/cli' export default defineConfig({ out: 'src/generated.ts', contracts: [], plugins: [], }) ``` ::: ## Add Contracts And Plugins Once the configuration file is set up, you can add contracts and plugins to it. These contracts and plugins are used to manage ABIs (fetch from block explorers, resolve from the file system, etc.), generate code (React hooks, etc.), and much more! For example, we can add the ERC-20 contract from Viem, and the [`etherscan`](/cli/api/plugins/etherscan) and [`react`](/cli/api/plugins/react) plugins. ::: code-group ```ts{2,3,9-12,15-27,28} [wagmi.config.ts] // {"path":"/vercel/path0/site/cli/getting-started.md","from":1871,"to":2570} import { defineConfig } from '@wagmi/cli' import { etherscan, react } from '@wagmi/cli/plugins' import { erc20Abi } from 'viem' import { mainnet, sepolia } from 'wagmi/chains' export default defineConfig({ out: 'src/generated.ts', contracts: [ { name: 'erc20', abi: erc20Abi, }, ], plugins: [ etherscan({ apiKey: process.env.ETHERSCAN_API_KEY!, chainId: mainnet.id, contracts: [ { name: 'EnsRegistry', address: { [mainnet.id]: '0x314159265dd8dbb310642f98f50c066173c1259b', [sepolia.id]: '0x112234455c3a32fd11230c42e7bccd4a84e02010', }, }, ], }), react(), ], }) ``` ::: ## Run Code Generation Now that we added a few contracts and plugins to the configuration file, we can run the [`generate`](/cli/api/commands/generate) command to resolve ABIs and generate code to the `out` file. ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/cli/getting-started.md","from":2824,"to":2844} pnpm wagmi generate ``` ```bash [npm] // {"path":"/vercel/path0/site/cli/getting-started.md","from":2863,"to":2882} npx wagmi generate ``` ```bash [yarn] // {"path":"/vercel/path0/site/cli/getting-started.md","from":2902,"to":2922} yarn wagmi generate ``` ```bash [bun] // {"path":"/vercel/path0/site/cli/getting-started.md","from":2941,"to":2960} bun wagmi generate ``` ::: In this example, the `generate` command will do the following: * Validate the `etherscan` and `react` plugins * Fetch and cache the ENS Registry ABI from the Mainnet Etherscan API * Pull in the `erc20Abi` using the name `'ERC20'` * Generate React Hooks for both ABIs * Save ABIs, ENS Registry deployment addresses, and React Hooks to the `out` file ## Use Generated Code Once `out` is created, you can start using the generated code in your project. ```ts // {"path":"/vercel/path0/site/cli/getting-started.md","from":3429,"to":3914} import { useReadErc20, useReadErc20BalanceOf } from './generated' // Use the generated ERC-20 read hook const { data } = useReadErc20({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }) // Use the generated ERC-20 "balanceOf" hook const { data } = useReadErc20BalanceOf({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }) ``` ::: tip Instead of committing the `out` file, you likely want to add `out` to your `.gitignore` and run `generate` during the build process or before you start your dev server in a `"predev"` script. ::: ## Next Steps For more information on what to do next, check out the following topics. * [**Configuring CLI**](/cli/config/configuring-cli) Learn how to configure the CLI to work best for your project. * [**Commands**](/cli/api/commands) Learn more about the CLI commands and how to use them. * [**Plugins**](/cli/api/plugins) Browse the collection of plugins and set them up with your config. --- --- url: /core/getting-started.md --- # Getting Started ## Overview Wagmi Core is a VanillaJS library for Ethereum. You can learn more about the rationale behind the project in the [Why Wagmi](/core/why) section. ## Manual Installation To manually add Wagmi to your project, install the required packages. ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/core/getting-started.md","from":447,"to":507} pnpm add @wagmi/core @wagmi/connectors viem@{{viemVersion}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/core/getting-started.md","from":530,"to":593} npm install @wagmi/core @wagmi/connectors viem@{{viemVersion}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/core/getting-started.md","from":617,"to":677} yarn add @wagmi/core @wagmi/connectors viem@{{viemVersion}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/core/getting-started.md","from":700,"to":759} bun add @wagmi/core @wagmi/connectors viem@{{viemVersion}} ``` ::: * [Wagmi Connectors](/core/api/connectors) is a collection of interfaces for linking accounts/wallets to Wagmi. * [Viem](https://viem.sh) is a TypeScript interface for Ethereum that performs blockchain operations. * [TypeScript](/react/typescript) is optional, but highly recommended. Learn more about [TypeScript support](/core/typescript). ### Create Config Create and export a new Wagmi config using `createConfig`. ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` In this example, Wagmi is configured to use the Mainnet and Sepolia chains. Check out the [`createConfig` docs](/core/api/createConfig) for more configuration options. ### Use Wagmi Now that everything is set up, you can pass the `config` to use actions. ::: code-group ```tsx [index.ts] // {"path":"/vercel/path0/site/core/getting-started.md","from":1542,"to":1729} import { getConnection, getEnsName } from '@wagmi/core' import { config } from './config' const { address } = getConnection(config) const ensName = await getEnsName(config, { address }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Next Steps For more information on what to do next, check out the following topics. * [**TypeScript**](/core/typescript) Learn how to get the most out of Wagmi's type-safety and inference for an enlightened developer experience. * [**Actions**](/core/api/actions) Browse the collection of actions and learn how to use them. * [**Framework Adapters**](/core/guides/framework-adapters) Learn how to create a Wagmi-like adapter for your favorite framework. * [**Viem docs**](https://viem.sh) Wagmi Core is a wrapper around Viem that manages account and client reactivity. Learn more about Viem and how to use it. --- --- url: /react/getting-started.md --- # Getting Started ## Overview Wagmi is a React Hooks library for Ethereum. You can learn more about the rationale behind the project in the [Why Wagmi](/react/why) section. ## Automatic Installation For new projects, it is recommended to set up your Wagmi app using the [`create-wagmi`](/cli/create-wagmi) command line interface (CLI). This will create a new Wagmi project using TypeScript and install the required dependencies. ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/react/getting-started.md","from":605,"to":623} pnpm create wagmi ``` ```bash [npm] // {"path":"/vercel/path0/site/react/getting-started.md","from":642,"to":666} npm create wagmi@latest ``` ```bash [yarn] // {"path":"/vercel/path0/site/react/getting-started.md","from":686,"to":704} yarn create wagmi ``` ```bash [bun] // {"path":"/vercel/path0/site/react/getting-started.md","from":723,"to":740} bun create wagmi ``` ::: Once the command runs, you'll see some prompts to complete. ```ansi // {"path":"/vercel/path0/site/react/getting-started.md","from":818,"to":886} Project name: wagmi-project Select a framework: React / Vanilla ... ``` After the prompts, `create-wagmi` will create a directory with your project name and install the required dependencies. Check out the `README.md` for further instructions (if required). ## Manual Installation To manually add Wagmi to your project, install the required packages. ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/react/getting-started.md","from":1207,"to":1265} pnpm add wagmi viem@{{viemVersion}} @tanstack/react-query ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/react/getting-started.md","from":1288,"to":1349} npm install wagmi viem@{{viemVersion}} @tanstack/react-query ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/react/getting-started.md","from":1373,"to":1431} yarn add wagmi viem@{{viemVersion}} @tanstack/react-query ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/react/getting-started.md","from":1454,"to":1511} bun add wagmi viem@{{viemVersion}} @tanstack/react-query ``` ::: * [Viem](https://viem.sh) is a TypeScript interface for Ethereum that performs blockchain operations. * [TanStack Query](https://tanstack.com/query/v5) is an async state manager that handles requests, caching, and more. * [TypeScript](/react/typescript) is optional, but highly recommended. Learn more about [TypeScript support](/react/typescript). ### Create Config Create and export a new Wagmi config using `createConfig`. ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` In this example, Wagmi is configured to use the Mainnet and Sepolia chains, and `injected` connector. Check out the [`createConfig` docs](/react/api/createConfig) for more configuration options. ::: details TypeScript Tip If you are using TypeScript, you can "register" the Wagmi config or use the hook `config` property to get strong type-safety across React Context in places that wouldn't normally have type info. ::: code-group ```ts twoslash [register config] // {"path":"/vercel/path0/site/react/getting-started.md","from":2479,"to":5900} // @twoslash-cache: {"v":1,"hash":"1e950b442ed7db157508f31fce13aca96913b67241b30d5521468ad652cad085","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAhVhBEBrAHKCAtgCMyAHhGT+7AOa86NMFDi8AwoZO8AvLfvHdpGMyiTWGXqgAdKV4QrUUVAFFaLEUPUjhEXmAgkNTUjy8fP1h+ZkFWNETk4LTS3gzvMF9eMGYNGESAkAi0fDI4EWYwJoBuFLLSiqzpUlZGgjQ0LASAehmYVvbOsAA6CV7+gfTPSurmLHYAVVHx/EnpxDn99hWFtvjltYgZ642S0oBfPvevzd4wpTKAAq7HqiQAjAAmAAMsO+aQMYDQpGYYgSST+aSGVT8MDAcEOYHYJHibAASvAIKwSUVMQNsXsoFAPHB0U1obQYFzuVzwQAWKAAdnBAA4RJCtHzBVAAJwyyEAZlgz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2sl1fqg1BtjXGzNWbS1aprXW25DB9D7o82thdW6j2XsGW+xk9UP1QcA3+hA/RjDPHta0GrFGmNCd43J2TWnNNpYM3Zyzfy4NDsnXyYLfyItJaq4kewhWvkDcgmHzSPW/tHdm3dyRK20LA9Tznifl28evbJ5NUHc/J6I6F7juXhBKd0EZ3xOQrvRd+93irpPOuw5xS+Q33IdI3dFyrnDNcKepA56pmFPmjKY+B0FFaLAdlJIkDmE/2rgIMdzikHAScUEIITDv5cUYMAQixFSKtLFQqau3BJuIR3FeIJVaoD5CCU4sb7B3ESwMhs1E2yYC7NvCB8FJhEhlJgBAfgL6TD9A+IuoqN5mBIFAOYGWEgwB4H0R8D4QA==="} // @errors: 2322 import { type Config } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' declare const config: Config // ---cut--- import { useBlockNumber } from 'wagmi' useBlockNumber({ chainId: 123 }) declare module 'wagmi' { interface Register { config: typeof config } } ``` ```ts twoslash [hook config property] // {"path":"/vercel/path0/site/react/getting-started.md","from":5943,"to":8411} // @twoslash-cache: {"v":1,"hash":"849a5652cb34072baf13797118507e525565a80b04851946389914c2dc341926","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAhVhBEBrAHKCAtgCMyAHhGT+7AOa86NMFDi8AwoZO8AvLfvGKvEfmbswASShm9DCW1gZgRsbIADognt5gcDEAushgmjqkKTHsUMlOHq7RsV4+iSApadpkWSA5ye6yrDBiACLMaMz5WiY+aAB8jFjMpMwaMDSkcAD8iLwAqrIKSmrpZAAKw6PjZHD6ru5xPv4NME2t7cx93LML8ooq6lWkAErjgqRgACrYMLqNzWg2h0+lEwOwNFgIKQ0NJFvcVk9KCAoEoEIgCGg0Fg4IgAPS4gDuzGMGnYADo4PhcaQYMwxLjmFh2LjCBBlHBcTI7stHhkkXAOtCkABOKhNMDGND4JAARgALFRBcZxnguUsHqtyGKfLhEAAGKhxEZiMg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lDjAmGqyZXqoVMilcyuZ8yFmMklLS1YxgDnrGOSYTYWwgEKmhb+vZVwDk3EOHcB5UETinBgmcnYtJLhXGuDcW5hynn3A2YhR4JCnkSmWUqkZOERn/k+RBC9Px6kKr+f8gFoYUOwWYBIUF2AwTgvARCyFQFJWSguCymFsI2XwsRYipEKLUVovRRizE2K0k4txPiAkhJkLAZpSR/8MrtEevJFiillI8VUuQ28mDwFqJ0oWdg+lDKwJMpQjR1kBx2Uio5Zyrl3KeR8n5AKQUQphQilFGKZE4rRPYSJLSDiZLOMqjlHieUCpeN4NwyphV6rFOqjSOqsMOxNRau1SkXUep9XYANd+w1RrjUmpsGaOxZgLVIEtNp+BVoQx2Jtbau19op1+MdU6zYLrXUrndauz13DiIjO9UEZpPpLx5ubQGgtTYb0QF5LeO90RhAiAfa2HdVbd18kcw0Vtna42hEBN06oEQZEqQIPaGg47U1JLHUEoIZYczIIwYAHgShz1fKxA4rhKncCRDNZgSBQDmAghIMAeAPZmjNEAA"} // @errors: 2322 import { type Config } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' declare const config: Config // ---cut--- import { useBlockNumber } from 'wagmi' useBlockNumber({ chainId: 123, config }) ``` By registering or using the hook `config` property, `useBlockNumber`'s `chainId` is strongly typed to only allow Mainnet and Sepolia IDs. Learn more by reading the [TypeScript docs](/react/typescript#config-types). ::: ### Wrap App in Context Provider Wrap your app in the `WagmiProvider` React Context Provider and pass the `config` you created earlier to the `config` property. ::: code-group ```tsx [app.tsx] // {"path":"/vercel/path0/site/react/getting-started.md","from":8831,"to":9099} import { WagmiProvider } from 'wagmi' // [!code focus] import { config } from './config' // [!code focus] function App() { return ( // [!code focus] {/** ... */} // [!code focus] // [!code focus] ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` Check out the [`WagmiProvider` docs](/react/api/WagmiProvider) to learn more about React Context in Wagmi. ### Setup TanStack Query Inside the `WagmiProvider`, wrap your app in a TanStack Query React Context Provider, e.g. `QueryClientProvider`, and pass a new `QueryClient` instance to the `client` property. ::: code-group ```tsx [app.tsx] // {"path":"/vercel/path0/site/react/getting-started.md","from":9495,"to":9955} import { QueryClient, QueryClientProvider } from '@tanstack/react-query' // [!code focus] import { WagmiProvider } from 'wagmi' import { config } from './config' const queryClient = new QueryClient() // [!code focus] function App() { return ( // [!code focus] {/** ... */} // [!code focus] // [!code focus] ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` Check out the [TanStack Query docs](https://tanstack.com/query/latest/docs/framework/react/overview) to learn about the library, APIs, and more. ### Use Wagmi Now that everything is set up, every component inside the Wagmi and TanStack Query Providers can use Wagmi React Hooks. ::: code-group ```tsx [profile.tsx] // {"path":"/vercel/path0/site/react/getting-started.md","from":10324,"to":10690} import { useConnection, useEnsName } from 'wagmi' export function Profile() { const { address } = useConnection() const { data, error, status } = useEnsName({ address }) if (status === 'pending') return
Loading ENS name
if (status === 'error') return
Error fetching ENS name: {error.message}
return
ENS name: {data}
} ``` ```tsx [app.tsx] // {"path":"/vercel/path0/site/react/getting-started.md","from":10712,"to":11122} import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { WagmiProvider } from 'wagmi' import { config } from './config' import { Profile } from './profile' const queryClient = new QueryClient() function App() { return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Next Steps For more information on what to do next, check out the following topics. * [**TypeScript**](/react/typescript) Learn how to get the most out of Wagmi's type-safety and inference for an enlightened developer experience. * [**Connect Wallet**](/react/guides/connect-wallet) Learn how to enable wallets to connect to and disconnect from your apps and display information about connected accounts. * [**React Hooks**](/react/api/hooks) Browse the collection of React Hooks and learn how to use them. * [**Viem**](/react/guides/viem) Learn about Viem and how it works with Wagmi. --- --- url: /solid/getting-started.md --- # Getting Started ## Overview `@wagmi/solid` is a collection of Solid primitives for Ethereum. You can learn more about the rationale behind the project in the [Why Wagmi](/solid/why) section. ## Manual Installation To manually add `@wagmi/solid` to your project, install the required packages. ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/solid/getting-started.md","from":475,"to":540} pnpm add @wagmi/solid viem@{{viemVersion}} @tanstack/solid-query ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/solid/getting-started.md","from":563,"to":631} npm install @wagmi/solid viem@{{viemVersion}} @tanstack/solid-query ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/solid/getting-started.md","from":655,"to":720} yarn add @wagmi/solid viem@{{viemVersion}} @tanstack/solid-query ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/solid/getting-started.md","from":743,"to":807} bun add @wagmi/solid viem@{{viemVersion}} @tanstack/solid-query ``` ::: * [Viem](https://viem.sh) is a TypeScript interface for Ethereum that performs blockchain operations. * [TanStack Query](https://tanstack.com/query/v5) is an async state manager that handles requests, caching, and more. * [TypeScript](/solid/typescript) is optional, but highly recommended. Learn more about [TypeScript support](/solid/typescript). ### Create Config Create and export a new Wagmi config using `createConfig`. ::: code-group ```ts [config.ts] // {"path":"/vercel/path0/site/solid/getting-started.md","from":1278,"to":1527} import { http, createConfig } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: In this example, Wagmi is configured to use the Mainnet and Sepolia chains, and `injected` connector. Check out the [`createConfig` docs](/solid/api/createConfig) for more configuration options. ::: details TypeScript Tip If you are using TypeScript, you can "register" the Wagmi config or use the hook `config` property to get strong type-safety across Solid Context in places that wouldn't normally have type info. ::: code-group ```ts twoslash [register config] // {"path":"/vercel/path0/site/solid/getting-started.md","from":2003,"to":6092} // @twoslash-cache: {"v":1,"hash":"5a265a7585bba6cc64f83e9dd43093d209786bd39bd0106c74836c3c3bff74f8","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAhVhBEBrAHKCAtgCMyAHhGT+7AOa86NMFDi8AwoZO8AvLfvHdpGMyiTWGXqgAdKV4QrUUVAFFaLEUPUjhEXmAgkNTUjy8fP1h+ZkFWNETk4LTS3gzvMF9eMGYNGESAkAi0fDI4EWYwJoBuFLLSiqzpUlZGgjQ0LASAehmYVvbOsAA6CV7+gfTPSurmLHYAVVHx/EnpxDn99hWFtvjltYgZ642S0oBfPvevzd4wpTKAAq7HqiQAjAAmAAMsO+aQMYDQpGYYgSST+aSGVT8MDAcEOYHYJHibAASvAIKwSUVMQNsXsoFAPHB0U1obQYFzuVzwQAWKAAdnBAA4RJCtHzBVAAJwyyEAZlgzC04IVCoArDB+XyeW8tlidsMASobBkaFBEoroSKNXaRfCBr93obMjjeBp8uJOqxWAraS76Ub3V5mfA2SAOZ1weCtLBoRqZYLBVoFQA2BUxtOC6GQkUitMSmCQ5jgwUKpNp6Pg/UGkIMvwm5RmzwWiF8zXp6Hgx1lZ1pfupFbD3j8j0QDy8YcrXu8EnsfgYAASXHwAH5EoxGCIOHjCrZd0jdNOAHwUXhYZgo+o0eKJABqZAXy9XAAUr3UFu0+I4T7xX6QEAaOwsi6FoEBUp4YAnnwAA+0iWDARhgDAUDfB857FGk07oQAumevAiPgzDsGAACSUBmPQeJWIRrjIE0REkfiTS4cgYCaDopBsU07BQKxTh0WARjGAxIBMaRcCsexnFkDxIB8ax56yKwMBiAAIswaDMIJWgmKRaAnowl7Xl+8QbtIsgKIC6jaGQKzvqZt5wPorjnhJ5FQMpMCqRpWnMDBiQyPI4RqLJpArBSaCCKQYBAtgMC6CpaloJp2knkELAcFwfC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XlhvfK0smm+y+aM0NyLCAxvXMjPiys0LhyDjHLJml85BxJuA/hjLPLWTHmzmVnI9WXd0aVb1jV1gFI6s0h12ne3B3WRtY651h2PXnb9bdkNsTXsxs+1W+990M3WxzYWxHKOLnrmh/jl6JOW3Gsa+GBnJPR3aDVlO+dguV3i53bLo90sz3q6vei5Xwv1Ri/B2+/yX7/2u7e+wsDvkraqeQ4xz89cfyp4zwPIj4FKPQVOfBZCreTld7woPki4+EEG3QTgghStaEyf33eI/Z+NO2FaMOhmCTvCWds+EdLtzkgLzk9IxmBuCDKM/I9CYnYjgtVEMqIogjyh8AIIigkgAALkLATUIcAzpBBBCIFLRcRbi46MDUrpKeRZIKjdzcDcD4GIQ7hXjFSg5QD5BNKYF9TYF1Z8R5IazcakC8bFSmZ1Lq7S6JCNKTrS79AfBk5NQ3jMBICgDmA6wSBgB4DOIfAfBAA="} // @errors: 2345 import { type Config } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' declare const config: Config // ---cut--- import { useBlockNumber } from '@wagmi/solid' useBlockNumber(() => ({ chainId: 123 })) declare module '@wagmi/solid' { interface Register { config: typeof config } } ``` ```ts twoslash [hook config property] // {"path":"/vercel/path0/site/solid/getting-started.md","from":6135,"to":9580} // @twoslash-cache: {"v":1,"hash":"f81e0bbbae23a2914d38755afa1fcae7b27d59df3ac778f5d55a5f0a3952daf7","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAhVhBEBrAHKCAtgCMyAHhGT+7AOa86NMFDi8AwoZO8AvLfvGKvEfmbswASShm9DCW1gZgRsbIADognt5gcDEAushgmjqkKTHsUMlOHq7RsV4+iSApadpkWSA5ye6yrDBiACLMaMz5WiY+aAB8jFjMpMwaMDSkcAD8iNKyCkpq6WQAdAAKw6PjZHD6ru5xPv4NME2t7cx93LMy8ooq6lWkKwBK44KkYAAq2DC6jc00G0On0omAWBwuHwwFs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NpsZ05BEDgV1Ee1h3piDnrTpra9JKyCYAfa4Z1rhoYupaaPVMqEOl5iEUPFCFFeliIGSDcik4pFbBkaolehVXIKLWYuWZtIjE7KWWvHcTHemrIvjx7mhi2MmKfkJxjf5GqtQzFYkCdS7GNTgghbpwn0wbywjhPCOxCLwB5KRBjRUT5USgDReAPlGKsVYuxLivF+KCWEqJCScZpKyQUkpFScmLMb34RVdoKKDJiSMiZOSZkdNv1ixvWyjZ2AOSci5IqG8vK2YXH5TKgVgqhXCpFGKcUEpJRSmlDKWUcocTyrljjakgvaV0mFzqNU5J1QarFpTCnQaON1NGsGE5PFRJATc+5/iFpBKeZwoe4TInIOeTsL5GCklPRemG96qSfp+pRUDdw1GMyDbAK6CGc6gVfplkgYy/6XaICisBjWeAwgRAgwbaDJs4NiW4idh0nsg6MxxMPbWiqX4CAwWXAAAkyFkQpBYLrBGCYHhIZpoMYNU2u/g6liQOAR103BuCyh2swJAoBzBYQkGAPA4dXSuiAA==="} // @errors: 2345 import { type Config } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' declare const config: Config // ---cut--- import { useBlockNumber } from '@wagmi/solid' useBlockNumber(() => ({ chainId: 123, config })) ``` By registering or using the hook `config` property, `useBlockNumber`'s `chainId` is strongly typed to only allow Mainnet and Sepolia IDs. Learn more by reading the [TypeScript docs](/solid/typescript#config-types). ::: ### Wrap App in Context Provider Wrap your app in the `WagmiProvider` Solid Context Provider and pass the `config` you created earlier to the `config` property. ::: code-group ```tsx [App.tsx] // {"path":"/vercel/path0/site/solid/getting-started.md","from":10001,"to":10191} import { WagmiProvider } from '@wagmi/solid' import { config } from './config' function App() { return ( {/** ... */} ) } ``` ```ts [config.ts] // {"path":"/vercel/path0/site/solid/getting-started.md","from":10213,"to":10462} import { http, createConfig } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: Check out the [`WagmiProvider` docs](/solid/api/WagmiProvider) to learn more about Solid Context in Wagmi. ### Setup TanStack Query Inside the `WagmiProvider`, wrap your app in a TanStack Query Solid Context Provider, e.g. `QueryClientProvider`, and pass a new `QueryClient` instance to the `client` property. ::: code-group ```tsx [App.tsx] // {"path":"/vercel/path0/site/solid/getting-started.md","from":10816,"to":11198} import { QueryClient, QueryClientProvider } from '@tanstack/solid-query' import { WagmiProvider } from '@wagmi/solid' import { config } from './config' const queryClient = new QueryClient() function App() { return ( {/** ... */} ) } ``` ```ts [config.ts] // {"path":"/vercel/path0/site/solid/getting-started.md","from":11220,"to":11469} import { http, createConfig } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: Check out the [TanStack Query docs](https://tanstack.com/query/latest/docs/framework/solid/overview) to learn about the library, APIs, and more. ### Use Wagmi Now that everything is set up, every component inside the Wagmi and TanStack Query Providers can use Wagmi Solid Primitives. ::: code-group ```tsx [Profile.tsx] // {"path":"/vercel/path0/site/solid/getting-started.md","from":11801,"to":12035} import { useConnection } from '@wagmi/solid' export function Profile() { const connection = useConnection() return (

Address: {connection.address}

Status: {connection.status}

) } ``` ```tsx [App.tsx] // {"path":"/vercel/path0/site/solid/getting-started.md","from":12057,"to":12474} import { QueryClient, QueryClientProvider } from '@tanstack/solid-query' import { WagmiProvider } from '@wagmi/solid' import { config } from './config' import { Profile } from './Profile' const queryClient = new QueryClient() function App() { return ( ) } ``` ```ts [config.ts] // {"path":"/vercel/path0/site/solid/getting-started.md","from":12496,"to":12745} import { http, createConfig } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: ## Next Steps For more information on what to do next, check out the following topics. * [**TypeScript**](/solid/typescript) Learn how to get the most out of Wagmi's type-safety and inference for an enlightened developer experience. * [**Connect Wallet**](/solid/guides/connect-wallet) Learn how to enable wallets to connect to and disconnect from your apps and display information about connected accounts. * [**Solid Primitives**](/solid/api/primitives) Browse the collection of Solid Primitives and learn how to use them. * [**Viem**](/solid/guides/viem) Learn about Viem and how it works with Wagmi. --- --- url: /tempo/getting-started.md --- # Getting Started ## Overview [Tempo](https://tempo.xyz) is a purpose-built Layer 1 blockchain optimized for payments. It enshrines features like [token management](https://docs.tempo.xyz/protocol/tip20/overview), [Fee AMM](https://docs.tempo.xyz/protocol/fees), and a [stablecoin DEX](https://docs.tempo.xyz/protocol/exchange) directly into the protocol, as well as a [Tempo transaction type](https://docs.tempo.xyz/protocol/transactions) with support for batch calls, fee sponsorship, configurable fee tokens, concurrent transactions, access keys, and scheduled execution. ## Setup Wagmi React and Core both have first-class support for Tempo with [Hooks](/tempo/hooks/) and [Actions](/tempo/actions/). To get started, first follow the [Getting Started guide for React](/react/getting-started) or [Core](/core/getting-started) and make sure your [Viem](https://viem.sh) version is `{{viemVersion}}`. ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/tempo/getting-started.md","from":1147,"to":1206} pnpm add viem@{{viemVersion}} accounts@{{accountsVersion}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/tempo/getting-started.md","from":1228,"to":1290} npm install viem@{{viemVersion}} accounts@{{accountsVersion}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/tempo/getting-started.md","from":1313,"to":1372} yarn add viem@{{viemVersion}} accounts@{{accountsVersion}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/tempo/getting-started.md","from":1395,"to":1453} bun add viem@{{viemVersion}} accounts@{{accountsVersion}} ``` ::: To dive a layer deeper, check out the [Viem Tempo docs](https://viem.sh/tempo). ## Use Wagmi Hooks Now that everything is set up, we can use regular Wagmi Hooks (e.g. `useSendTransactionSync`) that are decorated with [Tempo properties](https://docs.tempo.xyz/protocol/transactions/spec-tempo-transaction) like `calls` (batch transactions), `feePayer` (fee sponsorship), `nonceKey` (concurrent transactions) and more! ::: code-group ```tsx [tokenMetadata.tsx] // {"path":"/vercel/path0/site/tempo/getting-started.md","from":1927,"to":2813} import { useSendTransactionSync } from 'wagmi' export function TokenMetadata() { const sendTransactionSync = useSendTransactionSync() return ( ) } ``` ```tsx [app.tsx] // {"path":"/vercel/path0/site/tempo/getting-started.md","from":2834,"to":3262} import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { WagmiProvider } from 'wagmi' import { config } from './config' import { TokenMetadata } from './tokenMetadata' const queryClient = new QueryClient() function App() { return ( ) } ``` ```tsx [config.ts] // {"path":"/vercel/path0/site/tempo/getting-started.md","from":3285,"to":3584} import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Use Tempo Hooks You can also use [Tempo-specific Hooks](/tempo/hooks/): ::: code-group ```tsx [tokenMetadata.tsx] // {"path":"/vercel/path0/site/tempo/getting-started.md","from":3713,"to":4184} import { Hooks } from 'wagmi/tempo' const alphaUsd = '0x20c0000000000000000000000000000000000001' export function TokenMetadata() { const { data: metadata, ...metadataQuery } = Hooks.token.useGetMetadata({ token: alphaUsd }) if (metadataQuery.isError) return
Error fetching metadata: {metadataQuery.error.message}
if (metadataQuery.isLoading) return
Loading metadata...
return
{metadata.name} ({metadata.symbol})
} ``` ```tsx [app.tsx] // {"path":"/vercel/path0/site/tempo/getting-started.md","from":4206,"to":4634} import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { WagmiProvider } from 'wagmi' import { config } from './config' import { TokenMetadata } from './tokenMetadata' const queryClient = new QueryClient() function App() { return ( ) } ``` ```tsx [config.ts] // {"path":"/vercel/path0/site/tempo/getting-started.md","from":4658,"to":4957} import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Use Tempo Actions You can also use [Tempo-specific Actions](/tempo/actions/) directly via the `wagmi/tempo` and `@wagmi/core/tempo` entrypoints: ::: code-group ```ts [React] // {"path":"/vercel/path0/site/tempo/getting-started.md","from":5147,"to":5426} import { Actions } from 'wagmi/tempo' import { config } from './config' const alphaUsd = '0x20c0000000000000000000000000000000000001' const metadata = await Actions.token.getMetadata(config, { token: alphaUsd, }) console.log('Token:', metadata.name, `(${metadata.symbol})`) ``` ```ts [React config.ts] // {"path":"/vercel/path0/site/tempo/getting-started.md","from":5455,"to":5754} import { createConfig, http } from 'wagmi' import { tempo } from 'wagmi/chains' import { tempoWallet } from 'wagmi/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ```ts [Core] // {"path":"/vercel/path0/site/tempo/getting-started.md","from":5772,"to":6057} import { Actions } from '@wagmi/core/tempo' import { config } from './config' const alphaUsd = '0x20c0000000000000000000000000000000000001' const metadata = await Actions.token.getMetadata(config, { token: alphaUsd, }) console.log('Token:', metadata.name, `(${metadata.symbol})`) ``` ```ts [Core config.ts] // {"path":"/vercel/path0/site/tempo/getting-started.md","from":6085,"to":6402} import { createConfig, http } from '@wagmi/core' import { tempo } from '@wagmi/core/chains' import { tempoWallet } from '@wagmi/core/tempo' export const config = createConfig({ connectors: [tempoWallet()], chains: [tempo], multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` ::: ## Next Steps After you have set up your Tempo with Wagmi, you can now: * [**Guides & Examples**](https://docs.tempo.xyz/guide/tempo-transaction) Follow guides on how to [use accounts](https://docs.tempo.xyz/guide/use-accounts), [make payments](https://docs.tempo.xyz/guide/payments), [issue stablecoins](https://docs.tempo.xyz/guide/issuance), [exchange stablecoins](https://docs.tempo.xyz/guide/stablecoin-exchange), and more! * [**Tempo React Hooks**](/tempo/hooks/) Browse the collection of React Hooks and learn how to use them. * [**Tempo Core Actions**](/tempo/actions/) Browse the collection of Core Actions and learn how to use them. --- --- url: /vue/getting-started.md --- # Getting Started ## Overview Wagmi is a collection of Vue composition utilities for Ethereum. You can learn more about the rationale behind the project in the [Why Wagmi](/vue/why) section. ## Automatic Installation For new projects, it is recommended to set up your Wagmi app using the [`create-wagmi`](/cli/create-wagmi) command line interface (CLI). This will create a new Wagmi project using TypeScript and install the required dependencies. ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/vue/getting-started.md","from":621,"to":639} pnpm create wagmi ``` ```bash [npm] // {"path":"/vercel/path0/site/vue/getting-started.md","from":658,"to":682} npm create wagmi@latest ``` ```bash [yarn] // {"path":"/vercel/path0/site/vue/getting-started.md","from":702,"to":720} yarn create wagmi ``` ```bash [bun] // {"path":"/vercel/path0/site/vue/getting-started.md","from":739,"to":756} bun create wagmi ``` ::: Once the command runs, you'll see some prompts to complete. ```ansi // {"path":"/vercel/path0/site/vue/getting-started.md","from":834,"to":900} Project name: wagmi-project Select a framework: Vue / Vanilla ... ``` After the prompts, `create-wagmi` will create a directory with your project name and install the required dependencies. Check out the `README.md` for further instructions (if required). ## Manual Installation To manually add Wagmi to your project, install the required packages. ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/vue/getting-started.md","from":1221,"to":1282} pnpm add @wagmi/vue viem@{{viemVersion}} @tanstack/vue-query ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/vue/getting-started.md","from":1305,"to":1369} npm install @wagmi/vue viem@{{viemVersion}} @tanstack/vue-query ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/vue/getting-started.md","from":1393,"to":1454} yarn add @wagmi/vue viem@{{viemVersion}} @tanstack/vue-query ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/vue/getting-started.md","from":1477,"to":1537} bun add @wagmi/vue viem@{{viemVersion}} @tanstack/vue-query ``` ::: * [Viem](https://viem.sh) is a TypeScript interface for Ethereum that performs blockchain operations. * [TanStack Query](https://tanstack.com/query/v5) is an async state manager that handles requests, caching, and more. * [TypeScript](/vue/typescript) is optional, but highly recommended. Learn more about [TypeScript support](/vue/typescript). ### Create Config Create and export a new Wagmi config using `createConfig`. ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` In this example, Wagmi is configured to use the Mainnet and Sepolia chains, and `injected` connector. Check out the [`createConfig` docs](/vue/api/createConfig) for more configuration options. ::: details TypeScript Tip If you are using TypeScript, you can "register" the Wagmi config or use the hook `config` property to get strong type-safety in places that wouldn't normally have type info. ::: code-group ```ts twoslash [register config] // {"path":"/vercel/path0/site/vue/getting-started.md","from":2475,"to":6000} // @twoslash-cache: {"v":1,"hash":"a23946e4e600232f2356272aa1638ad6dfa3cb14a3230c917234b4d331429652","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAhVhBEBrAHKCAtgCMyAHhGT+7AOa86NMFDi8AwoZO8AvLfvHdpGMyiTWGXqgAdKV4QrUUVAFFaLEUPUjhEXmAgkNTUjy8fP1h+ZkFWNETk4LTS3gzvMF9eMGYNGESAkAi0fDI4EWYwJoBuFLLSiqzpUlZGgjQ0LASAehmYVvbOsAA6CV7+gfTPSurmLHYAVVHx/EnpxDn99hWFtvjltYgZ642S0oBfPvevzd4wpTKAAq7HqiQAjAAmAAMsO+aQMYDQpGYYgSST+aSGVT8MDAcEOYHYJHibAASvAIKwSUVMQNsXsoFAPHB0U1obQYFzuVzwQAWKAAdnBAA4RJCtHzBVAAJwyyEAZlgzC04IVCoArDB+XyeW8tlidsMASobBkaFBEoroSKNXaRfCBr93obMjjeBp8uJOqxWAraS76Ub3V5mfA2SAOZ1weCtLBoRqZYLBVoFQA2BUxtOC6GQkUitMS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tj8vLVHSt/of1GYVQnENZnaCNrTq2zOHau2517cWUsA7i5Dpc6K0d7nvYTv5FOmdTc5PvEXXyDucTL5pA3RegeO7h5Ij3fViep5D3L2PfPM9i8WpXuPT+de96t5gQgs+6Cr6yk7M/Vfc+JW11fvwvsyF3SNlgc0ZBjaMGGUmHg4c9pEiXkymvjo2A5iUEzSSGggRgDm4CHvf4gAAvg4CxCYB+KCEEfh0CuKMGAIRYipEKIQkVM3bgb3EI7ivHE5dUB8hxL8Q9hqT32overQZAFqJgUwFBbeULm3jCJD6TACA/B8MmH6B8L9JUbzMCQKAcwSsJBgDwDYj4HwgA=="} // @errors: 2322 import { type Config } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' declare const config: Config // ---cut--- import { useBlockNumber } from '@wagmi/vue' useBlockNumber({ chainId: 123 }) declare module '@wagmi/vue' { interface Register { config: typeof config } } ``` ```ts twoslash [hook config property] // {"path":"/vercel/path0/site/vue/getting-started.md","from":6043,"to":8630} // @twoslash-cache: {"v":1,"hash":"b0daf106bbcd51604a04f61b444559e5b4612f840caeff27571cf1d2939b54a2","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAhVhBEBrAHKCAtgCMyAHhGT+7AOa86NMFDi8AwoZO8AvLfvGKvEfmbswASShm9DCW1gZgRsbIADognt5gcDEAushgmjqkKTHsUMlOHq7RsV4+iSApadpkWSA5ye6yrDBiACLMaMz5WiY+aAB8jFjMpMwaMDSkcAD6APyIvACqsgpKaulkAArDo+NkcPqu7nE+/g0wTa3tzH3c80vyiirqVaQASuOCpGAAKtgwuo1mmg2h0+lEwOwNFgIKQ0NJlo81i9KCAoEoEIgCGg0Fg4IgAPT4gDuzGMGnYADo4Ph8URBDB8cwsOx8QYoRA4MwtE04PiZA9Vs8Mii4B1YUgAJxUJpgYxofBIACMABYqGLjOM8PyVk91uRpT5cIgAAxUOIjMRkSUAXw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WeetEDe3NMwJeSpV52nXhbTexBt5ukxHvCAB9MDH1cOfBuzdW4wHbv6VwQMAwRGDDZIsMZoLZRTGmJqmZvq4WsplIsJYywVksulAyvAmxjHHG2WckxOzdhAGVPCVCRw7nHAeScx5zwiPnIucRy4By8M3NuXc+5DxThvGedsSjLwSBvGlWsVV4wWLjNlT8Ai6r/kAv2ECYEIJQUkWw+CCQkLsBQmwdCmFsLMPShldcdkoBEXgI5ci1FqK0QYsxVi7FOLcT4qGLQgkRJiWVBJKiZjpK8Oyrldo71VI8XUppYS2k1Evgkaw0JRkKzsFMuZbhVkNHhIcuOZycU3IeS8j5PygVgqhXCpFaKsV4qJToslHpeT3GhMKUpEpdVCrCWKqVapvArFbLKq1FZDUmotRqu1daXVerUgGkNEa7AxrzBsJNaas15rbCWnseYa1SAbXOfgVGry9pOEOsdU6Bd/iXWul2O6j0B4vSHp9dwbj4y/XBNaf6z9B5vWHh/CWLt/KO3lkgXFgDSCqzwGECI4CPYL2NsvIKKK3awADhTOEwAqaaz1FsgQJ0NBZwAAKs3JJzGAmdwTgg1sjF4jAWWgJUvYniRxSHWm4CiJazAkCgHMAhCQYA8Ch2tNaIAA=="} // @errors: 2322 import { type Config } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' declare const config: Config // ---cut--- import { useBlockNumber } from '@wagmi/vue' useBlockNumber({ chainId: 123, config }) ``` By registering or using the hook `config` property, `useBlockNumber`'s `chainId` is strongly typed to only allow Mainnet and Sepolia IDs. Learn more by reading the [TypeScript docs](/vue/typescript#config-types). ::: ### Add Plugin to App Add the `WagmiPlugin` to your app instance and pass the `config` you created earlier to the plugin options. ::: code-group ```tsx [main.ts] // {"path":"/vercel/path0/site/vue/getting-started.md","from":9017,"to":9268} import { WagmiPlugin } from '@wagmi/vue' // [!code focus] import { createApp } from 'vue' import { config } from './config' // [!code focus] import App from './App.vue' createApp(App) .use(WagmiPlugin, { config }) // [!code focus] .mount('#app') ``` ```vue [App.vue] // {"path":"/vercel/path0/site/vue/getting-started.md","from":9289,"to":9312} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` Check out the [`WagmiPlugin` docs](/vue/api/WagmiPlugin) to learn more about the plugin API. ### Setup TanStack Query After the `WagmiPlugin`, attach the `VueQueryPlugin` to your app, and pass a new `QueryClient` instance to the `queryClient` property. ::: code-group ```tsx [main.ts] // {"path":"/vercel/path0/site/vue/getting-started.md","from":9649,"to":10045} import { QueryClient, VueQueryPlugin } from '@tanstack/vue-query' // [!code focus] import { WagmiPlugin } from '@wagmi/vue' import { createApp } from 'vue' import { config } from './config' import App from './App.vue' const queryClient = new QueryClient() // [!code focus] createApp(App) .use(WagmiPlugin, { config }) .use(VueQueryPlugin, { queryClient }) // [!code focus] .mount('#app') ``` ```vue [App.vue] // {"path":"/vercel/path0/site/vue/getting-started.md","from":10066,"to":10089} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` Check out the [TanStack Query docs](https://tanstack.com/query/latest/docs/framework/vue/overview) to learn about the library, APIs, and more. ### Use Wagmi Now that everything is set up, every component inside your app can use Wagmi Vue Composables. ::: code-group ```vue [App.vue] // {"path":"/vercel/path0/site/vue/getting-started.md","from":10424,"to":10823} ``` ```tsx [main.ts] // {"path":"/vercel/path0/site/vue/getting-started.md","from":10844,"to":11189} import { QueryClient, VueQueryPlugin } from '@tanstack/vue-query' import { WagmiPlugin } from '@wagmi/vue' import { createApp } from 'vue' import { config } from './config' import App from './App.vue' const queryClient = new QueryClient() createApp(App) .use(WagmiPlugin, { config }) .use(VueQueryPlugin, { queryClient }) .mount('#app') ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Next Steps For more information on what to do next, check out the following topics. * [**TypeScript**](/vue/typescript) Learn how to get the most out of Wagmi's type-safety and inference for an enlightened developer experience. * [**Connect Wallet**](/vue/guides/connect-wallet) Learn how to enable wallets to connect to and disconnect from your apps and display information about connected accounts. * [**Vue Composables**](/vue/api/composables) Browse the collection of Vue Composables and learn how to use them. * [**Viem**](/vue/guides/viem) Learn about Viem and how it works with Wagmi. --- --- url: /core/api/actions/getTransaction.md --- # getTransaction Action for fetching transactions given hashes or block identifiers. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransaction.md","from":234,"to":279} import { getTransaction } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransaction.md","from":326,"to":532} import { getTransaction } from '@wagmi/core' import { config } from './config' const transaction = getTransaction(config, { hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransaction.md","from":603,"to":663} import { type GetTransactionParameters } from '@wagmi/core' ``` *** ### blockHash `bigint | undefined` Block hash to get transaction at (with [`index`](#index)). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransaction.md","from":802,"to":1042} import { getTransaction } from '@wagmi/core' import { config } from './config' const transaction = getTransaction(config, { blockHash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', // [!code focus] index: 0, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` Block number to get transaction at (with [`index`](#index)). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransaction.md","from":1225,"to":1408} import { getTransaction } from '@wagmi/core' import { config } from './config' const transaction = getTransaction(config, { blockNumber: 17829139n, // [!code focus] index: 0, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get transaction at (with [`index`](#index)). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransaction.md","from":1635,"to":1812} import { getTransaction } from '@wagmi/core' import { config } from './config' const transaction = getTransaction(config, { blockTag: 'safe', // [!code focus] index: 0, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransaction.md","from":1998,"to":2295} import { getTransaction } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const transaction = await getTransaction(config, { chainId: mainnet.id, // [!code focus] hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### hash `` `0x${string}` | undefined `` Hash to get transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransaction.md","from":2446,"to":2669} import { getTransaction } from '@wagmi/core' import { config } from './config' const transaction = getTransaction(config, { hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### index `number | undefined` An index to be used with a block identifier ([hash](#blockhash), [number](#blocknumber), or [tag](#blocktag)). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransaction.md","from":2896,"to":3073} import { getTransaction } from '@wagmi/core' import { config } from './config' const transaction = getTransaction(config, { blockTag: 'safe', index: 0 // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransaction.md","from":3145,"to":3205} import { type GetTransactionReturnType } from '@wagmi/core' ``` [`Transaction`](https://viem.sh/docs/glossary/types#transaction) ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransaction.md","from":3292,"to":3351} import { type GetTransactionErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getTransaction`](https://viem.sh/docs/actions/public/getTransaction) --- --- url: /core/api/actions/getTransactionConfirmations.md --- # getTransactionConfirmations Action for fetching the number of blocks passed (confirmations) since the transaction was processed on a block. If confirmations is 0, then the Transaction has not been confirmed & processed yet. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransactionConfirmations.md","from":401,"to":459} import { getTransactionConfirmations } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransactionConfirmations.md","from":506,"to":738} import { getTransactionConfirmations } from '@wagmi/core' import { config } from './config' const transaction = getTransactionConfirmations(config, { hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransactionConfirmations.md","from":809,"to":882} import { type GetTransactionConfirmationsParameters } from '@wagmi/core' ``` *** ### hash `` `0x${string}` | undefined `` The hash of the transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransactionConfirmations.md","from":997,"to":1246} import { getTransactionConfirmations } from '@wagmi/core' import { config } from './config' const transaction = getTransactionConfirmations(config, { hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### transactionReceipt `TransactionReceipt | undefined` The transaction receipt. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransactionConfirmations.md","from":1412,"to":1614} import { getTransactionConfirmations } from '@wagmi/core' import { config } from './config' const transaction = getTransactionConfirmations(config, { transactionReceipt: { ... }, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransactionConfirmations.md","from":1800,"to":2123} import { getTransactionConfirmations } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const transaction = await getTransactionConfirmations(config, { chainId: mainnet.id, // [!code focus] hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransactionConfirmations.md","from":2195,"to":2268} import { type GetTransactionConfirmationsReturnType } from '@wagmi/core' ``` `bigint` The number of blocks passed since the transaction was processed. If confirmations is 0, then the Transaction has not been confirmed & processed yet. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransactionConfirmations.md","from":2449,"to":2521} import { type GetTransactionConfirmationsErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getTransactionConfirmations`](https://viem.sh/docs/actions/public/getTransactionConfirmations) --- --- url: /core/api/actions/getTransactionCount.md --- # getTransactionCount Action for fetching the number of transactions an Account has sent. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransactionCount.md","from":249,"to":299} import { getTransactionCount } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransactionCount.md","from":346,"to":546} import { getTransactionCount } from '@wagmi/core' import { config } from './config' const transactionCount = getTransactionCount(config, { address: '0x4557B18E779944BFE9d78A672452331C186a9f48', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransactionCount.md","from":617,"to":682} import { type GetTransactionCountParameters } from '@wagmi/core' ``` *** ### address `Address` The address of the account. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransactionCount.md","from":777,"to":994} import { getTransactionCount } from '@wagmi/core' import { config } from './config' const transactionCount = getTransactionCount(config, { address: '0x4557B18E779944BFE9d78A672452331C186a9f48', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### blockNumber `bigint | undefined` Get the count at a block number. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransactionCount.md","from":1154,"to":1397} import { getTransactionCount } from '@wagmi/core' import { config } from './config' const transactionCount = getTransactionCount(config, { address: '0x4557B18E779944BFE9d78A672452331C186a9f48', blockNumber: 17829139n, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Get the count at a block tag. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransactionCount.md","from":1596,"to":1835} import { getTransactionCount } from '@wagmi/core' import { config } from './config' const transactionCount = getTransactionCount(config, { address: '0x4557B18E779944BFE9d78A672452331C186a9f48', blockTag: 'latest', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransactionCount.md","from":2021,"to":2261} import { getTransactionCount } from '@wagmi/core' import { config } from './config' const transactionCount = getTransactionCount(config, { address: '0x4557B18E779944BFE9d78A672452331C186a9f48', chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransactionCount.md","from":2334,"to":2399} import { type GetTransactionCountReturnType } from '@wagmi/core' ``` `number` The number of transactions an account has sent. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransactionCount.md","from":2479,"to":2543} import { type GetTransactionCountErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getTransactionCount`](https://viem.sh/docs/actions/public/getTransactionCount) --- --- url: /core/api/actions/getTransactionReceipt.md --- # getTransactionReceipt Action for return the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt) given a [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransactionReceipt.md","from":365,"to":417} import { getTransactionReceipt } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransactionReceipt.md","from":464,"to":670} import { getTransactionReceipt } from '@wagmi/core' import { config } from './config' await getTransactionReceipt(config, { hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransactionReceipt.md","from":741,"to":808} import { type GetTransactionReceiptParameters } from '@wagmi/core' ``` ### hash `` `0x${string}` `` A transaction hash. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransactionReceipt.md","from":897,"to":1120} import { getTransactionReceipt } from '@wagmi/core' import { config } from './config' await getTransactionReceipt(config, { hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` The ID of chain to return the transaction receipt from. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getTransactionReceipt.md","from":1318,"to":1609} import { getTransactionReceipt } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' await getTransactionReceipt(config, { chainId: mainnet.id, // [!code focus] hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransactionReceipt.md","from":1681,"to":1748} import { type GetTransactionReceiptReturnType } from '@wagmi/core' ``` [`TransactionReceipt`](https://viem.sh/docs/glossary/types#transactionreceipt) The transaction receipt. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getTransactionReceipt.md","from":1875,"to":1941} import { type GetTransactionReceiptErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`getTransactionReceipt`](https://viem.sh/docs/actions/public/getTransactionReceipt) --- --- url: /core/api/actions/getWalletClient.md --- # getWalletClient Action for getting a Viem [`WalletClient`](https://viem.sh/docs/clients/wallet) object for the current or provided connector. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/getWalletClient.md","from":295,"to":341} import { getWalletClient } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getWalletClient.md","from":388,"to":508} import { getWalletClient } from '@wagmi/core' import { config } from './config' const client = getWalletClient(config) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: warning If you want to optimize bundle size, you should use [`getConnectorClient`](/core/api/actions/getConnectorClient) along with Viem's [tree-shakable actions](https://viem.sh/docs/clients/custom#tree-shaking) instead. Since Wallet Client has all wallet actions attached directly to it. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/getWalletClient.md","from":878,"to":939} import { type GetWalletClientParameters } from '@wagmi/core' ``` ### account `Address | Account | undefined` Account to use with client. Throws if account is not found on [`connector`](#connector). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getWalletClient.md","from":1112,"to":1311} import { getWalletClient } from '@wagmi/core' import { config } from './config' const client = getWalletClient(config, { account: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use with client. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getWalletClient.md","from":1485,"to":1695} import { getWalletClient } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const client = getWalletClient(config, { chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` * Connector to get client for. * Defaults to current connector. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/getWalletClient.md","from":1882,"to":2123} import { getConnections, getWalletClient } from '@wagmi/core' import { config } from './config' const connections = getConnections(config) const client = getWalletClient(config, { connector: connections[0]?.connector, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/getWalletClient.md","from":2195,"to":2251} import { type GetChainIdReturnType } from '@wagmi/core' ``` `WalletClient` Viem [`WalletClient`](https://viem.sh/docs/clients/wallet) object for the current or provided connector. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/getWalletClient.md","from":2394,"to":2454} import { type GetWalletClientErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` --- --- url: /cli/api/plugins/hardhat.md --- # hardhat Plugin for resolving ABIs from [Hardhat](https://hardhat.org) projects. Supports [`watch`](/cli/api/commands/generate#w-watch) mode. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/hardhat.md","from":151,"to":196} import { hardhat } from '@wagmi/cli/plugins' ``` ## Usage ```ts{2,6-8} // {"path":"/vercel/path0/site/cli/api/plugins/hardhat.md","from":224,"to":420} import { defineConfig } from '@wagmi/cli' import { hardhat } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ hardhat({ project: '../hello_hardhat', }), ], }) ``` ## Configuration ```ts // {"path":"/vercel/path0/site/cli/api/plugins/hardhat.md","from":449,"to":505} import { type HardhatConfig } from '@wagmi/cli/plugins' ``` ### artifacts `string | undefined` * Project's artifacts directory. Same as your project's `artifacts` [path configuration](https://hardhat.org/hardhat-runner/docs/config#path-configuration) option. * Defaults to `'artifacts/'`. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/hardhat.md","from":748,"to":986} import { defineConfig } from '@wagmi/cli' import { hardhat } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ hardhat({ artifacts: 'out/', // [!code focus] project: '../hello_hardhat', }), ], }) ``` ### deployments `{ [key: string]: address?: Address | Record | undefined } | undefined` Mapping of addresses to attach to artifacts. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/hardhat.md","from":1151,"to":1627} import { defineConfig } from '@wagmi/cli' import { hardhat } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ hardhat({ project: '../hello_hardhat', deployments: { // [!code focus] Counter: { // [!code focus] 1: '0x314159265dd8dbb310642f98f50c066173c1259b', // [!code focus] 5: '0x112234455c3a32fd11230c42e7bccd4a84e02010', // [!code focus] }, // [!code focus] }, // [!code focus] }), ], }) ``` ### exclude `string[] | undefined` Artifact files to exclude relative to `artifacts`. Supports glob patterns. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/hardhat.md","from":1751,"to":2163} import { defineConfig } from '@wagmi/cli' import { hardhat } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ hardhat({ exclude: [ // [!code focus] // the following patterns are excluded by default // [!code focus] 'build-info/**', // [!code focus] '*.dbg.json', // [!code focus] ], // [!code focus] project: '../hello_hardhat', }), ], }) ``` ### commands `{ clean?: string | boolean | undefined; build?: string | boolean | undefined; rebuild?: string | boolean | undefined } | undefined` Hardhat command options. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/hardhat.md","from":2348,"to":2773} import { defineConfig } from '@wagmi/cli' import { hardhat } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ hardhat({ commands: { // [!code focus] clean: 'pnpm hardhat clean', // [!code focus] build: 'pnpm hardhat compile', // [!code focus] rebuild: 'pnpm hardhat compile', // [!code focus] }, // [!code focus] project: '../hello_hardhat', }), ], }) ``` #### clean * Remove build artifacts and cache directories on start up. * Defaults to `'${packageManger} hardhat clean'`. #### build * Build Foundry project before fetching artifacts. * Defaults to `'${packageManger} hardhat compile'`. #### rebuild * Command to run when watched file or directory is changed. Used for setting up [`watch`](/cli/api/commands/generate#w-watch) mode. * Defaults to `'${packageManger} hardhat compile'`. ### include `string[] | undefined` Artifact files to include relative to `artifacts`. Supports glob patterns. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/hardhat.md","from":3335,"to":3701} import { defineConfig } from '@wagmi/cli' import { hardhat } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ hardhat({ include: [ // [!code focus] // the following patterns are included by default // [!code focus] '*.json', // [!code focus] ], // [!code focus] project: '../hello_hardhat', }), ], }) ``` ### namePrefix `string | undefined` Prefix to prepend to artifact names. Useful for preventing name collisions between contracts from other sources. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/hardhat.md","from":3864,"to":4111} import { defineConfig } from '@wagmi/cli' import { hardhat } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ hardhat({ namePrefix: 'HelloHardhat', // [!code focus] project: '../hello_hardhat', }), ], }) ``` ### project `string` Path to Hardhat project. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/hardhat.md","from":4171,"to":4384} import { defineConfig } from '@wagmi/cli' import { hardhat } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ hardhat({ project: '../hello_hardhat', // [!code focus] }), ], }) ``` --- --- url: /react/api/hooks.md --- # Hooks React Hooks for accounts, wallets, contracts, transactions, signing, ENS, and more. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks.md","from":316,"to":354} import { useConnection } from 'wagmi' ``` ## Available Hooks --- --- url: /core/api/transports/http.md --- # http The `http` Transport connects to a JSON-RPC API via HTTP. Wraps Viem's [`http` Transport](https://viem.sh/docs/clients/transports/http). ## Import ```ts-vue import { http } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, http // [!code hl] } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: http('https://foo-bar-baz.quiknode.pro/...'), // [!code hl] [sepolia.id]: http('https://foo-bar-sep.quiknode.pro/...'), // [!code hl] }, }) ``` ::: warning If no URL is provided, then the transport will fall back to a public RPC URL on the chain. It is highly recommended to provide an authenticated RPC URL to prevent rate-limiting. ::: ### Batch JSON-RPC The `http` Transport supports Batch JSON-RPC. This means that multiple JSON-RPC requests can be sent in a single HTTP request. The Transport will batch up Actions over a given period and execute them in a single Batch JSON-RPC HTTP request. By default, this period is a [zero delay](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#zero_delays) meaning that the batch request will be executed at the end of the current [JavaScript message queue](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#queue). Consumers can specify a custom time period `wait` (in ms). You can enable Batch JSON-RPC by setting the `batch` flag to `true`: ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: true // [!code hl] }) ``` ## Parameters ### url `string` URL of the JSON-RPC API. Defaults to `chain.rpcUrls.default.http[0]`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...') ``` ### batch `boolean | BatchOptions` Toggle to enable Batch JSON-RPC. Defaults to `false` ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: true // [!code focus] }) ``` ### batch.batchSize `number` The maximum number of JSON-RPC requests to send in a batch. Defaults to `1_000`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: { batchSize: 2_000 // [!code focus] } }) ``` ### batch.wait `number` The maximum number of milliseconds to wait before sending a batch. Defaults to `0` ([zero delay](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#zero_delays)). ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: { wait: 16 // [!code focus] } }) ``` ### fetchOptions [`RequestInit`](https://developer.mozilla.org/en-US/docs/Web/API/fetch) [Fetch options](https://developer.mozilla.org/en-US/docs/Web/API/fetch) to pass to the internal `fetch` function. Useful for passing auth headers or cache options. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { fetchOptions: { // [!code focus:5] headers: { 'Authorization': 'Bearer ...' } } }) ``` ### key `string` A key for the Transport. Defaults to `"http"`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { key: 'alchemy', // [!code focus] }) ``` ### name `string` A name for the Transport. Defaults to `"HTTP JSON-RPC"`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { name: 'Alchemy HTTP Provider', // [!code focus] }) ``` ### retryCount `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { retryCount: 5, // [!code focus] }) ``` ### retryDelay `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { retryDelay: 100, // [!code focus] }) ``` ### timeout `number` The timeout for requests. Defaults to `10_000`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { timeout: 60_000, // [!code focus] }) ``` --- --- url: /react/api/transports/http.md --- # http The `http` Transport connects to a JSON-RPC API via HTTP. Wraps Viem's [`http` Transport](https://viem.sh/docs/clients/transports/http). ## Import ```ts-vue import { http } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, http // [!code hl] } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: http('https://foo-bar-baz.quiknode.pro/...'), // [!code hl] [sepolia.id]: http('https://foo-bar-sep.quiknode.pro/...'), // [!code hl] }, }) ``` ::: warning If no URL is provided, then the transport will fall back to a public RPC URL on the chain. It is highly recommended to provide an authenticated RPC URL to prevent rate-limiting. ::: ### Batch JSON-RPC The `http` Transport supports Batch JSON-RPC. This means that multiple JSON-RPC requests can be sent in a single HTTP request. The Transport will batch up Actions over a given period and execute them in a single Batch JSON-RPC HTTP request. By default, this period is a [zero delay](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#zero_delays) meaning that the batch request will be executed at the end of the current [JavaScript message queue](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#queue). Consumers can specify a custom time period `wait` (in ms). You can enable Batch JSON-RPC by setting the `batch` flag to `true`: ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: true // [!code hl] }) ``` ## Parameters ### url `string` URL of the JSON-RPC API. Defaults to `chain.rpcUrls.default.http[0]`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...') ``` ### batch `boolean | BatchOptions` Toggle to enable Batch JSON-RPC. Defaults to `false` ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: true // [!code focus] }) ``` ### batch.batchSize `number` The maximum number of JSON-RPC requests to send in a batch. Defaults to `1_000`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: { batchSize: 2_000 // [!code focus] } }) ``` ### batch.wait `number` The maximum number of milliseconds to wait before sending a batch. Defaults to `0` ([zero delay](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#zero_delays)). ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: { wait: 16 // [!code focus] } }) ``` ### fetchOptions [`RequestInit`](https://developer.mozilla.org/en-US/docs/Web/API/fetch) [Fetch options](https://developer.mozilla.org/en-US/docs/Web/API/fetch) to pass to the internal `fetch` function. Useful for passing auth headers or cache options. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { fetchOptions: { // [!code focus:5] headers: { 'Authorization': 'Bearer ...' } } }) ``` ### key `string` A key for the Transport. Defaults to `"http"`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { key: 'alchemy', // [!code focus] }) ``` ### name `string` A name for the Transport. Defaults to `"HTTP JSON-RPC"`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { name: 'Alchemy HTTP Provider', // [!code focus] }) ``` ### retryCount `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { retryCount: 5, // [!code focus] }) ``` ### retryDelay `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { retryDelay: 100, // [!code focus] }) ``` ### timeout `number` The timeout for requests. Defaults to `10_000`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { timeout: 60_000, // [!code focus] }) ``` --- --- url: /shared/transports/http.md --- # http The `http` Transport connects to a JSON-RPC API via HTTP. Wraps Viem's [`http` Transport](https://viem.sh/docs/clients/transports/http). ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/transports/http.md","from":230,"to":269} import { http } from '{{packageName}}' ``` ## Usage ```ts-vue // {"path":"/vercel/path0/site/shared/transports/http.md","from":294,"to":701} import { createConfig, http // [!code hl] } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: http('https://foo-bar-baz.quiknode.pro/...'), // [!code hl] [sepolia.id]: http('https://foo-bar-sep.quiknode.pro/...'), // [!code hl] }, }) ``` ::: warning If no URL is provided, then the transport will fall back to a public RPC URL on the chain. It is highly recommended to provide an authenticated RPC URL to prevent rate-limiting. ::: ### Batch JSON-RPC The `http` Transport supports Batch JSON-RPC. This means that multiple JSON-RPC requests can be sent in a single HTTP request. The Transport will batch up Actions over a given period and execute them in a single Batch JSON-RPC HTTP request. By default, this period is a [zero delay](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#zero_delays) meaning that the batch request will be executed at the end of the current [JavaScript message queue](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#queue). Consumers can specify a custom time period `wait` (in ms). You can enable Batch JSON-RPC by setting the `batch` flag to `true`: ```ts // {"path":"/vercel/path0/site/shared/transports/http.md","from":1598,"to":1694} const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: true // [!code hl] }) ``` ## Parameters ### url `string` URL of the JSON-RPC API. Defaults to `chain.rpcUrls.default.http[0]`. ```ts // {"path":"/vercel/path0/site/shared/transports/http.md","from":1810,"to":1873} const transport = http('https://foo-bar-baz.quiknode.pro/...') ``` ### batch `boolean | BatchOptions` Toggle to enable Batch JSON-RPC. Defaults to `false` ```ts // {"path":"/vercel/path0/site/shared/transports/http.md","from":1976,"to":2075} const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: true // [!code focus] }) ``` ### batch.batchSize `number` The maximum number of JSON-RPC requests to send in a batch. Defaults to `1_000`. ```ts // {"path":"/vercel/path0/site/shared/transports/http.md","from":2200,"to":2321} const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: { batchSize: 2_000 // [!code focus] } }) ``` ### batch.wait `number` The maximum number of milliseconds to wait before sending a batch. Defaults to `0` ([zero delay](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#zero_delays)). ```ts // {"path":"/vercel/path0/site/shared/transports/http.md","from":2539,"to":2652} const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: { wait: 16 // [!code focus] } }) ``` ### fetchOptions [`RequestInit`](https://developer.mozilla.org/en-US/docs/Web/API/fetch) [Fetch options](https://developer.mozilla.org/en-US/docs/Web/API/fetch) to pass to the internal `fetch` function. Useful for passing auth headers or cache options. ```ts // {"path":"/vercel/path0/site/shared/transports/http.md","from":2919,"to":3085} const transport = http('https://foo-bar-baz.quiknode.pro/...', { fetchOptions: { // [!code focus:5] headers: { 'Authorization': 'Bearer ...' } } }) ``` ### key `string` A key for the Transport. Defaults to `"http"`. ```ts // {"path":"/vercel/path0/site/shared/transports/http.md","from":3163,"to":3266} const transport = http('https://foo-bar-baz.quiknode.pro/...', { key: 'alchemy', // [!code focus] }) ``` ### name `string` A name for the Transport. Defaults to `"HTTP JSON-RPC"`. ```ts // {"path":"/vercel/path0/site/shared/transports/http.md","from":3355,"to":3473} const transport = http('https://foo-bar-baz.quiknode.pro/...', { name: 'Alchemy HTTP Provider', // [!code focus] }) ``` ### retryCount `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts // {"path":"/vercel/path0/site/shared/transports/http.md","from":3583,"to":3685} const transport = http('https://foo-bar-baz.quiknode.pro/...', { retryCount: 5, // [!code focus] }) ``` ### retryDelay `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts // {"path":"/vercel/path0/site/shared/transports/http.md","from":3958,"to":4062} const transport = http('https://foo-bar-baz.quiknode.pro/...', { retryDelay: 100, // [!code focus] }) ``` ### timeout `number` The timeout for requests. Defaults to `10_000`. ```ts // {"path":"/vercel/path0/site/shared/transports/http.md","from":4145,"to":4249} const transport = http('https://foo-bar-baz.quiknode.pro/...', { timeout: 60_000, // [!code focus] }) ``` --- --- url: /solid/api/transports/http.md --- # http The `http` Transport connects to a JSON-RPC API via HTTP. Wraps Viem's [`http` Transport](https://viem.sh/docs/clients/transports/http). ## Import ```ts-vue import { http } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, http // [!code hl] } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: http('https://foo-bar-baz.quiknode.pro/...'), // [!code hl] [sepolia.id]: http('https://foo-bar-sep.quiknode.pro/...'), // [!code hl] }, }) ``` ::: warning If no URL is provided, then the transport will fall back to a public RPC URL on the chain. It is highly recommended to provide an authenticated RPC URL to prevent rate-limiting. ::: ### Batch JSON-RPC The `http` Transport supports Batch JSON-RPC. This means that multiple JSON-RPC requests can be sent in a single HTTP request. The Transport will batch up Actions over a given period and execute them in a single Batch JSON-RPC HTTP request. By default, this period is a [zero delay](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#zero_delays) meaning that the batch request will be executed at the end of the current [JavaScript message queue](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#queue). Consumers can specify a custom time period `wait` (in ms). You can enable Batch JSON-RPC by setting the `batch` flag to `true`: ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: true // [!code hl] }) ``` ## Parameters ### url `string` URL of the JSON-RPC API. Defaults to `chain.rpcUrls.default.http[0]`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...') ``` ### batch `boolean | BatchOptions` Toggle to enable Batch JSON-RPC. Defaults to `false` ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: true // [!code focus] }) ``` ### batch.batchSize `number` The maximum number of JSON-RPC requests to send in a batch. Defaults to `1_000`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: { batchSize: 2_000 // [!code focus] } }) ``` ### batch.wait `number` The maximum number of milliseconds to wait before sending a batch. Defaults to `0` ([zero delay](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#zero_delays)). ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: { wait: 16 // [!code focus] } }) ``` ### fetchOptions [`RequestInit`](https://developer.mozilla.org/en-US/docs/Web/API/fetch) [Fetch options](https://developer.mozilla.org/en-US/docs/Web/API/fetch) to pass to the internal `fetch` function. Useful for passing auth headers or cache options. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { fetchOptions: { // [!code focus:5] headers: { 'Authorization': 'Bearer ...' } } }) ``` ### key `string` A key for the Transport. Defaults to `"http"`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { key: 'alchemy', // [!code focus] }) ``` ### name `string` A name for the Transport. Defaults to `"HTTP JSON-RPC"`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { name: 'Alchemy HTTP Provider', // [!code focus] }) ``` ### retryCount `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { retryCount: 5, // [!code focus] }) ``` ### retryDelay `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { retryDelay: 100, // [!code focus] }) ``` ### timeout `number` The timeout for requests. Defaults to `10_000`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { timeout: 60_000, // [!code focus] }) ``` --- --- url: /vue/api/transports/http.md --- # http The `http` Transport connects to a JSON-RPC API via HTTP. Wraps Viem's [`http` Transport](https://viem.sh/docs/clients/transports/http). ## Import ```ts-vue import { http } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, http // [!code hl] } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: http('https://foo-bar-baz.quiknode.pro/...'), // [!code hl] [sepolia.id]: http('https://foo-bar-sep.quiknode.pro/...'), // [!code hl] }, }) ``` ::: warning If no URL is provided, then the transport will fall back to a public RPC URL on the chain. It is highly recommended to provide an authenticated RPC URL to prevent rate-limiting. ::: ### Batch JSON-RPC The `http` Transport supports Batch JSON-RPC. This means that multiple JSON-RPC requests can be sent in a single HTTP request. The Transport will batch up Actions over a given period and execute them in a single Batch JSON-RPC HTTP request. By default, this period is a [zero delay](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#zero_delays) meaning that the batch request will be executed at the end of the current [JavaScript message queue](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#queue). Consumers can specify a custom time period `wait` (in ms). You can enable Batch JSON-RPC by setting the `batch` flag to `true`: ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: true // [!code hl] }) ``` ## Parameters ### url `string` URL of the JSON-RPC API. Defaults to `chain.rpcUrls.default.http[0]`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...') ``` ### batch `boolean | BatchOptions` Toggle to enable Batch JSON-RPC. Defaults to `false` ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: true // [!code focus] }) ``` ### batch.batchSize `number` The maximum number of JSON-RPC requests to send in a batch. Defaults to `1_000`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: { batchSize: 2_000 // [!code focus] } }) ``` ### batch.wait `number` The maximum number of milliseconds to wait before sending a batch. Defaults to `0` ([zero delay](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop#zero_delays)). ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { batch: { wait: 16 // [!code focus] } }) ``` ### fetchOptions [`RequestInit`](https://developer.mozilla.org/en-US/docs/Web/API/fetch) [Fetch options](https://developer.mozilla.org/en-US/docs/Web/API/fetch) to pass to the internal `fetch` function. Useful for passing auth headers or cache options. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { fetchOptions: { // [!code focus:5] headers: { 'Authorization': 'Bearer ...' } } }) ``` ### key `string` A key for the Transport. Defaults to `"http"`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { key: 'alchemy', // [!code focus] }) ``` ### name `string` A name for the Transport. Defaults to `"HTTP JSON-RPC"`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { name: 'Alchemy HTTP Provider', // [!code focus] }) ``` ### retryCount `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { retryCount: 5, // [!code focus] }) ``` ### retryDelay `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { retryDelay: 100, // [!code focus] }) ``` ### timeout `number` The timeout for requests. Defaults to `10_000`. ```ts const transport = http('https://foo-bar-baz.quiknode.pro/...', { timeout: 60_000, // [!code focus] }) ``` --- --- url: /cli/api/commands/init.md --- # init Creates configuration file. If TypeScript is detected, the config file will use TypeScript and be named `wagmi.config.ts`. Otherwise, the config file will use JavaScript and be named `wagmi.config.js`. ## Usage ```bash // {"path":"/vercel/path0/site/cli/api/commands/init.md","from":229,"to":241} wagmi init ``` ## Options ### -c, --config \ `string` Path to config file. ```bash // {"path":"/vercel/path0/site/cli/api/commands/init.md","from":325,"to":361} wagmi init --config wagmi.config.ts ``` ### -r, --root \ `string` Root path to resolve config from. ```bash // {"path":"/vercel/path0/site/cli/api/commands/init.md","from":444,"to":475} wagmi init --root path/to/root ``` ### -h, --help Displays help message. ```bash // {"path":"/vercel/path0/site/cli/api/commands/init.md","from":528,"to":546} wagmi init --help ``` --- --- url: /core/api/connectors/injected.md --- # injected Connector for [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) Ethereum Providers. ## Import ```ts-vue import { injected } from '{{connectorsPackageName}}' ``` ## Usage ```ts-vue{3,7} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { injected } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type InjectedParameters } from '{{connectorsPackageName}}' ``` ### shimDisconnect `boolean | undefined` * MetaMask and other injected providers do not support programmatic disconnect. * This flag simulates the disconnect behavior by keeping track of connection status in storage. See [GitHub issue](https://github.com/MetaMask/metamask-extension/issues/10353) for more info. * Defaults to `true`. ```ts-vue import { injected } from '{{connectorsPackageName}}' const connector = injected({ shimDisconnect: false, // [!code focus] }) ``` ### target `TargetId | (TargetMap[TargetId] & { id: string }) | (() => (TargetMap[TargetId] & { id: string }) | undefined) | undefined` * [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) Ethereum Provider to target. * [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) supported via `createConfig`'s `multiInjectedProviderDiscovery` property. ```ts-vue import { injected } from '{{connectorsPackageName}}' const connector = injected({ target() { // [!code focus] return { // [!code focus] id: 'windowProvider', // [!code focus] name: 'Window Provider', // [!code focus] provider: window.ethereum, // [!code focus] } // [!code focus] }, // [!code focus] }) ``` ### unstable\_shimAsyncInject `boolean | number | undefined` Watches for async provider injection via the `ethereum#initialized` event. When `true`, defaults to `1_000` milliseconds. Otherwise, uses a provided value of milliseconds. ```ts-vue import { injected } from '{{connectorsPackageName}}' const connector = injected({ unstable_shimAsyncInject: 2_000, // [!code focus] }) ``` --- --- url: /react/api/connectors/injected.md --- # injected Connector for [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) Ethereum Providers. ## Import ```ts-vue import { injected } from '{{connectorsPackageName}}' ``` ## Usage ```ts-vue{3,7} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { injected } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type InjectedParameters } from '{{connectorsPackageName}}' ``` ### shimDisconnect `boolean | undefined` * MetaMask and other injected providers do not support programmatic disconnect. * This flag simulates the disconnect behavior by keeping track of connection status in storage. See [GitHub issue](https://github.com/MetaMask/metamask-extension/issues/10353) for more info. * Defaults to `true`. ```ts-vue import { injected } from '{{connectorsPackageName}}' const connector = injected({ shimDisconnect: false, // [!code focus] }) ``` ### target `TargetId | (TargetMap[TargetId] & { id: string }) | (() => (TargetMap[TargetId] & { id: string }) | undefined) | undefined` * [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) Ethereum Provider to target. * [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) supported via `createConfig`'s `multiInjectedProviderDiscovery` property. ```ts-vue import { injected } from '{{connectorsPackageName}}' const connector = injected({ target() { // [!code focus] return { // [!code focus] id: 'windowProvider', // [!code focus] name: 'Window Provider', // [!code focus] provider: window.ethereum, // [!code focus] } // [!code focus] }, // [!code focus] }) ``` ### unstable\_shimAsyncInject `boolean | number | undefined` Watches for async provider injection via the `ethereum#initialized` event. When `true`, defaults to `1_000` milliseconds. Otherwise, uses a provided value of milliseconds. ```ts-vue import { injected } from '{{connectorsPackageName}}' const connector = injected({ unstable_shimAsyncInject: 2_000, // [!code focus] }) ``` --- --- url: /shared/connectors/injected.md --- # injected Connector for [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) Ethereum Providers. ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/injected.md","from":257,"to":310} import { injected } from '{{connectorsPackageName}}' ``` ## Usage ```ts-vue{3,7} // {"path":"/vercel/path0/site/shared/connectors/injected.md","from":340,"to":676} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { injected } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/injected.md","from":706,"to":774} import { type InjectedParameters } from '{{connectorsPackageName}}' ``` ### shimDisconnect `boolean | undefined` * MetaMask and other injected providers do not support programmatic disconnect. * This flag simulates the disconnect behavior by keeping track of connection status in storage. See [GitHub issue](https://github.com/MetaMask/metamask-extension/issues/10353) for more info. * Defaults to `true`. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/injected.md","from":1126,"to":1254} import { injected } from '{{connectorsPackageName}}' const connector = injected({ shimDisconnect: false, // [!code focus] }) ``` ### target `TargetId | (TargetMap[TargetId] & { id: string }) | (() => (TargetMap[TargetId] & { id: string }) | undefined) | undefined` * [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) Ethereum Provider to target. * [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) supported via `createConfig`'s `multiInjectedProviderDiscovery` property. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/injected.md","from":1697,"to":2031} import { injected } from '{{connectorsPackageName}}' const connector = injected({ target() { // [!code focus] return { // [!code focus] id: 'windowProvider', // [!code focus] name: 'Window Provider', // [!code focus] provider: window.ethereum, // [!code focus] } // [!code focus] }, // [!code focus] }) ``` ### unstable\_shimAsyncInject `boolean | number | undefined` Watches for async provider injection via the `ethereum#initialized` event. When `true`, defaults to `1_000` milliseconds. Otherwise, uses a provided value of milliseconds. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/injected.md","from":2281,"to":2419} import { injected } from '{{connectorsPackageName}}' const connector = injected({ unstable_shimAsyncInject: 2_000, // [!code focus] }) ``` --- --- url: /solid/api/connectors/injected.md --- # injected Connector for [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) Ethereum Providers. ## Import ```ts-vue import { injected } from '{{connectorsPackageName}}' ``` ## Usage ```ts-vue{3,7} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { injected } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type InjectedParameters } from '{{connectorsPackageName}}' ``` ### shimDisconnect `boolean | undefined` * MetaMask and other injected providers do not support programmatic disconnect. * This flag simulates the disconnect behavior by keeping track of connection status in storage. See [GitHub issue](https://github.com/MetaMask/metamask-extension/issues/10353) for more info. * Defaults to `true`. ```ts-vue import { injected } from '{{connectorsPackageName}}' const connector = injected({ shimDisconnect: false, // [!code focus] }) ``` ### target `TargetId | (TargetMap[TargetId] & { id: string }) | (() => (TargetMap[TargetId] & { id: string }) | undefined) | undefined` * [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) Ethereum Provider to target. * [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) supported via `createConfig`'s `multiInjectedProviderDiscovery` property. ```ts-vue import { injected } from '{{connectorsPackageName}}' const connector = injected({ target() { // [!code focus] return { // [!code focus] id: 'windowProvider', // [!code focus] name: 'Window Provider', // [!code focus] provider: window.ethereum, // [!code focus] } // [!code focus] }, // [!code focus] }) ``` ### unstable\_shimAsyncInject `boolean | number | undefined` Watches for async provider injection via the `ethereum#initialized` event. When `true`, defaults to `1_000` milliseconds. Otherwise, uses a provided value of milliseconds. ```ts-vue import { injected } from '{{connectorsPackageName}}' const connector = injected({ unstable_shimAsyncInject: 2_000, // [!code focus] }) ``` --- --- url: /vue/api/connectors/injected.md --- # injected Connector for [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) Ethereum Providers. ## Import ```ts-vue import { injected } from '{{connectorsPackageName}}' ``` ## Usage ```ts-vue{3,7} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { injected } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type InjectedParameters } from '{{connectorsPackageName}}' ``` ### shimDisconnect `boolean | undefined` * MetaMask and other injected providers do not support programmatic disconnect. * This flag simulates the disconnect behavior by keeping track of connection status in storage. See [GitHub issue](https://github.com/MetaMask/metamask-extension/issues/10353) for more info. * Defaults to `true`. ```ts-vue import { injected } from '{{connectorsPackageName}}' const connector = injected({ shimDisconnect: false, // [!code focus] }) ``` ### target `TargetId | (TargetMap[TargetId] & { id: string }) | (() => (TargetMap[TargetId] & { id: string }) | undefined) | undefined` * [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) Ethereum Provider to target. * [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) supported via `createConfig`'s `multiInjectedProviderDiscovery` property. ```ts-vue import { injected } from '{{connectorsPackageName}}' const connector = injected({ target() { // [!code focus] return { // [!code focus] id: 'windowProvider', // [!code focus] name: 'Window Provider', // [!code focus] provider: window.ethereum, // [!code focus] } // [!code focus] }, // [!code focus] }) ``` ### unstable\_shimAsyncInject `boolean | number | undefined` Watches for async provider injection via the `ethereum#initialized` event. When `true`, defaults to `1_000` milliseconds. Otherwise, uses a provided value of milliseconds. ```ts-vue import { injected } from '{{connectorsPackageName}}' const connector = injected({ unstable_shimAsyncInject: 2_000, // [!code focus] }) ``` --- --- url: /cli/installation.md --- # Installation Install Wagmi CLI via your package manager. ## Package Manager Install the required package. ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/cli/installation.md","from":142,"to":162} pnpm add @wagmi/cli ``` ```bash [npm] // {"path":"/vercel/path0/site/cli/installation.md","from":181,"to":204} npm install @wagmi/cli ``` ```bash [yarn] // {"path":"/vercel/path0/site/cli/installation.md","from":224,"to":244} yarn add @wagmi/cli ``` ```bash [bun] // {"path":"/vercel/path0/site/cli/installation.md","from":263,"to":282} bun add @wagmi/cli ``` ::: ## Using Unreleased Commits If you can't wait for a new release to test the latest features, you can either install from the `canary` tag (tracks the [`main`](https://github.com/wevm/wagmi/tree/main) branch). ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/cli/installation.md","from":532,"to":559} pnpm add @wagmi/cli@canary ``` ```bash [npm] // {"path":"/vercel/path0/site/cli/installation.md","from":578,"to":608} npm install @wagmi/cli@canary ``` ```bash [yarn] // {"path":"/vercel/path0/site/cli/installation.md","from":628,"to":655} yarn add @wagmi/cli@canary ``` ```bash [bun] // {"path":"/vercel/path0/site/cli/installation.md","from":674,"to":700} bun add @wagmi/cli@canary ``` ::: Or clone the [Wagmi repo](https://github.com/wevm/wagmi) to your local machine, build, and link it yourself. ```bash // {"path":"/vercel/path0/site/cli/installation.md","from":827,"to":939} git clone https://github.com/wevm/wagmi.git cd wagmi pnpm install pnpm build cd packages/cli pnpm link --global ``` Then go to the project where you are using the Wagmi CLI and run `pnpm link --global @wagmi/cli` (or the package manager that you used to link Wagmi CLI globally). Finally, pull requests are continuously released via [pkg.pr.new](https://pkg.pr.new) and can be installed using the pull request number or short commit ID. ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/cli/installation.md","from":1297,"to":1340} pnpm add https://pkg.pr.new/@wagmi/cli@123 ``` ```bash [npm] // {"path":"/vercel/path0/site/cli/installation.md","from":1359,"to":1405} npm install https://pkg.pr.new/@wagmi/cli@123 ``` ```bash [yarn] // {"path":"/vercel/path0/site/cli/installation.md","from":1425,"to":1468} yarn add https://pkg.pr.new/@wagmi/cli@123 ``` ```bash [bun] // {"path":"/vercel/path0/site/cli/installation.md","from":1487,"to":1529} bun add https://pkg.pr.new/@wagmi/cli@123 ``` ::: --- --- url: /core/installation.md --- # Installation Install Wagmi Core via your package manager, a ` ``` ## Requirements Wagmi is optimized for modern browsers. It is compatible with the latest versions of the following browsers. ::: tip Depending on your environment, you might need to add polyfills. See [Viem Platform Compatibility](https://viem.sh/docs/compatibility) for more info. ::: ## Using Unreleased Commits If you can't wait for a new release to test the latest features, you can either install from the `canary` tag (tracks the [`main`](https://github.com/wevm/wagmi/tree/main) branch). ::: code-group ```bash-vue [pnpm] pnpm add {{packageName}}@canary ``` ```bash-vue [npm] npm install {{packageName}}@canary ``` ```bash-vue [yarn] yarn add {{packageName}}@canary ``` ```bash-vue [bun] bun add {{packageName}}@canary ``` ::: Or clone the [Wagmi repo](https://github.com/wevm/wagmi) to your local machine, build, and link it yourself. ```bash-vue gh repo clone wevm/wagmi cd wagmi pnpm install pnpm build cd packages/{{packageDir}} pnpm link --global ``` Then go to the project where you are using Wagmi and run `pnpm link --global {{packageName}}` (or the package manager that you used to link Wagmi globally). Make sure you installed any [required peer dependencies](#package-manager) and their versions are correct. Finally, pull requests are continuously released via [pkg.pr.new](https://pkg.pr.new) and can be installed using the pull request number or short commit ID. ::: code-group ```bash-vue [pnpm] pnpm add https://pkg.pr.new/{{packageName}}@123 ``` ```bash-vue [npm] npm install https://pkg.pr.new/{{packageName}}@123 ``` ```bash-vue [yarn] yarn add https://pkg.pr.new/{{packageName}}@123 ``` ```bash-vue [bun] bun add https://pkg.pr.new/{{packageName}}@123 ``` ::: ## Security Ethereum-related projects are often targeted in attacks to steal users' assets. Make sure you follow security best-practices for your project. Some quick things to get started. * Pin package versions, upgrade mindfully, and inspect lockfile changes to minimize the risk of [supply-chain attacks](https://nodejs.org/en/guides/security/#supply-chain-attacks). * Use [npm](https://docs.npmjs.com)'s [`min-release-age`](https://docs.npmjs.com/cli/v11/using-npm/config#min-release-age) or [pnpm](https://pnpm.io)'s [`minimumReleaseAge`](https://pnpm.io/settings#minimumreleaseage) and [`trustPolicy`](https://pnpm.io/settings#trustpolicy) to mitigate against supply-chain attacks. * Install the [Socket](https://socket.dev) [GitHub App](https://github.com/apps/socket-security) to help detect and block supply-chain attacks. * Add a [Content Security Policy](https://cheatsheetseries.owasp.org/cheatsheets/Content_Security_Policy_Cheat_Sheet.html) to defend against external scripts running in your app. * Pin [GitHub Action](https://x.com/paulmillr/status/1900948425325031448) versions to commits instead of tags. [Actions Up](https://github.com/azat-io/actions-up) is a good tool for using commits instead of tags. --- --- url: /react/installation.md --- # Installation Install Wagmi via your package manager, a ` ``` Check out the React docs for info on how to use [React without JSX](https://react.dev/reference/react/createElement#creating-an-element-without-jsx). ## Requirements Wagmi is optimized for modern browsers. It is compatible with the latest versions of the following browsers. ::: tip Depending on your environment, you might need to add polyfills. See [Viem Platform Compatibility](https://viem.sh/docs/compatibility) for more info. ::: ## Using Unreleased Commits If you can't wait for a new release to test the latest features, you can either install from the `canary` tag (tracks the [`main`](https://github.com/wevm/wagmi/tree/main) branch). ::: code-group ```bash-vue [pnpm] pnpm add {{packageName}}@canary ``` ```bash-vue [npm] npm install {{packageName}}@canary ``` ```bash-vue [yarn] yarn add {{packageName}}@canary ``` ```bash-vue [bun] bun add {{packageName}}@canary ``` ::: Or clone the [Wagmi repo](https://github.com/wevm/wagmi) to your local machine, build, and link it yourself. ```bash-vue gh repo clone wevm/wagmi cd wagmi pnpm install pnpm build cd packages/{{packageDir}} pnpm link --global ``` Then go to the project where you are using Wagmi and run `pnpm link --global {{packageName}}` (or the package manager that you used to link Wagmi globally). Make sure you installed any [required peer dependencies](#package-manager) and their versions are correct. Finally, pull requests are continuously released via [pkg.pr.new](https://pkg.pr.new) and can be installed using the pull request number or short commit ID. ::: code-group ```bash-vue [pnpm] pnpm add https://pkg.pr.new/{{packageName}}@123 ``` ```bash-vue [npm] npm install https://pkg.pr.new/{{packageName}}@123 ``` ```bash-vue [yarn] yarn add https://pkg.pr.new/{{packageName}}@123 ``` ```bash-vue [bun] bun add https://pkg.pr.new/{{packageName}}@123 ``` ::: ## Security Ethereum-related projects are often targeted in attacks to steal users' assets. Make sure you follow security best-practices for your project. Some quick things to get started. * Pin package versions, upgrade mindfully, and inspect lockfile changes to minimize the risk of [supply-chain attacks](https://nodejs.org/en/guides/security/#supply-chain-attacks). * Use [npm](https://docs.npmjs.com)'s [`min-release-age`](https://docs.npmjs.com/cli/v11/using-npm/config#min-release-age) or [pnpm](https://pnpm.io)'s [`minimumReleaseAge`](https://pnpm.io/settings#minimumreleaseage) and [`trustPolicy`](https://pnpm.io/settings#trustpolicy) to mitigate against supply-chain attacks. * Install the [Socket](https://socket.dev) [GitHub App](https://github.com/apps/socket-security) to help detect and block supply-chain attacks. * Add a [Content Security Policy](https://cheatsheetseries.owasp.org/cheatsheets/Content_Security_Policy_Cheat_Sheet.html) to defend against external scripts running in your app. * Pin [GitHub Action](https://x.com/paulmillr/status/1900948425325031448) versions to commits instead of tags. [Actions Up](https://github.com/azat-io/actions-up) is a good tool for using commits instead of tags. --- --- url: /solid/installation.md --- # Installation Install `@wagmi/solid` via your package manager. ## Package Manager Install the required packages. ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/solid/installation.md","from":380,"to":445} pnpm add @wagmi/solid viem@{{viemVersion}} @tanstack/solid-query ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/solid/installation.md","from":468,"to":536} npm install @wagmi/solid viem@{{viemVersion}} @tanstack/solid-query ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/solid/installation.md","from":560,"to":625} yarn add @wagmi/solid viem@{{viemVersion}} @tanstack/solid-query ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/solid/installation.md","from":648,"to":712} bun add @wagmi/solid viem@{{viemVersion}} @tanstack/solid-query ``` ::: * [Viem](https://viem.sh) is a TypeScript interface for Ethereum that performs blockchain operations. * [TanStack Query](https://tanstack.com/query/v5) is an async state manager that handles requests, caching, and more. * [TypeScript](/solid/typescript) is optional, but highly recommended. Learn more about [TypeScript support](/solid/typescript). ## Requirements Wagmi is optimized for modern browsers. It is compatible with the latest versions of the following browsers. ::: tip Depending on your environment, you might need to add polyfills. See [Viem Platform Compatibility](https://viem.sh/docs/compatibility) for more info. ::: ## Using Unreleased Commits If you can't wait for a new release to test the latest features, you can either install from the `canary` tag (tracks the [`main`](https://github.com/wevm/wagmi/tree/main) branch). ::: code-group ```bash-vue [pnpm] pnpm add {{packageName}}@canary ``` ```bash-vue [npm] npm install {{packageName}}@canary ``` ```bash-vue [yarn] yarn add {{packageName}}@canary ``` ```bash-vue [bun] bun add {{packageName}}@canary ``` ::: Or clone the [Wagmi repo](https://github.com/wevm/wagmi) to your local machine, build, and link it yourself. ```bash-vue gh repo clone wevm/wagmi cd wagmi pnpm install pnpm build cd packages/{{packageDir}} pnpm link --global ``` Then go to the project where you are using Wagmi and run `pnpm link --global {{packageName}}` (or the package manager that you used to link Wagmi globally). Make sure you installed any [required peer dependencies](#package-manager) and their versions are correct. Finally, pull requests are continuously released via [pkg.pr.new](https://pkg.pr.new) and can be installed using the pull request number or short commit ID. ::: code-group ```bash-vue [pnpm] pnpm add https://pkg.pr.new/{{packageName}}@123 ``` ```bash-vue [npm] npm install https://pkg.pr.new/{{packageName}}@123 ``` ```bash-vue [yarn] yarn add https://pkg.pr.new/{{packageName}}@123 ``` ```bash-vue [bun] bun add https://pkg.pr.new/{{packageName}}@123 ``` ::: ## Security Ethereum-related projects are often targeted in attacks to steal users' assets. Make sure you follow security best-practices for your project. Some quick things to get started. * Pin package versions, upgrade mindfully, and inspect lockfile changes to minimize the risk of [supply-chain attacks](https://nodejs.org/en/guides/security/#supply-chain-attacks). * Use [npm](https://docs.npmjs.com)'s [`min-release-age`](https://docs.npmjs.com/cli/v11/using-npm/config#min-release-age) or [pnpm](https://pnpm.io)'s [`minimumReleaseAge`](https://pnpm.io/settings#minimumreleaseage) and [`trustPolicy`](https://pnpm.io/settings#trustpolicy) to mitigate against supply-chain attacks. * Install the [Socket](https://socket.dev) [GitHub App](https://github.com/apps/socket-security) to help detect and block supply-chain attacks. * Add a [Content Security Policy](https://cheatsheetseries.owasp.org/cheatsheets/Content_Security_Policy_Cheat_Sheet.html) to defend against external scripts running in your app. * Pin [GitHub Action](https://x.com/paulmillr/status/1900948425325031448) versions to commits instead of tags. [Actions Up](https://github.com/azat-io/actions-up) is a good tool for using commits instead of tags. --- --- url: /vue/installation.md --- # Installation Install Wagmi via your package manager, a ` ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` --- --- url: /tempo/actions.md --- # Overview | Action | Description | |--------|-------------| | **AMM Actions** | | | [`amm.burn`](/tempo/actions/amm.burn) | Burns liquidity tokens and receives the underlying token pair | | [`amm.getLiquidityBalance`](/tempo/actions/amm.getLiquidityBalance) | Gets the liquidity balance for an address in a specific pool | | [`amm.getPool`](/tempo/actions/amm.getPool) | Gets the reserves for a liquidity pool | | [`amm.mint`](/tempo/actions/amm.mint) | Mints liquidity tokens by providing a token pair | | [`amm.rebalanceSwap`](/tempo/actions/amm.rebalanceSwap) | Performs a rebalance swap between user and validator tokens | | [`amm.watchBurn`](/tempo/actions/amm.watchBurn) | Watches for liquidity burn events | | [`amm.watchMint`](/tempo/actions/amm.watchMint) | Watches for liquidity mint events | | [`amm.watchRebalanceSwap`](/tempo/actions/amm.watchRebalanceSwap) | Watches for rebalance swap events | | **Faucet Actions** | | | [`faucet.fund`](/tempo/actions/faucet.fund) | Funds an account with testnet tokens | | **Fee Actions** | | | [`fee.getUserToken`](/tempo/actions/fee.getUserToken) | Gets the user's default fee token preference | | [`fee.setUserToken`](/tempo/actions/fee.setUserToken) | Sets the user's default fee token preference | | [`fee.watchSetUserToken`](/tempo/actions/fee.watchSetUserToken) | Watches for user token set events | | **Nonce Actions** | | | [`nonce.getNonce`](/tempo/actions/nonce.getNonce) | Gets the nonce for an account and nonce key | | [`nonce.watchNonceIncremented`](/tempo/actions/nonce.watchNonceIncremented) | Watches for nonce incremented events | | **Policy Actions** | | | [`policy.create`](#TODO) | Creates a new transfer policy for token access control | | [`policy.getData`](#TODO) | Gets the data for a transfer policy, including its type and admin address | | [`policy.isAuthorized`](#TODO) | Checks if an address is authorized by a transfer policy | | [`policy.modifyBlacklist`](#TODO) | Modifies the blacklist for a blacklist-type transfer policy | | [`policy.modifyWhitelist`](#TODO) | Modifies the whitelist for a whitelist-type transfer policy | | [`policy.setAdmin`](#TODO) | Sets the admin for a transfer policy | | [`policy.watchAdminUpdated`](#TODO) | Watches for policy admin update events | | [`policy.watchBlacklistUpdated`](#TODO) | Watches for blacklist update events | | [`policy.watchCreate`](#TODO) | Watches for policy creation events | | [`policy.watchWhitelistUpdated`](#TODO) | Watches for whitelist update events | | **Reward Actions** | | | [`reward.claim`](/tempo/actions/reward.claim) | Claims accumulated rewards for the caller | | [`reward.getUserRewardInfo`](/tempo/actions/reward.getUserRewardInfo) | Gets reward information for a specific account | | [`reward.setRecipient`](/tempo/actions/reward.setRecipient) | Sets or changes the reward recipient for a token holder | | [`reward.distribute`](/tempo/actions/reward.distribute) | Distributes tokens to opted-in holders | | [`reward.watchRewardRecipientSet`](/tempo/actions/reward.watchRewardRecipientSet) | Watches for reward recipient set events | | [`reward.watchRewardDistributed`](/tempo/actions/reward.watchRewardDistributed) | Watches for reward distributed events | | **Stablecoin DEX Actions** | | | [`dex.buy`](/tempo/actions/dex.buy) | Buys a specific amount of tokens from the Stablecoin DEX orderbook | | [`dex.cancel`](/tempo/actions/dex.cancel) | Cancels an order from the orderbook | | [`dex.createPair`](/tempo/actions/dex.createPair) | Creates a new trading pair on the DEX | | [`dex.getBalance`](/tempo/actions/dex.getBalance) | Gets a user's token balance on the Stablecoin DEX | | [`dex.getBuyQuote`](/tempo/actions/dex.getBuyQuote) | Gets the quote for buying a specific amount of tokens | | [`dex.getOrder`](/tempo/actions/dex.getOrder) | Gets an order's details from the orderbook | | [`dex.getTickLevel`](/tempo/actions/dex.getTickLevel) | Gets the price level information at a specific tick | | [`dex.getSellQuote`](/tempo/actions/dex.getSellQuote) | Gets the quote for selling a specific amount of tokens | | [`dex.place`](/tempo/actions/dex.place) | Places a limit order on the orderbook | | [`dex.placeFlip`](/tempo/actions/dex.placeFlip) | Places a flip order that automatically flips when filled | | [`dex.sell`](/tempo/actions/dex.sell) | Sells a specific amount of tokens from the Stablecoin DEX orderbook | | [`dex.watchFlipOrderPlaced`](/tempo/actions/dex.watchFlipOrderPlaced) | Watches for flip order placed events | | [`dex.watchOrderCancelled`](/tempo/actions/dex.watchOrderCancelled) | Watches for order cancelled events | | [`dex.watchOrderFilled`](/tempo/actions/dex.watchOrderFilled) | Watches for order filled events | | [`dex.watchOrderPlaced`](/tempo/actions/dex.watchOrderPlaced) | Watches for order placed events | | [`dex.withdraw`](/tempo/actions/dex.withdraw) | Withdraws tokens from the DEX to the caller's wallet | | **Token Actions** | | | [`token.approve`](/tempo/actions/token.approve) | Approves a spender to transfer TIP-20 tokens on behalf of the caller | | [`token.burn`](/tempo/actions/token.burn) | Burns TIP-20 tokens from the caller's balance | | [`token.burnBlocked`](/tempo/actions/token.burnBlocked) | Burns TIP-20 tokens from a blocked address | | [`token.changeTransferPolicy`](/tempo/actions/token.changeTransferPolicy) | Changes the transfer policy for a TIP-20 token | | [`token.create`](/tempo/actions/token.create) | Creates a new TIP-20 token and assigns the admin role to the calling account | | [`token.getAllowance`](/tempo/actions/token.getAllowance) | Gets the amount of tokens that a spender is approved to transfer on behalf of an owner | | [`token.getBalance`](/tempo/actions/token.getBalance) | Gets the token balance of an address | | [`token.getMetadata`](/tempo/actions/token.getMetadata) | Gets the metadata for a TIP-20 token, including name, symbol, decimals, currency, and total supply | | [`token.grantRoles`](/tempo/actions/token.grantRoles) | Grants one or more roles to an address | | [`token.mint`](/tempo/actions/token.mint) | Mints new TIP-20 tokens to a recipient | | [`token.pause`](/tempo/actions/token.pause) | Pauses a TIP-20 token, preventing all transfers | | [`token.renounceRoles`](/tempo/actions/token.renounceRoles) | Renounces one or more roles from the caller's address | | [`token.revokeRoles`](/tempo/actions/token.revokeRoles) | Revokes one or more roles from an address | | [`token.setRoleAdmin`](/tempo/actions/token.setRoleAdmin) | Sets the admin role for another role | | [`token.setSupplyCap`](/tempo/actions/token.setSupplyCap) | Sets the supply cap for a TIP-20 token | | [`token.transfer`](/tempo/actions/token.transfer) | Transfers TIP-20 tokens from the caller to a recipient | | [`token.unpause`](/tempo/actions/token.unpause) | Unpauses a TIP-20 token, allowing transfers to resume | | [`token.watchAdminRole`](/tempo/actions/token.watchAdminRole) | Watches for role admin update events | | [`token.watchApprove`](/tempo/actions/token.watchApprove) | Watches for token approval events | | [`token.watchBurn`](/tempo/actions/token.watchBurn) | Watches for token burn events | | [`token.watchCreate`](/tempo/actions/token.watchCreate) | Watches for new token creation events | | [`token.watchMint`](/tempo/actions/token.watchMint) | Watches for token mint events | | [`token.watchRole`](/tempo/actions/token.watchRole) | Watches for role membership update events | | [`token.watchTransfer`](/tempo/actions/token.watchTransfer) | Watches for token transfer events | --- --- url: /tempo/hooks.md --- # Overview | Hook | Description | |--------|-------------| | **AMM Hooks** | | | [`amm.useBurn`](/tempo/hooks/amm.useBurn) | Hook for burning liquidity tokens and receiving the underlying token pair | | [`amm.useLiquidityBalance`](/tempo/hooks/amm.useLiquidityBalance) | Hook for getting the liquidity balance for an address in a specific pool | | [`amm.useMint`](/tempo/hooks/amm.useMint) | Hook for minting liquidity tokens by providing a token pair | | [`amm.usePool`](/tempo/hooks/amm.usePool) | Hook for getting the reserves for a liquidity pool | | [`amm.useRebalanceSwap`](/tempo/hooks/amm.useRebalanceSwap) | Hook for performing a rebalance swap between user and validator tokens | | [`amm.useWatchBurn`](/tempo/hooks/amm.useWatchBurn) | Hook for watching liquidity burn events | | [`amm.useWatchMint`](/tempo/hooks/amm.useWatchMint) | Hook for watching liquidity mint events | | [`amm.useWatchRebalanceSwap`](/tempo/hooks/amm.useWatchRebalanceSwap) | Hook for watching rebalance swap events | | **Faucet Hooks** | | | [`faucet.useFund`](/tempo/hooks/faucet.useFund) | Hook for funding an account with testnet tokens | | **Fee Hooks** | | | [`fee.useSetUserToken`](/tempo/hooks/fee.useSetUserToken) | Hook for setting the user's default fee token preference | | [`fee.useUserToken`](/tempo/hooks/fee.useUserToken) | Hook for getting the user's default fee token preference | | [`fee.useWatchSetUserToken`](/tempo/hooks/fee.useWatchSetUserToken) | Hook for watching user token set events | | **Nonce Hooks** | | | [`nonce.useNonce`](/tempo/hooks/nonce.useNonce) | Hook for getting the nonce for an account and nonce key | | [`nonce.useWatchNonceIncremented`](/tempo/hooks/nonce.useWatchNonceIncremented) | Hook for watching nonce incremented events | | **Policy Hooks** | | | [`policy.useCreate`](#TODO) | Hook for creating a new transfer policy for token access control | | [`policy.useData`](#TODO) | Hook for getting the data for a transfer policy, including its type and admin address | | [`policy.useIsAuthorized`](#TODO) | Hook for checking if an address is authorized by a transfer policy | | [`policy.useModifyBlacklist`](#TODO) | Hook for modifying the blacklist for a blacklist-type transfer policy | | [`policy.useModifyWhitelist`](#TODO) | Hook for modifying the whitelist for a whitelist-type transfer policy | | [`policy.useSetAdmin`](#TODO) | Hook for setting the admin for a transfer policy | | [`policy.useWatchAdminUpdated`](#TODO) | Hook for watching policy admin update events | | [`policy.useWatchBlacklistUpdated`](#TODO) | Hook for watching blacklist update events | | [`policy.useWatchCreate`](#TODO) | Hook for watching policy creation events | | [`policy.useWatchWhitelistUpdated`](#TODO) | Hook for watching whitelist update events | | **Reward Hooks** | | | [`reward.useClaim`](/tempo/hooks/reward.useClaim) | Hook for claiming accumulated rewards | | [`reward.useSetRecipient`](/tempo/hooks/reward.useSetRecipient) | Hook for setting or changing the reward recipient for a token holder | | [`reward.useDistribute`](/tempo/hooks/reward.useDistribute) | Hook for distributing tokens to opted-in holders | | [`reward.useUserRewardInfo`](/tempo/hooks/reward.useUserRewardInfo) | Hook for getting reward information for a specific account | | [`reward.useWatchRewardRecipientSet`](/tempo/hooks/reward.useWatchRewardRecipientSet) | Hook for watching reward recipient set events | | [`reward.useWatchRewardDistributed`](/tempo/hooks/reward.useWatchRewardDistributed) | Hook for watching reward distributed events | | **Stablecoin DEX Hooks** | | | [`dex.useBalance`](/tempo/hooks/dex.useBalance) | Hook for getting a user's token balance on the Stablecoin DEX | | [`dex.useBuy`](/tempo/hooks/dex.useBuy) | Hook for buying a specific amount of tokens from the Stablecoin DEX orderbook | | [`dex.useBuyQuote`](/tempo/hooks/dex.useBuyQuote) | Hook for getting the quote for buying a specific amount of tokens | | [`dex.useCancel`](/tempo/hooks/dex.useCancel) | Hook for canceling an order from the orderbook | | [`dex.useCreatePair`](/tempo/hooks/dex.useCreatePair) | Hook for creating a new trading pair on the DEX | | [`dex.useOrder`](/tempo/hooks/dex.useOrder) | Hook for getting an order's details from the orderbook | | [`dex.usePlace`](/tempo/hooks/dex.usePlace) | Hook for placing a limit order on the orderbook | | [`dex.usePlaceFlip`](/tempo/hooks/dex.usePlaceFlip) | Hook for placing a flip order that automatically flips when filled | | [`dex.useTickLevel`](/tempo/hooks/dex.useTickLevel) | Hook for getting the price level information at a specific tick | | [`dex.useSell`](/tempo/hooks/dex.useSell) | Hook for selling a specific amount of tokens from the Stablecoin DEX orderbook | | [`dex.useSellQuote`](/tempo/hooks/dex.useSellQuote) | Hook for getting the quote for selling a specific amount of tokens | | [`dex.useWatchFlipOrderPlaced`](/tempo/hooks/dex.useWatchFlipOrderPlaced) | Hook for watching flip order placed events | | [`dex.useWatchOrderCancelled`](/tempo/hooks/dex.useWatchOrderCancelled) | Hook for watching order cancelled events | | [`dex.useWatchOrderFilled`](/tempo/hooks/dex.useWatchOrderFilled) | Hook for watching order filled events | | [`dex.useWatchOrderPlaced`](/tempo/hooks/dex.useWatchOrderPlaced) | Hook for watching order placed events | | [`dex.useWithdraw`](/tempo/hooks/dex.useWithdraw) | Hook for withdrawing tokens from the DEX to the caller's wallet | | **Token Hooks** | | | [`token.useAllowance`](/tempo/hooks/token.useGetAllowance) | Hook for getting the amount of tokens that a spender is approved to transfer on behalf of an owner | | [`token.useApprove`](/tempo/hooks/token.useApprove) | Hook for approving a spender to transfer TIP-20 tokens on behalf of the caller | | [`token.useBalance`](/tempo/hooks/token.useGetBalance) | Hook for getting the token balance of an address | | [`token.useBurn`](/tempo/hooks/token.useBurn) | Hook for burning TIP-20 tokens from the caller's balance | | [`token.useBurnBlocked`](/tempo/hooks/token.useBurnBlocked) | Hook for burning TIP-20 tokens from a blocked address | | [`token.useChangeTransferPolicy`](/tempo/hooks/token.useChangeTransferPolicy) | Hook for changing the transfer policy for a TIP-20 token | | [`token.useCreate`](/tempo/hooks/token.useCreate) | Hook for creating a new TIP-20 token and assigning the admin role to the calling account | | [`token.useGrantRoles`](/tempo/hooks/token.useGrantRoles) | Hook for granting one or more roles to an address | | [`token.useHasRole`](/tempo/hooks/token.useHasRole) | Hook for checking if an address has a specific role | | [`token.useMetadata`](/tempo/hooks/token.useGetMetadata) | Hook for getting the metadata for a TIP-20 token, including name, symbol, decimals, currency, and total supply | | [`token.useMint`](/tempo/hooks/token.useMint) | Hook for minting new TIP-20 tokens to a recipient | | [`token.usePause`](/tempo/hooks/token.usePause) | Hook for pausing a TIP-20 token, preventing all transfers | | [`token.useRenounceRoles`](/tempo/hooks/token.useRenounceRoles) | Hook for renouncing one or more roles from the caller's address | | [`token.useRevokeRoles`](/tempo/hooks/token.useRevokeRoles) | Hook for revoking one or more roles from an address | | [`token.useSetRoleAdmin`](/tempo/hooks/token.useSetRoleAdmin) | Hook for setting the admin role for another role | | [`token.useSetSupplyCap`](/tempo/hooks/token.useSetSupplyCap) | Hook for setting the supply cap for a TIP-20 token | | [`token.useTransfer`](/tempo/hooks/token.useTransfer) | Hook for transferring TIP-20 tokens from the caller to a recipient | | [`token.useUnpause`](/tempo/hooks/token.useUnpause) | Hook for unpausing a TIP-20 token, allowing transfers to resume | | [`token.useWatchAdminRole`](/tempo/hooks/token.useWatchAdminRole) | Hook for watching role admin update events | | [`token.useWatchApprove`](/tempo/hooks/token.useWatchApprove) | Hook for watching token approval events | | [`token.useWatchBurn`](/tempo/hooks/token.useWatchBurn) | Hook for watching token burn events | | [`token.useWatchCreate`](/tempo/hooks/token.useWatchCreate) | Hook for watching new token creation events | | [`token.useWatchMint`](/tempo/hooks/token.useWatchMint) | Hook for watching token mint events | | [`token.useWatchRole`](/tempo/hooks/token.useWatchRole) | Hook for watching role membership update events | | [`token.useWatchTransfer`](/tempo/hooks/token.useWatchTransfer) | Hook for watching token transfer events | --- --- url: /cli/api/plugins.md --- # Plugins Plugins for managing ABIs, generating code, and more. ## Import Import via the `'@wagmi/cli/plugins'` entrypoint. ```ts // {"path":"/vercel/path0/site/cli/api/plugins.md","from":134,"to":181} import { etherscan } from '@wagmi/cli/plugins' ``` ## Available Plugins * [`actions`](/cli/api/plugins/actions) Generate type-safe VanillaJS actions from configuration `contracts`. * [`blockExplorer`](/cli/api/plugins/blockExplorer) Fetch ABIs from Block Explorers that support `?module=contract&action=getabi`. * [`etherscan`](/cli/api/plugins/etherscan) Fetch ABIs from Etherscan and add into configuration. * [`fetch`](/cli/api/plugins/fetch) Fetch and parse ABIs from network resource with `fetch`. * [`foundry`](/cli/api/plugins/foundry) Generate ABIs and watch for Foundry project changes. * [`hardhat`](/cli/api/plugins/hardhat) Generate ABIs and watch for Hardhat projects changes. * [`react`](/cli/api/plugins/react) Generate type-safe React Hooks from configuration `contracts`. * [`sourcify`](/cli/api/plugins/sourcify) Fetch ABIs from Sourcify from configuration `contracts`. ## Create Plugin Creating plugins to hook into the CLI is quite simple. Plugins most commonly inject contracts into `contracts` config, e.g. [`etherscan`](/cli/api/plugins/etherscan), and/or generate code using the `run` option, e.g. [`react`](/cli/api/plugins/react). All you need to do is write a function that returns the `Plugin` type. ```ts{3-8} // {"path":"/vercel/path0/site/cli/api/plugins.md","from":1378,"to":1687} import { type Plugin, defineConfig } from '@wagmi/cli' function myPlugin(): Plugin { // `name` is the only required property. name: 'MyPlugin', // You likely want to at least include `contracts` or `run`. // ... } export default defineConfig({ out: 'src/generated.ts', plugins: [myPlugin()], }) ``` --- --- url: /core/api/connectors/porto.md --- # porto Connector for [Porto](https://porto.sh). ## Import ```ts-vue import { porto } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add porto@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install porto@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add porto@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add porto@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { porto } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [mainnet, sepolia], connectors: [porto()], // [!code hl] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type PortoParameters } from '{{connectorsPackageName}}' ``` See [`Porto.create` Parameters](https://porto.sh/sdk/api/porto/create#parameters) --- --- url: /react/api/connectors/porto.md --- # porto Connector for [Porto](https://porto.sh). ## Import ```ts-vue import { porto } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add porto@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install porto@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add porto@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add porto@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { porto } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [mainnet, sepolia], connectors: [porto()], // [!code hl] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type PortoParameters } from '{{connectorsPackageName}}' ``` See [`Porto.create` Parameters](https://porto.sh/sdk/api/porto/create#parameters) --- --- url: /shared/connectors/porto.md --- # porto Connector for [Porto](https://porto.sh). ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/porto.md","from":227,"to":277} import { porto } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/shared/connectors/porto.md","from":471,"to":517} pnpm add porto@{{connectorDependencyVersion}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/shared/connectors/porto.md","from":540,"to":589} npm install porto@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/shared/connectors/porto.md","from":613,"to":659} yarn add porto@{{connectorDependencyVersion}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/shared/connectors/porto.md","from":682,"to":727} bun add porto@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/porto.md","from":756,"to":1114} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { porto } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [mainnet, sepolia], connectors: [porto()], // [!code hl] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/porto.md","from":1144,"to":1209} import { type PortoParameters } from '{{connectorsPackageName}}' ``` See [`Porto.create` Parameters](https://porto.sh/sdk/api/porto/create#parameters) --- --- url: /solid/api/connectors/porto.md --- # porto Connector for [Porto](https://porto.sh). ## Import ```ts-vue import { porto } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add porto@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install porto@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add porto@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add porto@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { porto } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [mainnet, sepolia], connectors: [porto()], // [!code hl] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type PortoParameters } from '{{connectorsPackageName}}' ``` See [`Porto.create` Parameters](https://porto.sh/sdk/api/porto/create#parameters) --- --- url: /vue/api/connectors/porto.md --- # porto Connector for [Porto](https://porto.sh). ## Import ```ts-vue import { porto } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add porto@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install porto@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add porto@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add porto@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { porto } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [mainnet, sepolia], connectors: [porto()], // [!code hl] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type PortoParameters } from '{{connectorsPackageName}}' ``` See [`Porto.create` Parameters](https://porto.sh/sdk/api/porto/create#parameters) --- --- url: /core/api/actions/prepareTransactionRequest.md --- # prepareTransactionRequest Action for preparing a transaction request for signing by populating a nonce, gas limit, fee values, and a transaction type. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":324,"to":380} import { prepareTransactionRequest } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":427,"to":675} import { prepareTransactionRequest } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' await prepareTransactionRequest(config, { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":746,"to":817} import { type PrepareTransactionRequestParameters } from '@wagmi/core' ``` ### account `Account | Address | undefined` The Account to send the transaction from. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":944,"to":1266} import { prepareTransactionRequest } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' await prepareTransactionRequest(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### to `` `0x${string}` | undefined `` The transaction recipient or contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":1437,"to":1760} import { prepareTransactionRequest } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' await prepareTransactionRequest(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', // [!code focus] value: parseEther('1'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### accessList `AccessList | undefined` The access list. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":1902,"to":2310} import { prepareTransactionRequest } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' await prepareTransactionRequest(config, { accessList: [ // [!code focus:6] { address: '0x1', storageKeys: ['0x1'], }, ], account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` Chain ID to prepare the transaction request for. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":2501,"to":2891} import { prepareTransactionRequest } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { parseEther } from 'viem' import { config } from './config' await prepareTransactionRequest(config, { chainId: mainnet.id, // [!code focus] account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### data `` `0x${string}` | undefined `` A contract hashed method call with encoded args. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":3066,"to":3442} import { prepareTransactionRequest } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' await prepareTransactionRequest(config, { data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // [!code focus] account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gasPrice `bigint | undefined` The price (in wei) to pay per gas. Only applies to [Legacy Transactions](https://viem.sh/docs/glossary/terms#legacy-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":3691,"to":4053} import { prepareTransactionRequest } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' await prepareTransactionRequest(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', gasPrice: parseGwei('20'), // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxFeePerGas `bigint | undefined` Total fee per gas (in wei), inclusive of `maxPriorityFeePerGas`. Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":4340,"to":4706} import { prepareTransactionRequest } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' await prepareTransactionRequest(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', maxFeePerGas: parseGwei('20'), // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxPriorityFeePerGas `bigint | undefined` Max priority fee per gas (in wei). Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":4971,"to":5377} import { prepareTransactionRequest } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' await prepareTransactionRequest(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', maxFeePerGas: parseGwei('20'), maxPriorityFeePerGas: parseGwei('2'), // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### nonce `number | undefined` Unique number identifying this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":5537,"to":5871} import { prepareTransactionRequest } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' await prepareTransactionRequest(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), nonce: 5, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### parameters `("fees" | "gas" | "nonce" | "type")[] | undefined` Parameters to prepare. For instance, if `["gas", "nonce"]` is provided, then only the `gas` and `nonce` parameters will be prepared. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":6157,"to":6511} import { prepareTransactionRequest } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' await prepareTransactionRequest(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', parameters: ['gas', 'nonce'], // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### value `bigint | undefined` The transaction recipient or contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":6674,"to":6996} import { prepareTransactionRequest } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' await prepareTransactionRequest(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":7068,"to":7139} import { type PrepareTransactionRequestReturnType } from '@wagmi/core' ``` [`TransactionRequest`](https://viem.sh/docs/glossary/types#transactionrequest) The transaction request. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/prepareTransactionRequest.md","from":7266,"to":7336} import { type PrepareTransactionRequestErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`prepareTransactionRequest`](https://viem.sh/docs/actions/wallet/prepareTransactionRequest) --- --- url: /solid/api/primitives.md --- # Primitives Solid Primitives for accounts, wallets, contracts, transactions, signing, and more. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives.md","from":331,"to":376} import { useConnection } from '@wagmi/solid' ``` ## Reactive Parameters In Solid, primitive parameters are passed as getter functions (accessors) to maintain reactivity. This is different from React where parameters are passed directly as objects. ```ts // {"path":"/vercel/path0/site/solid/api/primitives.md","from":588,"to":642} // Solid style useBlockNumber(() => ({ chainId: 1 })) ``` ## Available Primitives --- --- url: /cli/api/plugins/react.md --- # react Plugin for generating type-safe [Wagmi Hooks](/react/api/hooks). ## Import ```ts // {"path":"/vercel/path0/site/cli/api/plugins/react.md","from":92,"to":135} import { react } from '@wagmi/cli/plugins' ``` ## Usage ```ts{2,6} // {"path":"/vercel/path0/site/cli/api/plugins/react.md","from":161,"to":311} import { defineConfig } from '@wagmi/cli' import { react } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ react(), ], }) ``` ## Configuration ```ts // {"path":"/vercel/path0/site/cli/api/plugins/react.md","from":340,"to":394} import { type ReactConfig } from '@wagmi/cli/plugins' ``` ### abiItemHooks * Boolean flag to generate abi item hooks (e.g. hooks for each abi function and events). * Defaults to `true`. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/react.md","from":535,"to":600} plugins: [ react({ abiItemHooks: false }), // [!code focus] ], ``` ### getHookName ``'legacy' | ((options: { contractName: string; type: 'read' | 'simulate' | 'watch' | 'write' }) => `use${string}`)`` * Function for setting custom hook names. * Defaults to `` `use${type}${contractName}` ``. For example, `useReadErc20`, `useSimulateErc20`, `useWatchErc20Event`, `useWriteErc20`. * When `'legacy'` (deprecated), hook names are set to `@wagmi/cli@1` format. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/react.md","from":1006,"to":1312} import { defineConfig } from '@wagmi/cli' import { react } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ react({ getHookName({ contractName, type }) { // [!code focus] return `use${contractName}__${type}` // [!code focus] }, // [!code focus] }), ], }) ``` --- --- url: /react/guides/read-from-contract.md --- # Read from Contract The [`useReadContract` Hook](/react/api/hooks/useReadContract) allows you to read data on a smart contract, from a `view` or `pure` (read-only) function. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. The component below shows how to retrieve the token balance of an address from the [Wagmi Example](https://etherscan.io/token/0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2) contract :::code-group ```tsx [read-contract.tsx] // {"path":"/vercel/path0/site/react/guides/read-from-contract.md","from":651,"to":1000} import { useReadContract } from 'wagmi' import { wagmiContractConfig } from './contracts' function ReadContract() { const { data: balance } = useReadContract({ ...wagmiContractConfig, functionName: 'balanceOf', args: ['0x03A71968491d55603FFe1b11A9e23eF013f75bCF'], }) return (
Balance: {balance?.toString()}
) } ``` ```ts [contracts.ts] // {"path":"/vercel/path0/site/react/guides/read-from-contract.md","from":1025,"to":1496} export const wagmiContractConfig = { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: [ { type: 'function', name: 'balanceOf', stateMutability: 'view', inputs: [{ name: 'account', type: 'address' }], outputs: [{ type: 'uint256' }], }, { type: 'function', name: 'totalSupply', stateMutability: 'view', inputs: [], outputs: [{ name: 'supply', type: 'uint256' }], }, ], } as const ``` ::: If `useReadContract` depends on another value (`address` in the example below), you can use the [`query.enabled`](/react/api/hooks/useReadContract#enabled) option to prevent the query from running until the dependency is ready. ```tsx // {"path":"/vercel/path0/site/react/guides/read-from-contract.md","from":1741,"to":1953} const { data: balance } = useReadContract({ ...wagmiContractConfig, functionName: 'balanceOf', args: [address], query: { // [!code focus] enabled: !!address, // [!code focus] }, // [!code focus] }) ``` ## Loading & Error States The [`useReadContract` Hook](/react/api/hooks/useReadContract) also returns loading & error states, which can be used to display a loading indicator while the data is being fetched, or an error message if contract execution reverts. :::code-group ```tsx [read-contract.tsx] // {"path":"/vercel/path0/site/react/guides/read-from-contract.md","from":2261,"to":2909} import { type BaseError, useReadContract } from 'wagmi' function ReadContract() { const { data: balance, error, // [!code ++] isPending // [!code ++] } = useReadContract({ ...wagmiContractConfig, functionName: 'balanceOf', args: ['0x03A71968491d55603FFe1b11A9e23eF013f75bCF'], }) if (isPending) return
Loading...
// [!code ++] if (error) // [!code ++] return ( // [!code ++]
// [!code ++] Error: {(error as BaseError).shortMessage || error.message} // [!code ++]
// [!code ++] ) // [!code ++] return (
Balance: {balance?.toString()}
) } ``` ## Refetching On Blocks The [`useBlockNumber` Hook](/react/api/hooks/useBlockNumber) can be utilized to refetch or [invalidate](https://tanstack.com/query/latest/docs/framework/react/guides/query-invalidation) the contract data on a specific block interval. :::code-group ```tsx [read-contract.tsx (refetch)] // {"path":"/vercel/path0/site/react/guides/read-from-contract.md","from":3225,"to":3845} import { useEffect } from 'react' import { useBlockNumber, useReadContract } from 'wagmi' function ReadContract() { const { data: balance, refetch } = useReadContract({ ...wagmiContractConfig, functionName: 'balanceOf', args: ['0x03A71968491d55603FFe1b11A9e23eF013f75bCF'], }) const { data: blockNumber } = useBlockNumber({ watch: true }) useEffect(() => { // want to refetch every `n` block instead? use the modulo operator! // if (blockNumber % 5 === 0) refetch() // refetch every 5 blocks refetch() }, [blockNumber]) return (
Balance: {balance?.toString()}
) } ``` ```tsx [read-contract.tsx (invalidate)] // {"path":"/vercel/path0/site/react/guides/read-from-contract.md","from":3889,"to":4700} import { useQueryClient } from '@tanstack/react-query' import { useEffect } from 'react' import { useBlockNumber, useReadContract } from 'wagmi' function ReadContract() { const queryClient = useQueryClient() const { data: balance, refetch } = useReadContract({ ...wagmiContractConfig, functionName: 'balanceOf', args: ['0x03A71968491d55603FFe1b11A9e23eF013f75bCF'], }) const { data: blockNumber } = useBlockNumber({ watch: true }) useEffect(() => { // if `useReadContract` is in a different hook/component, // you can import `readContractQueryKey` from `'wagmi/query'` and // construct a one-off query key to use for invalidation queryClient.invalidateQueries({ queryKey }) }, [blockNumber, queryClient]) return (
Balance: {balance?.toString()}
) } ``` ::: ## Calling Multiple Functions We can use the [`useReadContract` Hook](/react/api/hooks/useReadContract) multiple times in a single component to call multiple functions on the same contract, but this ends up being hard to manage as the number of functions increases, especially when we also want to deal with loading & error states. Luckily, to make this easier, we can use the [`useReadContracts` Hook](/react/api/hooks/useReadContracts) to call multiple functions in a single call. :::code-group ```tsx [read-contract.tsx] // {"path":"/vercel/path0/site/react/guides/read-from-contract.md","from":5238,"to":6146} import { type BaseError, useReadContracts } from 'wagmi' function ReadContract() { const { data, error, isPending } = useReadContracts({ contracts: [{ ...wagmiContractConfig, functionName: 'balanceOf', args: ['0x03A71968491d55603FFe1b11A9e23eF013f75bCF'], }, { ...wagmiContractConfig, functionName: 'ownerOf', args: [69n], }, { ...wagmiContractConfig, functionName: 'totalSupply', }] }) const [balance, ownerOf, totalSupply] = data || [] if (isPending) return
Loading...
if (error) return (
Error: {(error as BaseError).shortMessage || error.message}
) return ( <>
Balance: {balance?.toString()}
Owner of Token 69: {ownerOf?.toString()}
Total Supply: {totalSupply?.toString()}
) } ``` ::: --- --- url: /vue/guides/read-from-contract.md --- # Read from Contract ## Overview The [`useReadContract` Composable](/vue/api/composables/useReadContract) allows you to read data on a smart contract, from a `view` or `pure` (read-only) function. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. The component below shows how to retrieve the token balance of an address from the [Wagmi Example](https://etherscan.io/token/0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2) contract :::code-group ```vue [ReadContract.vue] // {"path":"/vercel/path0/site/vue/guides/read-from-contract.md","from":674,"to":1030} ``` ```ts [contracts.ts] // {"path":"/vercel/path0/site/vue/guides/read-from-contract.md","from":1055,"to":1526} export const wagmiContractConfig = { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: [ { type: 'function', name: 'balanceOf', stateMutability: 'view', inputs: [{ name: 'account', type: 'address' }], outputs: [{ type: 'uint256' }], }, { type: 'function', name: 'totalSupply', stateMutability: 'view', inputs: [], outputs: [{ name: 'supply', type: 'uint256' }], }, ], } as const ``` ::: If `useReadContract` depends on another value (`address` in the example below), you can use the [`query.enabled`](/vue/api/composables/useReadContract#enabled) option to prevent the query from running until the dependency is ready. ```tsx // {"path":"/vercel/path0/site/vue/guides/read-from-contract.md","from":1776,"to":1988} const { data: balance } = useReadContract({ ...wagmiContractConfig, functionName: 'balanceOf', args: [address], query: { // [!code focus] enabled: !!address, // [!code focus] }, // [!code focus] }) ``` ## Loading & Error States The [`useReadContract` Composable](/vue/api/composables/useReadContract) also returns loading & error states, which can be used to display a loading indicator while the data is being fetched, or an error message if contract execution reverts. :::code-group ```vue [ReadContract.vue] // {"path":"/vercel/path0/site/vue/guides/read-from-contract.md","from":2306,"to":2874} ``` ::: --- --- url: /core/api/actions/readContract.md --- # readContract Action for calling a **read-only** function on a contract, and returning the response. A **read-only** function (constant function) on a Solidity contract is denoted by a pure or view keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/readContract.md","from":607,"to":650} import { readContract } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/readContract.md","from":697,"to":945} import { readContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await readContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'totalSupply', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/readContract.md","from":1051,"to":1109} import { type ReadContractParameters } from '@wagmi/core' ``` ### abi `Abi` The contract's ABI. Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/readContract.md","from":1325,"to":1607} import { readContract } from '@wagmi/core' import { abi } from './abi' // [!code focus] import { config } from './config' const result = await readContract(config, { abi, // [!code focus] address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'totalSupply', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### account `Account | undefined` Account to use when calling the contract (`msg.sender`). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/readContract.md","from":1818,"to":2194} import { readContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await readContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'balanceOf', args: ['0xd2135CfB216b74109775236E36d4b433F1DF507B'], account: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### address `Address` The contract's address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/readContract.md","from":2360,"to":2625} import { readContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await readContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', // [!code focus] functionName: 'totalSupply', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### args `readonly unknown[] | undefined` * Arguments to pass when calling the contract. * Inferred from [`abi`](#abi) and [`functionName`](#functionname). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/readContract.md","from":2901,"to":3220} import { readContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await readContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'balanceOf', args: ['0xd2135CfB216b74109775236E36d4b433F1DF507B'], // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### blockNumber `bigint | undefined` Block number to call contract at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/readContract.md","from":3416,"to":3707} import { readContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await readContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'totalSupply', blockNumber: 17829139n, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to call contract at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/readContract.md","from":3942,"to":4227} import { readContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await readContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'totalSupply', blockTag: 'safe', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/readContract.md","from":4448,"to":4792} import { readContract } from '@wagmi/core' import { mainnet } from 'wagmi/chains' // [!code focus] import { abi } from './abi' import { config } from './config' const result = await readContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'totalSupply', chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### functionName `string` * Function to call on the contract. * Inferred from [`abi`](#abi). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/readContract.md","from":5005,"to":5324} import { readContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await readContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'balanceOf', // [!code focus] args: ['0xd2135CfB216b74109775236E36d4b433F1DF507B'], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/readContract.md","from":5431,"to":5489} import { type ReadContractReturnType } from '@wagmi/core' ``` `unknown` * Result of contract read-only function. * Inferred from [`abi`](#abi), [`functionName`](#functionname), and [`args`](#args). ## Type Inference With [`abi`](#abi) setup correctly, TypeScript will infer the correct types for [`functionName`](#functionname), [`args`](#args), and the return type. See the Wagmi [TypeScript docs](/core/typescript) for more information. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/readContract.md","from":5891,"to":5948} import { type ReadContractErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`readContract`](https://viem.sh/docs/contract/readContract) --- --- url: /core/api/actions/readContracts.md --- # readContracts Action for calling multiple read methods on a contract. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":219,"to":263} import { readContracts } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":310,"to":1014} import { readContracts } from '@wagmi/core' import { config } from './config' const wagmigotchiContract = { address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', abi: wagmigotchiABI, } as const const mlootContract = { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, } as const const result = await readContracts(config, { contracts: [ { ...wagmigotchiContract, functionName: 'getAlive', }, { ...wagmigotchiContract, functionName: 'getBoredom', }, { ...mlootContract, functionName: 'getChest', args: [69], }, { ...mlootContract, functionName: 'getWaist', args: [69], }, ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":1085,"to":1144} import { type ReadContractsParameters } from '@wagmi/core' ``` ### contracts `readonly Contract[]` Set of contracts to call. #### abi `Abi | undefined` The contract's ABI. Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":1440,"to":1757} import { readContracts } from '@wagmi/core' import { config } from './config' const result = await readContracts(config, { contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, // [!code hl] functionName: 'getChest', args: [69], }, // ... ], }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` #### address `Address | undefined` The contract's address. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":1904,"to":2221} import { readContracts } from '@wagmi/core' import { config } from './config' const result = await readContracts(config, { contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', // [!code hl] abi: mlootABI, functionName: 'getChest', args: [69], }, // ... ], }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` #### args `readonly unknown[] | undefined` * Arguments to pass when calling the contract. * Inferred from [`abi`](#abi) and [`functionName`](#functionname). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":2466,"to":2783} import { readContracts } from '@wagmi/core' import { config } from './config' const result = await readContracts(config, { contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69], // [!code hl] }, // ... ], }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` #### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":2968,"to":3303} import { readContracts } from '@wagmi/core' import { config } from './config' const result = await readContracts(config, { contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69], chainId: 1, // [!code hl] }, // ... ], }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` #### functionName `string | undefined` * Function to call on the contract. * Inferred from [`abi`](#abi). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":3498,"to":3815} import { readContracts } from '@wagmi/core' import { config } from './config' const result = await readContracts(config, { contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', // [!code hl] args: [69], }, // ... ], }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### allowFailure `boolean` Whether or not the Hook should throw if a call reverts. If set to `true` (default), and a call reverts, then `readContracts` will fail silently and its error will be logged in the results array. Defaults to `true`. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":4145,"to":4485} import { readContracts } from '@wagmi/core' import { config } from './config' const result = await readContracts(config, { allowFailure: false, // [!code hl] contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69], }, // ... ], }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### batchSize `number` The maximum size (in bytes) for each calldata chunk. Set to `0` to disable the size limit. Defaults to `1024`. > Note: Some RPC Providers limit the amount of calldata (`data`) that can be sent in a single `eth_call` request. It is best to check with your RPC Provider to see if there are any calldata size limits to `eth_call` requests. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":4934,"to":5271} import { readContracts } from '@wagmi/core' import { config } from './config' const result = await readContracts(config, { batchSize: 1_024, // [!code hl] contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69], }, // ... ], }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `number` The block number to perform the read against. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":5430,"to":5770} import { readContracts } from '@wagmi/core' import { config } from './config' const result = await readContracts(config, { blockNumber: 69420n, // [!code hl] contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69], }, // ... ], }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to read against. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":5969,"to":6306} import { readContracts } from '@wagmi/core' import { config } from './config' const result = await readContracts(config, { blockTag: 'safe', // [!code hl] contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69], }, // ... ], }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### multicallAddress `Address` Address of multicall contract. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":6456,"to":6839} import { readContracts } from '@wagmi/core' import { config } from './config' const result = await readContracts(config, { contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69], }, // ... ], multicallAddress: '0xca11bde05977b3631167028862be2a173976ca11', // [!code hl] }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":6912,"to":6971} import { type ReadContractsReturnType } from '@wagmi/core' ``` ## Type Inference With [`contracts[number]['abi']`](#abi) setup correctly, TypeScript will infer the correct types for [`functionName`](#functionname), [`args`](#args), and the return type. See the Wagmi [TypeScript docs](/core/typescript) for more information. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/readContracts.md","from":7256,"to":7314} import { type ReadContractsErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`multicall`](https://viem.sh/docs/contract/multicall) when supported by current chain. * [`readContract`](https://viem.sh/docs/contract/readContract) when multicall is not supported. --- --- url: /core/api/actions/reconnect.md --- # reconnect Action for reconnecting [connectors](/core/api/connectors). ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/reconnect.md","from":211,"to":251} import { reconnect } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/reconnect.md","from":298,"to":487} import { reconnect } from '@wagmi/core' import { injected } from '@wagmi/connectors' import { config } from './config' const result = await reconnect(config, { connectors: [injected()] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/reconnect.md","from":558,"to":613} import { type ReconnectParameters } from '@wagmi/core' ``` ### connectors `(CreateConnectorFn | Connector)[] | undefined` * [Connectors](/core/api/connectors) to reconnect to. * Defaults to [`Config['connectors']`](/core/api/createConfig#connectors). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/reconnect.md","from":845,"to":1056} import { reconnect } from '@wagmi/core' import { injected } from '@wagmi/connectors' import { config } from './config' const result = await reconnect(config, { connectors: [injected()], // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/reconnect.md","from":1128,"to":1183} import { type ReconnectReturnType } from '@wagmi/core' ``` `Connection[]` [Connections](/core/api/createConfig#connection) that were successfully reconnected. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/reconnect.md","from":1306,"to":1360} import { type ReconnectErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` --- --- url: /core/api/connectors/safe.md --- # safe Connector for [Safe Apps SDK](https://github.com/safe-global/safe-apps-sdk). ## Import ```ts-vue import { safe } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [npm] npm install @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [yarn] yarn add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [bun] bun add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ::: ## Usage ```ts-vue{3,7} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { safe } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [safe()], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type SafeParameters } from '{{connectorsPackageName}}' ``` Check out the [Safe docs](https://github.com/safe-global/safe-apps-sdk/tree/main/packages/safe-apps-sdk) for more info. ### allowedDomains `RegExp[] | undefined` ```ts-vue import { safe } from '{{connectorsPackageName}}' const connector = safe({ allowedDomains: [/^app\.safe\.global$/], // [!code focus] }) ``` ### debug `boolean | undefined` ```ts-vue import { safe } from '{{connectorsPackageName}}' const connector = safe({ debug: true, // [!code focus] }) ``` ### shimDisconnect `boolean | undefined` * This flag simulates disconnect behavior by keeping track of connection status in storage. * Defaults to `false`. ```ts-vue import { safe } from '{{connectorsPackageName}}' const connector = safe({ shimDisconnect: true, // [!code focus] }) ``` --- --- url: /react/api/connectors/safe.md --- # safe Connector for [Safe Apps SDK](https://github.com/safe-global/safe-apps-sdk). ## Import ```ts-vue import { safe } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [npm] npm install @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [yarn] yarn add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [bun] bun add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ::: ## Usage ```ts-vue{3,7} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { safe } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [safe()], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type SafeParameters } from '{{connectorsPackageName}}' ``` Check out the [Safe docs](https://github.com/safe-global/safe-apps-sdk/tree/main/packages/safe-apps-sdk) for more info. ### allowedDomains `RegExp[] | undefined` ```ts-vue import { safe } from '{{connectorsPackageName}}' const connector = safe({ allowedDomains: [/^app\.safe\.global$/], // [!code focus] }) ``` ### debug `boolean | undefined` ```ts-vue import { safe } from '{{connectorsPackageName}}' const connector = safe({ debug: true, // [!code focus] }) ``` ### shimDisconnect `boolean | undefined` * This flag simulates disconnect behavior by keeping track of connection status in storage. * Defaults to `false`. ```ts-vue import { safe } from '{{connectorsPackageName}}' const connector = safe({ shimDisconnect: true, // [!code focus] }) ``` --- --- url: /shared/connectors/safe.md --- # safe Connector for [Safe Apps SDK](https://github.com/safe-global/safe-apps-sdk). ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/safe.md","from":274,"to":323} import { safe } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/shared/connectors/safe.md","from":833,"to":975} pnpm add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/shared/connectors/safe.md","from":998,"to":1143} npm install @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/shared/connectors/safe.md","from":1167,"to":1309} yarn add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/shared/connectors/safe.md","from":1332,"to":1473} bun add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ::: ## Usage ```ts-vue{3,7} // {"path":"/vercel/path0/site/shared/connectors/safe.md","from":1507,"to":1835} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { safe } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [safe()], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/safe.md","from":1865,"to":1929} import { type SafeParameters } from '{{connectorsPackageName}}' ``` Check out the [Safe docs](https://github.com/safe-global/safe-apps-sdk/tree/main/packages/safe-apps-sdk) for more info. ### allowedDomains `RegExp[] | undefined` ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/safe.md","from":2108,"to":2246} import { safe } from '{{connectorsPackageName}}' const connector = safe({ allowedDomains: [/^app\.safe\.global$/], // [!code focus] }) ``` ### debug `boolean | undefined` ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/safe.md","from":2295,"to":2405} import { safe } from '{{connectorsPackageName}}' const connector = safe({ debug: true, // [!code focus] }) ``` ### shimDisconnect `boolean | undefined` * This flag simulates disconnect behavior by keeping track of connection status in storage. * Defaults to `false`. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/safe.md","from":2579,"to":2698} import { safe } from '{{connectorsPackageName}}' const connector = safe({ shimDisconnect: true, // [!code focus] }) ``` --- --- url: /solid/api/connectors/safe.md --- # safe Connector for [Safe Apps SDK](https://github.com/safe-global/safe-apps-sdk). ## Import ```ts-vue import { safe } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [npm] npm install @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [yarn] yarn add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [bun] bun add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ::: ## Usage ```ts-vue{3,7} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { safe } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [safe()], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type SafeParameters } from '{{connectorsPackageName}}' ``` Check out the [Safe docs](https://github.com/safe-global/safe-apps-sdk/tree/main/packages/safe-apps-sdk) for more info. ### allowedDomains `RegExp[] | undefined` ```ts-vue import { safe } from '{{connectorsPackageName}}' const connector = safe({ allowedDomains: [/^app\.safe\.global$/], // [!code focus] }) ``` ### debug `boolean | undefined` ```ts-vue import { safe } from '{{connectorsPackageName}}' const connector = safe({ debug: true, // [!code focus] }) ``` ### shimDisconnect `boolean | undefined` * This flag simulates disconnect behavior by keeping track of connection status in storage. * Defaults to `false`. ```ts-vue import { safe } from '{{connectorsPackageName}}' const connector = safe({ shimDisconnect: true, // [!code focus] }) ``` --- --- url: /vue/api/connectors/safe.md --- # safe Connector for [Safe Apps SDK](https://github.com/safe-global/safe-apps-sdk). ## Import ```ts-vue import { safe } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [npm] npm install @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [yarn] yarn add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ```bash-vue [bun] bun add @safe-global/safe-apps-provider@{{connectorDependencyVersions?.[0]}} @safe-global/safe-apps-sdk@{{connectorDependencyVersions?.[1]}} ``` ::: ## Usage ```ts-vue{3,7} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { safe } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [safe()], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type SafeParameters } from '{{connectorsPackageName}}' ``` Check out the [Safe docs](https://github.com/safe-global/safe-apps-sdk/tree/main/packages/safe-apps-sdk) for more info. ### allowedDomains `RegExp[] | undefined` ```ts-vue import { safe } from '{{connectorsPackageName}}' const connector = safe({ allowedDomains: [/^app\.safe\.global$/], // [!code focus] }) ``` ### debug `boolean | undefined` ```ts-vue import { safe } from '{{connectorsPackageName}}' const connector = safe({ debug: true, // [!code focus] }) ``` ### shimDisconnect `boolean | undefined` * This flag simulates disconnect behavior by keeping track of connection status in storage. * Defaults to `false`. ```ts-vue import { safe } from '{{connectorsPackageName}}' const connector = safe({ shimDisconnect: true, // [!code focus] }) ``` --- --- url: /react/guides/send-transaction.md --- # Send Transaction The following guide teaches you how to send transactions in Wagmi. The example below builds on the [Connect Wallet guide](/react/guides/connect-wallet) and uses the [useSendTransaction](/react/api/hooks/useSendTransaction) & [useWaitForTransactionReceipt](/react/api/hooks/useWaitForTransactionReceipt) hooks. ## Example Feel free to check out the example before moving on: ## Steps ### 1. Connect Wallet Follow the [Connect Wallet guide](/react/guides/connect-wallet) guide to get this set up. ### 2. Create a new component Create your `SendTransaction` component that will contain the send transaction logic. ::: code-group ```tsx [send-transaction.tsx] // {"path":"/vercel/path0/site/react/guides/send-transaction.md","from":857,"to":1131} import * as React from 'react' export function SendTransaction() { return (
) } ``` ::: ### 3. Add a form handler Next, we will need to add a handler to the form that will send the transaction when the user hits "Send". This will be a basic handler in this step. ::: code-group ```tsx [send-transaction.tsx] // {"path":"/vercel/path0/site/react/guides/send-transaction.md","from":1364,"to":2039} import * as React from 'react' export function SendTransaction() { async function submit(e: React.FormEvent) { // [!code ++] e.preventDefault() // [!code ++] const formData = new FormData(e.target as HTMLFormElement) // [!code ++] const to = formData.get('address') as `0x${string}` // [!code ++] const value = formData.get('value') as string // [!code ++] } // [!code ++] return (
// [!code --] // [!code ++]
) } ``` ::: ### 4. Hook up the `useSendTransaction` Hook Now that we have the form handler, we can hook up the [`useSendTransaction` Hook](/react/api/hooks/useSendTransaction) to send the transaction. ::: code-group ```tsx [send-transaction.tsx] // {"path":"/vercel/path0/site/react/guides/send-transaction.md","from":2286,"to":3161} import * as React from 'react' import { useSendTransaction } from 'wagmi' // [!code ++] import { parseEther } from 'viem' // [!code ++] export function SendTransaction() { const { data: hash, sendTransaction } = useSendTransaction() // [!code ++] async function submit(e: React.FormEvent) { e.preventDefault() const formData = new FormData(e.target as HTMLFormElement) const to = formData.get('address') as `0x${string}` const value = formData.get('value') as string sendTransaction({ to, value: parseEther(value) }) // [!code ++] } return (
{hash &&
Transaction Hash: {hash}
} // [!code ++]
) } ``` ::: ### 5. Add loading state (optional) We can optionally add a loading state to the "Send" button while we are waiting confirmation from the user's wallet. ::: code-group ```tsx [send-transaction.tsx] // {"path":"/vercel/path0/site/react/guides/send-transaction.md","from":3372,"to":4374} import * as React from 'react' import { useSendTransaction } from 'wagmi' import { parseEther } from 'viem' export function SendTransaction() { const { data: hash, isPending, // [!code ++] sendTransaction } = useSendTransaction() async function submit(e: React.FormEvent) { e.preventDefault() const formData = new FormData(e.target as HTMLFormElement) const to = formData.get('address') as `0x${string}` const value = formData.get('value') as string sendTransaction({ to, value: parseEther(value) }) } return (
{hash &&
Transaction Hash: {hash}
}
) } ``` ::: ### 6. Wait for transaction receipt (optional) We can also display the transaction confirmation status to the user by using the [`useWaitForTransactionReceipt` Hook](/react/api/hooks/useWaitForTransactionReceipt). ::: code-group ```tsx [send-transaction.tsx] // {"path":"/vercel/path0/site/react/guides/send-transaction.md","from":4647,"to":5954} import * as React from 'react' import { useSendTransaction, useWaitForTransactionReceipt // [!code ++] } from 'wagmi' import { parseEther } from 'viem' export function SendTransaction() { const { data: hash, isPending, sendTransaction } = useSendTransaction() async function submit(e: React.FormEvent) { e.preventDefault() const formData = new FormData(e.target as HTMLFormElement) const to = formData.get('address') as `0x${string}` const value = formData.get('value') as string sendTransaction({ to, value: parseEther(value) }) } const { isLoading: isConfirming, isSuccess: isConfirmed } = // [!code ++] useWaitForTransactionReceipt({ // [!code ++] hash, // [!code ++] }) // [!code ++] return (
{hash &&
Transaction Hash: {hash}
} {isConfirming &&
Waiting for confirmation...
} // [!code ++] {isConfirmed &&
Transaction confirmed.
} // [!code ++]
) } ``` ::: ### 7. Handle errors (optional) If the user rejects the transaction, or the user does not have enough funds to cover the transaction, we can display an error message to the user. ::: code-group ```tsx [send-transaction.tsx] // {"path":"/vercel/path0/site/react/guides/send-transaction.md","from":6191,"to":7612} import * as React from 'react' import { type BaseError, // [!code ++] useSendTransaction, useWaitForTransactionReceipt } from 'wagmi' import { parseEther } from 'viem' export function SendTransaction() { const { data: hash, error, // [!code ++] isPending, sendTransaction } = useSendTransaction() async function submit(e: React.FormEvent) { e.preventDefault() const formData = new FormData(e.target as HTMLFormElement) const to = formData.get('address') as `0x${string}` const value = formData.get('value') as string sendTransaction({ to, value: parseEther(value) }) } const { isLoading: isConfirming, isSuccess: isConfirmed } = useWaitForTransactionReceipt({ hash, }) return (
{hash &&
Transaction Hash: {hash}
} {isConfirming &&
Waiting for confirmation...
} {isConfirmed &&
Transaction confirmed.
} {error && ( // [!code ++]
Error: {(error as BaseError).shortMessage || error.message}
// [!code ++] )} // [!code ++]
) } ``` ::: ### 8. Wire it up! Finally, we can wire up our Send Transaction component to our application's entrypoint. ::: code-group ```tsx [app.tsx] // {"path":"/vercel/path0/site/react/guides/send-transaction.md","from":7764,"to":8229} import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { WagmiProvider } from 'wagmi' import { config } from './config' import { SendTransaction } from './send-transaction' // [!code ++] const queryClient = new QueryClient() function App() { return ( // [!code ++] ) } ``` ```tsx [send-transaction.tsx] // {"path":"/vercel/path0/site/react/guides/send-transaction.md","from":8264,"to":9619} import * as React from 'react' import { type BaseError, useSendTransaction, useWaitForTransactionReceipt } from 'wagmi' import { parseEther } from 'viem' export function SendTransaction() { const { data: hash, error, isPending, sendTransaction } = useSendTransaction() async function submit(e: React.FormEvent) { e.preventDefault() const formData = new FormData(e.target as HTMLFormElement) const to = formData.get('address') as `0x${string}` const value = formData.get('value') as string sendTransaction({ to, value: parseEther(value) }) } const { isLoading: isConfirming, isSuccess: isConfirmed } = useWaitForTransactionReceipt({ hash, }) return (
{hash &&
Transaction Hash: {hash}
} {isConfirming &&
Waiting for confirmation...
} {isConfirmed &&
Transaction confirmed.
} {error && (
Error: {(error as BaseError).shortMessage || error.message}
)}
) } ``` ```tsx [config.ts] // {"path":"/vercel/path0/site/react/guides/send-transaction.md","from":9643,"to":10101} import { http, createConfig } from 'wagmi' import { base, mainnet, optimism } from 'wagmi/chains' import { injected, metaMask, safe, walletConnect } from 'wagmi/connectors' const projectId = '' export const config = createConfig({ chains: [mainnet, base], connectors: [ injected(), walletConnect({ projectId }), metaMask(), safe(), ], transports: { [mainnet.id]: http(), [base.id]: http(), }, }) ``` ::: [See the Example.](#example) --- --- url: /vue/guides/send-transaction.md --- # Send Transaction The following guide teaches you how to send transactions in Wagmi. The example below builds on the [Connect Wallet guide](/vue/guides/connect-wallet) and uses the [useSendTransaction](/vue/api/composables/useSendTransaction) & [useWaitForTransactionReceipt](/vue/api/composables/useWaitForTransactionReceipt) composables. ## Example Feel free to check out the example before moving on: ## Steps ### 1. Connect Wallet Follow the [Connect Wallet guide](/vue/guides/connect-wallet) guide to get this set up. ### 2. Create a new component Create your `SendTransaction` component that will contain the send transaction logic. ::: code-group ```tsx [SendTransaction.vue] // {"path":"/vercel/path0/site/vue/guides/send-transaction.md","from":867,"to":1104} ``` ::: ### 3. Add a form handler Next, we will need to add a handler to the form that will send the transaction when the user hits "Send". This will be a basic handler in this step. ::: code-group ```vue [SendTransaction.vue] // {"path":"/vercel/path0/site/vue/guides/send-transaction.md","from":1336,"to":1984} ``` ::: ### 4. Hook up the `useSendTransaction` Composable Now that we have the form handler, we can hook up the [`useSendTransaction` Composable](/vue/api/composables/useSendTransaction) to send the transaction. ::: code-group ```vue [SendTransaction.vue] // {"path":"/vercel/path0/site/vue/guides/send-transaction.md","from":2246,"to":3045} ``` ::: ### 5. Add loading state (optional) We can optionally add a loading state to the "Send" button while we are waiting confirmation from the user's wallet. ::: code-group ```vue [SendTransaction.vue] // {"path":"/vercel/path0/site/vue/guides/send-transaction.md","from":3255,"to":4169} ``` ::: ### 6. Wait for transaction receipt (optional) We can also display the transaction confirmation status to the user by using the [`useWaitForTransactionReceipt` Composable](/vue/api/composables/useWaitForTransactionReceipt). ::: code-group ```vue [SendTransaction.vue] // {"path":"/vercel/path0/site/vue/guides/send-transaction.md","from":4451,"to":5686} ``` ::: ### 7. Handle errors (optional) If the user rejects the transaction, or the user does not have enough funds to cover the transaction, we can display an error message to the user. ::: code-group ```vue [SendTransaction.vue] // {"path":"/vercel/path0/site/vue/guides/send-transaction.md","from":5922,"to":7236} ``` ::: ### 8. Wire it up! Finally, we can wire up our Send Transaction component to our application's entrypoint. :::code-group ```vue [App.vue] // {"path":"/vercel/path0/site/vue/guides/send-transaction.md","from":7386,"to":7785} ``` ```vue [SendTransaction.vue] // {"path":"/vercel/path0/site/vue/guides/send-transaction.md","from":7818,"to":9076} ``` ::: [See the Example.](#example) --- --- url: /core/api/actions/sendCalls.md --- # sendCalls Action that requests for the wallet to sign and broadcast a batch of calls (transactions) to the network. [Read more.](https://github.com/ethereum/EIPs/blob/815028dc634463e1716fc5ce44c019a6040f0bef/EIPS/eip-5792.md#wallet_sendcalls) ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/sendCalls.md","from":389,"to":429} import { sendCalls } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendCalls.md","from":476,"to":833} import { parseEther } from 'viem' import { sendCalls } from '@wagmi/core' import { config } from './config' const id = await sendCalls(config, { calls: [ { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1') }, { data: '0xdeadbeef', to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', }, ] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### Synchronous Usage If you want to wait for the calls to be included in a block before returning, you can use `sendCallsSync`: ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendCalls.md","from":1046,"to":1416} import { parseEther } from 'viem' import { sendCallsSync } from '@wagmi/core' import { config } from './config' const receipt = await sendCallsSync(config, { calls: [ { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1') }, { data: '0xdeadbeef', to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', }, ] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/sendCalls.md","from":1487,"to":1542} import { type SendCallsParameters } from '@wagmi/core' ``` ### account `Account | Address | null | undefined` Account to execute the calls. If set to `null`, it is assumed that the wallet will handle filling the sender of the calls. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendCalls.md","from":1758,"to":2190} import { parseEther } from 'viem' import { sendCalls } from '@wagmi/core' import { config } from './config' const id = await sendCalls(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', // [!code focus] calls: [ { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1') }, { data: '0xdeadbeef', to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', }, ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### calls `{ to: Hex, data?: Hex, value?: bigint }[]` Calls to execute. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendCalls.md","from":2347,"to":2875} import { parseEther } from 'viem' import { sendCalls } from '@wagmi/core' import { config } from './config' const id = await sendCalls(config, { calls: [ // [!code focus] { // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', // [!code focus] value: parseEther('1') // [!code focus] }, // [!code focus] { // [!code focus] data: '0xdeadbeef', // [!code focus] to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', // [!code focus] }, // [!code focus] ], // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### capabilities `WalletCapabilities | undefined` Capability metadata for the calls (e.g. specifying a paymaster). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendCalls.md","from":3075,"to":3595} import { parseEther } from 'viem' import { sendCalls } from '@wagmi/core' import { config } from './config' const id = await sendCalls(config, { calls: [ { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1') }, { data: '0xdeadbeef', to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', }, ], capabilities: { // [!code focus] paymasterService: { // [!code focus] url: 'https://...' // [!code focus] } // [!code focus] } // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `number | undefined` The target chain ID to broadcast the calls. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendCalls.md","from":3757,"to":4147} import { parseEther } from 'viem' import { sendCalls } from '@wagmi/core' import { config } from './config' const id = await sendCalls(config, { calls: [ { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1') }, { data: '0xdeadbeef', to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', }, ], chainId: 10, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` Connector to get send the calls with. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendCalls.md","from":4308,"to":4811} import { parseEther } from 'viem' import { getConnections } from '@wagmi/core' import { sendCalls } from '@wagmi/core' import { config } from './config' const connections = getConnections(config) const id = await sendCalls(config, { calls: [ { to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1') }, { data: '0xdeadbeef', to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', }, ], connector: connections[0]?.connector, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/sendCalls.md","from":4883,"to":4938} import { type SendCallsReturnType } from '@wagmi/core' ``` `{ id: string; capabilities?: WalletCapabilities | undefined }` Identifier of the call batch. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/sendCalls.md","from":5055,"to":5109} import { type SendCallsErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls) --- --- url: /core/api/actions/sendTransaction.md --- # sendTransaction Action for creating, signing, and sending transactions to networks. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":237,"to":283} import { sendTransaction } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":330,"to":576} import { sendTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await sendTransaction(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### Synchronous Usage If you want to wait for the transaction to be included in a block before returning, you can use `sendTransactionSync`: ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":801,"to":1056} import { sendTransactionSync } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const receipt = await sendTransactionSync(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":1127,"to":1188} import { type SendTransactionParameters } from '@wagmi/core' ``` ### accessList `AccessList | undefined` The access list. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":1285,"to":1668} import { sendTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await sendTransaction(config, { accessList: [{ // [!code focus] address: '0x1', // [!code focus] storageKeys: ['0x1'], // [!code focus] }], // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### account `Address | Account | undefined` Account to use when sending transaction. Throws if account is not found on [`connector`](#connector). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":1899,"to":2219} import { sendTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await sendTransaction(config, { account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` Chain ID to validate against before sending transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":2418,"to":2749} import { sendTransaction } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { parseEther } from 'viem' import { config } from './config' const result = await sendTransaction(config, { chainId: mainnet.id, // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` * Connector to send transaction with. * Defaults to current connector. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":2943,"to":3305} import { getConnections, sendTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const connections = getConnections(config) const result = await sendTransaction(config, { connector: connections[0]?.connector, // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### data `` `0x${string}` | undefined `` A contract hashed method call with encoded args. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":3480,"to":3797} import { sendTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await sendTransaction(config, { data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gas `bigint | undefined | null` Gas provided for transaction execution. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":3958,"to":4256} import { sendTransaction } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' const result = await sendTransaction(config, { gas: parseGwei('20'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### gasPrice `bigint | undefined` The price in wei to pay per gas. Only applies to [Legacy Transactions](https://viem.sh/docs/glossary/terms#legacy-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":4508,"to":4811} import { sendTransaction } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' const result = await sendTransaction(config, { gasPrice: parseGwei('20'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxFeePerGas `bigint | undefined` Total fee per gas in wei, inclusive of [`maxPriorityFeePerGas`](#maxPriorityFeePerGas). Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":5121,"to":5428} import { sendTransaction } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' const result = await sendTransaction(config, { maxFeePerGas: parseGwei('20'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxPriorityFeePerGas `bigint | undefined` Max priority fee per gas in wei. Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":5691,"to":6038} import { sendTransaction } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' const result = await sendTransaction(config, { maxFeePerGas: parseGwei('20'), maxPriorityFeePerGas: parseGwei('2'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### nonce `number` Unique number identifying this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":6191,"to":6468} import { sendTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await sendTransaction(config, { nonce: 123, // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### to `Address` The transaction recipient or contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":6617,"to":6880} import { sendTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await sendTransaction(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### type `'legacy' | 'eip1559' | 'eip2930' | undefined` Optional transaction request type to narrow parameters. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":7077,"to":7359} import { sendTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await sendTransaction(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', type: 'eip1559', // [!code focus] value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### value `bigint | undefined` Value in wei sent with this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":7516,"to":7780} import { sendTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await sendTransaction(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":7852,"to":7913} import { type SendTransactionReturnType } from '@wagmi/core' ``` [`Hash`](https://viem.sh/docs/glossary/types#hash) Transaction hash. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/sendTransaction.md","from":8005,"to":8065} import { type SendTransactionErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Viem * [`sendTransaction`](https://viem.sh/docs/actions/wallet/sendTransaction) --- --- url: /core/api/utilities/serialize.md --- # serialize Serialize function that supports `bigint` and `Map`. ## Import ```ts-vue import { serialize } from '{{packageName}}' ``` ## Usage ```ts-vue import { serialize } from '{{packageName}}' const result = serialize({ foo: 'wagmi', bar: 123n }) ``` ## Parameters ### value `any` The value to stringify. ### replacer `(key: string, value: any) => any` A custom replacer function for handling standard values. ### indent `number | null | undefined` The number of spaces to indent the output by. ### circularReplacer A custom replacer function for handling circular values. ## Return Type `string` Stringified value. --- --- url: /react/api/utilities/serialize.md --- # serialize Serialize function that supports `bigint` and `Map`. ## Import ```ts-vue import { serialize } from '{{packageName}}' ``` ## Usage ```ts-vue import { serialize } from '{{packageName}}' const result = serialize({ foo: 'wagmi', bar: 123n }) ``` ## Parameters ### value `any` The value to stringify. ### replacer `(key: string, value: any) => any` A custom replacer function for handling standard values. ### indent `number | null | undefined` The number of spaces to indent the output by. ### circularReplacer A custom replacer function for handling circular values. ## Return Type `string` Stringified value. --- --- url: /shared/utilities/serialize.md --- # serialize Serialize function that supports `bigint` and `Map`. ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/utilities/serialize.md","from":151,"to":195} import { serialize } from '{{packageName}}' ``` ## Usage ```ts-vue // {"path":"/vercel/path0/site/shared/utilities/serialize.md","from":220,"to":319} import { serialize } from '{{packageName}}' const result = serialize({ foo: 'wagmi', bar: 123n }) ``` ## Parameters ### value `any` The value to stringify. ### replacer `(key: string, value: any) => any` A custom replacer function for handling standard values. ### indent `number | null | undefined` The number of spaces to indent the output by. ### circularReplacer A custom replacer function for handling circular values. ## Return Type `string` Stringified value. --- --- url: /vue/api/utilities/serialize.md --- # serialize Serialize function that supports `bigint` and `Map`. ## Import ```ts-vue import { serialize } from '{{packageName}}' ``` ## Usage ```ts-vue import { serialize } from '{{packageName}}' const result = serialize({ foo: 'wagmi', bar: 123n }) ``` ## Parameters ### value `any` The value to stringify. ### replacer `(key: string, value: any) => any` A custom replacer function for handling standard values. ### indent `number | null | undefined` The number of spaces to indent the output by. ### circularReplacer A custom replacer function for handling circular values. ## Return Type `string` Stringified value. --- --- url: /core/api/actions/showCallsStatus.md --- # showCallsStatus Action to request for the wallet to show information about a call batch that was sent via `sendCalls`. [Read more.](https://github.com/ethereum/EIPs/blob/1663ea2e7a683285f977eda51c32cec86553f585/EIPS/eip-5792.md#wallet_showcallsstatus) ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/showCallsStatus.md","from":409,"to":455} import { showCallsStatus } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/showCallsStatus.md","from":502,"to":646} import { showCallsStatus } from '@wagmi/core' import { config } from './config' await showCallsStatus(config, { id: '0x1234567890abcdef', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/showCallsStatus.md","from":717,"to":778} import { type ShowCallsStatusParameters } from '@wagmi/core' ``` ### connector `Connector | undefined` Connector to show call statuses with. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/showCallsStatus.md","from":894,"to":1154} import { getConnections, showCallsStatus } from '@wagmi/core' import { config } from './config' const connections = getConnections(config) await showCallsStatus(config, { connector: connections[0]?.connector, // [!code focus] id: '0x1234567890abcdef', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### id `string` Identifier of the call batch. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/showCallsStatus.md","from":1285,"to":1446} import { showCallsStatus } from '@wagmi/core' import { config } from './config' await showCallsStatus(config, { id: '0x1234567890abcdef', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/showCallsStatus.md","from":1518,"to":1579} import { type ShowCallsStatusReturnType } from '@wagmi/core' ``` `bigint` Most recent block number seen. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/showCallsStatus.md","from":1642,"to":1702} import { type ShowCallsStatusErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`showCallsStatus`](https://viem.sh/docs/actions/wallet/showCallsStatus) --- --- url: /core/api/actions/signMessage.md --- # signMessage Action for signing messages. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/signMessage.md","from":186,"to":228} import { signMessage } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signMessage.md","from":275,"to":406} import { signMessage } from '@wagmi/core' import { config } from './config' await signMessage(config, { message: 'hello world' }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/signMessage.md","from":477,"to":534} import { type SignMessageParameters } from '@wagmi/core' ``` ### account `Address | Account | undefined` Account to use when signing message. Throws if account is not found on [`connector`](#connector). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signMessage.md","from":716,"to":939} import { signMessage } from '@wagmi/core' import { config } from './config' const result = await signMessage(config, { account: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] message: 'hello world', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` [Connector](/core/api/connectors) to sign message with. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signMessage.md","from":1118,"to":1356} import { getConnection, signMessage } from '@wagmi/core' import { config } from './config' const { connector } = getConnection(config) const result = await signMessage(config, { connector, // [!code focus] message: 'hello world', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### message `string | { raw: Hex | ByteArray }` Message to sign. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signMessage.md","from":1506,"to":1672} import { signMessage } from '@wagmi/core' import { config } from './config' const result = await signMessage(config, { message: 'hello world', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: tip By default, viem signs the UTF-8 representation of the message. To sign the data representation of the message, you can use the `raw` attribute. ```ts // {"path":"/vercel/path0/site/core/api/actions/signMessage.md","from":1882,"to":2070} import { signMessage } from '@wagmi/core' import { config } from './config' const result = await signMessage(config, { message: { raw: '0x68656c6c6f20776f726c64' }, // [!code focus] }) ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/signMessage.md","from":2101,"to":2158} import { type SignMessageReturnType } from '@wagmi/core' ``` [`Hex`](https://viem.sh/docs/glossary/types#hex) The signed message. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/signMessage.md","from":2250,"to":2306} import { type SignMessageErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Viem * [`signMessage`](https://viem.sh/docs/actions/wallet/signMessage) --- --- url: /core/api/actions/signTransaction.md --- # signTransaction Action for creating and signing transactions to networks. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":227,"to":273} import { signTransaction } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":321,"to":567} import { signTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await signTransaction(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### Synchronous Usage If you want to wait for the transaction to be included in a block before returning, you can use `signTransactionSync`: ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":794,"to":1049} import { signTransactionSync } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const receipt = await signTransactionSync(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":1121,"to":1182} import { type SignTransactionParameters } from '@wagmi/core' ``` ### accessList `AccessList | undefined` The access list. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":1280,"to":1663} import { signTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await signTransaction(config, { accessList: [{ // [!code focus] address: '0x1', // [!code focus] storageKeys: ['0x1'], // [!code focus] }], // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### account `Address | Account | undefined` Account to use when signing transaction. Throws if account is not found on [`connector`](#connector). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":1896,"to":2216} import { signTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await signTransaction(config, { account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` Chain ID to validate against before signing transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":2417,"to":2748} import { signTransaction } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { parseEther } from 'viem' import { config } from './config' const result = await signTransaction(config, { chainId: mainnet.id, // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` * Connector to sign transaction with. * Defaults to current connector. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":2944,"to":3306} import { getConnections, signTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const connections = getConnections(config) const result = await signTransaction(config, { connector: connections[0]?.connector, // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### data `` `0x${string}` | undefined `` A contract hashed method call with encoded args. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":3483,"to":3800} import { signTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await signTransaction(config, { data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gas `bigint | undefined | null` Gas provided for transaction execution. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":3963,"to":4261} import { signTransaction } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' const result = await signTransaction(config, { gas: parseGwei('20'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### gasPrice `bigint | undefined` The price in wei to pay per gas. Only applies to [Legacy Transactions](https://viem.sh/docs/glossary/terms#legacy-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":4515,"to":4818} import { signTransaction } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' const result = await signTransaction(config, { gasPrice: parseGwei('20'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxFeePerGas `bigint | undefined` Total fee per gas in wei, inclusive of [`maxPriorityFeePerGas`](#maxpriorityfeepergas). Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":5130,"to":5437} import { signTransaction } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' const result = await signTransaction(config, { maxFeePerGas: parseGwei('20'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxPriorityFeePerGas `bigint | undefined` Max priority fee per gas in wei. Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":5702,"to":6049} import { signTransaction } from '@wagmi/core' import { parseEther, parseGwei } from 'viem' import { config } from './config' const result = await signTransaction(config, { maxFeePerGas: parseGwei('20'), maxPriorityFeePerGas: parseGwei('2'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### nonce `number` Unique number identifying this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":6204,"to":6481} import { signTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await signTransaction(config, { nonce: 123, // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### to `Address` The transaction recipient or contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":6632,"to":6895} import { signTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await signTransaction(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### type `'legacy' | 'eip1559' | 'eip2930' | undefined` Optional transaction request type to narrow parameters. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":7094,"to":7376} import { signTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await signTransaction(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', type: 'eip1559', // [!code focus] value: parseEther('0.01'), }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### value `bigint | undefined` Value in wei sent with this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":7535,"to":7798} import { signTransaction } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' const result = await signTransaction(config, { to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":7871,"to":7932} import { type SignTransactionReturnType } from '@wagmi/core' ``` [`Hash`](https://viem.sh/docs/glossary/types#hash) Transaction hash. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/signTransaction.md","from":8024,"to":8084} import { type SignTransactionErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Viem * [`signTransaction`](https://viem.sh/docs/actions/wallet/signTransaction) --- --- url: /core/api/actions/signTypedData.md --- # signTypedData Action for signing typed data and calculating an Ethereum-specific [EIP-712](https://eips.ethereum.org/EIPS/eip-712) signature. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/signTypedData.md","from":291,"to":335} import { signTypedData } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTypedData.md","from":382,"to":1034} import { signTypedData } from '@wagmi/core' import { config } from './config' const result = await signTypedData(config, { types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/signTypedData.md","from":1105,"to":1164} import { type SignTypedDataParameters } from '@wagmi/core' ``` ### account `Address | Account | undefined` Account to use when signing data. Throws if account is not found on [`connector`](#connector). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTypedData.md","from":1343,"to":1853} import { signTypedData } from '@wagmi/core' import { config } from './config' import { types } from './typedData' const result = await signTypedData(config, { account: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] types, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` [Connector](/core/api/connectors) to sign data with. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTypedData.md","from":2071,"to":2596} import { getConnection, signTypedData } from '@wagmi/core' import { config } from './config' import { types } from './typedData' const { connector } = getConnection(config) const result = await signTypedData(config, { connector, // [!code focus] types, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### domain `TypedDataDomain | undefined` * The typed data domain. * If `EIP712Domain` key exists in [`types`](#types), `domain` schema is inferred from it. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTypedData.md","from":2879,"to":3561} import { signTypedData } from '@wagmi/core' import { config } from './config' import { types } from './typedData' const result = await signTypedData(config, { domain: { // [!code focus] name: 'Ether Mail', // [!code focus] chainId: 1, // [!code focus] verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', // [!code focus] version: '1', // [!code focus] }, // [!code focus] types, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### message `Record` * Data to sign. * Type inferred from [`types`](#types) and [`primaryType`](#primarytype). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTypedData.md","from":3816,"to":4439} import { signTypedData } from '@wagmi/core' import { config } from './config' import { types } from './typedData' const result = await signTypedData(config, { types, primaryType: 'Mail', message: { // [!code focus] from: { // [!code focus] name: 'Cow', // [!code focus] wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', // [!code focus] }, // [!code focus] to: { // [!code focus] name: 'Bob', // [!code focus] wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', // [!code focus] }, // [!code focus] contents: 'Hello, Bob!', // [!code focus] }, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### primaryType `string` * The primary type to extract from [`types`](#types) and use in [`message`](#message). * Type inferred from [`types`](#types). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTypedData.md","from":4718,"to":5171} import { signTypedData } from '@wagmi/core' import { config } from './config' import { types } from './typedData' const result = await signTypedData(config, { types, primaryType: 'Mail', // [!code focus] message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### types `TypedData` * The type definitions for the typed data. * By defining inline or adding a [const assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) to `types`, TypeScript will infer the correct types for [`message`](#message) and [`primaryType`](#primarytype). See the Wagmi [TypeScript docs](/core/typescript) for more information. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/signTypedData.md","from":5696,"to":6535} import { signTypedData } from '@wagmi/core' import { config } from './config' const result = await signTypedData(config, { types: { // [!code focus] Person: [ // [!code focus] { name: 'name', type: 'string' }, // [!code focus] { name: 'wallet', type: 'address' }, // [!code focus] ], // [!code focus] Mail: [ // [!code focus] { name: 'from', type: 'Person' }, // [!code focus] { name: 'to', type: 'Person' }, // [!code focus] { name: 'contents', type: 'string' }, // [!code focus] ], // [!code focus] }, // [!code focus] primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/signTypedData.md","from":6607,"to":6666} import { type SignTypedDataReturnType } from '@wagmi/core' ``` [`Hex`](https://viem.sh/docs/glossary/types#hex) The signed data. ## Type Inference With [`types`](#types) setup correctly, TypeScript will infer the correct types for [`domain`](#domain), [`message`](#message), and [`primaryType`](#primarytype). See the Wagmi [TypeScript docs](/core/typescript) for more information. ::: code-group ```ts twoslash [Inline] // {"path":"/vercel/path0/site/core/api/actions/signTypedData.md","from":7033,"to":11532} // @twoslash-cache: {"v":1,"hash":"44d90fe296d503e3675e18b904994e8969cc43a5fc5d95c28c6ca88739b0e3f3","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAlPgFcAbNROwAGABloASYG1IBLMAHMAvkMog2AQ1INEANiq8YCtPiR7qm+TG0gucPg31zciEVUb5N6xjXK7FFdGxnAmIyVRp6PAAKdV4ZdTgASnY4GXkwABUgqAARdTR1AB5gAB0wdgrOGHUoFl4MdgAFMjgWQS4auobUMsq+qs6wevYwdQBbGEES8HGYaYBuXv6KjtqhhswcKbU0WQUFpYr/dlLy5YG14dGJ7YB3WIM0A7Pl1a72Tcn2aZqoWzhnn1FABdRYvC7vACy6hkvHa1Uu3VO5wh6xGs22ADNSBAxoDzm80Z9ts1SK0wPijhQTod+oSrhjvtQIJS6Qj3sSmaTyazjsiCey0dcvtNmGAaOKASAwSj6RsgttpHJ5LzQWVjtNobDpgA+KJizFpQQAYRYhvk1KwngmPjggn5FU+dpp4L6cqaLTaqOGPVdAsGDJuTOFrNlguGnOmSv20tpQOpDpR3oawruDysof9iI+CqZv3+maOar9K3DDS1cOT7F9Scq7tTTOxuMLbID8q2XM9FNjJfYfLjWfeDemaBZPdrpbbOY7025LBb/d7brL6KDopYErQUplE/dkZ2exV4/OIJ3RzP7AAdNf2AAWdhjCBcK/Xi9isAwbxPgD8JpYH6/Uh2AAH3YbgwFgQ0PygMFFESQRGhxMYZDgGBCgAZTSTJsjyAoACUrG4UhsJwHUyhkMYsCfDhUnSLIcFyfJ1FUWpGAQRACDQNAsDtAB6Xj7nkZDLzgfBeOYLhePULAZCk7wZBYOBeNokiYEYgpVA0LQkAAJgARn0Qx5GMJA9IAZ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VairmPvIXZ4y+vH777tRf07DuLKhSsxNvAjO9H2zBfdk79551PfC05x/Tm7nW7vJAK/dFI2nrls1240u5X2ZcIEp2YYXy3x7uWgMECKHBbD2HYHXdg6h7gyBolhey6l1D6jPhaULgCUsehrYIZAA5gDJvYAAcmFD76knIfdIJ932Cgnvvc+9kwHvdvvCGh/8LScetJSUe79F7hsPv6Ex6DyAhP4f0+R9HDn3MPu89h4j5ntXJeOzB+0/npPBeqRLHw8x39vuKwB7KN3s4dWgs94HxSIfg/B99B6wOTPppbhd79INn3YhjQ5FNrjDGy83sI2yuZRfvrYbZUYErAAgilY0sNl7ZQtreHImIEY5ByAjR9M/4y0nBxPxkPuABCEAUqP/6HPsQKV38AD39gCUogDADQDwDwCIDACoCAC4CgCACf9m9wQ1dBAfc44YAhYIBqRP8UoABCH/RPMAOCVQG0ZiRAUAMKZ6BSMAK9BARQRQIAA"} import { createConfig, http, signTypedData } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) // ---cut--- const result = await signTypedData(config, { types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', // ^? message: { // ^? from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, }) ``` ```ts twoslash [Const-Asserted] // {"path":"/vercel/path0/site/core/api/actions/signTypedData.md","from":11568,"to":16402} // @twoslash-cache: {"v":1,"hash":"3253afdbde057c102c6b708011549c2795dd31d2584982f81ae20a403b5bdb54","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAkxzkXeAB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VOhoeFHPXRNzvOsXR6xDFquavfl/hpXinRU9pN65+LyfaascF6usX4mSu4/L4m6vlTlPFvS9RyE+u9b7rTWnD16XHvSbyfLJUEk0A/K5xxCzS2O8yAkQwAlmvAAA5LcGAeEFMGAaOGASHBQMAaAewGAffFASVGAdovAWEI4BUIgZkN/EAV0CAXxGAeFOgTAWVNgfgToCQZsGAdsBQQqGAVQQgUgaQdLkwSLLASEtQbgfgSEOwBPAzPCoIIILnB3EXP/uIEkD4FMh0kCq8uIFQowjPHRjiDQUtr4P1sdrVigS5FAWIQsJkOrnTkYeYcYRYVYV0Cbn/KQQwgkIYZcJbmAeXHQkvGuhmsmjxsmgWPaASr8u4cmomgSowKOgAIKYp0Kvg8YEqbpFhLwDD2hLxLz2jhjQhOHyLA4QCg7CCkEABCEAmKmRugLh5cmK+RFR+R1RmKVRlRtR9R9RDRlRTRFRbRVRFRJRSwUuMWzw4B36MAKQEA4QhRmKAAhCUTgWpHyKCOwosogKAKyM6ncr6F6HpCACECEEAA"} import { createConfig, http, signTypedData } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) // ---cut--- const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const const result = await signTypedData(config, { types, primaryType: 'Mail', // ^? message: { // ^? from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, }) ``` ::: ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/signTypedData.md","from":16427,"to":16485} import { type SignTypedDataErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Viem * [`signTypedData`](https://viem.sh/docs/actions/wallet/signTypedData) --- --- url: /core/api/actions/simulateContract.md --- # simulateContract Action for simulating/validating a contract interaction. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":229,"to":276} import { simulateContract } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":323,"to":705} import { simulateContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":812,"to":874} import { type SimulateContractParameters } from '@wagmi/core' ``` ### abi `Abi` The contract's ABI. Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":1090,"to":1506} import { simulateContract } from '@wagmi/core' import { abi } from './abi' // [!code focus] import { config } from './config' const result = await simulateContract(config, { abi, // [!code focus] address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### accessList `AccessList | undefined` The access list. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":1684,"to":2203} import { simulateContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], accessList: [{ // [!code focus] address: '0x1', // [!code focus] storageKeys: ['0x1'], // [!code focus] }], // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### account `Address | Account | undefined` Account to use when signing data. Throws if account is not found on [`connector`](#connector). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":2463,"to":2919} import { simulateContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], account: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### address `Address` The contract's address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":3086,"to":3485} import { simulateContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', // [!code focus] functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### args `readonly unknown[] | undefined` * Arguments to pass when calling the contract. * Inferred from [`abi`](#abi) and [`functionName`](#functionname). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":3763,"to":4230} import { simulateContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ // [!code focus] '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', // [!code focus] 123n, // [!code focus] ], // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### blockNumber `bigint | undefined` Block number to simulate against. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":4427,"to":4852} import { simulateContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], blockNumber: 17829139n, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to simulate against. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":5088,"to":5507} import { simulateContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], blockTag: 'safe', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` Chain ID to validate against before sending transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":5747,"to":6225} import { simulateContract } from '@wagmi/core' import { mainnet } from 'wagmi/chains' // [!code focus] import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` [Connector](/core/api/connectors) to simulate transaction with. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":6448,"to":6919} import { getConnection, simulateContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const { connector } = getConnection(config) const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], connector, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### dataSuffix `` `0x${string}` | undefined `` Data to append to the end of the calldata. Useful for adding a ["domain" tag](https://opensea.notion.site/opensea/Seaport-Order-Attributions-ec2d69bf455041a5baa490941aad307f). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":7263,"to":7723} import { simulateContract } from '@wagmi/core' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], dataSuffix: '0xdeadbeef', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### functionName `string` * Function to call on the contract. * Inferred from [`abi`](#abi). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":7937,"to":8267} import { simulateContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'approve', // [!code focus] args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gas `bigint | undefined` Gas provided for transaction execution. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":8457,"to":8913} import { simulateContract } from '@wagmi/core' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], gas: parseGwei('20'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### gasPrice `bigint | undefined` The price in wei to pay per gas. Only applies to [Legacy Transactions](https://viem.sh/docs/glossary/terms#legacy-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":9201,"to":9662} import { simulateContract } from '@wagmi/core' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], gasPrice: parseGwei('20'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxFeePerGas `bigint | undefined` Total fee per gas in wei, inclusive of [`maxPriorityFeePerGas`](#maxPriorityFeePerGas). Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":10008,"to":10473} import { simulateContract } from '@wagmi/core' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], maxFeePerGas: parseGwei('20'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxPriorityFeePerGas `bigint | undefined` Max priority fee per gas in wei. Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":10772,"to":11277} import { simulateContract } from '@wagmi/core' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], maxFeePerGas: parseGwei('20'), maxPriorityFeePerGas: parseGwei('2'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### nonce `number` Unique number identifying this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":11466,"to":11879} import { simulateContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], nonce: 123, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### type `'legacy' | 'eip1559' | 'eip2930' | undefined` Optional transaction request type to narrow parameters. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":12112,"to":12530} import { simulateContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], type: 'eip1559', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### value `bigint | undefined` Value in wei sent with this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":12723,"to":13185} import { simulateContract } from '@wagmi/core' import { parseEther } from 'viem' import { abi } from './abi' import { config } from './config' const result = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], value: parseEther('0.01'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":13293,"to":13355} import { type SimulateContractReturnType } from '@wagmi/core' ``` The simulation result and write request. ### request Write request that includes [parameters](#parameters). ### response `unknown` * Result of contract simulation. * Inferred from [`abi`](#abi), [`functionName`](#functionname), and [`args`](#args). ## Type Inference With [`abi`](#abi) setup correctly, TypeScript will infer the correct types for [`functionName`](#functionname), [`args`](#args), and [`value`](#value). See the Wagmi [TypeScript docs](/core/typescript) for more information. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/simulateContract.md","from":13876,"to":13937} import { type SimulateContractErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`simulateContract`](https://viem.sh/docs/contract/simulateContract) --- --- url: /cli/api/plugins/sourcify.md --- # sourcify Plugin for fetching ABIs from [Sourcify](https://sourcify.dev/). Sourcify is a decentralized, open-source, smart contract verification and metadata repository. ## Import ```ts // {"path":"/vercel/path0/site/cli/api/plugins/sourcify.md","from":190,"to":236} import { sourcify } from '@wagmi/cli/plugins' ``` ## Usage ```ts{2,6-13} // {"path":"/vercel/path0/site/cli/api/plugins/sourcify.md","from":265,"to":569} import { defineConfig } from '@wagmi/cli' import { sourcify } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ sourcify({ contracts: [ { name: 'deposit', address: '0x00000000219ab540356cbb839cbe05303d7705fa', }, ], }), ], }) ``` ## Configuration ```ts // {"path":"/vercel/path0/site/cli/api/plugins/sourcify.md","from":598,"to":655} import { type SourcifyConfig } from '@wagmi/cli/plugins' ``` ### cacheDuration `number | undefined` * Duration in milliseconds to cache ABIs. * Defaults to `1_800_000` (30 minutes). ```ts // {"path":"/vercel/path0/site/cli/api/plugins/sourcify.md","from":790,"to":1161} import { defineConfig } from '@wagmi/cli' import { sourcify } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ sourcify({ cacheDuration: 300_000, // [!code focus] chainId: 100, contracts: [ { name: 'Deposit', address: '0x00000000219ab540356cbb839cbe05303d7705fa', }, ], }), ], }) ``` ### chainId `number` Chain ID to use for fetching ABI. If `address` is an object, `chainId` is used to select the address. See [Sourcify docs](https://docs.sourcify.dev/docs/chains) for supported chains. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/sourcify.md","from":1379,"to":1817} import { defineConfig } from '@wagmi/cli' import { sourcify } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ sourcify({ chainId: 100, // [!code focus] contracts: [ { name: 'Community', address: { 100: '0xC4c622862a8F548997699bE24EA4bc504e5cA865', 137: '0xC4c622862a8F548997699bE24EA4bc504e5cA865', }, }, ], }), ], }) ``` ### contracts `{ name: string; address?: Address | Record | undefined }[]` Contracts to fetch ABIs for. ```ts // {"path":"/vercel/path0/site/cli/api/plugins/sourcify.md","from":1952,"to":2378} import { defineConfig } from '@wagmi/cli' import { sourcify } from '@wagmi/cli/plugins' export default defineConfig({ plugins: [ sourcify({ chainId: 100, contracts: [ // [!code focus] { // [!code focus] name: 'Deposit', // [!code focus] address: '0x00000000219ab540356cbb839cbe05303d7705fa', // [!code focus] }, // [!code focus] ], // [!code focus] }), ], }) ``` --- --- url: /react/guides/ssr.md --- # SSR Wagmi uses client-only external stores (such as `localStorage` and `mipd`) to show the user the most relevant data as quickly as possible on first render. However, the caveat of using these external client stores is that frameworks which incorporate SSR (such as Next.js) will throw hydration warnings on the client when it identifies mismatches between the server-rendered HTML and the client-rendered HTML. To stop this from happening, you can toggle on the [`ssr`](/react/api/createConfig#ssr) property in the Wagmi Config. ```tsx // {"path":"/vercel/path0/site/react/guides/ssr.md","from":567,"to":842} import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' const config = createConfig({ // [!code focus:99] chains: [mainnet, sepolia], ssr: true, // [!code ++] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` Turning on the `ssr` property means that content from the external stores will be hydrated on the client after the initial mount. ## Persistence using Cookies As a result of turning on the `ssr` property, external persistent stores like `localStorage` will be hydrated on the client **after the initial mount**. This means that you will still see a flash of "empty" data on the client (e.g. a `"disconnected"` account instead of a `"reconnecting"` account, or an empty address instead of the last connected address) until after the first mount, when the store hydrates. In order to persist data between the server and the client, you can use cookies. ### 1. Set up cookie storage First, we will set up cookie storage in the Wagmi Config. ```tsx // {"path":"/vercel/path0/site/react/guides/ssr.md","from":1599,"to":2060} import { createConfig, http, cookieStorage, // [!code ++] createStorage // [!code ++] } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export function getConfig() { return createConfig({ chains: [mainnet, sepolia], ssr: true, storage: createStorage({ // [!code ++] storage: cookieStorage, // [!code ++] }), // [!code ++] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) } ``` ### 2. Hydrate the cookie Next, we will need to add some mechanisms to hydrate the stored cookie in Wagmi. #### Next.js App Directory In our `app/layout.tsx` file (a [Server Component](https://nextjs.org/docs/app/building-your-application/rendering/server-components)), we will need to extract the cookie from the `headers` function and pass it to [`cookieToInitialState`](/react/api/utilities/cookieToInitialState). We will need to pass this result to the [`initialState` property](/react/api/WagmiProvider#initialstate) of the `WagmiProvider`. The `WagmiProvider` **must** be in a Client Component tagged with `"use client"` (see `app/providers.tsx` tab). ::: code-group ```tsx [app/layout.tsx] // {"path":"/vercel/path0/site/react/guides/ssr.md","from":2768,"to":3450} import { type ReactNode } from 'react' import { headers } from 'next/headers' // [!code ++] import { cookieToInitialState } from 'wagmi' // [!code ++] import { getConfig } from './config' import { Providers } from './providers' export default async function Layout({ children }: { children: ReactNode }) { const initialState = cookieToInitialState( // [!code ++] getConfig(), // [!code ++] (await headers()).get('cookie') // [!code ++] ) // [!code ++] return ( // [!code --] // [!code ++] {children} ) } ``` ```tsx [app/providers.tsx] // {"path":"/vercel/path0/site/react/guides/ssr.md","from":3482,"to":4309} 'use client' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { type ReactNode, useState } from 'react' import { type State, WagmiProvider } from 'wagmi' import { getConfig } from './config' type Props = { children: ReactNode, initialState: State | undefined, // [!code ++] } export function Providers({ children }: Props) { // [!code --] export function Providers({ children, initialState }: Props) { // [!code ++] const [config] = useState(() => getConfig()) const [queryClient] = useState(() => new QueryClient()) return ( // [!code --] // [!code ++] {children} ) } ``` ```tsx [app/config.ts] // {"path":"/vercel/path0/site/react/guides/ssr.md","from":4337,"to":4771} import { createConfig, http, cookieStorage, createStorage } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export function getConfig() { return createConfig({ chains: [mainnet, sepolia], ssr: true, storage: createStorage({ // [!code ++] storage: cookieStorage, // [!code ++] }), // [!code ++] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) } ``` ::: #### Next.js Pages Directory Would you like to contribute this content? Feel free to [open a Pull Request](https://github.com/wevm/wagmi/pulls)! #### Vanilla SSR Would you like to contribute this content? Feel free to [open a Pull Request](https://github.com/wevm/wagmi/pulls)! --- --- url: /vue/guides/ssr.md --- # SSR Wagmi uses client-only external stores (such as `localStorage` and `mipd`) to show the user the most relevant data as quickly as possible on first render. However, the caveat of using these external client stores is that frameworks which incorporate SSR (such as Next.js) will throw hydration warnings on the client when it identifies mismatches between the server-rendered HTML and the client-rendered HTML. To stop this from happening, you can toggle on the [`ssr`](/vue/api/createConfig#ssr) property in the Wagmi Config. ```tsx // {"path":"/vercel/path0/site/vue/guides/ssr.md","from":565,"to":850} import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' const config = createConfig({ // [!code focus:99] chains: [mainnet, sepolia], ssr: true, // [!code ++] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` Turning on the `ssr` property means that content from the external stores will be hydrated on the client after the initial mount. ## Persistence using Cookies As a result of turning on the `ssr` property, external persistent stores like `localStorage` will be hydrated on the client **after the initial mount**. This means that you will still see a flash of "empty" data on the client (e.g. a `"disconnected"` account instead of a `"reconnecting"` account, or an empty address instead of the last connected address) until after the first mount, when the store hydrates. In order to persist data between the server and the client, you can use cookies. ### 1. Set up cookie storage First, we will set up cookie storage in the Wagmi Config. ```tsx // {"path":"/vercel/path0/site/vue/guides/ssr.md","from":1607,"to":2039} import { createConfig, http, cookieStorage, // [!code ++] createStorage // [!code ++] } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], ssr: true, storage: createStorage({ // [!code ++] storage: cookieStorage, // [!code ++] }), // [!code ++] transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### 2. Hydrate the cookie Next, we will need to add some mechanisms to hydrate the stored cookie in Wagmi. #### Nuxt.js Would you like to contribute this content? Feel free to [open a Pull Request](https://github.com/wevm/wagmi/pulls)! #### Vanilla SSR Would you like to contribute this content? Feel free to [open a Pull Request](https://github.com/wevm/wagmi/pulls)! --- --- url: /core/api/actions/switchChain.md --- # switchChain Action for switching the target chain for a connector or the Wagmi [`Config`](/core/api/createConfig#config). ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/switchChain.md","from":267,"to":309} import { switchChain } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/switchChain.md","from":356,"to":529} import { switchChain } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' await switchChain(config, { chainId: mainnet.id }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: tip When connected, `switchChain` will switch the target chain for the connector. When not connected, `switchChain` will switch the target chain for the Wagmi [`Config`](/core/api/createConfig#config). ::: ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/switchChain.md","from":811,"to":868} import { type SwitchChainParameters } from '@wagmi/core' ``` ### addEthereumChainParameter `{ chainName: string; nativeCurrency?: { name: string; symbol: string; decimals: number } | undefined; rpcUrls: readonly string[]; blockExplorerUrls?: string[] | undefined; iconUrls?: string[] | undefined } | undefined` [EIP-3085 parameters](https://eips.ethereum.org/EIPS/eip-3085) to use when adding chain to connector (when supported). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/switchChain.md","from":1277,"to":1603} import { switchChain } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const result = await switchChain(config, { addEthereumChainParameter: { // [!code focus] iconUrls: ['https://example.com/icon.png'], // [!code focus] }, // [!code focus] chainId: mainnet.id, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to switch to. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/switchChain.md","from":1771,"to":1979} import { switchChain } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const result = await switchChain(config, { chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector` [Connector](/core/api/connectors) to switch chain with. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/switchChain.md","from":2146,"to":2446} import { getConnection, switchChain } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const connection = getConnection(config) const result = await switchChain(config, { chainId: mainnet.id, connector: connection?.connector, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/switchChain.md","from":2518,"to":2575} import { type SwitchChainReturnType } from '@wagmi/core' ``` `Chain` Chain that was switched to. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/switchChain.md","from":2634,"to":2690} import { type SwitchChainErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Viem * [`switchChain`](https://viem.sh/docs/actions/wallet/switchChain) when connected. --- --- url: /core/api/actions/switchConnection.md --- # switchConnection Action for switching the current account. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/switchConnection.md","from":214,"to":261} import { switchConnection } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/switchConnection.md","from":308,"to":540} import { getConnections, switchConnection } from '@wagmi/core' import { config } from './config' const connections = getConnections(config) const result = await switchConnection(config, { connector: connections[0]?.connector, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/switchConnection.md","from":611,"to":673} import { type SwitchConnectionParameters } from '@wagmi/core' ``` ### connector `Connector` [Connector](/core/api/connectors) to switch to. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/switchConnection.md","from":787,"to":1036} import { getConnections, switchConnection } from '@wagmi/core' import { config } from './config' const connections = getConnections(config) const result = await switchConnection(config, { connector: connections[0]?.connector, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/switchConnection.md","from":1108,"to":1170} import { type SwitchConnectionReturnType } from '@wagmi/core' ``` ### accounts `readonly [Address, ...Address[]]` Connected accounts from connector. ### chainId `number` Connected chain ID from connector. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/switchConnection.md","from":1338,"to":1399} import { type SwitchConnectionErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` --- --- url: /react/guides/tanstack-query.md --- # TanStack Query Wagmi Hooks are not only a wrapper around the core [Wagmi Actions](/core/api/actions), but they also utilize [TanStack Query](https://tanstack.com/query/v5) to enable trivial and intuitive fetching, caching, synchronizing, and updating of asynchronous data in your React applications. Without an asynchronous data fetching abstraction, you would need to handle all the negative side-effects that comes as a result, such as: representing finite states (loading, error, success), handling race conditions, caching against a deterministic identifier, etc. ## Queries & Mutations Wagmi Hooks represent either a **Query** or a **Mutation**. **Queries** are used for fetching data (e.g. fetching a block number, reading from a contract, etc), and are typically invoked on mount by default. All queries are coupled to a unique [Query Key](#query-keys), and can be used for further operations such as refetching, prefetching, or modifying the cached data. **Mutations** are used for mutating data (e.g. connecting/disconnecting accounts, writing to a contract, switching chains, etc), and are typically invoked in response to a user interaction. Unlike **Queries**, they are not coupled with a query key. ## Terms * **Query**: An asynchronous data fetching (e.g. read data) operation that is tied against a unique Query Key. * **Mutation**: An asynchronous mutating (e.g. create/update/delete data or side-effect) operation. * **Query Key**: A unique identifier that is used to deterministically identify a query. It is typically a tuple of the query name and the query arguments. * **Stale Data**: Data that is unused or inactive after a certain period of time. * **Query Fetching**: The process of invoking an async query function. * **Query Refetching**: The process of refetching **rendered** queries. * **[Query Invalidation](https://tanstack.com/query/v5/docs/react/guides/query-invalidation)**: The process of marking query data as stale (e.g. inactive/unused), and refetching **rendered** queries. * **[Query Prefetching](https://tanstack.com/query/v5/docs/react/guides/prefetching)**: The process of prefetching queries and seeding the cache. ## Persistence via External Stores By default, TanStack Query persists all query data in-memory. This means that if you refresh the page, all in-memory query data will be lost. If you want to persist query data to an external storage, you can utilize TanStack Query's [`createSyncStoragePersister`](https://tanstack.com/query/v5/docs/react/plugins/createSyncStoragePersister) or [`createAsyncStoragePersister`](https://tanstack.com/query/v5/docs/react/plugins/createAsyncStoragePersister) to plug external storage like `localStorage`, `sessionStorage`, [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) or [`AsyncStorage`](https://reactnative.dev/docs/asyncstorage) (React Native). ### Sync Storage Below is an example of how to set up Wagmi + TanStack Query with sync external storage like `localStorage` or `sessionStorage`. #### Install ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":3074,"to":3157} pnpm i @tanstack/query-sync-storage-persister @tanstack/react-query-persist-client ``` ```bash [npm] // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":3176,"to":3258} npm i @tanstack/query-sync-storage-persister @tanstack/react-query-persist-client ``` ```bash [yarn] // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":3278,"to":3363} yarn add @tanstack/query-sync-storage-persister @tanstack/react-query-persist-client ``` ```bash [bun] // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":3382,"to":3464} bun i @tanstack/query-sync-storage-persister @tanstack/react-query-persist-client ``` ::: #### Usage ```tsx // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":3492,"to":4792} // 1. Import modules. // [!code hl] import { createSyncStoragePersister } from '@tanstack/query-sync-storage-persister' // [!code hl] import { QueryClient } from '@tanstack/react-query' // [!code hl] import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client' // [!code hl] import { WagmiProvider, deserialize, serialize } from 'wagmi' // [!code hl] // 2. Create a new Query Client with a default `gcTime`. // [!code hl] const queryClient = new QueryClient({ // [!code hl] defaultOptions: { // [!code hl] queries: { // [!code hl] gcTime: 1_000 * 60 * 60 * 24, // 24 hours // [!code hl] }, // [!code hl] }, // [!code hl] }) // [!code hl] // 3. Set up the persister. // [!code hl] const persister = createSyncStoragePersister({ // [!code hl] serialize, // [!code hl] storage: window.localStorage, // [!code hl] deserialize, // [!code hl] }) // [!code hl] function App() { return ( {/* 4. Wrap app in PersistQueryClientProvider */} // [!code hl] // [!code hl] {/* ... */} // [!code hl] ) } ``` Read more about [Sync Storage Persistence](https://tanstack.com/query/v5/docs/react/plugins/createSyncStoragePersister). ### Async Storage Below is an example of how to set up Wagmi + TanStack Query with async external storage like [`IndexedDB`](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) or [`AsyncStorage`](https://reactnative.dev/docs/asyncstorage). #### Install ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":5218,"to":5302} pnpm i @tanstack/query-async-storage-persister @tanstack/react-query-persist-client ``` ```bash [npm] // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":5321,"to":5404} npm i @tanstack/query-async-storage-persister @tanstack/react-query-persist-client ``` ```bash [yarn] // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":5424,"to":5510} yarn add @tanstack/query-async-storage-persister @tanstack/react-query-persist-client ``` ```bash [bun] // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":5529,"to":5612} bun i @tanstack/query-async-storage-persister @tanstack/react-query-persist-client ``` ::: #### Usage ```tsx // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":5640,"to":7019} // 1. Import modules. // [!code hl] import AsyncStorage from '@react-native-async-storage/async-storage' // [!code hl] import { createAsyncStoragePersister } from '@tanstack/query-async-storage-persister' // [!code hl] import { QueryClient } from '@tanstack/react-query' // [!code hl] import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client' // [!code hl] import { WagmiProvider, deserialize, serialize } from 'wagmi' // [!code hl] // 2. Create a new Query Client with a default `gcTime`. // [!code hl] const queryClient = new QueryClient({ // [!code hl] defaultOptions: { // [!code hl] queries: { // [!code hl] gcTime: 1_000 * 60 * 60 * 24, // 24 hours // [!code hl] }, // [!code hl] }, // [!code hl] }) // [!code hl] // 3. Set up the persister. // [!code hl] const persister = createAsyncStoragePersister({ // [!code hl] serialize, // [!code hl] storage: AsyncStorage, // [!code hl] deserialize, // [!code hl] }) // [!code hl] function App() { return ( {/* 4. Wrap app in PersistQueryClientProvider */} // [!code hl] // [!code hl] {/* ... */} // [!code hl] ) } ``` Read more about [Async Storage Persistence](https://tanstack.com/query/v5/docs/react/plugins/createAsyncStoragePersister). ## Query Keys Query Keys are typically used to perform advanced operations on the query such as: invalidation, refetching, prefetching, etc. Wagmi exports Query Keys for every Hook, and they can be retrieved via the [Hook (React)](#hook-react) or via an [Import (Vanilla JS)](#import-vanilla-js). Read more about **Query Keys** on the [TanStack Query docs.](https://tanstack.com/query/v5/docs/react/guides/query-keys) ### Hook (React) Each Hook returns a `queryKey` value. You would use this approach when you want to utilize the query key in a React component as it handles reactivity for you, unlike the [Import](#import-vanilla-js) method below. ```ts // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":7811,"to":7926} import { useBlock } from 'wagmi' // [!code hl] function App() { const { queryKey } = useBlock() // [!code hl] } ``` ### Import (Vanilla JS) Each Hook has a corresponding `getQueryOptions` function that returns a query key. You would use this method when you want to utilize the query key outside of a React component in a Vanilla JS context, like in a utility function. ```ts // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":8198,"to":8456} import { getBlockQueryOptions } from 'wagmi/query' // [!code hl] import { config } from './config' function perform() { const { queryKey } = getBlockQueryOptions(config, { // [!code hl] chainId: config.state.chainId // [!code hl] }) // [!code hl] } ``` ::: warning The caveat of this method is that it does not handle reactivity for you (e.g. active account/chain changes, argument changes, etc). You would need to handle this yourself by explicitly passing through the arguments to `getQueryOptions`. ::: ## Invalidating Queries Invalidating a query is the process of marking the query data as stale (e.g. inactive/unused), and refetching the queries that are already rendered. Read more about **Invalidating Queries** on the [TanStack Query docs.](https://tanstack.com/query/v5/docs/react/guides/query-invalidation) #### Example: Watching a Users' Balance You may want to "watch" a users' balance, and invalidate the balance after each incoming block. We can invoke `invalidateQueries` inside a `useEffect` with the block number as it's only dependency – this will refetch all rendered balance queries when the `blockNumber` changes. ```tsx // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":9362,"to":9871} import { useQueryClient } from '@tanstack/react-query' import { useEffect } from 'react' import { useBlockNumber, useBalance } from 'wagmi' function App() { const queryClient = useQueryClient() const { data: blockNumber } = useBlockNumber({ watch: true }) // [!code hl] const { data: balance, queryKey } = useBalance() // [!code hl] useEffect(() => { // [!code hl] queryClient.invalidateQueries({ queryKey }) // [!code hl] }, [blockNumber]) // [!code hl] return
{balance}
} ``` #### Example: After User Interaction Maybe you want to invalidate a users' balance after some interaction. This would mark the balance as stale, and consequently refetch all rendered balance queries. ```tsx // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":10085,"to":10720} import { useBalance } from 'wagmi' function App() { // 1. Extract `queryKey` from the useBalance Hook. // [!code hl] const { queryKey } = useBalance() // [!code hl] return ( ) } function Example() { // 3. Other `useBalance` Hooks in your rendered React tree will be refetched! // [!code hl] const { data: balance } = useBalance() // [!code hl] return
{balance}
} ``` ## Fetching Queries Fetching a query is the process of invoking the query function to retrieve data. If the query exists and the data is not invalidated or older than a given `staleTime`, then the data from the cache will be returned. Otherwise, the query will fetch for the latest data. ::: code-group ```tsx [example.tsx] // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":11051,"to":11396} import { getBlockQueryOptions } from 'wagmi' import { queryClient } from './app' import { config } from './config' export async function fetchBlockData() { return queryClient.fetchQuery( // [!code hl] getBlockQueryOptions(config, { // [!code hl] chainId: config.state.chainId, // [!code hl] } // [!code hl] )) // [!code hl] } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Retrieving & Updating Query Data You can retrieve and update query data imperatively with `getQueryData` and `setQueryData`. This is useful for scenarios where you want to retrieve or update a query outside of a React component. Note that these functions do not invalidate or refetch queries. ::: code-group ```tsx [example.tsx] // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":11820,"to":12536} import { getBlockQueryOptions } from 'wagmi' import type { Block } from 'viem' import { queryClient } from './app' import { config } from './config' export function getPendingBlockData() { return queryClient.getQueryData( // [!code hl] getBlockQueryOptions(config, { // [!code hl] chainId: config.state.chainId, // [!code hl] tag: 'pending' // [!code hl] } // [!code hl] )) // [!code hl] } export function setPendingBlockData(data: Block) { return queryClient.setQueryData( // [!code hl] getBlockQueryOptions(config, { // [!code hl] chainId: config.state.chainId, // [!code hl] tag: 'pending' // [!code hl] }, // [!code hl] data // [!code hl] )) // [!code hl] } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Prefetching Queries Prefetching a query is the process of fetching the data ahead of time and seeding the cache with the returned data. This is useful for scenarios where you want to fetch data before the user navigates to a page, or fetching data on the server to be reused on client hydration. Read more about **Prefetching Queries** on the [TanStack Query docs.](https://tanstack.com/query/v5/docs/react/guides/prefetching) #### Example: Prefetching in Event Handler ```tsx // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":13109,"to":13782} import { Link } from 'next/link' import { getBlockQueryOptions } from 'wagmi' function App() { const config = useConfig() const chainId = useChainId() // 1. Set up a function to prefetch the block data. // [!code hl] const prefetch = () => // [!code hl] queryClient.prefetchQuery(getBlockQueryOptions(config, { chainId })) // [!code hl] return ( Block details ) } ``` ## SSR It is possible to utilize TanStack Query's SSR strategies with Wagmi Hooks & Query Keys. Check out the [Server Rendering & Hydration](https://tanstack.com/query/v5/docs/react/guides/ssr) & [Advanced Server Rendering](https://tanstack.com/query/v5/docs/react/guides/advanced-ssr) guides. ## Devtools TanStack Query includes dedicated [Devtools](https://tanstack.com/query/latest/docs/framework/react/devtools) that assist in visualizing and debugging your queries, their cache states, and much more. You will have to pass a custom `queryKeyFn` to your `QueryClient` for Devtools to correctly serialize BigInt values for display. Alternatively, You can use the `hashFn` from `@wagmi/core/query`, which already handles this serialization. #### Install ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":14578,"to":14616} pnpm i @tanstack/react-query-devtools ``` ```bash [npm] // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":14635,"to":14672} npm i @tanstack/react-query-devtools ``` ```bash [yarn] // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":14692,"to":14732} yarn add @tanstack/react-query-devtools ``` ```bash [bun] // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":14751,"to":14788} bun i @tanstack/react-query-devtools ``` ::: #### Usage ```tsx // {"path":"/vercel/path0/site/react/guides/tanstack-query.md","from":14816,"to":15226} import { QueryClient, QueryClientProvider, } from "@tanstack/react-query"; import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; // [!code hl] import { hashFn } from "@wagmi/core/query"; // [!code hl] const queryClient = new QueryClient({ defaultOptions: { // [!code hl] queries: { // [!code hl] queryKeyHashFn: hashFn, // [!code hl] }, // [!code hl] }, // [!code hl] }); ``` --- --- url: /solid/guides/tanstack-query.md --- # TanStack Query [TanStack Query](https://tanstack.com/query/latest) is a powerful asynchronous state management library for Solid. It provides features like caching, deduplication, background refetching, and more. ## Overview `@wagmi/solid` uses TanStack Query under the hood to handle data fetching, caching, and state management. This means you get all the benefits of TanStack Query while using Wagmi primitives. ## Setup To use `@wagmi/solid`, you need to wrap your app with both `WagmiProvider` and `QueryClientProvider`: ```tsx // {"path":"/vercel/path0/site/solid/guides/tanstack-query.md","from":541,"to":927} import { QueryClient, QueryClientProvider } from '@tanstack/solid-query' import { WagmiProvider } from '@wagmi/solid' import { config } from './config' const queryClient = new QueryClient() function App() { return ( {/* Your app */} ) } ``` ## Query States When using Wagmi query primitives like `useBalance` or `useBlockNumber`, you have access to TanStack Query's state properties: ```tsx // {"path":"/vercel/path0/site/solid/guides/tanstack-query.md","from":1084,"to":1437} import { useBalance } from '@wagmi/solid' function Balance() { const balance = useBalance(() => ({ address: '0x...', })) return (
{balance.isPending &&

Loading...

} {balance.isError &&

Error: {balance.error?.message}

} {balance.isSuccess &&

Balance: {balance.data?.formatted}

}
) } ``` ## Query Options Wagmi primitives accept TanStack Query options through the `query` parameter: ```tsx // {"path":"/vercel/path0/site/solid/guides/tanstack-query.md","from":1546,"to":1846} import { useBalance } from '@wagmi/solid' function Balance() { const balance = useBalance(() => ({ address: '0x...', query: { enabled: true, refetchInterval: 5000, // Refetch every 5 seconds staleTime: 1000, // Consider data stale after 1 second }, })) // ... } ``` ## Further Reading For more information about TanStack Query, check out: * [TanStack Query Solid Documentation](https://tanstack.com/query/latest/docs/framework/solid/overview) * [Query Basics](https://tanstack.com/query/latest/docs/framework/solid/guides/queries) * [Mutations](https://tanstack.com/query/latest/docs/framework/solid/guides/mutations) --- --- url: /vue/guides/tanstack-query.md --- # TanStack Query Wagmi Composables are not only a wrapper around the core [Wagmi Actions](/core/api/actions), but they also utilize [TanStack Query](https://tanstack.com/query/v5) to enable trivial and intuitive fetching, caching, synchronizing, and updating of asynchronous data in your Vue applications. Without an asynchronous data fetching abstraction, you would need to handle all the negative side-effects that comes as a result, such as: representing finite states (loading, error, success), handling race conditions, caching against a deterministic identifier, etc. ## Queries & Mutations Wagmi Composables represent either a **Query** or a **Mutation**. **Queries** are used for fetching data (e.g. fetching a block number, reading from a contract, etc), and are typically invoked on mount by default. All queries are coupled to a unique [Query Key](#query-keys), and can be used for further operations such as refetching, prefetching, or modifying the cached data. **Mutations** are used for mutating data (e.g. connecting/disconnecting accounts, writing to a contract, switching chains, etc), and are typically invoked in response to a user interaction. Unlike **Queries**, they are not coupled with a query key. ## Terms * **Query**: An asynchronous data fetching (e.g. read data) operation that is tied against a unique Query Key. * **Mutation**: An asynchronous mutating (e.g. create/update/delete data or side-effect) operation. * **Query Key**: A unique identifier that is used to deterministically identify a query. It is typically a tuple of the query name and the query arguments. * **Stale Data**: Data that is unused or inactive after a certain period of time. * **Query Fetching**: The process of invoking an async query function. * **Query Refetching**: The process of refetching **rendered** queries. * **[Query Invalidation](https://tanstack.com/query/v5/docs/vue/guides/query-invalidation)**: The process of marking query data as stale (e.g. inactive/unused), and refetching **rendered** queries. * **[Query Prefetching](https://tanstack.com/query/v5/docs/vue/guides/prefetching)**: The process of prefetching queries and seeding the cache. ## Query Keys Query Keys are typically used to perform advanced operations on the query such as: invalidation, refetching, prefetching, etc. Wagmi exports Query Keys for every Composable, and they can be retrieved via the [Composable (Vue)](#composable-vue) or via an [Import (Vanilla JS)](#import-vanilla-js). Read more about **Query Keys** on the [TanStack Query docs.](https://tanstack.com/query/v5/docs/vue/guides/query-keys) ### Composable (Vue) Each Composable returns a `queryKey` value. You would use this approach when you want to utilize the query key in a Vue component as it handles reactivity for you, unlike the [Import](#import-vanilla-js) method below. ```vue [index.vue] // {"path":"/vercel/path0/site/vue/guides/tanstack-query.md","from":2923,"to":3117} ``` ### Import (Vanilla JS) Each Hook has a corresponding `getQueryOptions` function that returns a query key. You would use this method when you want to utilize the query key outside of a Vue component in a Vanilla JS context, like in a utility function. ```ts // {"path":"/vercel/path0/site/vue/guides/tanstack-query.md","from":3387,"to":3654} import { getBalanceQueryOptions } from '@wagmi/vue/query' // [!code hl] import { config } from './config' function perform() { const { queryKey } = getBalanceQueryOptions(config, { // [!code hl] chainId: config.state.chainId // [!code hl] }) // [!code hl] } ``` ::: warning The caveat of this method is that it does not handle reactivity for you (e.g. active account/chain changes, argument changes, etc). You would need to handle this yourself by explicitly passing through the arguments to `getQueryOptions`. ::: ## Invalidating Queries Invalidating a query is the process of marking the query data as stale (e.g. inactive/unused), and refetching the queries that are already rendered. Read more about **Invalidating Queries** on the [TanStack Query docs.](https://tanstack.com/query/v5/docs/vue/guides/query-invalidation) #### Example: Watching a Users' Balance You may want to "watch" a users' balance, and invalidate the balance after each incoming block. We can invoke `invalidateQueries` inside a `watchEffect` – this will refetch all rendered balance queries when the `blockNumber` changes. ```vue // {"path":"/vercel/path0/site/vue/guides/tanstack-query.md","from":4514,"to":5091} ``` #### Example: After User Interaction Maybe you want to invalidate a users' balance after some interaction. This would mark the balance as stale, and consequently refetch all rendered balance queries. ```vue // {"path":"/vercel/path0/site/vue/guides/tanstack-query.md","from":5305,"to":5722} ``` ```vue // {"path":"/vercel/path0/site/vue/guides/tanstack-query.md","from":5734,"to":5963} ``` ## Fetching Queries Fetching a query is the process of invoking the query function to retrieve data. If the query exists and the data is not invalidated or older than a given `staleTime`, then the data from the cache will be returned. Otherwise, the query will fetch for the latest data. ::: code-group ```tsx [example.tsx] // {"path":"/vercel/path0/site/vue/guides/tanstack-query.md","from":6294,"to":6651} import { getBlockQueryOptions } from '@wagmi/vue/query' import { queryClient } from './main' import { config } from './config' export async function fetchBlockData() { return queryClient.fetchQuery( // [!code hl] getBlockQueryOptions(config, { // [!code hl] chainId: config.state.chainId, // [!code hl] } // [!code hl] )) // [!code hl] } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Retrieving & Updating Query Data You can retrieve and update query data imperatively with `getQueryData` and `setQueryData`. This is useful for scenarios where you want to retrieve or update a query outside of a Vue component. Note that these functions do not invalidate or refetch queries. ::: code-group ```tsx [example.tsx] // {"path":"/vercel/path0/site/vue/guides/tanstack-query.md","from":7069,"to":7813} import type { GetBalanceReturnType } from '@wagmi/vue/actions' import { getBalanceQueryOptions } from '@wagmi/vue/query' import { queryClient } from './app' import { config } from './config' export function getBalanceData() { return queryClient.getQueryData( // [!code hl] getBalanceQueryOptions(config, { // [!code hl] chainId: config.state.chainId, // [!code hl] } // [!code hl] )) // [!code hl] } export function setBalanceData(parameters: Partial) { return queryClient.setQueryData( // [!code hl] getBalanceQueryOptions(config, { // [!code hl] chainId: config.state.chainId, // [!code hl] }, // [!code hl] data => ({ ...data, ...parameters }) // [!code hl] )) // [!code hl] } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Prefetching Queries Prefetching a query is the process of fetching the data ahead of time and seeding the cache with the returned data. This is useful for scenarios where you want to fetch data before the user navigates to a page, or fetching data on the server to be reused on client hydration. Read more about **Prefetching Queries** on the [TanStack Query docs.](https://tanstack.com/query/v5/docs/vue/guides/prefetching) #### Example: Prefetching in Event Handler ```vue // {"path":"/vercel/path0/site/vue/guides/tanstack-query.md","from":8380,"to":8853} ``` ## SSR It is possible to utilize TanStack Query's SSR strategies with Wagmi Composables & Query Keys. Check out the [SSR guide](https://tanstack.com/query/latest/docs/framework/vue/guides/ssr). ## Devtools TanStack Query includes dedicated [Devtools](https://tanstack.com/query/latest/docs/framework/vue/devtools) that assist in visualizing and debugging your queries, their cache states, and much more. You will have to pass a custom `queryKeyFn` to your `QueryClient` for Devtools to correctly serialize BigInt values for display. Alternatively, You can use the `hashFn` from `@wagmi/core/query`, which already handles this serialization. #### Install ::: code-group ```bash [pnpm] // {"path":"/vercel/path0/site/vue/guides/tanstack-query.md","from":9547,"to":9583} pnpm i @tanstack/vue-query-devtools ``` ```bash [npm] // {"path":"/vercel/path0/site/vue/guides/tanstack-query.md","from":9602,"to":9637} npm i @tanstack/vue-query-devtools ``` ```bash [yarn] // {"path":"/vercel/path0/site/vue/guides/tanstack-query.md","from":9657,"to":9695} yarn add @tanstack/vue-query-devtools ``` ```bash [bun] // {"path":"/vercel/path0/site/vue/guides/tanstack-query.md","from":9714,"to":9749} bun i @tanstack/vue-query-devtools ``` ::: #### Usage ::: code-group ```vue [App.vue] // {"path":"/vercel/path0/site/vue/guides/tanstack-query.md","from":9802,"to":9938} ``` ```vue [main.vue] // {"path":"/vercel/path0/site/vue/guides/tanstack-query.md","from":9961,"to":10535} ``` ::: --- --- url: /core/api/connectors/tempoWallet.md --- # tempoWallet Connector for the Tempo Wallet dialog. ## Import ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install accounts@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add accounts@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { tempo } from '{{packageName}}/chains' import { tempoWallet } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [tempo], connectors: [tempoWallet()], // [!code hl] multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` `tempoWallet` is a thin Wagmi wrapper around the `accounts` dialog adapter. ## Parameters ```ts-vue import { type TempoWalletParameters } from '{{connectorsPackageName}}' ``` `tempoWallet` accepts the Tempo Accounts dialog parameters together with provider options like [`authorizeAccessKey`](#authorizeaccesskey). ### host (optional) `string` Override the Tempo Wallet dialog host. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ host: 'https://wallet.tempo.xyz', // [!code focus] }) ``` ### dialog (optional) `Window | HTMLElement | ShadowRoot | string` Override where the dialog mounts. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ dialog: '#tempo-wallet-root', // [!code focus] }) ``` ### icon (optional) `` `data:image/${string}` `` Optional connector icon override. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ icon: 'data:image/svg+xml,', // [!code focus] }) ``` ### name (optional) `string` Optional connector display name. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ name: 'My Tempo Wallet', // [!code focus] }) ``` ### rdns (optional) `string` Optional reverse-DNS identifier. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ rdns: 'com.example.tempo-wallet', // [!code focus] }) ``` ### authorizeAccessKey (optional) `() => { expiry: number, ... }` Default access-key authorization parameters to attach to `wallet_connect`. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ authorizeAccessKey() { return { expiry: 60 * 60, } }, // [!code focus] }) ``` See the [Accounts SDK docs](https://docs.tempo.xyz/accounts) for more info on Tempo Wallet flows and access-key authorization. --- --- url: /react/api/connectors/tempoWallet.md --- # tempoWallet Connector for the Tempo Wallet dialog. ## Import ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install accounts@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add accounts@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { tempo } from '{{packageName}}/chains' import { tempoWallet } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [tempo], connectors: [tempoWallet()], // [!code hl] multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` `tempoWallet` is a thin Wagmi wrapper around the `accounts` dialog adapter. ## Parameters ```ts-vue import { type TempoWalletParameters } from '{{connectorsPackageName}}' ``` `tempoWallet` accepts the Tempo Accounts dialog parameters together with provider options like [`authorizeAccessKey`](#authorizeaccesskey). ### host (optional) `string` Override the Tempo Wallet dialog host. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ host: 'https://wallet.tempo.xyz', // [!code focus] }) ``` ### dialog (optional) `Window | HTMLElement | ShadowRoot | string` Override where the dialog mounts. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ dialog: '#tempo-wallet-root', // [!code focus] }) ``` ### icon (optional) `` `data:image/${string}` `` Optional connector icon override. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ icon: 'data:image/svg+xml,', // [!code focus] }) ``` ### name (optional) `string` Optional connector display name. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ name: 'My Tempo Wallet', // [!code focus] }) ``` ### rdns (optional) `string` Optional reverse-DNS identifier. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ rdns: 'com.example.tempo-wallet', // [!code focus] }) ``` ### authorizeAccessKey (optional) `() => { expiry: number, ... }` Default access-key authorization parameters to attach to `wallet_connect`. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ authorizeAccessKey() { return { expiry: 60 * 60, } }, // [!code focus] }) ``` See the [Accounts SDK docs](https://docs.tempo.xyz/accounts) for more info on Tempo Wallet flows and access-key authorization. --- --- url: /shared/connectors/tempoWallet.md --- # tempoWallet Connector for the Tempo Wallet dialog. ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/tempoWallet.md","from":231,"to":287} import { tempoWallet } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/shared/connectors/tempoWallet.md","from":488,"to":537} pnpm add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/shared/connectors/tempoWallet.md","from":560,"to":612} npm install accounts@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/shared/connectors/tempoWallet.md","from":636,"to":685} yarn add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/shared/connectors/tempoWallet.md","from":708,"to":756} bun add accounts@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/tempoWallet.md","from":785,"to":1146} import { createConfig, http } from '{{packageName}}' import { tempo } from '{{packageName}}/chains' import { tempoWallet } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [tempo], connectors: [tempoWallet()], // [!code hl] multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` `tempoWallet` is a thin Wagmi wrapper around the `accounts` dialog adapter. ## Parameters ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/tempoWallet.md","from":1253,"to":1324} import { type TempoWalletParameters } from '{{connectorsPackageName}}' ``` `tempoWallet` accepts the Tempo Accounts dialog parameters together with provider options like [`authorizeAccessKey`](#authorizeaccesskey). ### host (optional) `string` Override the Tempo Wallet dialog host. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/tempoWallet.md","from":1551,"to":1696} import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ host: 'https://wallet.tempo.xyz', // [!code focus] }) ``` ### dialog (optional) `Window | HTMLElement | ShadowRoot | string` Override where the dialog mounts. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/tempoWallet.md","from":1815,"to":1956} import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ dialog: '#tempo-wallet-root', // [!code focus] }) ``` ### icon (optional) `` `data:image/${string}` `` Optional connector icon override. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/tempoWallet.md","from":2057,"to":2243} import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ icon: 'data:image/svg+xml,', // [!code focus] }) ``` ### name (optional) `string` Optional connector display name. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/tempoWallet.md","from":2323,"to":2459} import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ name: 'My Tempo Wallet', // [!code focus] }) ``` ### rdns (optional) `string` Optional reverse-DNS identifier. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/tempoWallet.md","from":2539,"to":2684} import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ rdns: 'com.example.tempo-wallet', // [!code focus] }) ``` ### authorizeAccessKey (optional) `() => { expiry: number, ... }` Default access-key authorization parameters to attach to `wallet_connect`. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/tempoWallet.md","from":2843,"to":3024} import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ authorizeAccessKey() { return { expiry: 60 * 60, } }, // [!code focus] }) ``` See the [Accounts SDK docs](https://docs.tempo.xyz/accounts) for more info on Tempo Wallet flows and access-key authorization. --- --- url: /solid/api/connectors/tempoWallet.md --- # tempoWallet Connector for the Tempo Wallet dialog. ## Import ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install accounts@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add accounts@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { tempo } from '{{packageName}}/chains' import { tempoWallet } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [tempo], connectors: [tempoWallet()], // [!code hl] multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` `tempoWallet` is a thin Wagmi wrapper around the `accounts` dialog adapter. ## Parameters ```ts-vue import { type TempoWalletParameters } from '{{connectorsPackageName}}' ``` `tempoWallet` accepts the Tempo Accounts dialog parameters together with provider options like [`authorizeAccessKey`](#authorizeaccesskey). ### host (optional) `string` Override the Tempo Wallet dialog host. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ host: 'https://wallet.tempo.xyz', // [!code focus] }) ``` ### dialog (optional) `Window | HTMLElement | ShadowRoot | string` Override where the dialog mounts. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ dialog: '#tempo-wallet-root', // [!code focus] }) ``` ### icon (optional) `` `data:image/${string}` `` Optional connector icon override. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ icon: 'data:image/svg+xml,', // [!code focus] }) ``` ### name (optional) `string` Optional connector display name. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ name: 'My Tempo Wallet', // [!code focus] }) ``` ### rdns (optional) `string` Optional reverse-DNS identifier. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ rdns: 'com.example.tempo-wallet', // [!code focus] }) ``` ### authorizeAccessKey (optional) `() => { expiry: number, ... }` Default access-key authorization parameters to attach to `wallet_connect`. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ authorizeAccessKey() { return { expiry: 60 * 60, } }, // [!code focus] }) ``` See the [Accounts SDK docs](https://docs.tempo.xyz/accounts) for more info on Tempo Wallet flows and access-key authorization. --- --- url: /tempo/connectors/tempoWallet.md --- # tempoWallet Connector for the Tempo Wallet dialog. ## Import ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install accounts@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add accounts@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { tempo } from '{{packageName}}/chains' import { tempoWallet } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [tempo], connectors: [tempoWallet()], // [!code hl] multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` `tempoWallet` is a thin Wagmi wrapper around the `accounts` dialog adapter. ## Parameters ```ts-vue import { type TempoWalletParameters } from '{{connectorsPackageName}}' ``` `tempoWallet` accepts the Tempo Accounts dialog parameters together with provider options like [`authorizeAccessKey`](#authorizeaccesskey). ### host (optional) `string` Override the Tempo Wallet dialog host. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ host: 'https://wallet.tempo.xyz', // [!code focus] }) ``` ### dialog (optional) `Window | HTMLElement | ShadowRoot | string` Override where the dialog mounts. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ dialog: '#tempo-wallet-root', // [!code focus] }) ``` ### icon (optional) `` `data:image/${string}` `` Optional connector icon override. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ icon: 'data:image/svg+xml,', // [!code focus] }) ``` ### name (optional) `string` Optional connector display name. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ name: 'My Tempo Wallet', // [!code focus] }) ``` ### rdns (optional) `string` Optional reverse-DNS identifier. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ rdns: 'com.example.tempo-wallet', // [!code focus] }) ``` ### authorizeAccessKey (optional) `() => { expiry: number, ... }` Default access-key authorization parameters to attach to `wallet_connect`. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ authorizeAccessKey() { return { expiry: 60 * 60, } }, // [!code focus] }) ``` See the [Accounts SDK docs](https://docs.tempo.xyz/accounts) for more info on Tempo Wallet flows and access-key authorization. --- --- url: /vue/api/connectors/tempoWallet.md --- # tempoWallet Connector for the Tempo Wallet dialog. ## Import ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install accounts@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add accounts@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add accounts@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue import { createConfig, http } from '{{packageName}}' import { tempo } from '{{packageName}}/chains' import { tempoWallet } from '{{connectorsPackageName}}' // [!code hl] export const config = createConfig({ chains: [tempo], connectors: [tempoWallet()], // [!code hl] multiInjectedProviderDiscovery: false, transports: { [tempo.id]: http(), }, }) ``` `tempoWallet` is a thin Wagmi wrapper around the `accounts` dialog adapter. ## Parameters ```ts-vue import { type TempoWalletParameters } from '{{connectorsPackageName}}' ``` `tempoWallet` accepts the Tempo Accounts dialog parameters together with provider options like [`authorizeAccessKey`](#authorizeaccesskey). ### host (optional) `string` Override the Tempo Wallet dialog host. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ host: 'https://wallet.tempo.xyz', // [!code focus] }) ``` ### dialog (optional) `Window | HTMLElement | ShadowRoot | string` Override where the dialog mounts. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ dialog: '#tempo-wallet-root', // [!code focus] }) ``` ### icon (optional) `` `data:image/${string}` `` Optional connector icon override. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ icon: 'data:image/svg+xml,', // [!code focus] }) ``` ### name (optional) `string` Optional connector display name. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ name: 'My Tempo Wallet', // [!code focus] }) ``` ### rdns (optional) `string` Optional reverse-DNS identifier. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ rdns: 'com.example.tempo-wallet', // [!code focus] }) ``` ### authorizeAccessKey (optional) `() => { expiry: number, ... }` Default access-key authorization parameters to attach to `wallet_connect`. ```ts-vue import { tempoWallet } from '{{connectorsPackageName}}' const connector = tempoWallet({ authorizeAccessKey() { return { expiry: 60 * 60, } }, // [!code focus] }) ``` See the [Accounts SDK docs](https://docs.tempo.xyz/accounts) for more info on Tempo Wallet flows and access-key authorization. --- --- url: /core/guides/testing.md --- # Testing --- --- url: /react/guides/testing.md --- # Testing --- --- url: /core/api/transports.md --- # Transports [`createConfig`](/core/api/createConfig) can be instantiated with a set of Transports for each chain. A Transport is the intermediary layer that is responsible for executing outgoing JSON-RPC requests to the RPC Provider (e.g. Alchemy, Infura, etc). ## Import ```ts // {"path":"/vercel/path0/site/core/api/transports.md","from":555,"to":590} import { http } from '@wagmi/core' ``` ## Built-In Transports Available via the `'@wagmi/core'` entrypoint. --- --- url: /react/api/transports.md --- # Transports [`createConfig`](/react/api/createConfig) can be instantiated with a set of Transports for each chain. A Transport is the intermediary layer that is responsible for executing outgoing JSON-RPC requests to the RPC Provider (e.g. Alchemy, Infura, etc). ## Import ```ts // {"path":"/vercel/path0/site/react/api/transports.md","from":556,"to":585} import { http } from 'wagmi' ``` ## Built-In Transports Available via the `'wagmi'` entrypoint. --- --- url: /solid/api/transports.md --- # Transports [`createConfig`](/solid/api/createConfig) can be instantiated with a set of Transports for each chain. A Transport is the intermediary layer that is responsible for executing outgoing JSON-RPC requests to the RPC Provider (e.g. Alchemy, Infura, etc). ## Import ```ts // {"path":"/vercel/path0/site/solid/api/transports.md","from":556,"to":592} import { http } from '@wagmi/solid' ``` ## Built-In Transports Available via the `'@wagmi/solid'` entrypoint. --- --- url: /vue/api/transports.md --- # Transports [`createConfig`](/vue/api/createConfig) can be instantiated with a set of Transports for each chain. A Transport is the intermediary layer that is responsible for executing outgoing JSON-RPC requests to the RPC Provider (e.g. Alchemy, Infura, etc). ## Import ```ts // {"path":"/vercel/path0/site/vue/api/transports.md","from":554,"to":588} import { http } from '@wagmi/vue' ``` ## Built-In Transports Available via the `'@wagmi/vue'` entrypoint. --- --- url: /core/typescript.md --- # TypeScript ## Requirements Wagmi Core is designed to be as type-safe as possible! Things to keep in mind: * Types currently require using TypeScript {{typescriptVersion}}. * [TypeScript doesn't follow semver](https://www.learningtypescript.com/articles/why-typescript-doesnt-follow-strict-semantic-versioning) and often introduces breaking changes in minor releases. * Changes to types in this repository are considered non-breaking and are usually released as patch changes (otherwise every type enhancement would be a major version!). * It is highly recommended that you lock your `@wagmi/core` and `typescript` versions to specific patch releases and upgrade with the expectation that types may be fixed or upgraded between any release. * The non-type-related public API of Wagmi Core still follows semver very strictly. To ensure everything works correctly, make sure your `tsconfig.json` has [`strict`](https://www.typescriptlang.org/tsconfig#strict) mode set to `true`. ::: code-group ```json [tsconfig.json] // {"path":"/vercel/path0/site/core/typescript.md","from":1175,"to":1225} { "compilerOptions": { "strict": true } } ``` ::: ## Const-Assert ABIs & Typed Data Wagmi Core can infer types based on [ABIs](https://docs.soliditylang.org/en/latest/abi-spec.html#json) and [EIP-712](https://eips.ethereum.org/EIPS/eip-712) Typed Data definitions, powered by [Viem](https://viem.sh) and [ABIType](https://github.com/wevm/abitype). This achieves full end-to-end type-safety from your contracts to your frontend and enlightened developer experience by autocompleting ABI item names, catching misspellings, inferring argument and return types (including overloads), and more. For this to work, you must either [const-assert](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) ABIs and Typed Data (more info below) or define them inline. For example, `useReadContract`'s `abi` configuration parameter: ```ts // {"path":"/vercel/path0/site/core/typescript.md","from":2054,"to":2145} const result = await readContract({ abi: […], // <--- defined inline // [!code focus] }) ``` ```ts // {"path":"/vercel/path0/site/core/typescript.md","from":2156,"to":2259} const abi = […] as const // <--- const assertion // [!code focus] const result = readContract({ abi }) ``` If type inference isn't working, it's likely you forgot to add a `const` assertion or define the configuration parameter inline. Also, make sure your ABIs, Typed Data definitions, and [TypeScript configuration](#requirements) are valid and set up correctly. ::: tip Unfortunately [TypeScript doesn't support importing JSON `as const` yet](https://github.com/microsoft/TypeScript/issues/32063). Check out the [Wagmi CLI](/cli/getting-started) to help with this! It can automatically fetch ABIs from Etherscan and other block explorers, resolve ABIs from your Foundry/Hardhat projects, and more. ::: Anywhere you see the `abi` or `types` configuration property, you can likely use const-asserted or inline ABIs and Typed Data to get type-safety and inference. These properties are also called out in the docs. Here's what [`readContract`](/core/api/actions/readContract) looks like with and without a const-asserted `abi` property. ::: code-group ```ts twoslash [Const-Asserted] // {"path":"/vercel/path0/site/core/typescript.md","from":3245,"to":8469} // @twoslash-cache: {"v":1,"hash":"ce7669bfd8403077642e11ee62585359f9005b3491bb5cb9aa7196e861042c9f","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvUjGZQAwpLSlmYgDwjJ/dgHNedGmChxeisNp0VemsHDS9mAI3b76MIyYCCz3gB9pslCSrBi8wgDWkADuYMgAulZCouKSAHLMALYwrobGpk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CuSli+TeTnTLRHhHgFSmjTT8DyDgH8CxQeSmh+QH4UA3g1DXATaQarA3gS7CoH6oroqay4FX6QR0Ff4B51q/60CeABjyD8BYHzR2h1gAAirkjgpoAhC0dYjg5iYUAYCBzArkdYq03kYU3kDo/AGqdoMAB+CQAs3AtBt+aA9I3IzwzASAoA4wtg5QeAikIAUYUYQAA="} import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) const erc721Abi = [ { name: 'balanceOf', type: 'function', stateMutability: 'view', inputs: [{ type: 'address', name: 'owner' }], outputs: [{ type: 'uint256' }], }, { name: 'isApprovedForAll', type: 'function', stateMutability: 'view', inputs: [ { type: 'address', name: 'owner' }, { type: 'address', name: 'operator' }, ], outputs: [{ type: 'bool' }], }, { name: 'getApproved', type: 'function', stateMutability: 'view', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'address' }], }, { name: 'ownerOf', type: 'function', stateMutability: 'view', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'address' }], }, { name: 'tokenURI', type: 'function', stateMutability: 'pure', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'string' }], }, ] as const // ---cut--- import { readContract } from '@wagmi/core' const result = await readContract(config, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: erc721Abi, functionName: 'balanceOf', // ^? args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], // ^? }) result // ^? ``` ```ts twoslash [Not Const-Asserted] // {"path":"/vercel/path0/site/core/typescript.md","from":8509,"to":12310} // @twoslash-cache: {"v":1,"hash":"32e9700c30963257f6c79b087bc2f37aa4f1bb4bb135b24ec22d2f898493f29f","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvUjGZQAwpLSlmYgDwjJ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Gj1N42VxA5Vy71lK/U4HdUK8NIqwARvFfaEsXZbmdPNNQRseBDXGrtKapV/oVXdlGTMWu7kNX+i1W3IF7pQUQHWRCikmpjhAOJWmxAdpazZwrLnGsjo5XuiSO2iEJbSyqsreMn5sYm6aoAI6CDIBgHVwKm0ts2W2o4EIE3dt7f2rNQ6C55oFGO3dJxJ2IH7dXGd6r50opHNq8cjbVnNvBdu6EcAPG7zAJECAMR4gMyMBk5mUAD1DWlZ0sthd5XfuvTmu94ZZ01rwMu1d6631go2VspYv6MF5kA9LEDTMsmQalQOjpNZYNnoVUsRD06UMPqHLW1uCyG1pn1QEFsC8wj/vzN2h0hVoM1nrLmnpTZMzZmvcO8tXzxkBjQwKDDpA12vq47YDMvHoZEZiEJkTVGZXibg1JnTsmq4VuY4GQpwZoC1v9iyewwAg5p14FGAQnteAAHIAACUc0RxxkN5+k9Iu7NlbLwQmDhJTsAzHOeSRse6WDQc8yR1xvN2SKAAIU8OtR08hmABjclAFyJYfJeTOktQ8h58qmimvweQxX+AxXcqaXy3mKDXhqNcAtJrVjXgveCRl3mVasDVprfgnXQsQVm1ub91xkCZdoJ4AM8h+Btbmr2gAIi5Rwpp9vzVrI4Es0UAw1eYC5WsK0vKhS8g6fgwm7QwG8wkAW3AZsRezPSbkzxmBIFAOMWw5Q8AKRAFGKMQA=="} import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) declare const erc721Abi: { name: string; type: string; stateMutability: string; inputs: { type: string; name: string; }[]; outputs: { type: string; }[]; }[] // ---cut--- import { readContract } from '@wagmi/core' const result = await readContract(config, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: erc721Abi, functionName: 'balanceOf', // ^? args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], // ^? }) result // ^? ``` ::: You can prevent runtime errors and be more productive by making sure your ABIs and Typed Data definitions are set up appropriately. 🎉 ```ts twoslash // {"path":"/vercel/path0/site/core/typescript.md","from":12470,"to":17525} // @twoslash-cache: {"v":1,"hash":"1302572cb196fc0dde6d7e01c4f069233f8e54486c2e57cde92bd7a1bf18508b","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvUjGZQAwpLSlmYgDwjJ/dgHNedGmChxeisNp0VemsHDS9mAI3b76MIyYCCz3gB9pslCSrBi8wgDWkADuYMgAulZCouKSAHLMALYwrobGpkoqYgBiwmISYOlZak7sVgA6IFiCMg1+vA1E7DBRDQB8VjZ2DqQ6JgbueWbKqmglyeWeI3DVzvWNzTCt/h1dPZQCpSkVmTC9vYw2FojWWrpWWMwqWTSkcNcASoFThWgACo8nF7LGqJQ7lSowKyPUYDW46Xrca6/UgQDLsOAwNSfOTfGafNDNMAAFWwmJBB3maROUKWZzqYHYGSwEFI9hkOIKM0oICCIgQiAIaDQWDeAHpRVFmDo0QA6OD4UWaGSi5hYdgqsqSOCi9kKTlibl2R4MRAATiorHcOjQ+CQAEYAExUNDQmAmkC63EGi3sMC4RAABioInwALEZCQpoAvhR0KS8IQSORnQYmGxODwAhywNN1GYLGpdcFQqh6bxy7xHKwICJwgBRWhYasyV7XYBliudotgEK8WD8ZiCVhoNsdzvjrNBHuhMAna4NOs2shwETMMANADcY4nFe7vearHnguFYtFbvwy9XYBlEk3253k+LDjVAFVSIf2seRYhxar2DLz0vNcbwgFU1TvKQdyjLdIPLaDtyrGtwiJRkYGuR0A0wmDOxsXM0DeXh21g8c91Cdw4BfBkkzgNhPjgCBWCTUdiIfUiHCgKAZDgAiGgDWgYAEwSBLtAAWKAAHY7QADhEB1HBE8SoFNU0HQAZlgJw7VU1SAFYYFEkShIgh8u0CJ9ENreR2RoKBrjUgMpJ0pypOwqDXInNiMiHcRV1YVhVOYkzdzM6d2M4+AeJAPjVztO1HFgAMdNNcTxMcVSADZVNi9LxIDB0pK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y+at/0/6kx/eAx0rpZAIUUnxRCI8uOIfooG/aXbt7Ll5IO4++5Ao9PHCyIrjJKuv2x3V+nLXWd3S65LT0vpSxrjIF4rQTwAZ5D8D2QVO06VuciUcKaJPhV0qOB0tpAMKzmAiXSmVKSqkpIOn4Jqu0mwQD9aoNt+0FU9t5PfWkp9Dyliu5vYt8M37vkJBA7AK7TIWT2GACbD2MmBDaxBwAARtmiB2MhQfrjABHPCFw4QZdjdcYHfERljNNBMqZMy5kLKWQ6FZayNlbJEjszJ+yHTA4oB2Go1wptQZg/fyCTvjcg9N/E6md+H/B4bU33D0j2j1NFj3j0T2TzAPSjTwz1UizzrBzzz2kkL2L1LxgGBwSCRm4G5GeGYCQFAHGFsHKDwHuyjCjCAA"} // @errors: 2820 import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) const erc721Abi = [ { name: 'balanceOf', type: 'function', stateMutability: 'view', inputs: [{ type: 'address', name: 'owner' }], outputs: [{ type: 'uint256' }], }, { name: 'isApprovedForAll', type: 'function', stateMutability: 'view', inputs: [ { type: 'address', name: 'owner' }, { type: 'address', name: 'operator' }, ], outputs: [{ type: 'bool' }], }, { name: 'getApproved', type: 'function', stateMutability: 'view', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'address' }], }, { name: 'ownerOf', type: 'function', stateMutability: 'view', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'address' }], }, { name: 'tokenURI', type: 'function', stateMutability: 'pure', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'string' }], }, ] as const // ---cut--- import { readContract } from '@wagmi/core' readContract(config, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: erc721Abi, functionName: 'balanecOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }) ``` ## Configure Internal Types For advanced use-cases, you may want to configure wagmi's internal types. Most of wagmi's types relating to ABIs and EIP-712 Typed Data are powered by [ABIType](https://github.com/wevm/abitype). See the [ABIType docs](https://abitype.dev) for more info on how to configure types. --- --- url: /react/typescript.md --- # TypeScript ## Requirements Wagmi is designed to be as type-safe as possible! Things to keep in mind: * Types currently require using TypeScript {{typescriptVersion}}. * [TypeScript doesn't follow semver](https://www.learningtypescript.com/articles/why-typescript-doesnt-follow-strict-semantic-versioning) and often introduces breaking changes in minor releases. * Changes to types in this repository are considered non-breaking and are usually released as patch changes (otherwise every type enhancement would be a major version!). * It is highly recommended that you lock your `wagmi` and `typescript` versions to specific patch releases and upgrade with the expectation that types may be fixed or upgraded between any release. * The non-type-related public API of Wagmi still follows semver very strictly. To ensure everything works correctly, make sure your `tsconfig.json` has [`strict`](https://www.typescriptlang.org/tsconfig#strict) mode set to `true`. ::: code-group ```json [tsconfig.json] // {"path":"/vercel/path0/site/react/typescript.md","from":1159,"to":1209} { "compilerOptions": { "strict": true } } ``` ::: ## Config Types By default React Context does not work well with type inference. To support strong type-safety across the React Context boundary, there are two options available: * Declaration merging to "register" your `config` globally with TypeScript. * `config` property to pass your `config` directly to hooks. ### Declaration Merging [Declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) allows you to "register" your `config` globally with TypeScript. The `Register` type enables Wagmi to infer types in places that wouldn't normally have access to type info via React Context alone. To set this up, add the following declaration to your project. Below, we co-locate the declaration merging and the `config` set up. ```ts // {"path":"/vercel/path0/site/react/typescript.md","from":1993,"to":2394} import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' declare module 'wagmi' { // [!code focus] interface Register { // [!code focus] config: typeof config // [!code focus] } // [!code focus] } // [!code focus] export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` Since the `Register` type is global, you only need to add it once in your project. Once set up, you will get strong type-safety across your entire project. For example, query hooks will type `chainId` based on your `config`'s `chains`. ```ts twoslash // {"path":"/vercel/path0/site/react/typescript.md","from":2652,"to":5076} // @twoslash-cache: {"v":1,"hash":"296ef5d0fbed904e9f4bc9bf96c55b1f47345dcdd993965e6d5420eb1c6583d7","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAhVhBEBrAHKCAtgCMyAHhGT+7AOa86NMFDi8AwoZO8AvLfvHdpGMyiTWGXqgAdKV4QrUUVAFFaLEUPUjhEXmAgkNTUjy8fP1h+ZkFWNETk4LTS3gzvMF9eMGYNGESAkAi0fDI4EWYwJoBuFLLSiqzpUlZGgjQ0LASAehmYVvbOsAA6CV7+gfTPSurmLHYAVVHx/EnpxDn99hWFtvjltYgZ642S0oBfPvevzd4wpTKAAq7HqiQAjAAmAAMsO+aQMYDQpGYYgSST+aSGVT8MDAcEOYHYJHibAASvAIKwSUVMQNsXsoFAPHB0U1obQYFzuVzwQAWKAAdnBAA4RJCtHzBVAAJwyyEAZlgzC04IVCoArDB+XyeW8tlidsMASobBkaFBEoroSKNXaRfCBr93obMjjeBp8uJOqxWAraS76Ub3V5mfA2SAOZ1weCtLBoRqZYLBVoFQA2BUxtOC6GQkUitMSmCQ5jgwUKpNp6Pg/UGkIMvwm5RmzwWiF8zXp6Hgx1lZ1pfupFbD3j8j0QDy8YcrXu8EnsfgYAASXHwAH5EoxGCIOHjCrZd0jdNOAHwUXhYZgo+o0eKJABqZAXy9XAAUr3UFu0+I4T7xX6QEAaOwsi6FoEBUp4YAnnwAA+0iWDARhgDAUDfB857FGk07oQAumevAiPgzDsGAACSUBmPQeJWIRrjIE0REkfiTS4cgYCaDopBsU07BQKxTh0WARjGAxIBMaRcCsexnFkDxIB8ax56yKwMBiAAIswaDMIJWgmKRaAnowl7Xl+8QbrwhyyAogLqNoZDvqZt5wPorjnhJ5FQMpMCqRpWnMDBiRWfI4RqLJpAUmggikGAQLYDAugqWpaCadpJ5BKCWATmg0jWaFdlcZQIDeCICCIBMU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ainnet, sepolia } from 'wagmi/chains' declare module 'wagmi' { interface Register { config: Config } } // ---cut--- import { useBlockNumber } from 'wagmi' useBlockNumber({ chainId: 123 }) ``` You just saved yourself a runtime error and you didn't even need to pass your `config`. 🎉 ### Hook `config` Property For cases where you have more than one Wagmi `config` or don't want to use the declaration merging approach, you can pass a specific `config` directly to hooks via the `config` property. ```ts // {"path":"/vercel/path0/site/react/typescript.md","from":5395,"to":5913} import { createConfig, http } from 'wagmi' import { mainnet, optimism } from 'wagmi/chains' export const configA = createConfig({ // [!code focus] chains: [mainnet], // [!code focus] transports: { // [!code focus] [mainnet.id]: http(), // [!code focus] }, // [!code focus] }) // [!code focus] export const configB = createConfig({ // [!code focus] chains: [optimism], // [!code focus] transports: { // [!code focus] [optimism.id]: http(), // [!code focus] }, // [!code focus] }) // [!code focus] ``` As you expect, `chainId` is inferred correctly for each `config`. ```ts twoslash // {"path":"/vercel/path0/site/react/typescript.md","from":6000,"to":11819} // @twoslash-cache: {"v":1,"hash":"11543ad9699c8fdbef7c0ce7ac938f71b77d113989b5f3a8de83d428479463c3","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAhVhBEBrAHKCAtgCMyAHhGT+7AOa86NMFDi8AwoZO8AvLfvGKvEfmbswASShm9DCW1gZgRsbIADognt5gcDEAushgmjqkKTHsUMlOHq7RsV4+iSApadpkWSA5ye6yrDBiACLMaMz5WiY+aAB8jFjMpMwaMDSkcAD8iLwAqrIKSmrpZAAKw6PjZHD6ru5xPv4NME2t7cx93LML8ooq6lWkAErjgqRgACrYMLqNzWg2h0+lEwOwNFgIKQ0NJFvcVk9KCAoEoEIgCGg0Fg4IgAPS4gDuzGMGnYADo4PhcaQYMwxLjmFh2LjCBBlHBcTI7stHhkkXAOtCkABOKhNMDGND4JAARgALFRBcZxnguUsHqtyGKfLhEAAGKhxEZiMgigC+FHQPzwhBIWuo5iYbE4PFh3I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pyTxJNtNryQtl5AKStsKe+KKTADtntpKYce1d5eZAqbdkOSqbbi2Sap8n1SFQLhZQaYDsDqDmbqaeaTALDpxFaVADaSjmjg6U6WOUcVlalB6V6T6RTjtVVo7hZZ2XuczuGStbWTzrGUZQ1WycNlOYDd2TxIeUyTLntDmRoMrqroWRuRDQNZOTubDVWQjaFfWRbmRFbiOT9SxuZYVbQADXjZ+D2QpW9WtQORtQHs2YFVDXTrubTbOQzR1QuYninmntZKubHEWeldjeFTTdzWXrzSVBGlXqedGlkheemFec0smiUmUq3o+VUrwDmsWj3o0u+S0i+RtE4EPr+ZWv0oBVdMBQ2jPhMoYdzG+O2hgaYUsoha4HIChbYTAdssKC9IaAbJbMjNCEBG6DvpqOYgIOWsHITKSEHKCKCF/rvowMADofEP4PoQcEfF4SYJcuYtwMneAZqGnRnUcAGqxDnRcrMPhXIIXUiDNMwEgKAOYBBBIGAHgHbGaGaEAA="} // @errors: 2322 import { type Config } from 'wagmi' import { mainnet, optimism } from 'wagmi/chains' declare const configA: Config declare const configB: Config // ---cut--- import { useBlockNumber } from 'wagmi' useBlockNumber({ chainId: 123, config: configA }) useBlockNumber({ chainId: 123, config: configB }) ``` This approach is more explicit, but works well for advanced use-cases, if you don't want to use React Context or declaration merging, etc. ## Const-Assert ABIs & Typed Data Wagmi can infer types based on [ABIs](https://docs.soliditylang.org/en/latest/abi-spec.html#json) and [EIP-712](https://eips.ethereum.org/EIPS/eip-712) Typed Data definitions, powered by [Viem](https://viem.sh) and [ABIType](https://github.com/wevm/abitype). This achieves full end-to-end type-safety from your contracts to your frontend and enlightened developer experience by autocompleting ABI item names, catching misspellings, inferring argument and return types (including overloads), and more. For this to work, you must either [const-assert](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) ABIs and Typed Data (more info below) or define them inline. For example, `useReadContract`'s `abi` configuration parameter: ```ts // {"path":"/vercel/path0/site/react/typescript.md","from":12779,"to":12869} const { data } = useReadContract({ abi: […], // <--- defined inline // [!code focus] }) ``` ```ts // {"path":"/vercel/path0/site/react/typescript.md","from":12880,"to":12988} const abi = […] as const // <--- const assertion // [!code focus] const { data } = useReadContract({ abi }) ``` If type inference isn't working, it's likely you forgot to add a `const` assertion or define the configuration parameter inline. Also, make sure your ABIs, Typed Data definitions, and [TypeScript configuration](#requirements) are valid and set up correctly. ::: tip Unfortunately [TypeScript doesn't support importing JSON `as const` yet](https://github.com/microsoft/TypeScript/issues/32063). Check out the [Wagmi CLI](/cli/getting-started) to help with this! It can automatically fetch ABIs from Etherscan and other block explorers, resolve ABIs from your Foundry/Hardhat projects, generate React Hooks, and more. ::: Anywhere you see the `abi` or `types` configuration property, you can likely use const-asserted or inline ABIs and Typed Data to get type-safety and inference. These properties are also called out in the docs. Here's what [`useReadContract`](/react/api/hooks/useReadContract) looks like with and without a const-asserted `abi` property. ::: code-group ```ts twoslash [Const-Asserted] // {"path":"/vercel/path0/site/react/typescript.md","from":14001,"to":18502} // @twoslash-cache: {"v":1,"hash":"d7475b91e63cc31608c546a0ebb47f73a765bd7e10587f2f8d3a8df8fdf837c6","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAlGMygBhSWlLMxAHhGS4aXswBG7XnRpgocXgEETvAD69SiqJNYZpYANaQA7mDIALoUAsJiEmAAcswAtjBm9DCW1qpg6ppoAGLh4pIx8VrG7KEAOiBYgi7ljrzlROwwfuUAfKG6YPqGpADm1ubJVrxpGWI5onlgNr1wRSZlFVUwNU71jc2UYRORBTBtvB387D2JFkNpRycAvMOSl6GyrDBiACLMaMy8NwpKIxqv72YcxKWwi+TiMFCzBmLRajCw0IhNFIcAA/IheABVWQ/FRqf5oAAKiPiyNmxVCQm24PiUJm7TuxweMCeAI+LW4GOx8lcf0yCjQVTAABVsDBgZTcjsIXS+szWWg3uzSmB2LEsBBSAYZDzfvjMpQQG4RAhEAQ0GgsHBEAB6G1+Zg9WLsAB0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aQKG3KZRieU9Z7z3o+PRjU5IMse3gMtdHH85xu48hvjfQBP3xzSJ09yyu5rI/gWQcBgIKjmOBOJjPS5wLggCaPAK41wbgptuXcnkDxHg8qec8l5AQ3lIHeVcvAJOvlY3BT88GuOZtM+BQEe6kNzIfrmqsom8BJekwOLZ0WPiufHOkDzUGg4+aXP53g64uhbh3HuMLngItnk3pVz4/Bbz3kS8+STb49ORsQLBNLRnV08dLgWCCuW65CabtWCKtZoBie9pqAwwA/bhhLAYFsAgWqxF4AAcgdE6dgF2VQqic+VfrvATs3ArmnAkjA7okIxBdqeWQABCNgb5xnXcoZgVZPzPU/LnEQKE0swFggAUSR1WFCcZ8rN34MoSH/AhnNzjCIWCF2KAiWKBiFN+zDmk6MqhyhF3LncSbST+7ck2f0QUxiZAf3aA2CrMofgBOUIoXTPlF4n4jBxklyhfK+UjBwZvlWFHzBPz5WYOxm+KFYL8DyumGAF2QiNO4KziCKpDSkkgogUAAxOiRDwBZEALYWxAA="} const erc721Abi = [ { name: 'balanceOf', type: 'function', stateMutability: 'view', inputs: [{ type: 'address', name: 'owner' }], outputs: [{ type: 'uint256' }], }, { name: 'isApprovedForAll', type: 'function', stateMutability: 'view', inputs: [ { type: 'address', name: 'owner' }, { type: 'address', name: 'operator' }, ], outputs: [{ type: 'bool' }], }, { name: 'getApproved', type: 'function', stateMutability: 'view', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'address' }], }, { name: 'ownerOf', type: 'function', stateMutability: 'view', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'address' }], }, { name: 'tokenURI', type: 'function', stateMutability: 'pure', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'string' }], }, ] as const // ---cut--- import { useReadContract } from 'wagmi' const { data } = useReadContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: erc721Abi, functionName: 'balanceOf', // ^? args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], // ^? }) data // ^? ``` ```ts twoslash [Not Const-Asserted] // {"path":"/vercel/path0/site/react/typescript.md","from":18542,"to":21616} // @twoslash-cache: {"v":1,"hash":"8afd1fa05b7ad31ca46677e8331b056e5b32b376177ca9b18ff226265a7cdaaa","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAlGMygBhSWlLMxAHhGS4aXswBG7XnRpgocXgEETvAD69SiqJNYZpYANaQA7mDIALoUAsJiEmAAcswAtjBm9DCW1qpg6ppoAGLh4pIx8VrG7KEAOiBYgi7ljrzlROwwfuUAfKG6YPqGpADm1ubJVrxpGWI5onlgNr1wRSZlFVUwNU71jc2UYRORBTBtvB387D2JFkNpRycAvMOSl6GyrDBiACLMaMy8NwpKIxqv72YcxKWwi+TiMFCzBmLRajCw0IhNFIcAA/IheABVWQ/FRqf5oAAKiPiyNmxVCQm24PiUJm7TuxweMCeAI+LW4GOx8lcf0yCjQVTAABVsDBgZTcjsIXS+szWWg3uzSmB2LEsBBSAYZDzfvjMpQQG4RAhEAQ0GgsHBEAB6G1+Zg9WLsAB0cHwNpcmRtzCw7BthAg3jgNp1uL5YkN+mhDEQAE4qE8wD00PgkABGACsVA+vRgsZAYd5+sjifYYFwiAADFQRPhEWIyEg4wBfCjoMV4Qgkcg58x4DpdKCAjHCXwQAKG42mkDC/AJVhcAxwQQiETwOBCVgeZzwCCsEhQXjDj4CTW8VMJACOgjIGBdUdzsYALAmQEmU2nEM+c9Cevm8BPZhDQ4CskAAJlresCSbRAAA42w7HAu2IJs+3oJg2E4HhpBxYt0gJLRgBVXhSN4MAIQxfRSHLHoAG4SLIzAcCo9RaIYqQyOjGgAFlBA+EwOEwViaOTDiyN4ctKjQa1eGIziJNI5iYBE9jGMU8jKN4ai1IU3gW2CcSyIgfjpNk+SNKUsVVLE9T9MMlUDJCOoQCMNhmFEGAAHl+HKUIvTcMAd2Qcoq1oGwq2UfgAHY4zguD0wAN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TubZgQgh7K6bglJ5jjl9Iyec4ZeA1nXPjLcxs5TZmVnmVXc+BZBwGCAqOHwJMpwQBNHgOcC4lzaVXOuDuW4dzt33IeY8gIzykAvPOXgTz7zdIgs+NJxCzlkJyUBOFgyEVF2rMivAbLXkDk4fSj4OKOpgHxYSs0xLeCLi6CuNcG4qWeBpQebBMrPj8HPJeVlt5nkPhBTPRA4EuUQpIVC1egFASCrzqUxFSAqwthCBw2AeBraagMMAO24YSwGBbAIeusReAAHIHROnYNGlUKpMVyQNfpL4wb8Lh0YK9deG4MTRrClkAAQjYXKcZBnKGYFWZ8UAoDPljiIOCXKYDgWKlWOCcZErRX4MoGt/BCGxREOBaNFBGLFAxE4vhAix2cVGS0y60b/oeXXD5UdSawAbtImsjEyBC3hUijFOKCVkqpXSnFZGeUCrFVKuVSq1Var1UatGkIjluAbqAiqQ0pJgKIFAAMTokQ8AyRAC2FsQA"} declare const erc721Abi: { name: string; type: string; stateMutability: string; inputs: { type: string; name: string; }[]; outputs: { type: string; }[]; }[] // ---cut--- import { useReadContract } from 'wagmi' const { data } = useReadContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: erc721Abi, functionName: 'balanceOf', // ^? args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], // ^? }) data // ^? ``` ::: You can prevent runtime errors and be more productive by making sure your ABIs and Typed Data definitions are set up appropriately. 🎉 ```ts twoslash // {"path":"/vercel/path0/site/react/typescript.md","from":21789,"to":25510} // @twoslash-cache: {"v":1,"hash":"0a7ec06948f56913d5c1a0817fa61f890c5a7843c9839243ebabed5019be8a0e","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAlGMygBhSWlLMxAHhGS4aXswBG7XnRpgocXgEETvAD69SiqJNYZpYANaQA7mDIALoUAsJiEmAAcswAtjBm9DCW1qpg6ppoAGLh4pIx8VrG7KEAOiBYgi7ljrzlRO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OoJJi7FvBEm1dqMVO3pVy/RvL0z8tzESs0XDdgtpdu22l9iQgCtgDK9UmoDDABVuGEsBgWwCG0rEXg5r9bOktY+MAgdbYEkYM9HOZhSC+P8YEigZ510DXNZO54h5zUAfUdwQ0pJmBIFAAMTokQ8CKpbC2IAA="} // @errors: 2820 const erc721Abi = [ { name: 'balanceOf', type: 'function', stateMutability: 'view', inputs: [{ type: 'address', name: 'owner' }], outputs: [{ type: 'uint256' }], }, { name: 'isApprovedForAll', type: 'function', stateMutability: 'view', inputs: [ { type: 'address', name: 'owner' }, { type: 'address', name: 'operator' }, ], outputs: [{ type: 'bool' }], }, { name: 'getApproved', type: 'function', stateMutability: 'view', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'address' }], }, { name: 'ownerOf', type: 'function', stateMutability: 'view', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'address' }], }, { name: 'tokenURI', type: 'function', stateMutability: 'pure', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'string' }], }, ] as const // ---cut--- import { useReadContract } from 'wagmi' useReadContract({ abi: erc721Abi, functionName: 'balanecOf', }) ``` ## Configure Internal Types For advanced use-cases, you may want to configure Wagmi's internal types. Most of Wagmi's types relating to ABIs and EIP-712 Typed Data are powered by [ABIType](https://github.com/wevm/abitype). See the [ABIType docs](https://abitype.dev) for more info on how to configure types. --- --- url: /solid/typescript.md --- # TypeScript ## Requirements `@wagmi/solid` is designed to be as type-safe as possible! Things to keep in mind: * Types currently require using TypeScript {{typescriptVersion}}. * [TypeScript doesn't follow semver](https://www.learningtypescript.com/articles/why-typescript-doesnt-follow-strict-semantic-versioning) and often introduces breaking changes in minor releases. * Changes to types in this repository are considered non-breaking and are usually released as patch changes (otherwise every type enhancement would be a major version!). * It is highly recommended that you lock your `@wagmi/solid` and `typescript` versions to specific patch releases and upgrade with the expectation that types may be fixed or upgraded between any release. * The non-type-related public API of Wagmi still follows semver very strictly. To ensure everything works correctly, make sure your `tsconfig.json` has [`strict`](https://www.typescriptlang.org/tsconfig#strict) mode set to `true`. ::: code-group ```json [tsconfig.json] // {"path":"/vercel/path0/site/solid/typescript.md","from":1175,"to":1225} { "compilerOptions": { "strict": true } } ``` ::: ## Config Types By default Solid Context does not work well with type inference. To support strong type-safety across the Solid Context boundary, there are two options available: * Declaration merging to "register" your `config` globally with TypeScript. * `config` property to pass your `config` directly to primitives. ### Declaration Merging [Declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) allows you to "register" your `config` globally with TypeScript. The `Register` type enables Wagmi to infer types in places that wouldn't normally have access to type info via Solid Context alone. To set this up, add the following declaration to your project. Below, we co-locate the declaration merging and the `config` set up. ```ts // {"path":"/vercel/path0/site/solid/typescript.md","from":2013,"to":2435} import { http, createConfig } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' declare module '@wagmi/solid' { // [!code focus] interface Register { // [!code focus] config: typeof config // [!code focus] } // [!code focus] } // [!code focus] export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` Since the `Register` type is global, you only need to add it once in your project. Once set up, you will get strong type-safety across your entire project. For example, query primitives will type `chainId` based on your `config`'s `chains`. ```ts twoslash // {"path":"/vercel/path0/site/solid/typescript.md","from":2697,"to":5821} // @twoslash-cache: {"v":1,"hash":"27f72e6eb6261410d5ea826717da884abdb710c1600590e05d55d49a8093f14a","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAhVhBEBrAHKCAtgCMyAHhGT+7AOa86NMFDi8AwoZO8AvLfvHdpGMyiTWGXqgAdKV4QrUUVAFFaLEUPUjhEXmAgkNTUjy8fP1h+ZkFWNETk4LTS3gzvMF9eMGYNGESAkAi0fDI4EWYwJoBuFLLSiqzpUlZGgjQ0LASAehmYVvbOsAA6CV7+gfTPSurmLHYAVVHx/EnpxDn99hWFtvjltY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wNxAaJw3UkQYmRH4XrkEQG8xRTSvrEHEdQIJ7VjKARwBtDAfAZ2ivfhKl9UqO3vqapojaSBhS6J4cRgRYSzrtRnYBu6wHxKyNVq9Qxz9HomLsTg6qwzRGIN5R8AQSLEkAAFyHAWoRwWdQQgg8aWlxLcKTeCMBpRkzy2SFTd24NwJqN5mBIFAOYHWEgwB4GcR8D4QA==="} // @errors: 2345 import { type Config } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' declare module '@wagmi/solid' { interface Register { config: Config } } // ---cut--- import { useBlockNumber } from '@wagmi/solid' useBlockNumber(() => ({ chainId: 123 })) ``` ### Primitive `config` Property For cases where you have more than one Wagmi `config` or don't want to use the declaration merging approach, you can pass a specific `config` directly to primitives via the `config` property. ```ts // {"path":"/vercel/path0/site/solid/typescript.md","from":6058,"to":6590} import { http, createConfig } from '@wagmi/solid' import { mainnet, optimism } from '@wagmi/solid/chains' export const configA = createConfig({ // [!code focus] chains: [mainnet], // [!code focus] transports: { // [!code focus] [mainnet.id]: http(), // [!code focus] }, // [!code focus] }) // [!code focus] export const configB = createConfig({ // [!code focus] chains: [optimism], // [!code focus] transports: { // [!code focus] [optimism.id]: http(), // [!code focus] }, // [!code focus] }) // [!code focus] ``` As you expect, `chainId` is inferred correctly for each `config`. ```ts twoslash // {"path":"/vercel/path0/site/solid/typescript.md","from":6677,"to":14109} // @twoslash-cache: {"v":1,"hash":"6db931da3d5d995c7840071ad1e449e536b2569da9cadac7a5f1a18cd2f5e66d","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAhVhBEBrAHKCAtgCMyAHhGT+7AOa86NMFDi8AwoZO8AvLfvGKvEfmbswASShm9DCW1gZgRsbIADognt5gcDEAushgmjqkKTHsUMlOHq7RsV4+iSApadpkWSA5ye6yrDBiACLMaMz5WiY+aAB8jFjMpMwaMDSkcAD8iNKyCkpq6WQAdAAKw6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GxeSQRGzTPGyZtJZmypasSvNpaL02yztcDkBZd9oXTr2BjthvOfJbNxGLnXKeBvgEAQTzgAAE+zWQhzeRc4wQwRUuMgZo4FGBKqjhXdxIDgUK6qE4b5uBuBiu+Z2zSAyukyKuo6qvELaua5Zg7tjA5BGvuBZQdpmAkBQBzAsIJAwA8BfZXRXQgA=="} // @errors: 2345 import { type Config } from '@wagmi/solid' import { mainnet, optimism } from '@wagmi/solid/chains' declare const configA: Config declare const configB: Config // ---cut--- import { useBlockNumber } from '@wagmi/solid' useBlockNumber(() => ({ chainId: 123, config: configA })) useBlockNumber(() => ({ chainId: 123, config: configB })) ``` This approach is more explicit, but works well for advanced use-cases, if you don't want to use Solid Context or declaration merging, etc. ## Reactive Parameters In Solid, primitive parameters are passed as getter functions (accessors) to maintain reactivity. This is different from React where parameters are passed directly as objects. ```ts // {"path":"/vercel/path0/site/solid/typescript.md","from":14461,"to":14612} // React style (NOT used in @wagmi/solid) useBlockNumber({ chainId: 1 }) // Solid style (used in @wagmi/solid) useBlockNumber(() => ({ chainId: 1 })) ``` This allows Wagmi to react to changes in your parameters automatically when using Solid's reactive primitives like `createSignal`. ```ts // {"path":"/vercel/path0/site/solid/typescript.md","from":14755,"to":14999} import { createSignal } from 'solid-js' import { useBlockNumber } from '@wagmi/solid' const [chainId, setChainId] = createSignal(1) // Block number will automatically update when chainId changes useBlockNumber(() => ({ chainId: chainId() })) ``` ## Configure Internal Types For advanced use-cases, you may want to configure Wagmi's internal types. Most of Wagmi's types relating to ABIs and EIP-712 Typed Data are powered by [ABIType](https://github.com/wevm/abitype). See the [ABIType docs](https://abitype.dev) for more info on how to configure types. --- --- url: /vue/typescript.md --- # TypeScript ## Requirements Wagmi is designed to be as type-safe as possible! Things to keep in mind: * Types currently require using TypeScript {{typescriptVersion}}. * [TypeScript doesn't follow semver](https://www.learningtypescript.com/articles/why-typescript-doesnt-follow-strict-semantic-versioning) and often introduces breaking changes in minor releases. * Changes to types in this repository are considered non-breaking and are usually released as patch changes (otherwise every type enhancement would be a major version!). * It is highly recommended that you lock your `wagmi` and `typescript` versions to specific patch releases and upgrade with the expectation that types may be fixed or upgraded between any release. * The non-type-related public API of Wagmi still follows semver very strictly. To ensure everything works correctly, make sure your `tsconfig.json` has [`strict`](https://www.typescriptlang.org/tsconfig#strict) mode set to `true`. ::: code-group ```json [tsconfig.json] // {"path":"/vercel/path0/site/vue/typescript.md","from":1157,"to":1207} { "compilerOptions": { "strict": true } } ``` ::: ## Config Types By default Vue Plugins does not work well with type inference. To support strong type-safety across the Vue Plugins boundary, there are two options available: * Declaration merging to "register" your `config` globally with TypeScript. * `config` property to pass your `config` directly to composables. ### Declaration Merging [Declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) allows you to "register" your `config` globally with TypeScript. The `Register` type enables Wagmi to infer types in places that wouldn't normally have access to type info via a Vue Plugin alone. To set this up, add the following declaration to your project. Below, we co-locate the declaration merging and the `config` set up. ```ts // {"path":"/vercel/path0/site/vue/typescript.md","from":1992,"to":2403} import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from 'wagmi/chains' declare module '@wagmi/vue' { // [!code focus] interface Register { // [!code focus] config: typeof config // [!code focus] } // [!code focus] } // [!code focus] export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` Since the `Register` type is global, you only need to add it once in your project. Once set up, you will get strong type-safety across your entire project. For example, query composables will type `chainId` based on your `config`'s `chains`. ```ts twoslash // {"path":"/vercel/path0/site/vue/typescript.md","from":2667,"to":5186} // @twoslash-cache: {"v":1,"hash":"21ee40fb2fb12112e58ba8b16f5d7f9ef29efdee74e4bd47b38d17e1aa2e8800","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAhVhBEBrAHKCAtgCMyAHhGT+7AOa86NMFDi8AwoZO8AvLfvHdpGMyiTWGXqgAdKV4QrUUVAFF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OFIIY1CsLQrOiLIqiaDolhQZutUeIEkSJIDawFJwFSNIYoGZR00yLIRhyPI8vyQqiuKkrSnKirKqq6pajqeogLOMOo/84UtlpqFWgqNp2hqDp0iEAuDO7noFOwPp+kjBPu6GhvjFGpaxvGibJqmGZZjmeYFkWJZlhWgpVinvPy7sjae+aPujh2Gpdj2we8KHofTrX46TjhfzzouK4tVZW47uwe6JDYh5oMew4ESZn6uQ+T692+H43t+Th/gBQEgUl4GQV0MG8PBwg5KRqHoZhfxd2AHz4ee4IH6OMZ2jG4LnnpxgGUZM8rxZVmhbtEWOVIM5We7RJ4rGCtZAq41AHRVivFRKYDMpEj6rlT6/99rkCoGVCqpMar1UajcFqbUOpsx6kBfqg14AjSgd9QBk1pqzT5BqBaeJlr4FWnydaV5NqzRADtQqE0FonyQJCM6xELq3hOjdagd1KpkEApgkAU0ryzULCwpaK1ECCjOtAXAiBFSQlESAIwi1Px4FIrAWgKwZYlT4ngeRABaAxkIHF+wVA4wUT1zB4ASjgXgAByKECp/G8BAjUCAeUuBwBMLUMIMBeBoAgAkxKAT1JciwAAWWYBgHQFJ+C6DvvBZ+T8Yz3yPkhE+UATz+JWIdGAJBWD2NIAow6wj9FiI/JdcgiAyzSMwDge6xADrrW8ZVYygEcAzQwHwLyFErJpJgJk7JuSkIFPvsUjUz8ymIWQqhE89CVFIDUSARabCkDaOoNwralVZlQFacddp4lxHSyur03COjYDmJQTNJIaCBGAObgIQCGgAkAAF8HAWITAfxQQgj8OgVxRgwBCLEVIhRCEipm7cBKjeZgSBQDmCVhIMAeAbEfA+EAA"} // @errors: 2322 import { type Config } from '@wagmi/vue' import { mainnet, sepolia } from 'wagmi/chains' declare module '@wagmi/vue' { interface Register { config: Config } } // ---cut--- import { useBlockNumber } from '@wagmi/vue' useBlockNumber({ chainId: 123 }) ``` You just saved yourself a runtime error and you didn't even need to pass your `config`. 🎉 ### Hook `config` Property For cases where you have more than one Wagmi `config` or don't want to use the declaration merging approach, you can pass a specific `config` directly to composables via the `config` property. ```ts // {"path":"/vercel/path0/site/vue/typescript.md","from":5511,"to":6039} import { createConfig, http } from '@wagmi/vue' import { mainnet, optimism } from '@wagmi/vue/chains' export const configA = createConfig({ // [!code focus] chains: [mainnet], // [!code focus] transports: { // [!code focus] [mainnet.id]: http(), // [!code focus] }, // [!code focus] }) // [!code focus] export const configB = createConfig({ // [!code focus] chains: [optimism], // [!code focus] transports: { // [!code focus] [optimism.id]: http(), // [!code focus] }, // [!code focus] }) // [!code focus] ``` As you expect, `chainId` is inferred correctly for each `config`. ```ts twoslash // {"path":"/vercel/path0/site/vue/typescript.md","from":6126,"to":12100} // @twoslash-cache: {"v":1,"hash":"9b5b0298b470a179bc3ea33df03ba8ced7d88ec92e62fe07acf70060b35435dd","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAhVhBEBrAHKCAtgCMyAHhGT+7AOa86NMFDi8AwoZO8AvLfvGKvEfmbswASShm9DCW1gZgRsbIADognt5gcDEAushgmjqkKTHsUMlOHq7RsV4+iSApadpkWSA5ye6yrDBiACLMaMz5WiY+aAB8jFjMpMwaMDSkcAD6APyIvACqsgpKaulkAArDo+NkcPqu7nE+/g0wTa3tzH3c80vyiirqVaQASuOCpGAAKtgwuo1mmg2h0+lEwOwNFgIKQ0NJlo81i9KCAoEoEIgCGg0Fg4IgAPT4gDuzGMGnYADo4Ph8URBDB8cwsOx8QYoRA4MwtE04PiZA9Vs8Mii4B1YUgAJxUJpgYxofBIACMABYqGLjOM8PyVk91uRpT5cIgAAxUOIjMRkSUAXwo6D+eEIJH11HMTDYnB48IFupeujs4RMulIMGYaLArAwvFQ4N4cd43NWAFFaFhFCHJvNgLH47mQ2HJJHeLB+MxBKw0Fmc7ma7x8+Gi2AdvMYkn5XsRMwwDEANzV2vx+uFqOfVgtrE4vGE8b4DtdikSXv9gd10MNqNM9gLUhj3gxfDY3EExnMikzudgBcQE/sJdS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RyTO7NdPrxS0zOb1bzzMgtzSLI5KirmsnMrN5350F1/GF1F3FxgElzCWbKgFbIVwik7KTBVxTKGrVwxtsj7IHKHINzxrOzwoatgqIt9znO+sLMJ0LxXJmq/OJtFrFrtx3Mlr8uDxOkPIjx8HQpjxwrluBsryVrt12uGu5qfMppfLfNxqmq5JFoIqNoAuVCQqltGtAuzNzOL0Fq7xN1RJvMIodqAOdrVtHwnynw8VnywvPNHMvJ9p/PtoduIv8mdt3yHUopHWahougknR4pnS2R2UvzGjYo4vv14HOUuS2j4r2Ff0Ev3U/zeTEqCLkqkrAEvQUvFh4nvXkLvmfSfhllMuMDkE0riJELRQlC+iUKSNwJhDhGAAJnlj1EmQED3STgAAFyCWRqDE5wRwQ+DUDGBZ6GiDUhCBiTB5h+6SVJluAd6YC96D6cj/Aj6jhXAz7XA5BL6UQlpmAkBQBzAEIJAwA8BvZrRrQgA"} // @errors: 2322 import { type Config } from '@wagmi/vue' import { mainnet, optimism } from '@wagmi/vue/chains' declare const configA: Config declare const configB: Config // ---cut--- import { useBlockNumber } from '@wagmi/vue' useBlockNumber({ chainId: 123, config: configA }) useBlockNumber({ chainId: 123, config: configB }) ``` This approach is more explicit, but works well for advanced use-cases, if you don't want to use a Vue Plugin or declaration merging, etc. ## Const-Assert ABIs & Typed Data Wagmi can infer types based on [ABIs](https://docs.soliditylang.org/en/latest/abi-spec.html#json) and [EIP-712](https://eips.ethereum.org/EIPS/eip-712) Typed Data definitions, powered by [Viem](https://viem.sh) and [ABIType](https://github.com/wevm/abitype). This achieves full end-to-end type-safety from your contracts to your frontend and enlightened developer experience by autocompleting ABI item names, catching misspellings, inferring argument and return types (including overloads), and more. For this to work, you must either [const-assert](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) ABIs and Typed Data (more info below) or define them inline. For example, `useReadContract`'s `abi` configuration parameter: ```ts // {"path":"/vercel/path0/site/vue/typescript.md","from":13059,"to":13149} const { data } = useReadContract({ abi: […], // <--- defined inline // [!code focus] }) ``` ```ts // {"path":"/vercel/path0/site/vue/typescript.md","from":13160,"to":13268} const abi = […] as const // <--- const assertion // [!code focus] const { data } = useReadContract({ abi }) ``` If type inference isn't working, it's likely you forgot to add a `const` assertion or define the configuration parameter inline. Also, make sure your ABIs, Typed Data definitions, and [TypeScript configuration](#requirements) are valid and set up correctly. ::: tip Unfortunately [TypeScript doesn't support importing JSON `as const` yet](https://github.com/microsoft/TypeScript/issues/32063). Check out the [Wagmi CLI](/cli/getting-started) to help with this! It can automatically fetch ABIs from Etherscan and other block explorers, resolve ABIs from your Foundry/Hardhat projects, generate Vue Composables, and more. ::: Anywhere you see the `abi` or `types` configuration property, you can likely use const-asserted or inline ABIs and Typed Data to get type-safety and inference. These properties are also called out in the docs. Here's what [`useReadContract`](/vue/api/composables/useReadContract) looks like with and without a const-asserted `abi` property. ::: code-group ```ts twoslash [Const-Asserted] // {"path":"/vercel/path0/site/vue/typescript.md","from":14289,"to":18787} // @twoslash-cache: {"v":1,"hash":"c81ecea55f2b27ad2c18ae6e5fc3ad6aed33ef72a35b2bb465243c2101cb267c","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAlGMygBhSWlLMxAHhGS4aXswBG7XnRpgocXgEETvAD69SiqJNYZpYANaQA7mDIALoUAsJiEmAAcswAtjBm9DCW1qpg6ppoAGLh4pIx8VrG7KEAOiBYgi7ljrzlROwwfuUAfKHMpADm1ubJVrxpGWI5onlgNl1wRSZlFVUwNU71jc2UYaORBTBtvLpg/OydiRb9aQdHALwDkuehsqwwYgAizGjMvFcKSoMaz6/M0xK6wi+TiMHakxaLUYWA6YJopDgAH0APyIXgAVVkXxUal+aAACnD4gipsVQkINqD4hDuqE9rdePdHmgXm8Wtx0Vj5K4fpkFGgqmAACrYGCAim5TZg2lwO4wB5/dmlMDsWJYCCkAwyHnfPGZSggNwiBCIAhoNBYOCIAD0Nr8zE6sX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PxjQxhrDOG8MEaIyRsjN8KNUZo9XOjDGsxMfKKx8u7GTmcZfTx99/HFNCYwv3V54nD0Tx+XgwsQ4DAIWYOOGAk5pyha7vORcoXlyHEtpuCAJo8C7n3IeJkJ4zzBUvNeIKd4HxPjeC+Ugb49y8GPT+P8bHAHoKAs+i59cnO1v40Fzdb7e7/tE9WLzeByvSd+f5gFBXgu8CXOF2cvSFxOCXBbdIG4k6Je3Cl3gB5hzHlPOebLnhcv3l6UNorJXPxScq7Z6rqFauOdbc5wsLWf1VjayJ7CXWQj/NgHgKOmoDDAFjhGUsBhWwCD6rEXgAByAAAg6J0AZc7A5VCqALjU9v/auG3eO+JGB41keiYHq8N5bx3nvA+R8oAnzPhfK+t976P2fq/d+n9v6/2BxQGSxR0QNtBeCpnNkb3JOB5O+9jPYcaSF+xRTsHse0EQ8h1D6HMPYdwxpvTxHSPkco9R2j9HGMwGByEcx3BBdBZVIaEkzAkCgF6GAOAkQ8BORAK2VsQA"} const erc721Abi = [ { name: 'balanceOf', type: 'function', stateMutability: 'view', inputs: [{ type: 'address', name: 'owner' }], outputs: [{ type: 'uint256' }], }, { name: 'isApprovedForAll', type: 'function', stateMutability: 'view', inputs: [ { type: 'address', name: 'owner' }, { type: 'address', name: 'operator' }, ], outputs: [{ type: 'bool' }], }, { name: 'getApproved', type: 'function', stateMutability: 'view', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'address' }], }, { name: 'ownerOf', type: 'function', stateMutability: 'view', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'address' }], }, { name: 'tokenURI', type: 'function', stateMutability: 'pure', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'string' }], }, ] as const // ---cut--- import { useReadContract } from '@wagmi/vue' const { data } = useReadContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: erc721Abi, functionName: 'balanceOf', // ^? args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], // ^? }) data // ^? ``` ```ts twoslash [Not Const-Asserted] // {"path":"/vercel/path0/site/vue/typescript.md","from":18827,"to":21842} // @twoslash-cache: {"v":1,"hash":"fd8f5c57d72097f21d1a246c1505fe478b32857ce6eeba0f9c882f247122d11d","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAlGMygBhSWlLMxAHhGS4aXswBG7XnRpgocXgEETvAD69SiqJNYZpYANaQA7mDIALoUAsJiEmAAcswAtjBm9DCW1qpg6ppoAGLh4pIx8VrG7KEAOiBYgi7ljrzlROwwfuUAfKHMpADm1ubJVrxpGWI5onlgNl1wRSZlFVUwNU71jc2UYaORBTBtvLpg/OydiRb9aQdHALwDkuehsqwwYgAizGjMvFcKSoMaz6/M0xK6wi+TiMHakxaLUYWA6YJopDgAH0APyIXgAVVkXxUal+aAACnD4gipsVQkINqD4hDuqE9rdePdHmgXm8Wtx0Vj5K4fpkFGgqmAACrYGCAim5TZg2lwO4wB5/dmlMDsWJYCCkAwyHnfPGZSggNwiBCIAhoNBYOCIAD0Nr8zE6sXYADo4PgbURBDAbcwsOwbYQIN44DadTi+WJDfoOgxEABOKgPMCdND4JAARgArFQ3l0YHGQOHefqo0n2GBcIgAAxUET4OFiMhIeMAXwo6DFeEIJHIufMeD2+l4UH+6IU/C0wlgB0rUBatQnU58/jALUNxtNIGF+ASrC4BjgghEIngcCErA8zngEFYJCgI/+Ak1vDTCQAjt7SBgXdG83GswAFiTZJU3TRBgOoDpOgLPBRzeQ0OErJAACY6wbfFm0QAAOdtOxwbtiGbft6CYNhOB4aRsRLdJ8S0YAVV4JjeDAMF0X0UgK06ABuRjmMwHB2PULjeKkZiYxoABZQQ3hMDhMCEziU1E5jeArSo0GtXgGLE1SmIEmBFJEvi9JYtimWE5STN4VtghU5iIBkjStJ00z9LFIyrN0my7JVWyQjqEAjDYZhRBgAB5fhyjuSzOmCUIzkOUJhF8CAAmhWENBJMhkT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usMkGxrJ0rxQLemIK2Sg75ezeBLiObOGApynAEoulchmNytz3N4PuYcR4TxnjeZ4D5d5iW4t+f8j8PSQXjPLuCyFtSkD1MboWeFCzLFLOUUgasrYQjINgHgSmmoDDABphGUsBhWwCDtrEXgAByAAAg6J0AZub6pVCqbZ2kOXaquGrYW+JGDLRbmedE+qva+39oHYOodw6R2jrHeOicU5pwzlnHOgE84FyLihfVFA+LFHRNIzB2CE1iSSWEia+rcb7X4PGy1YBC1MRKeiZAHraA2GrMofghdsLYQzJLJ4gEjDxlbdhSWksjBZmltLasKdmCAUlswDMldsIoX4ChLMGYYD6pCH5bghbdkqkNCSZgSBQC9DAHASIeBNIgFbK2IAA==="} declare const erc721Abi: { name: string; type: string; stateMutability: string; inputs: { type: string; name: string; }[]; outputs: { type: string; }[]; }[] // ---cut--- import { useReadContract } from '@wagmi/vue' const { data } = useReadContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: erc721Abi, functionName: 'balanceOf', // ^? args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], // ^? }) data // ^? ``` ::: You can prevent runtime errors and be more productive by making sure your ABIs and Typed Data definitions are set up appropriately. 🎉 ```ts twoslash // {"path":"/vercel/path0/site/vue/typescript.md","from":22015,"to":25793} // @twoslash-cache: {"v":1,"hash":"a8bdf07964e5e57f195e43b7354ec3ed1fdcf454f5eca95c72e560cff7e4b73d","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgAlGMygBhSWlLMxAHhGS4aXswBG7XnRpgocXgEETvAD69SiqJNYZpYANaQA7mDIALoUAsJiEmAAcswAtjBm9DCW1qpg6ppoAGLh4pIx8VrG7KEAOiBYgi7ljrzlROwwfuUAfKHMpADm1ubJVrxpGWI5onlgNl1wRSZlFVUwNU71jc2UYaORBTBtvLpg/OydiRb9aQdHALwDkuehsqwwYgAizGjMvFcKSoMaz6/M0xK6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2oAAIm2dBbGAjrnxgBDlrfEjA3r5z8fSkJMwzwPpKva2JlYT38HtRQfq3BDQkmYEgUAvQwB+skHgLVrZWxAA="} // @errors: 2820 const erc721Abi = [ { name: 'balanceOf', type: 'function', stateMutability: 'view', inputs: [{ type: 'address', name: 'owner' }], outputs: [{ type: 'uint256' }], }, { name: 'isApprovedForAll', type: 'function', stateMutability: 'view', inputs: [ { type: 'address', name: 'owner' }, { type: 'address', name: 'operator' }, ], outputs: [{ type: 'bool' }], }, { name: 'getApproved', type: 'function', stateMutability: 'view', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'address' }], }, { name: 'ownerOf', type: 'function', stateMutability: 'view', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'address' }], }, { name: 'tokenURI', type: 'function', stateMutability: 'pure', inputs: [{ type: 'uint256', name: 'tokenId' }], outputs: [{ type: 'string' }], }, ] as const // ---cut--- import { useReadContract } from '@wagmi/vue' useReadContract({ abi: erc721Abi, functionName: 'balanecOf', }) ``` ## Configure Internal Types For advanced use-cases, you may want to configure Wagmi's internal types. Most of Wagmi's types relating to ABIs and EIP-712 Typed Data are powered by [ABIType](https://github.com/wevm/abitype). See the [ABIType docs](https://abitype.dev) for more info on how to configure types. --- --- url: /core/api/transports/unstable_connector.md --- # unstable\_connector The `unstable_connector` Transport connects to a JSON-RPC API via the provided Connector. For example, if the provided Connector is `injected` and the end-user uses MetaMask, then outgoing JSON-RPC requests will be sent via the MetaMask EIP-1193 Provider (`window.ethereum`). ## Import ```ts-vue import { unstable_connector } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, fallback, unstable_connector, // [!code hl] } from '{{packageName}}' import { mainnet } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet], connectors: [injected()], transports: { [mainnet.id]: fallback([ unstable_connector(injected), // [!code hl] http('https://foo-bar-baz.quiknode.pro/...') ]) }, }) ``` ::: warning It is **highly recommended** to use the `unstable_connector` Transport inside of a `fallback` Transport. This ensures that if the Connector request fails, the Transport will fall back to a different Transport in the fallback set. Some common cases for a Connector request to fail are: * Chain ID mismatches, * Connector RPC not supporting the requested method and/or only supporting a subset of methods for connected accounts, * Rate-limiting of Connector RPC. ::: ## Parameters ### connector `Connector` The Connector to use for the Transport. ```ts import { unstable_connector } from 'wagmi' import { safe } from 'wagmi/connectors' const transport = unstable_connector(safe) // [!code focus] ``` ### key (optional) `string` A key for the Transport. Defaults to `"connector"`. ```ts import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { key: 'injected', // [!code focus] }) ``` ### name (optional) `string` A name for the Transport. Defaults to `"Connector"`. ```ts import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { name: 'Injected', // [!code focus] }) ``` ### retryCount (optional) `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { retryCount: 5, // [!code focus] }) ``` ### retryDelay (optional) `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { retryDelay: 100, // [!code focus] }) ``` --- --- url: /react/api/transports/unstable_connector.md --- # unstable\_connector The `unstable_connector` Transport connects to a JSON-RPC API via the provided Connector. For example, if the provided Connector is `injected` and the end-user uses MetaMask, then outgoing JSON-RPC requests will be sent via the MetaMask EIP-1193 Provider (`window.ethereum`). ## Import ```ts-vue import { unstable_connector } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, fallback, unstable_connector, // [!code hl] } from '{{packageName}}' import { mainnet } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet], connectors: [injected()], transports: { [mainnet.id]: fallback([ unstable_connector(injected), // [!code hl] http('https://foo-bar-baz.quiknode.pro/...') ]) }, }) ``` ::: warning It is **highly recommended** to use the `unstable_connector` Transport inside of a `fallback` Transport. This ensures that if the Connector request fails, the Transport will fall back to a different Transport in the fallback set. Some common cases for a Connector request to fail are: * Chain ID mismatches, * Connector RPC not supporting the requested method and/or only supporting a subset of methods for connected accounts, * Rate-limiting of Connector RPC. ::: ## Parameters ### connector `Connector` The Connector to use for the Transport. ```ts import { unstable_connector } from 'wagmi' import { safe } from 'wagmi/connectors' const transport = unstable_connector(safe) // [!code focus] ``` ### key (optional) `string` A key for the Transport. Defaults to `"connector"`. ```ts import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { key: 'injected', // [!code focus] }) ``` ### name (optional) `string` A name for the Transport. Defaults to `"Connector"`. ```ts import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { name: 'Injected', // [!code focus] }) ``` ### retryCount (optional) `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { retryCount: 5, // [!code focus] }) ``` ### retryDelay (optional) `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { retryDelay: 100, // [!code focus] }) ``` --- --- url: /vue/api/transports/unstable_connector.md --- # unstable\_connector The `unstable_connector` Transport connects to a JSON-RPC API via the provided Connector. For example, if the provided Connector is `injected` and the end-user uses MetaMask, then outgoing JSON-RPC requests will be sent via the MetaMask EIP-1193 Provider (`window.ethereum`). ## Import ```ts-vue import { unstable_connector } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, fallback, unstable_connector, // [!code hl] } from '{{packageName}}' import { mainnet } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet], connectors: [injected()], transports: { [mainnet.id]: fallback([ unstable_connector(injected), // [!code hl] http('https://foo-bar-baz.quiknode.pro/...') ]) }, }) ``` ::: warning It is **highly recommended** to use the `unstable_connector` Transport inside of a `fallback` Transport. This ensures that if the Connector request fails, the Transport will fall back to a different Transport in the fallback set. Some common cases for a Connector request to fail are: * Chain ID mismatches, * Connector RPC not supporting the requested method and/or only supporting a subset of methods for connected accounts, * Rate-limiting of Connector RPC. ::: ## Parameters ### connector `Connector` The Connector to use for the Transport. ```ts import { unstable_connector } from 'wagmi' import { safe } from 'wagmi/connectors' const transport = unstable_connector(safe) // [!code focus] ``` ### key (optional) `string` A key for the Transport. Defaults to `"connector"`. ```ts import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { key: 'injected', // [!code focus] }) ``` ### name (optional) `string` A name for the Transport. Defaults to `"Connector"`. ```ts import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { name: 'Injected', // [!code focus] }) ``` ### retryCount (optional) `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { retryCount: 5, // [!code focus] }) ``` ### retryDelay (optional) `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { retryDelay: 100, // [!code focus] }) ``` --- --- url: /shared/transports/unstable_connector.md --- # unstable\_connector The `unstable_connector` Transport connects to a JSON-RPC API via the provided Connector. For example, if the provided Connector is `injected` and the end-user uses MetaMask, then outgoing JSON-RPC requests will be sent via the MetaMask EIP-1193 Provider (`window.ethereum`). ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/transports/unstable_connector.md","from":508,"to":561} import { unstable_connector } from '{{packageName}}' ``` ## Usage ```ts-vue // {"path":"/vercel/path0/site/shared/transports/unstable_connector.md","from":586,"to":983} import { createConfig, fallback, unstable_connector, // [!code hl] } from '{{packageName}}' import { mainnet } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet], connectors: [injected()], transports: { [mainnet.id]: fallback([ unstable_connector(injected), // [!code hl] http('https://foo-bar-baz.quiknode.pro/...') ]) }, }) ``` ::: warning It is **highly recommended** to use the `unstable_connector` Transport inside of a `fallback` Transport. This ensures that if the Connector request fails, the Transport will fall back to a different Transport in the fallback set. Some common cases for a Connector request to fail are: * Chain ID mismatches, * Connector RPC not supporting the requested method and/or only supporting a subset of methods for connected accounts, * Rate-limiting of Connector RPC. ::: ## Parameters ### connector `Connector` The Connector to use for the Transport. ```ts // {"path":"/vercel/path0/site/shared/transports/unstable_connector.md","from":1614,"to":1758} import { unstable_connector } from 'wagmi' import { safe } from 'wagmi/connectors' const transport = unstable_connector(safe) // [!code focus] ``` ### key (optional) `string` A key for the Transport. Defaults to `"connector"`. ```ts // {"path":"/vercel/path0/site/shared/transports/unstable_connector.md","from":1852,"to":2030} import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { key: 'injected', // [!code focus] }) ``` ### name (optional) `string` A name for the Transport. Defaults to `"Connector"`. ```ts // {"path":"/vercel/path0/site/shared/transports/unstable_connector.md","from":2126,"to":2305} import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { name: 'Injected', // [!code focus] }) ``` ### retryCount (optional) `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts // {"path":"/vercel/path0/site/shared/transports/unstable_connector.md","from":2426,"to":2600} import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { retryCount: 5, // [!code focus] }) ``` ### retryDelay (optional) `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts // {"path":"/vercel/path0/site/shared/transports/unstable_connector.md","from":2884,"to":3060} import { unstable_connector } from 'wagmi' import { injected } from 'wagmi/connectors' const transport = unstable_connector(injected, { retryDelay: 100, // [!code focus] }) ``` --- --- url: /shared/create-chain.md --- ## Create Chain Import the `Chain` type from Viem and create a new object that is asserted `as const` and `satisfies` the type. You can also use the `defineChain` function from Viem. ::: code-group ```ts twoslash [as const satisfies Chain] // {"path":"/vercel/path0/site/shared/create-chain.md","from":242,"to":2021} // @twoslash-cache: {"v":1,"hash":"b104f720769e0d28b42cc38edb3952d146e5b9902d8a7bead95767460071c100","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAML5m7MAB4AZhFIBbZmhqk4vOjTBRVIsWABishUrKqAPrwCummFPEwovALzDR4g/MXKzl67bD2KXgBjCzg0CDk1ehhNVQAlGCDZKAkw0nEAc0CrAGtIAHcwAD5ecytYP3snXgSk0hS0zOywPIhCkrLfOygS52AAHTBeYd4AI1YIIJyAUVosCdITAH5EXgGhkc3kHJgMVcawDIBdVZ1xACEJqdn52TIAbkHNzYrmC1Y0U9cwS8mZuYWDyeIwAvqUfBVuo8NsMkmA0KRmEE0HAVrwAAqLJTsKQYCTrZ4jba7fYIzInFy6IQQeGI5HggmE57IOAQCykIIwACSUFWYAsclGZApZzA1NpSLQ4PKNihwMJYM6kP8UGhmzBADI1vLnjE4AkMuw0hg0aLxQjJdKuiq1Uy9QBVMDsEgqNgJVmsF2m77mulSpWym06zZyd5odhBNisADM3qpNIt9IDlVVOpBHQhgfstuGADp87wAJy8OR3Xj53M53hSGDwONuWtwaSGTwmK3K+wZmUp6EgwbsORYWRS0WUEBhZikBiIACMABYqKwYhk0PgkABWKhoScZGDTkCjxd2JAABioQVEfrISHnIIo6GwuEQBGI1636jwcLCJd0/k+axBMcJynJA5wADkXZdVyQAB2Lcdz3PAFHEP8xw4fwkAAJnPS9JWvWdozvB8cDwQgXTHGh6DwAQYGCGlvz6QCqGA6cADYFxAJdDmgxBN2oBD9y/BgjwwxBsJAC9Jzw8gxMLIjqEfPAyFIWQgO3EDEBgs9OKgtdEELc9oCfGdo1Y7TbC45g5CfEBxFgWhcxRMd2CgJTSFIABaEyzI8sCYI8wsKI/Z8ABVH14AByYAQQi3goAgeBeEgKU4EUI1cX4fBaLoHBkSqGjItFCLc2BMLBCimLeCNEsjTgTJMtomRWAmfJ6qwFScCndhEqkFTIgKiKitWFzAjAKyYFGtKSCEdlFjAIIMECUgsCCe1SFYBBIJIVg3JU8gRKfcTJKvGTo3XeSaNI199uoYKQBYDguD4ArRWbDxjBUKINC0Sk3BbD7vG7bpqlFdwjC8dssygQIQjCCIvpiH7amSVIyUOZpWnaSGU2qZH6lR9J0Z8THimx7pem1GExiuf5bkWFQ0UZQliT2XgDmOL5dF+a4ATuUgqxeGw3g+TmLhpm5AX5tMyaDKm4UTFE0UxPdw1xfFgyJHZWfZkUfQTP0GQ15nWXZTkeT5AUhVIXX4wlJNMx7I3eEVB25SpzVKaZNQwH1GBDWNesxX1y1kzdr2HSdF1UtYd0IE9MhA99EPXdlr3Qw+CMo1jUWg7t/0U+zNMu2tQuqYrIsSzLCsqxrOsc70Rs3vBttQ5VYuO1TMA+ydQdh1+sA1MnacwO0riVz0vj1N3fdD0448xJwqS8pkudzqOQzYDwAchynNZ+HC0VnerPrIqIbq5AiwZBhyvuhJ/FC92qaLeC4OifZStK4FsRLZ+s7ckFAOoPU7AaTUQQCCEEQA="} // @errors: 1360 import { type Chain } from 'viem' export const mainnet = {} as const satisfies Chain ``` ```ts twoslash [defineChain] // {"path":"/vercel/path0/site/shared/create-chain.md","from":2054,"to":3714} // @twoslash-cache: {"v":1,"hash":"51816265e78622b289e1e5f943b76d80bfbe0a867d81b51ec6327613f6e28499","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvWP3ZgYAYXzM5AHn4RSAW2ZoapOLzo0wUQ0pVgAY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4XB5IUzCAjAJMQLwWB9EDqRkLwRMk5cFMUcxJGseE5OLoiAAqQuU9TtOvCmeTviT+BsxoVUQAA7tinP3Tg/TsPAAj3Vogtk+TItUSxtHk7E05OGAPNO7o7AkAodopKIGBOKQWAiIWpCsNDr4wCQrBw/d5AHZsR2QdzhzkIgnZLScOKfbAeCTa0qozeUnThvwZsU0QxtaOTDQNHQU3uE8LyAR8vAALz5x0ASMFT3DdMD8xIKAxhxhIXTXFDIAnCcQA=="} // @errors: 2345 import { defineChain } from 'viem' export const mainnet = defineChain({}) ``` ::: Now, add the missing required properties to the object until the error goes away. ::: code-group ```ts twoslash [as const satisfies Chain] // {"path":"/vercel/path0/site/shared/create-chain.md","from":3863,"to":8924} // @twoslash-cache: {"v":1,"hash":"7eb538e5797ec32b451699fd0f71747694cdee2f09698daad95d805d237f68ce","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAML5m7MAB4AZhFIBbZmhqk4vOjTBRVIsWABishUrKqAPrwCummFPEwovALzDR4g/MXKzl67bD2KXgBjCzg0CDk1ehhNVQAlGCDZKAkw0nEAc0CrAGtIAHcwAD5ecytYP3snXgSk0hS0zOywPIhCkrLfOygS52AAHTBeYd4AI1YIIJyAUVosCdITAH5EXgGhkc3kHJgMVcawDIBdVZ1xACEJqdn52TIAbkHNzYrmC1Y0U9cwS8mZuYWDyeIwAvqUfBVuo8NsMkmA0KRmEE0HAVrwAAqLJTsKQYCTrZ4jba7fYIzInFy6IQQeGI5HggmE57IOAQCykIIwACSUFWYAsclGZApZzA1NpSLQ4PKNihwMJYM6kP8UGhmzBADI1vLnjE4AkMuw0hg0aLxQjJdKuiq1Uy9QBVMDsEgqNgJVmsF2m77mulSpWym06zZyd5odhBNisADM3qpNIt9IDlVVOpBHQhgfstuGADp87wAJy8OR3Xj53M53hSGDwONuWtwaSGTwmK3K+wZmUp6EgwbsORYWRS0WUEBhZikBiIACMABYqKwYhk0Pg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C8BG4eSNER6IABSW6hQ269SNFHBHHAh3jAh0HpRmQLQXErHbFTHdRLwbFh63HtT3GdSC7AlgAvHvEbCfEbDCG/E6jGHiYe73a8CNH54F67RF6nTnRXS3T3SPTPSvTvSfTfS/T/SzFpjHGbBWGuY2Fd4Yk55rTbFD44x4wEwaREykwwDkwHSUzUy0z0yMzMwziszsw3SczMC0mFQb7CzqTb6SwnSbh0k6guGQasn97slYmbSRiSmjCwAnjrivQnSjDRiXR4aiwnQngHQaQaQMxCgHTMC1Y5InSXSGkzjymEiKn2DqRzjRiGaXQnhjGASImyzHFghcCk4fpSjQzhhwC2DwApFUBoTbhICgDqB6irJ4AHIggghAA==="} import { type Chain } from 'viem' export const mainnet = { id: 1, name: 'Ethereum', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { default: { http: ['https://eth.merkle.io'] }, }, blockExplorers: { default: { name: 'Etherscan', url: 'https://etherscan.io' }, }, contracts: { ensRegistry: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', }, ensUniversalResolver: { address: '0xE4Acdd618deED4e6d2f03b9bf62dc6118FC9A4da', blockCreated: 16773775, }, multicall3: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 14353601, }, }, } as const satisfies Chain ``` ```ts twoslash [defineChain] // {"path":"/vercel/path0/site/shared/create-chain.md","from":8957,"to":13795} // @twoslash-cache: {"v":1,"hash":"9dd120cd705dc697124cfe3fa80116ed4046ca81c57ffb5daa2cfd0b2775f253","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvWP3ZgYAYXzM5AHn4RSAW2ZoapOLzo0wUQ0pVgAYpp16ycCrxGS4aZ8rlH6MU+c9g6ra6+nAAfGGMIgGIHpbcsQAKpDB67PwYqgCCcHDsAOaBFmrCMnIwUGFO0ZYRADpg7FpYmu5l8sVglCBuzKQMiACcVKy++Wj4SACMU1Roffmpe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UayPT1wPxESj0BwQOB1BxALwjAKImhygPh1gPgJmDtwJwGB/EjHwKdxc1X1qjaVDDqSf3bzf0Cw/1vwx25V4gwKzXwhqivw6Wrzk3uzzwoPp03zI29xZl2GgHjXyVaHxCKRWksENgECmS0F4AAHIiB2AYAtBXCGgGg6ACl3AngXgOoPheAABeOw1YSwRgZ6BZCgeEZeVwuWNebw+IwkAVbeIVXeWwxIuWVwpwM+AGJItyfI8GB+aGQ2NIkkZGFtJjP4fTYAXga9ZAVwqzATEdemdDVwlmSo+EM4eEeTAWGEOo34BojFGWJI06MLMAUoizVo/jArEzITCAVw3owkfowkSnA0SWFXXrX7XnVwiRfnU3YXC3abcXG3EsfIl+Kov4WvAxUPZOPBX4A4yxfvI7BPE7ZPc7cfdPa7C8a4qsFQp7U/VZG41UEghJSCH7Z4pgv/Q0Q4lCVgoAsHTgyHCAmHOHGAxHOAhiQE4kYE/PdAnHW4rUW4jYk4bgboGkeYJAUAYwC0CQLoa4ThEAE4E4IAA="} import { defineChain } from 'viem' export const mainnet = defineChain({ id: 1, name: 'Ethereum', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { default: { http: ['https://eth.merkle.io'] }, }, blockExplorers: { default: { name: 'Etherscan', url: 'https://etherscan.io' }, }, contracts: { ensRegistry: { address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', }, ensUniversalResolver: { address: '0xE4Acdd618deED4e6d2f03b9bf62dc6118FC9A4da', blockCreated: 16773775, }, multicall3: { address: '0xca11bde05977b3631167028862be2a173976ca11', blockCreated: 14353601, }, }, }) ``` ::: The more properties you add, the better the chain will be to use with Wagmi. Most of these attributes exist within the [`ethereum-lists/chains` repository](https://github.com/ethereum-lists/chains/tree/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains). * `id`: The chain ID for the network. This can be found by typing the network name into [ChainList](https://chainlist.org). Example: "Ethereum Mainnet" has a Chain ID of `1`. * `name`: Human-readable name for the chain. Example: "Ethereum Mainnet" * `nativeCurrency`: The native currency of the chain. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L20-L24). * `rpcUrls`: At least one public, credible RPC URL. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L4-L18). * `blockExplorers`: A set of block explorers for the chain. Found from [`ethereum-lists/chains`](https://github.com/ethereum-lists/chains/blob/3fbd4eeac7ce116579634bd042b84e2b1d89886a/_data/chains/eip155-56.json#L30-L36). * `contracts`: A set of deployed contracts for the chain. If you are deploying one of the following contracts yourself, make sure it is verified. * `multicall3` is optional, but it's address is most likely `0xca11bde05977b3631167028862be2a173976ca11` – you can find the deployed block number on the block explorer. Check out [`mds1/multicall`](https://github.com/mds1/multicall#multicall3-contract-addresses) for more info. * `ensRegistry` is optional – not all Chains have a ENS Registry. See [ENS Deployments](https://docs.ens.domains/ens-deployments) for more info. * `ensUniversalResolver` is optional – not all Chains have a ENS Universal Resolver. * `sourceId`: Source Chain ID (e.g. the L1 chain). * `testnet`: Whether or not the chain is a testnet. --- --- url: /shared/errors.md --- ## BaseError Error class extended by all errors. ```ts-vue // {"path":"/vercel/path0/site/shared/errors.md","from":149,"to":193} import { BaseError } from '{{packageName}}' ``` ## Config ### ConnectorAccountNotFoundError When an account does not exist on the connector or is unable to be used. ```ts-vue // {"path":"/vercel/path0/site/shared/errors.md","from":328,"to":392} import { ConnectorAccountNotFoundError } from '{{packageName}}' ``` ### ConnectorAlreadyConnectedError When a connector is already connected. ```ts-vue // {"path":"/vercel/path0/site/shared/errors.md","from":483,"to":548} import { ConnectorAlreadyConnectedError } from '{{packageName}}' ``` ### ConnectorChainMismatchError When the Wagmi Config is out-of-sync with the connector's active chain ID. This is rare and likely an upstream wallet issue. ```ts-vue // {"path":"/vercel/path0/site/shared/errors.md","from":722,"to":784} import { ConnectorChainMismatchError } from '{{packageName}}' ``` ### ChainNotConfiguredError When a chain is not configured. You likely need to add the chain to `Config['chains']`. ```ts-vue // {"path":"/vercel/path0/site/shared/errors.md","from":971,"to":1029} import { ChainNotConfiguredError } from '{{packageName}}' ``` ### ConnectorNotConnectedError When a connector is not connected. ```ts-vue // {"path":"/vercel/path0/site/shared/errors.md","from":1112,"to":1173} import { ConnectorNotConnectedError } from '{{packageName}}' ``` ### ConnectorNotFoundError When a connector is not found or able to be used. ```ts-vue // {"path":"/vercel/path0/site/shared/errors.md","from":1267,"to":1324} import { ConnectorNotFoundError } from '{{packageName}}' ``` ### ConnectorUnavailableReconnectingError During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`. All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored. This error commonly occurs for connectors that asynchronously inject after reconnection has already started. ```ts-vue // {"path":"/vercel/path0/site/shared/errors.md","from":1728,"to":1800} import { ConnectorUnavailableReconnectingError } from '{{packageName}}' ``` ## Connector ### ProviderNotFoundError When a connector's provider is not found or able to be used. ```ts-vue // {"path":"/vercel/path0/site/shared/errors.md","from":1918,"to":1974} import { ProviderNotFoundError } from '{{packageName}}' ``` ### SwitchChainNotSupportedError When switching chains is not supported by connectors. ```ts-vue // {"path":"/vercel/path0/site/shared/errors.md","from":2078,"to":2141} import { SwitchChainNotSupportedError } from '{{packageName}}' ``` --- --- url: /shared/faq.md --- ## How do I support the project? Wagmi is an open source software project and free to use. If you enjoy using Wagmi or would like to support Wagmi development, you can: * [Become a sponsor on GitHub](https://github.com/sponsors/wevm) * Send us crypto * Mainnet: 0x4557B18E779944BFE9d78A672452331C186a9f48 * Multichain: 0xd2135CfB216b74109775236E36d4b433F1DF507B * [Become a supporter on Drips](https://www.drips.network/app/projects/github/wevm/wagmi) If you use Wagmi at work, **consider asking your company to sponsor Wagmi**. This may not be easy, but **business sponsorships typically make a much larger impact on the sustainability of OSS projects** than individual donations, so you will help us much more if you succeed. ## Type inference doesn't work * Check that you set up TypeScript correctly with `"strict": true` in your `tsconfig.json` (TypeScript docs) * Check that you const-asserted any ABIs or Typed Data you are using. * Restart your language server or IDE, and check for type errors in your code. ## My wallet doesn't work If you run into issues with a specific wallet, try another before opening up an issue. There are many different wallets and it's likely that the issue is with the wallet itself, not Wagmi. For example, if you are using Wallet X and sending a transaction doesn't work, try Wallet Y and see if it works. ## `BigInt` Serialization Using native `BigInt` with `JSON.stringify` will raise a `TypeError` as [`BigInt` values are not serializable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json). There are two techniques to mitigate this: #### Lossless serialization Lossless serialization means that `BigInt` will be converted to a format that can be deserialized later (e.g. `69420n` → `"#bigint.69420"`). The trade-off is that these values are not human-readable and are not intended to be displayed to the user. Lossless serialization can be achieved with wagmi's `serialize` and `deserialize` utilities. ```tsx // {"path":"/vercel/path0/site/shared/faq.md","from":2319,"to":2513} import { serialize, deserialize } from 'wagmi' const serialized = serialize({ value: 69420n }) // '{"value":"#bigint.69420"}' const deserialized = deserialize(serialized) // { value: 69420n } ``` #### Lossy serialization Lossy serialization means that the `BigInt` will be converted to a normal display string (e.g. `69420n` → `'69420'`). The trade-off is that you will not be able to deserialize the `BigInt` with `JSON.parse` as it can not distinguish between a normal string and a `BigInt`. This method can be achieved by modifying `JSON.stringify` to include a BigInt `replacer`: ```tsx // {"path":"/vercel/path0/site/shared/faq.md","from":2916,"to":3072} const replacer = (key, value) => typeof value === 'bigint' ? value.toString() : value JSON.stringify({ value: 69420n }, replacer) // '{"value":"69420"}' ``` ## Is Wagmi production ready? Yes. Wagmi is very stable and is used in production by thousands of organizations, like [Stripe](https://stripe.com), [Shopify](https://shopify.com), [Coinbase](https://coinbase.com), [Uniswap](https://uniswap.org), [ENS](https://ens.domains), [Optimism](https://optimism.com). ## Is Wagmi strict with semver? Yes, Wagmi is very strict with [semantic versioning](https://semver.org) and we will never introduce breaking changes to the runtime API in a minor version bump. For exported types, we try our best to not introduce breaking changes in non-major versions, however, [TypeScript doesn't follow semver](https://www.learningtypescript.com/articles/why-typescript-doesnt-follow-strict-semantic-versioning) and often introduces breaking changes in minor releases that can cause Wagmi type issues. See the TypeScript docs for more information. ## How can I contribute to Wagmi? The Wagmi team accepts all sorts of contributions. Check out the [Contributing](/dev/contributing) guide to get started. If you are interested in adding a new connector to Wagmi, check out the [Creating Connectors](/dev/creating-connectors) guide. ## Anything else you want to know? Please create a new [GitHub Discussion thread](https://github.com/wevm/wagmi). You're also free to suggest changes to this or any other page on the site using the "Suggest changes to this page" button at the bottom of the page. --- --- url: /shared/getConnection-return-type.md --- ### address `Address | undefined` * Connected address from connector. * Defaults to first address in [`addresses`](#addresses). ### addresses `readonly Address[] | undefined` Connected addresses from connector. ### chain `Chain | undefined` Connected chain from connector. If chain is not configured by config, it will be `undefined`. ### chainId `number | undefined` Connected chain id from connector. ### connector `Connector | undefined` Connected connector. ### isConnecting / isReconnecting / isConnected / isDisconnected `boolean` Boolean variables derived from [`status`](#status). ### status `'connecting' | 'reconnecting' | 'connected' | 'disconnected'` * `'connecting'` attempting to establish connection. * `'reconnecting'` attempting to re-establish connection to one or more connectors. * `'connected'` at least one connector is connected. * `'disconnected'` no connection to any connector. ::: info You can use `status` to narrow the return type. For example, when `status` is `'connected'` properties like `address` are guaranteed to be defined. ```ts twoslash // {"path":"/vercel/path0/site/shared/getConnection-return-type.md","from":1166,"to":2330} // @twoslash-cache: {"v":1,"hash":"70621ff7ba048810d10cff60e35c82126a2beb12177fb38b972d09b620d6367c","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAmbDBkbQEsWidgHEYaAMIsefQWABK4gK6kwAFWy4qbAIakGiACxUANjDABzNPiQBGAAxU0ei+KbTeAlpRAn+PJEcQRnw9HT4yJEMAXwp0TTxCEnInOgMQAAosUggcfQwASnZdNCU4YQAdECh+OC4ZGigq9gAfdir6zxgmkFb2kFJeD1lLZraO4YFRkB9dfTsAVlNzKxtEADYnFzdEEBKynz8AxCCQsIjyRFsF2PicROJI1Pp3Vg5O2SF2YAqwdn/2DooFBBnByuwAILA0FwADcvwBgOh8Dg8GEgyBLBMGHYyChIJRFHYADpSfiYcgALqU+F/AFnfzCCShfx9JRgWAAM383VpiIZYAAklBhGAlABbABGZD59MmEFITPlpFl/1qUm4XRF7DQpCUMFV7HVk38FmEnJ0JlRhtqABFah9GubLdaEQDaopHabnVaDW7/vtwRNNREerTorNnPMjABmZaWax2IJR1zpL3eUw8uxUM6kcI0S4AJlu1ASuwAjvrSBgfDQXrsuGxOCavj86f8gQSwcJySjDZ2YWj2BioFicXjkWCiaTib2wVSaf7OCywEyV2yOTBuTwoIaBcLRRLpSql46FUqQ2gFTa4BqGt1hLr9Te755vewLb6b/a6pMHx+XT9dsjTgT0TUsH1XWAwNKmCP8w1+CNtCjAxDDjXwVkTK5k22NMWzAQ4syuHNQjzC4kGLSkc2gXBdn4Tl2AydMwGJQN2AAXk49gAHJHW6biijbf5mN+USwDEiTxKkyTJKQkBxXEHQkFANJzDgOQ8DQBBomiIA==="} import { type GetConnectionReturnType } from '@wagmi/core' const connection = {} as GetConnectionReturnType // ---cut--- if (connection.status === 'connected') { connection // ^? } ``` Or when status is `'disconnected'` properties like `address` are guaranteed to be `undefined`: ```ts twoslash // {"path":"/vercel/path0/site/shared/getConnection-return-type.md","from":2446,"to":3549} // @twoslash-cache: {"v":1,"hash":"03f1cafa2983888b08080373baa176953254622dd97feb972d42875fedc5dd86","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAmbDBkbQEsWidgHEYaAMIsefQWABK4gK6kwAFWy4qbAIakGiACxUANjDABzNPiQBGAAxU0ei+KbTeAlpRAn+PJEcQRnw9HT4yJEMAXwp0TTxCEnInOgMQAAosUggcfQwASnZdNCU4YQAdECh+OC4ZGigq9gAfdir6zxgmkFb2kFJeD1lLZraO4YFRkB9dfTsAVlNzKxtEADYnFzdEEBKynz8AxCCQsIjyRFsF2PicROJI1Pp3Vg5O2SF2YAqwdn/2DooFBBnByuwlGBYAAzfzdADcvwBgOBoLg8GEkJhcKgiL+ALO/kxUJgsJ4uKRBNC/gAklBidjyXjkR80BBSAzSTjmQDalJuF16exoToTOief9aopWf4LMIRWKYBL2HzJrL5aLxZTJXAACK1VndYRoUhKJXa4rOUrgqo1OqTbpVPHRWbOeZGTa+FbWOxBN2udIy7ymOF2KhnUjhGiXABMt2oCV2AEczaQMD4aC9dlw2Jw1V8fvj/kCQfBwViuUyLSW0RiISSyQiLYSwJzGxSi5xqWA6W3uc3Juy+1XO6qBREhQqtaO4NK1ZYNYrlWOGurhZrzTP9fbx41jabN8j9jbqgaHT1na69AZDJ6zJYfVc/dtA/mwIdQ1dw6FIxckHGAF1w2gXBdn4aF2AyIMwAAOmPdgAF4kPYAByO1DSgFCikLf5oN+fCwAIojCJI4jiJdKgAFtxB0JBQDScw4DkPA0AQaJoiAA"} import { type GetConnectionReturnType } from '@wagmi/core' const connection = {} as GetConnectionReturnType // ---cut--- if (connection.status === 'disconnected') { connection // ^? } ``` ::: --- --- url: /shared/installation.md --- ## Requirements Wagmi is optimized for modern browsers. It is compatible with the latest versions of the following browsers. ::: tip Depending on your environment, you might need to add polyfills. See [Viem Platform Compatibility](https://viem.sh/docs/compatibility) for more info. ::: ## Using Unreleased Commits If you can't wait for a new release to test the latest features, you can either install from the `canary` tag (tracks the [`main`](https://github.com/wevm/wagmi/tree/main) branch). ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/shared/installation.md","from":713,"to":745} pnpm add {{packageName}}@canary ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/shared/installation.md","from":768,"to":803} npm install {{packageName}}@canary ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/shared/installation.md","from":827,"to":859} yarn add {{packageName}}@canary ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/shared/installation.md","from":882,"to":913} bun add {{packageName}}@canary ``` ::: Or clone the [Wagmi repo](https://github.com/wevm/wagmi) to your local machine, build, and link it yourself. ```bash-vue // {"path":"/vercel/path0/site/shared/installation.md","from":1044,"to":1148} gh repo clone wevm/wagmi cd wagmi pnpm install pnpm build cd packages/{{packageDir}} pnpm link --global ``` Then go to the project where you are using Wagmi and run `pnpm link --global {{packageName}}` (or the package manager that you used to link Wagmi globally). Make sure you installed any [required peer dependencies](#package-manager) and their versions are correct. Finally, pull requests are continuously released via [pkg.pr.new](https://pkg.pr.new) and can be installed using the pull request number or short commit ID. ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/shared/installation.md","from":1610,"to":1658} pnpm add https://pkg.pr.new/{{packageName}}@123 ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/shared/installation.md","from":1681,"to":1732} npm install https://pkg.pr.new/{{packageName}}@123 ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/shared/installation.md","from":1756,"to":1804} yarn add https://pkg.pr.new/{{packageName}}@123 ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/shared/installation.md","from":1827,"to":1874} bun add https://pkg.pr.new/{{packageName}}@123 ``` ::: ## Security Ethereum-related projects are often targeted in attacks to steal users' assets. Make sure you follow security best-practices for your project. Some quick things to get started. * Pin package versions, upgrade mindfully, and inspect lockfile changes to minimize the risk of [supply-chain attacks](https://nodejs.org/en/guides/security/#supply-chain-attacks). * Use [npm](https://docs.npmjs.com)'s [`min-release-age`](https://docs.npmjs.com/cli/v11/using-npm/config#min-release-age) or [pnpm](https://pnpm.io)'s [`minimumReleaseAge`](https://pnpm.io/settings#minimumreleaseage) and [`trustPolicy`](https://pnpm.io/settings#trustpolicy) to mitigate against supply-chain attacks. * Install the [Socket](https://socket.dev) [GitHub App](https://github.com/apps/socket-security) to help detect and block supply-chain attacks. * Add a [Content Security Policy](https://cheatsheetseries.owasp.org/cheatsheets/Content_Security_Policy_Cheat_Sheet.html) to defend against external scripts running in your app. * Pin [GitHub Action](https://x.com/paulmillr/status/1900948425325031448) versions to commits instead of tags. [Actions Up](https://github.com/azat-io/actions-up) is a good tool for using commits instead of tags. --- --- url: /shared/migrate-from-v2-to-v3.md --- ## Install Connector Dependencies All connector dependencies are now optional peer dependencies. This means that if you want to use a specific connector, you need to install its required dependencies. For example, if you are using the `porto` connector, you also need to install the `porto` npm package. Required connector dependencies are listed below (along with links to npm, GitHub, [Socket](https://socket.dev), and licenses) and on docs pages under the "Install" section. :::tip Secure your supply-chain Since you are now responsible for managing connector dependencies, take a look at Wagmi's Security Getting Started section to brush up on some best practices. ::: :::tip Building a developer tool on top of Wagmi? If you are developing a library with Wagmi, you should decide if you want to install connector dependencies as part of your library ("batteries-included" approach) or pass the responsibility onto your users (more flexibility and control). ::: ### baseAccount `baseAccount` requires `@base-org/account` ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":1598,"to":1682} pnpm add @base-org/account@{{packageJson?.peerDependencies?.['@base-org/account']}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":1705,"to":1792} npm install @base-org/account@{{packageJson?.peerDependencies?.['@base-org/account']}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":1816,"to":1900} yarn add @base-org/account@{{packageJson?.peerDependencies?.['@base-org/account']}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":1923,"to":2006} bun add @base-org/account@{{packageJson?.peerDependencies?.['@base-org/account']}} ``` ::: ### coinbaseWallet `coinbaseWallet` requires `@coinbase/wallet-sdk` ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":2381,"to":2471} pnpm add @coinbase/wallet-sdk@{{packageJson?.peerDependencies?.['@coinbase/wallet-sdk']}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":2494,"to":2587} npm install @coinbase/wallet-sdk@{{packageJson?.peerDependencies?.['@coinbase/wallet-sdk']}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":2611,"to":2701} yarn add @coinbase/wallet-sdk@{{packageJson?.peerDependencies?.['@coinbase/wallet-sdk']}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":2724,"to":2813} bun add @coinbase/wallet-sdk@{{packageJson?.peerDependencies?.['@coinbase/wallet-sdk']}} ``` ::: ### metaMask `metaMask` requires `@metamask/connect-evm` ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":3165,"to":3257} pnpm add @metamask/connect-evm@{{packageJson?.peerDependencies?.['@metamask/connect-evm']}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":3280,"to":3375} npm install @metamask/connect-evm@{{packageJson?.peerDependencies?.['@metamask/connect-evm']}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":3399,"to":3491} yarn add @metamask/connect-evm@{{packageJson?.peerDependencies?.['@metamask/connect-evm']}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":3514,"to":3605} bun add @metamask/connect-evm@{{packageJson?.peerDependencies?.['@metamask/connect-evm']}} ``` ::: ### porto `porto` requires `porto` ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":3879,"to":3939} pnpm add porto@{{packageJson?.peerDependencies?.['porto']}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":3962,"to":4025} npm install porto@{{packageJson?.peerDependencies?.['porto']}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":4049,"to":4109} yarn add porto@{{packageJson?.peerDependencies?.['porto']}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":4132,"to":4191} bun add porto@{{packageJson?.peerDependencies?.['porto']}} ``` ::: ### safe `safe` requires `@safe-global/safe-apps-provider` and `@safe-global/safe-apps-sdk` ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":4837,"to":5043} pnpm add @safe-global/safe-apps-provider@{{packageJson?.peerDependencies?.['@safe-global/safe-apps-provider']}} @safe-global/safe-apps-sdk@{{packageJson?.peerDependencies?.['@safe-global/safe-apps-sdk']}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":5066,"to":5275} npm install @safe-global/safe-apps-provider@{{packageJson?.peerDependencies?.['@safe-global/safe-apps-provider']}} @safe-global/safe-apps-sdk@{{packageJson?.peerDependencies?.['@safe-global/safe-apps-sdk']}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":5299,"to":5505} yarn add @safe-global/safe-apps-provider@{{packageJson?.peerDependencies?.['@safe-global/safe-apps-provider']}} @safe-global/safe-apps-sdk@{{packageJson?.peerDependencies?.['@safe-global/safe-apps-sdk']}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":5528,"to":5733} bun add @safe-global/safe-apps-provider@{{packageJson?.peerDependencies?.['@safe-global/safe-apps-provider']}} @safe-global/safe-apps-sdk@{{packageJson?.peerDependencies?.['@safe-global/safe-apps-sdk']}} ``` ::: ### walletConnect `walletConnect` requires `@walletconnect/ethereum-provider` ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":6141,"to":6255} pnpm add @walletconnect/ethereum-provider@{{packageJson?.peerDependencies?.['@walletconnect/ethereum-provider']}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":6278,"to":6395} npm install @walletconnect/ethereum-provider@{{packageJson?.peerDependencies?.['@walletconnect/ethereum-provider']}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":6419,"to":6533} yarn add @walletconnect/ethereum-provider@{{packageJson?.peerDependencies?.['@walletconnect/ethereum-provider']}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/shared/migrate-from-v2-to-v3.md","from":6556,"to":6669} bun add @walletconnect/ethereum-provider@{{packageJson?.peerDependencies?.['@walletconnect/ethereum-provider']}} ``` ::: ## Bumped Minimum TypeScript Version The minimum supported TypeScript version is now `5.7.3` instead of `5.0.4`. Older versions of TypeScript should continue to work, but since [TypeScript doesn't follow semver](https://www.learningtypescript.com/articles/why-typescript-doesnt-follow-strict-semantic-versioning) we recommend you update to at least `5.7.3`. This should be relatively simple as there haven't been any breaking changes since `5.0.4`. ## Migrate v2 Deprecations v2 deprecations Review the v2 migration guide for more information. --- --- url: /shared/mutation-imports.md --- ## TanStack Query ```ts-vue // {"path":"/vercel/path0/site/shared/mutation-imports.md","from":148,"to":335} import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` --- --- url: /shared/mutation-options.md --- *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. --- --- url: /shared/mutation-result.md --- *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. --- --- url: /shared/query-imports.md --- ## TanStack Query ```ts-vue // {"path":"/vercel/path0/site/shared/query-imports.md","from":154,"to":364} import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` --- --- url: /shared/query-options.md --- *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. --- --- url: /shared/query-result.md --- *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. --- --- url: /shared/tempo-write-parameters.md --- ### account (optional) * **Type:** `Account | Address` Account that will be used to send the transaction. Defaults to connected Wagmi account. ### feeToken (optional) * **Type:** `Address | bigint` Fee token for the transaction. Can be a TIP-20 token address or ID. ### feePayer (optional) * **Type:** `Account | true` Fee payer for the transaction. Can be a [Viem Account](https://viem.sh/docs/accounts/local/privateKeyToAccount), or `true` if a [Fee Payer Service](https://docs.tempo.xyz/sdk/typescript/server/handler.feePayer) will be used. ### gas (optional) * **Type:** `bigint` Gas limit for the transaction. ### maxFeePerGas (optional) * **Type:** `bigint` Max fee per gas for the transaction. ### maxPriorityFeePerGas (optional) * **Type:** `bigint` Max priority fee per gas for the transaction. ### nonce (optional) * **Type:** `number` Nonce for the transaction. ### nonceKey (optional) * **Type:** `'expiring' | bigint` Nonce key for the transaction. ### validBefore (optional) * **Type:** `number` Unix timestamp before which the transaction must be included. ### validAfter (optional) * **Type:** `number` Unix timestamp after which the transaction can be included. ### throwOnReceiptRevert (optional) * **Type:** `boolean` * **Default:** `true` Whether to throw an error if the transaction receipt indicates a revert. Only applicable to `*Sync` actions. --- --- url: /react/api/hooks/useBalance.md description: Hook for fetching native currency balance. --- # useBalance Hook for fetching native currency balance. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBalance.md","from":380,"to":415} import { useBalance } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBalance.md","from":464,"to":613} import { useBalance } from 'wagmi' function App() { const result = useBalance({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBalance.md","from":685,"to":735} import { type UseBalanceParameters } from 'wagmi' ``` ### address `Address | undefined` Address to get balance for. [`enabled`](#enabled) set to `false` if `address` is `undefined`. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBalance.md","from":905,"to":1110} import { useBalance } from 'wagmi' import { mainnet } from 'wagmi/chains' function App() { const result = useBalance({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### blockNumber `bigint | undefined` Block number to get balance at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useBalance.md","from":1270,"to":1464} import { useBalance } from 'wagmi' function App() { const result = useBalance({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', blockNumber: 17829139n, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get balance at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useBalance.md","from":1663,"to":1853} import { useBalance } from 'wagmi' function App() { const result = useBalance({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', blockTag: 'latest', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBalance.md","from":2042,"to":2289} import { useBalance } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] function App() { const result = useBalance({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBalance.md","from":2543,"to":2772} import { useBalance } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useBalance({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBalance.md","from":2992,"to":3179} import { useBalance } from 'wagmi' function App() { const result = useBalance({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBalance.md","from":3295,"to":3345} import { type UseBalanceReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getBalance`](/core/api/actions/getBalance) --- --- url: /solid/api/primitives/useBalance.md description: Primitive for fetching native currency balance. --- # useBalance Primitive for fetching native currency balance. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useBalance.md","from":397,"to":439} import { useBalance } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useBalance.md","from":488,"to":653} import { useBalance } from '@wagmi/solid' function App() { const balance = useBalance(() => ({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', })) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useBalance.md","from":725,"to":817} import { useBalance } from '@wagmi/solid' useBalance.Parameters useBalance.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useBalance.md","from":902,"to":971} useBalance(() => ({ address: '0x...', // other parameters... })) ``` ### address `Address | undefined` Address to get balance for. [`enabled`](#enabled) set to `false` if `address` is `undefined`. ### blockNumber `bigint | undefined` Block number to get balance at. ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get balance at. ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). ### scopeKey `string | undefined` Scopes the cache to a given context. Primitives that have identical context will share the same cache. *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useBalance.md","from":1768,"to":1833} import { useBalance } from '@wagmi/solid' useBalance.ReturnType ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getBalance`](/core/api/actions/getBalance) --- --- url: /vue/api/composables/useBalance.md description: Composable for fetching native currency balance. --- # useBalance Composable for fetching native currency balance. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useBalance.md","from":397,"to":437} import { useBalance } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBalance.md","from":486,"to":650} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useBalance.md","from":720,"to":775} import { type UseBalanceParameters } from '@wagmi/vue' ``` ### address `Address | undefined` Address to get balance for. [`enabled`](#enabled) set to `false` if `address` is `undefined`. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBalance.md","from":945,"to":1170} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### blockNumber `bigint | undefined` Block number to get balance at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBalance.md","from":1330,"to":1537} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get balance at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBalance.md","from":1736,"to":1939} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBalance.md","from":2126,"to":2391} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBalance.md","from":2627,"to":2869} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBalance.md","from":3087,"to":3287} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useBalance.md","from":3401,"to":3456} import { type UseBalanceReturnType } from '@wagmi/vue' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getBalance`](/core/api/actions/getBalance) --- --- url: /react/api/hooks/useBlobBaseFee.md description: Hook for fetching the current blob base fee (in wei). --- # useBlobBaseFee Hook for fetching the current blob base fee (in wei). ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBlobBaseFee.md","from":376,"to":415} import { useBlobBaseFee } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlobBaseFee.md","from":464,"to":557} import { useBlobBaseFee } from 'wagmi' function App() { const result = useBlobBaseFee() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBlobBaseFee.md","from":629,"to":683} import { type UseBlobBaseFeeParameters } from 'wagmi' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlobBaseFee.md","from":821,"to":1017} import { useBlobBaseFee } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] function App() { const result = useBlobBaseFee({ chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlobBaseFee.md","from":1271,"to":1449} import { useBlobBaseFee } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useBlobBaseFee({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlobBaseFee.md","from":1669,"to":1856} import { useBlobBaseFee } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useBlobBaseFee({ scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBlobBaseFee.md","from":1972,"to":2026} import { type UseBlobBaseFeeReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getBlobBaseFee`](/core/api/actions/getBlobBaseFee) --- --- url: /react/api/hooks/useBlock.md description: 'Hook for fetching information about a block at a block number, hash or tag.' --- # useBlock Hook for fetching information about a block at a block number, hash or tag. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBlock.md","from":396,"to":429} import { useBlock } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlock.md","from":478,"to":559} import { useBlock } from 'wagmi' function App() { const result = useBlock() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBlock.md","from":631,"to":679} import { type UseBlockParameters } from 'wagmi' ``` ### blockHash `` `0x${string}` `` Information at a given block hash. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlock.md","from":790,"to":977} import { useBlock } from 'wagmi' function App() { const result = useBlock({ blockHash: '0x89644bbd5c8d682a2e9611170e6c1f02573d866d286f006cbf517eec7254ec2d' // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint` Information at a given block number. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlock.md","from":1131,"to":1258} import { useBlock } from 'wagmi' function App() { const result = useBlock({ blockNumber: 42069n // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'` Information at a given block tag. Defaults to `'latest'`. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlock.md","from":1480,"to":1607} import { useBlock } from 'wagmi' function App() { const result = useBlock({ blockTag: 'pending' // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlock.md","from":1791,"to":1975} import { useBlock } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] function App() { const result = useBlock({ chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlock.md","from":2229,"to":2395} import { useBlock } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useBlock({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### includeTransactions `boolean` Whether or not to include transactions as objects. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlock.md","from":2568,"to":2735} import { useBlock } from 'wagmi' import { config } from './config' function App() { const result = useBlock({ includeTransactions: true // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlock.md","from":2955,"to":3112} import { useBlock } from 'wagmi' import { config } from './config' function App() { const result = useBlock({ scopeKey: 'foo' // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### watch `boolean | UseWatchBlockParameters | undefined` * Enables/disables listening for block changes. * Can pass a subset of [`UseWatchBlocksParameters`](/react/api/hooks/useWatchBlocks#parameters) directly to [`useWatchBlocks`](/react/api/hooks/useWatchBlocks). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlock.md","from":3467,"to":3587} import { useBlock } from 'wagmi' function App() { const result = useBlock({ watch: true, // [!code focus] }) } ``` ```tsx [index-2.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlock.md","from":3613,"to":3800} import { useBlock } from 'wagmi' function App() { const result = useBlock({ watch: { // [!code focus] pollingInterval: 4_000, // [!code focus] }, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBlock.md","from":3916,"to":3964} import { type UseBlockReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getBlock`](/core/api/actions/getBlock) * [`watchBlockNumber`](/core/api/actions/watchBlockNumber) --- --- url: /react/api/hooks/useBlockNumber.md description: Hook for fetching the number of the most recent block seen. --- # useBlockNumber Hook for fetching the number of the most recent block seen. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBlockNumber.md","from":388,"to":427} import { useBlockNumber } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlockNumber.md","from":476,"to":569} import { useBlockNumber } from 'wagmi' function App() { const result = useBlockNumber() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBlockNumber.md","from":641,"to":695} import { type UseBlockNumberParameters } from 'wagmi' ``` ### cacheTime `number | undefined` Time in milliseconds that cached block number will remain in memory. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlockNumber.md","from":841,"to":978} import { useBlockNumber } from 'wagmi' function App() { const result = useBlockNumber({ cacheTime: 4_000, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlockNumber.md","from":1162,"to":1358} import { useBlockNumber } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] function App() { const result = useBlockNumber({ chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlockNumber.md","from":1612,"to":1790} import { useBlockNumber } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useBlockNumber({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlockNumber.md","from":2010,"to":2197} import { useBlockNumber } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useBlockNumber({ scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### watch `boolean | UseWatchBlockNumberParameters | undefined` * Enables/disables listening for block number changes. * Can pass a subset of [`UseWatchBlockNumberParameters`](/react/api/hooks/useWatchBlockNumber#parameters)directly to [`useWatchBlockNumber`](/react/api/hooks/useWatchBlockNumber). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlockNumber.md","from":2584,"to":2716} import { useBlockNumber } from 'wagmi' function App() { const result = useBlockNumber({ watch: true, // [!code focus] }) } ``` ```tsx [index-2.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlockNumber.md","from":2742,"to":2941} import { useBlockNumber } from 'wagmi' function App() { const result = useBlockNumber({ watch: { // [!code focus] pollingInterval: 4_000, // [!code focus] }, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBlockNumber.md","from":3057,"to":3111} import { type UseBlockNumberReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getBlockNumber`](/core/api/actions/getBlockNumber) * [`watchBlockNumber`](/core/api/actions/watchBlockNumber) --- --- url: /solid/api/primitives/useBlockNumber.md description: Primitive for fetching the current block number. --- # useBlockNumber Primitive for fetching the current block number. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useBlockNumber.md","from":178,"to":224} import { useBlockNumber } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useBlockNumber.md","from":273,"to":378} import { useBlockNumber } from '@wagmi/solid' function App() { const blockNumber = useBlockNumber() } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useBlockNumber.md","from":450,"to":554} import { useBlockNumber } from '@wagmi/solid' useBlockNumber.Parameters useBlockNumber.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useBlockNumber.md","from":639,"to":706} useBlockNumber(() => ({ chainId: 1, // other parameters... })) ``` ### cacheTime `number | undefined` Time in milliseconds that cached block number will remain in memory. ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). ### scopeKey `string | undefined` Scopes the cache to a given context. Primitives that have identical context will share the same cache. *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useBlockNumber.md","from":1291,"to":1364} import { useBlockNumber } from '@wagmi/solid' useBlockNumber.ReturnType ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getBlockNumber`](/core/api/actions/getBlockNumber) --- --- url: /vue/api/composables/useBlockNumber.md description: Composable for fetching the number of the most recent block seen. --- # useBlockNumber Composable for fetching the number of the most recent block seen. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useBlockNumber.md","from":405,"to":449} import { useBlockNumber } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBlockNumber.md","from":498,"to":683} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useBlockNumber.md","from":753,"to":812} import { type UseBlockNumberParameters } from '@wagmi/vue' ``` ### cacheTime `MaybeRef | undefined` Time in milliseconds that cached block number will remain in memory. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBlockNumber.md","from":968,"to":1134} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `MaybeRef | undefined` ID of chain to use when fetching data. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBlockNumber.md","from":1326,"to":1557} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBlockNumber.md","from":1793,"to":2001} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `MaybeRef | undefined` Scopes the cache to a given context. Composables that have identical context will share the same cache. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBlockNumber.md","from":2235,"to":2401} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### watch `MaybeRef | undefined` * Enables/disables listening for block number changes. * Can pass a subset of [`UseWatchBlockNumberParameters`](/vue/api/composables/useWatchBlockNumber#parameters) directly to [`useWatchBlockNumber`](/vue/api/composables/useWatchBlockNumber). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBlockNumber.md","from":2805,"to":2967} ``` ```vue [index-2.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBlockNumber.md","from":2993,"to":3217} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useBlockNumber.md","from":3331,"to":3390} import { type UseBlockNumberReturnType } from '@wagmi/vue' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getBlockNumber`](/core/api/actions/getBlockNumber) * [`watchBlockNumber`](/core/api/actions/watchBlockNumber) --- --- url: /react/api/hooks/useBlockTransactionCount.md description: 'Hook for fetching the number of Transactions at a block number, hash or tag.' --- # useBlockTransactionCount Hook for fetching the number of Transactions at a block number, hash or tag. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBlockTransactionCount.md","from":472,"to":521} import { useBlockTransactionCount } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlockTransactionCount.md","from":570,"to":683} import { useBlockTransactionCount } from 'wagmi' function App() { const result = useBlockTransactionCount() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBlockTransactionCount.md","from":755,"to":819} import { type UseBlockTransactionCountParameters } from 'wagmi' ``` ### blockHash `` `0x${string}` `` Transaction count at a given block hash. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlockTransactionCount.md","from":936,"to":1123} import { useBlock } from 'wagmi' function App() { const result = useBlock({ blockHash: '0x89644bbd5c8d682a2e9611170e6c1f02573d866d286f006cbf517eec7254ec2d' // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint` Transaction count at a given block number. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlockTransactionCount.md","from":1283,"to":1410} import { useBlock } from 'wagmi' function App() { const result = useBlock({ blockNumber: 42069n // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'` Transaction count at a given block tag. Defaults to `'latest'`. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlockTransactionCount.md","from":1638,"to":1765} import { useBlock } from 'wagmi' function App() { const result = useBlock({ blockTag: 'pending' // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlockTransactionCount.md","from":1949,"to":2133} import { useBlock } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] function App() { const result = useBlock({ chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlockTransactionCount.md","from":2387,"to":2585} import { useBlockTransactionCount } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useBlockTransactionCount({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBlockTransactionCount.md","from":2805,"to":3012} import { useBlockTransactionCount } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useBlockTransactionCount({ scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBlockTransactionCount.md","from":3129,"to":3193} import { type UseBlockTransactionCountReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getBlockTransactionCount`](/core/api/actions/getBlockTransactionCount) --- --- url: /react/api/hooks/useBytecode.md description: Hook for retrieving the bytecode at an address. --- # useBytecode Hook for retrieving the bytecode at an address. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBytecode.md","from":358,"to":394} import { useBytecode } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBytecode.md","from":443,"to":594} import { useBytecode } from 'wagmi' function App() { const result = useBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBytecode.md","from":666,"to":717} import { type UseBytecodeParameters } from 'wagmi' ``` ### address `Address | undefined` The contract address. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBytecode.md","from":815,"to":983} import { useBytecode } from 'wagmi' function App() { const result = useBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` The block number to check the bytecode at. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBytecode.md","from":1151,"to":1347} import { useBytecode } from 'wagmi' function App() { const result = useBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', blockNumber: 16280770n, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` The block tag to check the bytecode at. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBytecode.md","from":1559,"to":1749} import { useBytecode } from 'wagmi' function App() { const result = useBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', blockTag: 'safe', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` The chain ID to check the bytecode at. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBytecode.md","from":1933,"to":2165} import { useBytecode } from 'wagmi' import { mainnet } from 'wagmi/chains' function App() { const result = useBytecode({ chainId: mainnet.id, // [!code focus] address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBytecode.md","from":2419,"to":2650} import { useBytecode } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useBytecode({ config, // [!code focus] address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useBytecode.md","from":2870,"to":3092} import { useBytecode } from 'wagmi' import { config } from './config' function App() { const result = useBytecode({ scopeKey: 'foo' // [!code focus] address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useBytecode.md","from":3208,"to":3259} import { type UseBytecodeReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getBytecode`](/core/api/actions/getBytecode) --- --- url: /vue/api/composables/useBytecode.md description: Composable for retrieving the bytecode at an address. --- # useBytecode Composable for retrieving the bytecode at an address. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useBytecode.md","from":375,"to":416} import { useBytecode } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBytecode.md","from":465,"to":695} ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useBytecode.md","from":767,"to":823} import { type UseBytecodeParameters } from '@wagmi/vue' ``` ### address `Address | undefined` The contract address. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBytecode.md","from":921,"to":1168} ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` The block number to check the bytecode at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBytecode.md","from":1336,"to":1609} ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` The block tag to check the bytecode at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBytecode.md","from":1821,"to":2088} ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` The chain ID to check the bytecode at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBytecode.md","from":2272,"to":2586} ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBytecode.md","from":2840,"to":3148} ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useBytecode.md","from":3368,"to":3685} ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useBytecode.md","from":3801,"to":3857} import { type UseBytecodeReturnType } from '@wagmi/vue' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getBytecode`](/core/api/actions/getBytecode) --- --- url: /react/api/hooks/useCall.md description: >- Hook for executing a new message call immediately without submitting a transaction to the network. --- # useCall Hook for executing a new message call immediately without submitting a transaction to the network. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":424,"to":456} import { useCall } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":505,"to":758} import { useCall } from 'wagmi' function App() { const result = useCall({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":830,"to":877} import { type UseCallParameters } from 'wagmi' ``` ### account `Account | Address | undefined` The Account to call from. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":989,"to":1259} import { useCall } from 'wagmi' function App() { const result = useCall({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', // [!code focus] data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### data `0x${string} | undefined` A contract hashed method call with encoded args. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":1431,"to":1701} import { useCall } from 'wagmi' function App() { const result = useCall({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### to `Address | undefined` The contract address or recipient. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":1853,"to":2123} import { useCall } from 'wagmi' function App() { const result = useCall({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### accessList `AccessList | undefined` The access list. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":2268,"to":2637} import { useCall } from 'wagmi' function App() { const result = useCall({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', accessList: [ // [!code focus:6] { address: '0x1', storageKeys: ['0x1'], }, ], data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gas `bigint | undefined` The gas provided for transaction execution. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":2798,"to":3089} import { useCall } from 'wagmi' function App() { const result = useCall({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', gas: 1_000_000n, // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gasPrice `bigint | undefined` The price (in wei) to pay per gas. Only applies to [Legacy Transactions](https://viem.sh/docs/glossary/terms#legacy-transaction). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":3341,"to":3642} import { useCall } from 'wagmi' function App() { const result = useCall({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', gasPrice: parseGwei('20'), // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxFeePerGas `bigint | undefined` Total fee per gas (in wei), inclusive of `maxPriorityFeePerGas`. Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":3932,"to":4237} import { useCall } from 'wagmi' function App() { const result = useCall({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', maxFeePerGas: parseGwei('20'), // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxPriorityFeePerGas `bigint | undefined` Max priority fee per gas (in wei). Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":4505,"to":4852} import { useCall } from 'wagmi' function App() { const result = useCall({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', maxFeePerGas: parseGwei('20'), maxPriorityFeePerGas: parseGwei('2'), // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### nonce `number | undefined` Unique number identifying this transaction. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":5015,"to":5301} import { useCall } from 'wagmi' function App() { const result = useCall({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', nonce: 420, // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### value `bigint | undefined` Value (in wei) sent with this transaction. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":5463,"to":5761} import { useCall } from 'wagmi' function App() { const result = useCall({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `number | undefined` The block number to perform the call against. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":5932,"to":6230} import { useCall } from 'wagmi' function App() { const result = useCall({ blockNumber: 15121123n, // [!code focus] account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` The block tag to perform the call against. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":6445,"to":6737} import { useCall } from 'wagmi' function App() { const result = useCall({ blockTag: 'safe', // [!code focus] account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` The block tag to perform the call against. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":6925,"to":7265} import { useCall } from 'wagmi' import { mainnet } from '@wagmi/core/chains' function App() { const result = useCall({ chainId: mainnet.id, // [!code focus] account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":7519,"to":7852} import { useCall } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useCall({ config, // [!code focus] account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":8072,"to":8396} import { useCall } from 'wagmi' import { config } from './config' function App() { const result = useCall({ scopeKey: 'foo' // [!code focus] account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useCall.md","from":8512,"to":8559} import { type UseCallReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`call`](/core/api/actions/call) --- --- url: /react/api/hooks/useCallsStatus.md description: Hook for fetching the number of the most recent block seen. --- # useCallsStatus Hook to fetch the status and receipts of a call batch that was sent via [`useSendCalls`](/react/api/hooks/useSendCalls). ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useCallsStatus.md","from":470,"to":509} import { useCallsStatus } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCallsStatus.md","from":558,"to":690} import { useCallsStatus } from 'wagmi' function App() { const result = useCallsStatus({ id: '0x...', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useCallsStatus.md","from":762,"to":816} import { type UseCallsStatusParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCallsStatus.md","from":1024,"to":1219} import { useCallsStatus } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useCallsStatus({ config, // [!code focus] id: '0x...', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` Connector to get call statuses with. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCallsStatus.md","from":1382,"to":1662} import { useCallsStatus, useConnections } from 'wagmi' import { config } from './config' // [!code focus] function App() { const connections = useConnections() const result = useCallsStatus({ connector: connections[0]?.connector, // [!code focus] id: '0x...', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### id `string` Identifier of the call batch. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useCallsStatus.md","from":1794,"to":1960} import { useCallsStatus } from '@wagmi/core' import { config } from './config' const status = await useCallsStatus({ id: '0x1234567890abcdef', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCallsStatus.md","from":2180,"to":2384} import { useCallsStatus } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useCallsStatus({ id: '0x...', scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useCallsStatus.md","from":2500,"to":2554} import { type UseCallsStatusReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getCallsStatus`](https://viem.sh/docs/actions/wallet/getCallsStatus) --- --- url: /react/api/hooks/useCapabilities.md description: Hook for fetching the number of the most recent block seen. --- # useCapabilities Hook to extract capabilities (grouped by chain ID) that a connected wallet supports (e.g. paymasters, session keys, etc). [Read more.](https://github.com/ethereum/EIPs/blob/815028dc634463e1716fc5ce44c019a6040f0bef/EIPS/eip-5792.md#wallet_getcapabilities) ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useCapabilities.md","from":608,"to":648} import { useCapabilities } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCapabilities.md","from":697,"to":792} import { useCapabilities } from 'wagmi' function App() { const result = useCapabilities() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useCapabilities.md","from":864,"to":919} import { type UseCapabilitiesParameters } from 'wagmi' ``` ### account `Account | Address | undefined` Fetch capabilities for the provided account. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useCapabilities.md","from":1048,"to":1245} import { useCapabilities } from '@wagmi/core' import { config } from './config' const status = await useCapabilities({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCapabilities.md","from":1499,"to":1679} import { useCapabilities } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useCapabilities({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` Connector to get call statuses with. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCapabilities.md","from":1842,"to":2107} import { useCapabilities, useConnections } from 'wagmi' import { config } from './config' // [!code focus] function App() { const connections = useConnections() const result = useCapabilities({ connector: connections[0]?.connector, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useCapabilities.md","from":2327,"to":2516} import { useCapabilities } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useCapabilities({ scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useCapabilities.md","from":2632,"to":2687} import { type UseCapabilitiesReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getCapabilities`](https://viem.sh/docs/actions/wallet/getCapabilities) --- --- url: /react/api/hooks/useChainId.md description: Hook for getting current chain ID. --- # useChainId Hook for getting current chain ID. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useChainId.md","from":142,"to":177} import { useChainId } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useChainId.md","from":226,"to":312} import { useChainId } from 'wagmi' function App() { const chainId = useChainId() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useChainId.md","from":384,"to":434} import { type UseChainIdParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useChainId.md","from":642,"to":813} import { useChainId } from 'wagmi' import { config } from './config' // [!code focus] function App() { const chainId = useChainId({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useChainId.md","from":886,"to":936} import { type UseChainIdReturnType } from 'wagmi' ``` `number` Current chain ID from [`config.state.chainId`](/react/api/createConfig#chainid). ::: info Only returns chain IDs for chains configured via `createConfig`'s [`chains`](/react/api/createConfig#chains) parameter. If the active [connection](/react/api/createConfig#connection) [`chainId`](/react/api/createConfig#chainid-1) is not from a chain included in your Wagmi `Config`, `useChainId` will return the last configured chain ID. ::: ## Action * [`getChainId`](/core/api/actions/getChainId) * [`watchChainId`](/core/api/actions/watchChainId) --- --- url: /solid/api/primitives/useChainId.md description: Primitive for getting current chain ID. --- # useChainId Primitive for getting current chain ID. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useChainId.md","from":152,"to":194} import { useChainId } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useChainId.md","from":243,"to":377} import { useChainId } from '@wagmi/solid' function App() { const chainId = useChainId() return

Chain ID: {chainId()}

} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useChainId.md","from":449,"to":541} import { useChainId } from '@wagmi/solid' useChainId.Parameters useChainId.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useChainId.md","from":626,"to":660} useChainId(() => ({ config, })) ``` ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useChainId.md","from":856,"to":921} import { useChainId } from '@wagmi/solid' useChainId.ReturnType ``` `Accessor` Returns an accessor containing the current chain ID from the config state. ::: info Only returns chain IDs for chains configured via `createConfig`'s [`chains`](/solid/api/createConfig#chains) parameter. If the active [connection](/solid/api/createConfig#connection) [`chainId`](/solid/api/createConfig#chainid-1) is not from a chain included in your Wagmi `Config`, `useChainId` will return the last configured chain ID. ::: ## Action * [`getChainId`](/core/api/actions/getChainId) * [`watchChainId`](/core/api/actions/watchChainId) --- --- url: /vue/api/composables/useChainId.md description: Composable for getting current chain ID. --- # useChainId Composable for getting current chain ID. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useChainId.md","from":154,"to":194} import { useChainId } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useChainId.md","from":243,"to":348} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useChainId.md","from":418,"to":473} import { type UseChainIdParameters } from '@wagmi/vue' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useChainId.md","from":665,"to":851} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useChainId.md","from":922,"to":977} import { type UseChainIdReturnType } from '@wagmi/vue' ``` `number` Current chain ID from [`config.state.chainId`](/vue/api/createConfig#chainid). ::: info Only returns chain IDs for chains configured via `createConfig`'s [`chains`](/vue/api/createConfig#chains) parameter. If the active [connection](/vue/api/createConfig#connection) [`chainId`](/vue/api/createConfig#chainid-1) is not from a chain included in your Wagmi `Config`, `useChainId` will return the last configured chain ID. ::: ## Action * [`getChainId`](/core/api/actions/getChainId) * [`watchChainId`](/core/api/actions/watchChainId) --- --- url: /react/api/hooks/useChains.md description: Hook for getting configured chains --- # useChains Hook for getting configured chains ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useChains.md","from":140,"to":174} import { useChains } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useChains.md","from":223,"to":306} import { useChains } from 'wagmi' function App() { const chains = useChains() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useChains.md","from":378,"to":427} import { type UseChainsParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useChains.md","from":635,"to":803} import { useChains } from 'wagmi' import { config } from './config' // [!code focus] function App() { const chains = useChains({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useChains.md","from":876,"to":925} import { type UseChainsReturnType } from 'wagmi' ``` `readonly [Chain, ...Chain[]]` Chains from [`config.chains`](/react/api/createConfig#chains). ## Action * [`getChains`](/core/api/actions/getChains) --- --- url: /solid/api/primitives/useChains.md description: Primitive for getting configured chains. --- # useChains Primitive for getting configured chains. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useChains.md","from":152,"to":193} import { useChains } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useChains.md","from":242,"to":484} import { useChains } from '@wagmi/solid' import { For } from 'solid-js' function App() { const chains = useChains() return (
    {(chain) =>
  • {chain.name}
  • }
) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useChains.md","from":556,"to":645} import { useChains } from '@wagmi/solid' useChains.Parameters useChains.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useChains.md","from":730,"to":763} useChains(() => ({ config, })) ``` ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useChains.md","from":959,"to":1022} import { useChains } from '@wagmi/solid' useChains.ReturnType ``` `Accessor` Returns an accessor containing the configured chains. ## Action * [`getChains`](/core/api/actions/getChains) --- --- url: /vue/api/composables/useChains.md description: Composable for getting configured chains --- # useChains Composable for getting configured chains ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useChains.md","from":152,"to":191} import { useChains } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useChains.md","from":240,"to":342} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useChains.md","from":412,"to":466} import { type UseChainsParameters } from '@wagmi/vue' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useChains.md","from":658,"to":841} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useChains.md","from":912,"to":966} import { type UseChainsReturnType } from '@wagmi/vue' ``` `readonly [Chain, ...Chain[]]` Chains from [`config.chains`](/vue/api/createConfig#chains). ## Action * [`getChains`](/core/api/actions/getChains) --- --- url: /react/api/hooks/useClient.md description: Hook for getting Viem `Client` instance. --- # useClient Hook for getting Viem [`Client`](https://viem.sh/docs/clients/custom) instance. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useClient.md","from":191,"to":225} import { useClient } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useClient.md","from":274,"to":357} import { useClient } from 'wagmi' function App() { const client = useClient() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useClient.md","from":429,"to":478} import { type UseClientParameters } from 'wagmi' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when getting Viem Client. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useClient.md","from":620,"to":840} import { useClient } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] import { config } from './config' function App() { const client = useClient({ chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useClient.md","from":1093,"to":1261} import { useClient } from 'wagmi' import { config } from './config' // [!code focus] function App() { const client = useClient({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useClient.md","from":1334,"to":1383} import { type UseClientReturnType } from 'wagmi' ``` `Client | undefined` Viem [`Client`](https://viem.sh/docs/clients/custom) instance. ## Action * [`getClient`](/core/api/actions/getClient) * [`watchClient`](/core/api/actions/watchClient) --- --- url: /solid/api/primitives/useClient.md description: Primitive for getting Viem Client. --- # useClient Primitive for getting [Viem Client](https://viem.sh/docs/clients/intro) instance. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useClient.md","from":187,"to":228} import { useClient } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useClient.md","from":277,"to":367} import { useClient } from '@wagmi/solid' function App() { const client = useClient() } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useClient.md","from":439,"to":528} import { useClient } from '@wagmi/solid' useClient.Parameters useClient.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useClient.md","from":613,"to":650} useClient(() => ({ chainId: 1, })) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when getting the client. ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useClient.md","from":950,"to":1013} import { useClient } from '@wagmi/solid' useClient.ReturnType ``` `Accessor` Returns an accessor containing the Viem Client instance, or `undefined` if not available. ## Action * [`getClient`](/core/api/actions/getClient) --- --- url: /vue/api/composables/useClient.md description: Composable for getting Viem `Client` instance. --- # useClient Composable for getting Viem [`Client`](https://viem.sh/docs/clients/custom) instance. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useClient.md","from":203,"to":242} import { useClient } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useClient.md","from":291,"to":393} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useClient.md","from":463,"to":517} import { type UseClientParameters } from '@wagmi/vue' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when getting Viem Client. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useClient.md","from":661,"to":901} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useClient.md","from":1137,"to":1320} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useClient.md","from":1391,"to":1445} import { type UseClientReturnType } from '@wagmi/vue' ``` `Client | undefined` Viem [`Client`](https://viem.sh/docs/clients/custom) instance. ## Action * [`getClient`](/core/api/actions/getClient) * [`watchClient`](/core/api/actions/watchClient) --- --- url: /react/api/hooks/useConfig.md description: Hook for getting `Config` from nearest `WagmiProvider`. --- # useConfig Hook for getting [`Config`](/react/api/createConfig#config) from nearest [`WagmiProvider`](/react/api/WagmiProvider). ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConfig.md","from":244,"to":278} import { useConfig } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConfig.md","from":327,"to":410} import { useConfig } from 'wagmi' function App() { const config = useConfig() } ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConfig.md","from":442,"to":491} import { type UseConfigReturnType } from 'wagmi' ``` If you use TypeScript and [register your `Config`](/react/typescript#register-config), the return type will be inferred. ::: code-group ```ts twoslash [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConfig.md","from":660,"to":3560} // @twoslash-cache: {"v":1,"hash":"914af31f2d67af9b6a0eb3594b780105455023fedc851e1b259e6312534bc63b","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgBhSf3YBzADwjFK3nRpgocXgrBLlvALyHNa0jGZRJrDL1QAdKbw8AjVhBEBrAFFaLB8bUjhEXmA3D1jYmzsHJ1h+ZkFWNEjo9zjc3gT7MEdeMGYAWxhIlxAAtHwyOBFmMGqAbhi83IKk6VJWKoI0NCwIgHpRmDqGprAAOgk2js7420Li5ix2AFU+gfwhkcRxjfZZyfrwmfmIUZPFnNyAX3aH56Xeb18/ABV2CsiAIwAJgADGCXnENGA0KRmGIIlF3nFukUnDAwHAtmB2CRwmwAErwCCsXFZJGdFHrKBQGxwBHVEG0GDMlnMgEAFigAHYAQAOERAzzsrlQACcoqBAGZYMxPADJZKAKwwDns1n3ZbI1Y9T7+OQJGhQSJSkG8xXm3kQzpvB5axKo3hldLiJqsViSsm2inah12GnwekgRlNAEAzywEGK0VcrmeSUANklofjXJBQN5vPjgpgQOYAK5kuj8ZDAI1mo8lKcur8+tshsB7KVCZBAKteRtcQ7sVmPd4HMdEBsvB7szbvFx7H4GAAElx8AB+SKMRgiDjozKGNfQ1QjgB8FF4WGYsIqNHCkQAamRJzO5wAFY/lSYNPhmXe8O+kCBldiyVSeCBiVsMBdz4AAfaQ9BgJQwBgKAXkeA9sjiEcEIAXV3XdGCPE9n3CRdeC2WQjBMB9cLPOB1CsUD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/xVzsjXcCkFG6wXgm4RCejuyRJqV3Kg5ke6ID7iAOyA8qrxhHqQeq40RJTzarPeepCwqIGXhQSKa8hrEBGtQPeIAWAcC4HwTyp85pnxphfWIV81phBxqoh+0E9objvpraBp18EXRQaAjx0iegAKeoDF6ExblXHAVIjRPRfq7GeUA4GJxkFXQ+egzY9ygnLVdngwEhC0bEMkJjeE5CKw0yocTWhrBCT0IpqQFFDzfRGJ1k9RmXDxGsz4RzQR3MRHyjEQLFk9zvkOm8XWD2UtJSmiUSo5h6iKGaOdKrHRHo6nU0Mf6dhJLaCmMNpYk2Ni7EW0cc4m2biHaYMOttVlEt2Ucn8a2QJsMxyB1CeE9ucRon5xjvEpJG45BJxTrMNOaTM7nmzteSO2TyIvnyR+QpFd/yAVKSBcpDdoJN2qR3VuDx26d0wthHJFECJ0TmoXV1lE9w5UsCZR1PFsRlH4iVISxkTCiXEpJZ6skFJKVOKpdSthNInB0oBfShlhImW7iVXuzlOmDycr0/pUl1kdqGbgaqnUF7jPzJ3QK0Ax0gD4gJKIxa5pqIEIU3gAByatP5N1uDcElMQEgpBNWynUiagkj7mBXVYbKNTRKnmYEgUAOhCbHrwNjEAjxHhAA=="} import { type Config } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' declare module 'wagmi' { interface Register { config: Config } } // ---cut--- import { useConfig } from 'wagmi' function App() { const config = useConfig() // ^? } ``` ```ts [config.ts] // {"path":"/vercel/path0/site/react/api/hooks/useConfig.md","from":3583,"to":3899} import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' declare module 'wagmi' { interface Register { config: typeof config } } export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: --- --- url: /solid/api/primitives/useConfig.md description: Primitive for getting Wagmi Config. --- # useConfig Primitive for getting the current Wagmi [`Config`](/solid/api/createConfig#config). ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConfig.md","from":190,"to":231} import { useConfig } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useConfig.md","from":280,"to":370} import { useConfig } from '@wagmi/solid' function App() { const config = useConfig() } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConfig.md","from":442,"to":531} import { useConfig } from '@wagmi/solid' useConfig.Parameters useConfig.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConfig.md","from":616,"to":663} useConfig(() => ({ config: customConfig, })) ``` ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConfig.md","from":859,"to":922} import { useConfig } from '@wagmi/solid' useConfig.ReturnType ``` `Accessor` Returns an accessor containing the Wagmi Config. --- --- url: /vue/api/composables/useConfig.md description: Composable for getting `Config` from the `WagmiPlugin`. --- # useConfig Composable for getting [`Config`](/vue/api/createConfig#config) from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConfig.md","from":238,"to":272} import { useConfig } from 'wagmi' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useConfig.md","from":321,"to":418} ``` ::: ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConfig.md","from":450,"to":499} import { type UseConfigReturnType } from 'wagmi' ``` --- --- url: /react/api/hooks/useConnect.md description: Hook for connecting accounts with connectors. --- # useConnect Hook for connecting accounts with [connectors](/react/api/connectors). ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnect.md","from":588,"to":623} import { useConnect } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConnect.md","from":672,"to":916} import { useConnect } from 'wagmi' import { injected } from 'wagmi/connectors' function App() { const connect = useConnect() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnect.md","from":988,"to":1038} import { type UseConnectParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConnect.md","from":1246,"to":1417} import { useConnect } from 'wagmi' import { config } from './config' // [!code focus] function App() { const connect = useConnect({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnect.md","from":1536,"to":1586} import { type UseConnectReturnType } from 'wagmi' ``` ### connectors [deprecated](/react/guides/migrate-from-v2-to-v3#removed-useconnect-connectors-usereconnect-connectors) `readonly Connector[]` Globally configured connectors via [`createConfig`](/react/api/createConfig#connectors). Useful for rendering a list of available connectors. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConnect.md","from":1942,"to":2249} import { useConnect } from 'wagmi' function App() { const connect = useConnect() return (
{connect.connectors.map((connector) => ( ))}
) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ::: tip Not all connectors support connecting directly to a `chainId` (e.g. they don't support programmatic chain switching). In those cases, the connector will connect to whatever chain the connector's provider (e.g. wallet) is connected to. ::: ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`connect`](/core/api/actions/connect) --- --- url: /solid/api/primitives/useConnect.md description: Primitive for connecting accounts with connectors. --- # useConnect Primitive for connecting accounts with [connectors](/solid/api/connectors). ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnect.md","from":541,"to":583} import { useConnect } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useConnect.md","from":632,"to":893} import { useConnect } from '@wagmi/solid' import { injected } from '@wagmi/solid/connectors' function App() { const connect = useConnect() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnect.md","from":965,"to":1057} import { useConnect } from '@wagmi/solid' useConnect.Parameters useConnect.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnect.md","from":1142,"to":1201} useConnect(() => ({ config, // mutation options... })) ``` ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnect.md","from":1443,"to":1508} import { useConnect } from '@wagmi/solid' useConnect.ReturnType ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ::: tip Not all connectors support connecting directly to a `chainId` (e.g. they don't support programmatic chain switching). In those cases, the connector will connect to whatever chain the connector's provider (e.g. wallet) is connected to. ::: ## Action * [`connect`](/core/api/actions/connect) --- --- url: /vue/api/composables/useConnect.md description: Composable for connecting accounts with connectors. --- # useConnect Composable for connecting accounts with [connectors](/vue/api/connectors). ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConnect.md","from":603,"to":643} import { useConnect } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useConnect.md","from":692,"to":952} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConnect.md","from":1022,"to":1077} import { type UseConnectParameters } from '@wagmi/vue' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useConnect.md","from":1269,"to":1455} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConnect.md","from":1572,"to":1627} import { type UseConnectReturnType } from '@wagmi/vue' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ::: tip Not all connectors support connecting directly to a `chainId` (e.g. they don't support programmatic chain switching). In those cases, the connector will connect to whatever chain the connector's provider (e.g. wallet) is connected to. ::: ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`connect`](/core/api/actions/connect) --- --- url: /react/api/hooks/useConnection.md description: Hook for getting current connection. --- # useConnection Hook for getting current connection. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnection.md","from":152,"to":190} import { useConnection } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConnection.md","from":239,"to":334} import { useConnection } from 'wagmi' function App() { const connection = useConnection() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnection.md","from":406,"to":459} import { type UseConnectionParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConnection.md","from":667,"to":847} import { useConnection } from 'wagmi' import { config } from './config' // [!code focus] function App() { const connection = useConnection({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnection.md","from":920,"to":973} import { type UseConnectionReturnType } from 'wagmi' ``` ### address `Address | undefined` * Connected address from connector. * Defaults to first address in [`addresses`](#addresses). ### addresses `readonly Address[] | undefined` Connected addresses from connector. ### chain `Chain | undefined` Connected chain from connector. If chain is not configured by config, it will be `undefined`. ### chainId `number | undefined` Connected chain id from connector. ### connector `Connector | undefined` Connected connector. ### isConnecting / isReconnecting / isConnected / isDisconnected `boolean` Boolean variables derived from [`status`](#status). ### status `'connecting' | 'reconnecting' | 'connected' | 'disconnected'` * `'connecting'` attempting to establish connection. * `'reconnecting'` attempting to re-establish connection to one or more connectors. * `'connected'` at least one connector is connected. * `'disconnected'` no connection to any connector. ::: info You can use `status` to narrow the return type. For example, when `status` is `'connected'` properties like `address` are guaranteed to be defined. ```ts twoslash // @twoslash-cache: {"v":1,"hash":"70621ff7ba048810d10cff60e35c82126a2beb12177fb38b972d09b620d6367c","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAmbDBkbQEsWidgHEYaAMIsefQWABK4gK6kwAFWy4qbAIakGiACxUANjDABzNPiQBGAAxU0ei+KbTeAlpRAn+PJEcQRnw9HT4yJEMAXwp0TTxCEnInOgMQAAosUggcfQwASnZdNCU4YQAdECh+OC4ZGigq9gAfdir6zxgmkFb2kFJeD1lLZraO4YFRkB9dfTsAVlNzKxtEADYnFzdEEBKynz8AxCCQsIjyRFsF2PicROJI1Pp3Vg5O2SF2YAqwdn/2DooFBBnByuwAILA0FwADcvwBgOh8Dg8GEgyBLBMGHYyChIJRFHYADpSfiYcgALqU+F/AFnfzCCShfx9JRgWAAM383VpiIZYAAklBhGAlABbABGZD59MmEFITPlpFl/1qUm4XRF7DQpCUMFV7HVk38FmEnJ0JlRhtqABFah9GubLdaEQDaopHabnVaDW7/vtwRNNREerTorNnPMjABmZaWax2IJR1zpL3eUw8uxUM6kcI0S4AJlu1ASuwAjvrSBgfDQXrsuGxOCavj86f8gQSwcJySjDZ2YWj2BioFicXjkWCiaTib2wVSaf7OCywEyV2yOTBuTwoIaBcLRRLpSql46FUqQ2gFTa4BqGt1hLr9Te755vewLb6b/a6pMHx+XT9dsjTgT0TUsH1XWAwNKmCP8w1+CNtCjAxDDjXwVkTK5k22NMWzAQ4syuHNQjzC4kGLSkc2gXBdn4Tl2AydMwGJQN2AAXk49gAHJHW6biijbf5mN+USwDEiTxKkyTJKQkBxXEHQkFANJzDgOQ8DQBBomiIA==="} import { type GetConnectionReturnType } from '@wagmi/core' const connection = {} as GetConnectionReturnType // ---cut--- if (connection.status === 'connected') { connection // ^? } ``` Or when status is `'disconnected'` properties like `address` are guaranteed to be `undefined`: ```ts twoslash // @twoslash-cache: {"v":1,"hash":"03f1cafa2983888b08080373baa176953254622dd97feb972d42875fedc5dd86","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAmbDBkbQEsWidgHEYaAMIsefQWABK4gK6kwAFWy4qbAIakGiACxUANjDABzNPiQBGAAxU0ei+KbTeAlpRAn+PJEcQRnw9HT4yJEMAXwp0TTxCEnInOgMQAAosUggcfQwASnZdNCU4YQAdECh+OC4ZGigq9gAfdir6zxgmkFb2kFJeD1lLZraO4YFRkB9dfTsAVlNzKxtEADYnFzdEEBKynz8AxCCQsIjyRFsF2PicROJI1Pp3Vg5O2SF2YAqwdn/2DooFBBnByuwlGBYAAzfzdADcvwBgOBoLg8GEkJhcKgiL+ALO/kxUJgsJ4uKRBNC/gAklBidjyXjkR80BBSAzSTjmQDalJuF16exoToTOief9aopWf4LMIRWKYBL2HzJrL5aLxZTJXAACK1VndYRoUhKJXa4rOUrgqo1OqTbpVPHRWbOeZGTa+FbWOxBN2udIy7ymOF2KhnUjhGiXABMt2oCV2AEczaQMD4aC9dlw2Jw1V8fvj/kCQfBwViuUyLSW0RiISSyQiLYSwJzGxSi5xqWA6W3uc3Juy+1XO6qBREhQqtaO4NK1ZYNYrlWOGurhZrzTP9fbx41jabN8j9jbqgaHT1na69AZDJ6zJYfVc/dtA/mwIdQ1dw6FIxckHGAF1w2gXBdn4aF2AyIMwAAOmPdgAF4kPYAByO1DSgFCikLf5oN+fCwAIojCJI4jiJdKgAFtxB0JBQDScw4DkPA0AQaJoiAA"} import { type GetConnectionReturnType } from '@wagmi/core' const connection = {} as GetConnectionReturnType // ---cut--- if (connection.status === 'disconnected') { connection // ^? } ``` ::: ## Action * [`getConnection`](/core/api/actions/getConnection) --- --- url: /solid/api/primitives/useConnection.md description: Primitive for getting current connection. --- # useConnection Primitive for getting current connection. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnection.md","from":162,"to":207} import { useConnection } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useConnection.md","from":256,"to":580} import { useConnection } from '@wagmi/solid' import { Show } from 'solid-js' function App() { const connection = useConnection() return ( Not connected

}>

Address: {connection.address}

Chain ID: {connection.chainId}

) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnection.md","from":652,"to":753} import { useConnection } from '@wagmi/solid' useConnection.Parameters useConnection.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnection.md","from":838,"to":875} useConnection(() => ({ config, })) ``` ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnection.md","from":1071,"to":1142} import { useConnection } from '@wagmi/solid' useConnection.ReturnType ``` ### address `Address | undefined` The connected account address. ### addresses `readonly Address[] | undefined` All connected account addresses. ### chain `Chain | undefined` The connected chain. ### chainId `number | undefined` The connected chain ID. ### connector `Connector | undefined` The active connector. ### isConnected `boolean` Whether an account is connected. ### isConnecting `boolean` Whether a connection is in progress. ### isDisconnected `boolean` Whether the account is disconnected. ### isReconnecting `boolean` Whether a reconnection is in progress. ### status `'connected' | 'connecting' | 'disconnected' | 'reconnecting'` The current connection status. ## Action * [`getConnection`](/core/api/actions/getConnection) --- --- url: /vue/api/composables/useConnection.md description: Composable for getting current connection. --- # useConnection Composable for getting current connection. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConnection.md","from":164,"to":207} import { useConnection } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue twoslash [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useConnection.md","from":265,"to":3520} // @twoslash-cache: {"v":1,"hash":"13c71d856a5988592573d4377882b1c1fa1e1a07a6da8a54925e9753a897fb69","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAIAzAK5gAxmnYQwvQXBgBhSWBhiJYADwjJ/dgHNedGmChxeCsNr0BeU1t1rSMZlEmsMvVAB0pvHwCNWECIA1gCitFgBDqRwiLzAXj6JiQ5OLm6w/MyCrGix8d5JhbwpzmCuvGDMALYwsR4gIWj4ZHAizGD1ANwJRYUladKkrHUEaGhYMQD0kzBNLW1gAHQSXT29yY6l5cxY7ACqQyP4YxOI0zvsi7PN0QvLEJMXqwWFAL7dL+9rvP6BQQAq7BqsQAjAAmAAMUI+SU0YDQpGYYhicW+SX6ZTcMDA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V1WdXHZqoQSbMbkOvZEUDkgGtacpKiA+TDuBqOsEqoy4pWgP3EAahWhRywFJWQ3EsC8FYO0HQlh6gg3qKJfEPSV1xD6X2yQ9KBCpN4AAcgAAJjIAlMmAzGvBeHeRVOjUhrBHJaYwbgXg1CTEw+wbDFGJM0CsoRmgFGfAAEExWqLiMAATxzXKLGtfS14EnJgKYiMbGAP6QCXmYEgUABgobxVUsZXArxXhAA"} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts twoslash // {"path":"/vercel/path0/site/vue/api/composables/useConnection.md","from":3599,"to":4137} // @twoslash-cache: {"v":1,"hash":"7e300c04b97782c39df43713d56b7a3f066187bfbb69ba67cfe1b4d60e143b11","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAKpwYAYQhgwMAMZp2kgArNSzALYwapOAB4ZkgGbsA5rzo0wUOLwlgjpgLw3DJgHy8nwADphef3vp2JgD8iAEupgA+zkFRvACuljBG0lAA3D4Avj7salgQpGjCorbScgpgyqoaWghUcGgqDIgAjAAsVKwwYMZo+EgATADMVI2kxpp4IuKSZfJKKuqaZHUgHNJIAAxUMviLcmRI7ZkAujvQuIggufmFvMD82DDFM1Ky85WLNSu8mbwGpAgal4AHIAAIAd2YxjU7AA9ER4jAQZQQDVmEhQOZunAKng0AhMpkgA=="} import { type UseConnectionParameters } from '@wagmi/vue' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useConnection.md","from":4337,"to":4532} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts twoslash // {"path":"/vercel/path0/site/vue/api/composables/useConnection.md","from":4612,"to":5542} // @twoslash-cache: {"v":1,"hash":"b6f1971287fb7adb77e1a5d5dc952329e6dd516b560ac655f5064dcb9d4b925c","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808AKAQwBsBLZuASgAJMcvAKpwYAYQhgwMAMZp2kgEow0AV1JgAKthgAeGZIBm7AOa86NMFDi8JYY2YC8to6YB8vZ5ojLDcXcAAOmC8obzMUFCk8HCIvKpWMMbSUADcwWHhkdFworHxickwaRlhMvjM7GBxCbBFJSFlFVUAklA1hVXF6Y2hBlKyaBCkHXVdDZnscHbScsVxhmyiPZNwyv2z8mAmC0swK2FTM4NVO7yLrMuloVMAIlMbg/P8pKr717xwaMxq+YEgUAekk2xX+PQAvh4AD68by+fxBXpZKIxOIAQWyMQOoQiKNy8Di0QiklYGF4yAxeLgFF4ADp6ZScnBkABdFnY3jlSrVXiMOwOcz0GBWGz9AUAflszRCcTFpmQ/y5VTg/xZyDAqgAtgAjMgsvgw2pJcYcpVgNpxDU6sim4GDYZxY5yYYco52ubtF5vV3Td1bM4XK5Iu5AgYe3aXd7BtayP2nCNBzJfH6qP4gR4esHBSG8GFwpL+em06GwnwF3RFtzBdiarDDNDCURO+RKFTqLQ6SggZOkBiIACMABYqKxhSY0PgkAAmADMVG+pBMKjwInEcdbag02hwXY40iQAAYqFzSMw5uQB4PwSzj9BcIgQDW673eMB+DpG2uwy2wMpNx3BHBc5SAgTVeAAcgAAQAd2YExNXYAB6Ig3nArtNRUZgkFACxhTgBQwDwNAEHBcEgA=="} import { type UseConnectionReturnType } from '@wagmi/vue' ``` ### address `Address | undefined` * Connected address from connector. * Defaults to first address in [`addresses`](#addresses). ### addresses `readonly Address[] | undefined` Connected addresses from connector. ### chain `Chain | undefined` Connected chain from connector. If chain is not configured by config, it will be `undefined`. ### chainId `number | undefined` Connected chain id from connector. ### connector `Connector | undefined` Connected connector. ### isConnecting / isReconnecting / isConnected / isDisconnected `boolean` Boolean variables derived from [`status`](#status). ### status `'connecting' | 'reconnecting' | 'connected' | 'disconnected'` * `'connecting'` attempting to establish connection. * `'reconnecting'` attempting to re-establish connection to one or more connectors. * `'connected'` at least one connector is connected. * `'disconnected'` no connection to any connector. ::: info You can use `status` to narrow the return type. For example, when `status` is `'connected'` properties like `address` are guaranteed to be defined. ```ts twoslash // @twoslash-cache: {"v":1,"hash":"70621ff7ba048810d10cff60e35c82126a2beb12177fb38b972d09b620d6367c","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAmbDBkbQEsWidgHEYaAMIsefQWABK4gK6kwAFWy4qbAIakGiACxUANjDABzNPiQBGAAxU0ei+KbTeAlpRAn+PJEcQRnw9HT4yJEMAXwp0TTxCEnInOgMQAAosUggcfQwASnZdNCU4YQAdECh+OC4ZGigq9gAfdir6zxgmkFb2kFJeD1lLZraO4YFRkB9dfTsAVlNzKxtEADYnFzdEEBKynz8AxCCQsIjyRFsF2PicROJI1Pp3Vg5O2SF2YAqwdn/2DooFBBnByuwAILA0FwADcvwBgOh8Dg8GEgyBLBMGHYyChIJRFHYADpSfiYcgALqU+F/AFnfzCCShfx9JRgWAAM383VpiIZYAAklBhGAlABbABGZD59MmEFITPlpFl/1qUm4XRF7DQpCUMFV7HVk38FmEnJ0JlRhtqABFah9GubLdaEQDaopHabnVaDW7/vtwRNNREerTorNnPMjABmZaWax2IJR1zpL3eUw8uxUM6kcI0S4AJlu1ASuwAjvrSBgfDQXrsuGxOCavj86f8gQSwcJySjDZ2YWj2BioFicXjkWCiaTib2wVSaf7OCywEyV2yOTBuTwoIaBcLRRLpSql46FUqQ2gFTa4BqGt1hLr9Te755vewLb6b/a6pMHx+XT9dsjTgT0TUsH1XWAwNKmCP8w1+CNtCjAxDDjXwVkTK5k22NMWzAQ4syuHNQjzC4kGLSkc2gXBdn4Tl2AydMwGJQN2AAXk49gAHJHW6biijbf5mN+USwDEiTxKkyTJKQkBxXEHQkFANJzDgOQ8DQBBomiIA==="} import { type GetConnectionReturnType } from '@wagmi/core' const connection = {} as GetConnectionReturnType // ---cut--- if (connection.status === 'connected') { connection // ^? } ``` Or when status is `'disconnected'` properties like `address` are guaranteed to be `undefined`: ```ts twoslash // @twoslash-cache: {"v":1,"hash":"03f1cafa2983888b08080373baa176953254622dd97feb972d42875fedc5dd86","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAmbDBkbQEsWidgHEYaAMIsefQWABK4gK6kwAFWy4qbAIakGiACxUANjDABzNPiQBGAAxU0ei+KbTeAlpRAn+PJEcQRnw9HT4yJEMAXwp0TTxCEnInOgMQAAosUggcfQwASnZdNCU4YQAdECh+OC4ZGigq9gAfdir6zxgmkFb2kFJeD1lLZraO4YFRkB9dfTsAVlNzKxtEADYnFzdEEBKynz8AxCCQsIjyRFsF2PicROJI1Pp3Vg5O2SF2YAqwdn/2DooFBBnByuwlGBYAAzfzdADcvwBgOBoLg8GEkJhcKgiL+ALO/kxUJgsJ4uKRBNC/gAklBidjyXjkR80BBSAzSTjmQDalJuF16exoToTOief9aopWf4LMIRWKYBL2HzJrL5aLxZTJXAACK1VndYRoUhKJXa4rOUrgqo1OqTbpVPHRWbOeZGTa+FbWOxBN2udIy7ymOF2KhnUjhGiXABMt2oCV2AEczaQMD4aC9dlw2Jw1V8fvj/kCQfBwViuUyLSW0RiISSyQiLYSwJzGxSi5xqWA6W3uc3Juy+1XO6qBREhQqtaO4NK1ZYNYrlWOGurhZrzTP9fbx41jabN8j9jbqgaHT1na69AZDJ6zJYfVc/dtA/mwIdQ1dw6FIxckHGAF1w2gXBdn4aF2AyIMwAAOmPdgAF4kPYAByO1DSgFCikLf5oN+fCwAIojCJI4jiJdKgAFtxB0JBQDScw4DkPA0AQaJoiAA"} import { type GetConnectionReturnType } from '@wagmi/core' const connection = {} as GetConnectionReturnType // ---cut--- if (connection.status === 'disconnected') { connection // ^? } ``` ::: ## Action * [`getConnection`](/core/api/actions/getConnection) --- --- url: /react/api/hooks/useConnectionEffect.md description: Hook for listening to connection lifecycle events. --- # useConnectionEffect Hook for listening to connection lifecycle events. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnectionEffect.md","from":192,"to":236} import { useConnectionEffect } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConnectionEffect.md","from":285,"to":508} import { useConnectionEffect } from 'wagmi' function App() { useConnectionEffect({ onConnect(data) { console.log('Connected!', data) }, onDisconnect() { console.log('Disconnected!') }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnectionEffect.md","from":580,"to":639} import { type UseConnectionEffectParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConnectionEffect.md","from":847,"to":1150} import { useConnectionEffect } from 'wagmi' import { config } from './config' // [!code focus] function App() { useConnectionEffect({ config, // [!code focus] onConnect(data) { console.log('Connected!', data) }, onDisconnect() { console.log('Disconnected!') }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onConnect ``((data: { address: `0x${string}`; addresses: readonly [`0x${string}`, ...`0x${string}`[]]; chain: Chain | undefined chainId: number; connector: Connector; isReconnected: boolean }) => void) | undefined`` Callback that is called when connection is made. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConnectionEffect.md","from":1509,"to":1720} import { useConnectionEffect } from 'wagmi' function App() { useConnectionEffect({ onConnect(data) { // [!code focus] console.log('Connected!', data) // [!code focus] }, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onDisconnect `(() => void) | undefined` Callback that is called when there no more connections. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConnectionEffect.md","from":1908,"to":2115} import { useConnectionEffect } from 'wagmi' function App() { useConnectionEffect({ onDisconnect() { // [!code focus] console.log('Disconnected!') // [!code focus] }, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Action * [`getConnection`](/core/api/actions/getConnection) * [`watchConnection`](/core/api/actions/watchConnection) --- --- url: /solid/api/primitives/useConnectionEffect.md description: Primitive for reacting to connection state changes. --- # useConnectionEffect Primitive for reacting to connection state changes. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnectionEffect.md","from":194,"to":245} import { useConnectionEffect } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useConnectionEffect.md","from":294,"to":557} import { useConnectionEffect } from '@wagmi/solid' function App() { useConnectionEffect(() => ({ onConnect(data) { console.log('Connected!', data) }, onDisconnect() { console.log('Disconnected!') }, })) return
...
} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnectionEffect.md","from":629,"to":748} import { useConnectionEffect } from '@wagmi/solid' useConnectionEffect.Parameters useConnectionEffect.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnectionEffect.md","from":833,"to":931} useConnectionEffect(() => ({ onConnect(data) { /* ... */ }, onDisconnect() { /* ... */ }, })) ``` ### onConnect `((data: { address: Address; addresses: readonly Address[]; chain: Chain | undefined; chainId: number; connector: Connector; isReconnected: boolean }) => void) | undefined` Callback that is called when accounts are connected. ### onDisconnect `(() => void) | undefined` Callback that is called when no more accounts are connected. ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnectionEffect.md","from":1478,"to":1561} import { useConnectionEffect } from '@wagmi/solid' useConnectionEffect.ReturnType ``` `void` ## Action * [`watchConnection`](/core/api/actions/watchConnection) --- --- url: /vue/api/composables/useConnectionEffect.md description: Composable for listening to connection lifecycle events. --- # useConnectionEffect Composable for listening to connection lifecycle events. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConnectionEffect.md","from":204,"to":253} import { useConnectionEffect } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useConnectionEffect.md","from":302,"to":530} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConnectionEffect.md","from":600,"to":664} import { type useConnectionEffectParameters } from '@wagmi/vue' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useConnectionEffect.md","from":856,"to":1162} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onConnect ``MaybeRef<((data: { address: `0x${string}`; addresses: readonly [`0x${string}`, ...`0x${string}`[]]; chain: Chain | undefined chainId: number; connector: Connector; isReconnected: boolean }) => void)> | undefined`` Callback that is called when connection is made. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/vue/api/composables/useConnectionEffect.md","from":1529,"to":1745} import { useConnectionEffect } from '@wagmi/vue' function App() { useConnectionEffect({ onConnect(data) { // [!code focus] console.log('Connected!', data) // [!code focus] }, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onDisconnect `MaybeRef<(() => void)> | undefined` Callback that is called when there no more connections. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/vue/api/composables/useConnectionEffect.md","from":1941,"to":2153} import { useConnectionEffect } from '@wagmi/vue' function App() { useConnectionEffect({ onDisconnect() { // [!code focus] console.log('Disconnected!') // [!code focus] }, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Action * [`getConnection`](/core/api/actions/getConnection) * [`watchConnection`](/core/api/actions/watchConnection) --- --- url: /react/api/hooks/useConnections.md description: Hook for getting active connections. --- # useConnections Hook for getting active connections. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnections.md","from":154,"to":193} import { useConnections } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConnections.md","from":242,"to":340} import { useConnections } from 'wagmi' function App() { const connections = useConnections() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnections.md","from":412,"to":466} import { type UseConnectionsParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConnections.md","from":674,"to":857} import { useConnections } from 'wagmi' import { config } from './config' // [!code focus] function App() { const connections = useConnections({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnections.md","from":930,"to":984} import { type UseConnectionsReturnType } from 'wagmi' ``` ## Action * [`getConnections`](/core/api/actions/getConnections) * [`watchConnections`](/core/api/actions/watchConnections) --- --- url: /solid/api/primitives/useConnections.md description: Primitive for getting all active connections. --- # useConnections Primitive for getting all active connections. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnections.md","from":172,"to":218} import { useConnections } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useConnections.md","from":267,"to":621} import { useConnections } from '@wagmi/solid' import { For } from 'solid-js' function App() { const connections = useConnections() return (
    {(connection) => (
  • {connection.connector.name}: {connection.accounts[0]}
  • )}
) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnections.md","from":693,"to":797} import { useConnections } from '@wagmi/solid' useConnections.Parameters useConnections.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnections.md","from":882,"to":920} useConnections(() => ({ config, })) ``` ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnections.md","from":1116,"to":1189} import { useConnections } from '@wagmi/solid' useConnections.ReturnType ``` `Accessor` Returns an accessor containing all active connections. Each connection includes: * `accounts`: Connected account addresses * `chainId`: Connected chain ID * `connector`: The connector instance ## Action * [`getConnections`](/core/api/actions/getConnections) --- --- url: /vue/api/composables/useConnections.md description: Composable for getting active connections. --- # useConnections Composable for getting active connections. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConnections.md","from":166,"to":205} import { useConnections } from 'wagmi' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useConnections.md","from":254,"to":366} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConnections.md","from":436,"to":490} import { type UseConnectionsParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useConnections.md","from":682,"to":875} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConnections.md","from":946,"to":1000} import { type UseConnectionsReturnType } from 'wagmi' ``` ## Action * [`getConnections`](/core/api/actions/getConnections) * [`watchConnections`](/core/api/actions/watchConnections) --- --- url: /react/api/hooks/useConnectorClient.md description: Hook for getting a Viem `Client` object for the current or provided connector. --- # useConnectorClient Hook for getting a Viem [`Client`](https://viem.sh/docs/clients/custom) object for the current or provided connector. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnectorClient.md","from":534,"to":577} import { useConnectorClient } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConnectorClient.md","from":626,"to":727} import { useConnectorClient } from 'wagmi' function App() { const result = useConnectorClient() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnectorClient.md","from":799,"to":857} import { type UseConnectorClientParameters } from 'wagmi' ``` ### account `Address | Account | undefined` Account to use with client. Throws if account is not found on [`connector`](#connector). ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnectorClient.md","from":1004,"to":1186} import { useConnectorClient } from 'wagmi' function App() { const result = useConnectorClient({ account: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] }) } ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use with client. ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnectorClient.md","from":1289,"to":1437} import { useConnectorClient } from 'wagmi' function App() { const result = useConnectorClient({ chainId: mainnet.id, // [!code focus] }) } ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConnectorClient.md","from":1645,"to":1831} import { useConnectorClient } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useConnectorClient({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` * Connector to get client for. * Defaults to current connector. ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnectorClient.md","from":1993,"to":2219} import { useConnections, useConnectorClient } from 'wagmi' function App() { const connections = useConnections(config) const result = useConnectorClient({ connector: connections[0]?.connector, // [!code focus] }) } ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnectorClient.md","from":2289,"to":2347} import { type UseConnectorClientReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getConnectorClient`](/core/api/actions/getConnectorClient) --- --- url: /solid/api/primitives/useConnectorClient.md description: Primitive for getting Viem Wallet Client from the active connector. --- # useConnectorClient Primitive for getting a [Viem Wallet Client](https://viem.sh/docs/clients/wallet) from the active connector. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnectorClient.md","from":265,"to":315} import { useConnectorClient } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useConnectorClient.md","from":364,"to":530} import { useConnectorClient } from '@wagmi/solid' function App() { const client = useConnectorClient() // client() returns the Wallet Client when connected } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnectorClient.md","from":602,"to":718} import { useConnectorClient } from '@wagmi/solid' useConnectorClient.Parameters useConnectorClient.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnectorClient.md","from":803,"to":875} useConnectorClient(() => ({ chainId: 1, connector: myConnector, })) ``` ### account `Address | undefined` Account to use for the client. ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use for the client. ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). ### connector `Connector | undefined` Connector to get the client for. Defaults to the active connector. *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnectorClient.md","from":1385,"to":1466} import { useConnectorClient } from '@wagmi/solid' useConnectorClient.ReturnType ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getConnectorClient`](/core/api/actions/getConnectorClient) --- --- url: /vue/api/composables/useConnectorClient.md description: >- Composable for getting a Viem `Client` object for the current or provided connector. --- # useConnectorClient Composable for getting a Viem [`Client`](https://viem.sh/docs/clients/custom) object for the current or provided connector. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConnectorClient.md","from":551,"to":599} import { useConnectorClient } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useConnectorClient.md","from":648,"to":768} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConnectorClient.md","from":838,"to":901} import { type UseConnectorClientParameters } from '@wagmi/vue' ``` ### account `Address | Account | undefined` Account to use with client. Throws if account is not found on [`connector`](#connector). ```vue // {"path":"/vercel/path0/site/vue/api/composables/useConnectorClient.md","from":1049,"to":1246} ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use with client. ```vue // {"path":"/vercel/path0/site/vue/api/composables/useConnectorClient.md","from":1350,"to":1513} ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useConnectorClient.md","from":1721,"to":1922} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` * Connector to get client for. * Defaults to current connector. ```vue // {"path":"/vercel/path0/site/vue/api/composables/useConnectorClient.md","from":2083,"to":2322} ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConnectorClient.md","from":2392,"to":2455} import { type UseConnectorClientReturnType } from '@wagmi/vue' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getConnectorClient`](/core/api/actions/getConnectorClient) --- --- url: /react/api/hooks/useConnectors.md description: Hook for getting configured connectors. --- # useConnectors Hook for getting configured connectors. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnectors.md","from":158,"to":196} import { useConnectors } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useConnectors.md","from":245,"to":340} import { useConnectors } from 'wagmi' function App() { const connectors = useConnectors() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useConnectors.md","from":413,"to":466} import { type UseConnectorsReturnType } from 'wagmi' ``` `readonly Connector[]` Connectors from [`config.connectors`](/react/api/createConfig#connectors-1). ## Action * [`getConnectors`](/core/api/actions/getConnectors) --- --- url: /solid/api/primitives/useConnectors.md description: Primitive for getting configured connectors. --- # useConnectors Primitive for getting configured connectors. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnectors.md","from":168,"to":213} import { useConnectors } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useConnectors.md","from":262,"to":708} import { useConnect, useConnectors } from '@wagmi/solid' import { For } from 'solid-js' function App() { const connectors = useConnectors() const connect = useConnect() return (
    {(connector) => (
  • )}
) } ``` ```ts [config.ts] // {"path":"/vercel/path0/site/solid/api/primitives/useConnectors.md","from":730,"to":1110} import { http, createConfig } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' import { injected, walletConnect } from '@wagmi/solid/connectors' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected(), walletConnect({ projectId: '...' })], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnectors.md","from":1140,"to":1241} import { useConnectors } from '@wagmi/solid' useConnectors.Parameters useConnectors.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnectors.md","from":1326,"to":1363} useConnectors(() => ({ config, })) ``` ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useConnectors.md","from":1559,"to":1630} import { useConnectors } from '@wagmi/solid' useConnectors.ReturnType ``` `Accessor` Returns an accessor containing all configured connectors. ## Action * [`getConnectors`](/core/api/actions/getConnectors) --- --- url: /vue/api/composables/useConnectors.md description: Composable for getting configured connectors. --- # useConnectors Composable for getting configured connectors. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConnectors.md","from":170,"to":213} import { useConnectors } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useConnectors.md","from":262,"to":376} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useConnectors.md","from":447,"to":505} import { type UseConnectorsReturnType } from '@wagmi/vue' ``` `readonly Connector[]` Connectors from [`config.connectors`](/vue/api/createConfig#connectors-1). ## Action * [`getConnectors`](/core/api/actions/getConnectors) --- --- url: /react/api/hooks/useContractEvents.md description: >- Hook that fetches a list of contract event logs matching the provided parameters. --- # useContractEvents Hook that fetches a list of contract event logs matching the provided parameters. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":250,"to":292} import { useContractEvents } from 'wagmi' ``` ## Usage By default, `useContractEvents` returns all matched events on the ABI. In practice, you must use scoping to filter for specific events. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":478,"to":677} import { useContractEvents } from 'wagmi' import { abi } from './abi' function App() { // Fetch event logs for every event on every ERC-20 contract. const result = useContractEvents({ abi }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":785,"to":842} import { type UseContractEventsParameters } from 'wagmi' ``` ### abi `Abi` The contract's ABI. Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":1060,"to":1217} import { useContractEvents } from 'wagmi' import { abi } from './abi' function App() { const result = useContractEvents({ abi, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### address `Address | undefined` The contract's address. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":1399,"to":1616} import { useContractEvents } from 'wagmi' import { abi } from './abi' function App() { const result = useContractEvents({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', // [!code focus] abi, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### args `object | readonly unknown[] | undefined` * Logs can be scoped to given indexed arguments. * Inferred from [`abi`](#abi) and [`eventName`](#eventname). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":1901,"to":2268} import { useContractEvents } from 'wagmi' import { abi } from './abi' function App() { const result = useContractEvents({ abi, eventName: 'Transfer', args: { // [!code focus] from: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045', // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B' // [!code focus] } // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` Only indexed arguments in `event` are candidates for `args`. An argument can also be an array to indicate that other values can exist in the position: ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":2542,"to":3054} import { useContractEvents } from 'wagmi' import { abi } from './abi' function App() { const result = useContractEvents({ abi, eventName: 'Transfer', args: { from: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045', to: [ // [!code focus] '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] '0xa5cc3c03994db5b0d9a5eedd10cabab0813678ac', // [!code focus] '0xa152f8bb749c55e9943a3a0a3111d18ee2b3f94e', // [!code focus] ], // [!code focus] } }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockHash `` `0x${string}` | undefined `` * Block hash to include logs from. Mutually exclusive with `fromBlock`/`toBlock`. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":3307,"to":3550} import { useContractEvents } from 'wagmi' import { abi } from './abi' function App() { const result = useContractEvents({ abi, blockHash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":3770,"to":3998} import { useContractEvents } from 'wagmi' import { mainnet } from '@wagmi/core/chains' import { abi } from './abi' function App() { const result = useContractEvents({ abi, chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":4288,"to":4492} import { useContractEvents } from 'wagmi' import { abi } from './abi' import { config } from './config' function App() { const result = useContractEvents({ abi, config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### eventName `string | undefined` * Event to filter for the contract. * Inferred from [`abi`](#abi). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":4718,"to":4937} import { useContractEvents } from 'wagmi' import { abi } from './abi' import { config } from './config' function App() { const result = useContractEvents({ abi, eventName: 'Transfer', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### fromBlock `bigint | 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` * Block to start including logs from. Mutually exclusive with `blockHash`. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":5230,"to":5445} import { useContractEvents } from 'wagmi' import { abi } from './abi' import { config } from './config' function App() { const result = useContractEvents({ abi, fromBlock: 69420n, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### strict `boolean | undefined` * Flag to only return logs that conform to the indexed & non-indexed arguments on the `event`, meaning that `args` will always be defined. Defaults to `false`. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":5762,"to":5972} import { useContractEvents } from 'wagmi' import { abi } from './abi' import { config } from './config' function App() { const result = useContractEvents({ abi, strict: true, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### toBlock `bigint | 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` * Block to stop including logs from. Mutually exclusive with `blockHash`. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":6262,"to":6475} import { useContractEvents } from 'wagmi' import { abi } from './abi' import { config } from './config' function App() { const result = useContractEvents({ abi, toBlock: 70120n, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useContractEvents.md","from":6584,"to":6641} import { type UseContractEventsReturnType } from 'wagmi' ``` A list of event logs. ## Action * [`getContractEvents`](/core/api/actions/getContractEvents) --- --- url: /react/api/hooks/useDeployContract.md description: >- Hook for deploying a contract to the network, given bytecode & constructor arguments. --- # useDeployContract Hook for deploying a contract to the network, given bytecode, and constructor arguments. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useDeployContract.md","from":561,"to":603} import { useDeployContract } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useDeployContract.md","from":652,"to":1077} import { useDeployContract } from 'wagmi' import { parseEther } from 'viem' import { wagmiAbi } from './abi' function App() { const deployContract = useDeployContract() return ( ) } ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/react/api/hooks/useDeployContract.md","from":1096,"to":1230} export const wagmiAbi = [ ... { inputs: [], stateMutability: "nonpayable", type: "constructor", }, ... ] as const ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Deploying with Constructor Args ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useDeployContract.md","from":1351,"to":1801} import { useDeployContract } from 'wagmi' import { parseEther } from 'viem' import { wagmiAbi } from './abi' function App() { const deployContract = useDeployContract() return ( ) } ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/react/api/hooks/useDeployContract.md","from":1820,"to":1984} export const wagmiAbi = [ ... { inputs: [{ name: "x", type: "uint32" }], stateMutability: "nonpayable", type: "constructor", }, ... ] as const; ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useDeployContract.md","from":2056,"to":2113} import { type useDeployContractParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useDeployContract.md","from":2321,"to":2513} import { useDeployContract } from 'wagmi' import { config } from './config' // [!code focus] function App() { const deployContract = useDeployContract({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useDeployContract.md","from":2632,"to":2689} import { type useDeployContractReturnType } from 'wagmi' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`deployContract`](/core/api/actions/deployContract) --- --- url: /react/api/hooks/useDisconnect.md description: Hook for disconnecting connections. --- # useDisconnect Hook for disconnecting connections. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useDisconnect.md","from":412,"to":450} import { useDisconnect } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useDisconnect.md","from":499,"to":689} import { useDisconnect } from 'wagmi' function App() { const disconnect = useDisconnect() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useDisconnect.md","from":761,"to":814} import { type UseDisconnectParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useDisconnect.md","from":1022,"to":1198} import { useDisconnect } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useDisconnect({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useDisconnect.md","from":1317,"to":1370} import { type UseDisconnectReturnType } from 'wagmi' ``` ### connectors [deprecated](/react/guides/migrate-from-v2-to-v3#removed-usedisconnect-connectors-useswitchconnection-connectors) `readonly Connector[]` Connectors that are currently connected. Useful for rendering a list of connectors to disconnect. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useDisconnect.md","from":1692,"to":2094} import { useConnectors, useDisconnect } from 'wagmi' import { mainnet } from 'wagmi/chains' function App() { const disconnect = useDisconnect() const connectors = useConnectors() return (
{connectors.map((connector) => ( ))}
) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`disconnect`](/core/api/actions/disconnect) --- --- url: /solid/api/primitives/useDisconnect.md description: Primitive for disconnecting connections. --- # useDisconnect Primitive for disconnecting connections. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useDisconnect.md","from":401,"to":446} import { useDisconnect } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useDisconnect.md","from":495,"to":695} import { useDisconnect } from '@wagmi/solid' function App() { const disconnect = useDisconnect() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useDisconnect.md","from":767,"to":868} import { useDisconnect } from '@wagmi/solid' useDisconnect.Parameters useDisconnect.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useDisconnect.md","from":953,"to":1015} useDisconnect(() => ({ config, // mutation options... })) ``` ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useDisconnect.md","from":1257,"to":1328} import { useDisconnect } from '@wagmi/solid' useDisconnect.ReturnType ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`disconnect`](/core/api/actions/disconnect) --- --- url: /vue/api/composables/useDisconnect.md description: Composable for disconnecting connections. --- # useDisconnect Composable for disconnecting connections. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useDisconnect.md","from":429,"to":472} import { useDisconnect } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useDisconnect.md","from":521,"to":726} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useDisconnect.md","from":796,"to":854} import { type UseDisconnectParameters } from '@wagmi/vue' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useDisconnect.md","from":1046,"to":1241} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useDisconnect.md","from":1358,"to":1416} import { type UseDisconnectReturnType } from '@wagmi/vue' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`disconnect`](/core/api/actions/connect) --- --- url: /react/api/hooks/useEnsAddress.md description: Hook for fetching ENS address for name. --- # useEnsAddress Hook for fetching ENS address for name. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsAddress.md","from":343,"to":381} import { useEnsAddress } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAddress.md","from":430,"to":596} import { useEnsAddress } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsAddress({ name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: warning Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `useEnsAddress`. You can use Viem's built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsAddress.md","from":1123,"to":1176} import { type UseEnsAddressParameters } from 'wagmi' ``` *** ### blockNumber `bigint | undefined` Block number to get ENS address at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAddress.md","from":1294,"to":1505} import { useEnsAddress } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsAddress({ blockNumber: 17829139n, // [!code focus] name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get ENS address at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAddress.md","from":1708,"to":1915} import { useEnsAddress } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsAddress({ name: normalize('wevm.eth'), blockTag: 'latest', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAddress.md","from":2104,"to":2368} import { useEnsAddress } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] import { normalize } from 'viem/ens' function App() { const result = useEnsAddress({ chainId: mainnet.id, // [!code focus] name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### coinType `number | undefined` The [ENSIP-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution) coin type to fetch the address for. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAddress.md","from":2628,"to":2829} import { useEnsAddress } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsAddress({ coinType: 60, // [!code focus] name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAddress.md","from":3083,"to":3329} import { useEnsAddress } from 'wagmi' import { normalize } from 'viem/ens' import { config } from './config' // [!code focus] function App() { const result = useEnsAddress({ config, // [!code focus] name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### name `string | undefined` Name to get the address for. [`enabled`](#enabled) set to `false` if `name` is `undefined`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAddress.md","from":3537,"to":3720} import { useEnsAddress } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsAddress({ name: normalize('wevm.eth'), // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAddress.md","from":3938,"to":4142} import { useEnsAddress } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsAddress({ name: normalize('wevm.eth'), scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### universalResolverAddress `Address | undefined` * Address of ENS Universal Resolver Contract. * Defaults to current chain's Universal Resolver Contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAddress.md","from":4392,"to":4651} import { useEnsAddress } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsAddress({ name: normalize('wevm.eth'), universalResolverAddress: '0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsAddress.md","from":4767,"to":4820} import { type UseEnsAddressReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getEnsAddress`](/core/api/actions/getEnsAddress) --- --- url: /vue/api/composables/useEnsAddress.md description: Composable for fetching ENS address for name. --- # useEnsAddress Composable for fetching ENS address for name. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useEnsAddress.md","from":360,"to":403} import { useEnsAddress } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAddress.md","from":452,"to":633} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: warning Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `useEnsAddress`. You can use Viem's built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useEnsAddress.md","from":1158,"to":1216} import { type UseEnsAddressParameters } from '@wagmi/vue' ``` *** ### blockNumber `bigint | undefined` Block number to get ENS address at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAddress.md","from":1336,"to":1560} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get ENS address at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAddress.md","from":1763,"to":1983} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAddress.md","from":2170,"to":2452} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### coinType `number | undefined` The [ENSIP-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution) coin type to fetch the address for. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAddress.md","from":2712,"to":2926} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAddress.md","from":3162,"to":3421} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### name `string | undefined` Name to get the address for. [`enabled`](#enabled) set to `false` if `name` is `undefined`. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAddress.md","from":3629,"to":3827} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Composables that have identical context will share the same cache. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAddress.md","from":4051,"to":4268} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### universalResolverAddress `Address | undefined` * Address of ENS Universal Resolver Contract. * Defaults to current chain's Universal Resolver Contract address. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAddress.md","from":4518,"to":4790} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useEnsAddress.md","from":4904,"to":4962} import { type UseEnsAddressReturnType } from '@wagmi/vue' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getEnsAddress`](/core/api/actions/getEnsAddress) --- --- url: /react/api/hooks/useEnsAvatar.md description: Hook for fetching ENS avatar for name. --- # useEnsAvatar Hook for fetching ENS avatar for name. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsAvatar.md","from":343,"to":380} import { useEnsAvatar } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAvatar.md","from":429,"to":593} import { useEnsAvatar } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsAvatar({ name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: warning Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `useEnsAvatar`. You can use Viem's built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsAvatar.md","from":1119,"to":1171} import { type UseEnsAvatarParameters } from 'wagmi' ``` *** ### assetGatewayUrls `{ ipfs?: string | undefined; arweave?: string | undefined } | undefined` Gateway urls to resolve IPFS and/or Arweave assets. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAvatar.md","from":1393,"to":1722} import { getEnsAvatar } from '@wagmi/core' import { normalize } from 'viem/ens' import { config } from './config' function App() { const result = useEnsAvatar({ assetGatewayUrls: { // [!code focus] ipfs: 'https://cloudflare-ipfs.com', // [!code focus] }, // [!code focus] name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` Block number to get ENS avatar at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAvatar.md","from":1880,"to":2089} import { useEnsAvatar } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsAvatar({ blockNumber: 17829139n, // [!code focus] name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get ENS avatar at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAvatar.md","from":2291,"to":2496} import { useEnsAvatar } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsAvatar({ name: normalize('wevm.eth'), blockTag: 'latest', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAvatar.md","from":2685,"to":2948} import { useEnsAvatar } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] import { normalize } from 'viem/ens' function App() { const result = useEnsAvatar({ chainId: mainnet.id, // [!code focus], name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAvatar.md","from":3202,"to":3446} import { useEnsAvatar } from 'wagmi' import { normalize } from 'viem/ens' import { config } from './config' // [!code focus] function App() { const result = useEnsAvatar({ config, // [!code focus] name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gatewayUrls `string[] | undefined` A set of Universal Resolver gateways, used for resolving CCIP-Read requests made through the ENS Universal Resolver Contract. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAvatar.md","from":3697,"to":3929} import { useEnsAvatar } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsAvatar({ gatewayUrls: ['https://cloudflare-ipfs.com'] { // [!code focus] name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### name `string | undefined` Name to get the avatar for. [`enabled`](#enabled) set to `false` if `name` is `undefined`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAvatar.md","from":4136,"to":4317} import { useEnsAvatar } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsAvatar({ name: normalize('wevm.eth'), // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAvatar.md","from":4535,"to":4737} import { useEnsAvatar } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsAvatar({ name: normalize('wevm.eth'), scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### universalResolverAddress `Address | undefined` * Address of ENS Universal Resolver Contract. * Defaults to current chain's Universal Resolver Contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsAvatar.md","from":4987,"to":5244} import { useEnsAvatar } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsAvatar({ name: normalize('wevm.eth'), universalResolverAddress: '0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsAvatar.md","from":5360,"to":5412} import { type UseEnsAvatarReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getEnsAvatar`](/core/api/actions/getEnsAvatar) --- --- url: /vue/api/composables/useEnsAvatar.md description: Composable for fetching ENS avatar for name. --- # useEnsAvatar Composable for fetching ENS avatar for name. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useEnsAvatar.md","from":360,"to":402} import { useEnsAvatar } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAvatar.md","from":451,"to":630} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: warning Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `useEnsAvatar`. You can use Viem's built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useEnsAvatar.md","from":1154,"to":1211} import { type UseEnsAvatarParameters } from '@wagmi/vue' ``` *** ### assetGatewayUrls `{ ipfs?: string | undefined; arweave?: string | undefined } | undefined` Gateway urls to resolve IPFS and/or Arweave assets. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAvatar.md","from":1435,"to":1768} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` Block number to get ENS avatar at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAvatar.md","from":1926,"to":2148} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get ENS avatar at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAvatar.md","from":2350,"to":2568} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAvatar.md","from":2755,"to":3031} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAvatar.md","from":3267,"to":3524} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gatewayUrls `string[] | undefined` A set of Universal Resolver gateways, used for resolving CCIP-Read requests made through the ENS Universal Resolver Contract. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAvatar.md","from":3775,"to":4019} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### name `string | undefined` Name to get the avatar for. [`enabled`](#enabled) set to `false` if `name` is `undefined`. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAvatar.md","from":4226,"to":4422} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Composables that have identical context will share the same cache. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAvatar.md","from":4646,"to":4861} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### universalResolverAddress `Address | undefined` * Address of ENS Universal Resolver Contract. * Defaults to current chain's Universal Resolver Contract address. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsAvatar.md","from":5111,"to":5381} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useEnsAvatar.md","from":5495,"to":5552} import { type UseEnsAvatarReturnType } from '@wagmi/vue' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getEnsAvatar`](/core/api/actions/getEnsAvatar) --- --- url: /react/api/hooks/useEnsName.md description: Hook for fetching primary ENS name for address. --- # useEnsName Hook for fetching primary ENS name for address. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsName.md","from":351,"to":386} import { useEnsName } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsName.md","from":435,"to":584} import { useEnsName } from 'wagmi' function App() { const result = useEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsName.md","from":656,"to":706} import { type UseEnsNameParameters } from 'wagmi' ``` ### address `Address | undefined` Name to get the resolver for. [`enabled`](#enabled) set to `false` if `address` is `undefined`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsName.md","from":876,"to":1042} import { useEnsName } from 'wagmi' function App() { const result = useEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### blockNumber `bigint | undefined` Block number to get ENS name at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsName.md","from":1203,"to":1397} import { useEnsName } from 'wagmi' function App() { const result = useEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', blockNumber: 17829139n, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get ENS name at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsName.md","from":1597,"to":1787} import { useEnsName } from 'wagmi' function App() { const result = useEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', blockTag: 'latest', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsName.md","from":1976,"to":2223} import { useEnsName } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] function App() { const result = useEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsName.md","from":2477,"to":2743} import { useEnsName } from 'wagmi' import { normalize } from 'viem/ens' import { config } from './config' // [!code focus] function App() { const result = useEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsName.md","from":2961,"to":3148} import { useEnsName } from 'wagmi' function App() { const result = useEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### universalResolverAddress `Address | undefined` * Address of ENS Universal Resolver Contract. * Defaults to current chain's Universal Resolver Contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsName.md","from":3398,"to":3640} import { useEnsName } from 'wagmi' function App() { const result = useEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', universalResolverAddress: '0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsName.md","from":3756,"to":3806} import { type UseEnsNameReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getEnsName`](/core/api/actions/getEnsName) --- --- url: /vue/api/composables/useEnsName.md description: Composable for fetching primary ENS name for address. --- # useEnsName Composable for fetching primary ENS name for address. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useEnsName.md","from":368,"to":408} import { useEnsName } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsName.md","from":457,"to":621} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useEnsName.md","from":691,"to":746} import { type UseEnsNameParameters } from '@wagmi/vue' ``` ### address `Address | undefined` Name to get the resolver for. [`enabled`](#enabled) set to `false` if `address` is `undefined`. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsName.md","from":918,"to":1099} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### blockNumber `bigint | undefined` Block number to get ENS name at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsName.md","from":1260,"to":1467} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get ENS name at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsName.md","from":1667,"to":1870} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsName.md","from":2057,"to":2317} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsName.md","from":2553,"to":2832} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Composables that have identical context will share the same cache. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsName.md","from":3056,"to":3256} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### universalResolverAddress `Address | undefined` * Address of ENS Universal Resolver Contract. * Defaults to current chain's Universal Resolver Contract address. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEnsName.md","from":3506,"to":3761} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useEnsName.md","from":3875,"to":3930} import { type UseEnsNameReturnType } from '@wagmi/vue' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getEnsName`](/core/api/actions/getEnsName) --- --- url: /react/api/hooks/useEnsResolver.md description: Hook for fetching ENS resolver for name. --- # useEnsResolver Hook for fetching ENS resolver for name. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsResolver.md","from":357,"to":396} import { useEnsResolver } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsResolver.md","from":445,"to":613} import { useEnsResolver } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsResolver({ name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: warning Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `useEnsResolver`. You can use Viem's built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsResolver.md","from":1141,"to":1195} import { type UseEnsResolverParameters } from 'wagmi' ``` *** ### blockNumber `bigint | undefined` Block number to get ENS resolver at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsResolver.md","from":1314,"to":1527} import { useEnsResolver } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsResolver({ blockNumber: 17829139n, // [!code focus] name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get ENS resolver at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsResolver.md","from":1731,"to":1940} import { useEnsResolver } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsResolver({ name: normalize('wevm.eth'), blockTag: 'latest', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsResolver.md","from":2129,"to":2395} import { useEnsResolver } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] import { normalize } from 'viem/ens' function App() { const result = useEnsResolver({ chainId: mainnet.id, // [!code focus] name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsResolver.md","from":2649,"to":2897} import { useEnsResolver } from 'wagmi' import { normalize } from 'viem/ens' import { config } from './config' // [!code focus] function App() { const result = useEnsResolver({ config, // [!code focus] name: normalize('wevm.eth'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### name `string | undefined` Name to get the resolver for. [`enabled`](#enabled) set to `false` if `name` is `undefined`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsResolver.md","from":3106,"to":3291} import { useEnsResolver } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsResolver({ name: normalize('wevm.eth'), // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsResolver.md","from":3509,"to":3715} import { useEnsResolver } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsResolver({ name: normalize('wevm.eth'), scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### universalResolverAddress `Address | undefined` * Resolver of ENS Universal Resolver Contract. * Defaults to current chain's Universal Resolver Contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsResolver.md","from":3966,"to":4227} import { useEnsResolver } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsResolver({ name: normalize('wevm.eth'), universalResolverAddress: '0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsResolver.md","from":4343,"to":4397} import { type UseEnsResolverReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getEnsResolver`](/core/api/actions/getEnsResolver) --- --- url: /react/api/hooks/useEnsText.md description: Hook for fetching a text record for a specified ENS name and key. --- # useEnsText Hook for fetching a text record for a specified ENS name and key. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsText.md","from":387,"to":422} import { useEnsText } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsText.md","from":471,"to":655} import { useEnsText } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsText({ name: normalize('wevm.eth'), key: 'com.twitter', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: warning Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `useEnsText`. You can use Viem's built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize) function for this. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsText.md","from":1179,"to":1229} import { type UseEnsTextParameters } from 'wagmi' ``` *** ### blockNumber `bigint | undefined` Block number to get the text at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsText.md","from":1344,"to":1573} import { useEnsText } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsText({ blockNumber: 17829139n, // [!code focus] name: normalize('wevm.eth'), key: 'com.twitter', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get the text at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsText.md","from":1773,"to":1998} import { useEnsText } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsText({ blockTag: 'latest', // [!code focus] name: normalize('wevm.eth'), key: 'com.twitter', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsText.md","from":2187,"to":2469} import { useEnsText } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] import { normalize } from 'viem/ens' function App() { const result = useEnsText({ chainId: mainnet.id, // [!code focus] name: normalize('wevm.eth'), key: 'com.twitter', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### key `string | undefined` ENS key to get Text for. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsText.md","from":2609,"to":2810} import { useEnsText } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsText({ name: normalize('wevm.eth'), key: 'com.twitter', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### name `string | undefined` Name to get the text for. [`enabled`](#enabled) set to `false` if `name` is `undefined`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsText.md","from":3016,"to":3217} import { useEnsText } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsText({ name: normalize('wevm.eth'), // [!code focus] key: 'com.twitter', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEnsText.md","from":3471,"to":3735} import { useEnsText } from 'wagmi' import { normalize } from 'viem/ens' import { config } from './config' // [!code focus] function App() { const result = useEnsText({ config, // [!code focus] name: normalize('wevm.eth'), key: 'com.twitter', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsText.md","from":3953,"to":4175} import { useEnsText } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsText({ scopeKey: 'foo', // [!code focus] name: normalize('wevm.eth'), key: 'com.twitter', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### universalResolverAddress `Address | undefined` * Resolver of ENS Universal Resolver Contract. * Defaults to current chain's Universal Resolver Contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEnsText.md","from":4426,"to":4703} import { useEnsText } from 'wagmi' import { normalize } from 'viem/ens' function App() { const result = useEnsText({ name: normalize('wevm.eth'), key: 'com.twitter', universalResolverAddress: '0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEnsText.md","from":4819,"to":4869} import { type UseEnsTextReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getEnsText`](/core/api/actions/getEnsText) --- --- url: /react/api/hooks/useEstimateFeesPerGas.md description: >- Hook for fetching an estimate for the fees per gas (in wei) for a transaction to be likely included in the next block. --- # useEstimateFeesPerGas Hook for fetching an estimate for the fees per gas (in wei) for a transaction to be likely included in the next block. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEstimateFeesPerGas.md","from":635,"to":681} import { useEstimateFeesPerGas } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateFeesPerGas.md","from":730,"to":837} import { useEstimateFeesPerGas } from 'wagmi' function App() { const result = useEstimateFeesPerGas() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEstimateFeesPerGas.md","from":909,"to":960} import { type UseEstimateFeesPerGas } from 'wagmi' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateFeesPerGas.md","from":1098,"to":1308} import { useEstimateFeesPerGas } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] function App() { const result = useEstimateFeesPerGas({ chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateFeesPerGas.md","from":1562,"to":1754} import { useEstimateFeesPerGas } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useEstimateFeesPerGas({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateFeesPerGas.md","from":1972,"to":2122} import { useEstimateFeesPerGas } from 'wagmi' function App() { const result = useEstimateFeesPerGas({ scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### type `'legacy' | 'eip1559'` * Defaults to `'eip1559'` ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateFeesPerGas.md","from":2266,"to":2415} import { useEstimateFeesPerGas } from 'wagmi' function App() { const result = useEstimateFeesPerGas({ type: 'legacy', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEstimateFeesPerGas.md","from":2531,"to":2592} import { type UseEstimateFeesPerGasReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`estimateFeesPerGas`](/core/api/actions/estimateFeesPerGas) --- --- url: /react/api/hooks/useEstimateGas.md description: >- Hook for estimating the gas necessary to complete a transaction without submitting it to the network. --- # useEstimateGas Hook for estimating the gas necessary to complete a transaction without submitting it to the network. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":463,"to":502} import { useEstimateGas } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":551,"to":644} import { useEstimateGas } from 'wagmi' function App() { const result = useEstimateGas() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":716,"to":770} import { type UseEstimateGasParameters } from 'wagmi' ``` ### accessList `AccessList | undefined` The access list. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":867,"to":1263} import { useEstimateGas } from 'wagmi' import { parseEther } from 'viem' import { config } from './config' function App() { const result = useEstimateGas({ accessList: [{ // [!code focus] address: '0x1', // [!code focus] storageKeys: ['0x1'], // [!code focus] }], // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### account `Address | Account | undefined` Account to use when estimating gas. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":1429,"to":1756} import { useEstimateGas } from 'wagmi' import { parseEther } from 'viem' import { config } from './config' function App() { const result = useEstimateGas({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` Chain ID to target when estimating gas. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":1939,"to":2277} import { useEstimateGas } from 'wagmi' import { mainnet } from '@wagmi/core/chains' import { parseEther } from 'viem' import { config } from './config' function App() { const result = useEstimateGas({ chainId: mainnet.id, // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` Connector to estimate with. If no [`account`](#account) is provided, will use default account from connector. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":2511,"to":2885} import { getConnections, estimateGas } from '@wagmi/core' import { parseEther } from 'viem' import { config } from './config' function App() { const connections = getConnections(config) const result = useEstimateGas({ connector: connections[0]?.connector, // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### data `` `0x${string}` | undefined `` A contract hashed method call with encoded function data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":3070,"to":3394} import { useEstimateGas } from 'wagmi' import { parseEther } from 'viem' import { config } from './config' function App() { const result = useEstimateGas({ data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gas `bigint | undefined` Gas provided for transaction execution. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":3549,"to":3854} import { useEstimateGas } from 'wagmi' import { parseEther, parseGwei } from 'viem' import { config } from './config' function App() { const result = useEstimateGas({ gas: parseGwei('20'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### gasPrice `bigint | undefined` The price in wei to pay per gas. Only applies to [Legacy Transactions](https://viem.sh/docs/glossary/terms#legacy-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":4107,"to":4417} import { useEstimateGas } from 'wagmi' import { parseEther, parseGwei } from 'viem' import { config } from './config' function App() { const result = useEstimateGas({ gasPrice: parseGwei('20'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxFeePerGas `bigint | undefined` Total fee per gas in wei, inclusive of [`maxPriorityFeePerGas`](#maxPriorityFeePerGas). Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":4728,"to":5042} import { useEstimateGas } from 'wagmi' import { parseEther, parseGwei } from 'viem' import { config } from './config' function App() { const result = useEstimateGas({ maxFeePerGas: parseGwei('20'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxPriorityFeePerGas `bigint | undefined` Max priority fee per gas in wei. Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":5306,"to":5662} import { useEstimateGas } from 'wagmi' import { parseEther, parseGwei } from 'viem' import { config } from './config' function App() { const result = useEstimateGas({ maxFeePerGas: parseGwei('20'), maxPriorityFeePerGas: parseGwei('2'), // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### nonce `number` Unique number identifying this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":5816,"to":6100} import { useEstimateGas } from 'wagmi' import { parseEther } from 'viem' import { config } from './config' function App() { const result = useEstimateGas({ nonce: 123, // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":6318,"to":6607} import { useEstimateGas } from 'wagmi' import { parseEther } from 'viem' import { config } from './config' function App() { const result = useEstimateGas({ scopeKey: 'foo', // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### to `Address | undefined` The transaction recipient or contract address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":6769,"to":7037} import { useEstimateGas } from 'wagmi' import { parseEther } from 'viem' import { config } from './config' function App() { const result = useEstimateGas({ to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] value: parseEther('0.01'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### type `'legacy' | 'eip1559' | 'eip2930' | undefined` Optional transaction request type to narrow parameters. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":7235,"to":7524} import { useEstimateGas } from 'wagmi' import { parseEther } from 'viem' import { config } from './config' function App() { const result = useEstimateGas({ to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', type: 'eip1559', // [!code focus] value: parseEther('0.01'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### value `bigint | undefined` Value in wei sent with this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":7682,"to":7951} import { useEstimateGas } from 'wagmi' import { parseEther } from 'viem' import { config } from './config' function App() { const result = useEstimateGas({ to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', value: parseEther('0.01'), // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEstimateGas.md","from":8067,"to":8121} import { type UseEstimateGasReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`estimateGas`](/core/api/actions/estimateGas) --- --- url: /vue/api/composables/useEstimateGas.md description: >- Composable for estimating the gas necessary to complete a transaction without submitting it to the network. --- # useEstimateGas Composable for estimating the gas necessary to complete a transaction without submitting it to the network. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":480,"to":524} import { useEstimateGas } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":573,"to":685} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":755,"to":814} import { type UseEstimateGasParameters } from '@wagmi/vue' ``` ### accessList `AccessList | undefined` The access list. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":913,"to":1314} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### account `Address | Account | undefined` Account to use when estimating gas. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":1480,"to":1818} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` Chain ID to target when estimating gas. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":2001,"to":2349} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` Connector to estimate with. If no [`account`](#account) is provided, will use default account from connector. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":2583,"to":2957} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### data `` `0x${string}` | undefined `` A contract hashed method call with encoded function data. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":3142,"to":3477} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gas `bigint | undefined` Gas provided for transaction execution. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":3632,"to":3948} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### gasPrice `bigint | undefined` The price in wei to pay per gas. Only applies to [Legacy Transactions](https://viem.sh/docs/glossary/terms#legacy-transaction). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":4201,"to":4522} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxFeePerGas `bigint | undefined` Total fee per gas in wei, inclusive of [`maxPriorityFeePerGas`](#maxPriorityFeePerGas). Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":4833,"to":5158} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxPriorityFeePerGas `bigint | undefined` Max priority fee per gas in wei. Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":5422,"to":5787} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### nonce `number` Unique number identifying this transaction. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":5941,"to":6236} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Composables that have identical context will share the same cache. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":6460,"to":6760} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### to `Address | undefined` The transaction recipient or contract address. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":6922,"to":7203} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### type `'legacy' | 'eip1559' | 'eip2930' | undefined` Optional transaction request type to narrow parameters. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":7401,"to":7701} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### value `bigint | undefined` Value in wei sent with this transaction. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":7859,"to":8141} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useEstimateGas.md","from":8255,"to":8314} import { type UseEstimateGasReturnType } from '@wagmi/vue' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`estimateGas`](/core/api/actions/estimateGas) --- --- url: /react/api/hooks/useEstimateMaxPriorityFeePerGas.md description: >- Hook for fetching an estimate for the max priority fee per gas (in wei) for a transaction to be likely included in the next block. --- # useEstimateMaxPriorityFeePerGas Hook for fetching an estimate for the fees per gas (in wei) for a transaction to be likely included in the next block. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEstimateMaxPriorityFeePerGas.md","from":594,"to":650} import { useEstimateMaxPriorityFeePerGas } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateMaxPriorityFeePerGas.md","from":699,"to":826} import { useEstimateMaxPriorityFeePerGas } from 'wagmi' function App() { const result = useEstimateMaxPriorityFeePerGas() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEstimateMaxPriorityFeePerGas.md","from":898,"to":959} import { type UseEstimateMaxPriorityFeePerGas } from 'wagmi' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateMaxPriorityFeePerGas.md","from":1097,"to":1327} import { useEstimateMaxPriorityFeePerGas } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] function App() { const result = useEstimateMaxPriorityFeePerGas({ chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateMaxPriorityFeePerGas.md","from":1581,"to":1793} import { useEstimateMaxPriorityFeePerGas } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useEstimateMaxPriorityFeePerGas({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useEstimateMaxPriorityFeePerGas.md","from":2011,"to":2181} import { useEstimateMaxPriorityFeePerGas } from 'wagmi' function App() { const result = useEstimateMaxPriorityFeePerGas({ scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useEstimateMaxPriorityFeePerGas.md","from":2297,"to":2368} import { type UseEstimateMaxPriorityFeePerGasReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`estimateMaxPriorityFeePerGas`](/core/api/actions/estimateMaxPriorityFeePerGas) --- --- url: /react/api/hooks/useFeeHistory.md description: Hook for fetching a collection of historical gas information. --- # useFeeHistory Hook for fetching a collection of historical gas information. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useFeeHistory.md","from":387,"to":425} import { useFeeHistory } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useFeeHistory.md","from":474,"to":619} import { useFeeHistory } from 'wagmi' function App() { const result = useFeeHistory({ blockCount: 4, rewardPercentiles: [25, 75] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useFeeHistory.md","from":691,"to":744} import { type UseFeeHistoryParameters } from 'wagmi' ``` ### blockCount `number | undefined` Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useFeeHistory.md","from":994,"to":1158} import { useFeeHistory } from 'wagmi' function App() { const result = useFeeHistory({ blockCount: 4, // [!code focus] rewardPercentiles: [25, 75] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### rewardPercentiles `number[] | undefined` A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useFeeHistory.md","from":1446,"to":1610} import { useFeeHistory } from 'wagmi' function App() { const result = useFeeHistory({ blockCount: 4, rewardPercentiles: [25, 75] // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` Highest number block of the requested range. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useFeeHistory.md","from":1781,"to":1972} import { useFeeHistory } from 'wagmi' function App() { const result = useFeeHistory({ blockCount: 4, blockNumber: 1551231n, // [!code focus] rewardPercentiles: [25, 75] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag of the highest number block of the requested range. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useFeeHistory.md","from":2206,"to":2392} import { useFeeHistory } from 'wagmi' function App() { const result = useFeeHistory({ blockCount: 4, blockTag: 'safe', // [!code focus] rewardPercentiles: [25, 75] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useFeeHistory.md","from":2577,"to":2811} import { useFeeHistory } from 'wagmi' import { mainnet } from '@wagmi/core/chains' function App() { const result = useFeeHistory({ blockCount: 4, chainId: mainnet.id, // [!code focus] rewardPercentiles: [25, 75] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useFeeHistory.md","from":3065,"to":3292} import { useFeeHistory } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useFeeHistory({ blockCount: 4, rewardPercentiles: [25, 75] config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useFeeHistory.md","from":3512,"to":3748} import { useFeeHistory } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useFeeHistory({ blockCount: 4, rewardPercentiles: [25, 75] scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useFeeHistory.md","from":3864,"to":3917} import { type UseFeeHistoryReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getFeeHistory`](/core/api/actions/getFeeHistory) --- --- url: /react/api/hooks/useGasPrice.md description: Hook for fetching the current price of gas (in wei). --- # useGasPrice Hook for fetching the current price of gas (in wei). ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useGasPrice.md","from":359,"to":395} import { useGasPrice } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useGasPrice.md","from":444,"to":531} import { useGasPrice } from 'wagmi' function App() { const result = useGasPrice() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useGasPrice.md","from":603,"to":654} import { type UseGasPriceParameters } from 'wagmi' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useGasPrice.md","from":792,"to":982} import { useGasPrice } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] function App() { const result = useGasPrice({ chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useGasPrice.md","from":1236,"to":1408} import { useGasPrice } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useGasPrice({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useGasPrice.md","from":1628,"to":1809} import { useGasPrice } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useGasPrice({ scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useGasPrice.md","from":1925,"to":1976} import { type UseGasPriceReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getGasPrice`](/core/api/actions/getGasPrice) --- --- url: /react/api/hooks/useInfiniteReadContracts.md description: >- Hook for calling multiple read methods on a contract with "infinite scroll"/"fetch more" support. --- # useInfiniteReadContracts Hook for calling multiple contract read-only methods with "infinite scrolling"/"fetch more" support. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useInfiniteReadContracts.md","from":505,"to":554} import { useInfiniteReadContracts } from 'wagmi' ``` ## Usage The example below shows how to demonstrate how to fetch a set of [mloot](https://etherscan.io/address/0x1dfe7ca09e99d10835bf73044a23b73fc20623df) attributes (chestwear, footwear, and handwear) with "fetch more" support. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useInfiniteReadContracts.md","from":824,"to":1561} import { useInfiniteReadContracts } from 'wagmi' import { abi } from './abi' const mlootContractConfig = { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi, } as const function App() { const result = useInfiniteReadContracts({ cacheKey: 'mlootAttributes', contracts(pageParam) { const args = [pageParam] as const return [ { ...mlootContractConfig, functionName: 'getChest', args }, { ...mlootContractConfig, functionName: 'getFoot', args }, { ...mlootContractConfig, functionName: 'getHand', args }, ] } query: { initialPageParam: 0, getNextPageParam: (_lastPage, _allPages, lastPageParam) => { return lastPageParam + 1 } } }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` In the above example, we are setting a few things: * [`cacheKey`](#cachekey): A unique key to store the data in the cache. * [`query.initialPageParam`](#initialpageparam): An initial page parameter to use when fetching the first set of contracts. * [`query.getNextPageParam`](#getnextpageparam): A function that returns the next page parameter to use when fetching the next set of contracts. * [`contracts`](#contracts): A function that provides `pageParam` (derived from the above) as an argument and expects to return an array of contracts. ### Paginated Parameters We can also leverage properties like `getNextPageParam` with a custom `limit` variable to achieve "pagination" of parameters. For example, we can fetch the first 10 contract functions, then fetch the next 10 contract functions, and so on. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useInfiniteReadContracts.md","from":2501,"to":3177} import { useInfiniteReadContracts } from 'wagmi' import { abi } from './abi' function Example({ limit = 10 }: { limit?: number } = {}) { const result = useInfiniteReadContracts({ cacheKey: 'mlootAttributes', contracts(pageParam) { return [...new Array(limit)].map( (_, i) => ({ address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi, functionName: 'getHand', args: [BigInt(pageParam + i)], }) as const, ) }, query: { initialPageParam: 1, getNextPageParam(_lastPage, _allPages, lastPageParam) { return lastPageParam + limit }, } }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useInfiniteReadContracts.md","from":3294,"to":3358} import { type UseInfiniteReadContractsParameters } from 'wagmi' ``` ### cacheKey `string` A unique key to store the data in the cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useInfiniteReadContracts.md","from":3467,"to":3860} import { useInfiniteReadContracts } from 'wagmi' import { abi } from './abi' function App() { const result = useInfiniteReadContracts({ cacheKey: 'mlootAttributes', // [!code hl] contracts(pageParam) { // ... } query: { initialPageParam: 0, getNextPageParam: (_lastPage, _allPages, lastPageParam) => { return lastPageParam + 1 } } }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### contracts `(pageParam: {{TPageParam}}) => Contract[]` A function that provides `pageParam` (derived from the above) as an argument and expects to return an array of contracts. #### abi `Abi | undefined` The contract's ABI. Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useInfiniteReadContracts.md","from":4364,"to":4993} import { useInfiniteReadContracts } from 'wagmi' import { abi } from './abi' function App() { const result = useInfiniteReadContracts({ cacheKey: 'mlootAttributes', contracts(pageParam) { const args = [pageParam] as const return [ // ... { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi, // [!code hl] functionName: 'getChest', args }, // ... ] } query: { initialPageParam: 0, getNextPageParam: (_lastPage, _allPages, lastPageParam) => { return lastPageParam + 1 } } }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` #### address `Address | undefined` The contract's address. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useInfiniteReadContracts.md","from":5184,"to":5813} import { useInfiniteReadContracts } from 'wagmi' import { abi } from './abi' function App() { const result = useInfiniteReadContracts({ cacheKey: 'mlootAttributes', contracts(pageParam) { const args = [pageParam] as const return [ // ... { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', // [!code hl] abi, functionName: 'getChest', args }, // ... ] } query: { initialPageParam: 0, getNextPageParam: (_lastPage, _allPages, lastPageParam) => { return lastPageParam + 1 } } }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` #### functionName `string | undefined` * Function to call on the contract. * Inferred from [`abi`](#abi). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useInfiniteReadContracts.md","from":6051,"to":6679} import { useInfiniteReadContracts } from 'wagmi' import { abi } from './abi' function App() { const result = useInfiniteReadContracts({ cacheKey: 'mlootAttributes', contracts(pageParam) { const args = [pageParam] as const return [ // ... { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi, functionName: 'getChest', // [!code hl] args }, // ... ] } query: { initialPageParam: 0, getNextPageParam: (_lastPage, _allPages, lastPageParam) => { return lastPageParam + 1 } } }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` #### args `readonly unknown[] | undefined` * Arguments to pass when calling the contract. * Inferred from [`abi`](#abi) and [`functionName`](#functionname). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useInfiniteReadContracts.md","from":6968,"to":7569} import { useInfiniteReadContracts } from 'wagmi' import { abi } from './abi' function App() { const result = useInfiniteReadContracts({ cacheKey: 'mlootAttributes', contracts(pageParam) { return [ // ... { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi, functionName: 'getChest', args: [pageParam] // [!code hl] }, // ... ] } query: { initialPageParam: 0, getNextPageParam: (_lastPage, _allPages, lastPageParam) => { return lastPageParam + 1 } } }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` #### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useInfiniteReadContracts.md","from":7798,"to":8448} import { useInfiniteReadContracts } from 'wagmi' import { abi } from './abi' function App() { const result = useInfiniteReadContracts({ cacheKey: 'mlootAttributes', contracts(pageParam) { const args = [pageParam] as const return [ // ... { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi, functionName: 'getChest', args, chainId: 1 // [!code hl] }, // ... ] } query: { initialPageParam: 0, getNextPageParam: (_lastPage, _allPages, lastPageParam) => { return lastPageParam + 1 } } }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useInfiniteReadContracts.md","from":8608,"to":8672} import { type UseInfiniteReadContractsReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. --- --- url: /react/api/hooks/usePrepareTransactionRequest.md description: >- Hook for preparing a transaction request for signing by populating a nonce, gas limit, fee values, and a transaction type. --- # usePrepareTransactionRequest Hook for preparing a transaction request for signing by populating a nonce, gas limit, fee values, and a transaction type. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":598,"to":651} import { usePrepareTransactionRequest } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":700,"to":942} import { usePrepareTransactionRequest } from 'wagmi' import { parseEther } from 'viem' function App() { const result = usePrepareTransactionRequest({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":1014,"to":1082} import { type UsePrepareTransactionRequestParameters } from 'wagmi' ``` ### account `Account | Address | undefined` The Account to send the transaction from. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":1211,"to":1529} import { usePrepareTransactionRequest } from 'wagmi' import { parseEther } from 'viem' function App() { const result = usePrepareTransactionRequest({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### to `` `0x${string}` | undefined `` The transaction recipient or contract address. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":1703,"to":2022} import { usePrepareTransactionRequest } from 'wagmi' import { parseEther } from 'viem' function App() { const result = usePrepareTransactionRequest({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', // [!code focus] value: parseEther('1'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### accessList `AccessList | undefined` The access list. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":2167,"to":2583} import { usePrepareTransactionRequest } from 'wagmi' import { parseEther } from 'viem' function App() { const result = usePrepareTransactionRequest({ accessList: [ // [!code focus:6] { address: '0x1', storageKeys: ['0x1'], }, ], account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` Chain ID to prepare the transaction request for. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":2777,"to":3120} import { usePrepareTransactionRequest } from 'wagmi' import { parseEther } from 'viem' function App() { const result = usePrepareTransactionRequest({ chainId: mainnet.id, // [!code focus] account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### data `` `0x${string}` | undefined `` A contract hashed method call with encoded args. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":3298,"to":3672} import { usePrepareTransactionRequest } from 'wagmi' import { parseEther } from 'viem' function App() { const result = usePrepareTransactionRequest({ data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // [!code focus] account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gasPrice `bigint | undefined` The price (in wei) to pay per gas. Only applies to [Legacy Transactions](https://viem.sh/docs/glossary/terms#legacy-transaction). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":3924,"to":4284} import { usePrepareTransactionRequest } from 'wagmi' import { parseEther, parseGwei } from 'viem' function App() { const result = usePrepareTransactionRequest({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', gasPrice: parseGwei('20'), // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxFeePerGas `bigint | undefined` Total fee per gas (in wei), inclusive of `maxPriorityFeePerGas`. Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":4574,"to":4938} import { usePrepareTransactionRequest } from 'wagmi' import { parseEther, parseGwei } from 'viem' function App() { const result = usePrepareTransactionRequest({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', maxFeePerGas: parseGwei('20'), // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxPriorityFeePerGas `bigint | undefined` Max priority fee per gas (in wei). Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":5206,"to":5612} import { usePrepareTransactionRequest } from 'wagmi' import { parseEther, parseGwei } from 'viem' function App() { const result = usePrepareTransactionRequest({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', maxFeePerGas: parseGwei('20'), maxPriorityFeePerGas: parseGwei('2'), // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### nonce `number | undefined` Unique number identifying this transaction. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":5775,"to":6107} import { usePrepareTransactionRequest } from 'wagmi' import { parseEther } from 'viem' function App() { const result = usePrepareTransactionRequest({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), nonce: 5, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### parameters `("fees" | "gas" | "nonce" | "type")[] | undefined` Parameters to prepare. For instance, if `["gas", "nonce"]` is provided, then only the `gas` and `nonce` parameters will be prepared. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":6396,"to":6748} import { usePrepareTransactionRequest } from 'wagmi' import { parseEther } from 'viem' function App() { const result = usePrepareTransactionRequest({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', parameters: ['gas', 'nonce'], // [!code focus] to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### value `bigint | undefined` Value in wei sent with this transaction. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":6908,"to":7226} import { usePrepareTransactionRequest } from 'wagmi' import { parseEther } from 'viem' function App() { const result = usePrepareTransactionRequest({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":7481,"to":7862} import { usePrepareTransactionRequest } from 'wagmi' import { parseEther } from 'viem' import { config } from './config' // [!code focus] function App() { const result = usePrepareTransactionRequest({ config, // [!code focus] account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":8082,"to":8454} import { usePrepareTransactionRequest } from 'wagmi' import { parseEther } from 'viem' import { config } from './config' function App() { const result = usePrepareTransactionRequest({ scopeKey: 'foo' // [!code focus] account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/usePrepareTransactionRequest.md","from":8570,"to":8638} import { type UsePrepareTransactionRequestReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`prepareTransactionRequest`](/core/api/actions/prepareTransactionRequest) --- --- url: /react/api/hooks/useProof.md description: >- Hook for return the account and storage values of the specified account including the Merkle-proof. --- # useProof Hook for return the account and storage values of the specified account including the Merkle-proof. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useProof.md","from":444,"to":477} import { useProof } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useProof.md","from":526,"to":773} import { useProof } from 'wagmi' function App() { const result = useProof({ address: '0x4200000000000000000000000000000000000016', storageKeys: [ '0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99', ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useProof.md","from":845,"to":893} import { type UseProofParameters } from 'wagmi' ``` ### address `Address | undefined` The account address to get the proof for. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useProof.md","from":1011,"to":1275} import { useProof } from 'wagmi' function App() { const result = useProof({ address: '0x4200000000000000000000000000000000000016', // [!code focus] storageKeys: [ '0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99', ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### storageKeys `` `0x${string}`[] | undefined `` Array of storage-keys that should be proofed and included. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useProof.md","from":1472,"to":1738} import { useProof } from 'wagmi' function App() { const result = useProof({ address: '0x4200000000000000000000000000000000000016', storageKeys: [ // [!code focus:3] '0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99', ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` Proof at a given block number. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useProof.md","from":1894,"to":2183} import { useProof } from 'wagmi' function App() { const result = useProof({ address: '0x4200000000000000000000000000000000000016', blockNumber: 42069n, // [!code focus] storageKeys: [ '0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99', ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Proof at a given block tag. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useProof.md","from":2383,"to":2671} import { useProof } from 'wagmi' function App() { const result = useProof({ address: '0x4200000000000000000000000000000000000016', blockTag: 'latest', // [!code focus] storageKeys: [ '0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99', ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` The ID of chain to get the proof for. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useProof.md","from":2854,"to":3184} import { useProof } from 'wagmi' import { optimism } from 'wagmi/chains' function App() { const result = useProof({ chainId: optimism.id, // [!code focus] address: '0x4200000000000000000000000000000000000016', storageKeys: [ '0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99', ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useProof.md","from":3438,"to":3765} import { useProof } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useProof({ config, // [!code focus] address: '0x4200000000000000000000000000000000000016', storageKeys: [ '0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99', ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useProof.md","from":3985,"to":4303} import { useProof } from 'wagmi' import { config } from './config' function App() { const result = useProof({ scopeKey: 'foo' // [!code focus] address: '0x4200000000000000000000000000000000000016', storageKeys: [ '0x4a932049252365b3eedbc5190e18949f2ec11f39d3bef2d259764799a1b27d99', ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useProof.md","from":4419,"to":4467} import { type UseProofReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getProof`](/core/api/actions/getProof) --- --- url: /react/api/hooks/usePublicClient.md description: Hook for getting Viem `PublicClient` instance. --- # usePublicClient Hook for getting Viem [`PublicClient`](https://viem.sh/docs/clients/public) instance. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/usePublicClient.md","from":215,"to":255} import { usePublicClient } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePublicClient.md","from":304,"to":399} import { usePublicClient } from 'wagmi' function App() { const client = usePublicClient() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: warning If you want to optimize bundle size, you should use [`useClient`](/react/api/hooks/useClient) along with Viem's [tree-shakable actions](https://viem.sh/docs/clients/custom#tree-shaking) instead. Since Public Client has all public actions attached directly to it. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/usePublicClient.md","from":751,"to":806} import { type UsePublicClientParameters } from 'wagmi' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when getting Viem Public Client. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/usePublicClient.md","from":955,"to":1187} import { usePublicClient } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] import { config } from './config' function App() { const client = usePublicClient({ chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/usePublicClient.md","from":1440,"to":1620} import { usePublicClient } from 'wagmi' import { config } from './config' // [!code focus] function App() { const client = usePublicClient({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/usePublicClient.md","from":1693,"to":1748} import { type UsePublicClientReturnType } from 'wagmi' ``` `PublicClient | undefined` Viem [`PublicClient`](https://viem.sh/docs/clients/public) instance. ## Action * [`getPublicClient`](/core/api/actions/getPublicClient) * [`watchPublicClient`](/core/api/actions/watchPublicClient) --- --- url: /react/api/hooks/useReadContract.md description: >- Hook for calling a read-only function on a contract, and returning the response. --- # useReadContract Hook for calling a **read-only** function on a contract, and returning the response. A **read-only** function (constant function) on a Solidity contract is denoted by a pure or view keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":806,"to":846} import { useReadContract } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":895,"to":1124} import { useReadContract } from 'wagmi' import { abi } from './abi' function App() { const result = useReadContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'totalSupply', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":1231,"to":1286} import { type UseReadContractParameters } from 'wagmi' ``` ### abi `Abi | undefined` The contract's ABI. Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":1516,"to":1779} import { useReadContract } from 'wagmi' import { abi } from './abi' // [!code focus] function App() { const result = useReadContract({ abi, // [!code focus] address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'totalSupply', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### account `Account | undefined` Account to use when calling the contract (`msg.sender`). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":1993,"to":2354} import { useReadContract } from 'wagmi' import { abi } from './abi' function App() { const result = useReadContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'balanceOf', args: ['0x6b175474e89094c44da98b954eedeac495271d0f'], account: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### address `Address | undefined` The contract's address. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":2535,"to":2781} import { useReadContract } from 'wagmi' import { abi } from './abi' function App() { const result = useReadContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', // [!code focus] functionName: 'totalSupply', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### args `readonly unknown[] | undefined` * Arguments to pass when calling the contract. * Inferred from [`abi`](#abi) and [`functionName`](#functionname). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":3060,"to":3362} import { useReadContract } from 'wagmi' import { abi } from './abi' function App() { const result = useReadContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'balanceOf', args: ['0x6b175474e89094c44da98b954eedeac495271d0f'], // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### blockNumber `bigint | undefined` Block number to call contract at. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":3561,"to":3835} import { useReadContract } from 'wagmi' import { abi } from './abi' function App() { const result = useReadContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'totalSupply', blockNumber: 17829139n, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to call contract at. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":4073,"to":4341} import { useReadContract } from 'wagmi' import { abi } from './abi' function App() { const result = useReadContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'totalSupply', blockTag: 'safe', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":4565,"to":4892} import { useReadContract } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] import { abi } from './abi' function App() { const result = useReadContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'totalSupply', chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":5181,"to":5490} import { useReadContract } from 'wagmi' import { abi } from './abi' import { config } from './config' // [!code focus] function App() { const result = useReadContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'totalSupply', config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### functionName `string | undefined` * Function to call on the contract. * Inferred from [`abi`](#abi). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":5718,"to":6020} import { useReadContract } from 'wagmi' import { abi } from './abi' function App() { const result = useReadContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'balanceOf', // [!code focus] args: ['0x6b175474e89094c44da98b954eedeac495271d0f'], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":6275,"to":6598} import { useReadContract } from 'wagmi' import { abi } from './abi' function App() { const result = useReadContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'balanceOf', args: ['0x6b175474e89094c44da98b954eedeac495271d0f'], scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":6749,"to":6804} import { type UseReadContractReturnType } from 'wagmi' ``` The return type's [`data`](#data) property is inferrable via the combination of [`abi`](#abi), [`functionName`](#functionname), and [`args`](#args). Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for more info. *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## Type Inference With [`abi`](#abi) setup correctly, TypeScript will infer the correct types for [`functionName`](#functionname), [`args`](#args), and the return type. See the Wagmi [TypeScript docs](/react/typescript) for more information. ::: code-group ```ts twoslash [Inline] // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":7379,"to":12198} // @twoslash-cache: {"v":1,"hash":"8bfa3d1e805ee2d7a8b83c91b1e75f961b748f9d5c3b79a8bca9b7494b57cb8e","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAlPgFcAbNROwCqcGACUYAQygBhFmlKTGaCWm6kwAFWwwAPF2kteGdqgA6Ydlc5SoRk5hyCzIAGbcwygJYsXAbgtrG0MwY3YwSQBbGGcQACNJXklPGAB5V39A6wM7UJM2SRoAWW40STivXi9MWKIvGAB3TMts23t2LzAsUrhBHPbzFqCrfrzwqJj2FyVmDzRm4daQsMdJ6agoLjg4BesAXwBdAKHg3LCIUu60XtOB4CzF0ZWdWO5OtAAmAFYANl2rQ7HPYUdj3E5PBwvKZuDzeXwgY5BCHjaKxNAQMq8ADK3CwWGM/1uYwKxVK5Uq1QwtXqTQRDyJYU6VxuyOQR3pyIuaGZfTaY0GixGfLCEVR0LguPx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GQuQ1wxYJQ0HMGXQxYDQpxbQmkfw4YfQxMWws+cQ4AQw9HDAEwhwp+JwiIlwrIFIqwXDG4aQ0nJyCnVyanDyOnbyRnEMMMAKL4KMNnVwUI1TdTQQZQ5GWRXQ33DI6sG4ZAbIxycnFyKndyWnLyBnXyMoiMCooKOMaQlIvYBcX3YXNGR3CwTMBKSQJAUASOIsOAc8FhBAPYPYIAA="} import { createConfig, http, useReadContract } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) // ---cut--- const result = useReadContract({ abi: [ { type: 'function', name: 'balanceOf', stateMutability: 'view', inputs: [{ name: 'account', type: 'address' }], outputs: [{ type: 'uint256' }], }, { type: 'function', name: 'totalSupply', stateMutability: 'view', inputs: [], outputs: [{ name: 'supply', type: 'uint256' }], }, ], address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'balanceOf', // ^? args: ['0x6b175474e89094c44da98b954eedeac495271d0f'], // ^? }) result.data // ^? ``` ```ts twoslash [Const-Asserted] // {"path":"/vercel/path0/site/react/api/hooks/useReadContract.md","from":12234,"to":17436} // @twoslash-cache: {"v":1,"hash":"9f8b59d36cf11dedf27c45ac2abd580ec38459b071c6641a3e4025c048f71072","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAgEMAjAS0XakYnKCwA2GdqgA6YdvMHDRYCe0w4B0kADMArmEZpeLLQG5ZCxSPGSwnALYxNIbpzGcDMAPLazFhULWKpJsnDQAsrpoPLxivJjORLwwAO5+cgFKNuy8YFhRcAKByqoyGZbyxdl2js6cjMz6aOkVmUGq6k7sWiJQQnBwLQoAvgC65uVWJZIQUflohVPZZa2VWcFq2F1aurloAEwArABsQ/JjE8MU7MD+a+2Snc56BkYmIBOWVRs129QQ0TEAGVdFgsBIzksNqEIlEYnEEt0QElUpDvqpcvNFujJMhxncoapZmgsUV1qVbpM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AUQy5cQ6Iegxg+UWQwnNgjg0McwpQvAxFPgtQgQuAIQyQcgyg3Q2ggw6Qowlgkw+Q8wxQng6w1Q9Q+wzQxwkQ5w6g1wqQmQzwonADb5FZOTDSRMLnWg9HMA03JAa8IOOQ6Pb6MXf0WghAiDbkVXb3KHKgDAvASwlQ/g4g4I6RHQ8IiQtwqIuQswrgqo/wmojQ0gkI7QsIvQyQww5g1ohQ7g5Qzo2w2ono+o/oiIoY4wmI0YjoggyY7orQhogY5ojwkYnwsYqwlYwIhwmYsQuY9w4Yrw2In/BMBIqaZIiQ1IzTFaTI0ZHMaAaKWPDgGIdgIeZAfwUhByAAcnyQBIoAJHQgBP3xXhBIJFPURABN3mhMmF8VQH3XYABOlxBL2nRNuwBOYVBMmCFRRMBMGVxO/X8CuD+IJEBOBPxMsHBIyzKURMsFhJ1XhNPCZIUGRNGQJEJOAFRIBJfQwExOJLSVJO5IyApLABV0RV7j4WaHMI+Pj1kW+NwwLQIzg0MFdANhiFpK4FuwEABLmVPz9Qv0DWvxDTv3DUfyuWjUODuVf20A5O+2NghOLyhPxK4PkAlwEGQENJ9TP39UvyDRv1DXvwjRtJuTtNjSeQBPFOGF9C4KALQAA1oNkCFCzU4CQFABdGlDgBDHrgQGGGGCAA="} import { createConfig, http, useReadContract } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) // ---cut--- const abi = [ { type: 'function', name: 'balanceOf', stateMutability: 'view', inputs: [{ name: 'account', type: 'address' }], outputs: [{ type: 'uint256' }], }, { type: 'function', name: 'totalSupply', stateMutability: 'view', inputs: [], outputs: [{ name: 'supply', type: 'uint256' }], }, ] as const const result = useReadContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'balanceOf', // ^? args: ['0x6b175474e89094c44da98b954eedeac495271d0f'], // ^? }) result.data // ^? ``` ::: ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`readContract`](/core/api/actions/readContract) --- --- url: /vue/api/composables/useReadContract.md description: >- Composable for calling a read-only function on a contract, and returning the response. --- # useReadContract Composable for calling a **read-only** function on a contract, and returning the response. A **read-only** function (constant function) on a Solidity contract is denoted by a pure or view keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":823,"to":868} import { useReadContract } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":917,"to":1157} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":1262,"to":1322} import { type UseReadContractParameters } from '@wagmi/vue' ``` ### abi `Abi | undefined` The contract's ABI. Check out the [TypeScript docs](/vue/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":1550,"to":1824} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### account `Account | undefined` Account to use when calling the contract (`msg.sender`). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":2036,"to":2404} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### address `Address | undefined` The contract's address. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":2583,"to":2840} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### args `readonly unknown[] | undefined` * Arguments to pass when calling the contract. * Inferred from [`abi`](#abi) and [`functionName`](#functionname). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":3117,"to":3428} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### blockNumber `bigint | undefined` Block number to call contract at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":3625,"to":3908} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to call contract at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":4144,"to":4421} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":4643,"to":4979} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":5250,"to":5568} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### functionName `string | undefined` * Function to call on the contract. * Inferred from [`abi`](#abi). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":5794,"to":6105} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Composables that have identical context will share the same cache. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":6364,"to":6694} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":6843,"to":6903} import { type UseReadContractReturnType } from '@wagmi/vue' ``` The return type's [`data`](#data) property is inferrable via the combination of [`abi`](#abi), [`functionName`](#functionname), and [`args`](#args). Check out the [TypeScript docs](/vue/typescript#const-assert-abis-typed-data) for more info. *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## Type Inference With [`abi`](#abi) setup correctly, TypeScript will infer the correct types for [`functionName`](#functionname), [`args`](#args), and the return type. See the Wagmi [TypeScript docs](/vue/typescript) for more information. ::: code-group ```ts twoslash [Inline] // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":7474,"to":11889} // @twoslash-cache: {"v":1,"hash":"c9cd30cf155368eb52dff62473381dfcdf7018daabaed2ca4c58019bdbc995a3","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAlPgFcAbNROwCqcGACUYAQygBhFmlKTGaCWm6kwAFWwwAPAApgAHTDsz7TDkFGQAM25hlASxY2A3CfPswkgLYxBNlInMABzD1NzNkkaAFluNEkAIydeJ0xrECInGAB3d09zEKwEuEFjSK8zH39AhRDwwqqLHUzpKC44OALK9gBfZABdCK8IBJK0MvYK5rNLAPYbbhC0ACYAVgA2Hq8B4ZM+9gAfaaaWq0W7B2dXEBHzGoWghvuzaLiE5NT0jEzsvJ2RTAEymYBgJFIQ1e7DGaBB5TOXkedWCYWhXnmmWWYDWW0BZj2ET6AEohhRLklJLxJI4YAB5Ww2cnPMJk7zgsgAPkoIGipAYiE2VF4MDCaHwSCF1EkpFCMAFIE6fAYwpCuEQAAYqIx8DKlDRyIK+hR0Do8IQITyaPQ8PoqU5JHBiexuKIJNI5DjFMoDDNzJjLvZHGgXGB8d4/E96mizu8YPFEik0hlLv98nczsVSgjekjIyiXoj/a1Lu1Ot0M71CWdYfDTrnixclisNttK7soQdjvWMSWbEGbmH2w98+wWY1enGE19k79Uzl09Cs5NBGCIZ3erXsz3Zsix9GJ7NzgtmzjW+Hq2ASWybJTqbSGUz96jQmzPbYnKFyWuufosHr/ANOAAH0AH5BBEcQpFkeRvTQAAFAD5TIOBfTOAN+2uENbmhPdx2hKdPiTH4/gXc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wJ089tUBmjPPd0CZzK2VcogHm71yrSWatpfqxt8buXtuFdm6V2LQPFsg5W2D9bY2cstdCzDzrMXysI/68t1zq30uo6a1DqbWOStdfh3ZxHA3Cco8y6TjHbXdvY8BzT/HyXkfDcZ5tsnmOZv7fWId/Rk6FRnZyeahd2tiE2V2tAGRt67MyfYAAXhSs+oKcE3qRBeuwZAZxUMBgAOQJuNxQIse5jfcYfLYc3RY5mkfYMbtM9uGy7NQAnBYxulDMAcGgc3RMfcSq6Mb/oNkizKMEJ7k3TKw99Aj1WC3vQjcllN42t39HvdoAgIkXgABlbgWAsBucz1UR3oGXcLjL14D3ifmhR/18AL3ghjcJeL6X8ksecbx/r+YY0hQ++utb9K2V8qnaKuVaq9VmrtW6v1YahrUgNVmotVau3yezAltHNb+ytu3fRbMFu/XxvR9ytTgqpVKqNRqo1VqnVeqDVKqXya1flrrXG8T9jkk0WZORX8yYDyIBJIEgKANdKKHAKGHgJMCAH0H0EAA="} import { createConfig, http, useReadContract } from '@wagmi/vue' import { mainnet, sepolia } from 'wagmi/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) // ---cut--- const result = useReadContract({ abi: [ { type: 'function', name: 'balanceOf', stateMutability: 'view', inputs: [{ name: 'account', type: 'address' }], outputs: [{ type: 'uint256' }], }, { type: 'function', name: 'totalSupply', stateMutability: 'view', inputs: [], outputs: [{ name: 'supply', type: 'uint256' }], }, ], address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'balanceOf', // ^? args: ['0x6b175474e89094c44da98b954eedeac495271d0f'], // ^? }) result.data // ^? ``` ```ts twoslash [Const-Asserted] // {"path":"/vercel/path0/site/vue/api/composables/useReadContract.md","from":11926,"to":17121} // @twoslash-cache: {"v":1,"hash":"b21638ef6d0df571da0457691c07531820bda58a8bf70cddee1ce9852f692ff4","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAgEMAjAS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vQbpvvM6ItNPT4ugvcWimrsS+ZtlDftVN91UiO7SKj1IRPWapZqz1nWp2U6u93JjmMfYtl3LVyxe3PuTjxq/2rQGh9wXLGRchvRAEKo7Qxj9CwHtXqKAQ5dgAAH3YC/2MWdRP0gwgGgzwAMXwBgHYHcADwZAaCIj0DEFUH6AgDEBICgHYHf04HYG0EAzUAQPYAV3B1PVkBoMMXIOQI4FQOXgGAwKwPgBwLwIILCCIJINIDIMQMoIwGoNDBEPgMQIYJ3F0DQJYLuTYLgA4Kmy4OiGINIPlAELByENoNkDEKQK+UYKkOYLgFYMkGwNwMUMIJUL4LUIoI0OENoJ0IkKYPQNkJMPYLMPwIsN4P4JsMV1PROVa1Yw0kTHR0IJ+3v1lytGvHlw0JfzEzf24M/xgG/1/ySMzEAJALAKSIgOPzQFPxACgxgxAAcL0MkOkKMJcOkQUI8O4MsO8MELsNEPoJKKcJkMwNcPkPcKUJ4NUPIPqK0LoPEOaIMOcLaMqM6M8J6PUN8P6OKJQOGNaLkKqK6NqOsL6JEO0KaLmLKOMLGM4ImKsN6NsP8ITECKmhCO4LCLxznCiNGRzGgGin9w4BiHYCHkpwyFIQcgAHJ8lPiKACR0JPj19tBfiCQgtERPjd4QTJhfFUAVV2BPiTVfi9oETdtPjmE/jJhqVYSvjBk0Td1/Arh/APjx5viYcoTLAASB0ylySFAwTRUITTwaT5AYTRkCQsTgA4TPi10kScS0k8TWSMhCSwBRguA4Be4+FmgRDHjA9ZEXjgN/UwMX1DBXQDYYgMT5BasBBPjtdac9cGdDdmcTc2dzdptudDh5trdgT1TiCYcvsuhATU8fAoTaCNT1cpBtTqcdc6d9dGcjcWdTd2dJtTTZtzTedltPiBThhfRaCb80BT1CDZAhR3VOAkBQAXRpQ4AQx64EBhhhggA"} import { createConfig, http, useReadContract } from '@wagmi/vue' import { mainnet, sepolia } from 'wagmi/chains' const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) // ---cut--- const abi = [ { type: 'function', name: 'balanceOf', stateMutability: 'view', inputs: [{ name: 'account', type: 'address' }], outputs: [{ type: 'uint256' }], }, { type: 'function', name: 'totalSupply', stateMutability: 'view', inputs: [], outputs: [{ name: 'supply', type: 'uint256' }], }, ] as const const result = useReadContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'balanceOf', // ^? args: ['0x6b175474e89094c44da98b954eedeac495271d0f'], // ^? }) result.data // ^? ``` ::: ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`readContract`](/core/api/actions/readContract) --- --- url: /react/api/hooks/useReadContracts.md description: Hook for calling multiple read methods on a contract. --- # useReadContracts Hook for calling multiple read methods on a contract. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":394,"to":435} import { useReadContracts } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":484,"to":1203} import { useReadContracts } from 'wagmi' const wagmigotchiContract = { address: '0xecb504d39723b0be0e3a9aa33d646642d1051ee1', abi: wagmigotchiABI, } as const const mlootContract = { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, } as const function App() { const result = useReadContracts({ contracts: [ { ...wagmigotchiContract, functionName: 'getAlive', }, { ...wagmigotchiContract, functionName: 'getBoredom', }, { ...mlootContract, functionName: 'getChest', args: [69], }, { ...mlootContract, functionName: 'getWaist', args: [69], }, ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":1275,"to":1331} import { type UseReadContractsParameters } from 'wagmi' ``` ### contracts `readonly Contract[]` Set of contracts to call. #### abi `Abi | undefined` The contract's ABI. Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":1627,"to":1937} import { useReadContracts } from 'wagmi' function App() { const result = useReadContracts({ contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, // [!code hl] functionName: 'getChest', args: [69], }, // ... ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` #### address `Address | undefined` The contract's address. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":2084,"to":2395} import { useReadContracts } from 'wagmi' function App() { const result = useReadContracts({ contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', // [!code hl] abi: mlootABI, functionName: 'getChest', args: [69], }, // ... ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` #### functionName `string | undefined` * Function to call on the contract. * Inferred from [`abi`](#abi). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":2589,"to":2899} import { useReadContracts } from 'wagmi' function App() { const result = useReadContracts({ contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', // [!code hl] args: [69], }, // ... ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` #### args `readonly unknown[] | undefined` * Arguments to pass when calling the contract. * Inferred from [`abi`](#abi) and [`functionName`](#functionname). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":3144,"to":3454} import { useReadContracts } from 'wagmi' function App() { const result = useReadContracts({ contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69], // [!code hl] }, // ... ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` #### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":3639,"to":3969} import { useReadContracts } from 'wagmi' function App() { const result = useReadContracts({ contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69], chainId: 1 // [!code hl] }, // ... ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### allowFailure `boolean` Whether or not the Hook should throw if a call reverts. If set to `true` (default), and a call reverts, then `useReadContracts` will fail silently and its error will be logged in the results array. Defaults to `true`. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":4303,"to":4637} import { useReadContracts } from 'wagmi' function App() { const result = useReadContracts({ allowFailure: false, // [!code hl] contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69] }, // ... ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### batchSize `number` The maximum size (in bytes) for each calldata chunk. Set to `0` to disable the size limit. Defaults to `1024`. > Note: Some RPC Providers limit the amount of calldata (`data`) that can be sent in a single `eth_call` request. It is best to check with your RPC Provider to see if there are any calldata size limits to `eth_call` requests. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":5087,"to":5417} import { useReadContracts } from 'wagmi' function App() { const result = useReadContracts({ batchSize: 1024, // [!code hl] contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69] }, // ... ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `number` The block number to perform the read against. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":5576,"to":5910} import { useReadContracts } from 'wagmi' function App() { const result = useReadContracts({ blockNumber: 69420n, // [!code hl] contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69] }, // ... ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to read against. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":6109,"to":6440} import { useReadContracts } from 'wagmi' function App() { const result = useReadContracts({ blockTag: 'safe', // [!code hl] contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69] }, // ... ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":6694,"to":7049} import { useReadContracts } from 'wagmi' import { config } from './config' function App() { const result = useReadContracts({ config, // [!code hl] contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69] }, // ... ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### multicallAddress `Address` Address of multicall contract. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":7199,"to":7576} import { useReadContracts } from 'wagmi' function App() { const result = useReadContracts({ contracts: [ { address: '0x1dfe7ca09e99d10835bf73044a23b73fc20623df', abi: mlootABI, functionName: 'getChest', args: [69] }, // ... ], multicallAddress: '0xca11bde05977b3631167028862be2a173976ca11', // [!code hl] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useReadContracts.md","from":7692,"to":7748} import { type UseReadContractsReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`readContracts`](/core/api/actions/readContracts) --- --- url: /react/api/hooks/useReconnect.md description: Hook for reconnecting connectors. --- # useReconnect Hook for reconnecting [connectors](/core/api/connectors). ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useReconnect.md","from":532,"to":569} import { useReconnect } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReconnect.md","from":618,"to":796} import { useReconnect } from 'wagmi' import { useEffect } from 'react' function App() { const reconnect = useReconnect() useEffect(() => { reconnect.mutate() }, []) } ``` ::: ::: tip When [`WagmiProvider['reconnectOnMount']`](/react/api/WagmiProvider#reconnectonmount) is `true`, `reconnect` is called automatically on mount. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useReconnect.md","from":983,"to":1035} import { type UseReconnectParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReconnect.md","from":1243,"to":1420} import { useReconnect } from 'wagmi' import { config } from './config' // [!code focus] function App() { const reconnect = useReconnect({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useReconnect.md","from":1539,"to":1591} import { type UseReconnectReturnType } from 'wagmi' ``` ### connectors [deprecated](/react/guides/migrate-from-v2-to-v3#removed-useconnect-connectors-usereconnect-connectors) `readonly Connector[]` Globally configured connectors via [`createConfig`](/react/api/createConfig#connectors). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useReconnect.md","from":1894,"to":2148} import { useReconnect } from 'wagmi' import { mainnet } from 'wagmi/chains' import { useEffect } from 'react' function App() { const reconnect = useReconnect() useEffect(() => { reconnect.mutate({ connectors: reconnect.connectors }) }, []) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`reconnect`](/core/api/actions/reconnect) --- --- url: /solid/api/primitives/useReconnect.md description: Primitive for reconnecting to previously connected connectors. --- # useReconnect Primitive for reconnecting to previously connected connectors. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useReconnect.md","from":469,"to":513} import { useReconnect } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useReconnect.md","from":562,"to":757} import { useReconnect } from '@wagmi/solid' function App() { const reconnect = useReconnect() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useReconnect.md","from":829,"to":927} import { useReconnect } from '@wagmi/solid' useReconnect.Parameters useReconnect.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useReconnect.md","from":1012,"to":1073} useReconnect(() => ({ config, // mutation options... })) ``` ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useReconnect.md","from":1315,"to":1384} import { useReconnect } from '@wagmi/solid' useReconnect.ReturnType ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`reconnect`](/core/api/actions/reconnect) --- --- url: /vue/api/composables/useReconnect.md description: Composable for reconnecting connectors. --- # useReconnect Composable for reconnecting [connectors](/core/api/connectors). ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useReconnect.md","from":549,"to":591} import { useReconnect } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useReconnect.md","from":640,"to":805} ``` ::: ::: tip When [`WagmiPlugin['reconnectOnMount']`](/vue/api/WagmiPlugin#reconnectonmount) is `true`, `reconnect` is called automatically on mount. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useReconnect.md","from":986,"to":1043} import { type UseReconnectParameters } from '@wagmi/vue' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useReconnect.md","from":1235,"to":1427} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useReconnect.md","from":1544,"to":1601} import { type UseReconnectReturnType } from '@wagmi/vue' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`reconnect`](/core/api/actions/reconnect) --- --- url: /react/api/hooks/useSendCalls.md description: >- Hook that requests for the wallet to sign and broadcast a batch of calls (transactions) to the network. --- # useSendCalls Hook that requests for the wallet to sign and broadcast a batch of calls (transactions) to the network. [Read more.](https://github.com/ethereum/EIPs/blob/815028dc634463e1716fc5ce44c019a6040f0bef/EIPS/eip-5792.md#wallet_sendcalls) ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSendCalls.md","from":661,"to":698} import { useSendCalls } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSendCalls.md","from":747,"to":1292} import { useSendCalls } from 'wagmi' import { parseEther } from 'viem' function App() { const sendCalls = useSendCalls() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### Synchronous Usage If you want to wait for the calls to be included in a block, you can use `useSendCallsSync`: ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSendCalls.md","from":1494,"to":2055} import { useSendCallsSync } from 'wagmi' import { parseEther } from 'viem' function App() { const sendCallsSync = useSendCallsSync() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSendCalls.md","from":2127,"to":2179} import { type UseSendCallsParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSendCalls.md","from":2387,"to":2564} import { useSendCalls } from 'wagmi' import { config } from './config' // [!code focus] function App() { const sendCalls = useSendCalls({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSendCalls.md","from":2683,"to":2735} import { type UseSendCallsReturnType } from 'wagmi' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`sendCalls`](/core/api/actions/sendCalls) --- --- url: /react/api/hooks/useSendTransaction.md description: 'Hook for creating, signing, and sending transactions to networks.' --- # useSendTransaction Hook for creating, signing, and sending transactions to networks. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSendTransaction.md","from":503,"to":546} import { useSendTransaction } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSendTransaction.md","from":595,"to":979} import { useSendTransaction } from 'wagmi' import { parseEther } from 'viem' function App() { const sendTransaction = useSendTransaction() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### Synchronous Usage If you want to wait for the transaction to be included in a block, you can use `useSendTransactionSync`: ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSendTransaction.md","from":1193,"to":1593} import { useSendTransactionSync } from 'wagmi' import { parseEther } from 'viem' function App() { const sendTransactionSync = useSendTransactionSync() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSendTransaction.md","from":1665,"to":1723} import { type UseSendTransactionParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSendTransaction.md","from":1931,"to":2126} import { useSendTransaction } from 'wagmi' import { config } from './config' // [!code focus] function App() { const sendTransaction = useSendTransaction({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSendTransaction.md","from":2245,"to":2303} import { type UseSendTransactionReturnType } from 'wagmi' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`sendTransaction`](/core/api/actions/sendTransaction) --- --- url: /vue/api/composables/useSendTransaction.md description: 'Composable for creating, signing, and sending transactions to networks.' --- # useSendTransaction Composable for creating, signing, and sending transactions to networks. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSendTransaction.md","from":520,"to":568} import { useSendTransaction } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSendTransaction.md","from":617,"to":984} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSendTransaction.md","from":1054,"to":1117} import { type UseSendTransactionParameters } from '@wagmi/vue' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSendTransaction.md","from":1309,"to":1519} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSendTransaction.md","from":1636,"to":1699} import { type UseSendTransactionReturnType } from '@wagmi/vue' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`sendTransaction`](/core/api/actions/sendTransaction) --- --- url: /react/api/hooks/useShowCallsStatus.md description: Action to request for the wallet to show information about a call batch --- # useShowCallsStatus Action to request for the wallet to show information about a call batch that was sent via `useSendCalls`. [Read more.](https://github.com/ethereum/EIPs/blob/1663ea2e7a683285f977eda51c32cec86553f585/EIPS/eip-5792.md#wallet_showcallsstatus) ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useShowCallsStatus.md","from":686,"to":729} import { useShowCallsStatus } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useShowCallsStatus.md","from":778,"to":1102} import { useShowCallsStatus } from 'wagmi' import { parseEther } from 'viem' function App() { const showCallsStatus = useShowCallsStatus() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useShowCallsStatus.md","from":1174,"to":1232} import { type UseShowCallsStatusParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useShowCallsStatus.md","from":1440,"to":1635} import { useShowCallsStatus } from 'wagmi' import { config } from './config' // [!code focus] function App() { const showCallsStatus = useShowCallsStatus({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useShowCallsStatus.md","from":1754,"to":1812} import { type UseShowCallsStatusReturnType } from 'wagmi' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`showCallsStatus`](/core/api/actions/showCallsStatus) --- --- url: /react/api/hooks/useSignMessage.md description: Hook for signing messages. --- # useSignMessage Hook for signing messages. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSignMessage.md","from":393,"to":432} import { useSignMessage } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSignMessage.md","from":481,"to":703} import { useSignMessage } from 'wagmi' function App() { const signMessage = useSignMessage() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSignMessage.md","from":775,"to":829} import { type UseSignMessageParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSignMessage.md","from":1037,"to":1220} import { useSignMessage } from 'wagmi' import { config } from './config' // [!code focus] function App() { const signMessage = useSignMessage({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSignMessage.md","from":1339,"to":1393} import { type UseSignMessageReturnType } from 'wagmi' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`signMessage`](/core/api/actions/signMessage) --- --- url: /vue/api/composables/useSignMessage.md description: Composable for signing messages. --- # useSignMessage Composable for signing messages. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSignMessage.md","from":410,"to":454} import { useSignMessage } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSignMessage.md","from":503,"to":740} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSignMessage.md","from":810,"to":869} import { type UseSignMessageParameters } from '@wagmi/vue' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSignMessage.md","from":1061,"to":1258} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSignMessage.md","from":1375,"to":1434} import { type UseSignMessageReturnType } from '@wagmi/vue' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`signMessage`](/core/api/actions/signMessage) --- --- url: /react/api/hooks/useSignTransaction.md description: Hook for signing transactions. --- # useSignTransaction Hook for signing transactions. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSignTransaction.md","from":433,"to":476} import { useSignTransaction } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSignTransaction.md","from":525,"to":909} import { useSignTransaction } from 'wagmi' import { parseEther } from 'viem' function App() { const signTransaction = useSignTransaction() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSignTransaction.md","from":981,"to":1039} import { type UseSignTransactionParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSignTransaction.md","from":1247,"to":1442} import { useSignTransaction } from 'wagmi' import { config } from './config' // [!code focus] function App() { const signTransaction = useSignTransaction({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSignTransaction.md","from":1561,"to":1619} import { type UseSignTransactionReturnType } from 'wagmi' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`signTransaction`](/core/api/actions/signTransaction) --- --- url: /vue/api/composables/useSignTransaction.md description: 'Composable for creating, and signing transactions to networks.' --- # useSignTransaction Composable for signing transactions. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSignTransaction.md","from":476,"to":524} import { useSignTransaction } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSignTransaction.md","from":574,"to":941} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSignTransaction.md","from":1012,"to":1075} import { type UseSignTransactionParameters } from '@wagmi/vue' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSignTransaction.md","from":1268,"to":1478} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSignTransaction.md","from":1596,"to":1659} import { type UseSignTransactionReturnType } from '@wagmi/vue' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`signTransaction`](/core/api/actions/signTransaction) --- --- url: /react/api/hooks/useSignTypedData.md description: >- Hook for signing typed data and calculating an Ethereum-specific EIP-712 signature. --- # useSignTypedData Hook for signing typed data and calculating an Ethereum-specific [EIP-712](https://eips.ethereum.org/EIPS/eip-712) signature. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSignTypedData.md","from":565,"to":606} import { useSignTypedData } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSignTypedData.md","from":655,"to":1605} import { useSignTypedData } from 'wagmi' function App() { const signTypedData = useSignTypedData() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSignTypedData.md","from":1677,"to":1733} import { type UseSignTypedDataParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSignTypedData.md","from":1941,"to":2130} import { useSignTypedData } from 'wagmi' import { config } from './config' // [!code focus] function App() { const signTypedData = useSignTypedData({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSignTypedData.md","from":2249,"to":2305} import { type UseSignTypedDataReturnType } from 'wagmi' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## Type Inference With [`types`](/core/api/actions/signTypedData#types) setup correctly, TypeScript will infer the correct types for [`domain`](/core/api/actions/signTypedData#domain), [`message`](/core/api/actions/signTypedData#message), and [`primaryType`](/core/api/actions/signTypedData#primarytype). See the Wagmi [TypeScript docs](/react/typescript) for more information. ::: code-group ```ts twoslash [Inline] // {"path":"/vercel/path0/site/react/api/hooks/useSignTypedData.md","from":2774,"to":8051} // @twoslash-cache: {"v":1,"hash":"d2bde2039b22db2dad4de0b0b1a903198c36d1f3885f32042523a928c54eac6c","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAjgEsBzMAFWwwoAEQCGaMYnYBVODADKvAUNESxAJRhoArqRU4APDrABrSAHcwAPkog2Y0g0QA2KgBsYYHmnxIAjADMVJKkPNp43HyCOGqSdu5cYLiIAAxUjPiOYow05K4AvhToQniEJOQhdM4gABRiiWJwAJTsOvJK0ariksZmlja1WNkAttpkcAD80sAAOmDsi+zMYABmvNPsAMIs6zzsAD5tYLDryVAA3PNL7CM6kmhcLJtzCzdLLACy9xIwm7W1IiOLhiABGnjgM2u7xhmBwkPYrxhyKWyFo0jYpCSPAAutJSDAxFAWO4MOwYsIemIAAqjcakZA4q5vFEwtHSAAGmOxyAAJMBud4CjiOXjjqcksJmazkez2BzViZck8wHyBWgsUKRWKTBLztKZe85RyiVACXA4GrBTxhaLpLqYGcpdDDaj0fLQRAIO4rRrsbadSdHZLLi7XexjaCMDRLfzrQH7UGnaGWeHI9H4P5fZqbdrE3rnanXemYwAmbP+vPi4P6sPF90cqMxwIVrV26vJg3hiMNpvwAAsrdz7YdnbrhpL8AArEOEx2Q12072M3AXLOq6OF+OZZO4AB2dcjpNbosT5cxgAch8DBZT3cWu4AnNf8zXC/ee5y+3B/KkX/Pa1PHdz0zLM4z9NsbzfO9713fxy3AnM503QCPzgltEMrI9b0XesvxXfxB0wyDXzHIDWTgmdiOHKCyLQkCfzXajkOPVDYIY/wD2YjdWPfdj8Jjfwr247DoNws8B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iYSCCVI7AE6sC1i4SVItQzQ8w8wHJnCkgwCO6NAtQFSz6bhiw76EY44wAVG0gAA5HCqqTGkCqqdaKqcxkqSqewKqQwZqTbmqf5nqUUGGEyWGBjsgAaYGqqQRqadqV6paRQA6VKqqYii6QqqqW6fqaeMqY6QEXAL6XxjqSdO6daR6W8FaW8OgZgRGZapqcKVim8KoXAOQdymmbmemXmXmTcNkeOI6TsBYKmaeAUaqcwVsCIKWGIIEFAI+AAGKPiBAXgACiQQtZXRe4HZjAqQU4AAgqCFsHuM2R2XuIEP2CIKsBeCICIBeBvhWRcrGTcHsSWV6QAEIQCggrnvBVnMGghbnHlblnmginknkXlXlXnXknm3nHmPmnnHn7mQprlLChlqkAASMAWyEAMaO5oIAAhPufGQUM0HYGMPEIgKANUF4NwCwO7ggAUAUEAA=="} import { useSignTypedData } from 'wagmi' // ---cut--- const signTypedData = useSignTypedData() signTypedData.mutate({ types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', // ^? message: { // ^? from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, }) ``` ```ts twoslash [Const-Asserted] // {"path":"/vercel/path0/site/react/api/hooks/useSignTypedData.md","from":8087,"to":13727} // @twoslash-cache: {"v":1,"hash":"8427c5e54a9e414e6af6101fcf5a4a859fe80517a66aac11a86d69f45d4b46b5","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAkxzkXeAB0w7Ye1IwAhlBYAbDOwAKZOC15jJMuakEidoiVLCz2YcQFsYvfuDMwrAbm27hag0a4X2VtqQCWYAOb2jsIAvhR8wbouGsY2liAA7uLS0jBoQUJOe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v8rCpCzcvCkWb8oJDCqCzCkIdgc+X+VgdIBYMAXODnN7KnW8snZXSnTedkPkQQQQNinHcQS7FgmgdkbiHETC4QeYxY8ilyD8gS5i4QbEg4i4JSjS5izSzSo4w2Gk7CkBBIRSy4Rkl864oBMucMcQAsKAG5AAMWbPtAAFEF4LKbkixXwnLGBCRkQABBEhIBV8Oypy18YsMuAYe0MuMue0F1YysfKk/SpCgAIQgBITit0FMuuJISSuyqSrypIVypyoKqKqKuKpytKuysqtyuyvSqWDZP+I5MAoAAkYAUgIBwgUqSEABCdKyCtSPkUEN+LeRAUAVkZ0fOFgbEBAEIEIIAA=="} import { useSignTypedData } from 'wagmi' // ---cut--- const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const const signTypedData = useSignTypedData() signTypedData.mutate({ types, primaryType: 'Mail', // ^? message: { // ^? from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, }) ``` ::: ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`signTypedData`](/core/api/actions/signTypedData) --- --- url: /vue/api/composables/useSignTypedData.md description: >- Composable for signing typed data and calculating an Ethereum-specific EIP-712 signature. --- # useSignTypedData Composable for signing typed data and calculating an Ethereum-specific [EIP-712](https://eips.ethereum.org/EIPS/eip-712) signature. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSignTypedData.md","from":582,"to":628} import { useSignTypedData } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSignTypedData.md","from":677,"to":1527} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSignTypedData.md","from":1597,"to":1658} import { type UseSignTypedDataParameters } from '@wagmi/vue' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSignTypedData.md","from":1850,"to":2054} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSignTypedData.md","from":2171,"to":2232} import { type UseSignTypedDataReturnType } from '@wagmi/vue' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## Type Inference With [`types`](/core/api/actions/signTypedData#types) setup correctly, TypeScript will infer the correct types for [`domain`](/core/api/actions/signTypedData#domain), [`message`](/core/api/actions/signTypedData#message), and [`primaryType`](/core/api/actions/signTypedData#primarytype). See the Wagmi [TypeScript docs](/vue/typescript) for more information. ::: code-group ```ts twoslash [Inline] // {"path":"/vercel/path0/site/vue/api/composables/useSignTypedData.md","from":2699,"to":8053} // @twoslash-cache: {"v":1,"hash":"d347b35c1f3533593f8f8fd4f638678cdbe6746b6703290029ec262c44dffe62","data":"N4Igdg9gJgpgziAXAbVAFw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fZI5I5Nw/RY4WZOwFgPZcEIx3pYIWwIgLYYggQUAAEAAYgBDDuiEEMufsVeOiIwKkGuAAIKhhbBXibnohXiBCTgiCrCvgiAiCvixRzmIqtkkgQAxGLBZkABCEAoYH5xIC5YIoY/5EF/50FoYUFkFsF8F8FCFkFSFEFaFUFEFIFbZpRW+dhJZAAEjAMChAIiIBaGAAIQgVJl2bNB2BChiBICgDVBeDcAsAM4IAFAFBAA"} import { useSignTypedData } from '@wagmi/vue' // ---cut--- const signTypedData = useSignTypedData() signTypedData.mutate({ types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', // ^? message: { // ^? from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, }) ``` ```ts twoslash [Const-Asserted] // {"path":"/vercel/path0/site/vue/api/composables/useSignTypedData.md","from":8089,"to":13794} // @twoslash-cache: {"v":1,"hash":"eaf9c3d409bf800893a6c4a9064554dc68fdcaaccc9fdd1dd7d8f8bf1a066ba2","data":"N4Igdg9gJgpgziAXAbVAFwJ4AcZJACwgDcYAnEAGhDRgA808BjCMONAAkxzkXeAB0w7Ye1IwAhlBYAbDOwAKZOC15jJMuakEidoiVLCz2YcQFsYvfuDMwrAbm27hag0a4X2VtqQCWYAOb2jsIAvhR8wbouGsY2liAA7uLS0jBoQUJOeuqGcu7xklBicHAZOiEAug6ZzvoxALLiPtKqdbnsWjVRbUYm5vEAZqQQpmVZ0e35niCKpMpgY6HhAl06E71x02gQi905btgeVrPzu2ERqyLrcn1HIMxgNI+lINVZ2a55h/HefoGvkUq1RClBAbHEpAYiAAbFRUgE0PgkABWKhoCH+NJ4dwIOF+XCIAAMVEY+Ah4kY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WuWuXgmGztnCD0UgIJC2WXD5nIVkJAJlzhjiAFhQDvIABiK59ozCC8oV7yRYr4zCjAhIyIAAgqEkAq+NFcwq+MWGXAMPaGXGXPaIGgFeUOZSIDKafvRQAEIQChJVW6BBVkKhINWdUNU9WhLdVdV9UDUDWDVdXDWdXjXdWdWtVLCRCfm8DIUAASMAKQEA4QTVoSAAhK1WRWpHyKCG/FvIgKAKyM6PnCwNiAgCECEEAA=="} import { useSignTypedData } from '@wagmi/vue' // ---cut--- const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const const signTypedData = useSignTypedData() signTypedData.mutate({ types, primaryType: 'Mail', // ^? message: { // ^? from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, }) ``` ::: ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`signTypedData`](/core/api/actions/signTypedData) --- --- url: /react/api/hooks/useSimulateContract.md description: Hook for simulating/validating a contract interaction. --- # useSimulateContract Hook for simulating/validating a contract interaction. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":414,"to":458} import { useSimulateContract } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":507,"to":880} import { useSimulateContract } from 'wagmi' import { abi } from './abi' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: details Composing with `useWriteContract` `useSimulateContract` can be combined with [`useWriteContract`](/react/api/hooks/useWriteContract) to reduce the amount of validation required by wallets. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":1205,"to":1790} import { useSimulateContract, useWriteContract } from 'wagmi' import { abi } from './abi' function App() { const { data } = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], }) const { writeContract } = useWriteContract() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":1898,"to":1957} import { type UseSimulateContractParameters } from 'wagmi' ``` ### abi `Abi | undefined` The contract's ABI. Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":2187,"to":2594} import { useSimulateContract } from 'wagmi' import { abi } from './abi' // [!code focus] function App() { const result = useSimulateContract({ abi, // [!code focus] address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### accessList `AccessList | undefined` The access list. ::: code-group ```tsx [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":2774,"to":3326} import { useSimulateContract } from 'wagmi' import { abi } from './abi' import { config } from './config' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], accessList: [{ // [!code focus] address: '0x1', // [!code focus] storageKeys: ['0x1'], // [!code focus] }], // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### account `Account | undefined` Account to use when calling the contract (`msg.sender`). Throws if account is not found on [`connector`](#connector). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":3602,"to":4051} import { useSimulateContract } from 'wagmi' import { abi } from './abi' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], account: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### address `Address | undefined` The contract's address. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":4233,"to":4623} import { useSimulateContract } from 'wagmi' import { abi } from './abi' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', // [!code focus] functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### args `readonly unknown[] | undefined` * Arguments to pass when calling the contract. * Inferred from [`abi`](#abi) and [`functionName`](#functionname). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":4903,"to":5362} import { useSimulateContract } from 'wagmi' import { abi } from './abi' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ // [!code focus] '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', // [!code focus] 123n, // [!code focus] ], // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### blockNumber `bigint | undefined` Block number to call contract at. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":5562,"to":5981} import { useSimulateContract } from 'wagmi' import { abi } from './abi' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], blockNumber: 17829139n, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to call contract at. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":6220,"to":6633} import { useSimulateContract } from 'wagmi' import { abi } from './abi' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], blockTag: 'safe', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":6858,"to":7330} import { useSimulateContract } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] import { abi } from './abi' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":7620,"to":8074} import { useSimulateContract } from 'wagmi' import { abi } from './abi' import { config } from './config' // [!code focus] function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` [Connector](/react/api/connectors) to simulate transaction with. ::: code-group ```tsx [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":8300,"to":8810} import { useConnectorClient, useSimulateContract } from 'wagmi' import { abi } from './abi' import { config } from './config' function App() { const { data: connector } = useConnectorClient() const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], connector, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### dataSuffix `` `0x${string}` | undefined `` Data to append to the end of the calldata. Useful for adding a ["domain" tag](https://opensea.notion.site/opensea/Seaport-Order-Attributions-ec2d69bf455041a5baa490941aad307f). ::: code-group ```tsx [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":9156,"to":9643} import { useSimulateContract } from 'wagmi' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], dataSuffix: '0xdeadbeef', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### functionName `string | undefined` * Function to call on the contract. * Inferred from [`abi`](#abi). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":9872,"to":10263} import { useSimulateContract } from 'wagmi' import { abi } from './abi' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', // [!code focus] args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gas `bigint | undefined` Gas provided for transaction execution. ::: code-group ```tsx [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":10455,"to":10938} import { useSimulateContract } from 'wagmi' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], gas: parseGwei('20'), // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### gasPrice `bigint | undefined` The price in wei to pay per gas. Only applies to [Legacy Transactions](https://viem.sh/docs/glossary/terms#legacy-transaction). ::: code-group ```tsx [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":11228,"to":11716} import { useSimulateContract } from 'wagmi' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], gasPrice: parseGwei('20'), // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxFeePerGas `bigint | undefined` Total fee per gas in wei, inclusive of [`maxPriorityFeePerGas`](#maxPriorityFeePerGas). Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```tsx [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":12064,"to":12556} import { useSimulateContract } from 'wagmi' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], maxFeePerGas: parseGwei('20'), // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxPriorityFeePerGas `bigint | undefined` Max priority fee per gas in wei. Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```tsx [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":12857,"to":13391} import { useSimulateContract } from 'wagmi' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], maxFeePerGas: parseGwei('20'), maxPriorityFeePerGas: parseGwei('2'), // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### nonce `number` Unique number identifying this transaction. ::: code-group ```tsx [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":13582,"to":14022} import { useSimulateContract } from 'wagmi' import { abi } from './abi' import { config } from './config' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], nonce: 123, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### type `'legacy' | 'eip1559' | 'eip2930' | undefined` Optional transaction request type to narrow parameters. ::: code-group ```tsx [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":14257,"to":14702} import { useSimulateContract } from 'wagmi' import { abi } from './abi' import { config } from './config' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], type: 'eip1559', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### value `bigint | undefined` Value in wei sent with this transaction. ::: code-group ```tsx [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":14897,"to":15386} import { useSimulateContract } from 'wagmi' import { parseEther } from 'viem' import { abi } from './abi' import { config } from './config' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], value: parseEther('0.01'), // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":15641,"to":16086} import { useSimulateContract } from 'wagmi' import { abi } from './abi' import { config } from './config' function App() { const result = useSimulateContract({ abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSimulateContract.md","from":16238,"to":16297} import { type UseSimulateContractReturnType } from 'wagmi' ``` The return type's [`data`](#data) property is inferrable via the combination of [`abi`](#abi), [`functionName`](#functionname), and [`args`](#args). Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for more info. *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## Type Inference With [`abi`](#abi) setup correctly, TypeScript will infer the correct types for [`functionName`](#functionname), [`args`](#args), and [`value`](#value). See the Wagmi [TypeScript docs](/react/typescript) for more information. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`simulateContract`](/core/api/actions/simulateContract) --- --- url: /vue/api/composables/useSimulateContract.md description: Composable for simulating/validating a contract interaction. --- # useSimulateContract Composable for simulating/validating a contract interaction. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":431,"to":480} import { useSimulateContract } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":529,"to":903} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":1067,"to":1131} import { type UseSimulateContractParameters } from '@wagmi/vue' ``` ### abi `Abi | undefined` The contract's ABI. Check out the [TypeScript docs](/vue/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":1359,"to":1767} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### accessList `AccessList | undefined` The access list. ::: code-group ```vue [index.ts] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":1945,"to":2490} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### account `Account | undefined` Account to use when calling the contract (`msg.sender`). Throws if account is not found on [`connector`](#connector). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":2764,"to":3212} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### address `Address | undefined` The contract's address. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":3392,"to":3783} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### args `readonly unknown[] | undefined` * Arguments to pass when calling the contract. * Inferred from [`abi`](#abi) and [`functionName`](#functionname). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":4061,"to":4521} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### blockNumber `bigint | undefined` Block number to call contract at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":4719,"to":5137} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to call contract at. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":5374,"to":5786} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":6009,"to":6480} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":6752,"to":7205} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` [Connector](/vue/api/connectors) to simulate transaction with. ::: code-group ```vue [index.ts] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":7427,"to":7934} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### dataSuffix `` `0x${string}` | undefined `` Data to append to the end of the calldata. Useful for adding a ["domain" tag](https://opensea.notion.site/opensea/Seaport-Order-Attributions-ec2d69bf455041a5baa490941aad307f). ::: code-group ```vue [index.ts] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":8278,"to":8764} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### functionName `string | undefined` * Function to call on the contract. * Inferred from [`abi`](#abi). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":8991,"to":9383} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gas `bigint | undefined` Gas provided for transaction execution. ::: code-group ```vue [index.ts] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":9573,"to":10055} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### gasPrice `bigint | undefined` The price in wei to pay per gas. Only applies to [Legacy Transactions](https://viem.sh/docs/glossary/terms#legacy-transaction). ::: code-group ```vue [index.ts] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":10343,"to":10830} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxFeePerGas `bigint | undefined` Total fee per gas in wei, inclusive of [`maxPriorityFeePerGas`](#maxPriorityFeePerGas). Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```vue [index.ts] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":11176,"to":11667} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxPriorityFeePerGas `bigint | undefined` Max priority fee per gas in wei. Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```vue [index.ts] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":11966,"to":12497} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### nonce `number` Unique number identifying this transaction. ::: code-group ```vue [index.ts] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":12686,"to":13125} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### type `'legacy' | 'eip1559' | 'eip2930' | undefined` Optional transaction request type to narrow parameters. ::: code-group ```vue [index.ts] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":13358,"to":13802} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### value `bigint | undefined` Value in wei sent with this transaction. ::: code-group ```vue [index.ts] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":13995,"to":14483} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Composables that have identical context will share the same cache. ::: code-group ```vue [index.ts] // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":14742,"to":15186} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSimulateContract.md","from":15336,"to":15400} import { type UseSimulateContractReturnType } from '@wagmi/vue' ``` The return type's [`data`](#data) property is inferrable via the combination of [`abi`](#abi), [`functionName`](#functionname), and [`args`](#args). Check out the [TypeScript docs](/vue/typescript#const-assert-abis-typed-data) for more info. *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## Type Inference With [`abi`](#abi) setup correctly, TypeScript will infer the correct types for [`functionName`](#functionname), [`args`](#args), and [`value`](#value). See the Wagmi [TypeScript docs](/vue/typescript) for more information. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`simulateContract`](/core/api/actions/simulateContract) --- --- url: /react/api/hooks/useStorageAt.md description: Hook for returning the value from a storage slot at a given address. --- # useStorageAt Hook for returning the value from a storage slot at a given address. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useStorageAt.md","from":406,"to":443} import { useStorageAt } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useStorageAt.md","from":492,"to":662} import { useStorageAt } from 'wagmi' function App() { const result = useStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: '0x0', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useStorageAt.md","from":734,"to":786} import { type UseStorageAtParameters } from 'wagmi' ``` ### address `Address | undefined` The contract address. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useStorageAt.md","from":884,"to":1071} import { useStorageAt } from 'wagmi' function App() { const result = useStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', // [!code focus] slot: '0x0', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### slot `Hex | undefined` The storage position (as a hex encoded value). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useStorageAt.md","from":1233,"to":1420} import { useStorageAt } from 'wagmi' function App() { const result = useStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: '0x0', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## blockNumber `bigint | undefined` The block number to check the storage at. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useStorageAt.md","from":1586,"to":1801} import { useStorageAt } from 'wagmi' function App() { const result = useStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', blockNumber: 16280770n, // [!code focus] slot: '0x0', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` The block tag to check the storage at. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useStorageAt.md","from":2012,"to":2221} import { useStorageAt } from 'wagmi' function App() { const result = useStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', blockTag: 'safe', // [!code focus] slot: '0x0', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` The chain ID to check the storage at. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useStorageAt.md","from":2404,"to":2661} import { useStorageAt } from 'wagmi' import { mainnet } from '@wagmi/core/chains' function App() { const result = useStorageAt({ chainId: mainnet.id, // [!code focus] address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: '0x0', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useStorageAt.md","from":2915,"to":3165} import { useStorageAt } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useStorageAt({ config, // [!code focus] address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: '0x0', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useStorageAt.md","from":3385,"to":3626} import { useStorageAt } from 'wagmi' import { config } from './config' function App() { const result = useStorageAt({ scopeKey: 'foo' // [!code focus] address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: '0x0', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useStorageAt.md","from":3742,"to":3794} import { type UseStorageAtReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getStorageAt`](/core/api/actions/getStorageAt) --- --- url: /react/api/hooks/useSwitchChain.md description: Hook for switching the target chain for a connector or the Wagmi `Config`. --- # useSwitchChain Hook for switching the target chain for a connector or the Wagmi [`Config`](/react/api/createConfig#config). ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSwitchChain.md","from":523,"to":562} import { useSwitchChain } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSwitchChain.md","from":611,"to":957} import { useChains, useSwitchChain } from 'wagmi' function App() { const switchChain = useSwitchChain() const chains = useChains() return (
{chains.map((chain) => ( ))}
) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: tip When connected, `switchChain` will switch the target chain for the connector. When not connected, `switchChain` will switch the target chain for the Wagmi [`Config`](/react/api/createConfig#config). ::: ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSwitchChain.md","from":1241,"to":1295} import { type UseSwitchChainParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSwitchChain.md","from":1503,"to":1686} import { useSwitchChain } from 'wagmi' import { config } from './config' // [!code focus] function App() { const switchChain = useSwitchChain({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSwitchChain.md","from":1805,"to":1859} import { type UseSwitchChainReturnType } from 'wagmi' ``` ### chains [deprecated](/react/guides/migrate-from-v2-to-v3#removed-useswitchchain-chains) `readonly [Chain, ...Chain[]]` Globally configured chains. Useful for rendering a list of available chains to switch to. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSwitchChain.md","from":2143,"to":2454} import { useSwitchChain } from 'wagmi' function App() { const switchChain = useSwitchChain() return (
{switchChain.chains.map((chain) => ( ))}
) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`switchChain`](/core/api/actions/switchChain) --- --- url: /solid/api/primitives/useSwitchChain.md description: Primitive for switching chains. --- # useSwitchChain Primitive for switching chains. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useSwitchChain.md","from":406,"to":452} import { useSwitchChain } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useSwitchChain.md","from":501,"to":1005} import { useSwitchChain } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' import { For } from 'solid-js' function App() { const switchChain = useSwitchChain() return (
{(chain) => ( )}
) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useSwitchChain.md","from":1077,"to":1181} import { useSwitchChain } from '@wagmi/solid' useSwitchChain.Parameters useSwitchChain.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useSwitchChain.md","from":1266,"to":1329} useSwitchChain(() => ({ config, // mutation options... })) ``` ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useSwitchChain.md","from":1571,"to":1644} import { useSwitchChain } from '@wagmi/solid' useSwitchChain.ReturnType ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`switchChain`](/core/api/actions/switchChain) --- --- url: /vue/api/composables/useSwitchChain.md description: >- Composable for switching the target chain for a connector or the Wagmi `Config`. --- # useSwitchChain Composable for switching the target chain for a connector or the Wagmi [`Config`](/vue/api/createConfig#config). ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSwitchChain.md","from":538,"to":582} import { useSwitchChain } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSwitchChain.md","from":631,"to":1000} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: tip When connected, `switchChain` will switch the target chain for the connector. When not connected, `switchChain` will switch the target chain for the Wagmi [`Config`](/vue/api/createConfig#config). ::: ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSwitchChain.md","from":1280,"to":1339} import { type UseSwitchChainParameters } from '@wagmi/vue' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSwitchChain.md","from":1531,"to":1729} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSwitchChain.md","from":1846,"to":1905} import { type UseSwitchChainReturnType } from '@wagmi/vue' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`switchChain`](/core/api/actions/switchChain) --- --- url: /react/api/hooks/useSwitchConnection.md description: Hook for switching the current connection. --- # useSwitchConnection Hook for switching the current connection. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSwitchConnection.md","from":465,"to":509} import { useSwitchConnection } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSwitchConnection.md","from":558,"to":983} import { useConnections, useSwitchConnection } from 'wagmi' function App() { const switchConnection = useSwitchConnection() const connections = useConnections() return (
{connections.map((connection) => ( ))}
) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSwitchConnection.md","from":1055,"to":1114} import { type UseSwitchConnectionParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSwitchConnection.md","from":1322,"to":1510} import { useSwitchConnection } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useSwitchConnection({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useSwitchConnection.md","from":1629,"to":1688} import { type UseSwitchConnectionReturnType } from 'wagmi' ``` ### connectors [deprecated](/react/guides/migrate-from-v2-to-v3#removed-usedisconnect-connectors-useswitchconnection-connectors) `readonly Connector[]` Globally configured and actively connected connectors. Useful for rendering a list of available connectors to switch to. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useSwitchConnection.md","from":2033,"to":2385} import { useSwitchConnection } from 'wagmi' function App() { const switchConnection = useSwitchConnection() return (
{switchConnection.connectors.map((connector) => ( ))}
) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`switchConnection`](/core/api/actions/switchConnection) --- --- url: /solid/api/primitives/useSwitchConnection.md description: Primitive for switching between connections. --- # useSwitchConnection Primitive for switching between connections when multiple wallets are connected. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useSwitchConnection.md","from":462,"to":513} import { useSwitchConnection } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useSwitchConnection.md","from":562,"to":1080} import { useConnections, useSwitchConnection } from '@wagmi/solid' import { For } from 'solid-js' function App() { const connections = useConnections() const switchConnection = useSwitchConnection() return (
{(connection) => ( )}
) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useSwitchConnection.md","from":1152,"to":1271} import { useSwitchConnection } from '@wagmi/solid' useSwitchConnection.Parameters useSwitchConnection.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useSwitchConnection.md","from":1356,"to":1424} useSwitchConnection(() => ({ config, // mutation options... })) ``` ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useSwitchConnection.md","from":1666,"to":1749} import { useSwitchConnection } from '@wagmi/solid' useSwitchConnection.ReturnType ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`switchConnection`](/core/api/actions/switchConnection) --- --- url: /vue/api/composables/useSwitchConnection.md description: Composable for switching the current connection. --- # useSwitchConnection Composable for switching the current connection. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSwitchConnection.md","from":477,"to":521} import { useSwitchConnection } from 'wagmi' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSwitchConnection.md","from":570,"to":1007} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSwitchConnection.md","from":1077,"to":1136} import { type UseSwitchConnectionParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useSwitchConnection.md","from":1328,"to":1536} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useSwitchConnection.md","from":1653,"to":1712} import { type UseSwitchConnectionReturnType } from 'wagmi' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`switchConnection`](/core/api/actions/switchConnection) --- --- url: /react/api/hooks/useTransaction.md description: Hook for fetching transactions given hashes or block identifiers. --- # useTransaction Hook for fetching transactions given hashes or block identifiers. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransaction.md","from":412,"to":451} import { useTransaction } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransaction.md","from":500,"to":678} import { useTransaction } from 'wagmi' function App() { const result = useTransaction({ hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransaction.md","from":750,"to":804} import { type UseTransactionParameters } from 'wagmi' ``` *** ### blockHash `bigint | undefined` Block hash to get transaction at (with [`index`](#index)). ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransaction.md","from":917,"to":1131} import { useTransaction } from 'wagmi' function App() { const result = useTransaction({ blockHash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', // [!code focus] index: 0, }) } ``` ### blockNumber `bigint | undefined` Block number to get transaction at (with [`index`](#index)). ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransaction.md","from":1243,"to":1400} import { useTransaction } from 'wagmi' function App() { const result = useTransaction({ blockNumber: 17829139n, // [!code focus] index: 0, }) } ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get transaction at (with [`index`](#index)). ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransaction.md","from":1556,"to":1707} import { useTransaction } from 'wagmi' function App() { const result = useTransaction({ blockTag: 'safe', // [!code focus] index: 0, }) } ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransaction.md","from":1817,"to":2076} import { useTransaction } from 'wagmi' import { mainnet } from 'wagmi/chains' function App() { const result = useTransaction({ chainId: mainnet.id, // [!code focus] hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', }) } ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransaction.md","from":2284,"to":2542} import { useTransaction } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useTransaction({ hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### hash `` `0x${string}` | undefined `` Hash to get transaction. [`enabled`](#enabled) set to `false` if `hash` and [`index`](#index) are `undefined`. ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransaction.md","from":2754,"to":2949} import { useTransaction } from 'wagmi' function App() { const result = useTransaction({ hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', // [!code focus] }) } ``` ### index `number | undefined` An index to be used with a block identifier ([hash](#blockhash), [number](#blocknumber), or [tag](#blocktag)). [`enabled`](#enabled) set to `false` if `index` and [`hash`](#hash) are `undefined`. ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransaction.md","from":3190,"to":3341} import { useTransaction } from 'wagmi' function App() { const result = useTransaction({ blockTag: 'safe', index: 0 // [!code focus] }) } ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransaction.md","from":3411,"to":3465} import { type UseTransactionReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getTransaction`](/core/api/actions/getTransaction) --- --- url: /vue/api/composables/useTransaction.md description: Composable for fetching transactions given hashes or block identifiers. --- # useTransaction Composable for fetching transactions given hashes or block identifiers. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useTransaction.md","from":429,"to":473} import { useTransaction } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useTransaction.md","from":522,"to":715} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useTransaction.md","from":785,"to":844} import { type UseTransactionParameters } from '@wagmi/vue' ``` *** ### blockHash `bigint | undefined` Block hash to get transaction at (with [`index`](#index)). ```vue // {"path":"/vercel/path0/site/vue/api/composables/useTransaction.md","from":958,"to":1185} ``` ### blockNumber `bigint | undefined` Block number to get transaction at (with [`index`](#index)). ```vue // {"path":"/vercel/path0/site/vue/api/composables/useTransaction.md","from":1298,"to":1468} ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get transaction at (with [`index`](#index)). ```vue // {"path":"/vercel/path0/site/vue/api/composables/useTransaction.md","from":1625,"to":1789} ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ```vue // {"path":"/vercel/path0/site/vue/api/composables/useTransaction.md","from":1900,"to":2172} ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useTransaction.md","from":2364,"to":2635} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### hash `` `0x${string}` | undefined `` Hash to get transaction. [`enabled`](#enabled) set to `false` if `hash` and [`index`](#index) are `undefined`. ```vue // {"path":"/vercel/path0/site/vue/api/composables/useTransaction.md","from":2846,"to":3056} ``` ### index `number | undefined` An index to be used with a block identifier ([hash](#blockhash), [number](#blocknumber), or [tag](#blocktag)). [`enabled`](#enabled) set to `false` if `index` and [`hash`](#hash) are `undefined`. ```vue // {"path":"/vercel/path0/site/vue/api/composables/useTransaction.md","from":3298,"to":3462} ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useTransaction.md","from":3532,"to":3591} import { type UseTransactionReturnType } from '@wagmi/vue' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getTransaction`](/core/api/actions/getTransaction) --- --- url: /react/api/hooks/useTransactionConfirmations.md description: >- Hook for fetching the number of blocks passed (confirmations) since the transaction was processed on a block. --- # useTransactionConfirmations Hook for fetching the number of blocks passed (confirmations) since the transaction was processed on a block. If confirmations is 0, then the Transaction has not been confirmed & processed yet. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransactionConfirmations.md","from":662,"to":714} import { useTransactionConfirmations } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionConfirmations.md","from":763,"to":967} import { useTransactionConfirmations } from 'wagmi' function App() { const result = useTransactionConfirmations({ hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransactionConfirmations.md","from":1039,"to":1106} import { type UseTransactionConfirmationsParameters } from 'wagmi' ``` *** ### hash `` `0x${string}` | undefined `` The hash of the transaction. ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransactionConfirmations.md","from":1195,"to":1416} import { useTransactionConfirmations } from 'wagmi' function App() { const result = useTransactionConfirmations({ hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', // [!code focus] }) } ``` ### transactionReceipt `TransactionReceipt | undefined` The transaction receipt. ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransactionConfirmations.md","from":1511,"to":1685} import { useTransactionConfirmations } from 'wagmi' function App() { const result = useTransactionConfirmations({ transactionReceipt: { ... }, // [!code focus] }) } ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransactionConfirmations.md","from":1795,"to":2080} import { useTransactionConfirmations } from 'wagmi' import { mainnet } from 'wagmi/chains' function App() { const result = useTransactionConfirmations({ chainId: mainnet.id, // [!code focus] hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', }) } ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionConfirmations.md","from":2288,"to":2572} import { useTransactionConfirmations } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useTransactionConfirmations({ config, // [!code focus] hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionConfirmations.md","from":2792,"to":3048} import { useBlock } from 'wagmi' import { config } from './config' function App() { const result = useTransactionConfirmations({ scopeKey: 'foo' // [!code focus] hash: '0x0fa64daeae54e207aa98613e308c2ba8abfe274f75507e741508cc4db82c8cb5', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransactionConfirmations.md","from":3164,"to":3231} import { type UseTransactionConfirmationsReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getTransactionConfirmations`](/core/api/actions/getTransactionConfirmations) --- --- url: /react/api/hooks/useTransactionCount.md description: Hook for fetching the number of transactions an Account has broadcast / sent. --- # useTransactionCount Hook for fetching the number of transactions an Account has sent. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransactionCount.md","from":437,"to":481} import { useTransactionCount } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionCount.md","from":530,"to":697} import { useTransactionCount } from 'wagmi' function App() { const result = useTransactionCount({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransactionCount.md","from":769,"to":828} import { type UseTransactionCountParameters } from 'wagmi' ``` ### address `Address | undefined` Address to get the transaction count for. [`enabled`](#enabled) set to `false` if `address` is `undefined`. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionCount.md","from":1012,"to":1235} import { useTransactionCount } from 'wagmi' import { mainnet } from 'wagmi/chains' function App() { const result = useTransactionCount({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### blockNumber `bigint | undefined` Block number to get the transaction count at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionCount.md","from":1409,"to":1621} import { useTransactionCount } from 'wagmi' function App() { const result = useTransactionCount({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', blockNumber: 17829139n, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to get the transaction count at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionCount.md","from":1834,"to":2042} import { useTransactionCount } from 'wagmi' function App() { const result = useTransactionCount({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', blockTag: 'latest', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionCount.md","from":2231,"to":2496} import { useTransactionCount } from 'wagmi' import { mainnet } from 'wagmi/chains' // [!code focus] function App() { const result = useTransactionCount({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', chainId: mainnet.id, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionCount.md","from":2750,"to":2997} import { useTransactionCount } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useTransactionCount({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionCount.md","from":3217,"to":3422} import { useTransactionCount } from 'wagmi' function App() { const result = useTransactionCount({ address: '0x4557B18E779944BFE9d78A672452331C186a9f48', scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransactionCount.md","from":3538,"to":3597} import { type UseTransactionCountReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getTransactionCount`](/core/api/actions/getTransactionCount) --- --- url: /react/api/hooks/useTransactionReceipt.md description: Hook for return the Transaction Receipt given a Transaction hash. --- # useTransactionReceipt Hook for return the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt) given a [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransactionReceipt.md","from":564,"to":610} import { useTransactionReceipt } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionReceipt.md","from":659,"to":851} import { useTransactionReceipt } from 'wagmi' function App() { const result = useTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransactionReceipt.md","from":923,"to":984} import { type UseTransactionReceiptParameters } from 'wagmi' ``` ### hash `` `0x${string}` | undefined `` A transaction hash. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionReceipt.md","from":1087,"to":1296} import { useTransactionReceipt } from 'wagmi' function App() { const result = useTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` The ID of chain to return the transaction receipt from. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionReceipt.md","from":1497,"to":1771} import { useTransactionReceipt } from 'wagmi' import { mainnet } from 'wagmi/chains' function App() { const result = useTransactionReceipt({ chainId: mainnet.id, // [!code focus] hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionReceipt.md","from":2025,"to":2297} import { useTransactionReceipt } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useTransactionReceipt({ config, // [!code focus] hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useTransactionReceipt.md","from":2517,"to":2780} import { useTransactionReceipt } from 'wagmi' import { config } from './config' function App() { const result = useTransactionReceipt({ scopeKey: 'foo' // [!code focus] hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useTransactionReceipt.md","from":2896,"to":2957} import { type UseTransactionReceiptReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getTransactionReceipt`](/core/api/actions/getTransactionReceipt) --- --- url: /vue/api/composables/useTransactionReceipt.md description: Composable for return the Transaction Receipt given a Transaction hash. --- # useTransactionReceipt Composable for return the [Transaction Receipt](https://viem.sh/docs/glossary/terms#transaction-receipt) given a [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useTransactionReceipt.md","from":581,"to":632} import { useTransactionReceipt } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useTransactionReceipt.md","from":681,"to":888} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useTransactionReceipt.md","from":958,"to":1024} import { type UseTransactionReceiptParameters } from '@wagmi/vue' ``` ### hash `` `0x${string}` | undefined `` A transaction hash. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useTransactionReceipt.md","from":1127,"to":1351} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` The ID of chain to return the transaction receipt from. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useTransactionReceipt.md","from":1550,"to":1836} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useTransactionReceipt.md","from":2072,"to":2357} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Composables that have identical context will share the same cache. ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useTransactionReceipt.md","from":2581,"to":2857} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useTransactionReceipt.md","from":2971,"to":3037} import { type UseTransactionReceiptReturnType } from '@wagmi/vue' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getTransactionReceipt`](/core/api/actions/getTransactionReceipt) --- --- url: /react/api/hooks/useVerifyMessage.md description: Hook for verify that a message was signed by the provided address. --- # useVerifyMessage Hook for verify that a message was signed by the provided address. It supports verifying messages that were signed by either a Smart Contract Account or Externally Owned Account. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useVerifyMessage.md","from":526,"to":567} import { useVerifyMessage } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyMessage.md","from":616,"to":956} import { useVerifyMessage } from 'wagmi' function App() { const result = useVerifyMessage({ address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: 'hello world', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useVerifyMessage.md","from":1028,"to":1084} import { type UseVerifyMessageParameters } from 'wagmi' ``` ### address `Address | undefined` The Ethereum address that signed the original message. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyMessage.md","from":1215,"to":1572} import { useVerifyMessage } from 'wagmi' function App() { const result = useVerifyMessage({ address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', // [!code focus] message: 'hello world', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### message `string | { raw: Hex | ByteArray } | undefined` The message to be verified. By default, wagmi verifies the UTF-8 representation of the message. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyMessage.md","from":1817,"to":2174} import { useVerifyMessage } from 'wagmi' function App() { const result = useVerifyMessage({ address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: 'hello world', // [!code focus] signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: tip By default, viem signs the UTF-8 representation of the message. To sign the data representation of the message, you can use the `raw` attribute. ```ts // {"path":"/vercel/path0/site/react/api/hooks/useVerifyMessage.md","from":2385,"to":2763} import { useVerifyMessage } from 'wagmi' function App() { const result = useVerifyMessage({ address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: { raw: '0x68656c6c6f20776f726c64' } // [!code focus] signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ::: ### signature `Hex | ByteArray | undefined` The signature that was generated by signing the message with the address's signer. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyMessage.md","from":2936,"to":3293} import { useVerifyMessage } from 'wagmi' function App() { const result = useVerifyMessage({ address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: 'hello world', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` Only used when verifying a message that was signed by a Smart Contract Account. The ID of chain to check if the contract was already deployed. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyMessage.md","from":3581,"to":4002} import { useVerifyMessage } from 'wagmi' import { mainnet } from 'wagmi/chains' function App() { const result = useVerifyMessage({ chainId: mainnet.id, // [!code focus] address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: 'hello world', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` Only used when verifying a message that was signed by a Smart Contract Account. The block number to check if the contract was already deployed. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyMessage.md","from":4271,"to":4695} import { useVerifyMessage } from 'wagmi' import { mainnet } from 'wagmi/chains' function App() { const result = useVerifyMessage({ blockNumber: 12345678n, // [!code focus] address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: 'hello world', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Only used when verifying a message that was signed by a Smart Contract Account. The block tag to check if the contract was already deployed. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyMessage.md","from":5008,"to":5429} import { useVerifyMessage } from 'wagmi' import { mainnet } from 'wagmi/chains' function App() { const result = useVerifyMessage({ blockTag: 'pending', // [!code focus] address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: 'hello world', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyMessage.md","from":5683,"to":6103} import { useVerifyMessage } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useVerifyMessage({ config, // [!code focus] address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: 'hello world', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyMessage.md","from":6323,"to":6734} import { useVerifyMessage } from 'wagmi' import { config } from './config' function App() { const result = useVerifyMessage({ scopeKey: 'foo' // [!code focus] address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: 'hello world', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useVerifyMessage.md","from":6850,"to":6906} import { type UseVerifyMessageReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`verifyMessage`](/core/api/actions/verifyMessage) --- --- url: /react/api/hooks/useVerifyTypedData.md description: Hook for verify that a typed data was signed by the provided address. --- # useVerifyTypedData Hook for verify that a typed data was signed by the provided address. It supports verifying typed data that were signed by either a Smart Contract Account or Externally Owned Account. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":546,"to":589} import { useVerifyTypedData } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":638,"to":1304} import { domain, types } from './data' import { useVerifyTypedData } from 'wagmi' function App() { const result = useVerifyTypedData({ domain, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts [data.ts] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":1324,"to":1825} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":1897,"to":1955} import { type UseVerifyTypedDataParameters } from 'wagmi' ``` ### address `Address | undefined` The Ethereum address that signed the original typed data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":2089,"to":2772} import { domain, types } from './data' import { useVerifyTypedData } from 'wagmi' function App() { const result = useVerifyTypedData({ domain, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', // [!code focus] signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts [data.ts] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":2792,"to":3293} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### domain `TypedDataDomain | undefined` The typed data domain. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":3445,"to":4266} import { types } from './data' import { useVerifyTypedData } from 'wagmi' function App() { const result = useVerifyTypedData({ domain: { // [!code focus:6] name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts [data.ts] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":4286,"to":4589} // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### types The type definitions for the typed data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":4727,"to":5678} import { domain } from './data' import { useVerifyTypedData } from 'wagmi' function App() { const result = useVerifyTypedData({ domain, types: { // [!code focus:11] Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts [data.ts] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":5698,"to":5895} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### primaryType `string | undefined` The primary `type` to extract from types and use in `value`. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":6081,"to":7048} import { domain } from './data' import { useVerifyTypedData } from 'wagmi' function App() { const result = useVerifyTypedData({ domain, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ // [!code focus:5] { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', // [!code focus] message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts [data.ts] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":7068,"to":7265} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### message Type inferred from `types` & `primaryType`. The message to be verified. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":7437,"to":8123} import { domain, types } from './data' import { useVerifyTypedData } from 'wagmi' function App() { const result = useVerifyTypedData({ domain, types, message: { // [!code focus:11] from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts [data.ts] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":8143,"to":8644} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### signature `Hex | ByteArray | undefined` The signature that was generated by signing the typed data with the address's signer. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":8862,"to":9545} import { domain, types } from './data' import { useVerifyTypedData } from 'wagmi' function App() { const result = useVerifyTypedData({ domain, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', // [!code focus] }) } ``` ```ts [data.ts] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":9565,"to":10066} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` Only used when verifying a typed data that was signed by a Smart Contract Account. The ID of chain to check if the contract was already deployed. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":10357,"to":11104} import { domain, types } from './data' import { useVerifyTypedData } from 'wagmi' import { mainnet } from 'wagmi/chains' function App() { const result = useVerifyTypedData({ chainId: mainnet.id, // [!code focus] domain, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts [data.ts] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":11124,"to":11625} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` Only used when verifying a typed data that was signed by a Smart Contract Account. The block number to check if the contract was already deployed. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":11897,"to":12608} import { domain, types } from './data' import { useVerifyTypedData } from 'wagmi' function App() { const result = useVerifyTypedData({ blockNumber: 12345678n, // [!code focus] domain, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts [data.ts] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":12628,"to":13129} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Only used when verifying a typed data that was signed by a Smart Contract Account. The block tag to check if the contract was already deployed. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":13445,"to":14152} import { domain, types } from './data' import { useVerifyTypedData } from 'wagmi' function App() { const result = useVerifyTypedData({ blockTag: 'latest', // [!code focus] domain, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts [data.ts] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":14172,"to":14673} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":14927,"to":15673} import { domain, types } from './data' import { useVerifyTypedData } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useVerifyTypedData({ config, // [!code focus] domain, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts [data.ts] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":15693,"to":16194} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":16414,"to":17117} import { domain, types } from './data' import { useVerifyTypedData } from 'wagmi' function App() { const result = useVerifyTypedData({ scopeKey: 'foo' // [!code focus] domain, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) } ``` ```ts [data.ts] // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":17137,"to":17638} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useVerifyTypedData.md","from":17754,"to":17812} import { type UseVerifyTypedDataReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## Type Inference With [`types`](#types) setup correctly, TypeScript will infer the correct types for [`domain`](#domain), [`message`](#message), and [`primaryType`](#primarytype). See the Wagmi [TypeScript docs](/react/typescript) for more information. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`verifyTypedData`](/core/api/actions/verifyTypedData) --- --- url: /react/api/hooks/useWaitForCallsStatus.md description: Waits for a call bundle to be confirmed & included on a block. --- # useWaitForCallsStatus Waits for a call bundle to be confirmed & included on a block before returning the status & receipts. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWaitForCallsStatus.md","from":484,"to":530} import { useWaitForCallsStatus } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWaitForCallsStatus.md","from":579,"to":725} import { useWaitForCallsStatus } from 'wagmi' function App() { const result = useWaitForCallsStatus({ id: '0x...', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWaitForCallsStatus.md","from":797,"to":858} import { type UseWaitForCallsStatusParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWaitForCallsStatus.md","from":1066,"to":1275} import { useWaitForCallsStatus } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useWaitForCallsStatus({ config, // [!code focus] id: '0x...', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` Connector to get call statuses with. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWaitForCallsStatus.md","from":1438,"to":1732} import { useWaitForCallsStatus, useConnections } from 'wagmi' import { config } from './config' // [!code focus] function App() { const connections = useConnections() const result = useWaitForCallsStatus({ connector: connections[0]?.connector, // [!code focus] id: '0x...', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### id `string` Identifier of the call batch. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWaitForCallsStatus.md","from":1864,"to":2044} import { useWaitForCallsStatus } from '@wagmi/core' import { config } from './config' const status = await useWaitForCallsStatus({ id: '0x1234567890abcdef', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### pollingInterval `number | undefined` Polling interval in milliseconds. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWaitForCallsStatus.md","from":2205,"to":2411} import { useWaitForCallsStatus } from '@wagmi/core' import { config } from './config' const status = await useWaitForCallsStatus({ id: '0x1234567890abcdef', pollingInterval: 1_000, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### scopeKey `string | undefined` Scopes the cache to a given context. Hooks that have identical context will share the same cache. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWaitForCallsStatus.md","from":2631,"to":2849} import { useWaitForCallsStatus } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useWaitForCallsStatus({ id: '0x...', scopeKey: 'foo', // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### timeout `number | undefined` Timeout in milliseconds. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWaitForCallsStatus.md","from":2993,"to":3192} import { useWaitForCallsStatus } from '@wagmi/core' import { config } from './config' const status = await useWaitForCallsStatus({ id: '0x1234567890abcdef', timeout: 10_000, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWaitForCallsStatus.md","from":3308,"to":3369} import { type UseWaitForCallsStatusReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`waitForCallsStatus`](https://viem.sh/docs/actions/wallet/waitForCallsStatus) --- --- url: /react/api/hooks/useWaitForTransactionReceipt.md description: >- Hook that waits for the transaction to be included on a block, and then returns the transaction receipt. If the transaction reverts, then the action will throw an error. Replacement detection (e.g. sped up transactions) is also supported. --- # useWaitForTransactionReceipt Hook that waits for the transaction to be included on a block, and then returns the transaction receipt. If the transaction reverts, then the action will throw an error. Replacement detection (e.g. sped up transactions) is also supported. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWaitForTransactionReceipt.md","from":830,"to":883} import { useWaitForTransactionReceipt } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWaitForTransactionReceipt.md","from":932,"to":1138} import { useWaitForTransactionReceipt } from 'wagmi' function App() { const result = useWaitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWaitForTransactionReceipt.md","from":1210,"to":1278} import { type UseWaitForTransactionReceiptParameters } from 'wagmi' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWaitForTransactionReceipt.md","from":1399,"to":1686} import { useWaitForTransactionReceipt } from 'wagmi' import { mainnet } from 'wagmi/chains' function App() { const result = useWaitForTransactionReceipt({ chainId: mainnet.id, // [!code focus] hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', }) } ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWaitForTransactionReceipt.md","from":1894,"to":2180} import { useWaitForTransactionReceipt } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useWaitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### confirmations `number | undefined` The number of confirmations (blocks that have passed) to wait before resolving. ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWaitForTransactionReceipt.md","from":2370,"to":2615} import { useWaitForTransactionReceipt } from 'wagmi' function App() { const result = useWaitForTransactionReceipt({ confirmations: 2, // [!code focus] hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', }) } ``` ### onReplaced `(({ reason: 'replaced' | 'repriced' | 'cancelled'; replacedTransaction: Transaction; transaction: Transaction; transactionReceipt: TransactionReceipt }) => void) | undefined` Optional callback to emit if the transaction has been replaced. ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWaitForTransactionReceipt.md","from":2897,"to":3177} import { useWaitForTransactionReceipt } from 'wagmi' function App() { const result = useWaitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', onReplaced: replacement => console.log(replacement), // [!code focus] }) } ``` ### pollingInterval `number | undefined` * Polling frequency (in milliseconds). * Defaults to the [Config's `pollingInterval` config](/react/api/createConfig#pollinginterval). ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWaitForTransactionReceipt.md","from":3378,"to":3629} import { useWaitForTransactionReceipt } from 'wagmi' function App() { const result = useWaitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', pollingInterval: 1_000, // [!code focus] }) } ``` ### hash `` `0x${string}` | undefined `` The transaction hash to wait for. [`enabled`](#enabled) set to `false` if `hash` is `undefined`. ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWaitForTransactionReceipt.md","from":3792,"to":4015} import { useWaitForTransactionReceipt } from 'wagmi' function App() { const result = useWaitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', // [!code focus] }) } ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWaitForTransactionReceipt.md","from":4085,"to":4153} import { type UseWaitForTransactionReceiptReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`waitForTransactionReceipt`](/core/api/actions/waitForTransactionReceipt) --- --- url: /vue/api/composables/useWaitForTransactionReceipt.md description: >- Composable that waits for the transaction to be included on a block, and then returns the transaction receipt. If the transaction reverts, then the action will throw an error. Replacement detection (e.g. sped up transactions) is also supported. --- # useWaitForTransactionReceipt Composable that waits for the transaction to be included on a block, and then returns the transaction receipt. If the transaction reverts, then the action will throw an error. Replacement detection (e.g. sped up transactions) is also supported. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useWaitForTransactionReceipt.md","from":847,"to":905} import { useWaitForTransactionReceipt } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useWaitForTransactionReceipt.md","from":954,"to":1175} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useWaitForTransactionReceipt.md","from":1245,"to":1316} import { type WaitForTransactionReceiptParameters } from '@wagmi/core' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useWaitForTransactionReceipt.md","from":1439,"to":1744} ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useWaitForTransactionReceipt.md","from":1936,"to":2235} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### confirmations `number | undefined` The number of confirmations (blocks that have passed) to wait before resolving. ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useWaitForTransactionReceipt.md","from":2425,"to":2683} ``` ### onReplaced `(({ reason: 'replaced' | 'repriced' | 'cancelled'; replacedTransaction: Transaction; transaction: Transaction; transactionReceipt: TransactionReceipt }) => void) | undefined` Optional callback to emit if the transaction has been replaced. ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useWaitForTransactionReceipt.md","from":2967,"to":3260} ``` ### pollingInterval `number | undefined` * Polling frequency (in milliseconds). * Defaults to the [Config's `pollingInterval` config](/vue/api/createConfig#pollinginterval). ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useWaitForTransactionReceipt.md","from":3461,"to":3725} ``` ### hash `` `0x${string}` | undefined `` The transaction hash to wait for. [`enabled`](#enabled) set to `false` if `hash` is `undefined`. ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useWaitForTransactionReceipt.md","from":3890,"to":4128} ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useWaitForTransactionReceipt.md","from":4198,"to":4271} import { type UseWaitForTransactionReceiptReturnType } from '@wagmi/vue' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`waitForTransactionReceipt`](/core/api/actions/waitForTransactionReceipt) --- --- url: /react/api/hooks/useWalletClient.md description: >- Hook for getting a Viem `WalletClient` object for the current or provided connector. --- # useWalletClient Hook for getting a Viem [`WalletClient`](https://viem.sh/docs/clients/wallet) object for the current or provided connector. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWalletClient.md","from":537,"to":577} import { useWalletClient } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWalletClient.md","from":626,"to":721} import { useWalletClient } from 'wagmi' function App() { const result = useWalletClient() } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: warning If you want to optimize bundle size, you should use [`useConnectorClient`](/react/api/hooks/useConnectorClient) along with Viem's [tree-shakable actions](https://viem.sh/docs/clients/custom#tree-shaking) instead. Since Wallet Client has all wallet actions attached directly to it. ::: ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWalletClient.md","from":1091,"to":1146} import { type UseWalletClientParameters } from 'wagmi' ``` ### account `Address | Account | undefined` Account to use with client. Throws if account is not found on [`connector`](#connector). ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWalletClient.md","from":1293,"to":1469} import { useWalletClient } from 'wagmi' function App() { const result = useWalletClient({ account: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] }) } ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use with client. ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWalletClient.md","from":1572,"to":1714} import { useWalletClient } from 'wagmi' function App() { const result = useWalletClient({ chainId: mainnet.id, // [!code focus] }) } ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWalletClient.md","from":1922,"to":2102} import { useWalletClient } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useWalletClient({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` * Connector to get client for. * Defaults to current connector. ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWalletClient.md","from":2264,"to":2484} import { useConnections, useWalletClient } from 'wagmi' function App() { const connections = useConnections(config) const result = useWalletClient({ connector: connections[0]?.connector, // [!code focus] }) } ``` *** ### query TanStack Query parameters. See the [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `queryFn` and `queryKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/types/properties.ts#L27) to see what parameters are not supported. All parameters listed below are supported. ::: #### enabled `boolean | undefined` * Set this to `false` to disable this query from automatically running. * Can be used for [Dependent Queries](https://tanstack.com/query/v5/docs/react/guides/dependent-queries). #### gcTime `number | Infinity | undefined` * Defaults to `5 * 60 * 1000` (5 minutes) or `Infinity` during SSR * The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different garbage collection times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### initialData `{{TData}} | (() => {{TData}}) | undefined` * If set, this value will be used as the initial data for the query cache (as long as the query hasn't been created or cached yet) * If set to a function, the function will be called **once** during the shared/root query initialization, and be expected to synchronously return the initialData * Initial data is considered stale by default unless a `staleTime` has been set. * `initialData` **is persisted** to the cache #### initialDataUpdatedAt `number | ((() => number | undefined)) | undefined` If set, this value will be used as the time (in milliseconds) of when the `initialData` itself was last updated. #### initialPageParam `{{TPageParam}}` The initial page parameter to be passed to the query function. #### getPreviousPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(firstPage: {{TData}}, allPages: {{TData}}[], firstPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### getNextPageParam This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. `(lastPage: {{TData}}, allPages: {{TData}}[], lastPageParam: {{TPageParam}}, allPageParams: {{TPageParam}}[]) => {{TPageParam}} | undefined | null` #### meta `Record | undefined` If set, stores additional information on the query cache entry that can be used as needed. It will be accessible wherever the `query` is available, and is also part of the `QueryFunctionContext` provided to the `queryFn`. #### networkMode `online' | 'always' | 'offlineFirst' | undefined` * Defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### notifyOnChangeProps `string[] | 'all' | (() => string[] | 'all') | undefined` * If set, the component will only re-render if any of the listed properties change. * If set to `['data', 'error']` for example, the component will only re-render when the `data` or `error` properties change. * If set to `'all'`, the component will opt-out of smart tracking and re-render whenever a query is updated. * If set to a function, the function will be executed to compute the list of properties. * By default, access to properties will be tracked, and the component will only re-render when one of the tracked properties change. #### placeholderData `{{TData}} | ((previousValue: {{TData}} | undefined; previousQuery: Query | undefined) => {{TData}}) | undefined` * If set, this value will be used as the placeholder data for this particular query observer while the query is still in the `pending` state. * `placeholderData` is **not persisted** to the cache * If you provide a function for `placeholderData`, as a first argument you will receive previously watched query data if available, and the second argument will be the complete previousQuery instance. #### queryClient `QueryClient | undefined` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### refetchInterval `number | false | ((data: {{TData}} | undefined, query: Query) => number | false | undefined) | undefined` * If set to a number, all queries will continuously refetch at this frequency in milliseconds * If set to a function, the function will be executed with the latest data and query to compute a frequency #### refetchIntervalInBackground `boolean | undefined` If set to `true`, queries that are set to continuously refetch with a `refetchInterval` will continue to refetch while their tab/window is in the background #### refetchOnMount `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on mount if the data is stale. * If set to `false`, the query will not refetch on mount. * If set to `'always'`, the query will always refetch on mount. * If set to a function, the function will be executed with the query to compute the value #### refetchOnReconnect `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on reconnect if the data is stale. * If set to `false`, the query will not refetch on reconnect. * If set to `'always'`, the query will always refetch on reconnect. * If set to a function, the function will be executed with the query to compute the value #### refetchOnWindowFocus `boolean | 'always' | ((query: Query) => boolean | 'always') | undefined` * Defaults to `true` * If set to `true`, the query will refetch on window focus if the data is stale. * If set to `false`, the query will not refetch on window focus. * If set to `'always'`, the query will always refetch on window focus. * If set to a function, the function will be executed with the query to compute the value #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * If `false`, failed queries will not retry by default. * If `true`, failed queries will retry infinitely. * If set to a `number`, e.g. `3`, failed queries will retry until the failed query count meets that number. * Defaults to `3` on the client and `0` on the server #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. #### retryOnMount `boolean | undefined` If set to `false`, the query will not be retried on mount if it contains an error. Defaults to `true`. #### select `((data: {{TData}}) => unknown) | undefined` This option can be used to transform or select a part of the data returned by the query function. It affects the returned `data` value, but does not affect what gets stored in the query cache. #### staleTime `number | Infinity | undefined` * Defaults to `0` * The time in milliseconds after data is considered stale. This value only applies to the hook it is defined on. * If set to `Infinity`, the data will never be considered stale #### structuralSharing `boolean | (((oldData: {{TData}} | undefined, newData: {{TData}}) => {{TData}})) | undefined` * Defaults to `true` * If set to `false`, structural sharing between query results will be disabled. * If set to a function, the old and new data values will be passed through this function, which should combine them into resolved data for the query. This way, you can retain references from the old data to improve performance even when that data contains non-serializable values. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWalletClient.md","from":2554,"to":2609} import { type UseWalletClientReturnType } from 'wagmi' ``` *** [TanStack Query query docs](https://tanstack.com/query/v5/docs/react/reference/useQuery) ### data `{{TData}}` * The last successfully resolved data for the query. * Defaults to `undefined`. ### dataUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'success'`. ### error `null | {{TError}}` * The error object for the query, if an error was thrown. * Defaults to `null` ### errorUpdatedAt `number` The timestamp for when the query most recently returned the `status` as `'error'`. ### errorUpdateCount `number` The sum of all errors. ### failureCount `number` * The failure count for the query. * Incremented every time the query fails. * Reset to `0` when the query succeeds. ### failureReason `null | {{TError}}` * The failure reason for the query retry. * Reset to `null` when the query succeeds. ### fetchNextPage `(options?: FetchNextPageOptions) => Promise>` This function allows you to fetch the next "page" of results. ### fetchPreviousPage `(options?: FetchPreviousPageOptions) => Promise>` This function allows you to fetch the previous "page" of results. ### hasNextPage `boolean` This will be `true` if there is a next page to be fetched (known via the `getNextPageParam` option). ### hasPreviousPage `boolean` This will be `true` if there is a previous page to be fetched (known via the `getPreviousPageParam` option). ### isFetchingNextPage `boolean` Will be `true` while fetching the next page with `fetchNextPage`. ### isFetchingPreviousPage `boolean` Will be `true` while fetching the previous page with `fetchPreviousPage`. ### fetchStatus `'fetching' | 'idle' | 'paused'` * `fetching` Is `true` whenever the queryFn is executing, which includes initial `pending` as well as background refetches. * `paused` The query wanted to fetch, but has been `paused`. * `idle` The query is not fetching. * See [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### isError / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isFetched `boolean` Will be `true` if the query has been fetched. ### isFetchedAfterMount `boolean` * Will be `true` if the query has been fetched after the component mounted. * This property can be used to not show any previously cached data. ### isFetching / isPaused `boolean` Boolean variables derived from [`fetchStatus`](#fetchstatus). ### isLoading `boolean` * Is `true` whenever the first fetch for a query is in-flight * Is the same as `isFetching && isPending` ### isLoadingError `boolean` Will be `true` if the query failed while fetching for the first time. ### isPlaceholderData `boolean` Will be `true` if the data shown is the placeholder data. ### isRefetchError `boolean` Will be `true` if the query failed while refetching. ### isRefetching `boolean` * Is `true` whenever a background refetch is in-flight, which *does not* include initial `'pending'`. * Is the same as `isFetching && !isPending` ### isStale `boolean` Will be `true` if the data in the cache is invalidated or if the data is older than the given `staleTime`. ### refetch `(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise>` * A function to manually refetch the query. * `throwOnError` * When set to `true`, an error will be thrown if the query fails. * When set to `false`, an error will be logged if the query fails. * `cancelRefetch` * When set to `true`, a currently running request will be cancelled before a new request is made. * When set to `false`, no refetch will be made if there is already a request running. * Defaults to `true` ### status `'error' | 'pending' | 'success'` * `pending` if there's no cached data and no query attempt was finished yet. * `error` if the query attempt resulted in an error. The corresponding `error` property has the error received from the attempted fetch * `success` if the query has received a response with no errors and is ready to display its data. The corresponding `data` property on the query is the data received from the successful fetch or if the query's `enabled` property is set to `false` and has not been fetched yet `data` is the first `initialData` supplied to the query on initialization. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Action * [`getWalletClient`](/core/api/actions/getWalletClient) --- --- url: /react/api/hooks/useWatchAsset.md description: >- Hook for requesting user tracks the token in their wallet. Returns a boolean indicating if the token was successfully added. --- # useWatchAsset Hook for requesting user tracks the token in their wallet. Returns a boolean indicating if the token was successfully added. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchAsset.md","from":581,"to":619} import { useWatchAsset } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchAsset.md","from":668,"to":1046} import { useWatchAsset } from 'wagmi' function App() { const { watchAsset } = useWatchAsset() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchAsset.md","from":1118,"to":1171} import { type UseWatchAssetParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchAsset.md","from":1379,"to":1555} import { useWatchAsset } from 'wagmi' import { config } from './config' // [!code focus] function App() { const result = useWatchAsset({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchAsset.md","from":1674,"to":1727} import { type UseWatchAssetReturnType } from 'wagmi' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`watchAsset`](/core/api/actions/watchAsset) --- --- url: /react/api/hooks/useWatchBlockNumber.md description: Hook that watches for block number changes. --- # useWatchBlockNumber Hook that watches for block number changes. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlockNumber.md","from":178,"to":222} import { useWatchBlockNumber } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlockNumber.md","from":271,"to":460} import { useWatchBlockNumber } from 'wagmi' function App() { useWatchBlockNumber({ onBlockNumber(blockNumber) { console.log('Block number changed!', blockNumber) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlockNumber.md","from":532,"to":591} import { type UseWatchBlockNumberParameters } from 'wagmi' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to watch blocks at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlockNumber.md","from":720,"to":937} import { useWatchBlockNumber } from 'wagmi' function App() { useWatchBlockNumber({ chainId: 1, // [!code focus] onBlockNumber(blockNumber) { console.log('New block number', blockNumber) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlockNumber.md","from":1188,"to":1435} import { useWatchBlockNumber } from 'wagmi' import { config } from './config' function App() { useWatchBlockNumber({ config, // [!code focus] onBlockNumber(blockNumber) { console.log('New block number', blockNumber) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### emitMissed `boolean` Whether or not to emit missed blocks to the callback. Defaults to `false`. Missed blocks may occur in instances where internet connection is lost, or the block time is lesser than the polling interval of the client. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlockNumber.md","from":1762,"to":1985} import { useWatchBlockNumber } from 'wagmi' function App() { useWatchBlockNumber({ emitMissed: true, // [!code focus] onBlockNumber(blockNumber) { console.log('New block number', blockNumber) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### emitOnBegin `boolean` Whether or not to emit the block to the callback when the subscription opens. Defaults to `false`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlockNumber.md","from":2195,"to":2419} import { useWatchBlockNumber } from 'wagmi' function App() { useWatchBlockNumber({ emitOnBegin: true, // [!code focus] onBlockNumber(blockNumber) { console.log('New block number', blockNumber) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### enabled `boolean` Whether or not to watch for blocks. Defaults to `true`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlockNumber.md","from":2582,"to":2803} import { useWatchBlockNumber } from 'wagmi' function App() { useWatchBlockNumber({ enabled: false, // [!code focus] onBlockNumber(blockNumber) { console.log('New block number', blockNumber) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onBlockNumber `(block: Block, prevblock: Block | undefined) => void` Callback for when block changes. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlockNumber.md","from":2994,"to":3229} import { useWatchBlockNumber } from 'wagmi' function App() { useWatchBlockNumber({ onBlockNumber(blockNumber) { // [!code focus] console.log('New block number', blockNumber) // [!code focus] }, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onError `((error: Error) => void) | undefined` Error thrown from getting the block. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlockNumber.md","from":3402,"to":3710} import { useWatchBlockNumber } from 'wagmi' function App() { useWatchBlockNumber({ onBlockNumber(blockNumber) { console.log('New block number', blockNumber) }, onError(error) { // [!code focus] console.error('Block error', error) // [!code focus] }, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### poll `boolean | undefined` * Whether or not to use a polling mechanism to check for new blocks instead of a WebSocket subscription. * Defaults to `false` for WebSocket Clients, and `true` for non-WebSocket Clients. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlockNumber.md","from":4014,"to":4232} import { useWatchBlockNumber } from 'wagmi' function App() { useWatchBlockNumber({ onBlockNumber(blockNumber) { console.log('New block number', blockNumber) } poll: true, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### pollingInterval `number | undefined` * Polling frequency (in milliseconds). * Defaults to the [Config's `pollingInterval` config](/core/api/createConfig#pollinginterval). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlockNumber.md","from":4492,"to":4722} import { useWatchBlockNumber } from 'wagmi' function App() { useWatchBlockNumber({ onBlockNumber(blockNumber) { console.log('New block number', blockNumber) } pollingInterval: 1_000, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### syncConnectedChain `boolean | undefined` * Set up subscriber for connected chain changes. * Defaults to [`Config['syncConnectedChain']`](/core/api/createConfig#syncconnectedchain). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlockNumber.md","from":4992,"to":5225} import { useWatchBlockNumber } from 'wagmi' function App() { useWatchBlockNumber({ onBlockNumber(blockNumber) { console.log('New block number', blockNumber) } syncConnectedChain: false, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlockNumber.md","from":5297,"to":5356} import { type UseWatchBlockNumberReturnType } from 'wagmi' ``` Function for cleaning up watcher. ## Action * [`watchBlockNumber`](/core/api/actions/watchBlockNumber) --- --- url: /solid/api/primitives/useWatchBlockNumber.md description: Primitive for watching block number changes. --- # useWatchBlockNumber Primitive for watching block number changes. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useWatchBlockNumber.md","from":180,"to":231} import { useWatchBlockNumber } from '@wagmi/solid' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/solid/api/primitives/useWatchBlockNumber.md","from":280,"to":629} import { useWatchBlockNumber } from '@wagmi/solid' import { createSignal } from 'solid-js' function App() { const [blockNumber, setBlockNumber] = createSignal() useWatchBlockNumber(() => ({ onBlockNumber(blockNumber) { setBlockNumber(blockNumber) }, })) return

Block number: {blockNumber()?.toString()}

} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/solid' import { mainnet, sepolia } from '@wagmi/solid/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useWatchBlockNumber.md","from":701,"to":820} import { useWatchBlockNumber } from '@wagmi/solid' useWatchBlockNumber.Parameters useWatchBlockNumber.SolidParameters ``` Parameters are passed as a getter function to maintain Solid reactivity. ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useWatchBlockNumber.md","from":905,"to":1005} useWatchBlockNumber(() => ({ onBlockNumber(blockNumber) { // Handle new block number }, })) ``` ### onBlockNumber `(blockNumber: bigint, prevBlockNumber: bigint | undefined) => void` Callback function called when the block number changes. ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when watching. ### config `Config | undefined` [`Config`](/solid/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/solid/api/WagmiProvider). ### emitMissed `boolean | undefined` Whether or not to emit missed block numbers to the callback. Defaults to `false`. Missed block numbers may occur in instances where internet connection is lost, or the block time is lesser than the polling interval of the client. ### emitOnBegin `boolean | undefined` Whether or not to emit the current block number when the watcher starts. Defaults to `false`. ### enabled `boolean | undefined` Whether or not to enable the watcher. Defaults to `true`. ### onError `((error: Error) => void) | undefined` Error handler called when an error occurs. ### poll `boolean | undefined` Whether or not to use polling. Defaults to the transport's `pollingInterval`. ### pollingInterval `number | undefined` Polling frequency (in ms). Defaults to the transport's `pollingInterval`. ### syncConnectedChain `boolean | undefined` Whether or not to sync the chain with the connected chain. Defaults to `true`. ## Return Type ```ts // {"path":"/vercel/path0/site/solid/api/primitives/useWatchBlockNumber.md","from":2396,"to":2479} import { useWatchBlockNumber } from '@wagmi/solid' useWatchBlockNumber.ReturnType ``` `void` ## Action * [`watchBlockNumber`](/core/api/actions/watchBlockNumber) --- --- url: /vue/api/composables/useWatchBlockNumber.md --- # useWatchBlockNumber Composable that watches for block number changes. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useWatchBlockNumber.md","from":91,"to":140} import { useWatchBlockNumber } from '@wagmi/vue' ``` ## Usage ::: code-group ```ts [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useWatchBlockNumber.md","from":188,"to":388} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useWatchBlockNumber.md","from":458,"to":522} import { type UseWatchBlockNumberParameters } from '@wagmi/vue' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to watch blocks at. ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ### emitMissed `boolean` Whether or not to emit missed blocks to the callback. Defaults to `false`. Missed blocks may occur in instances where internet connection is lost, or the block time is lesser than the polling interval of the client. ### emitOnBegin `boolean` Whether or not to emit the block to the callback when the subscription opens. Defaults to `false`. ### enabled `boolean` Whether or not to watch for blocks. Defaults to `true`. ### onBlockNumber `(block: Block, prevblock: Block | undefined) => void` Callback for when block changes. ### onError `((error: Error) => void) | undefined` Error thrown from getting the block. ### poll `boolean | undefined` * Whether or not to use a polling mechanism to check for new blocks instead of a WebSocket subscription. * Defaults to `false` for WebSocket Clients, and `true` for non-WebSocket Clients. ### pollingInterval `number | undefined` * Polling frequency (in milliseconds). * Defaults to the [Config's `pollingInterval` config](/core/api/createConfig#pollinginterval). ### syncConnectedChain `boolean | undefined` * Set up subscriber for connected chain changes. * Defaults to [`Config['syncConnectedChain']`](/core/api/createConfig#syncconnectedchain). ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useWatchBlockNumber.md","from":2052,"to":2116} import { type UseWatchBlockNumberReturnType } from '@wagmi/vue' ``` Function for cleaning up watcher. ## Action * [`watchBlockNumber`](/core/api/actions/watchBlockNumber) --- --- url: /react/api/hooks/useWatchBlocks.md description: Hook that watches for block changes. --- # useWatchBlocks Hook that watches for block changes. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":154,"to":193} import { useWatchBlocks } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":242,"to":398} import { useWatchBlocks } from 'wagmi' function App() { useWatchBlocks({ onBlock(block) { console.log('New block', block.number) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":470,"to":524} import { type UseWatchBlocksParameters } from 'wagmi' ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Block tag to watch blocks at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":678,"to":875} import { useWatchBlocks } from 'wagmi' function App() { useWatchBlocks({ blockTag: 'latest', // [!code focus] onBlock(block) { console.log('New block', block.number) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to watch blocks at. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":1049,"to":1238} import { useWatchBlocks } from 'wagmi' function App() { useWatchBlocks({ chainId: 1, // [!code focus] onBlock(block) { console.log('New block', block.number) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":1489,"to":1708} import { useWatchBlocks } from 'wagmi' import { config } from './config' function App() { useWatchBlocks({ config, // [!code focus] onBlock(block) { console.log('New block', block.number) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### emitMissed `boolean` Whether or not to emit missed blocks to the callback. Defaults to `false`. Missed blocks may occur in instances where internet connection is lost, or the block time is lesser than the polling interval of the client. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":2035,"to":2230} import { useWatchBlocks } from 'wagmi' function App() { useWatchBlocks({ emitMissed: true, // [!code focus] onBlock(block) { console.log('New block', block.number) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### emitOnBegin `boolean` Whether or not to emit the block to the callback when the subscription opens. Defaults to `false`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":2440,"to":2636} import { useWatchBlocks } from 'wagmi' function App() { useWatchBlocks({ emitOnBegin: true, // [!code focus] onBlock(block) { console.log('New block', block.number) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### enabled `boolean` Whether or not to watch for blocks. Defaults to `true`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":2799,"to":2992} import { useWatchBlocks } from 'wagmi' function App() { useWatchBlocks({ enabled: false, // [!code focus] onBlock(block) { console.log('New block', block.number) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### includeTransactions `boolean` Whether or not to unwrap transactions as objects (instead of hashes) in blocks. Defaults to `false`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":3212,"to":3416} import { useWatchBlocks } from 'wagmi' function App() { useWatchBlocks({ includeTransactions: true, // [!code focus] onBlock(block) { console.log('New block', block.number) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onBlock `(block: Block, prevblock: Block | undefined) => void` Callback for when block changes. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":3601,"to":3808} import { useWatchBlocks } from 'wagmi' function App() { useWatchBlocks({ onBlock(block) { // [!code focus] console.log('New block', block.number) // [!code focus] }, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onError `((error: Error) => void) | undefined` Error thrown from getting the block. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":3981,"to":4261} import { useWatchBlocks } from 'wagmi' function App() { useWatchBlocks({ onBlock(block) { console.log('New block', block.number) }, onError(error) { // [!code focus] console.error('Block error', error) // [!code focus] }, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### poll `boolean | undefined` * Whether or not to use a polling mechanism to check for new blocks instead of a WebSocket subscription. * Defaults to `false` for WebSocket Clients, and `true` for non-WebSocket Clients. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":4565,"to":4755} import { useWatchBlocks } from 'wagmi' function App() { useWatchBlocks({ onBlock(block) { console.log('New block', block.number) } poll: true, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### pollingInterval `number | undefined` * Polling frequency (in milliseconds). * Defaults to the [Config's `pollingInterval` config](/core/api/createConfig#pollinginterval). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":5015,"to":5217} import { useWatchBlocks } from 'wagmi' function App() { useWatchBlocks({ onBlock(block) { console.log('New block', block.number) } pollingInterval: 1_000, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### syncConnectedChain `boolean | undefined` * Set up subscriber for connected chain changes. * Defaults to [`Config['syncConnectedChain']`](/core/api/createConfig#syncconnectedchain). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":5487,"to":5692} import { useWatchBlocks } from 'wagmi' function App() { useWatchBlocks({ onBlock(block) { console.log('New block', block.number) } syncConnectedChain: false, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchBlocks.md","from":5764,"to":5818} import { type UseWatchBlocksReturnType } from 'wagmi' ``` ## Action * [`watchBlocks`](/core/api/actions/watchBlocks) --- --- url: /react/api/hooks/useWatchContractEvent.md description: Hook that watches and returns emitted contract event logs. --- # useWatchContractEvent Hook that watches and returns emitted contract event logs. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":212,"to":258} import { useWatchContractEvent } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":307,"to":590} import { useWatchContractEvent } from 'wagmi' import { abi } from './abi' function App() { useWatchContractEvent({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', abi, eventName: 'Transfer', onLogs(logs) { console.log('New logs!', logs) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":698,"to":759} import { type UseWatchContractEventParameters } from 'wagmi' ``` ### abi `Abi` The contract's ABI. Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":977,"to":1277} import { useWatchContractEvent } from 'wagmi' import { abi } from './abi' function App() { useWatchContractEvent({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', abi, // [!code focus] eventName: 'Transfer', onLogs(logs) { console.log('New logs!', logs) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### address `Address | undefined` The contract's address. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":1459,"to":1759} import { useWatchContractEvent } from 'wagmi' import { abi } from './abi' function App() { useWatchContractEvent({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', // [!code focus] abi, eventName: 'Transfer', onLogs(logs) { console.log('New logs!', logs) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### args `object | readonly unknown[] | undefined` * Arguments to pass when calling the contract. * Inferred from [`abi`](#abi) and [`eventName`](#eventname). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":2042,"to":2449} import { useWatchContractEvent } from 'wagmi' import { abi } from './abi' function App() { useWatchContractEvent({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', abi, args: { // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B' // [!code focus] } // [!code focus] eventName: 'Transfer', onLogs(logs) { console.log('New logs!', logs) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### batch `boolean | undefined` * Whether or not the events should be batched on each invocation. * Defaults to `true`. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":2693,"to":3011} import { useWatchContractEvent } from 'wagmi' import { abi } from './abi' function App() { useWatchContractEvent({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', abi, batch: false, // [!code focus] eventName: 'Transfer', onLogs(logs) { console.log('New logs!', logs) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":3231,"to":3547} import { useWatchContractEvent } from 'wagmi' import { abi } from './abi' function App() { useWatchContractEvent({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', abi, chainId: 1, // [!code focus] eventName: 'Transfer', onLogs(logs) { console.log('New logs!', logs) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":3837,"to":4183} import { useWatchContractEvent } from 'wagmi' import { abi } from './abi' import { config } from './config' function App() { useWatchContractEvent({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', abi, config, // [!code focus] eventName: 'Transfer', onLogs(logs) { console.log('New logs!', logs) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### eventName `string` * Event to listen for the contract. * Inferred from [`abi`](#abi). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":4397,"to":4731} import { useWatchContractEvent } from 'wagmi' import { abi } from './abi' import { config } from './config' function App() { useWatchContractEvent({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', abi, eventName: 'Transfer', // [!code focus] onLogs(logs) { console.log('New logs!', logs) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onError `((error: Error) => void) | undefined` Error thrown from getting the block number. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":4950,"to":5345} import { useWatchContractEvent } from 'wagmi' import { abi } from './abi' function App() { useWatchContractEvent({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', abi, eventName: 'Transfer', onLogs(logs) { console.log('New logs!', logs) }, onError(error) { // [!code focus] console.log('Error', error) // [!code focus] } // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onLogs `(logs: Log[], prevLogs: Log[] | undefined) => void` Callback for when logs changes. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":5565,"to":5898} import { useWatchContractEvent } from 'wagmi' import { abi } from './abi' function App() { useWatchContractEvent({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', abi, eventName: 'Transfer', onLogs(logs) { // [!code focus] console.log('New logs!', logs) // [!code focus] } // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### poll `boolean | undefined` * Whether or not to use a polling mechanism to check for new blocks instead of a WebSocket subscription. * Defaults to `false` for WebSocket Clients, and `true` for non-WebSocket Clients. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":6241,"to":6556} import { useWatchContractEvent } from 'wagmi' import { abi } from './abi' function App() { useWatchContractEvent({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', abi, eventName: 'Transfer', onLogs(logs) { console.log('New logs!', logs) }, poll: true // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### pollingInterval `number | undefined` * Polling frequency (in milliseconds). * Defaults to the [Config's `pollingInterval` config](/core/api/createConfig#pollinginterval). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":6855,"to":7182} import { useWatchContractEvent } from 'wagmi' import { abi } from './abi' function App() { useWatchContractEvent({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', abi, eventName: 'Transfer', onLogs(logs) { console.log('New logs!', logs) }, pollingInterval: 1_000 // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### strict `boolean | undefined` * Defaults to `false`. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":7362,"to":7679} import { useWatchContractEvent } from 'wagmi' import { abi } from './abi' function App() { useWatchContractEvent({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', abi, eventName: 'Transfer', onLogs(logs) { console.log('New logs!', logs) }, strict: true // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### syncConnectedChain `boolean | undefined` * Set up subscriber for connected chain changes. * Defaults to [`Config['syncConnectedChain']`](/core/api/createConfig#syncconnectedchain). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":7988,"to":8317} import { useWatchContractEvent } from 'wagmi' import { abi } from './abi' function App() { useWatchContractEvent({ address: '0x6b175474e89094c44da98b954eedeac495271d0f', abi, eventName: 'Transfer', onLogs(logs) { console.log('New logs!', logs) }, syncConnectedChain: true // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchContractEvent.md","from":8426,"to":8487} import { type UseWatchContractEventReturnType } from 'wagmi' ``` Hook returns `void` ## Action * [`watchContractEvent`](/core/api/actions/watchContractEvent) --- --- url: /vue/api/composables/useWatchContractEvent.md --- # useWatchContractEvent Composable that watches and returns emitted contract event logs. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useWatchContractEvent.md","from":108,"to":159} import { useWatchContractEvent } from '@wagmi/vue' ``` ## Usage ::: code-group ```ts [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useWatchContractEvent.md","from":207,"to":495} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useWatchContractEvent.md","from":601,"to":667} import { type UseWatchContractEventParameters } from '@wagmi/vue' ``` ### abi `Abi` The contract's ABI. Check out the [TypeScript docs](/vue/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ### address `Address | undefined` The contract's address. ### args `object | readonly unknown[] | undefined` * Arguments to pass when calling the contract. * Inferred from [`abi`](#abi) and [`eventName`](#eventname). ### batch `boolean | undefined` * Whether or not the events should be batched on each invocation. * Defaults to `true`. ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ### eventName `string` * Event to listen for the contract. * Inferred from [`abi`](#abi). ### onError `((error: Error) => void) | undefined` Error thrown from getting the block number. ### onLogs `(logs: Log[], prevLogs: Log[] | undefined) => void` Callback for when logs changes. ### poll `boolean | undefined` * Whether or not to use a polling mechanism to check for new blocks instead of a WebSocket subscription. * Defaults to `false` for WebSocket Clients, and `true` for non-WebSocket Clients. ### pollingInterval `number | undefined` * Polling frequency (in milliseconds). * Defaults to the [Config's `pollingInterval` config](/core/api/createConfig#pollinginterval). ### strict `boolean | undefined` * Defaults to `false`. ### syncConnectedChain `boolean | undefined` * Set up subscriber for connected chain changes. * Defaults to [`Config['syncConnectedChain']`](/core/api/createConfig#syncconnectedchain). ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useWatchContractEvent.md","from":2422,"to":2488} import { type UseWatchContractEventReturnType } from '@wagmi/vue' ``` Hook returns `void` ## Action * [`watchContractEvent`](/core/api/actions/watchContractEvent) --- --- url: /react/api/hooks/useWatchPendingTransactions.md description: Hook that watches and returns pending transaction hashes. --- # useWatchPendingTransactions Hook that watches and returns pending transaction hashes. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchPendingTransactions.md","from":222,"to":274} import { useWatchPendingTransactions } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchPendingTransactions.md","from":323,"to":527} import { useWatchPendingTransactions } from 'wagmi' function App() { useWatchPendingTransactions({ onTransactions(transactions) { console.log('New transactions!', transactions) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchPendingTransactions.md","from":599,"to":666} import { type UseWatchPendingTransactionsParameters } from 'wagmi' ``` ### batch `boolean | undefined` * Whether or not the transactions should be batched on each invocation. * Defaults to `true`. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchPendingTransactions.md","from":834,"to":1071} import { useWatchPendingTransactions } from 'wagmi' function App() { useWatchPendingTransactions({ batch: true // [!code focus] onTransactions(transactions) { console.log('New transactions!', transactions) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchPendingTransactions.md","from":1255,"to":1491} import { useWatchPendingTransactions } from 'wagmi' function App() { useWatchPendingTransactions({ chainId: 1 // [!code focus] onTransactions(transactions) { console.log('New transactions!', transactions) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchPendingTransactions.md","from":1745,"to":2011} import { useWatchPendingTransactions } from 'wagmi' import { config } from './config' function App() { useWatchPendingTransactions({ config // [!code focus] onTransactions(transactions) { console.log('New transactions!', transactions) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onError `((error: Error) => void) | undefined` Error thrown from watching pending transactions. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchPendingTransactions.md","from":2199,"to":2516} import { useWatchPendingTransactions } from 'wagmi' function App() { useWatchPendingTransactions({ onError(error) { // [!code focus] console.log('Error', error) // [!code focus] }, // [!code focus] onTransactions(transactions) { console.log('New transactions!', transactions) }, }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onTransactions `(transactions: Hash[], prevTransactions: Hash[] | undefined) => void` Callback when new incoming pending transactions are detected. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchPendingTransactions.md","from":2756,"to":3011} import { useWatchPendingTransactions } from 'wagmi' function App() { useWatchPendingTransactions({ onTransactions(transactions) { // [!code focus] console.log('New transactions!', transactions) // [!code focus] }, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### poll `boolean | undefined` * Whether or not to use a polling mechanism to check for new pending transactions instead of a WebSocket subscription. * Defaults to `false` for WebSocket Clients, and `true` for non-WebSocket Clients. ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchPendingTransactions.md","from":3332,"to":3569} import { useWatchPendingTransactions } from 'wagmi' function App() { useWatchPendingTransactions({ onTransactions(transactions) { console.log('New transactions!', transactions) }, poll: true, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### pollingInterval `number | undefined` * Polling frequency (in milliseconds). * Defaults to the [Config's `pollingInterval` config](/core/api/createConfig#pollinginterval). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchPendingTransactions.md","from":3832,"to":4081} import { useWatchPendingTransactions } from 'wagmi' function App() { useWatchPendingTransactions({ onTransactions(transactions) { console.log('New transactions!', transactions) }, pollingInterval: 1_000, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### syncConnectedChain `boolean | undefined` * Set up subscriber for connected chain changes. * Defaults to [`Config['syncConnectedChain']`](/core/api/createConfig#syncconnectedchain). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWatchPendingTransactions.md","from":4354,"to":4606} import { useWatchPendingTransactions } from 'wagmi' function App() { useWatchPendingTransactions({ onTransactions(transactions) { console.log('New transactions!', transactions) }, syncConnectedChain: false, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWatchPendingTransactions.md","from":4679,"to":4746} import { type UseWatchPendingTransactionsReturnType } from 'wagmi' ``` ## Action * [`watchPendingTransactions`](/core/api/actions/watchPendingTransactions) --- --- url: /react/api/hooks/useWriteContract.md description: Action for executing a write function on a contract. --- # useWriteContract Action for executing a write function on a contract. A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, hence a transaction is broadcasted in order to change the state. ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWriteContract.md","from":666,"to":707} import { useWriteContract } from 'wagmi' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWriteContract.md","from":757,"to":1309} import { useWriteContract } from 'wagmi' import { abi } from './abi' function App() { const writeContract = useWriteContract() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### Synchronous Usage If you want to wait for the transaction to be included in a block, you can use `useWriteContractSync`: ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWriteContract.md","from":1559,"to":2127} import { useWriteContractSync } from 'wagmi' import { abi } from './abi' function App() { const writeContractSync = useWriteContractSync() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWriteContract.md","from":2328,"to":2384} import { type UseWriteContractParameters } from 'wagmi' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWriteContract.md","from":2593,"to":2782} import { useWriteContract } from 'wagmi' import { config } from './config' // [!code focus] function App() { const writeContract = useWriteContract({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWriteContract.md","from":2902,"to":2958} import { type UseWriteContractReturnType } from 'wagmi' ``` The return type's [`data`](#data) property is inferrable via the combination of [`abi`](#abi), [`functionName`](#functionname), and [`args`](#args). Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for more info. *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## Type Inference With [`abi`](/core/api/actions/writeContract#abi) setup correctly, TypeScript will infer the correct types for [`functionName`](/core/api/actions/writeContract#functionname), [`args`](/core/api/actions/writeContract#args), and the [`value`](/core/api/actions/writeContract##value). See the Wagmi [TypeScript docs](/react/typescript) for more information. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`writeContract`](/core/api/actions/writeContract) --- --- url: /vue/api/composables/useWriteContract.md description: Composable for executing a write function on a contract. --- # useWriteContract Composable for executing a write function on a contract. A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, hence a transaction is broadcasted in order to change the state. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/composables/useWriteContract.md","from":679,"to":725} import { useWriteContract } from '@wagmi/vue' ``` ## Usage ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useWriteContract.md","from":775,"to":1261} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/composables/useWriteContract.md","from":1460,"to":1521} import { type UseWriteContractParameters } from '@wagmi/vue' ``` ### config `Config | undefined` [`Config`](/vue/api/createConfig#config) to use instead of retrieving from the [`WagmiPlugin`](/vue/api/WagmiPlugin). ::: code-group ```vue [index.vue] // {"path":"/vercel/path0/site/vue/api/composables/useWriteContract.md","from":1714,"to":1918} ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/vue/api/composables/useWriteContract.md","from":2036,"to":2097} import { type UseWriteContractReturnType } from '@wagmi/vue' ``` The return type's [`data`](#data) property is inferrable via the combination of [`abi`](#abi), [`functionName`](#functionname), and [`args`](#args). Check out the [TypeScript docs](/vue/typescript#const-assert-abis-typed-data) for more info. *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## Type Inference With [`abi`](/core/api/actions/writeContract#abi) setup correctly, TypeScript will infer the correct types for [`functionName`](/core/api/actions/writeContract#functionname), [`args`](/core/api/actions/writeContract#args), and the [`value`](/core/api/actions/writeContract##value). See the Wagmi [TypeScript docs](/vue/typescript) for more information. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`writeContract`](/core/api/actions/writeContract) --- --- url: /react/api/hooks/useWriteContracts.md description: >- Hook that requests for the wallet to sign and broadcast a batch of calls (transactions) to the network. --- # useWriteContracts Hook that requests for the wallet to sign and broadcast a batch of write contract calls (transactions) to the network. [Read more.](https://github.com/ethereum/EIPs/blob/815028dc634463e1716fc5ce44c019a6040f0bef/EIPS/eip-5792.md#wallet_sendcalls) ## Import ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWriteContracts.md","from":728,"to":783} import { useWriteContracts } from 'wagmi/experimental' ``` ## Usage ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWriteContracts.md","from":832,"to":1929} import { useWriteContracts } from 'wagmi/experimental' import { parseAbi } from 'viem' const abi = parseAbi([ 'function approve(address, uint256) returns (bool)', 'function transferFrom(address, address, uint256) returns (bool)', ]) function App() { const { writeContracts } = useWriteContracts() return ( ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWriteContracts.md","from":2001,"to":2071} import { type UseWriteContractsParameters } from 'wagmi/experimental' ``` ### config `Config | undefined` [`Config`](/react/api/createConfig#config) to use instead of retrieving from the nearest [`WagmiProvider`](/react/api/WagmiProvider). ::: code-group ```tsx [index.tsx] // {"path":"/vercel/path0/site/react/api/hooks/useWriteContracts.md","from":2279,"to":2476} import { useWriteContracts } from 'wagmi/experimental' import { config } from './config' // [!code focus] function App() { const result = useWriteContracts({ config, // [!code focus] }) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### mutation TanStack Query parameters. See the [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) for more info. ::: info Wagmi does not support passing all TanStack Query parameters TanStack Query parameters, like `mutationFn` and `mutationKey`, are used internally to make Wagmi work and you cannot override them. Check out the [source](https://github.com/wevm/wagmi/blob/main/packages/react/src/utils/query.ts#L30) to see what parameters are not supported. All parameters listed below are supported. ::: #### gcTime `number | Infinity | undefined` * The time in milliseconds that unused/inactive cache data remains in memory. When a mutation's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. * If set to `Infinity`, will disable garbage collection #### meta `Record | undefined` If set, stores additional information on the mutation cache entry that can be used as needed. It will be accessible wherever [`{{mutate}}`](#mutate) is available (e.g. [`onError`](#onerror), [`onSuccess`](#onsuccess) functions). #### networkMode `'online' | 'always' | 'offlineFirst' | undefined` * defaults to `'online'` * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. #### onError `((error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire if the mutation encounters an error and will be passed the error. #### onMutate `((variables: {{TVariables}}) => Promise | context | void) | undefined` * This function will fire before the mutation function is fired and is passed the same variables the mutation function would receive * Useful to perform optimistic updates to a resource in hopes that the mutation succeeds * The value returned from this function will be passed to both the `onError` and `onSettled` functions in the event of a mutation failure and can be useful for rolling back optimistic updates. #### onSuccess `((data: {{TData}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is successful and will be passed the mutation's result. #### onSettled `((data: {{TData}}, error: {{TError}}, variables: {{TVariables}}, context?: context | undefined) => Promise | unknown) | undefined` This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error #### queryClient `QueryClient` Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will be used. #### retry `boolean | number | ((failureCount: number, error: {{TError}}) => boolean) | undefined` * Defaults to `0`. * If `false`, failed mutations will not retry. * If `true`, failed mutations will retry infinitely. * If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. #### retryDelay `number | ((retryAttempt: number, error: {{TError}}) => number) | undefined` * This function receives a `retryAttempt` integer and the actual Error and returns the delay to apply before the next attempt in milliseconds. * A function like `attempt => Math.min(attempt > 1 ? 2 ** attempt * 1000 : 1000, 30 * 1000)` applies exponential backoff. * A function like `attempt => attempt * 1000` applies linear backoff. ## Return Type ```ts // {"path":"/vercel/path0/site/react/api/hooks/useWriteContracts.md","from":2595,"to":2665} import { type UseWriteContractsReturnType } from 'wagmi/experimental' ``` *** [TanStack Query mutation docs](https://tanstack.com/query/v5/docs/react/reference/useMutation) ### mutate `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => void` The mutation function you can call with variables to trigger the mutation and optionally hooks on additional callback options. * #### variables `{{TVariables}}` The variables object to pass to the `{{mutate}}` action. * #### onSuccess `(data: {{TData}}, variables: {{TVariables}}, context: TContext) => void` This function will fire when the mutation is successful and will be passed the mutation's result. * #### onError `(error: {{TError}}, variables: {{TVariables}}, context: TContext | undefined) => void` This function will fire if the mutation encounters an error and will be passed the error. * #### onSettled `(data: {{TData}} | undefined, error: {{TError}} | null, variables: {{TVariables}}, context: TContext | undefined) => void` * This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error * If you make multiple requests, `onSuccess` will fire only after the latest call you've made. ### mutateAsync `(variables: {{TVariables}}, { onSuccess, onSettled, onError }) => Promise<{{TData}}>` Similar to [`mutate`](#mutate) but returns a promise which can be awaited. ### data `{{TData}} | undefined` * `{{mutate}}` return type * Defaults to `undefined` * The last successfully resolved data for the mutation. ### error `{{TError}} | null` The error object for the mutation, if an error was encountered. ### failureCount `number` * The failure count for the mutation. * Incremented every time the mutation fails. * Reset to `0` when the mutation succeeds. ### failureReason `{{TError}} | null` * The failure reason for the mutation retry. * Reset to `null` when the mutation succeeds. ### isError / isIdle / isPending / isSuccess `boolean` Boolean variables derived from [`status`](#status). ### isPaused `boolean` * will be `true` if the mutation has been `paused`. * see [Network Mode](https://tanstack.com/query/v5/docs/react/guides/network-mode) for more information. ### reset `() => void` A function to clean the mutation internal state (e.g. it resets the mutation to its initial state). ### status `'idle' | 'pending' | 'error' | 'success'` * `'idle'` initial status prior to the mutation function executing. * `'pending'` if the mutation is currently executing. * `'error'` if the last mutation attempt resulted in an error. * `'success'` if the last mutation attempt was successful. ### submittedAt `number` * The timestamp for when the mutation was submitted. * Defaults to `0`. ### variables `{{TVariables}} | undefined` * The variables object passed to [`mutate`](#mutate). * Defaults to `undefined`. ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Action * [`writeContracts`](/core/api/actions/writeContracts) --- --- url: /core/api/actions/verifyMessage.md --- # verifyMessage Action for verify that a message was signed by the provided address. It supports verifying messages that were signed by either a Smart Contract Account or Externally Owned Account. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/verifyMessage.md","from":344,"to":388} import { verifyMessage } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyMessage.md","from":435,"to":779} import { verifyMessage } from '@wagmi/core' import { config } from './config' await verifyMessage(config, { address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: 'hello world', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/verifyMessage.md","from":850,"to":909} import { type VerifyMessageParameters } from '@wagmi/core' ``` ### address `Address` The Ethereum address that signed the original message. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyMessage.md","from":1026,"to":1387} import { verifyMessage } from '@wagmi/core' import { config } from './config' await verifyMessage(config, { address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', // [!code focus] message: 'hello world', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### message `string | { raw: Hex | ByteArray }` The message to be verified. By default, wagmi verifies the UTF-8 representation of the message. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyMessage.md","from":1617,"to":1978} import { verifyMessage } from '@wagmi/core' import { config } from './config' await verifyMessage(config, { address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: 'hello world', // [!code focus] signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::: tip By default, viem signs the UTF-8 representation of the message. To sign the data representation of the message, you can use the `raw` attribute. ```ts // {"path":"/vercel/path0/site/core/api/actions/verifyMessage.md","from":2188,"to":2570} import { verifyMessage } from '@wagmi/core' import { config } from './config' await verifyMessage(config, { address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: { raw: '0x68656c6c6f20776f726c64' } // [!code focus] signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) ``` ::: ### signature `Hex | ByteArray ` The signature that was generated by signing the message with the address's signer. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyMessage.md","from":2730,"to":3091} import { verifyMessage } from '@wagmi/core' import { config } from './config' await verifyMessage(config, { address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: 'hello world', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` Only used when verifying a message that was signed by a Smart Contract Account. The ID of chain to check if the contract was already deployed. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyMessage.md","from":3376,"to":3805} import { verifyMessage } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' await verifyMessage(config, { chainId: mainnet.id, // [!code focus] address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: 'hello world', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` Only used when verifying a message that was signed by a Smart Contract Account. The block number to check if the contract was already deployed. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyMessage.md","from":4071,"to":4458} import { verifyMessage } from '@wagmi/core' import { config } from './config' await verifyMessage(config, { blockNumber: 12345678n, // [!code focus] address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: 'hello world', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Only used when verifying a message that was signed by a Smart Contract Account. The block tag to check if the contract was already deployed. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyMessage.md","from":4768,"to":5151} import { verifyMessage } from '@wagmi/core' import { config } from './config' await verifyMessage(config, { blockTag: 'latest', // [!code focus] address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', message: 'hello world', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/verifyMessage.md","from":5223,"to":5282} import { type VerifyMessageReturnType } from '@wagmi/core' ``` `boolean` Whether the signed message is valid for the given address. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/verifyMessage.md","from":5374,"to":5432} import { type VerifyMessageErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Viem * [`verifyMessage`](https://viem.sh/docs/actions/public/verifyMessage) --- --- url: /core/api/actions/verifyTypedData.md --- # verifyTypedData Action for verify that a typed data was signed by the provided address. It supports verifying typed data that were signed by either a Smart Contract Account or Externally Owned Account. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":355,"to":401} import { verifyTypedData } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":448,"to":1114} import { verifyTypedData } from '@wagmi/core' import { domain, types } from './data' import { config } from './config' const valid = await verifyTypedData(config, { domain, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) // true ``` ```ts [data.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":1134,"to":1635} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":1706,"to":1767} import { type VerifyTypedDataParameters } from '@wagmi/core' ``` ### address `Address` The Ethereum address that signed the original typed data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":1887,"to":2570} import { verifyTypedData } from '@wagmi/core' import { domain, types } from './data' import { config } from './config' const valid = await verifyTypedData(config, { domain, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', // [!code focus] signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) // true ``` ```ts [data.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":2590,"to":3091} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### domain `TypedDataDomain` The typed data domain. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":3228,"to":4039} import { verifyTypedData } from '@wagmi/core' import { types } from './data' import { config } from './config' const valid = await verifyTypedData(config, { domain: { // [!code focus:6] name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) // true ``` ```ts [data.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":4059,"to":4362} // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### types The type definitions for the typed data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":4497,"to":5187} import { verifyTypedData } from '@wagmi/core' import { domain } from './data' import { config } from './config' const valid = await verifyTypedData(config, { domain, types: { // [!code focus:11] Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) // true ``` ```ts [data.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":5207,"to":5404} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### primaryType `string` The primary `type` to extract from types and use in `value`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":5575,"to":6522} import { verifyTypedData } from '@wagmi/core' import { domain } from './data' import { config } from './config' const valid = await verifyTypedData(config, { domain, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ // [!code focus:5] { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', // [!code focus] address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) // true ``` ```ts [data.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":6542,"to":6739} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### message Type inferred from `types` & `primaryType`. The message to be verified. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":6908,"to":7594} import { verifyTypedData } from '@wagmi/core' import { domain, types } from './data' import { config } from './config' const valid = await verifyTypedData(config, { domain, types, message: { // [!code focus:11] from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) // true ``` ```ts [data.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":7614,"to":8115} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### signature `Hex | ByteArray` The signature that was generated by signing the typed data with the address's signer. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":8318,"to":9003} import { verifyTypedData } from '@wagmi/core' import { domain, types } from './data' import { config } from './config' const valid = await verifyTypedData(config, { domain, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', // [!code focus] }) // true ``` ```ts [data.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":9023,"to":9524} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` Only used when verifying a typed data that was signed by a Smart Contract Account. The ID of chain to check if the contract was already deployed. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":9812,"to":10563} import { verifyTypedData } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { domain, types } from './data' import { config } from './config' const valid = await verifyTypedData(config, { chainId: mainnet.id, // [!code focus] domain, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) // true ``` ```ts [data.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":10583,"to":11084} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockNumber `bigint | undefined` Only used when verifying a typed data that was signed by a Smart Contract Account. The block number to check if the contract was already deployed. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":11353,"to":12062} import { verifyTypedData } from '@wagmi/core' import { domain, types } from './data' import { config } from './config' const valid = await verifyTypedData(config, { blockNumber: 12345678n, // [!code focus] domain, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) // true ``` ```ts [data.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":12082,"to":12583} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' | undefined` Only used when verifying a typed data that was signed by a Smart Contract Account. The block number to check if the contract was already deployed. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":12899,"to":13604} import { verifyTypedData } from '@wagmi/core' import { domain, types } from './data' import { config } from './config' const valid = await verifyTypedData(config, { blockTag: 'latest', // [!code focus] domain, types, message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, primaryType: 'Mail', address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', signature: '0x66edc32e2ab001213321ab7d959a2207fcef5190cc9abb6da5b0d2a8a9af2d4d2b0700e2c317c4106f337fd934fbbb0bf62efc8811a78603b33a8265d3b8f8cb1c', }) // true ``` ```ts [data.ts] // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":13624,"to":14125} // All properties on a domain are optional export const domain = { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', } as const // The named list of all type definitions export const types = { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], } as const ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":14197,"to":14258} import { type VerifyTypedDataReturnType } from '@wagmi/core' ``` `boolean` Whether the signed message is valid for the given address. ## Type Inference With [`types`](#types) setup correctly, TypeScript will infer the correct types for [`domain`](#domain), [`message`](#message), and [`primaryType`](#primarytype). See the Wagmi [TypeScript docs](/core/typescript) for more information. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/verifyTypedData.md","from":14605,"to":14665} import { type VerifyTypedDataErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Viem * [`verifyTypedData`](https://viem.sh/docs/actions/public/verifyTypedData) --- --- url: /core/guides/viem.md --- # Viem [Viem](https://viem.sh) is a low-level TypeScript Interface for Ethereum that enables developers to interact with the Ethereum blockchain, including: JSON-RPC API abstractions, Smart Contract interaction, wallet & signing implementations, coding/parsing utilities and more. **Wagmi Core** is essentially a wrapper over **Viem** that provides multi-chain functionality via [Wagmi Config](/core/api/createConfig) and automatic account management via [Connectors](/core/api/connectors). ## Leveraging Viem Actions All of the core [Wagmi Actions](/core/api/actions) are friendly wrappers around [Viem Actions](https://viem.sh/docs/actions/public/introduction) that inject a multi-chain and connector aware [Wagmi Config](/core/api/createConfig). There may be cases where you might want to dig deeper and utilize Viem Actions directly (maybe an Action doesn't exist in Wagmi yet). In these cases, you can import Viem Actions directly via `viem/actions` and plug in a Viem Client returned by the [`getClient` Action](/core/api/actions/getClient). The example below demonstrates two different ways to utilize Viem Actions: 1. **Tree-shakable Actions (recommended):** Uses `getClient` (for public actions) and `getConnectorClient` (for wallet actions). 2. **Client Actions:** Uses `getPublicClient` (for public actions) and `getWalletClient` (for wallet actions). ::: tip It is highly recommended to use the **tree-shakable** method to ensure that you are only pulling modules you use, and keep your bundle size low. ::: ::: code-group ```tsx [Tree-shakable Actions] // {"path":"/vercel/path0/site/core/guides/viem.md","from":1579,"to":2411} // 1. Import modules. import { http, createConfig, getClient, getConnectorClient } from '@wagmi/core' import { base, mainnet, optimism, zora } from '@wagmi/core/chains' import { getLogs, watchAsset } from 'viem/actions' // [!code hl] // 2. Set up a Wagmi Config export const config = createConfig({ chains: [base, mainnet, optimism, zora], transports: { [base.id]: http(), [mainnet.id]: http(), [optimism.id]: http(), [zora.id]: http(), }, }) // 3. Extract a Viem Client for the current active chain. const publicClient = getClient(config) const logs = await getLogs(publicClient, /* ... */) // [!code hl] // 4. Extract a Viem Client for the current active chain & account. const walletClient = getConnectorClient(config) const success = await watchAsset(walletClient, /* ... */) // [!code hl] ``` ```tsx [Client Actions] // {"path":"/vercel/path0/site/core/guides/viem.md","from":2440,"to":3253} // 1. Import modules. import { http, createConfig, getPublicClient, getWalletClient } from '@wagmi/core' import { base, mainnet, optimism, zora } from '@wagmi/core/chains' // 2. Set up a Wagmi Config export const config = createConfig({ chains: [base, mainnet, optimism, zora], transports: { [base.id]: http(), [mainnet.id]: http(), [optimism.id]: http(), [zora.id]: http(), }, }) // 3. Extract a Viem Public Client for the current active chain. const publicClient = getPublicClient(config) const logs = await publicClient.getLogs(publicClient, /* ... */) // [!code hl] // 4. Extract a Viem Wallet Client for the current active chain & account. const walletClient = getWalletClient(config) const success = await walletClient.watchAsset(walletClient, /* ... */) // [!code hl] ``` ::: ## Multi-chain Viem Client The [Viem Client](https://viem.sh/docs/clients/intro) provides an interface to interact with an JSON-RPC Provider. By nature, JSON-RPC Providers are single-chain, so the Viem Client is designed to be instantiated with a single `chain`. As a result, setting up Viem to be multi-chain aware can get a bit verbose. The good news is that you can create a **"multi-chain Viem Client"** with **Wagmi** by utilizing [`createConfig`](/core/api/createConfig) and [`getClient`](/core/api/actions/getClient). ::: code-group ```tsx [Wagmi Usage] // {"path":"/vercel/path0/site/core/guides/viem.md","from":3828,"to":4677} // 1. Import modules. import { http, createConfig, getClient, getConnectorClient } from '@wagmi/core' import { base, mainnet, optimism, zora } from '@wagmi/core/chains' import { getBlockNumber, sendTransaction } from 'viem/actions' // [!code hl] // 2. Set up a Wagmi Config export const config = createConfig({ chains: [base, mainnet, optimism, zora], transports: { [base.id]: http(), [mainnet.id]: http(), [optimism.id]: http(), [zora.id]: http(), }, }) // 3. Extract a Viem Client for the current active chain. const publicClient = getClient(config) const blockNumber = await getBlockNumber(publicClient) // [!code hl] // 4. Extract a Viem Client for the current active chain & account. const walletClient = getConnectorClient(config) const hash = await sendTransaction(walletClient, /* ... */) // [!code hl] ``` ```tsx [Viem Usage] // {"path":"/vercel/path0/site/core/guides/viem.md","from":4702,"to":5851} // Manually set up Viem Clients without wagmi. Don't do this, it's only here // to demonstrate the amount of boilerplate required. import { createPublicClient, createWalletClient, http } from 'viem' import { base, mainnet, optimism, zora } from 'viem/chains' const publicClient = { base: createPublicClient({ chain: base, transport: http() }), mainnet: createPublicClient({ chain: mainnet, transport: http() }), optimism: createPublicClient({ chain: optimism, transport: http() }), zora: createPublicClient({ chain: zora, transport: http() }) } as const const walletClient = { base: createWalletClient({ chain: base, transport: custom(window.ethereum) }), mainnet: createWalletClient({ chain: mainnet, transport: custom(window.ethereum) }), optimism: createWalletClient({ chain: optimism, transport: custom(window.ethereum) }), zora: createWalletClient({ chain: zora, transport: custom(window.ethereum) }) } as const const blockNumber = await publicClient.mainnet.getBlockNumber() const hash = await walletClient.mainnet.sendTransaction(/* ... */) ``` ::: ## Private Key & Mnemonic Accounts It is possible to utilize Viem's [Private Key & Mnemonic Accounts](https://viem.sh/docs/accounts/local) with Wagmi by explicitly passing through the account via the `account` argument on Wagmi Actions. ```tsx // {"path":"/vercel/path0/site/core/guides/viem.md","from":6107,"to":6749} import { http, createConfig, sendTransaction } from '@wagmi/core' import { base, mainnet, optimism, zora } from '@wagmi/core/chains' import { parseEther } from 'viem' import { privateKeyToAccount } from 'viem/accounts' export const config = createConfig({ chains: [base, mainnet, optimism, zora], transports: { [base.id]: http(), [mainnet.id]: http(), [optimism.id]: http(), [zora.id]: http(), }, }) const account = privateKeyToAccount('0x...') // [!code hl] const hash = await sendTransaction({ account, // [!code hl] to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', value: parseEther('0.001') }) ``` ::: info Wagmi currently does not support hoisting Private Key & Mnemonic Accounts to the top-level Wagmi Config – meaning you have to explicitly pass through the account to every Action. If you feel like this is a feature that should be added, please [open a discussion](https://github.com/wevm/wagmi/discussions/new?category=ideas). ::: --- --- url: /react/guides/viem.md --- # Viem [Viem](https://viem.sh) is a low-level TypeScript Interface for Ethereum that enables developers to interact with the Ethereum blockchain, including: JSON-RPC API abstractions, Smart Contract interaction, wallet & signing implementations, coding/parsing utilities and more. **Wagmi Core** is essentially a wrapper over **Viem** that provides multi-chain functionality via [Wagmi Config](/react/api/createConfig) and automatic account management via [Connectors](/react/api/connectors). ## Leveraging Viem Actions All of the core [Wagmi Hooks](/react/api/actions) are friendly wrappers around [Viem Actions](https://viem.sh/docs/actions/public/introduction) that inject a multi-chain and connector aware [Wagmi Config](/react/api/createConfig). There may be cases where you might want to dig deeper and utilize Viem Actions directly (maybe a Hook doesn't exist in Wagmi yet). In these cases, you can create your own custom Wagmi Hook by importing Viem Actions directly via `viem/actions` and plugging in a Viem Client returned by the [`useClient` Hook](/react/api/hooks/useClient). The example below demonstrates two different ways to utilize Viem Actions: 1. **Tree-shakable Actions (recommended):** Uses `useClient` (for public actions) and `useConnectorClient` (for wallet actions). 2. **Client Actions:** Uses `usePublicClient` (for public actions) and `useWalletClient` (for wallet actions). ::: tip It is highly recommended to use the **tree-shakable** method to ensure that you are only pulling modules you use, and keep your bundle size low. ::: ::: code-group ```tsx [Tree-shakable Actions] // {"path":"/vercel/path0/site/react/guides/viem.md","from":1619,"to":3002} // 1. Import modules. import { useMutation, useQuery } from '@tanstack/react-query' import { http, createConfig, useClient, useConnectorClient } from 'wagmi' import { base, mainnet, optimism, zora } from 'wagmi/chains' import { getLogs, watchAsset } from 'viem/actions' // 2. Set up a Wagmi Config export const config = createConfig({ chains: [base, mainnet, optimism, zora], transports: { [base.id]: http(), [mainnet.id]: http(), [optimism.id]: http(), [zora.id]: http(), }, }) function Example() { // 3. Extract a Viem Client for the current active chain. // [!code hl] const publicClient = useClient({ config }) // [!code hl] // 4. Create a "custom" Query Hook that utilizes the Client. // [!code hl] const { data: logs } = useQuery({ // [!code hl] queryKey: ['logs', publicClient.uid], // [!code hl] queryFn: () => getLogs(publicClient, /* ... */) // [!code hl] }) // [!code hl] // 5. Extract a Viem Client for the current active chain & account. // [!code hl] const { data: walletClient } = useConnectorClient({ config }) // [!code hl] // 6. Create a "custom" Mutation Hook that utilizes the Client. // [!code hl] const { mutate } = useMutation({ // [!code hl] mutationFn: (asset) => watchAsset(walletClient, asset) // [!code hl] }) // [!code hl] return (
{/* ... */}
) } ``` ```tsx [Client Actions] // {"path":"/vercel/path0/site/react/guides/viem.md","from":3031,"to":4361} // 1. Import modules. import { useMutation, useQuery } from '@tanstack/react-query' import { http, createConfig, useClient, useConnectorClient } from 'wagmi' import { base, mainnet, optimism, zora } from 'wagmi/chains' // 2. Set up a Wagmi Config export const config = createConfig({ chains: [base, mainnet, optimism, zora], transports: { [base.id]: http(), [mainnet.id]: http(), [optimism.id]: http(), [zora.id]: http(), }, }) function Example() { // 3. Extract a Viem Client for the current active chain. // [!code hl] const publicClient = useClient({ config }) // [!code hl] // 4. Create a "custom" Query Hook that utilizes the Client. // [!code hl] const { data: logs } = useQuery({ // [!code hl] queryKey: ['logs', publicClient.uid], // [!code hl] queryFn: () => publicClient.getLogs(/* ... */) // [!code hl] }) // [!code hl] // 5. Extract a Viem Client for the current active chain & account. // [!code hl] const { data: walletClient } = useConnectorClient({ config }) // [!code hl] // 6. Create a "custom" Mutation Hook that utilizes the Client. // [!code hl] const { mutate } = useMutation({ // [!code hl] mutationFn: (asset) => walletClient.watchAsset(asset) // [!code hl] }) // [!code hl] return (
{/* ... */}
) } ``` ::: ## Private Key & Mnemonic Accounts It is possible to utilize Viem's [Private Key & Mnemonic Accounts](https://viem.sh/docs/accounts/local) with Wagmi by explicitly passing through the account via the `account` argument on Wagmi Actions. ```tsx // {"path":"/vercel/path0/site/react/guides/viem.md","from":4617,"to":5289} import { http, createConfig, useSendTransaction } from 'wagmi' import { base, mainnet, optimism, zora } from 'wagmi/chains' import { parseEther } from 'viem' import { privateKeyToAccount } from 'viem/accounts' export const config = createConfig({ chains: [base, mainnet, optimism, zora], transports: { [base.id]: http(), [mainnet.id]: http(), [optimism.id]: http(), [zora.id]: http(), }, }) const account = privateKeyToAccount('0x...') // [!code hl] function Example() { const { data: hash } = useSendTransaction({ account, // [!code hl] to: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', value: parseEther('0.001') }) } ``` ::: info Wagmi currently does not support hoisting Private Key & Mnemonic Accounts to the top-level Wagmi Config – meaning you have to explicitly pass through the account to every Action. If you feel like this is a feature that should be added, please [open a discussion](https://github.com/wevm/wagmi/discussions/new?category=ideas). ::: --- --- url: /solid/guides/viem.md --- # Viem [Viem](https://viem.sh) is a TypeScript interface for Ethereum that provides low-level primitives for interacting with Ethereum. `@wagmi/solid` is built on top of Viem. ## Overview Wagmi uses Viem internally to perform blockchain operations like sending transactions, reading from contracts, and more. You can also use Viem directly alongside Wagmi when you need lower-level control. ## Using Viem with Wagmi ### Getting the Viem Client You can get a Viem Public Client or Wallet Client using Wagmi primitives: ```tsx // {"path":"/vercel/path0/site/solid/guides/viem.md","from":532,"to":842} import { useClient, useConnectorClient } from '@wagmi/solid' function Example() { // Get a Public Client for read operations const publicClient = useClient() // Get a Wallet Client for write operations (requires connected account) const walletClient = useConnectorClient() // Use the clients... } ``` ### Using Viem Actions Directly Once you have a client, you can use Viem actions directly: ```tsx // {"path":"/vercel/path0/site/solid/guides/viem.md","from":947,"to":1342} import { useClient } from '@wagmi/solid' import { getBlockNumber } from 'viem/actions' import { createEffect } from 'solid-js' function Example() { const client = useClient() createEffect(async () => { const clientValue = client() if (clientValue) { const blockNumber = await getBlockNumber(clientValue) console.log('Block number:', blockNumber) } }) // ... } ``` ## Viem Concepts ### Public Client vs Wallet Client * **Public Client**: Used for read-only operations (e.g., getting block numbers, reading contract state) * **Wallet Client**: Used for write operations that require signing (e.g., sending transactions, signing messages) ### Transports Wagmi uses Viem's transport system to communicate with Ethereum nodes. Common transports include: * `http`: HTTP JSON-RPC transport * `webSocket`: WebSocket transport for real-time updates * `fallback`: Fallback transport for reliability ## Further Reading For more information about Viem, check out: * [Viem Documentation](https://viem.sh) * [Viem Actions](https://viem.sh/docs/actions/public/introduction) * [Viem Clients](https://viem.sh/docs/clients/intro) --- --- url: /vue/guides/viem.md --- # Viem [Viem](https://viem.sh) is a low-level TypeScript Interface for Ethereum that enables developers to interact with the Ethereum blockchain, including: JSON-RPC API abstractions, Smart Contract interaction, wallet & signing implementations, coding/parsing utilities and more. **Wagmi Core** is essentially a wrapper over **Viem** that provides multi-chain functionality via [Wagmi Config](/react/api/createConfig) and automatic account management via [Connectors](/react/api/connectors). ## Leveraging Viem Actions All of the core [Wagmi Composables](/vue/api/composables) are friendly wrappers around [Viem Actions](https://viem.sh/docs/actions/public/introduction) that inject a multi-chain and connector aware [Wagmi Config](/vue/api/createConfig). There may be cases where you might want to dig deeper and utilize Viem Actions directly (maybe a Composable doesn't exist in Wagmi yet). In these cases, you can create your own custom Wagmi Composable by importing Viem Actions directly via `viem/actions` and plugging in a Viem Client returned by the [`useClient` Composable](/vue/api/composables/useClient). There are two categories of Viem Actions: * **[Public Actions](https://viem.sh/docs/actions/public/introduction):** Actions that are "read-only" and do not require a wallet connection. * **[Wallet Actions](https://viem.sh/docs/actions/wallet/introduction):** Actions that interface with a Wallet and require a wallet connection. While it is not mandatory, it is also recommended to pair Actions with either `useQuery` or `useMutation` to effectively leverage the reactivity and caching capabilities of [Tanstack Query](/vue/guides/tanstack-query). ### Public Actions The example below demonstrates how to utilize Viem's `getLogs` Action with a `useQuery` Composable to create your own abstraction akin to a `useLogs` Composable. ```vue // {"path":"/vercel/path0/site/vue/guides/viem.md","from":1863,"to":2396} ``` ### Wallet Actions The example below demonstrates how to utilize Viem's `watchAsset` Action with a `useMutation` Composable to create your own abstraction akin to a `useWatchAsset` Composable. ```vue // {"path":"/vercel/path0/site/vue/guides/viem.md","from":2603,"to":3082} ``` ## Private Key & Mnemonic Accounts It is possible to utilize Viem's [Private Key & Mnemonic Accounts](https://viem.sh/docs/accounts/local) with Wagmi by explicitly passing through the account via the `account` argument on Wagmi Actions. ```vue // {"path":"/vercel/path0/site/vue/guides/viem.md","from":3333,"to":3846} ``` ::: info Wagmi currently does not support hoisting Private Key & Mnemonic Accounts to the top-level Wagmi Config – meaning you have to explicitly pass through the account to every Action. If you feel like this is a feature that should be added, please [open an discussion](https://github.com/wevm/wagmi/discussions/new?category=ideas). ::: --- --- url: /vue/api/WagmiPlugin.md --- # WagmiPlugin [Vue Plugin](https://vuejs.org/guide/reusability/plugins.html#plugins) for Wagmi. ## Import ```ts // {"path":"/vercel/path0/site/vue/api/WagmiPlugin.md","from":115,"to":156} import { WagmiPlugin } from '@wagmi/vue' ``` ## Usage ::: code-group ```ts [main.ts] // {"path":"/vercel/path0/site/vue/api/WagmiPlugin.md","from":202,"to":404} import { createApp } from 'vue' import { WagmiPlugin } from '@wagmi/vue' import App from './App.vue' import { config } from './config' createApp(App) .use(WagmiPlugin, { config }) .mount('#app') ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/vue/api/WagmiPlugin.md","from":474,"to":525} import { type WagmiPluginProps } from '@wagmi/vue' ``` ### config [`Config`](/vue/api/createConfig#config) object to inject with context. ::: code-group ```ts [main.ts] // {"path":"/vercel/path0/site/vue/api/WagmiPlugin.md","from":646,"to":872} import { createApp } from 'vue' import { WagmiPlugin } from '@wagmi/vue' import App from './App.vue' import { config } from './config' createApp(App) .use(WagmiPlugin, { config // [!code focus] }) .mount('#app') ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### initialState `State | undefined` * Initial state to hydrate into the [Wagmi Config](/vue/api/createConfig). Useful for SSR. ::: code-group ```ts [main.ts] // {"path":"/vercel/path0/site/vue/api/WagmiPlugin.md","from":1083,"to":1338} import { createApp } from 'vue' import { WagmiPlugin } from '@wagmi/vue' import App from './App.vue' import { config } from './config' createApp(App) .use(WagmiPlugin, { config, initialState: /* ... */ // [!code focus] }) .mount('#app') ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### reconnectOnMount `boolean | undefined` * Whether or not to reconnect previously connected [connectors](/vue/api/createConfig#connectors) on mount. * Defaults to `true`. ::: code-group ```ts [main.ts] // {"path":"/vercel/path0/site/vue/api/WagmiPlugin.md","from":1594,"to":1849} import { createApp } from 'vue' import { WagmiPlugin } from '@wagmi/vue' import App from './App.vue' import { config } from './config' createApp(App) .use(WagmiPlugin, { config, reconnectOnMount: false // [!code focus] }) .mount('#app') ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/vue' import { mainnet, sepolia } from '@wagmi/vue/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## configKey Key to use to provide/inject `Config` via `WagmiPlugin`. ```ts // {"path":"/vercel/path0/site/vue/api/WagmiPlugin.md","from":1976,"to":2096} import { configKey, type Config } from '@wagmi/vue' import { inject } from 'vue' inject(configKey) ``` --- --- url: /react/api/WagmiProvider.md --- # WagmiProvider React Context Provider for Wagmi. ## Import ```ts // {"path":"/vercel/path0/site/react/api/WagmiProvider.md","from":69,"to":107} import { WagmiProvider } from 'wagmi' ``` ## Usage ::: code-group ```tsx [app.tsx] // {"path":"/vercel/path0/site/react/api/WagmiProvider.md","from":154,"to":339} import { WagmiProvider } from 'wagmi' import { config } from './config' function App() { return ( {/** ... */} ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/react/api/WagmiProvider.md","from":411,"to":459} import { type WagmiProviderProps } from 'wagmi' ``` ### config [`Config`](/react/api/createConfig#config) object to inject with context. ::: code-group ```tsx [app.tsx] // {"path":"/vercel/path0/site/react/api/WagmiProvider.md","from":583,"to":795} import { WagmiProvider } from 'wagmi' import { config } from './config' function App() { return ( {/** ... */} ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### initialState `State | undefined` * Initial state to hydrate into the [Wagmi Config](/react/api/createConfig). Useful for SSR. ::: code-group ```tsx [app.tsx] // {"path":"/vercel/path0/site/react/api/WagmiProvider.md","from":1011,"to":1254} import { WagmiProvider } from 'wagmi' import { config } from './config' function App() { return ( {/** ... */} ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### reconnectOnMount `boolean | undefined` * Whether or not to reconnect previously connected [connectors](/react/api/createConfig#connectors) on mount. * Defaults to `true`. ::: code-group ```tsx [app.tsx] // {"path":"/vercel/path0/site/react/api/WagmiProvider.md","from":1515,"to":1758} import { WagmiProvider } from 'wagmi' import { config } from './config' function App() { return ( {/** ... */} ) } ``` ```ts \[config.ts] import { createConfig, http } from 'wagmi' import { mainnet, sepolia } from 'wagmi/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Context ```ts // {"path":"/vercel/path0/site/react/api/WagmiProvider.md","from":1827,"to":1869} import { type WagmiContext } from 'wagmi' ``` --- --- url: /solid/api/WagmiProvider.md --- # WagmiProvider Solid Context Provider for Wagmi. ## Import ```ts // {"path":"/vercel/path0/site/solid/api/WagmiProvider.md","from":69,"to":114} import { WagmiProvider } from '@wagmi/solid' ``` ## Usage ```tsx // {"path":"/vercel/path0/site/solid/api/WagmiProvider.md","from":136,"to":326} import { WagmiProvider } from '@wagmi/solid' import { config } from './config' function App() { return ( {/** ... */} ) } ``` ## Parameters ```ts // {"path":"/vercel/path0/site/solid/api/WagmiProvider.md","from":352,"to":407} import { type WagmiProviderProps } from '@wagmi/solid' ``` ### config [`Config`](/solid/api/createConfig#config) object to inject with context. ```tsx // {"path":"/vercel/path0/site/solid/api/WagmiProvider.md","from":506,"to":724} import { WagmiProvider } from '@wagmi/solid' import { config } from './config' function App() { return ( {/** ... */} ) } ``` ### initialState `State | undefined` * Initial state to hydrate into the [Wagmi Config](/solid/api/createConfig). Useful for SSR. ```tsx // {"path":"/vercel/path0/site/solid/api/WagmiProvider.md","from":869,"to":1118} import { WagmiProvider } from '@wagmi/solid' import { config } from './config' function App() { return ( {/** ... */} ) } ``` ### reconnectOnMount `boolean | undefined` * Whether or not to reconnect previously connected [connectors](/solid/api/createConfig#connectors) on mount. * Defaults to `true`. ```tsx // {"path":"/vercel/path0/site/solid/api/WagmiProvider.md","from":1308,"to":1557} import { WagmiProvider } from '@wagmi/solid' import { config } from './config' function App() { return ( {/** ... */} ) } ``` ## Context ```ts // {"path":"/vercel/path0/site/solid/api/WagmiProvider.md","from":1580,"to":1629} import { type WagmiContext } from '@wagmi/solid' ``` --- --- url: /core/api/actions/waitForCallsStatus.md --- # waitForCallsStatus Waits for a call bundle to be confirmed & included on a block before returning the status & receipts. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/waitForCallsStatus.md","from":283,"to":332} import { waitForCallsStatus } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/waitForCallsStatus.md","from":379,"to":771} import { parseEther } from 'viem' import { sendCalls, waitForCallsStatus } from '@wagmi/core' import { config } from './config' const id = await sendCalls(config, { calls: [{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1') }] }) const { status, receipts } = await waitForCallsStatus(config, { // [!code focus] id, // [!code focus] }) // [!code focus] ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/waitForCallsStatus.md","from":842,"to":906} import { type WaitForCallsStatusParameters } from '@wagmi/core' ``` ### connector `Connector | undefined` Connector to get call statuses with. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/waitForCallsStatus.md","from":1021,"to":1302} import { getConnections, waitForCallsStatus } from '@wagmi/core' import { config } from './config' const connections = getConnections(config) const status = await waitForCallsStatus(config, { connector: connections[0]?.connector, // [!code focus] id: '0x1234567890abcdef', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### id `string` Identifier of the call batch. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/waitForCallsStatus.md","from":1433,"to":1615} import { waitForCallsStatus } from '@wagmi/core' import { config } from './config' const status = await waitForCallsStatus(config, { id: '0x1234567890abcdef', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### pollingInterval `number` Polling interval in milliseconds. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/waitForCallsStatus.md","from":1763,"to":1971} import { waitForCallsStatus } from '@wagmi/core' import { config } from './config' const status = await waitForCallsStatus(config, { id: '0x1234567890abcdef', pollingInterval: 1_000, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### timeout `number` Timeout in milliseconds before `waitForCallsStatus` stops polling. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/waitForCallsStatus.md","from":2144,"to":2345} import { waitForCallsStatus } from '@wagmi/core' import { config } from './config' const status = await waitForCallsStatus(config, { id: '0x1234567890abcdef', timeout: 10_000, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/waitForCallsStatus.md","from":2417,"to":2481} import { type WaitForCallsStatusReturnType } from '@wagmi/core' ``` `{ status: 'PENDING' | 'CONFIRMED', receipts: TransactionReceipt[] }` The status and receipts of the call batch. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/waitForCallsStatus.md","from":2617,"to":2680} import { type WaitForCallsStatusErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`waitForCallsStatus`](https://viem.sh/docs/actions/wallet/waitForCallsStatus) --- --- url: /core/api/actions/waitForTransactionReceipt.md --- # waitForTransactionReceipt Action that waits for the transaction to be included on a block, and then returns the transaction receipt. If the transaction reverts, then the action will throw an error. Replacement detection (e.g. sped up transactions) is also supported. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/waitForTransactionReceipt.md","from":440,"to":496} import { waitForTransactionReceipt } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/waitForTransactionReceipt.md","from":543,"to":778} import { waitForTransactionReceipt } from '@wagmi/core' import { config } from './config' const transactionReceipt = waitForTransactionReceipt(config, { hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/waitForTransactionReceipt.md","from":849,"to":920} import { type WaitForTransactionReceiptParameters } from '@wagmi/core' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/waitForTransactionReceipt.md","from":1056,"to":1382} import { waitForTransactionReceipt } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const transactionReceipt = await waitForTransactionReceipt(config, { chainId: mainnet.id, // [!code focus] hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### confirmations `number | undefined` The number of confirmations (blocks that have passed) to wait before resolving. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/waitForTransactionReceipt.md","from":1586,"to":1864} import { waitForTransactionReceipt } from '@wagmi/core' import { config } from './config' const transactionReceipt = await waitForTransactionReceipt(config, { confirmations: 2, // [!code focus] hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onReplaced `(({ reason: 'replaced' | 'repriced' | 'cancelled'; replacedTransaction: Transaction; transaction: Transaction; transactionReceipt: TransactionReceipt }) => void) | undefined` Optional callback to emit if the transaction has been replaced. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/waitForTransactionReceipt.md","from":2206,"to":2519} import { waitForTransactionReceipt } from '@wagmi/core' import { config } from './config' const transactionReceipt = await waitForTransactionReceipt(config, { hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', onReplaced: replacement => console.log(replacement), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### hash `` `0x${string}` `` The transaction hash to wait for. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/waitForTransactionReceipt.md","from":2667,"to":2925} import { waitForTransactionReceipt } from '@wagmi/core' import { config } from './config' const transactionReceipt = await waitForTransactionReceipt(config, { hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### pollingInterval `number | undefined` * Polling frequency (in milliseconds). * Defaults to the [Config's `pollingInterval` config](/core/api/createConfig#pollinginterval). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/waitForTransactionReceipt.md","from":3185,"to":3469} import { waitForTransactionReceipt } from '@wagmi/core' import { config } from './config' const transactionReceipt = await waitForTransactionReceipt(config, { hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', pollingInterval: 1_000, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/waitForTransactionReceipt.md","from":3541,"to":3612} import { type WaitForTransactionReceiptReturnType } from '@wagmi/core' ``` [`TransactionReceipt`](https://viem.sh/docs/glossary/types#transactionreceipt) The transaction receipt. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/waitForTransactionReceipt.md","from":3739,"to":3809} import { type WaitForTransactionReceiptErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`waitForTransactionReceipt`](https://viem.sh/docs/actions/public/waitForTransactionReceipt) --- --- url: /core/api/connectors/walletConnect.md --- # walletConnect Connector for [WalletConnect](https://walletconnect.com). ## Import ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue{3,8-10} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { walletConnect } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [ walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }), ], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type WalletConnectParameters } from '{{connectorsPackageName}}' ``` Check out the [WalletConnect docs](https://github.com/WalletConnect/walletconnect-monorepo/tree/v2.0/providers/ethereum-provider) for more info. A few options are omitted that Wagmi manages internally. ### customStoragePrefix `string | undefined` Custom storage prefix for persisting provider state. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ customStoragePrefix: 'wagmi', // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ### disableProviderPing `boolean | undefined` ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ disableProviderPing: false, // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ### isNewChainsStale `boolean | undefined` * If a new chain is added to a previously existing configured connector `chains`, this flag will determine if that chain should be considered as stale. A stale chain is a chain that WalletConnect has yet to establish a relationship with (e.g. the user has not approved or rejected the chain). * Defaults to `true`. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ isNewChainsStale: true, // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ::: details More info Preface: Whereas WalletConnect v1 supported dynamic chain switching, WalletConnect v2 requires the user to pre-approve a set of chains up-front. This comes with consequent UX nuances (see below) when a user tries to switch to a chain that they have not approved. This flag mainly affects the behavior when a wallet does not support dynamic chain authorization with WalletConnect v2. If `true` (default), the new chain will be treated as a stale chain. If the user has yet to establish a relationship (approved/rejected) with this chain in their WalletConnect session, the connector will disconnect upon the dapp auto-connecting, and the user will have to reconnect to the dapp (revalidate the chain) in order to approve the newly added chain. This is the default behavior to avoid an unexpected error upon switching chains which may be a confusing user experience (e.g. the user will not know they have to reconnect unless the dapp handles these types of errors). If `false`, the new chain will be treated as a validated chain. This means that if the user has yet to establish a relationship with the chain in their WalletConnect session, wagmi will successfully auto-connect the user. This comes with the trade-off that the connector will throw an error when attempting to switch to the unapproved chain. This may be useful in cases where a dapp constantly modifies their configured chains, and they do not want to disconnect the user upon auto-connecting. If the user decides to switch to the unapproved chain, it is important that the dapp handles this error and prompts the user to reconnect to the dapp in order to approve the newly added chain. ::: ### metadata `CoreTypes.Metadata | undefined` Metadata related to the app requesting the connection. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', metadata: { // [!code focus] name: 'Example', // [!code focus] description: 'Example website', // [!code focus] url: 'https://example.com', // [!code focus] }, // [!code focus] }) ``` ### projectId `string` WalletConnect Cloud project identifier. You can find your `projectId` on your [WalletConnect dashboard](https://dashboard.reown.com/sign-in). ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', // [!code focus] }) ``` ### qrModalOptions `QrModalOptions | undefined` Options for rendering QR modal. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', qrModalOptions: { // [!code focus] themeMode: 'dark', // [!code focus] }, // [!code focus] }) ``` ### relayUrl `string | undefined` * WalletConnect relay URL to use. * Defaults to `'wss://relay.walletconnect.com'`. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', relayUrl: 'wss://relay.walletconnect.org', // [!code focus] }) ``` ### storageOptions `KeyValueStorageOptions | undefined` ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', storageOptions: {}, // [!code focus] }) ``` ### showQrModal `boolean | undefined` * Whether to show the QR code modal upon calling `connector.connect()`. * Defaults to `true`. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', showQrModal: true, // [!code focus] }) ``` ::: tip This can be disabled and you can listen for a `'message'` event with payload `{ type: 'display_uri'; data: string }` if you want to render your own QR code. ::: --- --- url: /react/api/connectors/walletConnect.md --- # walletConnect Connector for [WalletConnect](https://walletconnect.com). ## Import ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue{3,8-10} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { walletConnect } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [ walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }), ], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type WalletConnectParameters } from '{{connectorsPackageName}}' ``` Check out the [WalletConnect docs](https://github.com/WalletConnect/walletconnect-monorepo/tree/v2.0/providers/ethereum-provider) for more info. A few options are omitted that Wagmi manages internally. ### customStoragePrefix `string | undefined` Custom storage prefix for persisting provider state. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ customStoragePrefix: 'wagmi', // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ### disableProviderPing `boolean | undefined` ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ disableProviderPing: false, // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ### isNewChainsStale `boolean | undefined` * If a new chain is added to a previously existing configured connector `chains`, this flag will determine if that chain should be considered as stale. A stale chain is a chain that WalletConnect has yet to establish a relationship with (e.g. the user has not approved or rejected the chain). * Defaults to `true`. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ isNewChainsStale: true, // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ::: details More info Preface: Whereas WalletConnect v1 supported dynamic chain switching, WalletConnect v2 requires the user to pre-approve a set of chains up-front. This comes with consequent UX nuances (see below) when a user tries to switch to a chain that they have not approved. This flag mainly affects the behavior when a wallet does not support dynamic chain authorization with WalletConnect v2. If `true` (default), the new chain will be treated as a stale chain. If the user has yet to establish a relationship (approved/rejected) with this chain in their WalletConnect session, the connector will disconnect upon the dapp auto-connecting, and the user will have to reconnect to the dapp (revalidate the chain) in order to approve the newly added chain. This is the default behavior to avoid an unexpected error upon switching chains which may be a confusing user experience (e.g. the user will not know they have to reconnect unless the dapp handles these types of errors). If `false`, the new chain will be treated as a validated chain. This means that if the user has yet to establish a relationship with the chain in their WalletConnect session, wagmi will successfully auto-connect the user. This comes with the trade-off that the connector will throw an error when attempting to switch to the unapproved chain. This may be useful in cases where a dapp constantly modifies their configured chains, and they do not want to disconnect the user upon auto-connecting. If the user decides to switch to the unapproved chain, it is important that the dapp handles this error and prompts the user to reconnect to the dapp in order to approve the newly added chain. ::: ### metadata `CoreTypes.Metadata | undefined` Metadata related to the app requesting the connection. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', metadata: { // [!code focus] name: 'Example', // [!code focus] description: 'Example website', // [!code focus] url: 'https://example.com', // [!code focus] }, // [!code focus] }) ``` ### projectId `string` WalletConnect Cloud project identifier. You can find your `projectId` on your [WalletConnect dashboard](https://dashboard.reown.com/sign-in). ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', // [!code focus] }) ``` ### qrModalOptions `QrModalOptions | undefined` Options for rendering QR modal. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', qrModalOptions: { // [!code focus] themeMode: 'dark', // [!code focus] }, // [!code focus] }) ``` ### relayUrl `string | undefined` * WalletConnect relay URL to use. * Defaults to `'wss://relay.walletconnect.com'`. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', relayUrl: 'wss://relay.walletconnect.org', // [!code focus] }) ``` ### storageOptions `KeyValueStorageOptions | undefined` ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', storageOptions: {}, // [!code focus] }) ``` ### showQrModal `boolean | undefined` * Whether to show the QR code modal upon calling `connector.connect()`. * Defaults to `true`. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', showQrModal: true, // [!code focus] }) ``` ::: tip This can be disabled and you can listen for a `'message'` event with payload `{ type: 'display_uri'; data: string }` if you want to render your own QR code. ::: --- --- url: /shared/connectors/walletConnect.md --- # walletConnect Connector for [WalletConnect](https://walletconnect.com). ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":252,"to":310} import { walletConnect } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":587,"to":660} pnpm add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [npm] // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":683,"to":759} npm install @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":783,"to":856} yarn add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [bun] // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":879,"to":951} bun add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue{3,8-10} // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":988,"to":1403} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { walletConnect } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [ walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }), ], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":1433,"to":1506} import { type WalletConnectParameters } from '{{connectorsPackageName}}' ``` Check out the [WalletConnect docs](https://github.com/WalletConnect/walletconnect-monorepo/tree/v2.0/providers/ethereum-provider) for more info. A few options are omitted that Wagmi manages internally. ### customStoragePrefix `string | undefined` Custom storage prefix for persisting provider state. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":2014,"to":2208} import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ customStoragePrefix: 'wagmi', // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ### disableProviderPing `boolean | undefined` ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":2271,"to":2463} import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ disableProviderPing: false, // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ### isNewChainsStale `boolean | undefined` * If a new chain is added to a previously existing configured connector `chains`, this flag will determine if that chain should be considered as stale. A stale chain is a chain that WalletConnect has yet to establish a relationship with (e.g. the user has not approved or rejected the chain). * Defaults to `true`. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":2839,"to":3027} import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ isNewChainsStale: true, // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ::: details More info Preface: Whereas WalletConnect v1 supported dynamic chain switching, WalletConnect v2 requires the user to pre-approve a set of chains up-front. This comes with consequent UX nuances (see below) when a user tries to switch to a chain that they have not approved. This flag mainly affects the behavior when a wallet does not support dynamic chain authorization with WalletConnect v2. If `true` (default), the new chain will be treated as a stale chain. If the user has yet to establish a relationship (approved/rejected) with this chain in their WalletConnect session, the connector will disconnect upon the dapp auto-connecting, and the user will have to reconnect to the dapp (revalidate the chain) in order to approve the newly added chain. This is the default behavior to avoid an unexpected error upon switching chains which may be a confusing user experience (e.g. the user will not know they have to reconnect unless the dapp handles these types of errors). If `false`, the new chain will be treated as a validated chain. This means that if the user has yet to establish a relationship with the chain in their WalletConnect session, wagmi will successfully auto-connect the user. This comes with the trade-off that the connector will throw an error when attempting to switch to the unapproved chain. This may be useful in cases where a dapp constantly modifies their configured chains, and they do not want to disconnect the user upon auto-connecting. If the user decides to switch to the unapproved chain, it is important that the dapp handles this error and prompts the user to reconnect to the dapp in order to approve the newly added chain. ::: ### metadata `CoreTypes.Metadata | undefined` Metadata related to the app requesting the connection. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":4827,"to":5165} import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', metadata: { // [!code focus] name: 'Example', // [!code focus] description: 'Example website', // [!code focus] url: 'https://example.com', // [!code focus] }, // [!code focus] }) ``` ### projectId `string` WalletConnect Cloud project identifier. You can find your `projectId` on your [WalletConnect dashboard](https://dashboard.reown.com/sign-in). ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":5348,"to":5510} import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', // [!code focus] }) ``` ### qrModalOptions `QrModalOptions | undefined` Options for rendering QR modal. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":5608,"to":5852} import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', qrModalOptions: { // [!code focus] themeMode: 'dark', // [!code focus] }, // [!code focus] }) ``` ### relayUrl `string | undefined` * WalletConnect relay URL to use. * Defaults to `'wss://relay.walletconnect.com'`. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":5987,"to":6194} import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', relayUrl: 'wss://relay.walletconnect.org', // [!code focus] }) ``` ### storageOptions `KeyValueStorageOptions | undefined` ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":6267,"to":6451} import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', storageOptions: {}, // [!code focus] }) ``` ### showQrModal `boolean | undefined` * Whether to show the QR code modal upon calling `connector.connect()`. * Defaults to `true`. ```ts-vue // {"path":"/vercel/path0/site/shared/connectors/walletConnect.md","from":6601,"to":6784} import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', showQrModal: true, // [!code focus] }) ``` ::: tip This can be disabled and you can listen for a `'message'` event with payload `{ type: 'display_uri'; data: string }` if you want to render your own QR code. ::: --- --- url: /solid/api/connectors/walletConnect.md --- # walletConnect Connector for [WalletConnect](https://walletconnect.com). ## Import ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue{3,8-10} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { walletConnect } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [ walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }), ], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type WalletConnectParameters } from '{{connectorsPackageName}}' ``` Check out the [WalletConnect docs](https://github.com/WalletConnect/walletconnect-monorepo/tree/v2.0/providers/ethereum-provider) for more info. A few options are omitted that Wagmi manages internally. ### customStoragePrefix `string | undefined` Custom storage prefix for persisting provider state. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ customStoragePrefix: 'wagmi', // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ### disableProviderPing `boolean | undefined` ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ disableProviderPing: false, // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ### isNewChainsStale `boolean | undefined` * If a new chain is added to a previously existing configured connector `chains`, this flag will determine if that chain should be considered as stale. A stale chain is a chain that WalletConnect has yet to establish a relationship with (e.g. the user has not approved or rejected the chain). * Defaults to `true`. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ isNewChainsStale: true, // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ::: details More info Preface: Whereas WalletConnect v1 supported dynamic chain switching, WalletConnect v2 requires the user to pre-approve a set of chains up-front. This comes with consequent UX nuances (see below) when a user tries to switch to a chain that they have not approved. This flag mainly affects the behavior when a wallet does not support dynamic chain authorization with WalletConnect v2. If `true` (default), the new chain will be treated as a stale chain. If the user has yet to establish a relationship (approved/rejected) with this chain in their WalletConnect session, the connector will disconnect upon the dapp auto-connecting, and the user will have to reconnect to the dapp (revalidate the chain) in order to approve the newly added chain. This is the default behavior to avoid an unexpected error upon switching chains which may be a confusing user experience (e.g. the user will not know they have to reconnect unless the dapp handles these types of errors). If `false`, the new chain will be treated as a validated chain. This means that if the user has yet to establish a relationship with the chain in their WalletConnect session, wagmi will successfully auto-connect the user. This comes with the trade-off that the connector will throw an error when attempting to switch to the unapproved chain. This may be useful in cases where a dapp constantly modifies their configured chains, and they do not want to disconnect the user upon auto-connecting. If the user decides to switch to the unapproved chain, it is important that the dapp handles this error and prompts the user to reconnect to the dapp in order to approve the newly added chain. ::: ### metadata `CoreTypes.Metadata | undefined` Metadata related to the app requesting the connection. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', metadata: { // [!code focus] name: 'Example', // [!code focus] description: 'Example website', // [!code focus] url: 'https://example.com', // [!code focus] }, // [!code focus] }) ``` ### projectId `string` WalletConnect Cloud project identifier. You can find your `projectId` on your [WalletConnect dashboard](https://dashboard.reown.com/sign-in). ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', // [!code focus] }) ``` ### qrModalOptions `QrModalOptions | undefined` Options for rendering QR modal. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', qrModalOptions: { // [!code focus] themeMode: 'dark', // [!code focus] }, // [!code focus] }) ``` ### relayUrl `string | undefined` * WalletConnect relay URL to use. * Defaults to `'wss://relay.walletconnect.com'`. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', relayUrl: 'wss://relay.walletconnect.org', // [!code focus] }) ``` ### storageOptions `KeyValueStorageOptions | undefined` ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', storageOptions: {}, // [!code focus] }) ``` ### showQrModal `boolean | undefined` * Whether to show the QR code modal upon calling `connector.connect()`. * Defaults to `true`. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', showQrModal: true, // [!code focus] }) ``` ::: tip This can be disabled and you can listen for a `'message'` event with payload `{ type: 'display_uri'; data: string }` if you want to render your own QR code. ::: --- --- url: /vue/api/connectors/walletConnect.md --- # walletConnect Connector for [WalletConnect](https://walletconnect.com). ## Import ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' ``` ## Install ::: code-group ```bash-vue [pnpm] pnpm add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [npm] npm install @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [yarn] yarn add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ```bash-vue [bun] bun add @walletconnect/ethereum-provider@{{connectorDependencyVersion}} ``` ::: ## Usage ```ts-vue{3,8-10} import { createConfig, http } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' import { walletConnect } from '{{connectorsPackageName}}' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [ walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }), ], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts-vue import { type WalletConnectParameters } from '{{connectorsPackageName}}' ``` Check out the [WalletConnect docs](https://github.com/WalletConnect/walletconnect-monorepo/tree/v2.0/providers/ethereum-provider) for more info. A few options are omitted that Wagmi manages internally. ### customStoragePrefix `string | undefined` Custom storage prefix for persisting provider state. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ customStoragePrefix: 'wagmi', // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ### disableProviderPing `boolean | undefined` ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ disableProviderPing: false, // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ### isNewChainsStale `boolean | undefined` * If a new chain is added to a previously existing configured connector `chains`, this flag will determine if that chain should be considered as stale. A stale chain is a chain that WalletConnect has yet to establish a relationship with (e.g. the user has not approved or rejected the chain). * Defaults to `true`. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ isNewChainsStale: true, // [!code focus] projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }) ``` ::: details More info Preface: Whereas WalletConnect v1 supported dynamic chain switching, WalletConnect v2 requires the user to pre-approve a set of chains up-front. This comes with consequent UX nuances (see below) when a user tries to switch to a chain that they have not approved. This flag mainly affects the behavior when a wallet does not support dynamic chain authorization with WalletConnect v2. If `true` (default), the new chain will be treated as a stale chain. If the user has yet to establish a relationship (approved/rejected) with this chain in their WalletConnect session, the connector will disconnect upon the dapp auto-connecting, and the user will have to reconnect to the dapp (revalidate the chain) in order to approve the newly added chain. This is the default behavior to avoid an unexpected error upon switching chains which may be a confusing user experience (e.g. the user will not know they have to reconnect unless the dapp handles these types of errors). If `false`, the new chain will be treated as a validated chain. This means that if the user has yet to establish a relationship with the chain in their WalletConnect session, wagmi will successfully auto-connect the user. This comes with the trade-off that the connector will throw an error when attempting to switch to the unapproved chain. This may be useful in cases where a dapp constantly modifies their configured chains, and they do not want to disconnect the user upon auto-connecting. If the user decides to switch to the unapproved chain, it is important that the dapp handles this error and prompts the user to reconnect to the dapp in order to approve the newly added chain. ::: ### metadata `CoreTypes.Metadata | undefined` Metadata related to the app requesting the connection. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', metadata: { // [!code focus] name: 'Example', // [!code focus] description: 'Example website', // [!code focus] url: 'https://example.com', // [!code focus] }, // [!code focus] }) ``` ### projectId `string` WalletConnect Cloud project identifier. You can find your `projectId` on your [WalletConnect dashboard](https://dashboard.reown.com/sign-in). ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', // [!code focus] }) ``` ### qrModalOptions `QrModalOptions | undefined` Options for rendering QR modal. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', qrModalOptions: { // [!code focus] themeMode: 'dark', // [!code focus] }, // [!code focus] }) ``` ### relayUrl `string | undefined` * WalletConnect relay URL to use. * Defaults to `'wss://relay.walletconnect.com'`. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', relayUrl: 'wss://relay.walletconnect.org', // [!code focus] }) ``` ### storageOptions `KeyValueStorageOptions | undefined` ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', storageOptions: {}, // [!code focus] }) ``` ### showQrModal `boolean | undefined` * Whether to show the QR code modal upon calling `connector.connect()`. * Defaults to `true`. ```ts-vue import { walletConnect } from '{{connectorsPackageName}}' const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', showQrModal: true, // [!code focus] }) ``` ::: tip This can be disabled and you can listen for a `'message'` event with payload `{ type: 'display_uri'; data: string }` if you want to render your own QR code. ::: --- --- url: /core/api/actions/watchAsset.md --- # watchAsset Action for requesting user tracks the token in their wallet. Returns a boolean indicating if the token was successfully added. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/watchAsset.md","from":281,"to":322} import { watchAsset } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchAsset.md","from":369,"to":608} import { watchAsset } from '@wagmi/core' import { config } from './config' await watchAsset(config, { type: 'ERC20', options: { address: '0x0000000000000000000000000000000000000000', symbol: 'WAGMI', decimals: 18, }, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/watchAsset.md","from":679,"to":735} import { type WatchAssetParameters } from '@wagmi/core' ``` ### connector `Connector | undefined` [Connector](/core/api/connectors) to sign message with. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchAsset.md","from":869,"to":1212} import { getConnection, watchAsset } from '@wagmi/core' import { config } from './config' const { connector } = getConnection(config) const result = await watchAsset(config, { connector, // [!code focus] options: { address: '0x0000000000000000000000000000000000000000', symbol: 'WAGMI', decimals: 18, }, type: 'ERC20', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### options `{ address: string; symbol: string; decimals: number; image?: string | undefined; }` Asset options. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchAsset.md","from":1409,"to":1748} import { watchAsset } from '@wagmi/core' import { config } from './config' const result = await watchAsset(config, { options: { // [!code focus] address: '0x0000000000000000000000000000000000000000', // [!code focus] symbol: 'WAGMI', // [!code focus] decimals: 18, // [!code focus] }, // [!code focus] type: 'ERC20', }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### type `'ERC20'` Type of asset. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchAsset.md","from":1867,"to":2138} import { watchAsset } from '@wagmi/core' import { config } from './config' const result = await watchAsset(config, { options: { address: '0x0000000000000000000000000000000000000000', symbol: 'WAGMI', decimals: 18, }, type: 'ERC20', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/watchAsset.md","from":2210,"to":2266} import { type WatchAssetReturnType } from '@wagmi/core' ``` `boolean` Returns a boolean indicating if the token was successfully added. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/watchAsset.md","from":2365,"to":2420} import { type WatchAssetErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Viem * [`watchAsset`](https://viem.sh/docs/actions/wallet/watchAsset) --- --- url: /core/api/actions/watchBlockNumber.md --- # watchBlockNumber Action that watches for block number changes. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/watchBlockNumber.md","from":84,"to":131} import { watchBlockNumber } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlockNumber.md","from":178,"to":406} import { watchBlockNumber } from '@wagmi/core' import { config } from './config' const unwatch = watchBlockNumber(config, { onBlockNumber(blockNumber) { console.log('Block number changed!', blockNumber) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/watchBlockNumber.md","from":477,"to":539} import { type WatchBlockNumberParameters } from '@wagmi/core' ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlockNumber.md","from":675,"to":988} import { watchBlockNumber } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const unwatch = watchBlockNumber(config, { chainId: mainnet.id, // [!code focus] onBlockNumber(blockNumber) { console.log('Block number changed!', blockNumber) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### emitOnBegin `boolean | undefined` Whether or not to emit the latest block number to the callback when the subscription opens. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlockNumber.md","from":1203,"to":1469} import { watchBlockNumber } from '@wagmi/core' import { config } from './config' const unwatch = watchBlockNumber(config, { emitOnBegin: true, // [!code focus] onBlockNumber(blockNumber) { console.log('Block number changed!', blockNumber) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### emitMissed `boolean | undefined` Whether or not to emit the missed block numbers to the callback. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlockNumber.md","from":1656,"to":1921} import { watchBlockNumber } from '@wagmi/core' import { config } from './config' const unwatch = watchBlockNumber(config, { emitMissed: true, // [!code focus] onBlockNumber(blockNumber) { console.log('Block number changed!', blockNumber) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onBlockNumber `(blockNumber: bigint, prevBlockNumber: bigint | undefined) => void` Callback for when block number changes. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlockNumber.md","from":2134,"to":2413} import { watchBlockNumber } from '@wagmi/core' import { config } from './config' const unwatch = watchBlockNumber(config, { onBlockNumber(blockNumber) { // [!code focus] console.log('Block number changed!', blockNumber) // [!code focus] }, // [!code focus] }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onError `((error: Error) => void) | undefined` Error thrown from getting the block number. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlockNumber.md","from":2593,"to":2946} import { watchBlockNumber } from '@wagmi/core' import { config } from './config' const unwatch = watchBlockNumber(config, { onBlockNumber(blockNumber) { console.log('Block number changed!', blockNumber) }, onError(error) { // [!code focus] console.error('Block number error', error) // [!code focus] }, // [!code focus] }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### poll `boolean | undefined` * Whether or not to use a polling mechanism to check for new blocks instead of a WebSocket subscription. * Defaults to `false` for WebSocket Clients, and `true` for non-WebSocket Clients. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlockNumber.md","from":3250,"to":3512} import { watchBlockNumber } from '@wagmi/core' import { config } from './config' const unwatch = watchBlockNumber(config, { onBlockNumber(blockNumber) { console.log('Block number changed!', blockNumber) }, poll: true, // [!code focus] }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### pollingInterval `number | undefined` * Polling frequency (in milliseconds). * Defaults to the [Config's `pollingInterval` config](/core/api/createConfig#pollinginterval). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlockNumber.md","from":3772,"to":4046} import { watchBlockNumber } from '@wagmi/core' import { config } from './config' const unwatch = watchBlockNumber(config, { onBlockNumber(blockNumber) { console.log('Block number changed!', blockNumber) }, pollingInterval: 1_000, // [!code focus] }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### syncConnectedChain `boolean | undefined` * Set up subscriber for connected chain changes. * Defaults to [`Config['syncConnectedChain']`](/core/api/createConfig#syncconnectedchain). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlockNumber.md","from":4316,"to":4590} import { watchBlockNumber } from '@wagmi/core' import { config } from './config' const unwatch = watchBlockNumber(config, { onBlockNumber(blockNumber) { console.log('Block number changed!', blockNumber) }, syncConnectedChain: false, // [!code focus] }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/watchBlockNumber.md","from":4662,"to":4724} import { type WatchBlockNumberReturnType } from '@wagmi/core' ``` Function for cleaning up watcher. ## Viem * [`watchBlockNumber`](https://viem.sh/docs/actions/public/watchBlockNumber) --- --- url: /core/api/actions/watchBlocks.md --- # watchBlocks Action that watches for block changes. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/watchBlocks.md","from":72,"to":114} import { watchBlocks } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlocks.md","from":161,"to":354} import { watchBlocks } from '@wagmi/core' import { config } from './config' const unwatch = watchBlocks(config, { onBlock(block) { console.log('Block changed!', block) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/watchBlocks.md","from":425,"to":482} import { type WatchBlocksParameters } from '@wagmi/core' ``` ### blockTag `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'` Watch for new blocks on a given tag. Defaults to `'latest'`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlocks.md","from":655,"to":888} import { watchBlocks } from '@wagmi/core' import { config } from './config' const unwatch = watchBlocks(config, { blockTag: 'pending', // [!code focus] onBlock(block) { console.log('Block changed!', block) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlocks.md","from":1069,"to":1347} import { watchBlocks } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const unwatch = watchBlocks(config, { chainId: mainnet.id, // [!code focus] onBlock(block) { console.log('Block changed!', block) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### emitMissed `boolean` Whether or not to emit missed blocks to the callback. Defaults to `false`. Missed blocks may occur in instances where internet connection is lost, or the block time is lesser than the polling interval of the client. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlocks.md","from":1674,"to":1904} import { watchBlocks } from '@wagmi/core' import { config } from './config' const unwatch = watchBlocks(config, { emitMissed: true, // [!code focus] onBlock(block) { console.log('Block changed!', block) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### emitOnBegin `boolean` Whether or not to emit the block to the callback when the subscription opens. Defaults to `false`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlocks.md","from":2114,"to":2345} import { watchBlocks } from '@wagmi/core' import { config } from './config' const unwatch = watchBlocks(config, { emitOnBegin: true, // [!code focus] onBlock(block) { console.log('Block changed!', block) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onBlock `(block: Block, prevblock: Block | undefined) => void` Callback for when block changes. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlocks.md","from":2530,"to":2774} import { watchBlocks } from '@wagmi/core' import { config } from './config' const unwatch = watchBlocks(config, { onBlock(block) { // [!code focus] console.log('Block changed!', block) // [!code focus] }, // [!code focus] }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onError `((error: Error) => void) | undefined` Error thrown from getting the block. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlocks.md","from":2947,"to":3258} import { watchBlocks } from '@wagmi/core' import { config } from './config' const unwatch = watchBlocks(config, { onBlock(block) { console.log('Block changed!', block) }, onError(error) { // [!code focus] console.error('Block error', error) // [!code focus] }, // [!code focus] }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### poll `boolean | undefined` * Whether or not to use a polling mechanism to check for new blocks instead of a WebSocket subscription. * Defaults to `false` for WebSocket Clients, and `true` for non-WebSocket Clients. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlocks.md","from":3562,"to":3786} import { watchBlocks } from '@wagmi/core' import { config } from './config' const unwatch = watchBlocks(config, { poll: true, // [!code focus] onBlock(block) { console.log('Block changed!', block) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### pollingInterval `number | undefined` * Polling frequency (in milliseconds). * Defaults to the [Config's `pollingInterval` config](/core/api/createConfig#pollinginterval). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlocks.md","from":4046,"to":4282} import { watchBlocks } from '@wagmi/core' import { config } from './config' const unwatch = watchBlocks(config, { pollingInterval: 1_000, // [!code focus] onBlock(block) { console.log('Block changed!', block) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### syncConnectedChain `boolean | undefined` * Set up subscriber for connected chain changes. * Defaults to [`Config['syncConnectedChain']`](/core/api/createConfig#syncconnectedchain). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchBlocks.md","from":4552,"to":4791} import { watchBlocks } from '@wagmi/core' import { config } from './config' const unwatch = watchBlocks(config, { onBlock(block) { console.log('Block changed!', block) }, syncConnectedChain: false, // [!code focus] }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/watchBlocks.md","from":4863,"to":4920} import { type WatchBlocksReturnType } from '@wagmi/core' ``` Function for cleaning up watcher. ## Viem * [`watchBlocks`](https://viem.sh/docs/actions/public/watchBlocks) --- --- url: /core/api/actions/watchChainId.md --- # watchChainId Subscribe to chain ID changes. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/watchChainId.md","from":65,"to":108} import { watchChainId } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchChainId.md","from":155,"to":358} import { watchChainId } from '@wagmi/core' import { config } from './config' const unwatch = watchChainId(config, { onChange(chainId) { console.log('Chain ID changed!', chainId) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/watchChainId.md","from":429,"to":487} import { type WatchChainIdParameters } from '@wagmi/core' ``` ### onChange `onChange(chainId: GetChainIdReturnType, prevChainId: GetChainIdReturnType): void` Callback function called when chain ID changes. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchChainId.md","from":671,"to":893} import { watchChainId } from '@wagmi/core' import { config } from './config' const unwatch = watchChainId(config, { onChange(chainId) { // [!code focus:3] console.log('Chain ID changed!', chainId) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/watchChainId.md","from":965,"to":1023} import { type WatchChainIdReturnType } from '@wagmi/core' ``` Function for cleaning up watcher. --- --- url: /core/api/actions/watchClient.md --- # watchClient Subscribe to Client changes. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/watchClient.md","from":62,"to":104} import { watchClient } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchClient.md","from":151,"to":348} import { watchClient } from '@wagmi/core' import { config } from './config' const unwatch = watchClient(config, { onChange(client) { console.log('Client changed!', client) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/watchClient.md","from":419,"to":476} import { type WatchClientParameters } from '@wagmi/core' ``` ### onChange `onChange(client: GetClientReturnType, prevClient: GetClientReturnType): void` Callback function called when Client changes. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchClient.md","from":654,"to":870} import { watchClient } from '@wagmi/core' import { config } from './config' const unwatch = watchClient(config, { onChange(client) { // [!code focus:3] console.log('Client changed!', client) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/watchClient.md","from":942,"to":999} import { type WatchClientReturnType } from '@wagmi/core' ``` Function for cleaning up watcher. --- --- url: /core/api/actions/watchConnection.md --- # watchConnection Subscribe to connection changes. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/watchConnection.md","from":70,"to":116} import { watchConnection } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchConnection.md","from":163,"to":368} import { watchConnection } from '@wagmi/core' import { config } from './config' const unwatch = watchConnection(config, { onChange(data) { console.log('Connection changed!', data) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/watchConnection.md","from":439,"to":500} import { type WatchConnectionParameters } from '@wagmi/core' ``` ### onChange `onChange(connection: GetConnectionReturnType, prevConnection: GetConnectionReturnType): void` Callback function called when connection changes. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchConnection.md","from":698,"to":934} import { watchConnection } from '@wagmi/core' import { config } from './config' const unwatch = watchConnection(config, { onChange(connection) { // [!code focus:3] console.log('Connection changed!', connection) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/watchConnection.md","from":1006,"to":1067} import { type WatchConnectionReturnType } from '@wagmi/core' ``` Function for cleaning up watcher. --- --- url: /core/api/actions/watchConnections.md --- # watchConnections Subscribe to connections changes. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/watchConnections.md","from":72,"to":119} import { watchConnections } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchConnections.md","from":166,"to":374} import { watchConnections } from '@wagmi/core' import { config } from './config' const unwatch = watchConnections(config, { onChange(data) { console.log('Connections changed!', data) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/watchConnections.md","from":445,"to":507} import { type WatchConnectionsParameters } from '@wagmi/core' ``` ### onChange `onChange(connections: GetConnectionsReturnType, prevConnections: GetConnectionsReturnType): void` Callback function called when connections changes. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchConnections.md","from":710,"to":937} import { watchConnections } from '@wagmi/core' import { config } from './config' const unwatch = watchConnections(config, { onChange(data) { // [!code focus:3] console.log('Connections changed!', data) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/watchConnections.md","from":1009,"to":1071} import { type WatchConnectionsReturnType } from '@wagmi/core' ``` Function for cleaning up watcher. --- --- url: /core/api/actions/watchConnectors.md --- # watchConnectors Subscribe to connectors changes. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/watchConnectors.md","from":70,"to":116} import { watchConnectors } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchConnectors.md","from":163,"to":380} import { watchConnectors } from '@wagmi/core' import { config } from './config' const unwatch = watchConnectors(config, { onChange(connectors) { console.log('Connectors changed!', connectors) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/watchConnectors.md","from":451,"to":512} import { type WatchConnectorsParameters } from '@wagmi/core' ``` ### onChange `onChange(connectors: GetConnectorsReturnType, prevConnectors: GetConnectorsReturnType): void` Callback function called when connectors changes. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchConnectors.md","from":710,"to":946} import { watchConnectors } from '@wagmi/core' import { config } from './config' const unwatch = watchConnectors(config, { onChange(connectors) { // [!code focus:3] console.log('Connectors changed!', connectors) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/watchConnectors.md","from":1018,"to":1079} import { type WatchConnectorsReturnType } from '@wagmi/core' ``` Function for cleaning up watcher. --- --- url: /core/api/actions/watchContractEvent.md --- # watchContractEvent Action that watches and returns emitted contract event logs. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":239,"to":288} import { watchContractEvent } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":335,"to":651} import { watchContractEvent } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const unwatch = watchContractEvent(config, { address: '0x6b175474e89094c44da98b954eedeac495271d0f', abi, eventName: 'Transfer', onLogs(logs) { console.log('New logs!', logs) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":758,"to":822} import { type WatchContractEventParameters } from '@wagmi/core' ``` ### abi `Abi` The contract's ABI. Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":1038,"to":1310} import { watchContractEvent } from '@wagmi/core' import { abi } from './abi' // [!code focus] import { config } from './config' const unwatch = watchContractEvent(config, { abi, // [!code focus] onLogs(logs) { console.log('Logs changed!', logs) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### address `Address | undefined` The contract's address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":1489,"to":1801} import { watchContractEvent } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const unwatch = watchContractEvent(config, { address: '0x6b175474e89094c44da98b954eedeac495271d0f', // [!code focus] abi, onLogs(logs) { console.log('Logs changed!', logs) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### args `object | readonly unknown[] | undefined` * Arguments to pass when calling the contract. * Inferred from [`abi`](#abi) and [`eventName`](#eventname). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":2081,"to":2439} import { watchContractEvent } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const unwatch = watchContractEvent(config, { abi, args: { // [!code focus] to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] }, // [!code focus] onLogs(logs) { console.log('Logs changed!', logs) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### batch `boolean | undefined` * Whether or not the events should be batched on each invocation. * Defaults to `true`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":2680,"to":2951} import { watchContractEvent } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const unwatch = watchContractEvent(config, { abi, batch: false, // [!code focus] onLogs(logs) { console.log('Logs changed!', logs) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":3168,"to":3491} import { watchContractEvent } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { abi } from './abi' import { config } from './config' const unwatch = watchContractEvent(config, { abi, chainId: mainnet.id, // [!code focus] onLogs(logs) { console.log('Logs changed!', logs) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### eventName `string` * Event to listen for the contract. * Inferred from [`abi`](#abi). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":3702,"to":3982} import { watchContractEvent } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const unwatch = watchContractEvent(config, { abi, eventName: 'Approval', // [!code focus] onLogs(logs) { console.log('Logs changed!', logs) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onError `((error: Error) => void) | undefined` Error thrown from getting the block number. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":4198,"to":4553} import { watchContractEvent } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const unwatch = watchContractEvent(config, { abi, onLogs(logs) { console.log('Logs changed!', logs) }, onError(error) { // [!code focus] console.error('Logs error', error) // [!code focus] }, // [!code focus] }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onLogs `(logs: Log[], prevLogs: Log[] | undefined) => void` Callback for when logs changes. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":4770,"to":5059} import { watchContractEvent } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const unwatch = watchContractEvent(config, { abi, onLogs(logs) { // [!code focus] console.log('Logs changed!', logs) // [!code focus] }, // [!code focus] }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### poll `boolean | undefined` * Whether or not to use a polling mechanism to check for new blocks instead of a WebSocket subscription. * Defaults to `false` for WebSocket Clients, and `true` for non-WebSocket Clients. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":5399,"to":5668} import { watchContractEvent } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const unwatch = watchContractEvent(config, { abi, onLogs(logs) { console.log('Logs changed!', logs) }, poll: true, // [!code focus] }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### pollingInterval `number | undefined` * Polling frequency (in milliseconds). * Defaults to the [Config's `pollingInterval` config](/core/api/createConfig#pollinginterval). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":5964,"to":6245} import { watchContractEvent } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const unwatch = watchContractEvent(config, { abi, onLogs(logs) { console.log('Logs changed!', logs) }, pollingInterval: 1_000, // [!code focus] }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### strict `boolean | undefined` * Defaults to `false`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":6422,"to":6693} import { watchContractEvent } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const unwatch = watchContractEvent(config, { abi, onLogs(logs) { console.log('Logs changed!', logs) }, strict: true, // [!code focus] }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### syncConnectedChain `boolean | undefined` * Set up subscriber for connected chain changes. * Defaults to [`Config['syncConnectedChain']`](/core/api/createConfig#syncconnectedchain). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":6999,"to":7283} import { watchContractEvent } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const unwatch = watchContractEvent(config, { abi, onLogs(logs) { console.log('Logs changed!', logs) }, syncConnectedChain: false, // [!code focus] }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":7391,"to":7455} import { type WatchContractEventReturnType } from '@wagmi/core' ``` Function for cleaning up watcher. ## Type Inference With [`abi`](#abi) setup correctly, TypeScript will infer the correct types for [`eventName`](#eventname), [`args`](#args), and [`onLogs`](#onlogs) parameters. See the Wagmi [TypeScript docs](/core/typescript) for more information. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/watchContractEvent.md","from":7763,"to":7822} import { type WatchContractEventError } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`watchContractEvent`](https://viem.sh/docs/contract/watchContractEvent) --- --- url: /core/api/actions/watchPendingTransactions.md --- # watchPendingTransactions Action that watches and returns pending transaction hashes. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/watchPendingTransactions.md","from":256,"to":311} import { watchPendingTransactions } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchPendingTransactions.md","from":358,"to":591} import { watchPendingTransactions } from '@wagmi/core' import { config } from './config' const unwatch = watchPendingTransactions(config, { onTransactions(transactions) { console.log('New transactions!', transactions) }, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/watchPendingTransactions.md","from":662,"to":732} import { type WatchPendingTransactionsParameters } from '@wagmi/core' ``` ### batch `boolean | undefined` * Whether or not the transactions should be batched on each invocation. * Defaults to `true`. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchPendingTransactions.md","from":898,"to":1130} import { watchPendingTransactions } from '@wagmi/core' const unwatch = watchPendingTransactions(config, { batch: false, // [!code focus] onTransactions(transactions) { console.log('New transactions!', transactions) }, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` ID of chain to use when fetching data. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchPendingTransactions.md","from":1311,"to":1629} import { watchPendingTransactions } from '@wagmi/core' import { mainnet } from '@wagmi/core/chains' import { config } from './config' const unwatch = watchPendingTransactions(config, { chainId: mainnet.id, // [!code focus] onTransactions(transactions) { console.log('New transactions!', transactions) }, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onError `((error: Error) => void) | undefined` Error thrown from watching pending transactions. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchPendingTransactions.md","from":1814,"to":2154} import { watchPendingTransactions } from '@wagmi/core' import { config } from './config' const unwatch = watchPendingTransactions(config, { onError(error) { // [!code focus] console.log('Error', error) // [!code focus] }, // [!code focus] onTransactions(transactions) { console.log('New transactions!', transactions) }, }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### onTransactions `(transactions: Hash[], prevTransactions: Hash[] | undefined) => void` Callback when new incoming pending transactions are detected. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchPendingTransactions.md","from":2391,"to":2675} import { watchPendingTransactions } from '@wagmi/core' import { config } from './config' const unwatch = watchPendingTransactions(config, { onTransactions(transactions) { // [!code focus] console.log('New transactions!', transactions) // [!code focus] }, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### poll `boolean | undefined` * Whether or not to use a polling mechanism to check for new pending transactions instead of a WebSocket subscription. * Defaults to `false` for WebSocket Clients, and `true` for non-WebSocket Clients. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchPendingTransactions.md","from":2993,"to":3258} import { watchPendingTransactions } from '@wagmi/core' import { config } from './config' const unwatch = watchPendingTransactions(config, { onTransactions(transactions) { console.log('New transactions!', transactions) }, poll: false, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### pollingInterval `number | undefined` * Polling frequency (in milliseconds). * Defaults to the [Config's `pollingInterval` config](/core/api/createConfig#pollinginterval). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchPendingTransactions.md","from":3518,"to":3794} import { watchPendingTransactions } from '@wagmi/core' import { config } from './config' const unwatch = watchPendingTransactions(config, { onTransactions(transactions) { console.log('New transactions!', transactions) }, pollingInterval: 1_000, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### syncConnectedChain `boolean | undefined` * Set up subscriber for connected chain changes. * Defaults to [`Config['syncConnectedChain']`](/core/api/createConfig#syncconnectedchain). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchPendingTransactions.md","from":4064,"to":4343} import { watchPendingTransactions } from '@wagmi/core' import { config } from './config' const unwatch = watchPendingTransactions(config, { onTransactions(transactions) { console.log('New transactions!', transactions) }, syncConnectedChain: false, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/watchPendingTransactions.md","from":4415,"to":4485} import { type WatchPendingTransactionsReturnType } from '@wagmi/core' ``` Function to unsubscribe from pending transaction listener. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/watchPendingTransactions.md","from":4566,"to":4631} import { type WatchPendingTransactionsError } from '@wagmi/core' ``` ## Viem * [`watchPendingTransactions`](https://viem.sh/docs/actions/public/watchPendingTransactions) --- --- url: /core/api/actions/watchPublicClient.md --- # watchPublicClient Subscribe to Public Client changes. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/watchPublicClient.md","from":75,"to":123} import { watchPublicClient } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchPublicClient.md","from":170,"to":386} import { watchPublicClient } from '@wagmi/core' import { config } from './config' const unwatch = watchPublicClient(config, { onChange(client) { console.log('Public Client changed!', client) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/watchPublicClient.md","from":457,"to":520} import { type WatchPublicClientParameters } from '@wagmi/core' ``` ### onChange `onChange(client: GetPublicClientReturnType, prevClient: GetPublicClientReturnType): void` Callback function called when Public Client changes. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/watchPublicClient.md","from":717,"to":952} import { watchPublicClient } from '@wagmi/core' import { config } from './config' const unwatch = watchPublicClient(config, { onChange(client) { // [!code focus:3] console.log('Public Client changed!', client) }, }) unwatch() ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/watchPublicClient.md","from":1024,"to":1087} import { type WatchPublicClientReturnType } from '@wagmi/core' ``` Function for cleaning up watcher. --- --- url: /core/api/transports/webSocket.md --- # webSocket The `webSocket` Transport connects to a JSON-RPC API via a WebSocket. Wraps Viem's [`webSocket` Transport](https://viem.sh/docs/clients/transports/websocket). ## Import ```ts-vue import { webSocket } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, webSocket // [!code hl] } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: webSocket('wss://foo-bar-baz.quiknode.pro/...'), // [!code hl] [sepolia.id]: webSocket('wss://foo-bar-sep.quicknode.pro/...'), // [!code hl] }, }) ``` ::: warning If no URL is provided, then the transport will fall back to a public RPC URL on the chain. It is highly recommended to provide an authenticated RPC URL to prevent rate-limiting. ::: ## Parameters ### url `string` URL of the JSON-RPC API. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...') ``` ### key (optional) `string` A key for the Transport. Defaults to `"webSocket"`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { key: 'alchemy', // [!code focus] }) ``` ### name (optional) `string` A name for the Transport. Defaults to `"WebSocket JSON-RPC"`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { name: 'Alchemy WebSocket Provider', // [!code focus] }) ``` ### retryCount (optional) `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { retryCount: 5, // [!code focus] }) ``` ### retryDelay (optional) `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { retryDelay: 100, // [!code focus] }) ``` ### timeout (optional) `number` The timeout for async WebSocket requests. Defaults to `10_000`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { timeout: 60_000, // [!code focus] }) ``` --- --- url: /react/api/transports/webSocket.md --- # webSocket The `webSocket` Transport connects to a JSON-RPC API via a WebSocket. Wraps Viem's [`webSocket` Transport](https://viem.sh/docs/clients/transports/websocket). ## Import ```ts-vue import { webSocket } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, webSocket // [!code hl] } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: webSocket('wss://foo-bar-baz.quiknode.pro/...'), // [!code hl] [sepolia.id]: webSocket('wss://foo-bar-sep.quicknode.pro/...'), // [!code hl] }, }) ``` ::: warning If no URL is provided, then the transport will fall back to a public RPC URL on the chain. It is highly recommended to provide an authenticated RPC URL to prevent rate-limiting. ::: ## Parameters ### url `string` URL of the JSON-RPC API. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...') ``` ### key (optional) `string` A key for the Transport. Defaults to `"webSocket"`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { key: 'alchemy', // [!code focus] }) ``` ### name (optional) `string` A name for the Transport. Defaults to `"WebSocket JSON-RPC"`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { name: 'Alchemy WebSocket Provider', // [!code focus] }) ``` ### retryCount (optional) `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { retryCount: 5, // [!code focus] }) ``` ### retryDelay (optional) `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { retryDelay: 100, // [!code focus] }) ``` ### timeout (optional) `number` The timeout for async WebSocket requests. Defaults to `10_000`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { timeout: 60_000, // [!code focus] }) ``` --- --- url: /shared/transports/webSocket.md --- # webSocket The `webSocket` Transport connects to a JSON-RPC API via a WebSocket. Wraps Viem's [`webSocket` Transport](https://viem.sh/docs/clients/transports/websocket). ## Import ```ts-vue // {"path":"/vercel/path0/site/shared/transports/webSocket.md","from":257,"to":301} import { webSocket } from '{{packageName}}' ``` ## Usage ```ts-vue // {"path":"/vercel/path0/site/shared/transports/webSocket.md","from":326,"to":745} import { createConfig, webSocket // [!code hl] } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: webSocket('wss://foo-bar-baz.quiknode.pro/...'), // [!code hl] [sepolia.id]: webSocket('wss://foo-bar-sep.quicknode.pro/...'), // [!code hl] }, }) ``` ::: warning If no URL is provided, then the transport will fall back to a public RPC URL on the chain. It is highly recommended to provide an authenticated RPC URL to prevent rate-limiting. ::: ## Parameters ### url `string` URL of the JSON-RPC API. ```ts // {"path":"/vercel/path0/site/shared/transports/webSocket.md","from":1011,"to":1077} const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...') ``` ### key (optional) `string` A key for the Transport. Defaults to `"webSocket"`. ```ts // {"path":"/vercel/path0/site/shared/transports/webSocket.md","from":1171,"to":1279} const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { key: 'alchemy', // [!code focus] }) ``` ### name (optional) `string` A name for the Transport. Defaults to `"WebSocket JSON-RPC"`. ```ts // {"path":"/vercel/path0/site/shared/transports/webSocket.md","from":1384,"to":1512} const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { name: 'Alchemy WebSocket Provider', // [!code focus] }) ``` ### retryCount (optional) `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts // {"path":"/vercel/path0/site/shared/transports/webSocket.md","from":1633,"to":1738} const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { retryCount: 5, // [!code focus] }) ``` ### retryDelay (optional) `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts // {"path":"/vercel/path0/site/shared/transports/webSocket.md","from":2022,"to":2129} const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { retryDelay: 100, // [!code focus] }) ``` ### timeout (optional) `number` The timeout for async WebSocket requests. Defaults to `10_000`. ```ts // {"path":"/vercel/path0/site/shared/transports/webSocket.md","from":2239,"to":2346} const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { timeout: 60_000, // [!code focus] }) ``` --- --- url: /solid/api/transports/webSocket.md --- # webSocket The `webSocket` Transport connects to a JSON-RPC API via a WebSocket. Wraps Viem's [`webSocket` Transport](https://viem.sh/docs/clients/transports/websocket). ## Import ```ts-vue import { webSocket } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, webSocket // [!code hl] } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: webSocket('wss://foo-bar-baz.quiknode.pro/...'), // [!code hl] [sepolia.id]: webSocket('wss://foo-bar-sep.quicknode.pro/...'), // [!code hl] }, }) ``` ::: warning If no URL is provided, then the transport will fall back to a public RPC URL on the chain. It is highly recommended to provide an authenticated RPC URL to prevent rate-limiting. ::: ## Parameters ### url `string` URL of the JSON-RPC API. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...') ``` ### key (optional) `string` A key for the Transport. Defaults to `"webSocket"`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { key: 'alchemy', // [!code focus] }) ``` ### name (optional) `string` A name for the Transport. Defaults to `"WebSocket JSON-RPC"`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { name: 'Alchemy WebSocket Provider', // [!code focus] }) ``` ### retryCount (optional) `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { retryCount: 5, // [!code focus] }) ``` ### retryDelay (optional) `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { retryDelay: 100, // [!code focus] }) ``` ### timeout (optional) `number` The timeout for async WebSocket requests. Defaults to `10_000`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { timeout: 60_000, // [!code focus] }) ``` --- --- url: /vue/api/transports/webSocket.md --- # webSocket The `webSocket` Transport connects to a JSON-RPC API via a WebSocket. Wraps Viem's [`webSocket` Transport](https://viem.sh/docs/clients/transports/websocket). ## Import ```ts-vue import { webSocket } from '{{packageName}}' ``` ## Usage ```ts-vue import { createConfig, webSocket // [!code hl] } from '{{packageName}}' import { mainnet, sepolia } from '{{packageName}}/chains' export const config = createConfig({ chains: [mainnet, sepolia], connectors: [injected()], transports: { [mainnet.id]: webSocket('wss://foo-bar-baz.quiknode.pro/...'), // [!code hl] [sepolia.id]: webSocket('wss://foo-bar-sep.quicknode.pro/...'), // [!code hl] }, }) ``` ::: warning If no URL is provided, then the transport will fall back to a public RPC URL on the chain. It is highly recommended to provide an authenticated RPC URL to prevent rate-limiting. ::: ## Parameters ### url `string` URL of the JSON-RPC API. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...') ``` ### key (optional) `string` A key for the Transport. Defaults to `"webSocket"`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { key: 'alchemy', // [!code focus] }) ``` ### name (optional) `string` A name for the Transport. Defaults to `"WebSocket JSON-RPC"`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { name: 'Alchemy WebSocket Provider', // [!code focus] }) ``` ### retryCount (optional) `number` The max number of times to retry when a request fails. Defaults to `3`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { retryCount: 5, // [!code focus] }) ``` ### retryDelay (optional) `number` The base delay (in ms) between retries. By default, the Transport will use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) (`~~(1 << count) * retryDelay`), which means the time between retries is not constant. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { retryDelay: 100, // [!code focus] }) ``` ### timeout (optional) `number` The timeout for async WebSocket requests. Defaults to `10_000`. ```ts const transport = webSocket('wss://foo-bar-baz.quiknode.pro/...', { timeout: 60_000, // [!code focus] }) ``` --- --- url: /react/why.md --- # Why Wagmi ## The Problems Building Ethereum applications is hard. Apps need to support connecting wallets, multiple chains, signing messages and data, sending transactions, listening for events and state changes, refreshing stale blockchain data, and much more. This is all on top of solving for app-specific use-cases and providing polished user experiences. The ecosystem is also continuously evolving, meaning you need to adapt to new improvements or get left behind. App developers should not need to worry about connecting tens of different wallets, the intricacies of multi-chain support, typos accidentally sending an order of magnitude more ETH or calling a misspelled contract function, or accidentally spamming their RPC provider, costing thousands in compute units. Wagmi solves all these problems and more — allowing app developers to focus on building high-quality and performant experiences for Ethereum — by focusing on **developer experience**, **performance**, **feature coverage**, and **stability.** ## Developer Experience Wagmi delivers a great developer experience through modular and composable APIs, automatic type safety and inference, and comprehensive documentation. It provides developers with intuitive building blocks to build their Ethereum apps. While Wagmi's APIs might seem more verbose at first, it makes Wagmi's modular building blocks extremely flexible. Easy to move around, change, and remove. It also allows developers to better understand Ethereum concepts as well as understand *what* and *why* certain properties are being passed through. Learning how to use Wagmi is a great way to learn how to interact with Ethereum in general. Wagmi also provides [strongly typed APIs](/react/typescript), allowing consumers to get the best possible experience through [autocomplete](https://twitter.com/awkweb/status/1555678944770367493), [type inference](https://twitter.com/jakemoxey/status/1570244174502588417?s=20), as well as static validation. You often just need to provide an ABI and Wagmi can help you autocomplete your way to success, identify type errors before your users do, drill into blockchain errors [at compile and runtimes](/react/guides/error-handling) with surgical precision, and much more. The API documentation is comprehensive and contains usage info for *every* module in Wagmi. The core team uses a [documentation](https://gist.github.com/zsup/9434452) and [test driven](https://en.wikipedia.org/wiki/Test-driven_development#:~:text=Test%2Ddriven%20development%20\(TDD\),software%20against%20all%20test%20cases.) development approach to building modules, which leads to predictable and stable APIs. ## Performance Performance is critical for applications on all sizes. Slow page load and interactions can cause users to stop using applications. Wagmi uses and is built by the same team behind [Viem](https://viem.sh), the most performant production-ready Ethereum library. End users should not be required to download a module of over 100kB in order to interact with Ethereum. Wagmi is optimized for tree-shaking and dead-code elimination, allowing apps to minimize bundle size for fast page load times. Data layer performance is also critical. Slow, unnecessary, and manual data fetching can make apps unusable and cost thousands in RPC compute units. Wagmi supports caching, deduplication, persistence, and much more through [TanStack Query](/react/guides/tanstack-query). ## Feature Coverage Wagmi supports the most popular and commonly-used Ethereum features out of the box with 40+ React Hooks for accounts, wallets, contracts, transactions, signing, ENS, and more. Wagmi also supports just about any wallet out there through official [connectors](/react/api/connectors), [EIP-6963 support](/react/api/createConfig#multiinjectedproviderdiscovery), and [extensible API](/dev/creating-connectors). If you need lower-level control, you can always drop down to [Wagmi Core](/core/getting-started) or [Viem](https://viem.sh), which Wagmi uses internally to perform blockchain operations. Wagmi also manages multi-chain support automatically so developers can focus on their applications instead of adding custom code. Finally, Wagmi has a [CLI](/cli/getting-started) to manage ABIs as well as a robust ecosystem of third-party libraries, like [ConnectKit](https://docs.family.co/connectkit), [Dynamic](https://www.dynamic.xyz), [Privy](https://privy.io), and many more, so you can get started quickly without needing to build everything from scratch. ## Stability Stability is a fundamental principle for Wagmi. Many organizations, large and small, rely heavily on Wagmi and expect it to be entirely stable for their users and applications. Wagmi's test suite runs against forked Ethereum nodes to make sure functions work across chains. The test suite also runs type tests against many different versions of peer dependencies, like TypeScript, to ensure compatibility with the latest releases of other popular software. Wagmi follows semver so developers can upgrade between versions with confidence. Starting with Wagmi v2, new functionality will be opt-in with old functionality being deprecated alongside the new features. This means upgrading to the latest major versions will not require immediate changes. Lastly, the core team works full-time on Wagmi and [related projects](https://github.com/wevm), and is constantly improving Wagmi and keeping it up-to-date with industry trends and changes. --- --- url: /solid/why.md --- # Why Wagmi Please see the [React "Why Wagmi"](/react/why) page for more information on the rationale behind the Wagmi project. The same principles apply to `@wagmi/solid`. ## Why Solid? [Solid](https://www.solidjs.com/) is a declarative JavaScript library for building user interfaces. It compiles templates to real DOM nodes and updates them with fine-grained reactions. Solid combines the best ideas from React, Vue, and Svelte while providing excellent performance and a small bundle size. `@wagmi/solid` brings the same great developer experience from Wagmi to Solid applications, allowing you to build Ethereum applications with Solid's reactive primitives. --- --- url: /vue/why.md --- # Why Wagmi ## The Problems Building Ethereum applications is hard. Apps need to support connecting wallets, multiple chains, signing messages and data, sending transactions, listening for events and state changes, refreshing stale blockchain data, and much more. This is all on top of solving for app-specific use-cases and providing polished user experiences. The ecosystem is also continuously evolving, meaning you need to adapt to new improvements or get left behind. App developers should not need to worry about connecting tens of different wallets, the intricacies of multi-chain support, typos accidentally sending an order of magnitude more ETH or calling a misspelled contract function, or accidentally spamming their RPC provider, costing thousands in compute units. Wagmi solves all these problems and more — allowing app developers to focus on building high-quality and performant experiences for Ethereum — by focusing on **developer experience**, **performance**, **feature coverage**, and **stability.** ## Developer Experience Wagmi delivers a great developer experience through modular and composable APIs, automatic type safety and inference, and comprehensive documentation. It provides developers with intuitive building blocks to build their Ethereum apps. While Wagmi's APIs might seem more verbose at first, it makes Wagmi's modular building blocks extremely flexible. Easy to move around, change, and remove. It also allows developers to better understand Ethereum concepts as well as understand *what* and *why* certain properties are being passed through. Learning how to use Wagmi is a great way to learn how to interact with Ethereum in general. Wagmi also provides [strongly typed APIs](/vue/typescript), allowing consumers to get the best possible experience through [autocomplete](https://twitter.com/awkweb/status/1555678944770367493), [type inference](https://twitter.com/jakemoxey/status/1570244174502588417?s=20), as well as static validation. You often just need to provide an ABI and Wagmi can help you autocomplete your way to success, identify type errors before your users do, drill into blockchain errors [at compile and runtimes](/vue/guides/error-handling) with surgical precision, and much more. The API documentation is comprehensive and contains usage info for *every* module in Wagmi. The core team uses a [documentation](https://gist.github.com/zsup/9434452) and [test driven](https://en.wikipedia.org/wiki/Test-driven_development#:~:text=Test%2Ddriven%20development%20\(TDD\),software%20against%20all%20test%20cases.) development approach to building modules, which leads to predictable and stable APIs. ## Performance Performance is critical for applications on all sizes. Slow page load and interactions can cause users to stop using applications. Wagmi uses and is built by the same team behind [Viem](https://viem.sh), the most performant production-ready Ethereum library. End users should not be required to download a module of over 100kB in order to interact with Ethereum. Wagmi is optimized for tree-shaking and dead-code elimination, allowing apps to minimize bundle size for fast page load times. Data layer performance is also critical. Slow, unnecessary, and manual data fetching can make apps unusable and cost thousands in RPC compute units. Wagmi supports caching, deduplication, persistence, and much more through [TanStack Query](/vue/guides/tanstack-query). ## Feature Coverage Wagmi supports the most popular and commonly-used Ethereum features out of the box with 40+ Vue Composables for accounts, wallets, contracts, transactions, signing, ENS, and more. Wagmi also supports just about any wallet out there through it's official [connectors](/vue/api/connectors), [EIP-6963 support](/vue/api/createConfig#multiinjectedproviderdiscovery), and [extensible API](/dev/creating-connectors). If you need lower-level control, you can always drop down to [Wagmi Core](/core/getting-started) or [Viem](https://viem.sh), which Wagmi uses internally to perform blockchain operations. Wagmi also manages multi-chain support automatically so developers can focus on their applications instead of adding custom code. Finally, Wagmi has a [CLI](/cli/getting-started) to manage ABIs as well as a robust ecosystem of third-party libraries, like [ConnectKit](https://docs.family.co/connectkit), [Dynamic](https://www.dynamic.xyz), [Privy](https://privy.io), and many more, so you can get started quickly without needing to build everything from scratch. ## Stability Stability is a fundamental principle for Wagmi. Many organizations, large and small, rely heavily on Wagmi and expect it to be entirely stable for their users and applications. Wagmi's test suite runs against forked Ethereum nodes to make sure functions work across chains. The test suite also runs type tests against many different versions of peer dependencies, like TypeScript, to ensure compatibility with the latest releases of other popular software. Wagmi follows semver so developers can upgrade between versions with confidence. Starting with Wagmi v2, new functionality will be opt-in with old functionality being deprecated alongside the new features. This means upgrading to the latest major versions will not require immediate changes. Lastly, the core team works full-time on Wagmi and [related projects](https://github.com/wevm), and is constantly improving Wagmi and keeping it up-to-date with industry trends and changes. --- --- url: /cli/why.md --- # Why Wagmi CLI ## The Problem The most common way to interact with smart contracts is through [Application Binary Interfaces](https://docs.soliditylang.org/en/latest/abi-spec.html). ABIs describe smart contracts' public functionality (e.g. functions, events, errors) as well as how to encode and decode related data (e.g. arguments and results). While ABIs are extremely powerful, there isn't a uniform way developers manage them in their apps. Developers do a bunch of different things, like: * Publish packages on npm containing ABIs * Write custom scripts to fetch ABIs from external sources * Compile contracts into application project * Copy and paste ABIs from local projects or block explorers All these approaches take time that you could spend doing more important things, like interacting with your smart contracts! ## The Solution The Wagmi CLI is an attempt to automate manual work so you can build faster. In short, the CLI manages ABIs and generates code. It takes ABIs as inputs and outputs ABIs and generated code. For example, the [Etherscan plugin](/cli/api/plugins/etherscan) allows you to fetch ABIs across multiple chains and deployments and immediately start importing them into your project. Code generation is another big advantage of the CLI. Using the [React plugin](/cli/api/plugins/react), you can generate [Wagmi Hooks](/react/api/hooks) for ABIs. When you combine this with the CLI's different ABI sources, like Etherscan, Foundry/Hardhat, and more, you reduce a lot of boilerplate code. ::: code-group ```ts [Diff] // {"path":"/vercel/path0/site/cli/why.md","from":1556,"to":2407} import { useReadContract, useWriteContract } from 'wagmi' // [!code --] import { froggyFriendsAbi, froggyFriendsAddress } from './generated' // [!code --] import { useReadFroggyFriends, useWriteFroggyFriends } from './generated' // [!code ++] function App() { const { data } = useReadContract({ // [!code --] const { data } = useReadFroggyFriends({ // [!code ++] abi: froggyFriendsAbi, // [!code --] address: froggyFriendsAddress, // [!code --] functionName: 'tokenURI', args: [123n], }) const { write } = useWriteContract() // [!code --] const { write } = useWriteFroggyFriends() // [!code ++] const onClick = React.useCallback(() => { write({ abi: froggyFriendsAbi, // [!code --] address: froggyFriendsAddress, // [!code --] functionName: 'mint', args: ['foo', 123n], }) }, [write]) } ``` ```ts [Before] // {"path":"/vercel/path0/site/cli/why.md","from":2426,"to":2963} import { useReadContract, useWriteContract } from 'wagmi' import { froggyFriendsAbi, froggyFriendsAddress } from './generated' function App() { const { data } = useReadContract({ abi: froggyFriendsAbi, address: froggyFriendsAddress, functionName: 'tokenURI', args: [123n], }) const { write } = useWriteContract() const onClick = React.useCallback(() => { write({ abi: froggyFriendsAbi, address: froggyFriendsAddress, functionName: 'mint', args: ['foo', 123n], }) }, [write]) } ``` ```ts [After] // {"path":"/vercel/path0/site/cli/why.md","from":2981,"to":3347} import { useReadFroggyFriends, useWriteFroggyFriends } from './generated' function App() { const { data } = useReadFroggyFriends({ functionName: 'tokenURI', args: [123n], }) const { write } = useWriteFroggyFriends() const onClick = React.useCallback(() => { write({ functionName: 'mint', args: ['foo', 123n], }) }, [write]) } ``` ::: Finally, the Wagmi CLI supports popular smart contract development tools, [Foundry](/cli/api/plugins/foundry) and [Hardhat](/cli/api/plugins/hardhat). You can run the CLI in [watch mode](/cli/api/commands/generate#w-watch), make changes to your contracts, and the CLI will automatically pick up ABI changes and run plugins over those changes. A major boon to working a monorepo and shortening the feedback loop across your stack. --- --- url: /core/why.md --- # Why Wagmi Core ## The Problems Building Ethereum applications is hard. Apps need to support connecting wallets, multiple chains, signing messages and data, sending transactions, listening for events and state changes, refreshing stale blockchain data, and much more. This is all on top of solving for app-specific use-cases and providing polished user experiences. The ecosystem is also continuously evolving, meaning you need to adapt to new improvements or get left behind. App developers should not need to worry about connecting tens of different wallets, the intricacies of multi-chain support, typos accidentally sending an order of magnitude more ETH or calling a misspelled contract function, or accidentally spamming their RPC provider, costing thousands in compute units. Wagmi Core solves all these problems and more — allowing app developers to focus on building high-quality and performant experiences for Ethereum — by focusing on **developer experience**, **performance**, **feature coverage**, and **stability.** ## Developer Experience Wagmi Core delivers a great developer experience through modular and composable APIs, automatic type safety and inference, and comprehensive documentation. It provides developers with intuitive building blocks to build their Ethereum apps. While Wagmi Core's APIs might seem more verbose at first, it makes Wagmi Core's modular building blocks extremely flexible. Easy to move around, change, and remove. It also allows developers to better understand Ethereum concepts as well as understand *what* and *why* certain properties are being passed through. Learning how to use Wagmi Core is a great way to learn how to interact with Ethereum in general. Wagmi Core also provides [strongly typed APIs](/core/typescript), allowing consumers to get the best possible experience through [autocomplete](https://twitter.com/awkweb/status/1555678944770367493), [type inference](https://twitter.com/jakemoxey/status/1570244174502588417?s=20), as well as static validation. You often just need to provide an ABI and Wagmi Core can help you autocomplete your way to success, identify type errors before your users do, drill into blockchain errors [at compile and runtimes](/core/guides/error-handling) with surgical precision, and much more. The API documentation is comprehensive and contains usage info for *every* module in Wagmi Core. The core team uses a [documentation](https://gist.github.com/zsup/9434452) and [test driven](https://en.wikipedia.org/wiki/Test-driven_development#:~:text=Test%2Ddriven%20development%20\(TDD\),software%20against%20all%20test%20cases.) development approach to building modules, which leads to predictable and stable APIs. ## Performance Performance is critical for applications on all sizes. Slow page load and interactions can cause users to stop using applications. Wagmi Core uses and is built by the same team behind [Viem](https://viem.sh), the most performant production-ready Ethereum library. End users should not be required to download a module of over 100kB in order to interact with Ethereum. Wagmi Core is optimized for tree-shaking and dead-code elimination, allowing apps to minimize bundle size for fast page load times. Data layer performance is also critical. Slow, unnecessary, and manual data fetching can make apps unusable and cost thousands in RPC compute units. Wagmi Core supports caching, deduplication, persistence, and much more through [TanStack Query](/react/guides/tanstack-query) via the `'@wagmi/core/query'` entrypoint so you can [plug it into your framework](/core/guides/framework-adapters) of choice, like Vue, Svelte, and more. ## Feature Coverage Wagmi Core supports the most popular and commonly-used Ethereum features out of the box with 40+ VanillaJS Actions for accounts, wallets, contracts, transactions, signing, ENS, and more. Wagmi Core also supports just about any wallet out there through its official [connectors](/core/api/connectors), [EIP-6963 support](/core/api/createConfig#multiinjectedproviderdiscovery), and [extensible API](/dev/creating-connectors). If you need lower-level control, you can always drop down to [Viem](https://viem.sh), which Wagmi Core uses internally to perform blockchain operations. Wagmi Core also manages multi-chain support automatically so developers can focus on their applications instead of adding custom code. Finally, Wagmi Core has a [CLI](/cli/getting-started) to manage ABIs as well as a robust ecosystem of third-party libraries, like [ConnectKit](https://docs.family.co/connectkit), [Dynamic](https://www.dynamic.xyz), [Privy](https://privy.io), and many more, so you can get started quickly without needing to build everything from scratch. ## Stability Stability is a fundamental principle for Wagmi Core. Many organizations, large and small, rely heavily on Wagmi Core and expect it to be entirely stable for their users and applications. Wagmi Core's test suite runs against forked Ethereum nodes to make sure functions work across chains. The test suite also runs type tests against many different versions of peer dependencies, like TypeScript, to ensure compatibility with the latest releases of other popular software. Wagmi Core follows semver so developers can upgrade between versions with confidence. Starting with Wagmi Core v2, new functionality will be opt-in with old functionality being deprecated alongside the new features. This means upgrading to the latest major versions will not require immediate changes. Lastly, the core team works full-time on Wagmi Core and [related projects](https://github.com/wevm), and is constantly improving Wagmi Core and keeping it up-to-date with industry trends and changes. --- --- url: /react/guides/write-to-contract.md --- # Write to Contract The [`useWriteContract` Hook](/react/api/hooks/useWriteContract) allows you to mutate data on a smart contract, from a `payable` or `nonpayable` (write) function. These types of functions require gas to be executed, hence a transaction is broadcasted in order to change the state. In the guide below, we will teach you how to implement a "Mint NFT" form that takes in a dynamic argument (token ID) using Wagmi. The example below builds on the [Connect Wallet guide](/react/guides/connect-wallet) and uses the [useWriteContract](/react/api/hooks/useWriteContract) & [useWaitForTransactionReceipt](/react/api/hooks/useWaitForTransactionReceipt) hooks. If you have already completed the [Sending Transactions guide](/react/guides/send-transaction), this guide will look very similar! That's because writing to a contract internally broadcasts & sends a transaction. ## Example Feel free to check out the example before moving on: ## Steps ### 1. Connect Wallet Follow the [Connect Wallet guide](/react/guides/connect-wallet) guide to get this set up. ### 2. Create a new component Create your `MintNFT` component that will contain the Mint NFT logic. ::: code-group ```tsx [mint-nft.tsx] // {"path":"/vercel/path0/site/react/guides/write-to-contract.md","from":1389,"to":1592} import * as React from 'react' export function MintNFT() { return (
) } ``` ::: ### 3. Add a form handler Next, we will need to add a handler to the form that will send the transaction when the user hits "Mint". This will be a basic handler in this step. ::: code-group ```tsx [mint-nft.tsx] // {"path":"/vercel/path0/site/react/guides/write-to-contract.md","from":1817,"to":2355} import * as React from 'react' export function MintNFT() { async function submit(e: React.FormEvent) { // [!code ++] e.preventDefault() // [!code ++] const formData = new FormData(e.target as HTMLFormElement) // [!code ++] const tokenId = formData.get('tokenId') as string // [!code ++] } // [!code ++] return (
// [!code --] // [!code ++]
) } ``` ::: ### 4. Hook up the `useWriteContract` Hook Now that we have the form handler, we can hook up the [`useWriteContract` Hook](/react/api/hooks/useWriteContract) to send the transaction. ::: code-group ```tsx [mint-nft.tsx] // {"path":"/vercel/path0/site/react/guides/write-to-contract.md","from":2588,"to":3501} import * as React from 'react' import { useWriteContract } from 'wagmi' // [!code ++] import { abi } from './abi' // [!code ++] export function MintNFT() { const { data: hash, writeContract } = useWriteContract() // [!code ++] async function submit(e: React.FormEvent) { e.preventDefault() const formData = new FormData(e.target as HTMLFormElement) const tokenId = formData.get('tokenId') as string writeContract({ // [!code ++] address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', // [!code ++] abi, // [!code ++] functionName: 'mint', // [!code ++] args: [BigInt(tokenId)], // [!code ++] }) // [!code ++] } return (
{hash &&
Transaction Hash: {hash}
} // [!code ++]
) } ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/react/guides/write-to-contract.md","from":3521,"to":3729} export const abi = [ { name: 'mint', type: 'function', stateMutability: 'nonpayable', inputs: [{ internalType: 'uint32', name: 'tokenId', type: 'uint32' }], outputs: [], }, ] as const ``` ::: ### 5. Add loading state (optional) We can optionally add a loading state to the "Mint" button while we are waiting confirmation from the user's wallet. ::: code-group ```tsx [mint-nft.tsx] // {"path":"/vercel/path0/site/react/guides/write-to-contract.md","from":3932,"to":4898} import * as React from 'react' import { useWriteContract } from 'wagmi' import { abi } from './abi' export function MintNFT() { const { data: hash, isPending, // [!code ++] writeContract } = useWriteContract() async function submit(e: React.FormEvent) { e.preventDefault() const formData = new FormData(e.target as HTMLFormElement) const tokenId = formData.get('tokenId') as string writeContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'mint', args: [BigInt(tokenId)], }) } return (
{hash &&
Transaction Hash: {hash}
}
) } ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/react/guides/write-to-contract.md","from":4918,"to":5126} export const abi = [ { name: 'mint', type: 'function', stateMutability: 'nonpayable', inputs: [{ internalType: 'uint32', name: 'tokenId', type: 'uint32' }], outputs: [], }, ] as const ``` ::: ### 6. Wait for transaction receipt (optional) We can also display the transaction confirmation status to the user by using the [`useWaitForTransactionReceipt` Hook](/react/api/hooks/useWaitForTransactionReceipt). ::: code-group ```tsx [mint-nft.tsx] // {"path":"/vercel/path0/site/react/guides/write-to-contract.md","from":5391,"to":6662} import * as React from 'react' import { useWaitForTransactionReceipt, // [!code ++] useWriteContract } from 'wagmi' import { abi } from './abi' export function MintNFT() { const { data: hash, isPending, writeContract } = useWriteContract() async function submit(e: React.FormEvent) { e.preventDefault() const formData = new FormData(e.target as HTMLFormElement) const tokenId = formData.get('tokenId') as string writeContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'mint', args: [BigInt(tokenId)], }) } const { isLoading: isConfirming, isSuccess: isConfirmed } = // [!code ++] useWaitForTransactionReceipt({ // [!code ++] hash, // [!code ++] }) // [!code ++] return (
{hash &&
Transaction Hash: {hash}
} {isConfirming &&
Waiting for confirmation...
} // [!code ++] {isConfirmed &&
Transaction confirmed.
} // [!code ++]
) } ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/react/guides/write-to-contract.md","from":6682,"to":6890} export const abi = [ { name: 'mint', type: 'function', stateMutability: 'nonpayable', inputs: [{ internalType: 'uint32', name: 'tokenId', type: 'uint32' }], outputs: [], }, ] as const ``` ::: ### 7. Handle errors (optional) If the user rejects the transaction, or the contract reverts, we can display an error message to the user. ::: code-group ```tsx [mint-nft.tsx] // {"path":"/vercel/path0/site/react/guides/write-to-contract.md","from":7079,"to":8465} import * as React from 'react' import { type BaseError, // [!code ++] useWaitForTransactionReceipt, useWriteContract } from 'wagmi' import { abi } from './abi' export function MintNFT() { const { data: hash, error, // [!code ++] isPending, writeContract } = useWriteContract() async function submit(e: React.FormEvent) { e.preventDefault() const formData = new FormData(e.target as HTMLFormElement) const tokenId = formData.get('tokenId') as string writeContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'mint', args: [BigInt(tokenId)], }) } const { isLoading: isConfirming, isSuccess: isConfirmed } = useWaitForTransactionReceipt({ hash, }) return (
{hash &&
Transaction Hash: {hash}
} {isConfirming &&
Waiting for confirmation...
} {isConfirmed &&
Transaction confirmed.
} {error && ( // [!code ++]
Error: {(error as BaseError).shortMessage || error.message}
// [!code ++] )} // [!code ++]
) } ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/react/guides/write-to-contract.md","from":8485,"to":8693} export const abi = [ { name: 'mint', type: 'function', stateMutability: 'nonpayable', inputs: [{ internalType: 'uint32', name: 'tokenId', type: 'uint32' }], outputs: [], }, ] as const ``` ::: ### 8. Wire it up! Finally, we can wire up our Mint NFT component to our application's entrypoint. ::: code-group ```tsx [app.tsx] // {"path":"/vercel/path0/site/react/guides/write-to-contract.md","from":8837,"to":9278} import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { WagmiProvider } from 'wagmi' import { config } from './config' import { MintNft } from './mint-nft' // [!code ++] const queryClient = new QueryClient() function App() { return ( // [!code ++] ) } ``` ```tsx [mint-nft.tsx] // {"path":"/vercel/path0/site/react/guides/write-to-contract.md","from":9305,"to":10626} import * as React from 'react' import { type BaseError, useWaitForTransactionReceipt, useWriteContract } from 'wagmi' import { abi } from './abi' export function MintNFT() { const { data: hash, error, isPending, writeContract } = useWriteContract() async function submit(e: React.FormEvent) { e.preventDefault() const formData = new FormData(e.target as HTMLFormElement) const tokenId = formData.get('tokenId') as string writeContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'mint', args: [BigInt(tokenId)], }) } const { isLoading: isConfirming, isSuccess: isConfirmed } = useWaitForTransactionReceipt({ hash, }) return (
{hash &&
Transaction Hash: {hash}
} {isConfirming &&
Waiting for confirmation...
} {isConfirmed &&
Transaction confirmed.
} {error && (
Error: {(error as BaseError).shortMessage || error.message}
)}
) } ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/react/guides/write-to-contract.md","from":10646,"to":10854} export const abi = [ { name: 'mint', type: 'function', stateMutability: 'nonpayable', inputs: [{ internalType: 'uint32', name: 'tokenId', type: 'uint32' }], outputs: [], }, ] as const ``` ```tsx [config.ts] // {"path":"/vercel/path0/site/react/guides/write-to-contract.md","from":10878,"to":11336} import { http, createConfig } from 'wagmi' import { base, mainnet, optimism } from 'wagmi/chains' import { injected, metaMask, safe, walletConnect } from 'wagmi/connectors' const projectId = '' export const config = createConfig({ chains: [mainnet, base], connectors: [ injected(), walletConnect({ projectId }), metaMask(), safe(), ], transports: { [mainnet.id]: http(), [base.id]: http(), }, }) ``` ::: [See the Example.](#example) --- --- url: /vue/guides/write-to-contract.md --- # Write to Contract The [`useWriteContract` Composable](/vue/api/composables/useWriteContract) allows you to mutate data on a smart contract, from a `payable` or `nonpayable` (write) function. These types of functions require gas to be executed, hence a transaction is broadcasted in order to change the state. In the guide below, we will teach you how to implement a "Mint NFT" form that takes in a dynamic argument (token ID) using Wagmi. The example below builds on the [Connect Wallet guide](/vue/guides/connect-wallet) and uses the [useWriteContract](/vue/api/composables/useWriteContract) & [useWaitForTransactionReceipt](/vue/api/composables/useWaitForTransactionReceipt) composables. If you have already completed the [Sending Transactions guide](/vue/guides/send-transaction), this guide will look very similar! That's because writing to a contract internally broadcasts & sends a transaction. ## Example Feel free to check out the example before moving on: ## Steps ### 1. Connect Wallet Follow the [Connect Wallet guide](/vue/guides/connect-wallet) guide to get this set up. ### 2. Create a new component Create your `MintNft` component that will contain the Mint NFT logic. ::: code-group ```vue [MintNft.vue] // {"path":"/vercel/path0/site/vue/guides/write-to-contract.md","from":1406,"to":1583} ``` ::: ### 3. Add a form handler Next, we will need to add a handler to the form that will send the transaction when the user hits "Mint". This will be a basic handler in this step. ::: code-group ```vue [MintNft.vue] // {"path":"/vercel/path0/site/vue/guides/write-to-contract.md","from":1807,"to":2247} ``` ::: ### 4. Hook up the `useWriteContract` Composable Now that we have the form handler, we can hook up the [`useWriteContract` Composable](/vue/api/composables/useWriteContract) to send the transaction. ::: code-group ```vue [MintNft.vue] // {"path":"/vercel/path0/site/vue/guides/write-to-contract.md","from":2495,"to":3317} ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/vue/guides/write-to-contract.md","from":3337,"to":3545} export const abi = [ { name: 'mint', type: 'function', stateMutability: 'nonpayable', inputs: [{ internalType: 'uint32', name: 'tokenId', type: 'uint32' }], outputs: [], }, ] as const ``` ::: ### 5. Add loading state (optional) We can optionally add a loading state to the "Mint" button while we are waiting confirmation from the user's wallet. ::: code-group ```vue [MintNft.vue] // {"path":"/vercel/path0/site/vue/guides/write-to-contract.md","from":3747,"to":4606} ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/vue/guides/write-to-contract.md","from":4626,"to":4834} export const abi = [ { name: 'mint', type: 'function', stateMutability: 'nonpayable', inputs: [{ internalType: 'uint32', name: 'tokenId', type: 'uint32' }], outputs: [], }, ] as const ``` ::: ### 6. Wait for transaction receipt (optional) We can also display the transaction confirmation status to the user by using the [`useWaitForTransactionReceipt` Composable](/vue/api/composables/useWaitForTransactionReceipt). ::: code-group ```vue [MintNft.vue] // {"path":"/vercel/path0/site/vue/guides/write-to-contract.md","from":5108,"to":6274} ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/vue/guides/write-to-contract.md","from":6294,"to":6502} export const abi = [ { name: 'mint', type: 'function', stateMutability: 'nonpayable', inputs: [{ internalType: 'uint32', name: 'tokenId', type: 'uint32' }], outputs: [], }, ] as const ``` ::: ### 7. Handle errors (optional) If the user rejects the transaction, or the user does not have enough funds to cover the transaction, we can display an error message to the user. ::: code-group ```vue [MintNft.vue] // {"path":"/vercel/path0/site/vue/guides/write-to-contract.md","from":6730,"to":7967} ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/vue/guides/write-to-contract.md","from":7987,"to":8195} export const abi = [ { name: 'mint', type: 'function', stateMutability: 'nonpayable', inputs: [{ internalType: 'uint32', name: 'tokenId', type: 'uint32' }], outputs: [], }, ] as const ``` ::: ### 8. Wire it up! Finally, we can wire up our Send Transaction component to our application's entrypoint. :::code-group ```vue [App.vue] // {"path":"/vercel/path0/site/vue/guides/write-to-contract.md","from":8345,"to":8720} ``` ```vue [MintNft.vue] // {"path":"/vercel/path0/site/vue/guides/write-to-contract.md","from":8746,"to":9927} ``` ```ts [abi.ts] // {"path":"/vercel/path0/site/vue/guides/write-to-contract.md","from":9947,"to":10155} export const abi = [ { name: 'mint', type: 'function', stateMutability: 'nonpayable', inputs: [{ internalType: 'uint32', name: 'tokenId', type: 'uint32' }], outputs: [], }, ] as const ``` ::: [See the Example.](#example) --- --- url: /core/api/actions/writeContract.md --- # writeContract Action for executing a write function on a contract. A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, hence a transaction is broadcasted in order to change the state. ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":415,"to":459} import { writeContract } from '@wagmi/core' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":506,"to":882} import { writeContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ::::tip Pairing with `simulateContract` Pairing [`simulateContract`](/core/api/actions/simulateContract) with `writeContract` allows you to validate if the transaction will succeed ahead of time. If the simulate succeeds, `writeContract` can execute the transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":1269,"to":1721} import { simulateContract, writeContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const { request } = await simulateContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], }) const hash = await writeContract(config, request) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### Synchronous Usage If you want to wait for the transaction to be included in a block before returning, you can use `writeContractSync`: ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":1985,"to":2370} import { writeContractSync } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const receipt = await writeContractSync(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":2477,"to":2536} import { type WriteContractParameters } from '@wagmi/core' ``` ### abi `Abi` The contract's ABI. Check out the [TypeScript docs](/react/typescript#const-assert-abis-typed-data) for how to set up ABIs for maximum type inference and safety. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":2752,"to":3162} import { writeContract } from '@wagmi/core' import { abi } from './abi' // [!code focus] import { config } from './config' const result = await writeContract(config, { abi, // [!code focus] address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### accessList `AccessList | undefined` The access list. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":3340,"to":3853} import { writeContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], accessList: [{ // [!code focus] address: '0x1', // [!code focus] storageKeys: ['0x1'], // [!code focus] }], // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### account `Address | Account | undefined` Account to use when signing data. Throws if account is not found on [`connector`](#connector). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":4113,"to":4563} import { writeContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], account: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### address `Address` The contract's address. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":4730,"to":5123} import { writeContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', // [!code focus] functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### args `readonly unknown[] | undefined` * Arguments to pass when calling the contract. * Inferred from [`abi`](#abi) and [`functionName`](#functionname). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":5401,"to":5861} import { writeContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ // [!code focus] '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus] '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', // [!code focus] 123n, // [!code focus] ] // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `config['chains'][number]['id'] | undefined` Chain ID to validate against before sending transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":6096,"to":6568} import { writeContract } from '@wagmi/core' import { mainnet } from 'wagmi/chains' // [!code focus] import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], chainId: mainnet.id, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` [Connector](/core/api/connectors) to sign data with. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":6780,"to":7245} import { getConnection, writeContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const { connector } = getConnection(config) const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], connector, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### dataSuffix `` `0x${string}` | undefined `` Data to append to the end of the calldata. Useful for adding a ["domain" tag](https://opensea.notion.site/opensea/Seaport-Order-Attributions-ec2d69bf455041a5baa490941aad307f). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":7589,"to":8043} import { writeContract } from '@wagmi/core' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], dataSuffix: '0xdeadbeef', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### functionName `string` * Function to call on the contract. * Inferred from [`abi`](#abi). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":8257,"to":8581} import { writeContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'approve', // [!code focus] args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### gas `bigint | undefined` Gas provided for transaction execution. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":8772,"to":9222} import { writeContract } from '@wagmi/core' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], gas: parseGwei('20'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### gasPrice `bigint | undefined` The price in wei to pay per gas. Only applies to [Legacy Transactions](https://viem.sh/docs/glossary/terms#legacy-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":9510,"to":9965} import { writeContract } from '@wagmi/core' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], gasPrice: parseGwei('20'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxFeePerGas `bigint | undefined` Total fee per gas in wei, inclusive of [`maxPriorityFeePerGas`](#maxPriorityFeePerGas). Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":10311,"to":10770} import { writeContract } from '@wagmi/core' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], maxFeePerGas: parseGwei('20'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### maxPriorityFeePerGas `bigint | undefined` Max priority fee per gas in wei. Only applies to [EIP-1559 Transactions](https://viem.sh/docs/glossary/terms#eip-1559-transaction). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":11069,"to":11568} import { writeContract } from '@wagmi/core' import { parseGwei } from 'viem' import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], maxFeePerGas: parseGwei('20'), maxPriorityFeePerGas: parseGwei('2'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` *** ### nonce `number` Unique number identifying this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":11757,"to":12164} import { writeContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], nonce: 123, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### type `'legacy' | 'eip1559' | 'eip2930' | undefined` Optional transaction request type to narrow parameters. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":12397,"to":12809} import { writeContract } from '@wagmi/core' import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], type: 'eip1559', // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### value `bigint | undefined` Value in wei sent with this transaction. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":13002,"to":13458} import { writeContract } from '@wagmi/core' import { parseEther } from 'viem' import { abi } from './abi' import { config } from './config' const result = await writeContract(config, { abi, address: '0x6b175474e89094c44da98b954eedeac495271d0f', functionName: 'transferFrom', args: [ '0xd2135CfB216b74109775236E36d4b433F1DF507B', '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', 123n, ], value: parseEther('0.01'), // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":13566,"to":13625} import { type WriteContractReturnType } from '@wagmi/core' ``` [`Hash`](https://viem.sh/docs/glossary/types#hash) The transaction hash. ## Type Inference With [`abi`](#abi) setup correctly, TypeScript will infer the correct types for [`functionName`](#functionname), [`args`](#args), and [`value`](#value). See the Wagmi [TypeScript docs](/core/typescript) for more information. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/writeContract.md","from":13966,"to":14024} import { type WriteContractErrorType } from '@wagmi/core' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Variables, type {{typeName}}Mutate, type {{typeName}}MutateAsync, {{actionName}}MutationOptions, } from '{{packageName}}/query' ``` ## Viem * [`writeContract`](https://viem.sh/docs/contract/writeContract) --- --- url: /core/api/actions/writeContracts.md --- # writeContracts Action that requests for the wallet to sign and broadcast a batch of write contract calls (transactions) to the network. [Read more.](https://github.com/ethereum/EIPs/blob/815028dc634463e1716fc5ce44c019a6040f0bef/EIPS/eip-5792.md#wallet_sendcalls) ## Import ```ts // {"path":"/vercel/path0/site/core/api/actions/writeContracts.md","from":431,"to":489} import { writeContracts } from '@wagmi/core/experimental' ``` ## Usage ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContracts.md","from":536,"to":1349} import { parseAbi } from 'viem' import { writeContracts } from '@wagmi/core/experimental' import { config } from './config' const abi = parseAbi([ 'function approve(address, uint256) returns (bool)', 'function transferFrom(address, address, uint256) returns (bool)', ]) const id = await writeContracts(config, { contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'approve', args: [ '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', 100n ], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'transferFrom', args: [ '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', '0x0000000000000000000000000000000000000000', 100n ], }, ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Parameters ```ts // {"path":"/vercel/path0/site/core/api/actions/writeContracts.md","from":1420,"to":1493} import { type WriteContractsParameters } from '@wagmi/core/experimental' ``` ### account `Account | Address | undefined` Account to execute the calls. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContracts.md","from":1607,"to":2494} import { parseAbi } from 'viem' import { writeContracts } from '@wagmi/core/experimental' import { config } from './config' const abi = parseAbi([ 'function approve(address, uint256) returns (bool)', 'function transferFrom(address, address, uint256) returns (bool)', ]) const id = await writeContracts(config, { account: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', // [!code focus] contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'approve', args: [ '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', 100n ], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'transferFrom', args: [ '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', '0x0000000000000000000000000000000000000000', 100n ], }, ], }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### contracts `{ to: Hex, data?: Hex, value?: bigint }[]` Calls to execute. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContracts.md","from":2655,"to":3824} import { parseAbi } from 'viem' import { writeContracts } from '@wagmi/core/experimental' import { config } from './config' const abi = parseAbi([ 'function approve(address, uint256) returns (bool)', 'function transferFrom(address, address, uint256) returns (bool)', ]) const id = await writeContracts(config, { contracts: [ // [!code focus] { // [!code focus] address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', // [!code focus] abi, // [!code focus] functionName: 'approve', // [!code focus] args: [ // [!code focus] '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', // [!code focus] 100n // [!code focus] ], // [!code focus] }, // [!code focus] { // [!code focus] address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', // [!code focus] abi, // [!code focus] functionName: 'transferFrom', // [!code focus] args: [ // [!code focus] '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', // [!code focus] '0x0000000000000000000000000000000000000000', // [!code focus] 100n // [!code focus] ], // [!code focus] }, // [!code focus] ], // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### capabilities `WalletCapabilities | undefined` Capability metadata for the calls (e.g. specifying a paymaster). ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContracts.md","from":4024,"to":4999} import { parseAbi } from 'viem' import { writeContracts } from '@wagmi/core/experimental' import { config } from './config' const abi = parseAbi([ 'function approve(address, uint256) returns (bool)', 'function transferFrom(address, address, uint256) returns (bool)', ]) const id = await writeContracts(config, { contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'approve', args: [ '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', 100n ], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'transferFrom', args: [ '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', '0x0000000000000000000000000000000000000000', 100n ], }, ], capabilities: { // [!code focus] paymasterService: { // [!code focus] url: 'https://...' // [!code focus] } // [!code focus] } // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### chainId `number | undefined` The target chain ID to broadcast the calls. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContracts.md","from":5161,"to":6006} import { parseAbi } from 'viem' import { writeContracts } from '@wagmi/core/experimental' import { config } from './config' const abi = parseAbi([ 'function approve(address, uint256) returns (bool)', 'function transferFrom(address, address, uint256) returns (bool)', ]) const id = await writeContracts(config, { contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'approve', args: [ '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', 100n ], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'transferFrom', args: [ '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', '0x0000000000000000000000000000000000000000', 100n ], }, ], chainId: 10, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ### connector `Connector | undefined` Connector to get send the calls with. ::: code-group ```ts [index.ts] // {"path":"/vercel/path0/site/core/api/actions/writeContracts.md","from":6167,"to":7125} import { parseAbi } from 'viem' import { getConnections } from '@wagmi/core' import { writeContracts } from '@wagmi/core/experimental' import { config } from './config' const abi = parseAbi([ 'function approve(address, uint256) returns (bool)', 'function transferFrom(address, address, uint256) returns (bool)', ]) const connections = getConnections(config) const id = await writeContracts(config, { contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'approve', args: [ '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', 100n ], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'transferFrom', args: [ '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', '0x0000000000000000000000000000000000000000', 100n ], }, ], connector: connections[0]?.connector, // [!code focus] }) ``` ```ts \[config.ts] import { createConfig, http } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' export const config = createConfig({ chains: [mainnet, sepolia], transports: { [mainnet.id]: http(), [sepolia.id]: http(), }, }) ``` ## Return Type ```ts // {"path":"/vercel/path0/site/core/api/actions/writeContracts.md","from":7197,"to":7270} import { type WriteContractsReturnType } from '@wagmi/core/experimental' ``` `{ id: string; capabilities?: WalletCapabilities | undefined }` Identifier of the call batch. ## Error ```ts // {"path":"/vercel/path0/site/core/api/actions/writeContracts.md","from":7387,"to":7459} import { type WriteContractsErrorType } from '@wagmi/core/experimental' ``` ## TanStack Query ```ts-vue import { type {{typeName}}Data, type {{typeName}}Options, type {{typeName}}QueryFnData, type {{typeName}}QueryKey, {{actionName}}QueryKey, {{actionName}}QueryOptions, } from '{{packageName}}/query' ``` ## Viem * [`writeContracts`](https://viem.sh/experimental/eip5792/writeContracts)