Skip to content

Commit

Permalink
feat: switch to dedicated backend for identicons (#43)
Browse files Browse the repository at this point in the history
* feat: switch to dedicated backend for identicons

* feat: update package version

* test: fix workflow

* test: fix mainnet tests

---------

Co-authored-by: Iris <[email protected]>
  • Loading branch information
Th0rgal and irisdv authored Aug 7, 2024
1 parent 52d4fea commit 030c28d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 3 additions & 3 deletions packages/core/__test__/profile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 8 additions & 4 deletions packages/core/__test__/profile_mainnet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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);
});
Expand Down Expand Up @@ -196,15 +196,19 @@ 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 &&
profiles[2].profilePicture.startsWith("https://img.starkurabu.com"),
).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 &&
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "starknetid.js",
"version": "4.0.0",
"version": "4.0.1",
"keywords": [
"starknet",
"starknetid",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/starknetIdNavigator/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 030c28d

Please sign in to comment.