Skip to content

Commit

Permalink
refactor: blockchain model
Browse files Browse the repository at this point in the history
  • Loading branch information
fbwoolf committed Sep 23, 2024
1 parent e415be9 commit 6bbb1fa
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"@leather.io/bitcoin": "0.12.2",
"@leather.io/constants": "0.10.0",
"@leather.io/crypto": "1.5.2",
"@leather.io/models": "0.14.0",
"@leather.io/models": "0.15.0",
"@leather.io/query": "2.11.0",
"@leather.io/stacks": "1.1.2",
"@leather.io/tokens": "0.9.0",
Expand Down
21 changes: 15 additions & 6 deletions pnpm-lock.yaml

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

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { AddressTransactionWithTransfers } from '@stacks/stacks-blockchain-api-types';

import type { BitcoinTx, Blockchains } from '@leather.io/models';
import type { BitcoinTx, Blockchain } from '@leather.io/models';

export interface TransactionListBitcoinTx {
blockchain: Extract<Blockchains, 'bitcoin'>;
blockchain: Extract<Blockchain, 'bitcoin'>;
transaction: BitcoinTx;
}

export interface TransactionListStacksTx {
blockchain: Extract<Blockchains, 'stacks'>;
blockchain: Extract<Blockchain, 'stacks'>;
transaction: AddressTransactionWithTransfers;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useNavigate } from 'react-router-dom';

import { styled } from 'leather-styles/jsx';

import type { Blockchains } from '@leather.io/models';
import type { Blockchain } from '@leather.io/models';
import { Button, LedgerIcon } from '@leather.io/ui';

import { RouteUrls } from '@shared/route-urls';
Expand All @@ -11,7 +11,7 @@ import { capitalize } from '@app/common/utils';
import { immediatelyAttemptLedgerConnection } from '@app/features/ledger/hooks/use-when-reattempt-ledger-connection';

interface ConnectLedgerButtonProps {
chain: Blockchains;
chain: Blockchain;
}
export function ConnectLedgerButton({ chain }: ConnectLedgerButtonProps) {
const navigate = useNavigate();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type React from 'react';

import type { Blockchains, Currency } from '@leather.io/models';
import type { Blockchain, Currency } from '@leather.io/models';
import { ItemLayout, Pressable } from '@leather.io/ui';

import { capitalize } from '@app/common/utils';
Expand All @@ -10,7 +10,7 @@ import type { AssetListVariant } from '../asset-list';
import { ConnectLedgerButton } from './connect-ledger-asset-button';

interface ConnectLedgerAssetItemFallbackProps {
chain: Blockchains;
chain: Blockchain;
icon: React.ReactNode;
symbol: Currency;
variant: AssetListVariant;
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/fund/components/fund.layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Stack, styled } from 'leather-styles/jsx';

import type { Blockchains, CryptoCurrency } from '@leather.io/models';
import type { Blockchain, CryptoCurrency } from '@leather.io/models';

import { HasChildren } from '@app/common/has-children';

interface FundLayoutProps extends HasChildren {
blockchain: Blockchains;
blockchain: Blockchain;
symbol: CryptoCurrency;
}
export function FundLayout({ blockchain, symbol, children }: FundLayoutProps) {
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/fund/fund.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Outlet, useParams } from 'react-router-dom';

import type {
Blockchains,
Blockchain,
BtcCryptoAssetBalance,
CryptoCurrency,
StxCryptoAssetBalance,
Expand All @@ -21,7 +21,7 @@ import { FiatProvidersList } from './fiat-providers-list';
interface FundCryptoCurrencyInfo {
address?: string;
balance?: BtcCryptoAssetBalance | StxCryptoAssetBalance;
blockchain: Blockchains;
blockchain: Blockchain;
route: string;
symbol: CryptoCurrency;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useLocation, useNavigate } from 'react-router-dom';
import { Box, Flex, HStack, Stack } from 'leather-styles/jsx';
import get from 'lodash.get';

import type { Blockchains, Inscription } from '@leather.io/models';
import type { Blockchain, Inscription } from '@leather.io/models';
import { CheckmarkIcon, CopyIcon, ExternalLinkIcon, Sheet, SheetHeader } from '@leather.io/ui';

import { RouteUrls } from '@shared/route-urls';
Expand Down Expand Up @@ -35,7 +35,7 @@ export function SendInscriptionSummary() {
const toast = useToast();
const navigate = useNavigate();
const txLink = {
blockchain: 'bitcoin' as Blockchains,
blockchain: 'bitcoin' as Blockchain,
txid,
};

Expand Down
4 changes: 2 additions & 2 deletions src/app/store/accounts/blockchain/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback } from 'react';

import type { Blockchains } from '@leather.io/models';
import type { Blockchain } from '@leather.io/models';

import { useHasCurrentBitcoinAccount } from './bitcoin/bitcoin.hooks';
import { useHasStacksLedgerKeychain } from './stacks/stacks.hooks';
Expand All @@ -12,7 +12,7 @@ export function useCheckLedgerBlockchainAvailable() {
const hasStacksLedgerKeys = useHasStacksLedgerKeychain();

return useCallback(
(chain: Blockchains) => {
(chain: Blockchain) => {
if (chain === 'bitcoin') {
return hasBitcoinLedgerKeys;
}
Expand Down

0 comments on commit 6bbb1fa

Please sign in to comment.