Skip to content

Commit

Permalink
feat: export all ethers and chain provider
Browse files Browse the repository at this point in the history
  • Loading branch information
sampullman committed Nov 12, 2024
1 parent be32879 commit a5fb59d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
20 changes: 1 addition & 19 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,4 @@ export * from './util'

export { useChain } from './use-chain'

import {
hexlify,
isHexString,
isAddress,
formatEther,
formatUnits,
parseEther,
parseUnits,
} from 'ethers'

export {
hexlify,
isHexString,
isAddress,
formatEther,
formatUnits,
parseEther,
parseUnits,
}
export * from 'ethers'
3 changes: 3 additions & 0 deletions lib/use-chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface IUseChain {
getTx: (hash: string) => Promise<TransactionResponse | null>
getTxReceipt: (hash: string) => Promise<TransactionReceipt | null>
getSigner: () => Signer | undefined
getProvider: () => BrowserProvider | undefined
// eslint-disable-next-line @typescript-eslint/no-explicit-any
getError: (e: unknown) => any
getBalance: (address: string) => Promise<bigint | undefined>
Expand Down Expand Up @@ -218,6 +219,7 @@ export const useChain = (config?: IProviderConfig) => {
}

const getSigner = () => state.signer
const getProvider = () => state.provider

const subscribeProvider = async (provider: BrowserProvider) => {
if (!provider.on) {
Expand Down Expand Up @@ -262,6 +264,7 @@ export const useChain = (config?: IProviderConfig) => {
getTx,
getTxReceipt,
getSigner,
getProvider,
getError,
getBalance,
}
Expand Down

0 comments on commit a5fb59d

Please sign in to comment.