Skip to content

Commit

Permalink
papi link error in from calldata proxy info hydration tokens transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaut committed Dec 17, 2024
1 parent c38955b commit 0c7dcec
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 23 deletions.
11 changes: 7 additions & 4 deletions packages/ui/src/components/CallInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ const isWhiteListedCall = (type: string, value: string) => {
'ConvictionVoting.vote',
'ConvictionVoting.remove_vote',
'ConvictionVoting.undelegate',
'ConvictionVoting.unlock'
'ConvictionVoting.unlock',
// Hydration
'Tokens.transfer'
].includes(`${type}.${value}`)
}

Expand All @@ -76,9 +78,10 @@ const formatBalance = (amount: bigint, label: string, chainInfo: ChainInfoHuman,

const eachFieldRendered = (value: Record<string, any>, chainInfo: ChainInfoHuman, id: string) => {
// for transfer, nomination, staking, bounties
const bigIntKey = ['value', 'fee', 'max_additional', 'balance'].find(
(key) => typeof value[key] === 'bigint'
)
// We should make sure this is not done for hydration
const bigIntKey =
chainInfo.tokenSymbol !== 'HDX' &&
['value', 'fee', 'max_additional', 'balance'].find((key) => typeof value[key] === 'bigint')

if (bigIntKey) {
return formatBalance(value[bigIntKey], bigIntKey, chainInfo, id)
Expand Down
16 changes: 13 additions & 3 deletions packages/ui/src/components/EasySetup/FromCallData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useCallInfoFromCallData } from '../../hooks/useCallInfoFromCallData'
import { getExtrinsicName } from '../../utils/getExtrinsicName'
import { usePjsLinks } from '../../hooks/usePjsLinks'
import { Binary, HexString, Transaction } from 'polkadot-api'
import { getPapiHowLink } from '../../utils/getPapiHowLink'

interface Props {
className?: string
Expand Down Expand Up @@ -40,7 +41,8 @@ const FromCallData = ({ className, onSetExtrinsic }: Props) => {
}

return call
} catch {
} catch (e: unknown) {
!!e && setCallDataError(String(e))
return
}
},
Expand Down Expand Up @@ -82,13 +84,21 @@ const FromCallData = ({ className, onSetExtrinsic }: Props) => {
return (
<Box className={className}>
<AlertStyled severity="info">
Paste below the &quot;encoded call data&quot; from a{' '}
Paste below the &quot;encoded call data&quot; from{' '}
<a
href={getPapiHowLink()}
target="_blank"
rel="noreferrer"
>
papi console
</a>{' '}
or{' '}
<a
href={extrinsicUrl}
target="_blank"
rel="noreferrer"
>
manual extrinsic
pjs manual extrinsic
</a>
.<br /> Multix will take care of wrapping it in a multisig/proxy call
</AlertStyled>
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/components/library/TextFieldStyled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ const TextFieldStyled = styled(TextField)`
&.Mui-error {
outline: 3px solid ${({ theme }) => theme.custom.error};
margin-bottom: 1rem;
}
}
.MuiFormHelperText-root {
&.Mui-error {
position: absolute;
bottom: -24px;
bottom: -1rem;
}
}
`
Expand Down
8 changes: 4 additions & 4 deletions packages/ui/src/hooks/useGetMultisigTx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export const useGetMultisigTx = ({
}

if (forceAsMulti && !extrinsicToCall) {
console.warn(
'The extrinsic call is required when multisig.asMulti is called',
extrinsicToCall
)
// console.warn(
// 'The extrinsic call is required when multisig.asMulti is called',
// extrinsicToCall
// )
return
}

Expand Down
21 changes: 16 additions & 5 deletions packages/ui/src/pages/Creation/WithProxySelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,19 @@ const WithProxySelection = ({ setWithProxy, withProxy, className }: Props) => {
Pure proxy <InfoBox />
</TitleBoxStyled>
<FormControlLabel
label="Use a pure proxy (recommended)"
label={
<>
Use a pure proxy (not cross-chain{' '}
<a
href="https://github.com/ChainSafe/Multix/wiki/When-to-use-a-Pure-proxy-with-a-Multisig"
target="_blank"
rel="noreferrer"
>
see here
</a>
)
</>
}
control={
<Checkbox
checked={withProxy}
Expand All @@ -32,14 +44,13 @@ const InfoBox = ({ className = '' }: { className?: string }) => (
className={className}
title={
<span>
Using a proxy makes the multisig more flexible. You can then change the signatories without
changing the proxy address. More info{' '}
Using a pure proxy has advantages and drawbacks see when it makes sense to use it{' '}
<a
href="https://youtu.be/cQymHtreDUA?t=147"
href="https://github.com/ChainSafe/Multix/wiki/When-to-use-a-Pure-proxy-with-a-Multisig"
target="_blank"
rel="noreferrer"
>
in this video
in the docs
</a>
.
</span>
Expand Down
6 changes: 0 additions & 6 deletions packages/ui/src/pages/Creation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,6 @@ const MultisigCreation = ({ className }: Props) => {
threshold
])

useEffect(() => {
// default to using a proxy
if (supportsProxy) {
setWithProxy(true)
}
}, [supportsProxy])
useEffect(() => {
setErrorMessage('')

Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/utils/getPapiHowLink.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const getPapiHowLink = () => 'https://dev.papi.how'

0 comments on commit 0c7dcec

Please sign in to comment.