Skip to content

When transaction is encoded, data of member variable of transaction disappears. #619

@zuv55

Description

@zuv55

I am trying to send an ERC20 token using "createWriteOperation"
this is transaction

guard let writeOp = contract.createWriteOperation("transfer", parameters: parameters,extraData: Data())else{
            print("ERROR3");return;
 }
↓print(writeOp.transaction)

Transaction
Type: Legacy
Nonce: 32
Gas price: 30000000000
Gas limit: 100000
To: 0x~
Value: 0
Data: 0x
Resolved chainID: Optional(1)
- Intrinsic chainID: Optional(1)
- Infered chainID: Optional(1)
v: ~
r: ~
s: ~
from: Optional("0x~")
hash: Optional("0x~")

the data certainly exists.

print(transaction.data.toHexString())
→a9059cbb000000000000000000~~

This may represents the transfer method.
But the problem happens when encoding the transaction.

guard let transactionData = writeOp.transaction.encode() else { throw Web3Error.dataError }
print(transactionData.toHexString())
→~f8652.....

Then, when this transaction is decoded using https://flightwallet.github.io/decode-eth-tx/

{
  "nonce": 32,
  "gasPrice": 30000000000,
  "gasLimit": 100000,
  "to": "0x~~",
  "value": 0,
  "data": "",
  "from": "0x~~",
  "r": "~~",
  "v": "~~",
  "s": "~~"
}

"data" of member variable of transaction disappears.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions