diff --git a/packages/core/package.json b/packages/core/package.json index cfc76a3..2d343e8 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -30,7 +30,7 @@ "test": "vitest" }, "dependencies": { - "starknet-types": "^0.7.1" + "@starknet-io/types-js": "^0.7.7" }, "devDependencies": { "c8": "^7.12.0", diff --git a/packages/core/src/__test__/wallet.mock.ts b/packages/core/src/__test__/wallet.mock.ts index 87d6ecc..91a2215 100644 --- a/packages/core/src/__test__/wallet.mock.ts +++ b/packages/core/src/__test__/wallet.mock.ts @@ -1,5 +1,5 @@ import wallets from "../discovery" -import { Permission, type StarknetWindowObject } from "starknet-types" +import { Permission, type StarknetWindowObject } from "@starknet-io/types-js" type WalletMock = Pick @@ -47,7 +47,7 @@ export function makeAuthorized(authorized: boolean) { request: async (request) => { switch (request.type) { case "wallet_getPermissions": - return authorized ? [Permission.Accounts] : [] + return authorized ? [Permission.ACCOUNTS] : [] default: return wallet.request(request) } @@ -62,7 +62,7 @@ export function makeConnected(isConnected: boolean) { request: async ({ type }) => { switch (type) { case "wallet_getPermissions": - return isConnected ? [Permission.Accounts] : [] + return isConnected ? [Permission.ACCOUNTS] : [] default: return [] } diff --git a/packages/core/src/main.ts b/packages/core/src/main.ts index 93a458a..046899a 100644 --- a/packages/core/src/main.ts +++ b/packages/core/src/main.ts @@ -6,7 +6,7 @@ import { filterBy, filterByAuthorized } from "./wallet/filter" import { isWalletObj } from "./wallet/isWalletObject" import { scanObjectForWallets } from "./wallet/scan" import { sortBy } from "./wallet/sort" -import { Permission, type StarknetWindowObject } from "starknet-types" +import { Permission, type StarknetWindowObject } from "@starknet-io/types-js" export type { StarknetWindowObject, @@ -29,9 +29,9 @@ export type { NetworkChangeEventHandler, WalletEventHandlers, WalletEvents, -} from "starknet-types" +} from "@starknet-io/types-js" -export { Permission } from "starknet-types" +export { Permission } from "@starknet-io/types-js" export { scanObjectForWallets } from "./wallet/scan" export { isWalletObj } from "./wallet/isWalletObject" @@ -124,7 +124,7 @@ export function getStarknet( const permissions: Permission[] = await wallet.request({ type: "wallet_getPermissions", }) - if (!permissions?.includes(Permission.Accounts)) { + if (!permissions?.includes(Permission.ACCOUNTS)) { throw new Error("Failed to connect to wallet") } lastConnectedStore.set(wallet.id) diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 9d12178..f153015 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -5,7 +5,7 @@ import { Sort } from "./wallet/sort" import type { RequestAccountsParameters, StarknetWindowObject, -} from "starknet-types" +} from "@starknet-io/types-js" export type { WalletProvider } from "./discovery" diff --git a/packages/core/src/wallet/filter.ts b/packages/core/src/wallet/filter.ts index 5ebdb54..d5d43a4 100644 --- a/packages/core/src/wallet/filter.ts +++ b/packages/core/src/wallet/filter.ts @@ -1,5 +1,5 @@ import type { WalletProvider } from "../discovery" -import { Permission, type StarknetWindowObject } from "starknet-types" +import { Permission, type StarknetWindowObject } from "@starknet-io/types-js" export type FilterList = string[] interface FilterByOptions { @@ -35,7 +35,7 @@ export const filterByAuthorized = async ( wallets.map((w) => w .request({ type: "wallet_getPermissions" }) - .then((result: Permission[]) => result.includes(Permission.Accounts)) + .then((result: Permission[]) => result.includes(Permission.ACCOUNTS)) .catch(() => false), ), ) diff --git a/packages/core/src/wallet/scan.ts b/packages/core/src/wallet/scan.ts index c48ad3e..eff7c52 100644 --- a/packages/core/src/wallet/scan.ts +++ b/packages/core/src/wallet/scan.ts @@ -1,4 +1,4 @@ -import type { StarknetWindowObject } from "starknet-types" +import type { StarknetWindowObject } from "@starknet-io/types-js" export function scanObjectForWallets( obj: Record, diff --git a/packages/core/src/wallet/sort.ts b/packages/core/src/wallet/sort.ts index 5443842..f351d30 100644 --- a/packages/core/src/wallet/sort.ts +++ b/packages/core/src/wallet/sort.ts @@ -1,6 +1,6 @@ import { WalletProvider } from "../discovery" import { shuffle } from "../utils" -import { type StarknetWindowObject } from "starknet-types" +import { type StarknetWindowObject } from "@starknet-io/types-js" export type Sort = string[] | "random" | null | undefined diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ea1b239..11e9a7f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -66,9 +66,9 @@ importers: packages/core: dependencies: - starknet-types: - specifier: ^0.7.1 - version: 0.7.1 + '@starknet-io/types-js': + specifier: ^0.7.7 + version: 0.7.7 devDependencies: c8: specifier: ^7.12.0 @@ -1053,6 +1053,10 @@ packages: string-argv: 0.3.2 dev: true + /@starknet-io/types-js@0.7.7: + resolution: {integrity: sha512-WLrpK7LIaIb8Ymxu6KF/6JkGW1sso988DweWu7p5QY/3y7waBIiPvzh27D9bX5KIJNRDyOoOVoHVEKYUYWZ/RQ==} + dev: false + /@sveltejs/vite-plugin-svelte@1.0.1(svelte@3.49.0)(vite@3.0.0): resolution: {integrity: sha512-PorCgUounn0VXcpeJu+hOweZODKmGuLHsLomwqSj+p26IwjjGffmYQfVHtiTWq+NqaUuuHWWG7vPge6UFw4Aeg==} engines: {node: ^14.18.0 || >= 16} @@ -4345,10 +4349,6 @@ packages: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} dev: true - /starknet-types@0.7.1: - resolution: {integrity: sha512-aXLUpJyDXICV84pD33kwrOyuUrtacTIF9rfxtBVTerNo5RjIHaZj5TKCvZ0gQzTzZEcS37mbb4w67YumKKbZwA==} - dev: false - /stream-transform@2.1.3: resolution: {integrity: sha512-9GHUiM5hMiCi6Y03jD2ARC1ettBXkQBoQAe7nJsPknnI0ow10aXjTnew8QtYQmLjzn974BnmWEAJgCY6ZP1DeQ==} dependencies: