Skip to content

Decode an unsignedTransaction results to nil #902

@smartine-ledger

Description

@smartine-ledger

What happened?

Hi team,

When I am trying to decode this unsigned transaction (0x02e90a50825b7482621e82520894b548c80ea2346f5ce5853b54d1e943bf29c0505e8609184e72a00080c0) I get nill

What are the steps to reproduce?

    public func decodeRlpTransaction(rawTransaction: String) -> EthereumTransactionBridge? {
        guard let transactionInBytes = Data.fromHex(rawTransaction) else {
            return nil
        }
        
        guard let codableTransaction = CodableTransaction(rawValue: transactionInBytes) else {
            print("FAILURE HERE")
            return nil
        }
        
        guard let unsignedTx = codableTransaction.encode(for: .signature)?.toHexString() else {
            return nil
        }
        
        return EthereumTransactionBridge(
            transaction: unsignedTx,
            to: codableTransaction.to.address.lowercased(),
            chainId: codableTransaction.chainID?.description ?? "0",
            data: "0x"+codableTransaction.data.toHexString().lowercased(),
            type: codableTransaction.type.toEthereumTransactionType()
        )
    }

What is the expected behavior?

Be able to extract all the transaction field :

{
  "chainId": "10",
  "type": "EIP-1559",
  "valid": false,
  "hash": "0x44b2717ec4f2af5c7f4e1204e3b80e366d38ba5863a60d8eaf5d58e25df2b362",
  "nonce": "80",
  "gasLimit": "21000",
  "maxFeePerGas": "25118",
  "maxPriorityFeePerGas": "23412",
  "to": "0xb548c80ea2346f5ce5853b54d1e943bf29c0505e",
  "value": "10000000000000"
}

What is the error thrown?

CodableTransaction(rawValue: <rawTx>) returns nil

What's the stack trace said?

CodableTransaction(rawValue: <rawTx>) returns nil

OS version

IOS 18.5

Library version

3.3.0

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