diff --git a/packages/ui/src/components/CallInfo.tsx b/packages/ui/src/components/CallInfo.tsx index 382e7693..28651cc3 100644 --- a/packages/ui/src/components/CallInfo.tsx +++ b/packages/ui/src/components/CallInfo.tsx @@ -52,7 +52,12 @@ const isWhiteListedCall = (type: string, value: string) => { 'Staking.nominate', 'Proxy.add_proxy', 'Proxy.remove_proxy', - 'Proxy.kill_pure' + 'Proxy.kill_pure', + 'ConvictionVoting.delegate', + 'ConvictionVoting.vote', + 'ConvictionVoting.remove_vote', + 'ConvictionVoting.undelegate', + 'ConvictionVoting.unlock' ].includes(`${type}.${value}`) } @@ -71,7 +76,9 @@ const formatBalance = (amount: bigint, label: string, chainInfo: ChainInfoHuman, const eachFieldRendered = (value: Record, chainInfo: ChainInfoHuman, id: string) => { // for transfer, nomination, staking, bounties - const bigIntKey = ['value', 'fee', 'max_additional'].find((key) => typeof value[key] === 'bigint') + const bigIntKey = ['value', 'fee', 'max_additional', 'balance'].find( + (key) => typeof value[key] === 'bigint' + ) if (bigIntKey) { return formatBalance(value[bigIntKey], bigIntKey, chainInfo, id) @@ -120,9 +127,15 @@ const eachFieldRendered = (value: Record, chainInfo: ChainInfoHuman } // that's an Account with MultiAddress.Id - const multiAddressKey = ['dest', 'beneficiary', 'curator', 'delegate', 'spawner'].find( - (key) => typeof value[key] === 'object' && value[key].type === 'Id' - ) + const multiAddressKey = [ + 'dest', + 'beneficiary', + 'curator', + 'delegate', + 'spawner', + 'to', + 'target' + ].find((key) => typeof value[key] === 'object' && value[key].type === 'Id') if (multiAddressKey) { return ( diff --git a/packages/ui/src/components/modals/WalletConnectSessionProposal.tsx b/packages/ui/src/components/modals/WalletConnectSessionProposal.tsx index 5d92dc9a..843ecf42 100644 --- a/packages/ui/src/components/modals/WalletConnectSessionProposal.tsx +++ b/packages/ui/src/components/modals/WalletConnectSessionProposal.tsx @@ -72,7 +72,8 @@ const WalletConnectSessionProposal = ({ onClose, className, sessionProposal }: P polkadot: { accounts: accountsToShare, methods, - events + events, + chains } } }) @@ -81,7 +82,7 @@ const WalletConnectSessionProposal = ({ onClose, className, sessionProposal }: P onClose() refresh() }) - }, [accountsToShare, events, methods, onClose, refresh, sessionProposal, web3wallet]) + }, [accountsToShare, chains, events, methods, onClose, refresh, sessionProposal, web3wallet]) const onReject = useCallback(() => { if (!web3wallet || !sessionProposal) return diff --git a/packages/ui/src/components/modals/WalletConnectSigning.tsx b/packages/ui/src/components/modals/WalletConnectSigning.tsx index b3795e23..154c5bf1 100644 --- a/packages/ui/src/components/modals/WalletConnectSigning.tsx +++ b/packages/ui/src/components/modals/WalletConnectSigning.tsx @@ -27,6 +27,7 @@ import { useMultisigProposalNeededFunds } from '../../hooks/useMultisigProposalN import { useCheckBalance } from '../../hooks/useCheckBalance' import { formatBigIntBalance } from '../../utils/formatBnBalance' import { getErrorMessageReservedFunds } from '../../utils/getErrorMessageReservedFunds' +import { useGetWalletConnectNamespace } from '../../hooks/useWalletConnectNamespace' export interface SigningModalProps { onClose: () => void @@ -37,6 +38,7 @@ export interface SigningModalProps { const ProposalSigning = ({ onClose, className, request, onSuccess }: SigningModalProps) => { const { api, chainInfo } = useApi() + const { currentNamespace } = useGetWalletConnectNamespace() const [isSubmitting, setIsSubmitting] = useState(false) const { web3wallet } = useWalletConnect() const { @@ -81,6 +83,30 @@ const ProposalSigning = ({ onClose, className, request, onSuccess }: SigningModa address: selectedAccount?.address }) + useEffect(() => { + const requestedChainId = request.params.chainId + if (requestedChainId !== currentNamespace) { + setErrorMessage( + `Wrong selected network in Multix. Please reject, then select the correct network and resubmit the transaction. Request with namespace: ${requestedChainId}` + ) + } + }, [currentNamespace, originAddress, request.params.chainId]) + + const isCorrectMultiproxySelected = useMemo( + () => + selectedMultiProxy?.proxy === originAddress || + selectedMultiProxy?.multisigs.map(({ address }) => address).includes(originAddress), + [selectedMultiProxy, originAddress] + ) + + useEffect(() => { + if (!isCorrectMultiproxySelected) { + setErrorMessage( + `Wrong multisig selected in Multix. Please reject, then select the correct multisig and resubmit the transaction. Request with address: ${originAddress}` + ) + } + }, [isCorrectMultiproxySelected, originAddress]) + useEffect(() => { if (multisigProposalNeededFunds !== 0n && !hasSignerEnoughFunds) { const requiredBalanceString = formatBigIntBalance( @@ -260,7 +286,7 @@ const ProposalSigning = ({ onClose, className, request, onSuccess }: SigningModa callData, name: getExtrinsicName(callInfo?.section, callInfo?.method) }} - expanded + expanded={!errorMessage} /> diff --git a/squid/assets/envs/.env.chopsticks-ci b/squid/assets/envs/.env.chopsticks-ci index b2e62289..0d4894db 100644 --- a/squid/assets/envs/.env.chopsticks-ci +++ b/squid/assets/envs/.env.chopsticks-ci @@ -7,5 +7,5 @@ DB_HOST=postgres # kusama chopsticks BLOCK_START=26000000 PREFIX=2 -RPC_WS="ws://localhost:8000" +RPC_WS="http://localhost:8000" CHAIN_ID='kusama' \ No newline at end of file diff --git a/squid/assets/envs/.env.chopsticks-local b/squid/assets/envs/.env.chopsticks-local index 4b8f7e6f..85b2aa81 100644 --- a/squid/assets/envs/.env.chopsticks-local +++ b/squid/assets/envs/.env.chopsticks-local @@ -1,10 +1,10 @@ # DB_PORT=5432 -# GQL_PORT=4350 +GQL_PORT=4350 # SQD_DEBUG=sqd:processor:mapping # SQD_DEBUG=* # kusama chopsticks BLOCK_START=26000000 PREFIX=2 -RPC_WS="ws://localhost:8000" +RPC_WS="http://localhost:8000" CHAIN_ID='kusama' \ No newline at end of file