Skip to content

Commit 3b6737a

Browse files
committed
ui fix, ledger signing
1 parent cdd9e63 commit 3b6737a

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

contracts/ExclusiveGeyser.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ contract ExclusiveGeyser is Geyser {
2828
uint256 lockCount = vault.getLockSetCount();
2929
for (uint256 i = 0; i < lockCount; i++) {
3030
IUniversalVault.LockData memory lock = vault.getLockAt(i);
31-
if(lock.token == stakingToken){
31+
if (lock.token == stakingToken) {
3232
require(lock.delegate == address(this), "ExclusiveGeyser: expected exclusive stake");
3333
}
3434
}

frontend/src/sdk/utils.ts

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,18 @@ export const signPermission = async (
6666
amount: amount,
6767
nonce: vaultNonce,
6868
}
69-
// sign permission
70-
// todo: add fallback if wallet does not support eip 712 rpc
71-
const signedPermission = await owner._signTypedData(domain, types, value)
72-
// return
69+
70+
// Try to sign with EIP-712
71+
let signedPermission
72+
try {
73+
signedPermission = await owner._signTypedData(domain, types, value)
74+
} catch (error) {
75+
console.log('EIP-712 signing failed, falling back to eth_sign:', error)
76+
77+
// Fallback to eth_sign
78+
const messageHash = ethers.utils._TypedDataEncoder.hash(domain, types, value)
79+
signedPermission = await owner.provider.send('eth_sign', [owner.address, messageHash])
80+
}
7381

7482
const replaceV: any = []
7583
replaceV['00'] = '1b'
@@ -114,9 +122,23 @@ export const signPermitEIP2612 = async (
114122
nonce: nonce,
115123
deadline: deadline,
116124
}
117-
// sign permission
118-
// todo: add fallback if wallet does not support eip 712 rpc
119-
const signedPermission = await owner._signTypedData(domainSeparator, types, values)
125+
126+
// Try to sign with EIP-712
127+
let signedPermission
128+
try {
129+
signedPermission = await owner._signTypedData(domainSeparator, types, values)
130+
} catch (error) {
131+
console.log('EIP-712 signing failed, falling back to eth_sign:', error)
132+
133+
// Fallback to eth_sign
134+
const messageHash = ethers.utils._TypedDataEncoder.hash(
135+
{ chainId: await token.provider.getNetwork().chainId, ...domainSeparator },
136+
types,
137+
values,
138+
)
139+
signedPermission = await owner.provider.send('eth_sign', [owner.address, messageHash])
140+
}
141+
120142
// split signature
121143
const sig = splitSignature(signedPermission)
122144
// return

0 commit comments

Comments
 (0)