Skip to content

Commit

Permalink
fix: GoodDollar verification shown for wallet that is not Face Verifi…
Browse files Browse the repository at this point in the history
…ed #1911
  • Loading branch information
sirpy committed Nov 24, 2024
1 parent 766b959 commit 7c3cdb8
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions packages/app/src/hooks/useIsStewardVerified.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
import { G$ContractAddresses, CONTRACT_TO_ABI } from '@gooddollar/web3sdk-v2';
import { G$ContractAddresses } from '@gooddollar/web3sdk-v2';
import { isAddress, zeroAddress } from 'viem';
import { useContractRead, useNetwork } from 'wagmi';

export const useIsStewardVerified = (address: string): boolean => {
const chain = useNetwork();
const idAddress = G$ContractAddresses('Identity', 'production-celo') as `0x{string}`;
const abi = CONTRACT_TO_ABI.Identity.abi;
const result = useContractRead({
chainId: chain.chain?.id,
abi,
abi: [
{
inputs: [
{
internalType: 'address',
name: 'account',
type: 'address',
},
],
name: 'getWhitelistedRoot',
outputs: [
{
internalType: 'address',
name: 'whitelisted',
type: 'address',
},
],
stateMutability: 'view',
type: 'function',
},
],
address: idAddress,
args: [address],
functionName: 'isWhitelisted',
functionName: 'getWhitelistedRoot',
});

return result.data as any as boolean;
return result.data !== zeroAddress && isAddress(result.data as any);
};

0 comments on commit 7c3cdb8

Please sign in to comment.