From e2a688e6d9bd7bd29524f486f9f91b5178fcb5eb Mon Sep 17 00:00:00 2001 From: tmm Date: Thu, 25 Jun 2026 12:40:52 -0400 Subject: [PATCH 1/2] Fix Tempo transaction override types --- .changeset/quiet-lions-jump.md | 6 + packages/core/src/tempo/actions/amm.test-d.ts | 37 + packages/core/src/tempo/actions/amm.ts | 34 +- packages/core/src/tempo/actions/dex.test-d.ts | 36 + packages/core/src/tempo/actions/dex.ts | 73 +- packages/core/src/tempo/actions/fee.test-d.ts | 29 + packages/core/src/tempo/actions/fee.ts | 18 +- .../core/src/tempo/actions/policy.test-d.ts | 28 + packages/core/src/tempo/actions/policy.ts | 57 +- .../core/src/tempo/actions/reward.test-d.ts | 29 + packages/core/src/tempo/actions/reward.ts | 45 +- .../core/src/tempo/actions/token.test-d.ts | 34 + packages/core/src/tempo/actions/token.ts | 185 +- .../core/src/tempo/actions/utils.test-d.ts | 51 + packages/core/src/tempo/actions/utils.ts | 19 +- .../core/src/tempo/actions/zone.test-d.ts | 18 +- packages/core/src/tempo/actions/zone.ts | 20 +- packages/react/src/tempo/hooks/amm.test-d.ts | 562 ++++ packages/react/src/tempo/hooks/dex.test-d.ts | 1431 ++++++++ .../react/src/tempo/hooks/faucet.test-d.ts | 174 + packages/react/src/tempo/hooks/fee.test-d.ts | 214 ++ .../react/src/tempo/hooks/nonce.test-d.ts | 28 + .../react/src/tempo/hooks/policy.test-d.ts | 791 +++++ .../react/src/tempo/hooks/reward.test-d.ts | 583 ++++ .../react/src/tempo/hooks/token.test-d.ts | 2919 +++++++++++++++++ .../react/src/tempo/hooks/wallet.test-d.ts | 258 ++ packages/react/src/tempo/hooks/zone.test-d.ts | 16 +- 27 files changed, 7543 insertions(+), 152 deletions(-) create mode 100644 .changeset/quiet-lions-jump.md create mode 100644 packages/core/src/tempo/actions/amm.test-d.ts create mode 100644 packages/core/src/tempo/actions/dex.test-d.ts create mode 100644 packages/core/src/tempo/actions/fee.test-d.ts create mode 100644 packages/core/src/tempo/actions/policy.test-d.ts create mode 100644 packages/core/src/tempo/actions/reward.test-d.ts create mode 100644 packages/core/src/tempo/actions/token.test-d.ts create mode 100644 packages/core/src/tempo/actions/utils.test-d.ts create mode 100644 packages/react/src/tempo/hooks/amm.test-d.ts create mode 100644 packages/react/src/tempo/hooks/dex.test-d.ts create mode 100644 packages/react/src/tempo/hooks/faucet.test-d.ts create mode 100644 packages/react/src/tempo/hooks/fee.test-d.ts create mode 100644 packages/react/src/tempo/hooks/nonce.test-d.ts create mode 100644 packages/react/src/tempo/hooks/policy.test-d.ts create mode 100644 packages/react/src/tempo/hooks/reward.test-d.ts create mode 100644 packages/react/src/tempo/hooks/token.test-d.ts create mode 100644 packages/react/src/tempo/hooks/wallet.test-d.ts diff --git a/.changeset/quiet-lions-jump.md b/.changeset/quiet-lions-jump.md new file mode 100644 index 0000000000..0c7e9cb8ce --- /dev/null +++ b/.changeset/quiet-lions-jump.md @@ -0,0 +1,6 @@ +--- +'@wagmi/core': patch +'wagmi': patch +--- + +Fixed Tempo action and hook types so transaction override parameters are optional. diff --git a/packages/core/src/tempo/actions/amm.test-d.ts b/packages/core/src/tempo/actions/amm.test-d.ts new file mode 100644 index 0000000000..7205c1ec46 --- /dev/null +++ b/packages/core/src/tempo/actions/amm.test-d.ts @@ -0,0 +1,37 @@ +import { createConfig, http } from '@wagmi/core' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { test } from 'vitest' +import * as amm from './amm.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) +const tokenA = '0x20c0000000000000000000000000000000000001' +const tokenB = '0x20c0000000000000000000000000000000000002' +const to = '0xd2135CfB216b74109775236E36d4b433F1DF507B' + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +test('mintSync accepts optional transaction overrides', () => { + const chainId = tempo.id + + amm.mintSync(config, { + chainId, + feePayer: true, + to, + userTokenAddress: tokenA, + validatorTokenAddress: tokenB, + validatorTokenAmount: 1_000_000n, + }) + + // @ts-expect-error required action parameters stay required + amm.mintSync(config, { + chainId, + feePayer: true, + to, + validatorTokenAddress: tokenB, + validatorTokenAmount: 1_000_000n, + }) +}) diff --git a/packages/core/src/tempo/actions/amm.ts b/packages/core/src/tempo/actions/amm.ts index a50bbbedf9..84e9ec144f 100644 --- a/packages/core/src/tempo/actions/amm.ts +++ b/packages/core/src/tempo/actions/amm.ts @@ -7,7 +7,11 @@ import type { ConnectorParameter, } from '../../types/properties.js' import type { UnionLooseOmit } from '../../types/utils.js' -import type { QueryOptions, QueryParameter } from './utils.js' +import type { + OptionalTransactionOverrides, + QueryOptions, + QueryParameter, +} from './utils.js' import { filterQueryOptions } from './utils.js' /** @@ -257,7 +261,9 @@ export declare namespace rebalanceSwap { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.amm.rebalanceSwap.Parameters, + OptionalTransactionOverrides< + Actions.amm.rebalanceSwap.Parameters + >, 'chain' > @@ -314,9 +320,11 @@ export declare namespace rebalanceSwapSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.amm.rebalanceSwapSync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.amm.rebalanceSwapSync.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -374,7 +382,9 @@ export declare namespace mint { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.amm.mint.Parameters, + OptionalTransactionOverrides< + Actions.amm.mint.Parameters + >, 'chain' > @@ -431,7 +441,9 @@ export declare namespace mintSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.amm.mintSync.Parameters, + OptionalTransactionOverrides< + Actions.amm.mintSync.Parameters + >, 'chain' > @@ -488,7 +500,9 @@ export declare namespace burn { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.amm.burn.Parameters, + OptionalTransactionOverrides< + Actions.amm.burn.Parameters + >, 'chain' > @@ -545,7 +559,9 @@ export declare namespace burnSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.amm.burnSync.Parameters, + OptionalTransactionOverrides< + Actions.amm.burnSync.Parameters + >, 'chain' > diff --git a/packages/core/src/tempo/actions/dex.test-d.ts b/packages/core/src/tempo/actions/dex.test-d.ts new file mode 100644 index 0000000000..128cbb6d5c --- /dev/null +++ b/packages/core/src/tempo/actions/dex.test-d.ts @@ -0,0 +1,36 @@ +import { createConfig, http } from '@wagmi/core' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { test } from 'vitest' +import * as dex from './dex.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) +const tokenA = '0x20c0000000000000000000000000000000000001' +const tokenB = '0x20c0000000000000000000000000000000000002' + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +test('buySync accepts optional transaction overrides', () => { + const chainId = tempo.id + + dex.buySync(config, { + amountOut: 1_000_000n, + chainId, + feePayer: true, + maxAmountIn: 1_000_000n, + tokenIn: tokenA, + tokenOut: tokenB, + }) + + // @ts-expect-error required action parameters stay required + dex.buySync(config, { + chainId, + feePayer: true, + maxAmountIn: 1_000_000n, + tokenIn: tokenA, + tokenOut: tokenB, + }) +}) diff --git a/packages/core/src/tempo/actions/dex.ts b/packages/core/src/tempo/actions/dex.ts index cf3de7cc72..1f38067253 100644 --- a/packages/core/src/tempo/actions/dex.ts +++ b/packages/core/src/tempo/actions/dex.ts @@ -7,7 +7,11 @@ import type { ConnectorParameter, } from '../../types/properties.js' import type { PartialBy, UnionLooseOmit } from '../../types/utils.js' -import type { QueryOptions, QueryParameter } from './utils.js' +import type { + OptionalTransactionOverrides, + QueryOptions, + QueryParameter, +} from './utils.js' /** * Buys a specific amount of tokens. @@ -57,7 +61,9 @@ export declare namespace buy { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.buy.Parameters, + OptionalTransactionOverrides< + Actions.dex.buy.Parameters + >, 'chain' > @@ -117,7 +123,9 @@ export declare namespace buySync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.buySync.Parameters, + OptionalTransactionOverrides< + Actions.dex.buySync.Parameters + >, 'chain' > @@ -171,7 +179,9 @@ export declare namespace cancel { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.cancel.Parameters, + OptionalTransactionOverrides< + Actions.dex.cancel.Parameters + >, 'chain' > @@ -228,7 +238,9 @@ export declare namespace cancelSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.cancelSync.Parameters, + OptionalTransactionOverrides< + Actions.dex.cancelSync.Parameters + >, 'chain' > @@ -285,7 +297,9 @@ export declare namespace cancelStale { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.cancelStale.Parameters, + OptionalTransactionOverrides< + Actions.dex.cancelStale.Parameters + >, 'chain' > @@ -342,7 +356,12 @@ export declare namespace cancelStaleSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.cancelStaleSync.Parameters, + OptionalTransactionOverrides< + Actions.dex.cancelStaleSync.Parameters< + config['chains'][number], + Account + > + >, 'chain' > @@ -396,7 +415,9 @@ export declare namespace createPair { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.createPair.Parameters, + OptionalTransactionOverrides< + Actions.dex.createPair.Parameters + >, 'chain' > @@ -453,7 +474,9 @@ export declare namespace createPairSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.createPairSync.Parameters, + OptionalTransactionOverrides< + Actions.dex.createPairSync.Parameters + >, 'chain' > @@ -1086,7 +1109,9 @@ export declare namespace place { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.place.Parameters, + OptionalTransactionOverrides< + Actions.dex.place.Parameters + >, 'chain' > @@ -1144,7 +1169,9 @@ export declare namespace placeFlip { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.placeFlip.Parameters, + OptionalTransactionOverrides< + Actions.dex.placeFlip.Parameters + >, 'chain' > @@ -1205,7 +1232,9 @@ export declare namespace placeFlipSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.placeFlipSync.Parameters, + OptionalTransactionOverrides< + Actions.dex.placeFlipSync.Parameters + >, 'chain' > @@ -1265,7 +1294,9 @@ export declare namespace placeSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.placeSync.Parameters, + OptionalTransactionOverrides< + Actions.dex.placeSync.Parameters + >, 'chain' > @@ -1322,7 +1353,9 @@ export declare namespace sell { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.sell.Parameters, + OptionalTransactionOverrides< + Actions.dex.sell.Parameters + >, 'chain' > @@ -1382,7 +1415,9 @@ export declare namespace sellSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.sellSync.Parameters, + OptionalTransactionOverrides< + Actions.dex.sellSync.Parameters + >, 'chain' > @@ -1617,7 +1652,9 @@ export declare namespace withdraw { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.withdraw.Parameters, + OptionalTransactionOverrides< + Actions.dex.withdraw.Parameters + >, 'chain' > @@ -1675,7 +1712,9 @@ export declare namespace withdrawSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.dex.withdrawSync.Parameters, + OptionalTransactionOverrides< + Actions.dex.withdrawSync.Parameters + >, 'chain' > diff --git a/packages/core/src/tempo/actions/fee.test-d.ts b/packages/core/src/tempo/actions/fee.test-d.ts new file mode 100644 index 0000000000..f40b5d1582 --- /dev/null +++ b/packages/core/src/tempo/actions/fee.test-d.ts @@ -0,0 +1,29 @@ +import { createConfig, http } from '@wagmi/core' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { test } from 'vitest' +import * as fee from './fee.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) +const token = '0x20c0000000000000000000000000000000000001' + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +test('setUserTokenSync accepts optional transaction overrides', () => { + const chainId = tempo.id + + fee.setUserTokenSync(config, { + chainId, + feePayer: true, + token, + }) + + // @ts-expect-error required action parameters stay required + fee.setUserTokenSync(config, { + chainId, + feePayer: true, + }) +}) diff --git a/packages/core/src/tempo/actions/fee.ts b/packages/core/src/tempo/actions/fee.ts index 4e809ef38c..05eb30899d 100644 --- a/packages/core/src/tempo/actions/fee.ts +++ b/packages/core/src/tempo/actions/fee.ts @@ -7,7 +7,11 @@ import type { ConnectorParameter, } from '../../types/properties.js' import type { PartialBy, UnionLooseOmit } from '../../types/utils.js' -import type { QueryOptions, QueryParameter } from './utils.js' +import type { + OptionalTransactionOverrides, + QueryOptions, + QueryParameter, +} from './utils.js' import { filterQueryOptions } from './utils.js' /** @@ -148,7 +152,9 @@ export declare namespace setUserToken { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.fee.setUserToken.Parameters, + OptionalTransactionOverrides< + Actions.fee.setUserToken.Parameters + >, 'chain' > @@ -205,9 +211,11 @@ export declare namespace setUserTokenSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.fee.setUserTokenSync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.fee.setUserTokenSync.Parameters< + config['chains'][number], + Account + > >, 'chain' > diff --git a/packages/core/src/tempo/actions/policy.test-d.ts b/packages/core/src/tempo/actions/policy.test-d.ts new file mode 100644 index 0000000000..32e756f229 --- /dev/null +++ b/packages/core/src/tempo/actions/policy.test-d.ts @@ -0,0 +1,28 @@ +import { createConfig, http } from '@wagmi/core' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { test } from 'vitest' +import * as policy from './policy.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +test('createSync accepts optional transaction overrides', () => { + const chainId = tempo.id + + policy.createSync(config, { + chainId, + feePayer: true, + type: 'whitelist', + }) + + // @ts-expect-error required action parameters stay required + policy.createSync(config, { + chainId, + feePayer: true, + }) +}) diff --git a/packages/core/src/tempo/actions/policy.ts b/packages/core/src/tempo/actions/policy.ts index ad75d51618..7ecfce8ce1 100644 --- a/packages/core/src/tempo/actions/policy.ts +++ b/packages/core/src/tempo/actions/policy.ts @@ -7,7 +7,11 @@ import type { ConnectorParameter, } from '../../types/properties.js' import type { UnionLooseOmit } from '../../types/utils.js' -import type { QueryOptions, QueryParameter } from './utils.js' +import type { + OptionalTransactionOverrides, + QueryOptions, + QueryParameter, +} from './utils.js' /** * Creates a new policy. @@ -54,7 +58,9 @@ export declare namespace create { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.policy.create.Parameters, + OptionalTransactionOverrides< + Actions.policy.create.Parameters + >, 'chain' | 'admin' > @@ -111,7 +117,9 @@ export declare namespace createSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.policy.createSync.Parameters, + OptionalTransactionOverrides< + Actions.policy.createSync.Parameters + >, 'chain' | 'admin' > @@ -166,7 +174,9 @@ export declare namespace setAdmin { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.policy.setAdmin.Parameters, + OptionalTransactionOverrides< + Actions.policy.setAdmin.Parameters + >, 'chain' > @@ -224,7 +234,12 @@ export declare namespace setAdminSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.policy.setAdminSync.Parameters, + OptionalTransactionOverrides< + Actions.policy.setAdminSync.Parameters< + config['chains'][number], + Account + > + >, 'chain' > @@ -280,9 +295,11 @@ export declare namespace modifyWhitelist { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.policy.modifyWhitelist.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.policy.modifyWhitelist.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -342,9 +359,11 @@ export declare namespace modifyWhitelistSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.policy.modifyWhitelistSync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.policy.modifyWhitelistSync.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -401,9 +420,11 @@ export declare namespace modifyBlacklist { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.policy.modifyBlacklist.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.policy.modifyBlacklist.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -463,9 +484,11 @@ export declare namespace modifyBlacklistSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.policy.modifyBlacklistSync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.policy.modifyBlacklistSync.Parameters< + config['chains'][number], + Account + > >, 'chain' > diff --git a/packages/core/src/tempo/actions/reward.test-d.ts b/packages/core/src/tempo/actions/reward.test-d.ts new file mode 100644 index 0000000000..a6c07b73be --- /dev/null +++ b/packages/core/src/tempo/actions/reward.test-d.ts @@ -0,0 +1,29 @@ +import { createConfig, http } from '@wagmi/core' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { test } from 'vitest' +import * as reward from './reward.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) +const token = '0x20c0000000000000000000000000000000000001' + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +test('claimSync accepts optional transaction overrides', () => { + const chainId = tempo.id + + reward.claimSync(config, { + chainId, + feePayer: true, + token, + }) + + // @ts-expect-error required action parameters stay required + reward.claimSync(config, { + chainId, + feePayer: true, + }) +}) diff --git a/packages/core/src/tempo/actions/reward.ts b/packages/core/src/tempo/actions/reward.ts index b87f2e75e3..b5a6a434e6 100644 --- a/packages/core/src/tempo/actions/reward.ts +++ b/packages/core/src/tempo/actions/reward.ts @@ -7,7 +7,11 @@ import type { ConnectorParameter, } from '../../types/properties.js' import type { UnionLooseOmit } from '../../types/utils.js' -import type { QueryOptions, QueryParameter } from './utils.js' +import type { + OptionalTransactionOverrides, + QueryOptions, + QueryParameter, +} from './utils.js' /** * Claims accumulated rewards for a recipient. @@ -55,7 +59,9 @@ export declare namespace claim { ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.reward.claim.Parameters, + OptionalTransactionOverrides< + Actions.reward.claim.Parameters + >, 'chain' > @@ -110,7 +116,9 @@ export declare namespace claimSync { ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.reward.claimSync.Parameters, + OptionalTransactionOverrides< + Actions.reward.claimSync.Parameters + >, 'chain' > @@ -351,9 +359,11 @@ export declare namespace setRecipient { ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.reward.setRecipient.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.reward.setRecipient.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -410,9 +420,11 @@ export declare namespace setRecipientSync { ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.reward.setRecipientSync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.reward.setRecipientSync.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -470,7 +482,12 @@ export declare namespace distribute { ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.reward.distribute.Parameters, + OptionalTransactionOverrides< + Actions.reward.distribute.Parameters< + config['chains'][number], + Account + > + >, 'chain' > @@ -527,9 +544,11 @@ export declare namespace distributeSync { ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.reward.distributeSync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.reward.distributeSync.Parameters< + config['chains'][number], + Account + > >, 'chain' > diff --git a/packages/core/src/tempo/actions/token.test-d.ts b/packages/core/src/tempo/actions/token.test-d.ts new file mode 100644 index 0000000000..7384ca9fbc --- /dev/null +++ b/packages/core/src/tempo/actions/token.test-d.ts @@ -0,0 +1,34 @@ +import { createConfig, http } from '@wagmi/core' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { test } from 'vitest' +import * as token from './token.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) +const tokenAddress = '0x20c0000000000000000000000000000000000001' +const to = '0xd2135CfB216b74109775236E36d4b433F1DF507B' + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +test('transferSync accepts optional transaction overrides', () => { + const chainId = tempo.id + + token.transferSync(config, { + amount: 1_000_000n, + chainId, + feePayer: true, + to, + token: tokenAddress, + }) + + // @ts-expect-error required action parameters stay required + token.transferSync(config, { + chainId, + feePayer: true, + to, + token: tokenAddress, + }) +}) diff --git a/packages/core/src/tempo/actions/token.ts b/packages/core/src/tempo/actions/token.ts index ac09631898..65e6bef510 100644 --- a/packages/core/src/tempo/actions/token.ts +++ b/packages/core/src/tempo/actions/token.ts @@ -7,7 +7,11 @@ import type { ConnectorParameter, } from '../../types/properties.js' import type { UnionLooseOmit } from '../../types/utils.js' -import type { QueryOptions, QueryParameter } from './utils.js' +import type { + OptionalTransactionOverrides, + QueryOptions, + QueryParameter, +} from './utils.js' /** * Approves a spender to transfer TIP20 tokens on behalf of the caller. @@ -53,7 +57,9 @@ export declare namespace approve { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.approve.Parameters, + OptionalTransactionOverrides< + Actions.token.approve.Parameters + >, 'chain' > @@ -109,7 +115,9 @@ export declare namespace approveSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.approveSync.Parameters, + OptionalTransactionOverrides< + Actions.token.approveSync.Parameters + >, 'chain' > @@ -162,7 +170,9 @@ export declare namespace burn { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.burn.Parameters, + OptionalTransactionOverrides< + Actions.token.burn.Parameters + >, 'chain' > @@ -216,7 +226,9 @@ export declare namespace burnBlocked { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.burnBlocked.Parameters, + OptionalTransactionOverrides< + Actions.token.burnBlocked.Parameters + >, 'chain' > @@ -273,9 +285,11 @@ export declare namespace burnBlockedSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.burnBlockedSync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.token.burnBlockedSync.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -332,7 +346,9 @@ export declare namespace burnSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.burnSync.Parameters, + OptionalTransactionOverrides< + Actions.token.burnSync.Parameters + >, 'chain' > @@ -385,9 +401,11 @@ export declare namespace changeTransferPolicy { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.changeTransferPolicy.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.token.changeTransferPolicy.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -444,9 +462,11 @@ export declare namespace changeTransferPolicySync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.changeTransferPolicySync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.token.changeTransferPolicySync.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -501,7 +521,9 @@ export declare namespace create { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.create.Parameters, + OptionalTransactionOverrides< + Actions.token.create.Parameters + >, 'chain' > @@ -558,7 +580,9 @@ export declare namespace createSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.createSync.Parameters, + OptionalTransactionOverrides< + Actions.token.createSync.Parameters + >, 'chain' > @@ -610,9 +634,11 @@ export declare namespace updateQuoteToken { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.updateQuoteToken.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.token.updateQuoteToken.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -668,9 +694,11 @@ export declare namespace updateQuoteTokenSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.updateQuoteTokenSync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.token.updateQuoteTokenSync.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -1097,7 +1125,9 @@ export declare namespace grantRoles { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.grantRoles.Parameters, + OptionalTransactionOverrides< + Actions.token.grantRoles.Parameters + >, 'chain' > @@ -1154,9 +1184,11 @@ export declare namespace grantRolesSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.grantRolesSync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.token.grantRolesSync.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -1307,7 +1339,9 @@ export declare namespace mint { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.mint.Parameters, + OptionalTransactionOverrides< + Actions.token.mint.Parameters + >, 'chain' > @@ -1364,7 +1398,9 @@ export declare namespace mintSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.mintSync.Parameters, + OptionalTransactionOverrides< + Actions.token.mintSync.Parameters + >, 'chain' > @@ -1416,7 +1452,9 @@ export declare namespace pause { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.pause.Parameters, + OptionalTransactionOverrides< + Actions.token.pause.Parameters + >, 'chain' > @@ -1471,7 +1509,9 @@ export declare namespace pauseSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.pauseSync.Parameters, + OptionalTransactionOverrides< + Actions.token.pauseSync.Parameters + >, 'chain' > @@ -1524,7 +1564,12 @@ export declare namespace renounceRoles { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.renounceRoles.Parameters, + OptionalTransactionOverrides< + Actions.token.renounceRoles.Parameters< + config['chains'][number], + Account + > + >, 'chain' > @@ -1580,9 +1625,11 @@ export declare namespace renounceRolesSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.renounceRolesSync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.token.renounceRolesSync.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -1637,7 +1684,9 @@ export declare namespace revokeRoles { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.revokeRoles.Parameters, + OptionalTransactionOverrides< + Actions.token.revokeRoles.Parameters + >, 'chain' > @@ -1694,9 +1743,11 @@ export declare namespace revokeRolesSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.revokeRolesSync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.token.revokeRolesSync.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -1751,7 +1802,9 @@ export declare namespace setRoleAdmin { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.setRoleAdmin.Parameters, + OptionalTransactionOverrides< + Actions.token.setRoleAdmin.Parameters + >, 'chain' > @@ -1808,9 +1861,11 @@ export declare namespace setRoleAdminSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.setRoleAdminSync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.token.setRoleAdminSync.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -1864,7 +1919,9 @@ export declare namespace setSupplyCap { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.setSupplyCap.Parameters, + OptionalTransactionOverrides< + Actions.token.setSupplyCap.Parameters + >, 'chain' > @@ -1920,9 +1977,11 @@ export declare namespace setSupplyCapSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.setSupplyCapSync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.token.setSupplyCapSync.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -1976,7 +2035,9 @@ export declare namespace transfer { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.transfer.Parameters, + OptionalTransactionOverrides< + Actions.token.transfer.Parameters + >, 'chain' > @@ -2032,7 +2093,9 @@ export declare namespace transferSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.transferSync.Parameters, + OptionalTransactionOverrides< + Actions.token.transferSync.Parameters + >, 'chain' > @@ -2084,7 +2147,9 @@ export declare namespace unpause { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.unpause.Parameters, + OptionalTransactionOverrides< + Actions.token.unpause.Parameters + >, 'chain' > @@ -2139,7 +2204,9 @@ export declare namespace unpauseSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.unpauseSync.Parameters, + OptionalTransactionOverrides< + Actions.token.unpauseSync.Parameters + >, 'chain' > @@ -2192,9 +2259,11 @@ export declare namespace prepareUpdateQuoteToken { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.prepareUpdateQuoteToken.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.token.prepareUpdateQuoteToken.Parameters< + config['chains'][number], + Account + > >, 'chain' > @@ -2251,9 +2320,11 @@ export declare namespace prepareUpdateQuoteTokenSync { export type Parameters = ChainIdParameter & ConnectorParameter & UnionLooseOmit< - Actions.token.prepareUpdateQuoteTokenSync.Parameters< - config['chains'][number], - Account + OptionalTransactionOverrides< + Actions.token.prepareUpdateQuoteTokenSync.Parameters< + config['chains'][number], + Account + > >, 'chain' > diff --git a/packages/core/src/tempo/actions/utils.test-d.ts b/packages/core/src/tempo/actions/utils.test-d.ts new file mode 100644 index 0000000000..2618facd3e --- /dev/null +++ b/packages/core/src/tempo/actions/utils.test-d.ts @@ -0,0 +1,51 @@ +import { expectTypeOf, test } from 'vitest' +import type { OptionalTransactionOverrides } from './utils.js' + +test('OptionalTransactionOverrides', () => { + type Parameters = OptionalTransactionOverrides<{ + account: `0x${string}` + amount: bigint + gas: bigint + maxFeePerGas: bigint + maxPriorityFeePerGas: bigint + nonce: number + to: `0x${string}` + }> + + expectTypeOf().toExtend<{ + account?: `0x${string}` | undefined + amount: bigint + gas?: bigint | undefined + maxFeePerGas?: bigint | undefined + maxPriorityFeePerGas?: bigint | undefined + nonce?: number | undefined + to: `0x${string}` + }>() + + void ({ + account: '0xd2135CfB216b74109775236E36d4b433F1DF507B', + amount: 1_000_000n, + gas: 21_000n, + maxFeePerGas: 1_000_000n, + maxPriorityFeePerGas: 1_000_000n, + nonce: 1, + to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', + } satisfies Parameters) + + void ({ + amount: 1_000_000n, + to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', + } satisfies Parameters) + + void ({ + to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', + // @ts-expect-error required non-override parameters stay required + } satisfies Parameters) + + void ({ + amount: 1_000_000n, + // @ts-expect-error excess parameters stay rejected + extra: true, + to: '0xd2135CfB216b74109775236E36d4b433F1DF507B', + } satisfies Parameters) +}) diff --git a/packages/core/src/tempo/actions/utils.ts b/packages/core/src/tempo/actions/utils.ts index 813274785e..ccb5cd2f0d 100644 --- a/packages/core/src/tempo/actions/utils.ts +++ b/packages/core/src/tempo/actions/utils.ts @@ -1,5 +1,22 @@ import type * as Query from '@tanstack/query-core' -import type { RequiredBy, UnionLooseOmit } from '../../types/utils.js' +import type { + PartialBy, + RequiredBy, + UnionLooseOmit, +} from '../../types/utils.js' + +export type OptionalTransactionOverrides = parameters extends object + ? PartialBy< + parameters, + Extract + > + : parameters +type TransactionOverrideParameter = + | 'account' + | 'gas' + | 'maxFeePerGas' + | 'maxPriorityFeePerGas' + | 'nonce' export type QueryParameter< queryFnData = unknown, diff --git a/packages/core/src/tempo/actions/zone.test-d.ts b/packages/core/src/tempo/actions/zone.test-d.ts index f81a26fa91..fffe694bf2 100644 --- a/packages/core/src/tempo/actions/zone.test-d.ts +++ b/packages/core/src/tempo/actions/zone.test-d.ts @@ -26,7 +26,7 @@ test('deposit parameters', () => { zoneId: 7, }) - expectTypeOf>().toMatchTypeOf<{ + expectTypeOf>().toExtend<{ account?: unknown amount: bigint chainId?: number | undefined @@ -43,9 +43,7 @@ test('depositSync parameters', () => { zoneId: 7, }) - expectTypeOf< - zoneActions.depositSync.Parameters - >().toMatchTypeOf<{ + expectTypeOf>().toExtend<{ account?: unknown amount: bigint chainId?: number | undefined @@ -64,7 +62,7 @@ test('encryptedDeposit parameters', () => { expectTypeOf< zoneActions.encryptedDeposit.Parameters - >().toMatchTypeOf<{ + >().toExtend<{ account?: unknown amount: bigint chainId?: number | undefined @@ -83,7 +81,7 @@ test('encryptedDepositSync parameters', () => { expectTypeOf< zoneActions.encryptedDepositSync.Parameters - >().toMatchTypeOf<{ + >().toExtend<{ account?: unknown amount: bigint chainId?: number | undefined @@ -101,7 +99,7 @@ test('requestWithdrawal parameters', () => { expectTypeOf< zoneActions.requestWithdrawal.Parameters - >().toMatchTypeOf<{ + >().toExtend<{ account?: unknown amount: bigint chainId?: number | undefined @@ -118,7 +116,7 @@ test('requestWithdrawalSync parameters', () => { expectTypeOf< zoneActions.requestWithdrawalSync.Parameters - >().toMatchTypeOf<{ + >().toExtend<{ account?: unknown amount: bigint chainId?: number | undefined @@ -136,7 +134,7 @@ test('requestVerifiableWithdrawal parameters', () => { expectTypeOf< zoneActions.requestVerifiableWithdrawal.Parameters - >().toMatchTypeOf<{ + >().toExtend<{ account?: unknown amount: bigint chainId?: number | undefined @@ -155,7 +153,7 @@ test('requestVerifiableWithdrawalSync parameters', () => { expectTypeOf< zoneActions.requestVerifiableWithdrawalSync.Parameters - >().toMatchTypeOf<{ + >().toExtend<{ account?: unknown amount: bigint chainId?: number | undefined diff --git a/packages/core/src/tempo/actions/zone.ts b/packages/core/src/tempo/actions/zone.ts index 293a95e149..dfe87bd4b2 100644 --- a/packages/core/src/tempo/actions/zone.ts +++ b/packages/core/src/tempo/actions/zone.ts @@ -21,23 +21,13 @@ import type { ConnectorParameter, } from '../../types/properties.js' import type { PartialBy, UnionLooseOmit } from '../../types/utils.js' -import type { QueryOptions, QueryParameter } from './utils.js' +import type { + OptionalTransactionOverrides, + QueryOptions, + QueryParameter, +} from './utils.js' import { filterQueryOptions } from './utils.js' -type TransactionOverrideParameter = - | 'account' - | 'gas' - | 'maxFeePerGas' - | 'maxPriorityFeePerGas' - | 'nonce' - -type OptionalTransactionOverrides = parameters extends object - ? PartialBy< - parameters, - Extract - > - : parameters - /** * Gets information about the currently stored zone authorization token. * diff --git a/packages/react/src/tempo/hooks/amm.test-d.ts b/packages/react/src/tempo/hooks/amm.test-d.ts new file mode 100644 index 0000000000..c5f411e03f --- /dev/null +++ b/packages/react/src/tempo/hooks/amm.test-d.ts @@ -0,0 +1,562 @@ +import { createConfig, http } from '@wagmi/core' +import type { Actions } from '@wagmi/core/tempo' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { expectTypeOf, test } from 'vitest' +import * as amm from './amm.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) +const contextValue = { foo: 'bar' } as const +const selected = 'selected' as const + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +type Context = typeof contextValue + +test('usePool', () => { + const result = amm.usePool({ + config, + query: { + select(data) { + expectTypeOf(data).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useLiquidityBalance', () => { + const result = amm.useLiquidityBalance({ + config, + query: { + select(data) { + expectTypeOf( + data, + ).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useRebalanceSwap', () => { + const variables = {} as Actions.amm.rebalanceSwap.Parameters + + const rebalanceSwap = amm.useRebalanceSwap({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.amm.rebalanceSwap.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.rebalanceSwap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.rebalanceSwap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.amm.rebalanceSwap.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.rebalanceSwap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(rebalanceSwap.data).toEqualTypeOf< + Actions.amm.rebalanceSwap.ReturnValue | undefined + >() + expectTypeOf( + rebalanceSwap.error, + ).toEqualTypeOf() + expectTypeOf(rebalanceSwap.variables).toEqualTypeOf< + Actions.amm.rebalanceSwap.Parameters | undefined + >() + expectTypeOf(rebalanceSwap.context).toEqualTypeOf() + + rebalanceSwap.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.rebalanceSwap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.rebalanceSwap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.amm.rebalanceSwap.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.rebalanceSwap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.amm.rebalanceSwapSync.Parameters< + typeof config + > + + const rebalanceSwapSync = amm.useRebalanceSwapSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.amm.rebalanceSwapSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.rebalanceSwapSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.rebalanceSwapSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.amm.rebalanceSwapSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.rebalanceSwapSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(rebalanceSwapSync.data).toEqualTypeOf< + Actions.amm.rebalanceSwapSync.ReturnValue | undefined + >() + expectTypeOf( + rebalanceSwapSync.error, + ).toEqualTypeOf() + expectTypeOf(rebalanceSwapSync.variables).toEqualTypeOf< + Actions.amm.rebalanceSwapSync.Parameters | undefined + >() + expectTypeOf(rebalanceSwapSync.context).toEqualTypeOf() + + rebalanceSwapSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.rebalanceSwapSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.rebalanceSwapSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.amm.rebalanceSwapSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.rebalanceSwapSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useMint', () => { + const variables = {} as Actions.amm.mint.Parameters + + const mint = amm.useMint({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.amm.mint.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.mint.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.mint.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.amm.mint.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.mint.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(mint.data).toEqualTypeOf< + Actions.amm.mint.ReturnValue | undefined + >() + expectTypeOf(mint.error).toEqualTypeOf() + expectTypeOf(mint.variables).toEqualTypeOf< + Actions.amm.mint.Parameters | undefined + >() + expectTypeOf(mint.context).toEqualTypeOf() + + mint.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.mint.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.mint.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.amm.mint.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.mint.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.amm.mintSync.Parameters + + const mintSync = amm.useMintSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.amm.mintSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.mintSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.mintSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.amm.mintSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.mintSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(mintSync.data).toEqualTypeOf< + Actions.amm.mintSync.ReturnValue | undefined + >() + expectTypeOf( + mintSync.error, + ).toEqualTypeOf() + expectTypeOf(mintSync.variables).toEqualTypeOf< + Actions.amm.mintSync.Parameters | undefined + >() + expectTypeOf(mintSync.context).toEqualTypeOf() + + mintSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.mintSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.mintSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.amm.mintSync.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.mintSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useBurn', () => { + const variables = {} as Actions.amm.burn.Parameters + + const burn = amm.useBurn({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.amm.burn.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.burn.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.burn.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.amm.burn.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.burn.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(burn.data).toEqualTypeOf< + Actions.amm.burn.ReturnValue | undefined + >() + expectTypeOf(burn.error).toEqualTypeOf() + expectTypeOf(burn.variables).toEqualTypeOf< + Actions.amm.burn.Parameters | undefined + >() + expectTypeOf(burn.context).toEqualTypeOf() + + burn.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.burn.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.burn.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.amm.burn.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.burn.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.amm.burnSync.Parameters + + const burnSync = amm.useBurnSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.amm.burnSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.burnSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.burnSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.amm.burnSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.burnSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(burnSync.data).toEqualTypeOf< + Actions.amm.burnSync.ReturnValue | undefined + >() + expectTypeOf( + burnSync.error, + ).toEqualTypeOf() + expectTypeOf(burnSync.variables).toEqualTypeOf< + Actions.amm.burnSync.Parameters | undefined + >() + expectTypeOf(burnSync.context).toEqualTypeOf() + + burnSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.burnSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.burnSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.amm.burnSync.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.amm.burnSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useWatchRebalanceSwap', () => { + amm.useWatchRebalanceSwap({ + config, + enabled: true, + onRebalanceSwap(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchMint', () => { + amm.useWatchMint({ + config, + enabled: true, + onMint(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchBurn', () => { + amm.useWatchBurn({ + config, + enabled: true, + onBurn(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) diff --git a/packages/react/src/tempo/hooks/dex.test-d.ts b/packages/react/src/tempo/hooks/dex.test-d.ts new file mode 100644 index 0000000000..e66c909147 --- /dev/null +++ b/packages/react/src/tempo/hooks/dex.test-d.ts @@ -0,0 +1,1431 @@ +import { createConfig, http } from '@wagmi/core' +import type { Actions } from '@wagmi/core/tempo' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { expectTypeOf, test } from 'vitest' +import * as dex from './dex.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) +const contextValue = { foo: 'bar' } as const +const selected = 'selected' as const + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +type Context = typeof contextValue + +test('useBalance', () => { + const result = dex.useBalance({ + config, + query: { + select(data) { + expectTypeOf(data).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useBuyQuote', () => { + const result = dex.useBuyQuote({ + config, + query: { + select(data) { + expectTypeOf(data).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useOrder', () => { + const result = dex.useOrder({ + config, + query: { + select(data) { + expectTypeOf(data).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useOrderbook', () => { + const result = dex.useOrderbook({ + config, + query: { + select(data) { + expectTypeOf(data).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useTickLevel', () => { + const result = dex.useTickLevel({ + config, + query: { + select(data) { + expectTypeOf(data).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useSellQuote', () => { + const result = dex.useSellQuote({ + config, + query: { + select(data) { + expectTypeOf(data).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useBuy', () => { + const variables = {} as Actions.dex.buy.Parameters + + const buy = dex.useBuy({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.buy.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.buy.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.buy.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.buy.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.buy.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(buy.data).toEqualTypeOf< + Actions.dex.buy.ReturnValue | undefined + >() + expectTypeOf(buy.error).toEqualTypeOf() + expectTypeOf(buy.variables).toEqualTypeOf< + Actions.dex.buy.Parameters | undefined + >() + expectTypeOf(buy.context).toEqualTypeOf() + + buy.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.buy.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.buy.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.buy.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.buy.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.dex.buySync.Parameters + + const buySync = dex.useBuySync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.buySync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.buySync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.buySync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.buySync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.buySync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(buySync.data).toEqualTypeOf< + Actions.dex.buySync.ReturnValue | undefined + >() + expectTypeOf( + buySync.error, + ).toEqualTypeOf() + expectTypeOf(buySync.variables).toEqualTypeOf< + Actions.dex.buySync.Parameters | undefined + >() + expectTypeOf(buySync.context).toEqualTypeOf() + + buySync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.buySync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.buySync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.buySync.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.buySync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useCancel', () => { + const variables = {} as Actions.dex.cancel.Parameters + + const cancel = dex.useCancel({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.cancel.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancel.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancel.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.cancel.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancel.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(cancel.data).toEqualTypeOf< + Actions.dex.cancel.ReturnValue | undefined + >() + expectTypeOf( + cancel.error, + ).toEqualTypeOf() + expectTypeOf(cancel.variables).toEqualTypeOf< + Actions.dex.cancel.Parameters | undefined + >() + expectTypeOf(cancel.context).toEqualTypeOf() + + cancel.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancel.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancel.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.cancel.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancel.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.dex.cancelSync.Parameters + + const cancelSync = dex.useCancelSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.cancelSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.cancelSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(cancelSync.data).toEqualTypeOf< + Actions.dex.cancelSync.ReturnValue | undefined + >() + expectTypeOf( + cancelSync.error, + ).toEqualTypeOf() + expectTypeOf(cancelSync.variables).toEqualTypeOf< + Actions.dex.cancelSync.Parameters | undefined + >() + expectTypeOf(cancelSync.context).toEqualTypeOf() + + cancelSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.cancelSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useCancelStale', () => { + const variables = {} as Actions.dex.cancelStale.Parameters + + const cancelStale = dex.useCancelStale({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.cancelStale.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelStale.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelStale.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.cancelStale.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelStale.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(cancelStale.data).toEqualTypeOf< + Actions.dex.cancelStale.ReturnValue | undefined + >() + expectTypeOf( + cancelStale.error, + ).toEqualTypeOf() + expectTypeOf(cancelStale.variables).toEqualTypeOf< + Actions.dex.cancelStale.Parameters | undefined + >() + expectTypeOf(cancelStale.context).toEqualTypeOf() + + cancelStale.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelStale.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelStale.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.cancelStale.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelStale.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.dex.cancelStaleSync.Parameters< + typeof config + > + + const cancelStaleSync = dex.useCancelStaleSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.cancelStaleSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelStaleSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelStaleSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.cancelStaleSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelStaleSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(cancelStaleSync.data).toEqualTypeOf< + Actions.dex.cancelStaleSync.ReturnValue | undefined + >() + expectTypeOf( + cancelStaleSync.error, + ).toEqualTypeOf() + expectTypeOf(cancelStaleSync.variables).toEqualTypeOf< + Actions.dex.cancelStaleSync.Parameters | undefined + >() + expectTypeOf(cancelStaleSync.context).toEqualTypeOf() + + cancelStaleSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelStaleSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelStaleSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.cancelStaleSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.cancelStaleSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useCreatePair', () => { + const variables = {} as Actions.dex.createPair.Parameters + + const createPair = dex.useCreatePair({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.createPair.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.createPair.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.createPair.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.createPair.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.createPair.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(createPair.data).toEqualTypeOf< + Actions.dex.createPair.ReturnValue | undefined + >() + expectTypeOf( + createPair.error, + ).toEqualTypeOf() + expectTypeOf(createPair.variables).toEqualTypeOf< + Actions.dex.createPair.Parameters | undefined + >() + expectTypeOf(createPair.context).toEqualTypeOf() + + createPair.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.createPair.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.createPair.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.createPair.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.createPair.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.dex.createPairSync.Parameters< + typeof config + > + + const createPairSync = dex.useCreatePairSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.createPairSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.createPairSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.createPairSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.createPairSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.createPairSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(createPairSync.data).toEqualTypeOf< + Actions.dex.createPairSync.ReturnValue | undefined + >() + expectTypeOf( + createPairSync.error, + ).toEqualTypeOf() + expectTypeOf(createPairSync.variables).toEqualTypeOf< + Actions.dex.createPairSync.Parameters | undefined + >() + expectTypeOf(createPairSync.context).toEqualTypeOf() + + createPairSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.createPairSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.createPairSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.createPairSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.createPairSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('usePlace', () => { + const variables = {} as Actions.dex.place.Parameters + + const place = dex.usePlace({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.place.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.place.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.place.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.place.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.place.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(place.data).toEqualTypeOf< + Actions.dex.place.ReturnValue | undefined + >() + expectTypeOf(place.error).toEqualTypeOf() + expectTypeOf(place.variables).toEqualTypeOf< + Actions.dex.place.Parameters | undefined + >() + expectTypeOf(place.context).toEqualTypeOf() + + place.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.place.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.place.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.place.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.place.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.dex.placeSync.Parameters + + const placeSync = dex.usePlaceSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.placeSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.placeSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(placeSync.data).toEqualTypeOf< + Actions.dex.placeSync.ReturnValue | undefined + >() + expectTypeOf( + placeSync.error, + ).toEqualTypeOf() + expectTypeOf(placeSync.variables).toEqualTypeOf< + Actions.dex.placeSync.Parameters | undefined + >() + expectTypeOf(placeSync.context).toEqualTypeOf() + + placeSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.placeSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('usePlaceFlip', () => { + const variables = {} as Actions.dex.placeFlip.Parameters + + const placeFlip = dex.usePlaceFlip({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.placeFlip.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeFlip.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeFlip.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.placeFlip.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeFlip.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(placeFlip.data).toEqualTypeOf< + Actions.dex.placeFlip.ReturnValue | undefined + >() + expectTypeOf( + placeFlip.error, + ).toEqualTypeOf() + expectTypeOf(placeFlip.variables).toEqualTypeOf< + Actions.dex.placeFlip.Parameters | undefined + >() + expectTypeOf(placeFlip.context).toEqualTypeOf() + + placeFlip.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeFlip.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeFlip.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.placeFlip.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeFlip.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.dex.placeFlipSync.Parameters< + typeof config + > + + const placeFlipSync = dex.usePlaceFlipSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.placeFlipSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeFlipSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeFlipSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.placeFlipSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeFlipSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(placeFlipSync.data).toEqualTypeOf< + Actions.dex.placeFlipSync.ReturnValue | undefined + >() + expectTypeOf( + placeFlipSync.error, + ).toEqualTypeOf() + expectTypeOf(placeFlipSync.variables).toEqualTypeOf< + Actions.dex.placeFlipSync.Parameters | undefined + >() + expectTypeOf(placeFlipSync.context).toEqualTypeOf() + + placeFlipSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeFlipSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeFlipSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.placeFlipSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.placeFlipSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useSell', () => { + const variables = {} as Actions.dex.sell.Parameters + + const sell = dex.useSell({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.sell.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.sell.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.sell.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.sell.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.sell.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(sell.data).toEqualTypeOf< + Actions.dex.sell.ReturnValue | undefined + >() + expectTypeOf(sell.error).toEqualTypeOf() + expectTypeOf(sell.variables).toEqualTypeOf< + Actions.dex.sell.Parameters | undefined + >() + expectTypeOf(sell.context).toEqualTypeOf() + + sell.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.sell.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.sell.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.sell.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.sell.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.dex.sellSync.Parameters + + const sellSync = dex.useSellSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.sellSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.sellSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.sellSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.sellSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.sellSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(sellSync.data).toEqualTypeOf< + Actions.dex.sellSync.ReturnValue | undefined + >() + expectTypeOf( + sellSync.error, + ).toEqualTypeOf() + expectTypeOf(sellSync.variables).toEqualTypeOf< + Actions.dex.sellSync.Parameters | undefined + >() + expectTypeOf(sellSync.context).toEqualTypeOf() + + sellSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.sellSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.sellSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.sellSync.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.sellSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useWithdraw', () => { + const variables = {} as Actions.dex.withdraw.Parameters + + const withdraw = dex.useWithdraw({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.withdraw.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.withdraw.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.withdraw.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.withdraw.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.withdraw.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(withdraw.data).toEqualTypeOf< + Actions.dex.withdraw.ReturnValue | undefined + >() + expectTypeOf( + withdraw.error, + ).toEqualTypeOf() + expectTypeOf(withdraw.variables).toEqualTypeOf< + Actions.dex.withdraw.Parameters | undefined + >() + expectTypeOf(withdraw.context).toEqualTypeOf() + + withdraw.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.withdraw.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.withdraw.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.withdraw.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.withdraw.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.dex.withdrawSync.Parameters + + const withdrawSync = dex.useWithdrawSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.dex.withdrawSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.withdrawSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.withdrawSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.withdrawSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.withdrawSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(withdrawSync.data).toEqualTypeOf< + Actions.dex.withdrawSync.ReturnValue | undefined + >() + expectTypeOf( + withdrawSync.error, + ).toEqualTypeOf() + expectTypeOf(withdrawSync.variables).toEqualTypeOf< + Actions.dex.withdrawSync.Parameters | undefined + >() + expectTypeOf(withdrawSync.context).toEqualTypeOf() + + withdrawSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.withdrawSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.withdrawSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.dex.withdrawSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.dex.withdrawSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useWatchFlipOrderPlaced', () => { + dex.useWatchFlipOrderPlaced({ + config, + enabled: true, + onFlipOrderPlaced(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchOrderCancelled', () => { + dex.useWatchOrderCancelled({ + config, + enabled: true, + onOrderCancelled(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchOrderFilled', () => { + dex.useWatchOrderFilled({ + config, + enabled: true, + onOrderFilled(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchOrderPlaced', () => { + dex.useWatchOrderPlaced({ + config, + enabled: true, + onOrderPlaced(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) diff --git a/packages/react/src/tempo/hooks/faucet.test-d.ts b/packages/react/src/tempo/hooks/faucet.test-d.ts new file mode 100644 index 0000000000..d561923197 --- /dev/null +++ b/packages/react/src/tempo/hooks/faucet.test-d.ts @@ -0,0 +1,174 @@ +import { createConfig, http } from '@wagmi/core' +import type { Actions } from '@wagmi/core/tempo' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { expectTypeOf, test } from 'vitest' +import * as faucet from './faucet.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) +const contextValue = { foo: 'bar' } as const + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +type Context = typeof contextValue + +test('useFund', () => { + const variables = {} as Actions.faucet.fund.Parameters + + const fund = faucet.useFund({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toEqualTypeOf< + Actions.faucet.fund.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.faucet.fund.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.faucet.fund.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.faucet.fund.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.faucet.fund.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(fund.data).toEqualTypeOf< + Actions.faucet.fund.ReturnValue | undefined + >() + expectTypeOf(fund.error).toEqualTypeOf() + expectTypeOf(fund.variables).toEqualTypeOf< + Actions.faucet.fund.Parameters | undefined + >() + expectTypeOf(fund.context).toEqualTypeOf() + + fund.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.faucet.fund.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.faucet.fund.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.faucet.fund.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.faucet.fund.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.faucet.fundSync.Parameters + + const fundSync = faucet.useFundSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toEqualTypeOf< + Actions.faucet.fundSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.faucet.fundSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.faucet.fundSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.faucet.fundSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.faucet.fundSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(fundSync.data).toEqualTypeOf< + Actions.faucet.fundSync.ReturnValue | undefined + >() + expectTypeOf( + fundSync.error, + ).toEqualTypeOf() + expectTypeOf(fundSync.variables).toEqualTypeOf< + Actions.faucet.fundSync.Parameters | undefined + >() + expectTypeOf(fundSync.context).toEqualTypeOf() + + fundSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.faucet.fundSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.faucet.fundSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.faucet.fundSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.faucet.fundSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) diff --git a/packages/react/src/tempo/hooks/fee.test-d.ts b/packages/react/src/tempo/hooks/fee.test-d.ts new file mode 100644 index 0000000000..b23512d65c --- /dev/null +++ b/packages/react/src/tempo/hooks/fee.test-d.ts @@ -0,0 +1,214 @@ +import { createConfig, http } from '@wagmi/core' +import type { Actions } from '@wagmi/core/tempo' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { expectTypeOf, test } from 'vitest' +import * as fee from './fee.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) +const contextValue = { foo: 'bar' } as const +const selected = 'selected' as const + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +type Context = typeof contextValue + +test('useUserToken', () => { + const result = fee.useUserToken({ + config, + query: { + select(data) { + expectTypeOf(data).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useSetUserToken', () => { + const variables = {} as Actions.fee.setUserToken.Parameters + + const setUserToken = fee.useSetUserToken({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.fee.setUserToken.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.fee.setUserToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.fee.setUserToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.fee.setUserToken.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.fee.setUserToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(setUserToken.data).toEqualTypeOf< + Actions.fee.setUserToken.ReturnValue | undefined + >() + expectTypeOf( + setUserToken.error, + ).toEqualTypeOf() + expectTypeOf(setUserToken.variables).toEqualTypeOf< + Actions.fee.setUserToken.Parameters | undefined + >() + expectTypeOf(setUserToken.context).toEqualTypeOf() + + setUserToken.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.fee.setUserToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.fee.setUserToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.fee.setUserToken.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.fee.setUserToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.fee.setUserTokenSync.Parameters< + typeof config + > + + const setUserTokenSync = fee.useSetUserTokenSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.fee.setUserTokenSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.fee.setUserTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.fee.setUserTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.fee.setUserTokenSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.fee.setUserTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(setUserTokenSync.data).toEqualTypeOf< + Actions.fee.setUserTokenSync.ReturnValue | undefined + >() + expectTypeOf( + setUserTokenSync.error, + ).toEqualTypeOf() + expectTypeOf(setUserTokenSync.variables).toEqualTypeOf< + Actions.fee.setUserTokenSync.Parameters | undefined + >() + expectTypeOf(setUserTokenSync.context).toEqualTypeOf() + + setUserTokenSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.fee.setUserTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.fee.setUserTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.fee.setUserTokenSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.fee.setUserTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useWatchSetUserToken', () => { + fee.useWatchSetUserToken({ + config, + enabled: true, + onUserTokenSet(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) diff --git a/packages/react/src/tempo/hooks/nonce.test-d.ts b/packages/react/src/tempo/hooks/nonce.test-d.ts new file mode 100644 index 0000000000..81c2e1d33a --- /dev/null +++ b/packages/react/src/tempo/hooks/nonce.test-d.ts @@ -0,0 +1,28 @@ +import { createConfig, http } from '@wagmi/core' +import type { Actions } from '@wagmi/core/tempo' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { expectTypeOf, test } from 'vitest' +import * as nonce from './nonce.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) +const selected = 'selected' as const + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +test('useNonce', () => { + const result = nonce.useNonce({ + config, + query: { + select(data) { + expectTypeOf(data).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) diff --git a/packages/react/src/tempo/hooks/policy.test-d.ts b/packages/react/src/tempo/hooks/policy.test-d.ts new file mode 100644 index 0000000000..9be46da6e1 --- /dev/null +++ b/packages/react/src/tempo/hooks/policy.test-d.ts @@ -0,0 +1,791 @@ +import { createConfig, http } from '@wagmi/core' +import type { Actions } from '@wagmi/core/tempo' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { expectTypeOf, test } from 'vitest' +import * as policy from './policy.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) +const contextValue = { foo: 'bar' } as const +const selected = 'selected' as const + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +type Context = typeof contextValue + +test('useData', () => { + const result = policy.useData({ + config, + query: { + select(data) { + expectTypeOf(data).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useIsAuthorized', () => { + const result = policy.useIsAuthorized({ + config, + query: { + select(data) { + expectTypeOf( + data, + ).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useCreate', () => { + const variables = {} as Actions.policy.create.Parameters + + const create = policy.useCreate({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.policy.create.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.create.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.create.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.create.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.create.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(create.data).toEqualTypeOf< + Actions.policy.create.ReturnValue | undefined + >() + expectTypeOf( + create.error, + ).toEqualTypeOf() + expectTypeOf(create.variables).toEqualTypeOf< + Actions.policy.create.Parameters | undefined + >() + expectTypeOf(create.context).toEqualTypeOf() + + create.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.create.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.create.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.create.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.create.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.policy.createSync.Parameters< + typeof config + > + + const createSync = policy.useCreateSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.policy.createSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.createSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.createSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.createSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.createSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(createSync.data).toEqualTypeOf< + Actions.policy.createSync.ReturnValue | undefined + >() + expectTypeOf( + createSync.error, + ).toEqualTypeOf() + expectTypeOf(createSync.variables).toEqualTypeOf< + Actions.policy.createSync.Parameters | undefined + >() + expectTypeOf(createSync.context).toEqualTypeOf() + + createSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.createSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.createSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.createSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.createSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useSetAdmin', () => { + const variables = {} as Actions.policy.setAdmin.Parameters + + const setAdmin = policy.useSetAdmin({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.policy.setAdmin.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.setAdmin.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.setAdmin.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.setAdmin.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.setAdmin.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(setAdmin.data).toEqualTypeOf< + Actions.policy.setAdmin.ReturnValue | undefined + >() + expectTypeOf( + setAdmin.error, + ).toEqualTypeOf() + expectTypeOf(setAdmin.variables).toEqualTypeOf< + Actions.policy.setAdmin.Parameters | undefined + >() + expectTypeOf(setAdmin.context).toEqualTypeOf() + + setAdmin.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.setAdmin.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.setAdmin.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.setAdmin.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.setAdmin.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.policy.setAdminSync.Parameters< + typeof config + > + + const setAdminSync = policy.useSetAdminSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.policy.setAdminSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.setAdminSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.setAdminSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.setAdminSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.setAdminSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(setAdminSync.data).toEqualTypeOf< + Actions.policy.setAdminSync.ReturnValue | undefined + >() + expectTypeOf( + setAdminSync.error, + ).toEqualTypeOf() + expectTypeOf(setAdminSync.variables).toEqualTypeOf< + Actions.policy.setAdminSync.Parameters | undefined + >() + expectTypeOf(setAdminSync.context).toEqualTypeOf() + + setAdminSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.setAdminSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.setAdminSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.setAdminSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.setAdminSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useModifyWhitelist', () => { + const variables = {} as Actions.policy.modifyWhitelist.Parameters< + typeof config + > + + const modifyWhitelist = policy.useModifyWhitelist({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.policy.modifyWhitelist.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyWhitelist.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyWhitelist.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.modifyWhitelist.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyWhitelist.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(modifyWhitelist.data).toEqualTypeOf< + Actions.policy.modifyWhitelist.ReturnValue | undefined + >() + expectTypeOf( + modifyWhitelist.error, + ).toEqualTypeOf() + expectTypeOf(modifyWhitelist.variables).toEqualTypeOf< + Actions.policy.modifyWhitelist.Parameters | undefined + >() + expectTypeOf(modifyWhitelist.context).toEqualTypeOf() + + modifyWhitelist.mutate(variables, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyWhitelist.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyWhitelist.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.modifyWhitelist.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyWhitelist.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.policy.modifyWhitelistSync.Parameters< + typeof config + > + + const modifyWhitelistSync = policy.useModifyWhitelistSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.policy.modifyWhitelistSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyWhitelistSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyWhitelistSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.modifyWhitelistSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyWhitelistSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(modifyWhitelistSync.data).toEqualTypeOf< + Actions.policy.modifyWhitelistSync.ReturnValue | undefined + >() + expectTypeOf( + modifyWhitelistSync.error, + ).toEqualTypeOf() + expectTypeOf(modifyWhitelistSync.variables).toEqualTypeOf< + Actions.policy.modifyWhitelistSync.Parameters | undefined + >() + expectTypeOf(modifyWhitelistSync.context).toEqualTypeOf() + + modifyWhitelistSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyWhitelistSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyWhitelistSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.modifyWhitelistSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyWhitelistSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useModifyBlacklist', () => { + const variables = {} as Actions.policy.modifyBlacklist.Parameters< + typeof config + > + + const modifyBlacklist = policy.useModifyBlacklist({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.policy.modifyBlacklist.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyBlacklist.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyBlacklist.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.modifyBlacklist.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyBlacklist.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(modifyBlacklist.data).toEqualTypeOf< + Actions.policy.modifyBlacklist.ReturnValue | undefined + >() + expectTypeOf( + modifyBlacklist.error, + ).toEqualTypeOf() + expectTypeOf(modifyBlacklist.variables).toEqualTypeOf< + Actions.policy.modifyBlacklist.Parameters | undefined + >() + expectTypeOf(modifyBlacklist.context).toEqualTypeOf() + + modifyBlacklist.mutate(variables, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyBlacklist.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyBlacklist.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.modifyBlacklist.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyBlacklist.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.policy.modifyBlacklistSync.Parameters< + typeof config + > + + const modifyBlacklistSync = policy.useModifyBlacklistSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.policy.modifyBlacklistSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyBlacklistSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyBlacklistSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.modifyBlacklistSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyBlacklistSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(modifyBlacklistSync.data).toEqualTypeOf< + Actions.policy.modifyBlacklistSync.ReturnValue | undefined + >() + expectTypeOf( + modifyBlacklistSync.error, + ).toEqualTypeOf() + expectTypeOf(modifyBlacklistSync.variables).toEqualTypeOf< + Actions.policy.modifyBlacklistSync.Parameters | undefined + >() + expectTypeOf(modifyBlacklistSync.context).toEqualTypeOf() + + modifyBlacklistSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyBlacklistSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyBlacklistSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.policy.modifyBlacklistSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.policy.modifyBlacklistSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useWatchCreate', () => { + policy.useWatchCreate({ + config, + enabled: true, + onPolicyCreated(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchAdminUpdated', () => { + policy.useWatchAdminUpdated({ + config, + enabled: true, + onAdminUpdated(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchWhitelistUpdated', () => { + policy.useWatchWhitelistUpdated({ + config, + enabled: true, + onWhitelistUpdated(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchBlacklistUpdated', () => { + policy.useWatchBlacklistUpdated({ + config, + enabled: true, + onBlacklistUpdated(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) diff --git a/packages/react/src/tempo/hooks/reward.test-d.ts b/packages/react/src/tempo/hooks/reward.test-d.ts new file mode 100644 index 0000000000..392873b05c --- /dev/null +++ b/packages/react/src/tempo/hooks/reward.test-d.ts @@ -0,0 +1,583 @@ +import { createConfig, http } from '@wagmi/core' +import type { Actions } from '@wagmi/core/tempo' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { expectTypeOf, test } from 'vitest' +import * as reward from './reward.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) +const contextValue = { foo: 'bar' } as const +const selected = 'selected' as const + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +type Context = typeof contextValue + +test('useGetGlobalRewardPerToken', () => { + const result = reward.useGetGlobalRewardPerToken({ + config, + query: { + select(data) { + expectTypeOf( + data, + ).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useUserRewardInfo', () => { + const result = reward.useUserRewardInfo({ + config, + query: { + select(data) { + expectTypeOf( + data, + ).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useClaim', () => { + const variables = {} as Actions.reward.claim.Parameters + + const claim = reward.useClaim({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.reward.claim.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.claim.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.claim.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.reward.claim.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.claim.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(claim.data).toEqualTypeOf< + Actions.reward.claim.ReturnValue | undefined + >() + expectTypeOf( + claim.error, + ).toEqualTypeOf() + expectTypeOf(claim.variables).toEqualTypeOf< + Actions.reward.claim.Parameters | undefined + >() + expectTypeOf(claim.context).toEqualTypeOf() + + claim.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.claim.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.claim.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.reward.claim.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.claim.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.reward.claimSync.Parameters + + const claimSync = reward.useClaimSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.reward.claimSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.claimSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.claimSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.reward.claimSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.claimSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(claimSync.data).toEqualTypeOf< + Actions.reward.claimSync.ReturnValue | undefined + >() + expectTypeOf( + claimSync.error, + ).toEqualTypeOf() + expectTypeOf(claimSync.variables).toEqualTypeOf< + Actions.reward.claimSync.Parameters | undefined + >() + expectTypeOf(claimSync.context).toEqualTypeOf() + + claimSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.claimSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.claimSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.reward.claimSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.claimSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useSetRecipient', () => { + const variables = {} as Actions.reward.setRecipient.Parameters + + const setRecipient = reward.useSetRecipient({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.reward.setRecipient.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.setRecipient.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.setRecipient.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.reward.setRecipient.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.setRecipient.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(setRecipient.data).toEqualTypeOf< + Actions.reward.setRecipient.ReturnValue | undefined + >() + expectTypeOf( + setRecipient.error, + ).toEqualTypeOf() + expectTypeOf(setRecipient.variables).toEqualTypeOf< + Actions.reward.setRecipient.Parameters | undefined + >() + expectTypeOf(setRecipient.context).toEqualTypeOf() + + setRecipient.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.setRecipient.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.setRecipient.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.reward.setRecipient.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.setRecipient.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.reward.setRecipientSync.Parameters< + typeof config + > + + const setRecipientSync = reward.useSetRecipientSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.reward.setRecipientSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.setRecipientSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.setRecipientSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.reward.setRecipientSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.setRecipientSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(setRecipientSync.data).toEqualTypeOf< + Actions.reward.setRecipientSync.ReturnValue | undefined + >() + expectTypeOf( + setRecipientSync.error, + ).toEqualTypeOf() + expectTypeOf(setRecipientSync.variables).toEqualTypeOf< + Actions.reward.setRecipientSync.Parameters | undefined + >() + expectTypeOf(setRecipientSync.context).toEqualTypeOf() + + setRecipientSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.setRecipientSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.setRecipientSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.reward.setRecipientSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.setRecipientSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useDistribute', () => { + const variables = {} as Actions.reward.distribute.Parameters + + const distribute = reward.useDistribute({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.reward.distribute.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.distribute.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.distribute.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.reward.distribute.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.distribute.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(distribute.data).toEqualTypeOf< + Actions.reward.distribute.ReturnValue | undefined + >() + expectTypeOf( + distribute.error, + ).toEqualTypeOf() + expectTypeOf(distribute.variables).toEqualTypeOf< + Actions.reward.distribute.Parameters | undefined + >() + expectTypeOf(distribute.context).toEqualTypeOf() + + distribute.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.distribute.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.distribute.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.reward.distribute.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.distribute.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.reward.distributeSync.Parameters< + typeof config + > + + const distributeSync = reward.useDistributeSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.reward.distributeSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.distributeSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.distributeSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.reward.distributeSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.distributeSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(distributeSync.data).toEqualTypeOf< + Actions.reward.distributeSync.ReturnValue | undefined + >() + expectTypeOf( + distributeSync.error, + ).toEqualTypeOf() + expectTypeOf(distributeSync.variables).toEqualTypeOf< + Actions.reward.distributeSync.Parameters | undefined + >() + expectTypeOf(distributeSync.context).toEqualTypeOf() + + distributeSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.distributeSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.distributeSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.reward.distributeSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.reward.distributeSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useWatchRewardDistributed', () => { + reward.useWatchRewardDistributed({ + config, + enabled: true, + onRewardDistributed(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchRewardRecipientSet', () => { + reward.useWatchRewardRecipientSet({ + config, + enabled: true, + onRewardRecipientSet(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) diff --git a/packages/react/src/tempo/hooks/token.test-d.ts b/packages/react/src/tempo/hooks/token.test-d.ts new file mode 100644 index 0000000000..f4064055d4 --- /dev/null +++ b/packages/react/src/tempo/hooks/token.test-d.ts @@ -0,0 +1,2919 @@ +import { createConfig, http } from '@wagmi/core' +import type { Actions } from '@wagmi/core/tempo' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { expectTypeOf, test } from 'vitest' +import * as token from './token.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) +const contextValue = { foo: 'bar' } as const +const selected = 'selected' as const + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +type Context = typeof contextValue + +test('useGetAllowance', () => { + const result = token.useGetAllowance({ + config, + query: { + select(data) { + expectTypeOf( + data, + ).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useGetBalance', () => { + const result = token.useGetBalance({ + config, + query: { + select(data) { + expectTypeOf(data).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useGetMetadata', () => { + const result = token.useGetMetadata({ + config, + query: { + select(data) { + expectTypeOf( + data, + ).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useGetRoleAdmin', () => { + const result = token.useGetRoleAdmin({ + config, + query: { + select(data) { + expectTypeOf( + data, + ).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useHasRole', () => { + const result = token.useHasRole({ + config, + query: { + select(data) { + expectTypeOf(data).toEqualTypeOf() + return selected + }, + }, + }) + + expectTypeOf(result.data).toEqualTypeOf() +}) + +test('useApprove', () => { + const variables = {} as Actions.token.approve.Parameters + + const approve = token.useApprove({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.approve.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.approve.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.approve.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.approve.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.approve.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(approve.data).toEqualTypeOf< + Actions.token.approve.ReturnValue | undefined + >() + expectTypeOf( + approve.error, + ).toEqualTypeOf() + expectTypeOf(approve.variables).toEqualTypeOf< + Actions.token.approve.Parameters | undefined + >() + expectTypeOf(approve.context).toEqualTypeOf() + + approve.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.approve.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.approve.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.approve.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.approve.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.approveSync.Parameters< + typeof config + > + + const approveSync = token.useApproveSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.approveSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.approveSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.approveSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.approveSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.approveSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(approveSync.data).toEqualTypeOf< + Actions.token.approveSync.ReturnValue | undefined + >() + expectTypeOf( + approveSync.error, + ).toEqualTypeOf() + expectTypeOf(approveSync.variables).toEqualTypeOf< + Actions.token.approveSync.Parameters | undefined + >() + expectTypeOf(approveSync.context).toEqualTypeOf() + + approveSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.approveSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.approveSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.approveSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.approveSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useBurn', () => { + const variables = {} as Actions.token.burn.Parameters + + const burn = token.useBurn({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.burn.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burn.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burn.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.burn.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burn.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(burn.data).toEqualTypeOf< + Actions.token.burn.ReturnValue | undefined + >() + expectTypeOf(burn.error).toEqualTypeOf() + expectTypeOf(burn.variables).toEqualTypeOf< + Actions.token.burn.Parameters | undefined + >() + expectTypeOf(burn.context).toEqualTypeOf() + + burn.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burn.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burn.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.burn.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burn.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.burnSync.Parameters + + const burnSync = token.useBurnSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.burnSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.burnSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(burnSync.data).toEqualTypeOf< + Actions.token.burnSync.ReturnValue | undefined + >() + expectTypeOf( + burnSync.error, + ).toEqualTypeOf() + expectTypeOf(burnSync.variables).toEqualTypeOf< + Actions.token.burnSync.Parameters | undefined + >() + expectTypeOf(burnSync.context).toEqualTypeOf() + + burnSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.burnSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useBurnBlocked', () => { + const variables = {} as Actions.token.burnBlocked.Parameters + + const burnBlocked = token.useBurnBlocked({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.burnBlocked.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnBlocked.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnBlocked.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.burnBlocked.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnBlocked.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(burnBlocked.data).toEqualTypeOf< + Actions.token.burnBlocked.ReturnValue | undefined + >() + expectTypeOf( + burnBlocked.error, + ).toEqualTypeOf() + expectTypeOf(burnBlocked.variables).toEqualTypeOf< + Actions.token.burnBlocked.Parameters | undefined + >() + expectTypeOf(burnBlocked.context).toEqualTypeOf() + + burnBlocked.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnBlocked.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnBlocked.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.burnBlocked.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnBlocked.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.burnBlockedSync.Parameters< + typeof config + > + + const burnBlockedSync = token.useBurnBlockedSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.burnBlockedSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnBlockedSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnBlockedSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.burnBlockedSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnBlockedSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(burnBlockedSync.data).toEqualTypeOf< + Actions.token.burnBlockedSync.ReturnValue | undefined + >() + expectTypeOf( + burnBlockedSync.error, + ).toEqualTypeOf() + expectTypeOf(burnBlockedSync.variables).toEqualTypeOf< + Actions.token.burnBlockedSync.Parameters | undefined + >() + expectTypeOf(burnBlockedSync.context).toEqualTypeOf() + + burnBlockedSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnBlockedSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnBlockedSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.burnBlockedSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.burnBlockedSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useChangeTransferPolicy', () => { + const variables = {} as Actions.token.changeTransferPolicy.Parameters< + typeof config + > + + const changeTransferPolicy = token.useChangeTransferPolicy({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.changeTransferPolicy.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.changeTransferPolicy.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.changeTransferPolicy.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.changeTransferPolicy.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.changeTransferPolicy.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(changeTransferPolicy.data).toEqualTypeOf< + Actions.token.changeTransferPolicy.ReturnValue | undefined + >() + expectTypeOf( + changeTransferPolicy.error, + ).toEqualTypeOf() + expectTypeOf(changeTransferPolicy.variables).toEqualTypeOf< + Actions.token.changeTransferPolicy.Parameters | undefined + >() + expectTypeOf(changeTransferPolicy.context).toEqualTypeOf< + Context | undefined + >() + + changeTransferPolicy.mutate(variables, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.changeTransferPolicy.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.changeTransferPolicy.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.changeTransferPolicy.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.changeTransferPolicy.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.changeTransferPolicySync.Parameters< + typeof config + > + + const changeTransferPolicySync = token.useChangeTransferPolicySync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.changeTransferPolicySync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.changeTransferPolicySync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.changeTransferPolicySync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.changeTransferPolicySync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.changeTransferPolicySync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(changeTransferPolicySync.data).toEqualTypeOf< + Actions.token.changeTransferPolicySync.ReturnValue | undefined + >() + expectTypeOf( + changeTransferPolicySync.error, + ).toEqualTypeOf() + expectTypeOf(changeTransferPolicySync.variables).toEqualTypeOf< + Actions.token.changeTransferPolicySync.Parameters | undefined + >() + expectTypeOf(changeTransferPolicySync.context).toEqualTypeOf< + Context | undefined + >() + + changeTransferPolicySync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.changeTransferPolicySync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.changeTransferPolicySync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.changeTransferPolicySync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.changeTransferPolicySync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useCreate', () => { + const variables = {} as Actions.token.create.Parameters + + const create = token.useCreate({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.create.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.create.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.create.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.create.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.create.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(create.data).toEqualTypeOf< + Actions.token.create.ReturnValue | undefined + >() + expectTypeOf( + create.error, + ).toEqualTypeOf() + expectTypeOf(create.variables).toEqualTypeOf< + Actions.token.create.Parameters | undefined + >() + expectTypeOf(create.context).toEqualTypeOf() + + create.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.create.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.create.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.create.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.create.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.createSync.Parameters + + const createSync = token.useCreateSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.createSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.createSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.createSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.createSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.createSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(createSync.data).toEqualTypeOf< + Actions.token.createSync.ReturnValue | undefined + >() + expectTypeOf( + createSync.error, + ).toEqualTypeOf() + expectTypeOf(createSync.variables).toEqualTypeOf< + Actions.token.createSync.Parameters | undefined + >() + expectTypeOf(createSync.context).toEqualTypeOf() + + createSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.createSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.createSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.createSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.createSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useUpdateQuoteToken', () => { + const variables = {} as Actions.token.updateQuoteToken.Parameters< + typeof config + > + + const updateQuoteToken = token.useUpdateQuoteToken({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.updateQuoteToken.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.updateQuoteToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.updateQuoteToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.updateQuoteToken.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.updateQuoteToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(updateQuoteToken.data).toEqualTypeOf< + Actions.token.updateQuoteToken.ReturnValue | undefined + >() + expectTypeOf( + updateQuoteToken.error, + ).toEqualTypeOf() + expectTypeOf(updateQuoteToken.variables).toEqualTypeOf< + Actions.token.updateQuoteToken.Parameters | undefined + >() + expectTypeOf(updateQuoteToken.context).toEqualTypeOf() + + updateQuoteToken.mutate(variables, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.updateQuoteToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.updateQuoteToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.updateQuoteToken.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.updateQuoteToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.updateQuoteTokenSync.Parameters< + typeof config + > + + const updateQuoteTokenSync = token.useUpdateQuoteTokenSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.updateQuoteTokenSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.updateQuoteTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.updateQuoteTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.updateQuoteTokenSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.updateQuoteTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(updateQuoteTokenSync.data).toEqualTypeOf< + Actions.token.updateQuoteTokenSync.ReturnValue | undefined + >() + expectTypeOf( + updateQuoteTokenSync.error, + ).toEqualTypeOf() + expectTypeOf(updateQuoteTokenSync.variables).toEqualTypeOf< + Actions.token.updateQuoteTokenSync.Parameters | undefined + >() + expectTypeOf(updateQuoteTokenSync.context).toEqualTypeOf< + Context | undefined + >() + + updateQuoteTokenSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.updateQuoteTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.updateQuoteTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.updateQuoteTokenSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.updateQuoteTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useGrantRoles', () => { + const variables = {} as Actions.token.grantRoles.Parameters + + const grantRoles = token.useGrantRoles({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.grantRoles.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.grantRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.grantRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.grantRoles.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.grantRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(grantRoles.data).toEqualTypeOf< + Actions.token.grantRoles.ReturnValue | undefined + >() + expectTypeOf( + grantRoles.error, + ).toEqualTypeOf() + expectTypeOf(grantRoles.variables).toEqualTypeOf< + Actions.token.grantRoles.Parameters | undefined + >() + expectTypeOf(grantRoles.context).toEqualTypeOf() + + grantRoles.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.grantRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.grantRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.grantRoles.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.grantRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.grantRolesSync.Parameters< + typeof config + > + + const grantRolesSync = token.useGrantRolesSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.grantRolesSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.grantRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.grantRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.grantRolesSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.grantRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(grantRolesSync.data).toEqualTypeOf< + Actions.token.grantRolesSync.ReturnValue | undefined + >() + expectTypeOf( + grantRolesSync.error, + ).toEqualTypeOf() + expectTypeOf(grantRolesSync.variables).toEqualTypeOf< + Actions.token.grantRolesSync.Parameters | undefined + >() + expectTypeOf(grantRolesSync.context).toEqualTypeOf() + + grantRolesSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.grantRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.grantRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.grantRolesSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.grantRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useMint', () => { + const variables = {} as Actions.token.mint.Parameters + + const mint = token.useMint({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.mint.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.mint.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.mint.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.mint.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.mint.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(mint.data).toEqualTypeOf< + Actions.token.mint.ReturnValue | undefined + >() + expectTypeOf(mint.error).toEqualTypeOf() + expectTypeOf(mint.variables).toEqualTypeOf< + Actions.token.mint.Parameters | undefined + >() + expectTypeOf(mint.context).toEqualTypeOf() + + mint.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.mint.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.mint.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.mint.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.mint.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.mintSync.Parameters + + const mintSync = token.useMintSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.mintSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.mintSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.mintSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.mintSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.mintSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(mintSync.data).toEqualTypeOf< + Actions.token.mintSync.ReturnValue | undefined + >() + expectTypeOf( + mintSync.error, + ).toEqualTypeOf() + expectTypeOf(mintSync.variables).toEqualTypeOf< + Actions.token.mintSync.Parameters | undefined + >() + expectTypeOf(mintSync.context).toEqualTypeOf() + + mintSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.mintSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.mintSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.mintSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.mintSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('usePause', () => { + const variables = {} as Actions.token.pause.Parameters + + const pause = token.usePause({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.pause.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.pause.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.pause.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.pause.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.pause.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(pause.data).toEqualTypeOf< + Actions.token.pause.ReturnValue | undefined + >() + expectTypeOf( + pause.error, + ).toEqualTypeOf() + expectTypeOf(pause.variables).toEqualTypeOf< + Actions.token.pause.Parameters | undefined + >() + expectTypeOf(pause.context).toEqualTypeOf() + + pause.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.pause.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.pause.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.pause.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.pause.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.pauseSync.Parameters + + const pauseSync = token.usePauseSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.pauseSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.pauseSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.pauseSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.pauseSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.pauseSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(pauseSync.data).toEqualTypeOf< + Actions.token.pauseSync.ReturnValue | undefined + >() + expectTypeOf( + pauseSync.error, + ).toEqualTypeOf() + expectTypeOf(pauseSync.variables).toEqualTypeOf< + Actions.token.pauseSync.Parameters | undefined + >() + expectTypeOf(pauseSync.context).toEqualTypeOf() + + pauseSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.pauseSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.pauseSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.pauseSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.pauseSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useRenounceRoles', () => { + const variables = {} as Actions.token.renounceRoles.Parameters + + const renounceRoles = token.useRenounceRoles({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.renounceRoles.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.renounceRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.renounceRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.renounceRoles.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.renounceRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(renounceRoles.data).toEqualTypeOf< + Actions.token.renounceRoles.ReturnValue | undefined + >() + expectTypeOf( + renounceRoles.error, + ).toEqualTypeOf() + expectTypeOf(renounceRoles.variables).toEqualTypeOf< + Actions.token.renounceRoles.Parameters | undefined + >() + expectTypeOf(renounceRoles.context).toEqualTypeOf() + + renounceRoles.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.renounceRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.renounceRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.renounceRoles.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.renounceRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.renounceRolesSync.Parameters< + typeof config + > + + const renounceRolesSync = token.useRenounceRolesSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.renounceRolesSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.renounceRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.renounceRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.renounceRolesSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.renounceRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(renounceRolesSync.data).toEqualTypeOf< + Actions.token.renounceRolesSync.ReturnValue | undefined + >() + expectTypeOf( + renounceRolesSync.error, + ).toEqualTypeOf() + expectTypeOf(renounceRolesSync.variables).toEqualTypeOf< + Actions.token.renounceRolesSync.Parameters | undefined + >() + expectTypeOf(renounceRolesSync.context).toEqualTypeOf() + + renounceRolesSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.renounceRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.renounceRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.renounceRolesSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.renounceRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useRevokeRoles', () => { + const variables = {} as Actions.token.revokeRoles.Parameters + + const revokeRoles = token.useRevokeRoles({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.revokeRoles.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.revokeRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.revokeRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.revokeRoles.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.revokeRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(revokeRoles.data).toEqualTypeOf< + Actions.token.revokeRoles.ReturnValue | undefined + >() + expectTypeOf( + revokeRoles.error, + ).toEqualTypeOf() + expectTypeOf(revokeRoles.variables).toEqualTypeOf< + Actions.token.revokeRoles.Parameters | undefined + >() + expectTypeOf(revokeRoles.context).toEqualTypeOf() + + revokeRoles.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.revokeRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.revokeRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.revokeRoles.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.revokeRoles.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.revokeRolesSync.Parameters< + typeof config + > + + const revokeRolesSync = token.useRevokeRolesSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.revokeRolesSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.revokeRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.revokeRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.revokeRolesSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.revokeRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(revokeRolesSync.data).toEqualTypeOf< + Actions.token.revokeRolesSync.ReturnValue | undefined + >() + expectTypeOf( + revokeRolesSync.error, + ).toEqualTypeOf() + expectTypeOf(revokeRolesSync.variables).toEqualTypeOf< + Actions.token.revokeRolesSync.Parameters | undefined + >() + expectTypeOf(revokeRolesSync.context).toEqualTypeOf() + + revokeRolesSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.revokeRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.revokeRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.revokeRolesSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.revokeRolesSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useSetRoleAdmin', () => { + const variables = {} as Actions.token.setRoleAdmin.Parameters + + const setRoleAdmin = token.useSetRoleAdmin({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.setRoleAdmin.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setRoleAdmin.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setRoleAdmin.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.setRoleAdmin.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setRoleAdmin.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(setRoleAdmin.data).toEqualTypeOf< + Actions.token.setRoleAdmin.ReturnValue | undefined + >() + expectTypeOf( + setRoleAdmin.error, + ).toEqualTypeOf() + expectTypeOf(setRoleAdmin.variables).toEqualTypeOf< + Actions.token.setRoleAdmin.Parameters | undefined + >() + expectTypeOf(setRoleAdmin.context).toEqualTypeOf() + + setRoleAdmin.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setRoleAdmin.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setRoleAdmin.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.setRoleAdmin.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setRoleAdmin.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.setRoleAdminSync.Parameters< + typeof config + > + + const setRoleAdminSync = token.useSetRoleAdminSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.setRoleAdminSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setRoleAdminSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setRoleAdminSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.setRoleAdminSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setRoleAdminSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(setRoleAdminSync.data).toEqualTypeOf< + Actions.token.setRoleAdminSync.ReturnValue | undefined + >() + expectTypeOf( + setRoleAdminSync.error, + ).toEqualTypeOf() + expectTypeOf(setRoleAdminSync.variables).toEqualTypeOf< + Actions.token.setRoleAdminSync.Parameters | undefined + >() + expectTypeOf(setRoleAdminSync.context).toEqualTypeOf() + + setRoleAdminSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setRoleAdminSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setRoleAdminSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.setRoleAdminSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setRoleAdminSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useSetSupplyCap', () => { + const variables = {} as Actions.token.setSupplyCap.Parameters + + const setSupplyCap = token.useSetSupplyCap({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.setSupplyCap.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setSupplyCap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setSupplyCap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.setSupplyCap.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setSupplyCap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(setSupplyCap.data).toEqualTypeOf< + Actions.token.setSupplyCap.ReturnValue | undefined + >() + expectTypeOf( + setSupplyCap.error, + ).toEqualTypeOf() + expectTypeOf(setSupplyCap.variables).toEqualTypeOf< + Actions.token.setSupplyCap.Parameters | undefined + >() + expectTypeOf(setSupplyCap.context).toEqualTypeOf() + + setSupplyCap.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setSupplyCap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setSupplyCap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.setSupplyCap.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setSupplyCap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.setSupplyCapSync.Parameters< + typeof config + > + + const setSupplyCapSync = token.useSetSupplyCapSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.setSupplyCapSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setSupplyCapSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setSupplyCapSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.setSupplyCapSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setSupplyCapSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(setSupplyCapSync.data).toEqualTypeOf< + Actions.token.setSupplyCapSync.ReturnValue | undefined + >() + expectTypeOf( + setSupplyCapSync.error, + ).toEqualTypeOf() + expectTypeOf(setSupplyCapSync.variables).toEqualTypeOf< + Actions.token.setSupplyCapSync.Parameters | undefined + >() + expectTypeOf(setSupplyCapSync.context).toEqualTypeOf() + + setSupplyCapSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setSupplyCapSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setSupplyCapSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.setSupplyCapSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.setSupplyCapSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useTransfer', () => { + const variables = {} as Actions.token.transfer.Parameters + + const transfer = token.useTransfer({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.transfer.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.transfer.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.transfer.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.transfer.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.transfer.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(transfer.data).toEqualTypeOf< + Actions.token.transfer.ReturnValue | undefined + >() + expectTypeOf( + transfer.error, + ).toEqualTypeOf() + expectTypeOf(transfer.variables).toEqualTypeOf< + Actions.token.transfer.Parameters | undefined + >() + expectTypeOf(transfer.context).toEqualTypeOf() + + transfer.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.transfer.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.transfer.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.transfer.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.transfer.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.transferSync.Parameters< + typeof config + > + + const transferSync = token.useTransferSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.transferSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.transferSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.transferSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.transferSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.transferSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(transferSync.data).toEqualTypeOf< + Actions.token.transferSync.ReturnValue | undefined + >() + expectTypeOf( + transferSync.error, + ).toEqualTypeOf() + expectTypeOf(transferSync.variables).toEqualTypeOf< + Actions.token.transferSync.Parameters | undefined + >() + expectTypeOf(transferSync.context).toEqualTypeOf() + + transferSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.transferSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.transferSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.transferSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.transferSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useUnpause', () => { + const variables = {} as Actions.token.unpause.Parameters + + const unpause = token.useUnpause({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.unpause.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.unpause.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.unpause.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.unpause.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.unpause.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(unpause.data).toEqualTypeOf< + Actions.token.unpause.ReturnValue | undefined + >() + expectTypeOf( + unpause.error, + ).toEqualTypeOf() + expectTypeOf(unpause.variables).toEqualTypeOf< + Actions.token.unpause.Parameters | undefined + >() + expectTypeOf(unpause.context).toEqualTypeOf() + + unpause.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.unpause.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.unpause.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.unpause.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.unpause.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = {} as Actions.token.unpauseSync.Parameters< + typeof config + > + + const unpauseSync = token.useUnpauseSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.unpauseSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.unpauseSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.unpauseSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.unpauseSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.unpauseSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(unpauseSync.data).toEqualTypeOf< + Actions.token.unpauseSync.ReturnValue | undefined + >() + expectTypeOf( + unpauseSync.error, + ).toEqualTypeOf() + expectTypeOf(unpauseSync.variables).toEqualTypeOf< + Actions.token.unpauseSync.Parameters | undefined + >() + expectTypeOf(unpauseSync.context).toEqualTypeOf() + + unpauseSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.unpauseSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.unpauseSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.unpauseSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.unpauseSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('usePrepareUpdateQuoteToken', () => { + const variables = {} as Actions.token.prepareUpdateQuoteToken.Parameters< + typeof config + > + + const prepareUpdateQuoteToken = token.usePrepareUpdateQuoteToken({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.prepareUpdateQuoteToken.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.prepareUpdateQuoteToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.prepareUpdateQuoteToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.prepareUpdateQuoteToken.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.prepareUpdateQuoteToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(prepareUpdateQuoteToken.data).toEqualTypeOf< + Actions.token.prepareUpdateQuoteToken.ReturnValue | undefined + >() + expectTypeOf( + prepareUpdateQuoteToken.error, + ).toEqualTypeOf() + expectTypeOf(prepareUpdateQuoteToken.variables).toEqualTypeOf< + Actions.token.prepareUpdateQuoteToken.Parameters | undefined + >() + expectTypeOf(prepareUpdateQuoteToken.context).toEqualTypeOf< + Context | undefined + >() + + prepareUpdateQuoteToken.mutate(variables, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.prepareUpdateQuoteToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.prepareUpdateQuoteToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.prepareUpdateQuoteToken.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.prepareUpdateQuoteToken.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) + + const variablesSync = + {} as Actions.token.prepareUpdateQuoteTokenSync.Parameters + + const prepareUpdateQuoteTokenSync = token.usePrepareUpdateQuoteTokenSync({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toExtend< + Actions.token.prepareUpdateQuoteTokenSync.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.prepareUpdateQuoteTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.prepareUpdateQuoteTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.prepareUpdateQuoteTokenSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.prepareUpdateQuoteTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(prepareUpdateQuoteTokenSync.data).toEqualTypeOf< + Actions.token.prepareUpdateQuoteTokenSync.ReturnValue | undefined + >() + expectTypeOf( + prepareUpdateQuoteTokenSync.error, + ).toEqualTypeOf() + expectTypeOf(prepareUpdateQuoteTokenSync.variables).toEqualTypeOf< + | Actions.token.prepareUpdateQuoteTokenSync.Parameters + | undefined + >() + expectTypeOf(prepareUpdateQuoteTokenSync.context).toEqualTypeOf< + Context | undefined + >() + + prepareUpdateQuoteTokenSync.mutate(variablesSync, { + onError(error, variables, context) { + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.prepareUpdateQuoteTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf( + data, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.prepareUpdateQuoteTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.token.prepareUpdateQuoteTokenSync.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toExtend< + Actions.token.prepareUpdateQuoteTokenSync.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useWatchAdminRole', () => { + token.useWatchAdminRole({ + config, + enabled: true, + onRoleAdminUpdated(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchApprove', () => { + token.useWatchApprove({ + config, + enabled: true, + onApproval(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchBurn', () => { + token.useWatchBurn({ + config, + enabled: true, + onBurn(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchCreate', () => { + token.useWatchCreate({ + config, + enabled: true, + onTokenCreated(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchMint', () => { + token.useWatchMint({ + config, + enabled: true, + onMint(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchRole', () => { + token.useWatchRole({ + config, + enabled: true, + onRoleUpdated(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchTransfer', () => { + token.useWatchTransfer({ + config, + enabled: true, + onTransfer(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) + +test('useWatchUpdateQuoteToken', () => { + token.useWatchUpdateQuoteToken({ + config, + enabled: true, + onUpdateQuoteToken(args, log) { + expectTypeOf(args).toExtend() + expectTypeOf(log).toExtend() + }, + }) +}) diff --git a/packages/react/src/tempo/hooks/wallet.test-d.ts b/packages/react/src/tempo/hooks/wallet.test-d.ts new file mode 100644 index 0000000000..e83c2df116 --- /dev/null +++ b/packages/react/src/tempo/hooks/wallet.test-d.ts @@ -0,0 +1,258 @@ +import { createConfig, http } from '@wagmi/core' +import type { Actions } from '@wagmi/core/tempo' +import { defineChain } from 'viem' +import { tempoLocalnet } from 'viem/chains' +import { expectTypeOf, test } from 'vitest' +import * as wallet from './wallet.js' + +const tempo = defineChain({ ...tempoLocalnet, id: 1337 as number }) +const contextValue = { foo: 'bar' } as const + +const config = createConfig({ + chains: [tempo], + transports: { [tempo.id]: http() }, +}) + +type Context = typeof contextValue + +test('useTransfer', () => { + const variables = {} as Actions.wallet.transfer.Parameters + + const transfer = wallet.useTransfer({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.transfer.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.transfer.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.transfer.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.wallet.transfer.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.transfer.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(transfer.data).toEqualTypeOf< + Actions.wallet.transfer.ReturnValue | undefined + >() + expectTypeOf( + transfer.error, + ).toEqualTypeOf() + expectTypeOf(transfer.variables).toEqualTypeOf< + Actions.wallet.transfer.Parameters | undefined + >() + expectTypeOf(transfer.context).toEqualTypeOf() + + transfer.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.transfer.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.transfer.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.wallet.transfer.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.transfer.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useSwap', () => { + const variables = {} as Actions.wallet.swap.Parameters + + const swap = wallet.useSwap({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.swap.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.swap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.swap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.wallet.swap.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.swap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(swap.data).toEqualTypeOf< + Actions.wallet.swap.ReturnValue | undefined + >() + expectTypeOf(swap.error).toEqualTypeOf() + expectTypeOf(swap.variables).toEqualTypeOf< + Actions.wallet.swap.Parameters | undefined + >() + expectTypeOf(swap.context).toEqualTypeOf() + + swap.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.swap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.swap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.wallet.swap.ReturnValue | undefined + >() + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.swap.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) + +test('useDeposit', () => { + const variables = {} as Actions.wallet.deposit.Parameters + + const deposit = wallet.useDeposit({ + config, + mutation: { + onMutate(variables) { + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.deposit.Parameters + >() + return contextValue + }, + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.deposit.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.deposit.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.wallet.deposit.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.deposit.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }, + }) + + expectTypeOf(deposit.data).toEqualTypeOf< + Actions.wallet.deposit.ReturnValue | undefined + >() + expectTypeOf( + deposit.error, + ).toEqualTypeOf() + expectTypeOf(deposit.variables).toEqualTypeOf< + Actions.wallet.deposit.Parameters | undefined + >() + expectTypeOf(deposit.context).toEqualTypeOf() + + deposit.mutate(variables, { + onError(error, variables, context) { + expectTypeOf(error).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.deposit.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSuccess(data, variables, context) { + expectTypeOf(data).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.deposit.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + onSettled(data, error, variables, context) { + expectTypeOf(data).toEqualTypeOf< + Actions.wallet.deposit.ReturnValue | undefined + >() + expectTypeOf( + error, + ).toEqualTypeOf() + expectTypeOf(variables).toEqualTypeOf< + Actions.wallet.deposit.Parameters + >() + expectTypeOf(context).toEqualTypeOf() + }, + }) +}) diff --git a/packages/react/src/tempo/hooks/zone.test-d.ts b/packages/react/src/tempo/hooks/zone.test-d.ts index e5037928d2..b98d049adc 100644 --- a/packages/react/src/tempo/hooks/zone.test-d.ts +++ b/packages/react/src/tempo/hooks/zone.test-d.ts @@ -36,7 +36,7 @@ test('deposit variables', () => { zoneId: 7, }) - expectTypeOf(deposit.variables).toMatchTypeOf< + expectTypeOf(deposit.variables).toExtend< | { account?: unknown amount: bigint @@ -58,7 +58,7 @@ test('depositSync variables', () => { zoneId: 7, }) - expectTypeOf(deposit.variables).toMatchTypeOf< + expectTypeOf(deposit.variables).toExtend< | { account?: unknown amount: bigint @@ -80,7 +80,7 @@ test('encryptedDeposit variables', () => { zoneId: 7, }) - expectTypeOf(deposit.variables).toMatchTypeOf< + expectTypeOf(deposit.variables).toExtend< | { account?: unknown amount: bigint @@ -102,7 +102,7 @@ test('encryptedDepositSync variables', () => { zoneId: 7, }) - expectTypeOf(deposit.variables).toMatchTypeOf< + expectTypeOf(deposit.variables).toExtend< | { account?: unknown amount: bigint @@ -123,7 +123,7 @@ test('requestWithdrawal variables', () => { token, }) - expectTypeOf(withdraw.variables).toMatchTypeOf< + expectTypeOf(withdraw.variables).toExtend< | { account?: unknown amount: bigint @@ -143,7 +143,7 @@ test('requestWithdrawalSync variables', () => { token, }) - expectTypeOf(withdraw.variables).toMatchTypeOf< + expectTypeOf(withdraw.variables).toExtend< | { account?: unknown amount: bigint @@ -164,7 +164,7 @@ test('requestVerifiableWithdrawal variables', () => { token, }) - expectTypeOf(withdraw.variables).toMatchTypeOf< + expectTypeOf(withdraw.variables).toExtend< | { account?: unknown amount: bigint @@ -186,7 +186,7 @@ test('requestVerifiableWithdrawalSync variables', () => { token, }) - expectTypeOf(withdraw.variables).toMatchTypeOf< + expectTypeOf(withdraw.variables).toExtend< | { account?: unknown amount: bigint From 5f83a0d6f3cbed561e507d291020e2819989dad8 Mon Sep 17 00:00:00 2001 From: tmm Date: Thu, 25 Jun 2026 12:46:15 -0400 Subject: [PATCH 2/2] chore: changeset --- .changeset/quiet-lions-jump.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/quiet-lions-jump.md b/.changeset/quiet-lions-jump.md index 0c7e9cb8ce..734473f4fb 100644 --- a/.changeset/quiet-lions-jump.md +++ b/.changeset/quiet-lions-jump.md @@ -3,4 +3,4 @@ 'wagmi': patch --- -Fixed Tempo action and hook types so transaction override parameters are optional. +Fixed Tempo types so transaction override parameters are optional.