Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Make getAddressType consistent between renders
Browse files Browse the repository at this point in the history
  • Loading branch information
abefernan committed Oct 2, 2024
1 parent 1bb07f0 commit 7df2983
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/chain.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
//TODO - query from chain
export function getAddressType(_address: string) {
if (Math.random() < 0.5) {
return "account";
export function getAddressType(address: string) {
const unprefixedAddress = address.slice(7);

if (unprefixedAddress.includes("i") || unprefixedAddress.includes("u")) {
return "validator";
}

return Math.random() < 0.5 ? "contract" : "validator";
return unprefixedAddress.includes("a") ? "account" : "contract";
}

0 comments on commit 7df2983

Please sign in to comment.