Skip to content

Commit

Permalink
Trigger CI for NameGuard SDK (#449)
Browse files Browse the repository at this point in the history
* Trigger CI for NameGuard SDK

* Fix Logic and Unit Tests Related to Failure of cb.id primary names

---------

Co-authored-by: djstrong <[email protected]>
  • Loading branch information
lightwalker-eth and djstrong authored Oct 24, 2024
1 parent 8883082 commit 0f5efb8
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
3 changes: 3 additions & 0 deletions apps/examples.nameguard.io/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const messages = [
{
address: "0xFD9eE68000Dc92aa6c67F8f6EB5d9d1a24086fAd",
},
{
address: "0x9d32572997DA4948063E3Fc11c2552Eb82F7208E",
},
{
address: "0xfA9A134f997b3d48e122d043E12d04E909b11073",
},
Expand Down
1 change: 1 addition & 0 deletions packages/nameguard-js/src/impersonation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe("Impersonation", () => {
expect(computeImpersonationStatus("vitalik.eth")).toBe("unlikely");
expect(computeImpersonationStatus("vitalìk.eth")).toBe("potential");
expect(computeImpersonationStatus("٧٣٧.eth")).toBe("unlikely");
expect(computeImpersonationStatus("poet.base.eth")).toBe("unlikely");
expect(computeImpersonationStatus("exampleprimary.cb.id")).toBe("unlikely");
expect(computeImpersonationStatus("888‍‍.eth")).toBe("potential");
expect(computeImpersonationStatus("‍‍❤‍‍.eth")).toBe("potential");
Expand Down
18 changes: 14 additions & 4 deletions packages/nameguard-js/src/secureprimaryName.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,23 @@ describe("secure primary name", () => {
],
[
"0xFD9eE68000Dc92aa6c67F8f6EB5d9d1a24086fAd",
null,
"no_primary_name",
null,
'Unnamed fd9e',
null,
false,
null,
],
[
"0x9d32572997DA4948063E3Fc11c2552Eb82F7208E",
"unlikely",
"normalized",
"exampleprimary.cb.id",
"exampleprimary.cb.id",
"exampleprimary.cb.id",
"poet.base.eth",
"poet.base.eth",
"poet.base.eth",
false,
"exampleprimary.cb.id",
"poet.base.eth",
],
[
'0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96046',
Expand Down
10 changes: 5 additions & 5 deletions packages/nameguard-sdk/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,17 @@ describe("NameGuard", () => {

it("getSecurePrimaryName: normalized - unlikely impersonation - offchain name", async () => {
const data = await nameguard.getSecurePrimaryName(
"0xFD9eE68000Dc92aa6c67F8f6EB5d9d1a24086fAd",
"0x9d32572997DA4948063E3Fc11c2552Eb82F7208E",
{ returnNameGuardReport: true },
);

expect(data.primary_name_status).toBe("normalized");
expect(data.impersonation_status).toBe("unlikely");
expect(data.primary_name).toBe("exampleprimary.cb.id");
expect(data.display_name).toBe("exampleprimary.cb.id");
expect(data.primary_name).toBe("poet.base.eth");
expect(data.display_name).toBe("poet.base.eth");
expect(data.nameguard_report).not.toBeNull();
expect(data.nameguard_report?.name).toBe("exampleprimary.cb.id");
expect(data.nameguard_report?.canonical_name).toBe("exampleprimary.cb.id");
expect(data.nameguard_report?.name).toBe("poet.base.eth");
expect(data.nameguard_report?.canonical_name).toBe("poet.base.eth");
});

it("getSecurePrimaryName: no primary name", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/nameguard-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ export class NameGuard {
* Returns `display_name` to be shown to users and estimates `impersonation_status`
*
* If `address` has a primary name and `options.returnNameGuardReport` is `true`, then NameGuard will attempt to inspect that primary name. Else, NameGuard will not perform any primary name inspection and the returned `nameguard_report` field will be `null`.
*
*
* @param {string} address An Ethereum address.
* @param {SecurePrimaryNameOptions} options The options for the secure primary name.
* @returns {Promise<SecurePrimaryNameResult>} A promise that resolves with a `SecurePrimaryNameResult`.
Expand Down

0 comments on commit 0f5efb8

Please sign in to comment.