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

chore: addresses to approve (evm) #728

Merged
merged 2 commits into from
Sep 26, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import useSmartAccounts from '@/hooks/useSmartAccounts'
import { EIP5792_METHODS } from '@/data/EIP5792Data'
import { getWalletCapabilities } from '@/utils/EIP5792WalletUtil'
import { EIP7715_METHOD } from '@/data/EIP7715Data'
import { useRouter } from 'next/router'

const StyledText = styled(Text, {
fontWeight: 400
Expand All @@ -55,6 +56,10 @@ export default function SessionProposalModal() {
const [isLoadingReject, setIsLoadingReject] = useState(false)
const { getAvailableSmartAccountsOnNamespaceChains } = useSmartAccounts()

const { query } = useRouter()

const addressesToApprove = Number(query.addressesToApprove) || null

const supportedNamespaces = useMemo(() => {
// eip155
const eip155Chains = Object.keys(EIP155_CHAINS)
Expand Down Expand Up @@ -106,7 +111,11 @@ export default function SessionProposalModal() {
methods: eip155Methods.concat(eip5792Methods).concat(eip7715Methods),
events: ['accountsChanged', 'chainChanged'],
accounts: eip155Chains
.map(chain => eip155Addresses.map(account => `${chain}:${account}`))
.map(chain =>
eip155Addresses
.map(account => `${chain}:${account}`)
.slice(0, addressesToApprove ?? eip155Addresses.length)
)
.flat()
},
cosmos: {
Expand Down