diff --git a/shared/lib/citizenship-workflow.ts b/shared/lib/citizenship-workflow.ts index 9ba9351b..03bcc41b 100644 --- a/shared/lib/citizenship-workflow.ts +++ b/shared/lib/citizenship-workflow.ts @@ -790,7 +790,8 @@ export async function getPendingApprovalsForReferrer( let referrerSS58 = ''; try { if (appData.referrer) { - referrerSS58 = encodeAddress(appData.referrer as string, 42); + const ss58Prefix = api.registry.chainSS58 ?? 42; + referrerSS58 = encodeAddress(appData.referrer as string, ss58Prefix); } } catch { referrerSS58 = appData.referrer?.toString() ?? ''; diff --git a/shared/lib/referral.ts b/shared/lib/referral.ts index 87fbda40..9d16ac67 100644 --- a/shared/lib/referral.ts +++ b/shared/lib/referral.ts @@ -166,7 +166,7 @@ export async function getReferralInfo( // toJSON() returns hex for AccountId, convert to SS58 let referrerSS58 = data.referrer ?? ''; try { - if (data.referrer) referrerSS58 = encodeAddress(data.referrer, 42); + if (data.referrer) referrerSS58 = encodeAddress(data.referrer, api.registry.chainSS58 ?? 42); } catch { /* keep hex as fallback */ } return { referrer: referrerSS58, @@ -274,7 +274,7 @@ export async function getMyReferrals( // toJSON() returns hex for AccountId, convert to SS58 for comparison let refSS58 = ''; try { - if (data.referrer) refSS58 = encodeAddress(data.referrer, 42); + if (data.referrer) refSS58 = encodeAddress(data.referrer, api.registry.chainSS58 ?? 42); } catch { refSS58 = data.referrer ?? ''; }