Skip to content

Commit

Permalink
Merge branch 'ledger-live-updates' into ledger-live-fix-connection-er…
Browse files Browse the repository at this point in the history
…rors
  • Loading branch information
r-czajkowski committed Oct 31, 2024
2 parents e39ed9b + 3657727 commit b473827
Show file tree
Hide file tree
Showing 90 changed files with 3,156 additions and 841 deletions.
3 changes: 1 addition & 2 deletions dapp/.env
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ VITE_ACRE_API_ENDPOINT="http://localhost:8788/api/v1/"
VITE_GELATO_RELAY_API_KEY="htaJCy_XHj8WsE3w53WBMurfySDtjLP_TrNPPa6IPIc_" # this key should not be used on production
# Get the API key from: https://thegraph.com/studio/apikeys/.
VITE_SUBGRAPH_API_KEY=""
# Get the API key from: 1Password.
VITE_MEZO_PORTAL_API_KEY=""

# Feature flags
VITE_FEATURE_FLAG_GAMIFICATION_ENABLED="false"
Expand All @@ -28,4 +26,5 @@ VITE_FEATURE_FLAG_XVERSE_WALLET_ENABLED="false"
VITE_FEATURE_FLAG_BEEHIVE_COMPONENT_ENABLED="false"
VITE_FEATURE_FLAG_ACRE_POINTS_ENABLED="true"
VITE_FEATURE_FLAG_TVL_ENABLED="false"
VITE_FEATURE_GATING_DAPP_ENABLED="true"

Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
"permissions": [
"account.request",
"account.list",
"message.sign",
"transaction.sign",
"transaction.signAndBroadcast",
"bitcoin.getXPub",
"bitcoin.getAddress",
"bitcoin.getPublicKey",
"custom.acre.messageSign",
Expand Down
4 changes: 0 additions & 4 deletions dapp/manifests/ledger-live/ledger-live-manifest-mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
"permissions": [
"account.request",
"account.list",
"message.sign",
"transaction.sign",
"transaction.signAndBroadcast",
"bitcoin.getXPub",
"bitcoin.getAddress",
"bitcoin.getPublicKey",
"custom.acre.messageSign",
Expand Down
8 changes: 2 additions & 6 deletions dapp/manifests/ledger-live/ledger-live-manifest-testnet.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"id": "acre-testnet",
"name": "Acre [testnet]",
"url": "https://ledger-live-updates--acre-dapp-testnet.netlify.app/?embed=ledger-live",
"url": "https://stake.test.acre.fi/?embed=ledger-live",
"homepageUrl": "https:/acre.fi/",
"icon": "https://ledger-live-updates--acre-dapp-testnet.netlify.app/acre.svg",
"icon": "https://stake.test.acre.fi/acre.svg",
"platforms": "desktop",
"apiVersion": "^2.0.0",
"manifestVersion": "2",
Expand All @@ -21,10 +21,6 @@
"permissions": [
"account.request",
"account.list",
"message.sign",
"transaction.sign",
"transaction.signAndBroadcast",
"bitcoin.getXPub",
"bitcoin.getAddress",
"bitcoin.getPublicKey",
"custom.acre.messageSign",
Expand Down
4 changes: 0 additions & 4 deletions dapp/manifests/ledger-live/ledger-manifest-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
"permissions": [
"account.request",
"account.list",
"message.sign",
"transaction.sign",
"transaction.signAndBroadcast",
"bitcoin.getXPub",
"bitcoin.getAddress",
"bitcoin.getPublicKey",
"custom.acre.messageSign",
Expand Down
16 changes: 9 additions & 7 deletions dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"scripts": {
"start": "vite",
"build": "tsc && vite build",
"build": "NODE_OPTIONS=--max-old-space-size=8192 vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"format": "npm run lint:js && npm run lint:config",
Expand All @@ -13,27 +13,28 @@
"lint:js:fix": "eslint . --fix",
"lint:config": "prettier -c '**/*.@(json|yaml|toml)'",
"lint:config:fix": "prettier -w '**/*.@(json|yaml|toml)'",
"test": "vitest",
"test": "vitest --reporter=verbose",
"generate:manifests": "for env in development testnet mainnet; do mustache config/$env.json ./manifests/ledger-live/ledger-manifest-template.json > ./manifests/ledger-live/ledger-live-manifest-$env.json; done"
},
"dependencies": {
"@acre-btc/sdk": "workspace:*",
"@chakra-ui/react": "^2.8.2",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@orangekit/react": "1.0.0-beta.32",
"@orangekit/sign-in-with-wallet": "1.0.0-beta.6",
"@ledgerhq/wallet-api-client": "1.6.0",
"@ledgerhq/wallet-api-acre-module": "0.1.0-nightly.0",
"@ledgerhq/wallet-api-client": "1.6.0",
"@orangekit/react": "1.0.0-beta.33",
"@orangekit/sign-in-with-wallet": "1.0.0-beta.6",
"@reduxjs/toolkit": "^2.2.0",
"@rehooks/local-storage": "^2.4.5",
"@safe-global/safe-core-sdk-types": "^5.0.1",
"@sentry/react": "^7.98.0",
"@sentry/types": "^7.102.0",
"@sentry/react": "^8.34.0",
"@sentry/types": "^8.34.0",
"@tabler/icons-react": "^3.1.0",
"@tanstack/react-query": "^5.40.1",
"@tanstack/react-query-devtools": "^5.49.2",
"axios": "^1.6.7",
"bignumber.js": "^9.1.2",
"ethers": "^6.10.0",
"formik": "^2.4.5",
"framer-motion": "^10.16.5",
Expand All @@ -48,6 +49,7 @@
"wagmi": "^2.9.11"
},
"devDependencies": {
"@sentry/vite-plugin": "^2.22.5",
"@thesis-co/eslint-config": "github:thesis/eslint-config#7b9bc8c",
"@types/react": "^18.2.38",
"@types/react-dom": "^18.2.17",
Expand Down
7 changes: 3 additions & 4 deletions dapp/src/acre-react/contexts/AcreSdkContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useCallback, useMemo, useState } from "react"
import { Acre } from "@acre-btc/sdk"
import { BitcoinProvider } from "@acre-btc/sdk/dist/src/lib/bitcoin/providers"
import { Acre, AcreBitcoinProvider } from "@acre-btc/sdk"
import { BITCOIN_NETWORK, env } from "#/constants"

const { TBTC_API_ENDPOINT, SUBGRAPH_API_KEY } = env
Expand All @@ -9,7 +8,7 @@ const GELATO_API_KEY = env.GELATO_RELAY_API_KEY

type AcreSdkContextValue = {
acre?: Acre
init: (bitcoinProvider?: BitcoinProvider) => Promise<void>
init: (bitcoinProvider?: AcreBitcoinProvider) => Promise<void>
isInitialized: boolean
isConnected: boolean
}
Expand All @@ -27,7 +26,7 @@ export function AcreSdkProvider({ children }: { children: React.ReactNode }) {
const [isConnected, setIsConnected] = useState(false)

const init = useCallback<AcreSdkContextValue["init"]>(
async (bitcoinProvider?: BitcoinProvider) => {
async (bitcoinProvider?: AcreBitcoinProvider) => {
let sdk = await Acre.initialize(
BITCOIN_NETWORK,
TBTC_API_ENDPOINT,
Expand Down
88 changes: 88 additions & 0 deletions dapp/src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import React from "react"
import {
Box,
useMultiStyleConfig,
List,
ListItem,
LinkProps,
Link,
Button,
Icon,
} from "@chakra-ui/react"
import { EXTERNAL_HREF } from "#/constants"
import { AcreSignIcon, ArrowUpRight } from "#/assets/icons"

type FooterListItem = Pick<LinkProps, "href" | "children">

const NAVIGATION: FooterListItem[] = [
{
children: "Acre.fi",
href: EXTERNAL_HREF.WEBSITE,
},
{
children: "Docs",
href: EXTERNAL_HREF.DOCS,
},
{
children: "FAQ",
href: EXTERNAL_HREF.FAQ,
},
{
children: "Blog",
href: EXTERNAL_HREF.BLOG,
},
{
children: "Discord",
href: EXTERNAL_HREF.DISCORD,
},
{
children: "X",
href: EXTERNAL_HREF.X,
},
]

const DOCUMENTS: FooterListItem[] = [
{
children: "Privacy Policy",
href: EXTERNAL_HREF.PRIVACY_POLICY,
},
{
children: "Terms of Use",
href: EXTERNAL_HREF.TERMS_OF_USE,
},
]

const getItemsList = (
items: FooterListItem[],
styles: ReturnType<typeof useMultiStyleConfig>,
) => (
<List __css={styles.list}>
{items.map((link) => (
<ListItem key={link.href}>
<Button
as={Link}
__css={styles.link}
iconSpacing={0}
rightIcon={<Icon as={ArrowUpRight} />}
{...link}
isExternal
/>
</ListItem>
))}
</List>
)

export default function Footer() {
const styles = useMultiStyleConfig("Footer")

return (
<Box as="footer" __css={styles.container}>
<Box __css={styles.wrapper}>
<AcreSignIcon __css={styles.logo} />

{getItemsList(NAVIGATION, styles)}
{getItemsList(DOCUMENTS, styles)}
</Box>
</Box>
)
}
49 changes: 49 additions & 0 deletions dapp/src/components/GateModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React, { useCallback } from "react"
import { Link, ModalBody, ModalFooter, ModalHeader } from "@chakra-ui/react"
import { TextSm } from "#/components/shared/Typography"
import { EXTERNAL_HREF } from "#/constants"
import { BaseModalProps } from "#/types"
import { useAccessCode } from "#/hooks"
import withBaseModal from "./ModalRoot/withBaseModal"
import PasswordForm from "./shared/PasswordForm"
import { PasswordFormValues } from "./shared/PasswordForm/PasswordFormBase"

export function GateModalBase({ closeModal }: BaseModalProps) {
const { saveAccessCode } = useAccessCode()

const onSubmitForm = useCallback(
(values: PasswordFormValues) => {
const { password } = values
if (!password) return

closeModal()
saveAccessCode(password)
},
[closeModal, saveAccessCode],
)

return (
<>
<ModalHeader>Enter password</ModalHeader>
<ModalBody>
<PasswordForm submitButtonText="Connect" onSubmitForm={onSubmitForm} />
</ModalBody>
<ModalFooter pt={0}>
<TextSm>
Don’t have a password? Contact us on{" "}
<Link
fontWeight="bold"
textDecoration="underline"
href={EXTERNAL_HREF.DISCORD}
isExternal
>
Discord
</Link>
</TextSm>
</ModalFooter>
</>
)
}

const GateModal = withBaseModal(GateModalBase, { closeOnEsc: false })
export default GateModal
30 changes: 0 additions & 30 deletions dapp/src/components/Header/Navigation/Navigation.tsx

This file was deleted.

44 changes: 0 additions & 44 deletions dapp/src/components/Header/Navigation/NavigationItem.tsx

This file was deleted.

1 change: 0 additions & 1 deletion dapp/src/components/Header/Navigation/index.ts

This file was deleted.

Loading

0 comments on commit b473827

Please sign in to comment.