forked from reown-com/web-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Smart Account relay connection + paymaster base (reown-com#351)
* feat: added Goerli smart accounts * chore: remove viem version modifier. Split useSmartAccount usage into multiliune * feat: fix error handling * feat: added smart wallets to proposal modal * feat: added paymasters to be able to freely transact on testnet with Pimlico sponsorship. Serialize SA addresses in relay response * feat: adapted SmartWalletLib interface to be able to use same methods as EIP155Lib. Hooked up all operations on EIP155RequestHandler to smart accounts. * chore: remove logs * feat: added spinner to modal footer. Use it when handling eip155 requests * feat: added sponsorship toggle in settings * feat: upgraded to [email protected] * fix: conflicts after merge * chore: unify loaders * chore: kristoph refactor + multi chain support * fix: chain Id issue. remove unused logs
- Loading branch information
Showing
18 changed files
with
537 additions
and
124 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
advanced/wallets/react-wallet-v2/src/components/ChainSmartAddressMini.tsx
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,31 @@ | ||
import useSmartAccount from '@/hooks/useSmartAccount' | ||
import { Hex } from 'viem' | ||
import ChainAddressMini from './ChainAddressMini' | ||
import { createOrRestoreEIP155Wallet, eip155Wallets } from '@/utils/EIP155WalletUtil' | ||
import { Spinner } from '@nextui-org/react' | ||
import { Chain, allowedChains } from '@/utils/SmartAccountUtils' | ||
import { useSnapshot } from 'valtio' | ||
import SettingsStore from '@/store/SettingsStore' | ||
|
||
interface Props { | ||
namespace: string | ||
} | ||
|
||
const getKey = (namespace?: string) => { | ||
switch (namespace) { | ||
case 'eip155': | ||
createOrRestoreEIP155Wallet() | ||
const key = Object.values(eip155Wallets)[0]?.getPrivateKey() as Hex | ||
return key | ||
} | ||
} | ||
|
||
export default function ChainSmartAddressMini({ namespace }: Props) { | ||
const { activeChainId } = useSnapshot(SettingsStore.state) | ||
const { address } = useSmartAccount(getKey(namespace) as `0x${string}`, allowedChains.find((c) => c.id.toString() === activeChainId) as Chain) | ||
|
||
if (!address) return <Spinner /> | ||
return ( | ||
<ChainAddressMini address={address}/> | ||
) | ||
} |
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
Oops, something went wrong.