-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: remove mapps from justverified * fix yarn.lock * fix * feat: efp * feat: efp and storybook for react sdk * chore(release): publish - project: justweb3-efp-plugin 0.1.0 * chore(release): publish - project: justweb3-efp-plugin 0.1.1 * chore(release): publish - project: justweb3-efp-plugin 0.1.2 * chore(release): publish - project: justweb3-efp-plugin 0.1.3 * feat: console fixes * chore(release): publish - project: justweb3-efp-plugin 0.1.4 * feat: added docs and the sign in should only show ens set to default resolver or justaname resolver only * feat: add verbose to the test in ci * trial * trial * trial * trial * Trial (#42) * trial * trial * trial * trial * trial * fix: lint fix on react and package json of projects * fix: lint fix on react and package json of projects * Console (#43) * fix: naming app name * fix: packages * fix(console): deployment * fix: trial * fix(console): trial * trial * trial * trial * trial * trial * trial * trial --------- Co-authored-by: anthony2399 <[email protected]> * fix: error from useEnsWalletClient --------- Co-authored-by: anthony2399 <[email protected]>
- Loading branch information
1 parent
ad23861
commit 2081267
Showing
21 changed files
with
558 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 33 additions & 14 deletions
47
packages/@justaname.id/react/src/lib/hooks/client/useEnsWalletClient.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,50 @@ | ||
import { useWalletClient } from 'wagmi'; | ||
import { WalletClient, Transport, Account, Chain, RpcSchema } from 'viem'; | ||
import { Account, Chain, RpcSchema, Transport, WalletClient } from 'viem'; | ||
import { addEnsContracts } from '@ensdomains/ensjs'; | ||
import { CheckedChainWithEns } from '@ensdomains/ensjs/contracts'; | ||
|
||
export interface UseEnsWalletClientResult { | ||
ensWalletClient: WalletClient<Transport, CheckedChainWithEns<Chain>, Account, RpcSchema> | undefined | ||
isEnsWalletClientPending: boolean | ||
ensWalletClient: | ||
| WalletClient<Transport, CheckedChainWithEns<Chain>, Account, RpcSchema> | ||
| undefined; | ||
isEnsWalletClientPending: boolean; | ||
} | ||
|
||
export interface UseEnsWalletClientParams {} | ||
|
||
export const useEnsWalletClient = (params?: UseEnsWalletClientParams): UseEnsWalletClientResult => { | ||
const query = useWalletClient() | ||
export const useEnsWalletClient = ( | ||
params?: UseEnsWalletClientParams | ||
): UseEnsWalletClientResult => { | ||
const query = useWalletClient(); | ||
|
||
const transformWalletToEnsWallet = (wallet: WalletClient<Transport, Chain, Account, RpcSchema> | undefined): WalletClient<Transport, CheckedChainWithEns<Chain>, Account, RpcSchema> | undefined => { | ||
const transformWalletToEnsWallet = ( | ||
wallet: WalletClient<Transport, Chain, Account, RpcSchema> | undefined | ||
): | ||
| WalletClient<Transport, CheckedChainWithEns<Chain>, Account, RpcSchema> | ||
| undefined => { | ||
if (!wallet) { | ||
return | ||
return; | ||
} | ||
|
||
if (wallet?.chain.id !== 1 && wallet?.chain.id !== 11155111) { | ||
return; | ||
} | ||
|
||
return { | ||
...wallet, | ||
chain: addEnsContracts(wallet.chain as Chain) | ||
} as WalletClient<Transport, CheckedChainWithEns<Chain>, Account, RpcSchema> | ||
} | ||
chain: addEnsContracts(wallet.chain as Chain), | ||
} as WalletClient< | ||
Transport, | ||
CheckedChainWithEns<Chain>, | ||
Account, | ||
RpcSchema | ||
>; | ||
}; | ||
|
||
return { | ||
ensWalletClient: transformWalletToEnsWallet(query.data as WalletClient<Transport, Chain, Account, RpcSchema>), | ||
isEnsWalletClientPending: query.isPending | ||
} | ||
} | ||
ensWalletClient: transformWalletToEnsWallet( | ||
query.data as WalletClient<Transport, Chain, Account, RpcSchema> | ||
), | ||
isEnsWalletClientPending: query.isPending, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.