mirror of
https://github.com/pezkuwichain/pezkuwi-telegram-miniapp.git
synced 2026-04-22 03:07:55 +00:00
fix: compare referrer addresses in SS58 format for pending approvals
This commit is contained in:
@@ -167,11 +167,17 @@ export async function getPendingApprovals(
|
|||||||
|
|
||||||
for (const [key, value] of entries) {
|
for (const [key, value] of entries) {
|
||||||
const applicantAddress = key.args[0].toString();
|
const applicantAddress = key.args[0].toString();
|
||||||
|
|
||||||
|
// Use codec .toString() for SS58, fallback to toJSON() for hex comparison
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
const appValue = value as any;
|
||||||
|
const referrerSS58 = appValue?.referrer?.toString?.() || '';
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const appData = value.toJSON() as any;
|
const appData = value.toJSON() as any;
|
||||||
|
const identityHash = appData?.identityHash || appValue?.identityHash?.toHex?.() || '';
|
||||||
|
|
||||||
// Check if this application's referrer matches
|
// Compare referrer in SS58 format (codec toString returns SS58)
|
||||||
if (!appData?.referrer || appData.referrer !== referrerAddress) {
|
if (!referrerSS58 || referrerSS58 !== referrerAddress) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +186,7 @@ export async function getPendingApprovals(
|
|||||||
if (status === 'PendingReferral') {
|
if (status === 'PendingReferral') {
|
||||||
pending.push({
|
pending.push({
|
||||||
applicantAddress,
|
applicantAddress,
|
||||||
identityHash: appData.identityHash || '',
|
identityHash: typeof identityHash === 'string' ? identityHash : '',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user