Skip to content

Commit

Permalink
fix: data in tx default set 0x
Browse files Browse the repository at this point in the history
  • Loading branch information
galenyuan committed Jun 4, 2021
1 parent ecdf325 commit 920b5b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Sometimes DApp not set value param(like [https://pancakeswap.finance/farms](http

## data

When transaction is not a contract(like send token to another address), DApp will not set data param, we use empty string(`''`) as default.
When transaction is not a contract(like send token to another address), DApp will not set data param, we use `0x` as default.
4 changes: 2 additions & 2 deletions src/ui/views/Approval/components/SignTx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ const SignTx = ({ params, origin }) => {
if (!chainId) {
chainId = CHAINS[site!.chain].id;
}
const [{ data = '', from, gas, gasPrice, nonce, to, value }] = params.data;
const [{ data = '0x', from, gas, gasPrice, nonce, to, value }] = params.data;
const [tx, setTx] = useState<Tx>({
chainId,
data,
data: data || '0x', // can not execute with empty string, use 0x instead
from,
gas,
gasPrice,
Expand Down

0 comments on commit 920b5b8

Please sign in to comment.