* EIP-712 domain separator for EIP-3009 transferWithAuthorization. * * This follows the USDC contract's EIP-712 domain: * name: token name (e.g. "USD Coin") * version: token version (e.g. "2") * chainId: network chain ID * verifyingContract: USDC contract address
(requirement: PaymentRequirement)
| 111 | * verifyingContract: USDC contract address |
| 112 | */ |
| 113 | function getEIP712Domain(requirement: PaymentRequirement): { |
| 114 | name: string |
| 115 | version: string |
| 116 | chainId: number |
| 117 | verifyingContract: string |
| 118 | } { |
| 119 | const chainIds: Record<PaymentNetwork, number> = { |
| 120 | 'base': 8453, |
| 121 | 'base-sepolia': 84532, |
| 122 | 'ethereum': 1, |
| 123 | 'ethereum-sepolia': 11155111, |
| 124 | } |
| 125 | |
| 126 | return { |
| 127 | name: requirement.extra?.name ?? 'USD Coin', |
| 128 | version: requirement.extra?.version ?? '2', |
| 129 | chainId: chainIds[requirement.network], |
| 130 | verifyingContract: requirement.asset, |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * EIP-712 type hash for TransferWithAuthorization. |