Handle no statementKind (#2941)
* Handle no statementKind * Send claim with no statementKind
This commit is contained in:
parent
6225a6fc7b
commit
95dd1a1bd1
@ -33,22 +33,14 @@ interface ConstructTx {
|
||||
}
|
||||
|
||||
// Depending on isOldClaimProcess, construct the correct tx.
|
||||
function constructTx (
|
||||
systemChain: string,
|
||||
accountId: string,
|
||||
ethereumSignature: string | null,
|
||||
kind: StatementKind | undefined,
|
||||
isOldClaimProcess: boolean
|
||||
): ConstructTx {
|
||||
function constructTx (systemChain: string, accountId: string, ethereumSignature: string | null, kind: StatementKind | undefined, isOldClaimProcess: boolean): ConstructTx {
|
||||
if (!ethereumSignature) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return isOldClaimProcess
|
||||
return isOldClaimProcess || !kind
|
||||
? { params: [accountId, ethereumSignature], tx: 'claims.claim' }
|
||||
: !kind
|
||||
? {}
|
||||
: { params: [accountId, ethereumSignature, getStatement(systemChain, kind)?.sentence], tx: 'claims.claimAttest' };
|
||||
: { params: [accountId, ethereumSignature, getStatement(systemChain, kind)?.sentence], tx: 'claims.claimAttest' };
|
||||
}
|
||||
|
||||
function Claim ({ accountId, className = '', ethereumAddress, ethereumSignature, isOldClaimProcess, onSuccess, statementKind, systemChain }: Props): React.ReactElement<Props> | null {
|
||||
|
||||
@ -38,6 +38,10 @@ function Statement ({ className, kind, systemChain }: Props): React.ReactElement
|
||||
const { t } = useTranslation();
|
||||
const statementUrl = getStatement(systemChain, kind)?.url;
|
||||
|
||||
if (!statementUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
{t('Please read these terms and conditions carefully. By submitting this statement, you are deemed to have accepted these Terms and Conditions. If you do not agree to these terms, please refrain from accessing or proceeding. You can also find them at:')}
|
||||
|
||||
@ -240,51 +240,45 @@ function ClaimsApp (): React.ReactElement {
|
||||
)}
|
||||
{(step >= Step.Sign && !isPreclaimed) && (
|
||||
<Card>
|
||||
{(isOldClaimProcess || !!statementKind)
|
||||
? (
|
||||
<>
|
||||
<h3>{t<string>('{{step}}. Sign with your ETH address',
|
||||
{ replace: { step: isOldClaimProcess ? '2' : '3' } })}</h3>
|
||||
{!isOldClaimProcess && (<Statement
|
||||
kind={statementKind}
|
||||
systemChain={systemChain}
|
||||
/>)}
|
||||
<div>{t<string>('Copy the following string and sign it with the Ethereum account you used during the pre-sale in the wallet of your choice, using the string as the payload, and then paste the transaction signature object below:')}</div>
|
||||
<CopyToClipboard
|
||||
onCopy={onCopy}
|
||||
text={payload}
|
||||
>
|
||||
<Payload
|
||||
data-for='tx-payload'
|
||||
data-tip
|
||||
>
|
||||
{payload}
|
||||
</Payload>
|
||||
</CopyToClipboard>
|
||||
<Tooltip
|
||||
place='right'
|
||||
text={didCopy ? t<string>('copied') : t<string>('click to copy')}
|
||||
trigger='tx-payload'
|
||||
/>
|
||||
<Signature
|
||||
onChange={onChangeSignature}
|
||||
placeholder={`{\n "address": "0x ...",\n "msg": "${prefix}:...",\n "sig": "0x ...",\n "version": "2"\n}`}
|
||||
rows={10}
|
||||
/>
|
||||
{(step === Step.Sign) && (
|
||||
<Button.Group>
|
||||
<Button
|
||||
icon='sign-in'
|
||||
isDisabled={!accountId || !signature}
|
||||
label={t<string>('Confirm claim')}
|
||||
onClick={goToStepClaim}
|
||||
/>
|
||||
</Button.Group>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
: <div>{t<string>('This Ethereum address does not have a claim.')}</div>
|
||||
}
|
||||
<h3>{t<string>('{{step}}. Sign with your ETH address', { replace: { step: isOldClaimProcess ? '2' : '3' } })}</h3>
|
||||
{!isOldClaimProcess && (
|
||||
<Statement
|
||||
kind={statementKind}
|
||||
systemChain={systemChain}
|
||||
/>
|
||||
)}
|
||||
<div>{t<string>('Copy the following string and sign it with the Ethereum account you used during the pre-sale in the wallet of your choice, using the string as the payload, and then paste the transaction signature object below:')}</div>
|
||||
<CopyToClipboard
|
||||
onCopy={onCopy}
|
||||
text={payload}
|
||||
>
|
||||
<Payload
|
||||
data-for='tx-payload'
|
||||
data-tip
|
||||
>
|
||||
{payload}
|
||||
</Payload>
|
||||
</CopyToClipboard>
|
||||
<Tooltip
|
||||
place='right'
|
||||
text={didCopy ? t<string>('copied') : t<string>('click to copy')}
|
||||
trigger='tx-payload'
|
||||
/>
|
||||
<Signature
|
||||
onChange={onChangeSignature}
|
||||
placeholder={`{\n "address": "0x ...",\n "msg": "${prefix}:...",\n "sig": "0x ...",\n "version": "2"\n}`}
|
||||
rows={10}
|
||||
/>
|
||||
{(step === Step.Sign) && (
|
||||
<Button.Group>
|
||||
<Button
|
||||
icon='sign-in'
|
||||
isDisabled={!accountId || !signature}
|
||||
label={t<string>('Confirm claim')}
|
||||
onClick={goToStepClaim}
|
||||
/>
|
||||
</Button.Group>
|
||||
)}
|
||||
</Card>
|
||||
)}
|
||||
</Column>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user