Browse Source
Merge pull request #1454 from juan-cortes/issue-1444
Auto tag/amount from qrcode/pasting on ripple addresses
gre-patch-1
Gaëtan Renaudeau
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
31 additions and
16 deletions
-
src/bridge/RippleJSBridge.js
-
src/components/AdvancedOptions/RippleKind.js
|
|
@ -463,10 +463,30 @@ const RippleJSBridge: WalletBridge<Transaction> = { |
|
|
|
|
|
|
|
getTransactionAmount: (a, t) => t.amount, |
|
|
|
|
|
|
|
editTransactionRecipient: (account, t, recipient) => ({ |
|
|
|
...t, |
|
|
|
recipient, |
|
|
|
}), |
|
|
|
editTransactionRecipient: (account, t, recipient) => { |
|
|
|
const parts = recipient.split('?') |
|
|
|
const params = new URLSearchParams(parts[1]) |
|
|
|
recipient = parts[0] |
|
|
|
|
|
|
|
// Extract parameters we may need
|
|
|
|
for (const [key, value] of params.entries()) { |
|
|
|
switch (key) { |
|
|
|
case 'dt': |
|
|
|
t.tag = parseInt(value, 10) || 0 |
|
|
|
break |
|
|
|
case 'amount': |
|
|
|
t.amount = parseAPIValue(value || '0') |
|
|
|
break |
|
|
|
default: |
|
|
|
// do nothing
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
|
...t, |
|
|
|
recipient, |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
EditFees, |
|
|
|
|
|
|
|
|
|
@ -6,7 +6,6 @@ import { translate } from 'react-i18next' |
|
|
|
import Box from 'components/base/Box' |
|
|
|
import Input from 'components/base/Input' |
|
|
|
import Label from 'components/base/Label' |
|
|
|
import Spoiler from 'components/base/Spoiler' |
|
|
|
|
|
|
|
type Props = { |
|
|
|
tag: ?number, |
|
|
@ -31,18 +30,14 @@ class RippleKind extends Component<Props> { |
|
|
|
render() { |
|
|
|
const { tag, t } = this.props |
|
|
|
return ( |
|
|
|
<Spoiler title={t('app:send.steps.amount.advancedOptions')}> |
|
|
|
<Box horizontal align="center" flow={5}> |
|
|
|
<Box style={{ width: 200 }}> |
|
|
|
<Label> |
|
|
|
<span>{t('app:send.steps.amount.rippleTag')}</span> |
|
|
|
</Label> |
|
|
|
</Box> |
|
|
|
<Box grow> |
|
|
|
<Input value={String(tag || '')} onChange={this.onChange} /> |
|
|
|
</Box> |
|
|
|
<Box vertical flow={5}> |
|
|
|
<Box grow> |
|
|
|
<Label> |
|
|
|
<span>{t('app:send.steps.amount.rippleTag')}</span> |
|
|
|
</Label> |
|
|
|
<Input value={String(tag || '')} onChange={this.onChange} /> |
|
|
|
</Box> |
|
|
|
</Spoiler> |
|
|
|
</Box> |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|