Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dumi/components/ShowCase/CryptoInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const App: React.FC = () => {
}}
options={[ETH, USDT]}
/>
{/* biome-ignore lint/a11y/useKeyWithClickEvents: <explanation> */}
<span
style={{
width: 30,
Expand Down
5 changes: 3 additions & 2 deletions .dumi/components/Theme/components/Thumbnail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const ThumbnailItem: React.FC<ThumbnailItemProps> = (item) => {
curTheme.name === 'Dark' ? token.colorWhite : token.colorTextBase,
} as React.CSSProperties;
return (
// biome-ignore lint/a11y/useKeyWithClickEvents: by design
<div
className={classNames(styles.thumbnailItem, {
[styles.selected]: selected,
Expand Down Expand Up @@ -138,9 +139,9 @@ export type ThumbnailProps = {
export const Thumbnail: React.FC<ThumbnailProps> = ({ selectedTheme, onSelect }) => {
return (
<div className={styles.thumbnail}>
{themes.map((theme, index) => (
{themes.map((theme) => (
<ThumbnailItem
key={index}
key={theme.value}
{...theme}
selected={theme.name === selectedTheme.name}
onSelect={onSelect}
Expand Down
2 changes: 1 addition & 1 deletion .dumi/theme/builtins/IconSearch/IconSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const IconSearch: React.FC = () => {
let iconList = categories[key as CategoriesKeys];
if (searchKey) {
const matchKey = searchKey
.replace(new RegExp(`^<([a-zA-Z]*)\\s/>$`, 'gi'), (_, name) => name)
.replace(/^<([a-zA-Z]*)\s\/>$/gi, (_, name) => name)
.replace(/(Colorful|Filled|CircleFilled|CircleColorful)$/gi, '')
.toLowerCase();
iconList = iconList.filter((iconName) => iconName.toLowerCase().includes(matchKey));
Expand Down
1 change: 1 addition & 0 deletions .dumi/theme/builtins/IconSearch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const IconSearchFallback = () => {
{Array(24)
.fill(1)
.map((_, index) => (
// biome-ignore lint/suspicious/noArrayIndexKey:
<div key={index} className={styles.skeletonWrapper}>
<Skeleton.Node active style={{ height: 110, width: '100%' }}>
{' '}
Expand Down
2 changes: 2 additions & 0 deletions .dumi/theme/builtins/IconSearch/themeIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const FilledIcon: CustomIconComponent = (props) => {
' 12 12v680c0 6.6-5.4 12-12 12z';
return (
<svg {...props} viewBox="0 0 1024 1024">
<title>Filled icons</title>
<path d={path} />
</svg>
);
Expand All @@ -36,6 +37,7 @@ export const CircleFilledIcon: CustomIconComponent = (props) => {
'68 368 0 203.41-164.622 368-368 368z';
return (
<svg {...props} viewBox="0 0 1024 1024">
<title>CircleFilled icons</title>
<path d={path} />
</svg>
);
Expand Down
1 change: 1 addition & 0 deletions .dumi/theme/builtins/InstallDependencies/npm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const NpmIcon: React.FC<IconProps> = (props) => {
viewBox="0 0 16 16"
width="1em"
>
<title>NPM</title>
<path d="M0 0v16h16v-16h-16zM13 13h-2v-8h-3v8h-5v-10h10v10z" />
</svg>
);
Expand Down
2 changes: 1 addition & 1 deletion .dumi/theme/builtins/NormalInstallDependencies/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface NormalInstallProps {

const NormalInstallDependencies: React.FC<NormalInstallProps> = (props) => {
const { packageNames, save } = props;
let realSave: boolean = false;
let realSave = false;
if (save === 'true') {
realSave = true;
} else if (save !== 'false') {
Expand Down
8 changes: 4 additions & 4 deletions .dumi/theme/builtins/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ const useStyle = createStyles(({ token, css }, { dark }: { dark: boolean }) => (
border-radius: 36px;
font-size: 44px;
background-image: ${dark
? `linear-gradient(175deg, #262525 -8%, #363535 32%)`
: `linear-gradient(175deg, #f5f8fc -8%, #ffffff 32%)`};
? 'linear-gradient(175deg, #262525 -8%, #363535 32%)'
: 'linear-gradient(175deg, #f5f8fc -8%, #ffffff 32%)'};
border-image-slice: 1;
box-shadow: ${dark
? `0px 0 14px 2px rgba(210, 198, 255, 0.25), inset 0px -2px 0 0 #525355`
: `0px 25px 14px 2px rgba(210, 198, 255, 0.25), inset 0px -4px 0 0 #e6ebf3`};
? '0px 0 14px 2px rgba(210, 198, 255, 0.25), inset 0px -2px 0 0 #525355'
: '0px 25px 14px 2px rgba(210, 198, 255, 0.25), inset 0px -4px 0 0 #e6ebf3'};
`,
componentsOverviewCard: css`
cursor: pointer;
Expand Down
3 changes: 2 additions & 1 deletion .dumi/theme/layouts/GlobalLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const GlobalLayout: React.FC = () => {

useServerInsertedHTML(() => {
const styleText = extractStyle(cssCache, { plain: true });
return <style id="antd-cssinjs" dangerouslySetInnerHTML={{ __html: styleText }}></style>;
// biome-ignore lint/security/noDangerouslySetInnerHtml: by design
return <style id="antd-cssinjs" dangerouslySetInnerHTML={{ __html: styleText }} />;
});

return (
Expand Down
4 changes: 2 additions & 2 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { existsSync, readdirSync } from 'fs';
import { join, resolve } from 'path';
import { existsSync, readdirSync } from 'node:fs';
import { join, resolve } from 'node:path';
import { defineConfig } from 'dumi';

const openSSR = process.env.SSR || process.env.NODE_ENV === 'production';
Expand Down
32 changes: 31 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,42 @@
"./es/**/*",
"./lib/**/*",
"_site/**/*",
"./packages/icons/src/components/*"
"./packages/icons/src/components/*",
"./coverage/*",
"*/.umi/**/*"
],
"indentStyle": "space",
"lineWidth": 100,
"indentWidth": 2
},
"organizeImports": {
"enabled": true
},
"linter": {
"ignore": [
"./coverage/**/*",
"./.umi/**/*",
"./.dumi/tmp/**/*",
"./.dumi/pages/tonconnect-manifest.json",
".vscode/*",
"*/dist/**/*"
],
"rules": {
"style": {
"useImportType": "off",
"noNonNullAssertion": "off"
},
"complexity": {
"noForEach": "off"
},
"correctness": {
"useExhaustiveDependencies": "off"
},
"suspicious": {
"noExplicitAny": "off"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single"
Expand Down
1 change: 1 addition & 0 deletions docs/meetup2024/sbt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const SBT: React.FC = () => {
'-webkit-box-reflect': 'below 2px linear-gradient(transparent, rgba(0, 0, 0, 15%))',
}}
src="https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*brRjT72GJPIAAAAAAAAAAAAADlrGAQ/original"
aria-label="Ant Design Meetup 2024"
/>
<div
style={{
Expand Down
4 changes: 2 additions & 2 deletions packages/assets/src/solana/chains.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const SolanaDevnet: SolanaChain = {
browser: {
icon: <SolanaColorful />,
getBrowserLink: (address, type) =>
createGetBrowserLink('https://explorer.solana.com')(address, type) + '?cluster=devnet',
`${createGetBrowserLink('https://explorer.solana.com')(address, type)}?cluster=devnet`,
},
nativeCurrency: { name: 'Solana', symbol: 'SOL', decimals: 9 },
};
Expand All @@ -35,7 +35,7 @@ export const SolanaTestnet: SolanaChain = {
browser: {
icon: <SolanaColorful />,
getBrowserLink: (address, type) =>
createGetBrowserLink('https://explorer.solana.com')(address, type) + '?cluster=testnet',
`${createGetBrowserLink('https://explorer.solana.com')(address, type)}?cluster=testnet`,
},
nativeCurrency: { name: 'Solana', symbol: 'SOL', decimals: 9 },
};
2 changes: 1 addition & 1 deletion packages/assets/src/wallets/_tests_/meta-mask.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('transferQRCodeFormatter', () => {
const expectedValue = `ethereum:${paramsWithTokenAddress.tokenAddress}@${
commonParams.chainId
}/transfer?address=${commonParams.toAddress}&uint256=${
paramsWithTokenAddress.amount * Math.pow(10, 18 - commonParams.decimal)
paramsWithTokenAddress.amount * 10 ** (18 - commonParams.decimal)
}`;
expect(result).toBe(expectedValue);
});
Expand Down
3 changes: 1 addition & 2 deletions packages/assets/src/wallets/im-token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ export const metadata_imToken: WalletMetadata = {
const { toAddress, chainId, amount, tokenAddress = '', decimal } = params;
if (tokenAddress) {
return `ethereum:${toAddress}@${chainId}?contractAddress=${tokenAddress}&decimal=${decimal}&value=${amount}`;
} else {
return `ethereum:${toAddress}@${chainId}?decimal=18&value=${amount}`;
}
return `ethereum:${toAddress}@${chainId}?decimal=18&value=${amount}`;
},
supportChainTypes: [ChainType.EVM],
};
6 changes: 3 additions & 3 deletions packages/assets/src/wallets/meta-mask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export const metadata_MetaMask: WalletMetadata = {
const { toAddress, chainId, amount, tokenAddress = '', decimal } = params;
if (tokenAddress) {
return `ethereum:${tokenAddress}@${chainId}/transfer?address=${toAddress}&uint256=${
Number(amount) * Math.pow(10, 18 - decimal)
Number(amount) * 10 ** (18 - decimal)
}`;
} else {
return `ethereum:${toAddress}@${chainId}?value=${amount}`;
}

return `ethereum:${toAddress}@${chainId}?value=${amount}`;
},
supportChainTypes: [ChainType.EVM],
};
2 changes: 2 additions & 0 deletions packages/bitcoin/src/adapter/wallets/okx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class OkxBitcoinWallet implements BitcoinWallet {
const accounts = await this.provider.requestAccounts();
this.account = { address: accounts[0] };
} catch (error) {
// biome-ignore lint/complexity/noUselessCatch: re-throw error
throw error;
}
};
Expand Down Expand Up @@ -56,6 +57,7 @@ export class OkxBitcoinWallet implements BitcoinWallet {
try {
txid = await this.provider.sendBitcoin(to, sats, options);
} catch (error) {
// biome-ignore lint/complexity/noUselessCatch: re-throw error
throw error;
}
return txid;
Expand Down
5 changes: 3 additions & 2 deletions packages/bitcoin/src/adapter/wallets/phantom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { fromHex, fromUtf8, toBase64, toHex } from 'uint8array-tools';

import { NoAddressError, NoProviderError, NotImplementedError } from '../../error';
import { getBalanceByMempool, getInscriptionsByAddress } from '../../helpers';
import type { SignPsbtParams, TransferParams } from '../../types';
import type { SignPsbtParams } from '../../types';
import type { BitcoinWallet } from '../useBitcoinWallet';

type AccountType = {
Expand Down Expand Up @@ -48,6 +48,7 @@ export class PhantomBitcoinWallet implements BitcoinWallet {
this.account = ordinals ? { address: ordinals.address } : undefined;
this.payment = payment?.address;
} catch (error) {
// biome-ignore lint/complexity/noUselessCatch: re-throw error
throw error;
}
};
Expand Down Expand Up @@ -112,7 +113,7 @@ export class PhantomBitcoinWallet implements BitcoinWallet {
};
};

sendTransfer = async (params: TransferParams) => {
sendTransfer = async () => {
throw new NotImplementedError();
};

Expand Down
2 changes: 2 additions & 0 deletions packages/bitcoin/src/adapter/wallets/unisat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class UnisatBitcoinWallet implements BitcoinWallet {
const accounts = await this.provider.requestAccounts();
this.account = { address: accounts[0] };
} catch (e) {
// biome-ignore lint/complexity/noUselessCatch: re-throw error
throw e;
}
};
Expand Down Expand Up @@ -54,6 +55,7 @@ export class UnisatBitcoinWallet implements BitcoinWallet {
try {
txid = await this.provider.sendBitcoin(to, sats, options);
} catch (e) {
// biome-ignore lint/complexity/noUselessCatch: re-throw error
throw e;
}
return txid;
Expand Down
8 changes: 4 additions & 4 deletions packages/bitcoin/src/adapter/wallets/xverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ export class XverseBitcoinWallet implements BitcoinWallet {
});
if (response.status === 'success') {
return response.result.signature;
} else {
throw new Error(response.error.message);
}

throw new Error(response.error.message);
};

sendTransfer = async ({ to, sats }: TransferParams): Promise<string> => {
Expand Down Expand Up @@ -89,9 +89,9 @@ export class XverseBitcoinWallet implements BitcoinWallet {
});
if (response.status === 'success') {
return response.result as SignPsbtResult;
} else {
throw new Error(response.error.message);
}

throw new Error(response.error.message);
};

getInscriptions = async (offset = 0, limit = 20) => {
Expand Down
12 changes: 6 additions & 6 deletions packages/bitcoin/src/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export const getBalanceByMempool = async (address: string): Promise<Balance> =>
const { chain_stats } = data;
const { funded_txo_sum, spent_txo_sum } = chain_stats;
return getBalanceObject(funded_txo_sum - spent_txo_sum);
} else {
throw new NoBalanceError();
}

throw new NoBalanceError();
};

export const getInscriptionsByAddress = async ({
Expand Down Expand Up @@ -69,17 +69,17 @@ export const getInscriptionsByAddress = async ({
}),
);
return { list, total };
} else {
throw new NoInscriptionError();
}

throw new NoInscriptionError();
};

export const getInscriptionContentById = async (inscriptionId: string): Promise<string> => {
const res = await fetch(`${HIRO_API}/ordinals/v1/inscriptions/${inscriptionId}`);
if (res.ok) {
const { id } = await res.json();
return `${ORDINALS_URL}/content/${id}`;
} else {
throw new NoInscriptionError();
}

throw new NoInscriptionError();
};
2 changes: 1 addition & 1 deletion packages/bitcoin/src/provider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const BitcoinWeb3ConfigProvider: FC<PropsWithChildren<BitcoinWeb3ConfigPr
const selectWallet = async (wallet?: Wallet | null) => {
if (!wallet) {
// disconnect
if (!!adapter) setAdapter({} as BitcoinWallet);
if (adapter) setAdapter({} as BitcoinWallet);
cacheSelectedWallet();
return;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/common/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// biome-ignore lint/suspicious/noConstEnum: <explanation>
export const enum ConnectStatus {
Connected = 'connected',
Disconnected = 'disconnected',
Expand Down Expand Up @@ -120,6 +121,7 @@ export interface UniversalWeb3ProviderInterface {
/** Such as `0x` */
addressPrefix?: string | false;

// biome-ignore lint/suspicious/noConfusingVoidType: by design
connect?: (wallet?: Wallet, options?: ConnectOptions) => Promise<void | Account>;
disconnect?: () => Promise<void>;
switchChain?: (chain: Chain) => Promise<void>;
Expand Down
3 changes: 2 additions & 1 deletion packages/common/src/utils/createGetBrowserLink.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export const createGetBrowserLink = (url: string) => (address: string, type: string) => {
if (type === 'address') {
return `${url}/address/${address}`;
} else if (type === 'transaction') {
}
if (type === 'transaction') {
return `${url}/tx/${address}`;
}
throw new Error(`getBrowserLink unsupported type ${type}`);
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/web3-config-provider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ const Web3ConfigProvider: React.FC<Web3ConfigProviderProps> = (props) => {
);
};

export { Web3ConfigProvider, Web3ConfigProviderProps };
export { Web3ConfigProvider, type Web3ConfigProviderProps };

export * from './context';
2 changes: 2 additions & 0 deletions packages/eth-web3js/src/web3js-provider/web3js-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const EthWeb3jsConfigProvider: React.FC<

const wallets = React.useMemo(() => {
const targetWallets = [...(props.wallets ?? [])];
// biome-ignore lint/complexity/useOptionalChain: <explanation>
if (walletConnect && walletConnect.projectId) targetWallets.push(WalletConnect());
return targetWallets;
}, [props.wallets, walletConnect]);
Expand All @@ -48,6 +49,7 @@ export const EthWeb3jsConfigProvider: React.FC<
}
});

// biome-ignore lint/complexity/useOptionalChain: <explanation>
if (walletConnect && walletConnect.projectId) {
connectors.push(
wagmiConnectors.walletConnect({
Expand Down
Loading