-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add web wallet * fix: ordering wallet & move functions to utils * test: browserService * feat: add quiz imgs * fix: task opens on click verify button * fix: connectors as any (#240) --------- Co-authored-by: nicolasito1411 <[email protected]> Co-authored-by: Fricoben <[email protected]>
- Loading branch information
1 parent
4a21aa4
commit 07f65b2
Showing
12 changed files
with
152 additions
and
13 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
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
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 { useEffect, useState } from "react"; | ||
import { WalletProvider } from "get-starknet-core"; | ||
import { getBrowser } from "../utils/browserService"; | ||
|
||
export default function useGetDiscoveryWallets( | ||
getDiscoveryWallets: Promise<WalletProvider[]> | ||
) { | ||
const [argentX, setArgentX] = useState<string>(""); | ||
const [braavos, setBraavos] = useState<string>(""); | ||
|
||
useEffect(() => { | ||
if (typeof navigator !== "undefined") { | ||
getDiscoveryWallets.then((wallets) => { | ||
const browser = getBrowser(navigator.userAgent); | ||
|
||
wallets.map((wallet) => { | ||
if (wallet.id === "argentX") { | ||
setArgentX( | ||
browser | ||
? wallet.downloads[browser as keyof typeof wallet.downloads] | ||
: "https://www.argent.xyz/argent-x/" | ||
); | ||
} else if (wallet.id === "braavos") { | ||
setBraavos( | ||
browser | ||
? wallet.downloads[browser as keyof typeof wallet.downloads] | ||
: "https://braavos.app/download-braavos-wallet/" | ||
); | ||
} | ||
}); | ||
}); | ||
} | ||
}, [getDiscoveryWallets]); | ||
|
||
return { argentX, braavos }; | ||
} |
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,28 @@ | ||
import { | ||
getBrowser, | ||
} from "../../utils/browserService"; | ||
|
||
describe("Should test getBrowser function", () => { | ||
it("Should return Chrome", () => { | ||
expect( | ||
getBrowser( | ||
"userAgent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36" | ||
) | ||
).toEqual( | ||
"chrome" | ||
); | ||
}); | ||
|
||
it("Should return firefox", () => { | ||
expect( | ||
getBrowser( | ||
"userAgent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/116.0" | ||
) | ||
).toEqual("firefox"); | ||
}); | ||
|
||
it("Should return an undefined if it's another browser or an empty string", () => { | ||
expect(getBrowser("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15")).toEqual(undefined); | ||
expect(getBrowser("")).toEqual(undefined); | ||
}); | ||
}); |
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,9 @@ | ||
export function getBrowser(userAgent: string): string | undefined { | ||
if (userAgent.includes("Chrome")) { | ||
return "chrome"; | ||
} else if (userAgent.includes("Firefox")) { | ||
return "firefox"; | ||
} else { | ||
return undefined; | ||
} | ||
} |
07f65b2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
starknet-quest – ./
starknet-quest-starknetid.vercel.app
starknet-quest-git-mainnet-starknetid.vercel.app
starknetquest.vercel.app
www.starknet.quest
starknet.quest