Skip to content

Commit 6825916

Browse files
authored
fix: retreive onchain passport regardles of attestation uuid (#3360)
- this affects users that do not have a passport attestation (which is now deprected), as it will not load the provider list
1 parent 187f1bf commit 6825916

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

app/utils/onChainStamps.ts

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -91,30 +91,18 @@ export async function getAttestationData({
9191
),
9292
};
9393

94-
const passportSchema = onchainInfo[chainId].easSchemas.passport.uid;
95-
// check if user has attestations
96-
const passportUid = (await publicClient.readContract({
97-
abi: resolverAbi,
98-
address: resolverAddress as `0x${string}`,
99-
functionName: "userAttestations", // Name of the function in your contract ABI
100-
args: [address, passportSchema], // Arguments to the function
101-
})) as `0x${string}`;
102-
103-
let providers: AttestationData["providers"] = [];
104-
if (passportUid !== ZERO_BYTES32) {
105-
const cachedPassport = await getPassport({
106-
publicClient,
107-
address,
108-
decoderAddress,
109-
decoderAbi,
110-
});
94+
const cachedPassport = await getPassport({
95+
publicClient,
96+
address,
97+
decoderAddress,
98+
decoderAbi,
99+
});
111100

112-
providers = cachedPassport.map(({ provider, issuanceDate, expirationDate }) => ({
113-
providerName: provider as PROVIDER_ID,
114-
issuanceDate: new Date(Number(issuanceDate) * 1000),
115-
expirationDate: new Date(Number(expirationDate) * 1000),
116-
}));
117-
}
101+
const providers = cachedPassport.map(({ provider, issuanceDate, expirationDate }) => ({
102+
providerName: provider as PROVIDER_ID,
103+
issuanceDate: new Date(Number(issuanceDate) * 1000),
104+
expirationDate: new Date(Number(expirationDate) * 1000),
105+
}));
118106

119107
return {
120108
providers,

0 commit comments

Comments
 (0)