diff --git a/packages/page-contracts/src/Codes/Upload.tsx b/packages/page-contracts/src/Codes/Upload.tsx index 7f80975e7d..ac679477b7 100644 --- a/packages/page-contracts/src/Codes/Upload.tsx +++ b/packages/page-contracts/src/Codes/Upload.tsx @@ -92,7 +92,7 @@ function Upload ({ onClose }: Props): React.ReactElement { ? code.tx[contractAbi.constructors[constructorIndex].method]({ gasLimit: weight.weight, storageDepositLimit: null, - value + value: contractAbi?.constructors[constructorIndex].isPayable ? value : undefined }, ...params) : null; } catch (e) { @@ -200,14 +200,17 @@ function Upload ({ onClose }: Props): React.ReactElement { params={contractAbi.constructors[constructorIndex].args} registry={contractAbi.registry} /> - ('The balance to transfer from the `origin` to the newly created contract.')} - isError={!isValueValid} - isZeroable={hasStorageDeposit} - label={t('value')} - onChange={setValue} - value={value} - /> + {contractAbi.constructors[constructorIndex].isPayable && ( + ('The balance to transfer from the `origin` to the newly created contract.')} + isError={!isValueValid} + isZeroable={hasStorageDeposit} + label={t('value')} + onChange={setValue} + value={value} + /> + ) + } ('The maximum amount of gas that can be used by this deployment, if the code requires more, the deployment will fail')} weight={weight} diff --git a/packages/page-contracts/src/Contracts/Deploy.tsx b/packages/page-contracts/src/Contracts/Deploy.tsx index 0ed876f245..21b5548b1d 100644 --- a/packages/page-contracts/src/Contracts/Deploy.tsx +++ b/packages/page-contracts/src/Contracts/Deploy.tsx @@ -86,7 +86,7 @@ function Deploy ({ codeHash, constructorIndex = 0, onClose, setConstructorIndex ? salt : null, storageDepositLimit: null, - value + value: contractAbi?.constructors[constructorIndex].isPayable ? value : undefined }, ...params); } catch (error) { return null; @@ -172,14 +172,16 @@ function Deploy ({ codeHash, constructorIndex = 0, onClose, setConstructorIndex /> )} - ('The balance to transfer from the `origin` to the newly created contract.')} - isError={!isValueValid} - isZeroable={hasStorageDeposit} - label={t('value')} - onChange={setValue} - value={value} - /> + {contractAbi?.constructors[constructorIndex].isPayable && ( + ('The balance to transfer from the `origin` to the newly created contract.')} + isError={!isValueValid} + isZeroable={hasStorageDeposit} + label={t('value')} + onChange={setValue} + value={value} + /> + )} ('A hex or string value that acts as a salt for this deployment.')} isDisabled={!withSalt}