/permit2:permit2-wagmi-integrationfrom permit2
Integration patterns for Permit2 with wagmi hooks. Use when building UI components that interact with Permit2.
Ships in permit2. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Complete patterns for integrating Permit2 with wagmi/viem.
import { useWriteContract, useReadContract, useAccount, useChainId } from 'wagmi'
import { usePublicClient, useWalletClient } from 'wagmi'
import { erc20Abi } from 'viem'
import { SignatureTransfer, PERMIT2_ADDRESS } from '@uniswap/permit2-sdk'
function useTokenAllowance(token: string, owner: string) {
const { data } = useReadContract({
address: token,
abi: erc20Abi,
functionName: 'allowance',
args: [owner, PERMIT2_ADDRESS],
query: { staleTime: 0 }
})
return data ?? 0n
}
function usePermit2Allowance(token: string, owner: string, spender: string) {
const { data } = useReadContract({
address: PERMIT2_ADDRESS,
abi: [{
inputs: [
{ name: 'owner', type: 'address' },
{ name: 'token', type: 'address' },
{ name: 'spender', type: 'address' }
],
name: 'allowance',
outputs: [
{ name: 'amount', type: 'uint160' },
{ name: 'expiration', type: 'uint48' },
{ name: 'nonce', type: 'uint48' }
],
stateMutability: 'view',
type: 'function'
}],
functionName: 'allowance',
args: [owner, token, spender],
query: { staleTime: 0 }
})
return data
}
import { useSignTypedData } from 'wagmi'
import { keccak256, encodePacked } from 'viem'
const WITNESS_TYPE: Record<string, TypedDataField[]> = {
Witness: [{ name: 'actionId', type: 'bytes32' }]
}
function usePermitSignature() {
const { signTypedDataAsync } = useSignTypedData()
const chainId = useChainId()
const signPermit = async (
token: string,
amount: bigint,
spender: string,
nonce: bigint,
witness?: { actionId: `0x${string}` }
) => {
const permit: SignatureTransfer.PermitTransferFrom = {
permitted: { token, amount },
nonce,
deadline: BigInt(Math.floor(Date.now() / 1000)) + 1800n
}
const witnessData = witness
? { witness: witness.actionId, witnessTypeName: 'Witness', witnessType: WITNESS_TYPE }
: undefined
const { domain, types, values } = SignatureTransfer.getPermitData(
permit,
PERMIT2_ADDRESS,
chainId,
witnessData
)
return signTypedDataAsync(domain, types, values)
}
return { signPermit }
}
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
10 skills in this plugin
/permit2-addressesCanonical Permit2 contract addresses by chain. Use when configuring multi-chain support./permit2-allowance-flowComplete approval flow with reset-to-zero pattern. Use when implementing full ERC20 and Permit2 approval workflow./permit2-allowance-transferUses AllowanceTransfer for persistent token approvals. Use when user grants recurring spend authority to the protocol./permit2-nonce-managementBitmap nonce patterns for Permit2 signature replay protection. Use when generating nonces for SignatureTransfer permits.permit2@cyotee is listed by cyotee/cyotee-claude-plugins — review the source before installing
npx claudepluginhub cyotee/cyotee-claude-plugins --plugin permit22 plugins ship this exact skill · first indexed Jul 20, 2026