Skip to content

Commit

Permalink
fixed broken sigs with 712 domains
Browse files Browse the repository at this point in the history
  • Loading branch information
Ncookiez committed Apr 30, 2024
1 parent 56821aa commit d1db7df
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/hyperstructure-client-js/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@generationsoftware/hyperstructure-client-js",
"description": "Lightweight library for interacting with PoolTogether contracts",
"version": "1.12.2",
"version": "1.12.3",
"license": "MIT",
"main": "./dist/index.mjs",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/hyperstructure-react-hooks/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@generationsoftware/hyperstructure-react-hooks",
"description": "React hooks library for interacting with PoolTogether contracts",
"version": "1.16.3",
"version": "1.16.4",
"license": "MIT",
"main": "./dist/index.mjs",
"types": "./dist/index.d.ts",
Expand Down
22 changes: 8 additions & 14 deletions shared/utilities/utils/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,26 +180,27 @@ export const getTokenDomain = async (publicClient: PublicClient, tokenAddress: A

domain.name = eip712Domain[1]
domain.version = eip712Domain[2]
domain.verifyingContract = eip712Domain[4]
domain.salt = eip712Domain[5]
// TODO: for some reason, adding salt and verifying contract from domain breaks sigs
// domain.verifyingContract = eip712Domain[4]
// domain.salt = eip712Domain[5]

return domain
} catch {
try {
const version = await publicClient.readContract({
const name = await publicClient.readContract({
address: tokenAddress,
abi: erc20ABI,
functionName: 'version'
functionName: 'name'
})

const name = await publicClient.readContract({
const version = await publicClient.readContract({
address: tokenAddress,
abi: erc20ABI,
functionName: 'name'
functionName: 'version'
})

domain.version = version
domain.name = name
domain.version = version

return domain
} catch {
Expand All @@ -217,13 +218,6 @@ export const getTokenPermitSupport = async (
publicClient: PublicClient,
tokenAddress: Address
): Promise<'eip2612' | 'daiPermit' | 'none'> => {
if (
tokenAddress.toLowerCase() === '0xdb1fe6da83698885104da02a6e0b3b65c0b0de80' ||
tokenAddress.toLowerCase() === '0x6da98bde0068d10ddd11b468b197ea97d96f96bc'
) {
return 'none'
}

try {
await publicClient.simulateContract({
address: tokenAddress,
Expand Down

0 comments on commit d1db7df

Please sign in to comment.