Skip to content

Commit

Permalink
Merge pull request #41 from starknet-id/chore/update_starknetjs_v6
Browse files Browse the repository at this point in the history
chore: update starknet.js to v6
  • Loading branch information
Th0rgal authored Jun 28, 2024
2 parents a40b88e + a2bab79 commit 52d4fea
Show file tree
Hide file tree
Showing 11 changed files with 1,168 additions and 1,748 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "starknetid.js",
"version": "3.2.2",
"version": "4.0.0",
"description": "JavaScript library for Starknet ID",
"private": false,
"license": "MIT",
Expand Down Expand Up @@ -53,7 +53,7 @@
},
"peerDependencies": {
"@babel/core": "^7.0.0-0",
"starknet": "^5.25.0"
"starknet": "^6.9.0"
},
"files": [
"packages/core/dist",
Expand Down
60 changes: 30 additions & 30 deletions packages/core/__test__/default.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Account, num, shortString, constants } from "starknet";
import { StarknetIdNavigator } from "../src";
import { StarknetChainId, StarknetIdNavigator } from "../src";
import {
compiledIdentitySierra,
compiledIdentitySierraCasm,
Expand Down Expand Up @@ -115,7 +115,7 @@ describe("test starknetid.js sdk", () => {
test("getAddressFromStarkName should return account.address", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -131,7 +131,7 @@ describe("test starknetid.js sdk", () => {
test("getStarkName should return ben.stark", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -145,7 +145,7 @@ describe("test starknetid.js sdk", () => {
test("getStarkNames should work", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -163,7 +163,7 @@ describe("test starknetid.js sdk", () => {
test("getStarkNames with addresses that don't have domains should work", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -185,7 +185,7 @@ describe("test starknetid.js sdk", () => {
test("getStarknetId should return id 1 for ben.stark", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -199,7 +199,7 @@ describe("test starknetid.js sdk", () => {
test("Should fail because contractAddress not deployed", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
);
expect(starknetIdNavigator).toBeInstanceOf(StarknetIdNavigator);

Expand All @@ -211,7 +211,7 @@ describe("test starknetid.js sdk", () => {
test("getAddressFromStarkName should fail because domain does not exist", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -227,7 +227,7 @@ describe("test starknetid.js sdk", () => {
test("getStarkName should fail because address has no starkname", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down Expand Up @@ -281,7 +281,7 @@ describe("test starknetid.js sdk", () => {
test("getUserData from id should succeed", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
identity: IdentityContract,
naming: NamingContract,
Expand All @@ -298,7 +298,7 @@ describe("test starknetid.js sdk", () => {
test("getUserData from domain should succeed", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -318,7 +318,7 @@ describe("test starknetid.js sdk", () => {
test("getUserData from address should succeed", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -338,7 +338,7 @@ describe("test starknetid.js sdk", () => {
test("getUserExtentedData should return user extended data", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down Expand Up @@ -366,7 +366,7 @@ describe("test starknetid.js sdk", () => {
test("getUserUnboundedData should return user unbounded data", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down Expand Up @@ -394,7 +394,7 @@ describe("test starknetid.js sdk", () => {
test("Should fail because identity contract not deployed", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
);
expect(starknetIdNavigator).toBeInstanceOf(StarknetIdNavigator);

Expand All @@ -406,7 +406,7 @@ describe("test starknetid.js sdk", () => {
test("getUserData should return 0x0 when id does not exist", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -421,7 +421,7 @@ describe("test starknetid.js sdk", () => {
test("getUserExtentedData should succeed even with wrong lenth", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down Expand Up @@ -452,7 +452,7 @@ describe("test starknetid.js sdk", () => {
test("getUserData should return 0x0 when field does not exist", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down Expand Up @@ -505,7 +505,7 @@ describe("test starknetid.js sdk", () => {
expect(otherAccount).toBeInstanceOf(Account);
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -526,7 +526,7 @@ describe("test starknetid.js sdk", () => {
test("getVerifierData from domain should succeed", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -547,7 +547,7 @@ describe("test starknetid.js sdk", () => {
test("getVerifierData from hex address should succeed", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -568,7 +568,7 @@ describe("test starknetid.js sdk", () => {
test("getVerifierExtendedData should succeed", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down Expand Up @@ -598,7 +598,7 @@ describe("test starknetid.js sdk", () => {
test("getVerifierUnboundedData should succeed", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down Expand Up @@ -627,7 +627,7 @@ describe("test starknetid.js sdk", () => {
test("getVerifierData should fail because identity contract not deployed", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
);
expect(starknetIdNavigator).toBeInstanceOf(StarknetIdNavigator);

Expand All @@ -643,7 +643,7 @@ describe("test starknetid.js sdk", () => {
test("getVerifierData should return 0x0 in case verifier contract is not deployed", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -661,7 +661,7 @@ describe("test starknetid.js sdk", () => {
test("getVerifierData should return 0x0 when field in custom verifier contract does not exist", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -680,7 +680,7 @@ describe("test starknetid.js sdk", () => {
test("getVerifierData should return 0x0 when id does not exist", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down Expand Up @@ -736,7 +736,7 @@ describe("test starknetid.js sdk", () => {
expect(otherAccount).toBeInstanceOf(Account);
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -755,7 +755,7 @@ describe("test starknetid.js sdk", () => {
expect(otherAccount).toBeInstanceOf(Account);
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand All @@ -774,7 +774,7 @@ describe("test starknetid.js sdk", () => {
expect(otherAccount).toBeInstanceOf(Account);
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down
22 changes: 11 additions & 11 deletions packages/core/__test__/profile.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Account, shortString, constants } from "starknet";
import { StarknetIdNavigator } from "../src";
import { StarknetChainId, StarknetIdNavigator } from "../src";
import {
compiledErc721Sierra,
compiledErc721SierraCasm,
Expand Down Expand Up @@ -196,7 +196,7 @@ describe("test starknetid.js sdk", () => {
beforeEach(() => {
(getMulticallContract as jest.Mock).mockImplementation(
(chainId: constants.StarknetChainId) => {
if (chainId === constants.StarknetChainId.SN_GOERLI) {
if (chainId === StarknetChainId.SN_SEPOLIA) {
return MulticallContract;
}
},
Expand All @@ -209,7 +209,7 @@ describe("test starknetid.js sdk", () => {
test("getProfileData should return an undefined profile picture url", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down Expand Up @@ -237,7 +237,7 @@ describe("test starknetid.js sdk", () => {
test("getProfileData should return an identicon url", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down Expand Up @@ -310,7 +310,7 @@ describe("test starknetid.js sdk", () => {
});
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down Expand Up @@ -341,21 +341,21 @@ describe("test starknetid.js sdk", () => {
beforeEach(() => {
(getMulticallContract as jest.Mock).mockImplementation(
(chainId: constants.StarknetChainId) => {
if (chainId === constants.StarknetChainId.SN_GOERLI) {
if (chainId === StarknetChainId.SN_SEPOLIA) {
return MulticallContract;
}
},
);
(getUtilsMulticallContract as jest.Mock).mockImplementation(
(chainId: constants.StarknetChainId) => {
if (chainId === constants.StarknetChainId.SN_GOERLI) {
if (chainId === StarknetChainId.SN_SEPOLIA) {
return UtilsMulticallContract;
}
},
);
(getBlobbertContract as jest.Mock).mockImplementation(
(chainId: constants.StarknetChainId) => {
if (chainId === constants.StarknetChainId.SN_GOERLI) {
if (chainId === StarknetChainId.SN_SEPOLIA) {
return NFTContract2;
}
},
Expand Down Expand Up @@ -409,7 +409,7 @@ describe("test starknetid.js sdk", () => {
test("getStarkProfiles with useDefaultPfp enabled", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down Expand Up @@ -442,7 +442,7 @@ describe("test starknetid.js sdk", () => {
test("getStarkProfiles with useDefaultPfp disabled", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down Expand Up @@ -553,7 +553,7 @@ describe("test starknetid.js sdk", () => {
test("getStarkProfiles with with an undefined NFT metadata", async () => {
const starknetIdNavigator = new StarknetIdNavigator(
provider,
constants.StarknetChainId.SN_GOERLI,
StarknetChainId.SN_SEPOLIA,
{
naming: NamingContract,
identity: IdentityContract,
Expand Down
Loading

0 comments on commit 52d4fea

Please sign in to comment.