Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hooks missing return type #1200

Closed
wants to merge 2 commits into from
Closed
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
5 changes: 5 additions & 0 deletions .changeset/clean-lemons-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ant-design/web3': patch
---

fix: hooks missing return type
51 changes: 51 additions & 0 deletions packages/common/src/enums.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
export enum ChainIds {
Mainnet = 1,
Polygon = 137,
BSC = 56,
Arbitrum = 42_161,
Optimism = 10,
Goerli = 5,
Avalanche = 43_114,
X1Testnet = 195,
Sepolia = 11_155_111,
Holesky = 17_000,
Scroll = 534_352,
ScrollSepolia = 534_351,
Hardhat = 31_337,
Localhost = 1_337,
}

export enum SolanaChainIds {
MainnetBeta = 2,
Devnet = 3,
Testnet = 4,
}

export enum SuiChainIds {
Mainnet = 1,
Testnet = 2,
Devnet = 3,
Localnet = 4,
}

export enum ChainType {
/**
* Ethereum virtual machine and EVM compatible chains
*/
EVM = 'EVM',

/**
* Solana virtual machine
*/
SVM = 'SVM',

/**
* Bitcoin chain
*/
Bitcoin = 'Bitcoin',

/**
* Sui chain
*/
Sui = 'Sui',
}
1 change: 1 addition & 0 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './enums';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉 enums 算是 types 中的一种,应该在 types 中导出 enums。

export * from './types';
export * from './utils';
export * from './web3-config-provider';
Expand Down
54 changes: 2 additions & 52 deletions packages/common/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,12 @@
import { ChainIds, ChainType } from './enums';

export interface Account {
address: string;
name?: string;
avatar?: string;
addresses?: readonly [`0x${string}`, ...`0x${string}`[]];
}

export enum ChainIds {
Mainnet = 1,
Polygon = 137,
BSC = 56,
Arbitrum = 42_161,
Optimism = 10,
Goerli = 5,
Avalanche = 43_114,
X1Testnet = 195,
Sepolia = 11_155_111,
Holesky = 17_000,
Scroll = 534_352,
ScrollSepolia = 534_351,
Hardhat = 31_337,
Localhost = 1_337,
}

export enum SolanaChainIds {
MainnetBeta = 2,
Devnet = 3,
Testnet = 4,
}

export enum SuiChainIds {
Mainnet = 1,
Testnet = 2,
Devnet = 3,
Localnet = 4,
}

export type BrowserLinkType = 'address' | 'transaction';

export type BalanceMetadata = {
Expand All @@ -43,28 +15,6 @@ export type BalanceMetadata = {
symbol?: string;
};

export enum ChainType {
/**
* Ethereum virtual machine and EVM compatible chains
*/
EVM = 'EVM',

/**
* Solana virtual machine
*/
SVM = 'SVM',

/**
* Bitcoin chain
*/
Bitcoin = 'Bitcoin',

/**
* Sui chain
*/
Sui = 'Sui',
}

export interface Chain {
id: ChainIds | number;
name: string;
Expand Down
Loading