Add nprofile property to profile model
This commit is contained in:
parent
b7eccde9d0
commit
7aebcfc43f
@ -59,6 +59,13 @@ export default class Profile {
|
||||
return nip19.npubEncode(this.pubkey);
|
||||
}
|
||||
|
||||
get nprofile(): string {
|
||||
return nip19.nprofileEncode({
|
||||
pubkey: this.pubkey,
|
||||
relays: [config.relay_urls[0]],
|
||||
});
|
||||
}
|
||||
|
||||
get profileUrl(): string {
|
||||
return `${config.base_url}/@${this.username}`;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ describe("Article", () => {
|
||||
describe("#naddr", () => {
|
||||
it("returns a bech32 addressable event ID", () => {
|
||||
expect(article.naddr).toMatch(
|
||||
/naddr1qvzqqqr4gupzq8meqkx80g3yuklzymy0qf/,
|
||||
/^naddr1qvzqqqr4gupzq8meqkx80g3yuklzymy0qf/,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -40,4 +40,12 @@ describe("Profile", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#nprofile", () => {
|
||||
it("returns a bech32 profile ID", () => {
|
||||
expect(profile.nprofile).toMatch(
|
||||
/^nprofile1qyt8wumn8ghj7mn0wd68ytntdaek6mmn9ehhyecqyq0hjpvvw73zfed7yf/,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user