-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hieu.ha
committed
Jan 9, 2025
1 parent
7812a68
commit 446e97e
Showing
10 changed files
with
531 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules/starknet/package.json | ||
|
||
"browser": "dist/index.global.js", | ||
=> | ||
"browser": "dist/index.js", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"use client"; | ||
import { sepolia, mainnet } from "@starknet-react/chains"; | ||
import { | ||
StarknetConfig, | ||
publicProvider, | ||
argent, | ||
braavos, | ||
useInjectedConnectors, | ||
voyager, | ||
} from "@starknet-react/core"; | ||
import React from "react"; | ||
|
||
export function StarknetProvider({ children }: { children: React.ReactNode }) { | ||
const { connectors } = useInjectedConnectors({ | ||
// Show these connectors if the user has no connector installed. | ||
recommended: [argent(), braavos()], | ||
// Hide recommended connectors if the user has any connector installed. | ||
includeRecommended: "onlyIfNoConnectors", | ||
// Randomize the order of the connectors. | ||
order: "random", | ||
}); | ||
|
||
return ( | ||
<StarknetConfig | ||
chains={[mainnet, sepolia]} | ||
provider={publicProvider()} | ||
connectors={connectors} | ||
explorer={voyager} | ||
> | ||
{children} | ||
</StarknetConfig> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { ScreenContainer } from "@/components/ScreenContainer"; | ||
import { PrimaryButton } from "@/components/buttons/PrimaryButton"; | ||
import { useCairoTodos } from "./useCairoTodos"; | ||
import { TertiaryBox } from "@/components/boxes/TertiaryBox"; | ||
import { BrandText } from "@/components/BrandText"; | ||
import { Todo } from "./types"; | ||
|
||
export const CairoPOCScreen = () => { | ||
const { data: todos, isLoading } = useCairoTodos(); | ||
|
||
return ( | ||
<ScreenContainer> | ||
<PrimaryButton text="Add Todo" /> | ||
|
||
{todos?.map((todo: Todo, idx) => { | ||
return ( | ||
<TertiaryBox key={idx} style={{ marginTop: 12 }}> | ||
<BrandText | ||
style={[ | ||
{ fontSize: 16, paddingHorizontal: 16, paddingVertical: 4 }, | ||
todo.isDone && { | ||
textDecorationLine: "line-through", | ||
textDecorationStyle: "solid", | ||
color: "#666", | ||
fontStyle: "italic", | ||
}, | ||
]} | ||
> | ||
{todo.title} | ||
</BrandText> | ||
</TertiaryBox> | ||
); | ||
})} | ||
</ScreenContainer> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type Todo = { | ||
title: string; | ||
isDone?: boolean; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { useQuery } from "@tanstack/react-query"; | ||
|
||
export const useCairoTodos = () => { | ||
return useQuery(["useCairoTodos"], async () => { | ||
return [ | ||
{ title: "task1", isDone: false }, | ||
{ title: "task2", isDone: false }, | ||
{ title: "task3", isDone: true }, | ||
]; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.