Skip to content

Commit

Permalink
fix: update types js (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
tabaktoni authored Jun 23, 2024
1 parent e3ecdca commit 0eba229
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"test": "vitest"
},
"dependencies": {
"starknet-types": "^0.7.1"
"@starknet-io/types-js": "^0.7.7"
},
"devDependencies": {
"c8": "^7.12.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/__test__/wallet.mock.ts
Original file line number Diff line number Diff line change
@@ -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<StarknetWindowObject, "id" | "name" | "icon" | "request">

Expand Down Expand Up @@ -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)
}
Expand All @@ -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 []
}
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/wallet/filter.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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),
),
)
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/wallet/scan.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { StarknetWindowObject } from "starknet-types"
import type { StarknetWindowObject } from "@starknet-io/types-js"

export function scanObjectForWallets(
obj: Record<string, any>,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/wallet/sort.ts
Original file line number Diff line number Diff line change
@@ -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

Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0eba229

Please sign in to comment.