diff --git a/components/ContractInfo/index.tsx b/components/ContractInfo/index.tsx index 0a80f3eb8..c10bbee4d 100644 --- a/components/ContractInfo/index.tsx +++ b/components/ContractInfo/index.tsx @@ -2,6 +2,7 @@ import type { PolyjuiceContract as PolyjuiceContractProps } from 'components/Acc import { useState, useEffect } from 'react' import { useTranslation } from 'next-i18next' import NextLink from 'next/link' +import { utils } from 'ethers' import OpenInNewIcon from 'assets/icons/open-in-new.svg' import ExpandIcon from 'assets/icons/expand.svg' import { currentChain as targetChain } from 'utils' @@ -149,7 +150,8 @@ const ContractInfo: React.FC<{ address: string; contract: PolyjuiceContractProps form.setAttribute(LOADING_ATTRIBUTE, 'true') try { - const result = await method(...params) + const pCKB = form.querySelector('input[name=pCKB]')?.value ?? '0' + const result = await method(...params, { value: utils.parseEther(pCKB) }) if (tabIdx === 2) { const elm = resInputList[0] if (elm) { @@ -340,7 +342,7 @@ const ContractInfo: React.FC<{ address: string; contract: PolyjuiceContractProps ) : null}
Non-payable and Payable
{Object.keys(writeMethods).map(signature => { - const { inputs = [], outputs = [] } = contract.interface.functions[signature] ?? {} + const { inputs = [], outputs = [], payable } = contract.interface.functions[signature] ?? {} return (
@@ -362,6 +364,12 @@ const ContractInfo: React.FC<{ address: string; contract: PolyjuiceContractProps ) })} + {payable ? ( +
+ + +
+ ) : null}
Response
diff --git a/public/locales/en-US/account.json b/public/locales/en-US/account.json index 82425f15a..93fd3d4c4 100644 --- a/public/locales/en-US/account.json +++ b/public/locales/en-US/account.json @@ -92,5 +92,6 @@ "erc721Assets": "ERC 721 Assets", "erc1155Assets": "ERC 1155 Assets", "erc20Assets": "ERC 20 Assets", - "invalidAddress": "*Invalid address format" + "invalidAddress": "*Invalid address format", + "pckb_send_along_with_tx": "Send along with the transaction" } diff --git a/public/locales/zh-CN/account.json b/public/locales/zh-CN/account.json index b0a14e548..5089fb150 100644 --- a/public/locales/zh-CN/account.json +++ b/public/locales/zh-CN/account.json @@ -92,5 +92,6 @@ "erc721Assets": "ERC 721 资产", "erc1155Assets": "ERC 1155 资产", "erc20Assets": "ERC 20 资产", - "invalidAddress": "*无效的地址格式" + "invalidAddress": "*无效的地址格式", + "pckb_send_along_with_tx": "与交易一起发送" }