From 030c28d0fbaa4173c8b238b5de8bf0a1f70e2419 Mon Sep 17 00:00:00 2001 From: Thomas Marchand Date: Wed, 7 Aug 2024 08:40:27 +0100 Subject: [PATCH] feat: switch to dedicated backend for identicons (#43) * feat: switch to dedicated backend for identicons * feat: update package version * test: fix workflow * test: fix mainnet tests --------- Co-authored-by: Iris --- .github/workflows/main.yml | 4 ++-- package.json | 2 +- packages/core/__test__/profile.test.ts | 6 +++--- packages/core/__test__/profile_mainnet.test.ts | 12 ++++++++---- packages/core/package.json | 2 +- packages/core/src/starknetIdNavigator/default.ts | 4 ++-- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5ea1f6b..f4e0086 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,9 +23,9 @@ jobs: uses: actions/setup-node@v1 with: node-version: 19.4.0 - - uses: pnpm/action-setup@v2.2.2 + - uses: pnpm/action-setup@v4 with: - version: 7.1.7 + version: 8.15.3 - name: Install dependencies run: pnpm install --strict-peer-dependencies=false --no-frozen-lockfile - name: Print project structure diff --git a/package.json b/package.json index 3f2c760..9d93211 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "starknetid.js", - "version": "4.0.0", + "version": "4.0.1", "description": "JavaScript library for Starknet ID", "private": false, "license": "MIT", diff --git a/packages/core/__test__/profile.test.ts b/packages/core/__test__/profile.test.ts index 169a78f..ca1a84c 100644 --- a/packages/core/__test__/profile.test.ts +++ b/packages/core/__test__/profile.test.ts @@ -257,7 +257,7 @@ describe("test starknetid.js sdk", () => { github: undefined, discord: "123", proofOfPersonhood: false, - profilePicture: "https://starknet.id/api/identicons/1", + profilePicture: "https://identicon.starknet.id/1", }; expect(profile).toStrictEqual(expectedProfile); }); @@ -429,11 +429,11 @@ describe("test starknetid.js sdk", () => { }, { name: "test.stark", - profilePicture: "https://starknet.id/api/identicons/2", + profilePicture: "https://identicon.starknet.id/2", }, { name: undefined, - profilePicture: "https://starknet.id/api/identicons/0", + profilePicture: "https://identicon.starknet.id/0", }, ]; expect(profiles).toStrictEqual(expectedProfiles); diff --git a/packages/core/__test__/profile_mainnet.test.ts b/packages/core/__test__/profile_mainnet.test.ts index da7ec3a..21d3022 100644 --- a/packages/core/__test__/profile_mainnet.test.ts +++ b/packages/core/__test__/profile_mainnet.test.ts @@ -111,7 +111,7 @@ describe("test starknetid.js sdk on mainnet", () => { github: undefined, discord: undefined, proofOfPersonhood: false, - profilePicture: "https://starknet.id/api/identicons/0", + profilePicture: "https://identicon.starknet.id/0", }; expect(profile).toStrictEqual(expectedProfile); }); @@ -131,7 +131,7 @@ describe("test starknetid.js sdk on mainnet", () => { github: undefined, discord: undefined, proofOfPersonhood: false, - profilePicture: "https://starknet.id/api/identicons/0", + profilePicture: "https://identicon.starknet.id/0", }; expect(profile).toStrictEqual(expectedProfile); }); @@ -196,7 +196,9 @@ describe("test starknetid.js sdk on mainnet", () => { ).toBeTruthy(); expect( profiles[1].profilePicture && - profiles[1].profilePicture.startsWith("https://starknet.id"), + profiles[1].profilePicture.startsWith( + "https://identicon.starknet.id", + ), ).toBeTruthy(); expect( profiles[2].profilePicture && @@ -204,7 +206,9 @@ describe("test starknetid.js sdk on mainnet", () => { ).toBeTruthy(); expect( profiles[3].profilePicture && - profiles[3].profilePicture.startsWith("https://starknet.id"), + profiles[3].profilePicture.startsWith( + "https://identicon.starknet.id", + ), ).toBeTruthy(); expect( profiles[4].profilePicture && diff --git a/packages/core/package.json b/packages/core/package.json index 603fd49..5a554f3 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "starknetid.js", - "version": "4.0.0", + "version": "4.0.1", "keywords": [ "starknet", "starknetid", diff --git a/packages/core/src/starknetIdNavigator/default.ts b/packages/core/src/starknetIdNavigator/default.ts index 32aa59c..4118f0c 100644 --- a/packages/core/src/starknetIdNavigator/default.ts +++ b/packages/core/src/starknetIdNavigator/default.ts @@ -520,7 +520,7 @@ export class StarknetIdNavigator implements StarknetIdNavigatorInterface { ? parseBase64Image(profilePictureMetadata) : await fetchImageUrl(profilePictureMetadata) : useDefaultPfp - ? `https://starknet.id/api/identicons/${data[1][0].toString()}` + ? `https://identicon.starknet.id/${data[1][0].toString()}` : undefined; return { @@ -611,7 +611,7 @@ export class StarknetIdNavigator implements StarknetIdNavigatorInterface { ? parseBase64Image(profilePictureMetadata) : await fetchImageUrl(profilePictureMetadata) : useDefaultPfp - ? `https://starknet.id/api/identicons/${callResult[ + ? `https://identicon.starknet.id/${callResult[ i * nbInstructions + 1 ][0].toString()}` // result of domain_to_id : undefined;