"APIRequest.sendRequest()" doesn't work with erc1155ABI
See original GitHub issueWhat happened?
This is when I tried to send tokens using ERC1155.
I generated the signed transaction using the ERC1155ABI. This is a decoded version of that transaction using https://flightwallet.github.io/decode-eth-tx/.
{
"nonce": 0,
"gasPrice": 124135355866,
"gasLimit": 82646,
"to": "0x29533991~",
"value": 0,
"data": "f242432a0000000000000000000000002953399124f0cbb46d2cbacd8a89cf0599974963000000000000000000000000713956a23~~~~~~a0000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000",
"from": "0xe86cf02b510a238046479~",
"r": "~",
"v": "~",
"s": "~"
}
And this is a decoded version of the “data” using https://lab.miguelmota.com/ethereum-input-data-decoder/example/
{
"method": "safeTransferFrom",
"types": [
"address",
"address",
"uint256",
"uint256",
"bytes"
],
"inputs": [
"~~",
"~",
{
"type": "BigNumber",
"hex": "0x193d~~"
},
{
"type": "BigNumber",
"hex": "0x0a"
},
"0x"
],
"names": [
"from",
"to",
"id",
"amount",
"data"
]
}
At first glance, there seems to be no mistake. However, when I use “APIRequest.sendRequest()” for this transaction, I get an error
let request: APIRequest = .sendRawTransaction(tx)
let response: APIResponse<Hash> = try await APIRequest.sendRequest(with: web3.provider, for: request)
The error message is here.
Swift.DecodingError.keyNotFound(CodingKeys(stringValue: "result", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: \"result\", intValue: nil) (\"result\").", underlyingError: nil))
What are the steps to reproduce?
Step1 : Please create a transaction first.
contract.createWriteOperation("safeTransferFrom", parameters: [originalOwner, to, id, value, data] as [AnyObject] )
Step2:Please sign the transaction
Web3Signer.signTX(transaction: &writeOp.transaction,
keystore: web3.provider.attachedKeystoreManager!,
account: self.address! ,
password: "")
Step3 Write that transaction into the chain.
let request: APIRequest = .sendRawTransaction(tx)
let response: APIResponse<Hash> = try await APIRequest.sendRequest(with: web3.provider, for: request)
What is the expected behavior?
If the transfer is successful, a hash of the transaction should be returned.
What is the error thrown?
Swift.DecodingError.keyNotFound(CodingKeys(stringValue: “result”, intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: “No value associated with key CodingKeys(stringValue: "result", intValue: nil) ("result").”, underlyingError: nil))
What’s the stack trace said?
Sources/Core/EthereumNetwork/Request/APIRequest+Methods
Issue Analytics
- State:
- Created 10 months ago
- Comments:8
Top GitHub Comments
@zuv55 unfortunately ERC specs are not the best part of me, so I really don’t know.
Got you, but please fill new issue for that to avoid messing up with different topics within one issue.