Skip to content

Commit

Permalink
get identity name
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosala committed Aug 21, 2024
1 parent 99ce15a commit cf4a04f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/api/delegation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SS58String } from "polkadot-api"
import { polkadotApi as api } from "./"
import { Binary, SS58String } from "polkadot-api"
import { polkadotApi as api, polkadotPeopleApi } from "./"
import { MultiAddress, VotingConviction } from "@polkadot-api/descriptors"

export const getOptimalAmount = async (
Expand Down Expand Up @@ -96,6 +96,12 @@ const getTrackInfo = async (
)
}

export const getAddressName = async (addr: string): Promise<string> => {
const id = await polkadotPeopleApi.query.Identity.IdentityOf.getValue(addr)
if (id == null || id[0].info.display.value == null) return addr
return id[0].info.display.value.asText()
}

export const delegate = async (
from: SS58String,
target: SS58String,
Expand Down

0 comments on commit cf4a04f

Please sign in to comment.