-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from xmtp-labs/ar/remove-thirdweb-part1
feat: Remove Thirdweb
- Loading branch information
Showing
10 changed files
with
63 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import {mainnet} from 'viem/chains'; | ||
|
||
export const SUPPORTED_CHAIN = mainnet; | ||
export const RPC_URL = SUPPORTED_CHAIN.rpcUrls.default.http[0]; |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {useClient} from './useClient'; | ||
|
||
export const useAddress = () => { | ||
const {client, loading} = useClient(); | ||
return { | ||
address: client?.address, | ||
loading, | ||
}; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,14 @@ | ||
import {Chain} from '@thirdweb-dev/chains'; | ||
import {getChainProvider} from '@thirdweb-dev/react-native'; | ||
import {ethers} from 'ethers'; | ||
import {RPC_URL} from '../consts/Chains'; | ||
|
||
export const getEnsInfo = async ( | ||
address: string, | ||
supportedChains: Chain[], | ||
clientId?: string, | ||
) => { | ||
const ethereum = supportedChains.find(chain => chain.chainId === 1); | ||
const provider = getChainProvider(1, { | ||
clientId, | ||
supportedChains: ethereum | ||
? [ | ||
{ | ||
chainId: 1, | ||
rpc: [...ethereum.rpc], | ||
nativeCurrency: ethereum.nativeCurrency, | ||
slug: ethereum.slug, | ||
}, | ||
] | ||
: undefined, | ||
}); | ||
if (provider instanceof ethers.providers.JsonRpcProvider) { | ||
const [ens, avatarUrl] = await Promise.all([ | ||
provider.lookupAddress(address), | ||
provider.getAvatar(address), | ||
]); | ||
return { | ||
ens, | ||
avatarUrl, | ||
}; | ||
} else { | ||
const ens = await provider.lookupAddress(address); | ||
return { | ||
ens, | ||
avatarUrl: null, | ||
}; | ||
} | ||
export const getEnsInfo = async (address: string) => { | ||
const provider = new ethers.providers.JsonRpcProvider(RPC_URL); | ||
const [ens, avatarUrl] = await Promise.all([ | ||
provider.lookupAddress(address), | ||
provider.getAvatar(address), | ||
]); | ||
return { | ||
ens, | ||
avatarUrl, | ||
}; | ||
}; |