Skip to content

Commit 1b68ee8

Browse files
Merge pull request #640 from Cryptonomic/patch/a1
contract deployment bug
2 parents b0cdfaf + 7a0a8f4 commit 1b68ee8

7 files changed

Lines changed: 58 additions & 79 deletions

File tree

app/components/ActionPanel/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class ActionPanel extends Component<Props, State> {
150150
return (
151151
<Delegate
152152
isReady={ready}
153-
address={selectedAccount.get('delegate') || selectedAccountHash}
153+
address={selectedAccount.get('delegate')}
154154
selectedAccountHash={selectedAccountHash}
155155
selectedParentHash={selectedParentHash}
156156
/>

app/components/Delegate/index.js

Lines changed: 29 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @flow
2-
import React, { Component } from 'react';
2+
import React, { Component, Fragment } from 'react';
33
import { bindActionCreators, compose } from 'redux';
44
import { connect } from 'react-redux';
55
import styled from 'styled-components';
@@ -23,7 +23,7 @@ import {
2323
type Props = {
2424
selectedAccountHash?: string,
2525
selectedParentHash?: string,
26-
address?: string,
26+
address?: string | null,
2727
delegate?: () => {},
2828
fetchDelegationAverageFees: () => {},
2929
getIsReveal: () => {},
@@ -108,24 +108,6 @@ const SetADelegate = styled.div`
108108
margin-bottom: 14px;
109109
color: ${({ theme: { colors } }) => colors.black2};
110110
`;
111-
const WarningContainer = styled.div`
112-
height: 91px;
113-
width: 60%;
114-
border: solid 1px rgba(148, 169, 209, 0.49);
115-
border-radius: 3px;
116-
background-color: ${({ theme: { colors } }) => colors.light};
117-
display: flex;
118-
align-items: center;
119-
padding: 0 19px;
120-
margin-right: 5%;
121-
`;
122-
const InfoText = styled.div`
123-
color: ${({ theme: { colors } }) => colors.primary};
124-
font-size: 16px;
125-
letter-spacing: 0.7px;
126-
margin-left: 11px;
127-
line-height: 21px;
128-
`;
129111

130112
const initialState = {
131113
open: false,
@@ -200,12 +182,6 @@ class Delegate extends Component<Props> {
200182
handleFeeChange = fee => this.setState({ fee });
201183
setIsLoading = isLoading => this.setState({ isLoading });
202184

203-
getAddress = () => {
204-
const { tempAddress } = this.state;
205-
const { address } = this.props;
206-
return tempAddress || address;
207-
};
208-
209185
onDelegate = async () => {
210186
const { password, fee, tempAddress } = this.state;
211187
const {
@@ -287,33 +263,29 @@ class Delegate extends Component<Props> {
287263
<Container>
288264
<Title>{t('components.delegate.delegate_settings')}</Title>
289265
<DelegateContainer>
290-
{address && (
291-
<DelegateInputContainer>
292-
<SetADelegate>
293-
{t('components.delegate.current_delegate')}:
294-
</SetADelegate>
295-
<TezosAddress
296-
address={address}
297-
size="16px"
298-
color="primary"
299-
color2="index0"
300-
/>
301-
<UpdateButton
302-
disabled={isLoading}
303-
onClick={this.openConfirmation}
304-
buttonTheme="secondary"
305-
small
306-
>
307-
{t('components.delegate.change_delegate')}
308-
</UpdateButton>
309-
</DelegateInputContainer>
310-
)}
311-
{!address && (
312-
<WarningContainer>
313-
<TezosIcon iconName="info" size={ms(5)} color="info" />
314-
<InfoText>{t('components.delegate.delegate_warning')}</InfoText>
315-
</WarningContainer>
316-
)}
266+
<DelegateInputContainer>
267+
{!!address && (
268+
<Fragment>
269+
<SetADelegate>
270+
{t('components.delegate.current_delegate')}:
271+
</SetADelegate>
272+
<TezosAddress
273+
address={address}
274+
size="16px"
275+
color="primary"
276+
color2="index0"
277+
/>
278+
</Fragment>
279+
)}
280+
<UpdateButton
281+
disabled={isLoading}
282+
onClick={this.openConfirmation}
283+
buttonTheme="secondary"
284+
small
285+
>
286+
{t('components.delegate.change_delegate')}
287+
</UpdateButton>
288+
</DelegateInputContainer>
317289
<DelegationTipsContainer>
318290
<DelegationTitle>
319291
{t('components.addressBlock.delegation_tips')}
@@ -359,6 +331,10 @@ class Delegate extends Component<Props> {
359331
}
360332
}
361333

334+
Delegate.defaultProps = {
335+
address: ''
336+
};
337+
362338
function mapStateToProps(state) {
363339
return {
364340
isLedger: getIsLedger(state)

app/components/DelegateConfirmationModal/index.js

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @flow
2-
import React from 'react';
2+
import React, { Fragment } from 'react';
33
import { Trans } from 'react-i18next';
44
import styled from 'styled-components';
55
import Modal from '../CustomModal';
@@ -15,7 +15,8 @@ import { wrapComponent } from '../../utils/i18n';
1515
import Tooltip from '../Tooltip/';
1616

1717
const ModalContainer = styled.div`
18-
padding: 43px 76px 0 76px;
18+
padding: ${({ isAddress }) =>
19+
isAddress ? '43px 76px 0 76px' : '10px 76px 0 76px'};
1920
`;
2021
const DelegateTitle = styled.div`
2122
color: ${({ theme: { colors } }) => colors.gray5};
@@ -118,7 +119,7 @@ const BoldSpan = styled.span`
118119
type Props = {
119120
onEnterPress: () => {},
120121
open?: boolean,
121-
address: string,
122+
address: string | null,
122123
newAddress?: string,
123124
password?: string,
124125
fee?: number,
@@ -189,18 +190,22 @@ const DelegateConfirmationModal = (props: Props) => {
189190
style={{ width: '651px' }}
190191
onKeyDown={onEnterPress}
191192
>
192-
<ModalContainer>
193-
<DelegateTitle>
194-
{t('components.delegate.current_delegate')}
195-
</DelegateTitle>
196-
<AddressContainer>
197-
<TezosAddress
198-
address={address}
199-
size="16px"
200-
color="primary"
201-
color2="index0"
202-
/>
203-
</AddressContainer>
193+
<ModalContainer isAddress={!!address}>
194+
{!!address && (
195+
<Fragment>
196+
<DelegateTitle>
197+
{t('components.delegate.current_delegate')}
198+
</DelegateTitle>
199+
<AddressContainer>
200+
<TezosAddress
201+
address={address}
202+
size="16px"
203+
color="primary"
204+
color2="index0"
205+
/>
206+
</AddressContainer>
207+
</Fragment>
208+
)}
204209
<InputAddressContainer>
205210
<InputAddress
206211
labelText={t(

app/components/InteractContractModal/DeployContract.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ const defaultState = {
5353
gas: 0,
5454
storage: 0,
5555
fee: 50000,
56-
amount: '',
56+
amount: '0',
5757
parameters: '',
5858
passPhrase: '',
5959
isShowedPwd: false,
6060
isOpenLedgerConfirm: false,
6161
michelsonCode: '',
6262
delegate: '',
63-
codeFormat: ''
63+
codeFormat: 'micheline'
6464
};
6565

6666
class DeployContract extends Component<Props> {
@@ -179,7 +179,7 @@ class DeployContract extends Component<Props> {
179179
<InputAddressContainer>
180180
<CustomTextArea
181181
label={t('components.interactModal.paste_micheline_code', {
182-
format: codeFormat || 'micheline'
182+
format: codeFormat
183183
})}
184184
multiline
185185
rows={5}

app/components/InteractContractModal/InvokeContract.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ const defaultState = {
5252
gas: 0,
5353
storage: 0,
5454
fee: 50000,
55-
amount: '',
55+
amount: '0',
5656
parameters: '',
5757
passPhrase: '',
5858
isShowedPwd: false,
5959
isOpenLedgerConfirm: false,
60-
codeFormat: '',
60+
codeFormat: 'micheline',
6161
entryPoint: ''
6262
};
6363

app/components/Invoke/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ const initialState = {
148148
selectedInvokeAddress: '',
149149
gas: 0,
150150
storage: 0,
151-
amount: '',
151+
amount: '0',
152152
parameters: '',
153153
passPhrase: '',
154154
isShowedPwd: false,
155155
isOpenLedgerConfirm: false,
156-
codeFormat: ''
156+
codeFormat: 'micheline'
157157
};
158158

159159
class Invoke extends Component<Props> {

app/reduxContent/originate/thunks.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export function originateContract(
105105
url,
106106
userKeyStore,
107107
amountInUtez,
108-
delegate,
108+
delegate.length > 0 ? delegate : undefined,
109109
fee,
110110
userDerivation,
111111
storageLimit,
@@ -135,8 +135,6 @@ export function originateContract(
135135
});
136136
}
137137

138-
console.log('newAddress results-----', newAddress);
139-
140138
if (newAddress) {
141139
const operationResult1 =
142140
newAddress &&

0 commit comments

Comments
 (0)