Skip to content

Commit

Permalink
Merge pull request #4579 from leather-wallet/release/fund-config
Browse files Browse the repository at this point in the history
Release/fund config
  • Loading branch information
pete-watters authored Nov 28, 2023
2 parents 014b6e7 + e284fae commit b8a36ab
Show file tree
Hide file tree
Showing 608 changed files with 8,868 additions and 9,233 deletions.
15 changes: 8 additions & 7 deletions .dependency-cruiser.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,14 @@ module.exports = {
from: { path: '^src/app/features/.*' },
to: { path: '^src/app/pages/.*' },
},
{
name: 'only-allow-react-icons-fi',
comment: 'Ensure only icons from `fi` group are allowed',
severity: 'error',
from: { path: '^src' },
to: { path: 'react-icons.*', pathNot: 'react-icons/fi' },
},
// TODO: Replace in future with new icon library
// {
// name: 'only-allow-react-icons-fi',
// comment: 'Ensure only icons from `fi` group are allowed',
// severity: 'error',
// from: { path: '^src' },
// to: { path: 'react-icons.*', pathNot: 'react-icons/fi' },
// },
{
name: 'no-using-pino-directly',
comment: 'Enforce use of Pino logging library via @logger wrapper',
Expand Down
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"prettier.documentSelectors": ["src/**/*.{ts,tsx}", "*.{js,json}"],
"vitest.include": ["src/**/*.spec.ts"],
"githubPullRequests.ignoredPullRequestBranches": ["dev"],
"editor.folding": false
"githubPullRequests.ignoredPullRequestBranches": ["dev"]
}
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

Leather is the most popular and trusted wallet for apps built on Bitcoin. Connect to apps and manage assets secured by Bitcoin and Bitcoin L2s with battle-tested wallet for the Stacks blockchain.

To integrate this wallet into your app, we recommend [@stacks/connect](https://github.com/hirosystems/connect).

[📚 See Leather Developer Documentation →](https://leather.gitbook.io/developers/home/welcome)

[📩 Join the mailing list for updates →](https://forms.gle/sdZPu2jbX1AeQ8Fi9)
Expand Down
22 changes: 7 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"dependencies": {
"@bitcoinerlab/secp256k1": "1.0.2",
"@coinbase/cbpay-js": "1.0.2",
"@dlc-link/dlc-tools": "1.0.4",
"@dlc-link/dlc-tools": "1.0.7",
"@fungible-systems/zone-file": "2.0.0",
"@hirosystems/token-metadata-api-client": "1.1.0",
"@ledgerhq/hw-transport-webusb": "6.27.19",
Expand Down Expand Up @@ -153,10 +153,6 @@
"@stacks/rpc-client": "1.0.3",
"@stacks/storage": "6.9.0",
"@stacks/transactions": "6.9.0",
"@stacks/ui": "7.10.0",
"@stacks/ui-core": "7.3.0",
"@stacks/ui-theme": "7.5.0",
"@stacks/ui-utils": "7.5.0",
"@stacks/wallet-sdk": "6.9.0",
"@stitches/react": "1.2.8",
"@styled-system/theme-get": "5.1.2",
Expand Down Expand Up @@ -197,12 +193,12 @@
"limiter": "2.1.0",
"lodash.get": "4.4.2",
"lodash.uniqby": "4.7.0",
"mdi-react": "9.2.0",
"micro-packed": "0.3.2",
"object-hash": "3.0.0",
"observable-hooks": "4.2.3",
"pino": "8.15.4",
"postcss-preset-env": "9.1.4",
"prism-react-renderer": "2.2.0",
"prismjs": "1.29.0",
"promise-memoize": "1.2.1",
"punycode": "2.3.0",
Expand All @@ -213,7 +209,6 @@
"react-dom-confetti": "0.2.0",
"react-head": "3.4.2",
"react-hot-toast": "2.4.1",
"react-icons": "4.10.1",
"react-intersection-observer": "9.5.2",
"react-lottie": "1.2.3",
"react-redux": "8.1.3",
Expand All @@ -235,13 +230,10 @@
},
"devDependencies": {
"@actions/core": "1.10.1",
"@babel/core": "7.23.0",
"@babel/preset-react": "7.22.15",
"@babel/preset-typescript": "7.23.0",
"@btckit/types": "0.0.19",
"@leather-wallet/prettier-config": "0.0.1",
"@ls-lint/ls-lint": "2.1.0",
"@pandacss/dev": "0.17.0",
"@pandacss/dev": "0.18.3",
"@playwright/test": "1.38.1",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
"@redux-devtools/cli": "3.0.2",
Expand Down Expand Up @@ -277,7 +269,6 @@
"@typescript-eslint/parser": "6.7.4",
"@vitest/coverage-istanbul": "0.34.6",
"audit-ci": "6.6.1",
"babel-loader": "9.1.3",
"base64-loader": "1.0.0",
"bip32": "4.0.0",
"blns": "2.0.4",
Expand All @@ -292,7 +283,7 @@
"deepmerge": "4.3.1",
"dependency-cruiser": "14.1.1",
"dotenv-webpack": "8.0.1",
"esbuild": "0.19.4",
"esbuild": "0.19.7",
"esbuild-loader": "4.0.2",
"eslint-plugin-deprecation": "2.0.0",
"eslint-plugin-react": "7.33.2",
Expand Down Expand Up @@ -320,14 +311,15 @@
"vm-browserify": "1.1.2",
"web-ext": "7.8.0",
"web-ext-submit": "7.8.0",
"webpack": "5.88.2",
"webpack-bundle-analyzer": "4.9.1",
"webpack": "5.89.0",
"webpack-bundle-analyzer": "4.10.1",
"webpack-cli": "5.1.4",
"webpack-dev-server": "4.15.1",
"webpack-hot-middleware": "2.25.4",
"webpack-shell-plugin": "0.5.0"
},
"resolutions": {
"nanoid": "3.3.4",
"socket.io-parser": "4.2.4",
"**/**/bn.js": "5.2.1"
},
Expand Down
6 changes: 4 additions & 2 deletions public/assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@

@font-face {
font-family: 'Fira Code';
src: url('/assets/fonts/fira-code/woff2/FiraCode-Light.woff2') format('woff2'),
src:
url('/assets/fonts/fira-code/woff2/FiraCode-Light.woff2') format('woff2'),
url('/assets/fonts/fira-code/woff/FiraCode-Light.woff') format('woff');
font-weight: 300;
font-style: normal;
}

@font-face {
font-family: 'Fira Code';
src: url('/assets/fonts/fira-code/woff2/FiraCode-Regular.woff2') format('woff2'),
src:
url('/assets/fonts/fira-code/woff2/FiraCode-Regular.woff2') format('woff2'),
url('/assets/fonts/fira-code/woff/FiraCode-Regular.woff') format('woff');
font-weight: 400;
font-style: normal;
Expand Down
Binary file removed public/assets/images/bitcoin-stamp.png
Binary file not shown.
Binary file added public/assets/images/stamps-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 0 additions & 8 deletions public/assets/images/wallet-type-ledger.svg

This file was deleted.

11 changes: 5 additions & 6 deletions src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import { Suspense } from 'react';
import { Provider as ReduxProvider } from 'react-redux';

import { radixBaseCSS } from '@radix-ui/themes/styles.css';
import { ThemeProvider } from '@stacks/ui';
import { QueryClientProvider } from '@tanstack/react-query';
import { styled } from 'leather-styles/jsx';
import { PersistGate } from 'redux-persist/integration/react';

import { queryClient } from '@app/common/persistence';
import { theme } from '@app/common/theme';
import { FullPageLoadingSpinner } from '@app/components/loading-spinner';
import { Devtools } from '@app/features/devtool/devtools';
import { AppErrorBoundary } from '@app/features/errors/app-error-boundary';
Expand All @@ -26,8 +25,8 @@ export function App() {
<PersistGate loading={<FullPageLoadingSpinner />} persistor={persistor}>
<HeadProvider />
{/* TODO: this works but investigate importing radixBaseCSS in panda layer config */}
<ThemeProvider theme={theme} css={radixBaseCSS}>
<ThemeSwitcherProvider>
<ThemeSwitcherProvider>
<styled.div css={radixBaseCSS}>
<QueryClientProvider client={queryClient}>
<Suspense fallback={<FullPageLoadingSpinner />}>
<AppErrorBoundary>
Expand All @@ -36,8 +35,8 @@ export function App() {
{reactQueryDevToolsEnabled && <Devtools />}
</Suspense>
</QueryClientProvider>
</ThemeSwitcherProvider>
</ThemeProvider>
</styled.div>
</ThemeSwitcherProvider>
</PersistGate>
</ReduxProvider>
);
Expand Down
35 changes: 6 additions & 29 deletions src/app/common/authentication/use-finish-auth-request.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useCallback } from 'react';

import { bytesToHex } from '@stacks/common';
import {
createWalletGaiaConfig,
getOrCreateWalletConfig,
Expand All @@ -16,13 +15,13 @@ import { useAuthRequestParams } from '@app/common/hooks/auth/use-auth-request-pa
import { useOnboardingState } from '@app/common/hooks/auth/use-onboarding-state';
import { useKeyActions } from '@app/common/hooks/use-key-actions';
import { useWalletType } from '@app/common/use-wallet-type';
import { useNativeSegwitNetworkSigners } from '@app/store/accounts/blockchain/bitcoin/native-segwit-account.hooks';
import { useTaprootNetworkSigners } from '@app/store/accounts/blockchain/bitcoin/taproot-account.hooks';
import {
useLegacyStacksWallet,
useStacksAccounts,
} from '@app/store/accounts/blockchain/stacks/stacks-account.hooks';

import { useGetLegacyAuthBitcoinAddresses } from './use-legacy-auth-bitcoin-addresses';

export function useFinishAuthRequest() {
const { decodedAuthRequest, authRequest, appIcon, appName } = useOnboardingState();
const keyActions = useKeyActions();
Expand All @@ -36,8 +35,7 @@ export function useFinishAuthRequest() {
// TODO: It would be good to separate out finishing auth by the wallet vs an app
// so that the additional data we provide apps can be removed from our onboarding.
// Currently, these create errors unless early returns are used in the keychain code.
const deriveAllNativeSegWitNetworkSigners = useNativeSegwitNetworkSigners();
const deriveAllTaprootNetworkSigners = useTaprootNetworkSigners();
const getLegacyAuthBitcoinData = useGetLegacyAuthBitcoinAddresses();

return useCallback(
async (accountIndex: number) => {
Expand Down Expand Up @@ -75,35 +73,15 @@ export function useFinishAuthRequest() {
},
});

const taprootAccount = deriveAllTaprootNetworkSigners(accountIndex);
const nativeSegwitAccount = deriveAllNativeSegWitNetworkSigners(accountIndex);

const authResponse = await makeAuthResponse({
gaiaHubUrl: gaiaUrl,
appDomain: appURL.origin,
transitPublicKey: decodedAuthRequest.public_keys[0],
scopes: decodedAuthRequest.scopes,
account: account,
additionalData: {
btcAddress: {
p2tr: {
mainnet: taprootAccount.mainnet.payment.address,
testnet: taprootAccount.testnet.payment.address,
regtest: taprootAccount.regtest.payment.address,
signet: taprootAccount.signet.payment.address,
},
p2wpkh: {
mainnet: nativeSegwitAccount.mainnet.payment.address,
testnet: nativeSegwitAccount.testnet.payment.address,
regtest: nativeSegwitAccount.regtest.payment.address,
signet: nativeSegwitAccount.signet.payment.address,
},
},
btcPublicKey: {
p2tr: bytesToHex(taprootAccount.mainnet.keychain.publicKey!),
p2wpkh: bytesToHex(nativeSegwitAccount.mainnet.keychain.publicKey!),
},
walletProvider: 'hiro-wallet',
...getLegacyAuthBitcoinData(accountIndex),
walletProvider: 'leather',
},
});
keyActions.switchAccount(accountIndex);
Expand All @@ -127,8 +105,7 @@ export function useFinishAuthRequest() {
wallet,
appIcon,
appName,
deriveAllTaprootNetworkSigners,
deriveAllNativeSegWitNetworkSigners,
getLegacyAuthBitcoinData,
keyActions,
]
);
Expand Down
35 changes: 35 additions & 0 deletions src/app/common/authentication/use-legacy-auth-bitcoin-addresses.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { bytesToHex } from '@noble/hashes/utils';

import { useNativeSegwitNetworkSigners } from '@app/store/accounts/blockchain/bitcoin/native-segwit-account.hooks';
import { useTaprootNetworkSigners } from '@app/store/accounts/blockchain/bitcoin/taproot-account.hooks';

export function useGetLegacyAuthBitcoinAddresses() {
const deriveAllNativeSegWitNetworkSigners = useNativeSegwitNetworkSigners();
const deriveAllTaprootNetworkSigners = useTaprootNetworkSigners();

return (accountIndex: number) => {
const taprootAccount = deriveAllTaprootNetworkSigners(accountIndex);
const nativeSegwitAccount = deriveAllNativeSegWitNetworkSigners(accountIndex);

return {
btcAddress: {
p2tr: {
mainnet: taprootAccount?.mainnet?.payment.address,
testnet: taprootAccount?.testnet?.payment.address,
regtest: taprootAccount?.regtest?.payment.address,
signet: taprootAccount?.signet?.payment.address,
},
p2wpkh: {
mainnet: nativeSegwitAccount?.mainnet?.payment.address,
testnet: nativeSegwitAccount?.testnet?.payment.address,
regtest: nativeSegwitAccount?.regtest?.payment.address,
signet: nativeSegwitAccount?.signet?.payment.address,
},
},
btcPublicKey: {
p2tr: bytesToHex(taprootAccount?.mainnet?.keychain.publicKey!),
p2wpkh: bytesToHex(nativeSegwitAccount?.mainnet?.keychain.publicKey!),
},
};
};
}
47 changes: 0 additions & 47 deletions src/app/common/hooks/account/use-account-gradient.ts

This file was deleted.

Loading

0 comments on commit b8a36ab

Please sign in to comment.