Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodeError(desc: "transaction underpriced") #476

Closed
AlleniCode opened this issue Mar 7, 2022 · 2 comments
Closed

nodeError(desc: "transaction underpriced") #476

AlleniCode opened this issue Mar 7, 2022 · 2 comments
Labels
bug Something isn't working FAQ common questions tend to recur about web3 infra

Comments

@AlleniCode
Copy link

AlleniCode commented Mar 7, 2022

I make the transaction from json:

["object": {
    data = 0x7ff36ab500000000000000000000000000000000000000000000000000034039a4aab0bf0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000dcafb08f535d986c72ac254fe0bb225ccc0f77fc00000000000000000000000000000000000000000000000000000000c44d75b900000000000000000000000000000000000000000000000000000000000000030000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a063000000000000000000000000831753dd7087cac61ab5644b308642cc1c33dc13;
    from = 0xdcafb08f535d986c72ac254fe0bb225ccc0f77fc;
    gas = 0x50315;
    to = 0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff;
    value = 0x16345785d8a0000;
}, "name": signTransaction, "id": 1646704788011]

`
TransactionOptions(to: Optional(web3swift.EthereumAddress(_address: "0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff", type: web3swift.EthereumAddress.AddressType.normal)), from: Optional(web3swift.EthereumAddress(_address: "0xdcafb08f535d986c72ac254fe0bb225ccc0f77fc", type: web3swift.EthereumAddress.AddressType.normal)), gasLimit: Optional(web3swift.TransactionOptions.GasLimitPolicy.manual(328469)), gasPrice: Optional(web3swift.TransactionOptions.GasPricePolicy.manual(1845490560)), value: Optional(100000000000000000), nonce: Optional(web3swift.TransactionOptions.NoncePolicy.latest), callOnBlock: Optional(web3swift.TransactionOptions.CallingBlockPolicy.pending))

Transaction
Nonce: 68
Gas price: 1845490560
Gas limit: 328469
To: 0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff
Value: 100000000000000000
Data: 0x7ff36ab500000000000000000000000000000000000000000000000000034039a4aab0bf0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000dcafb08f535d986c72ac254fe0bb225ccc0f77fc00000000000000000000000000000000000000000000000000000000c44d75b900000000000000000000000000000000000000000000000000000000000000030000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a063000000000000000000000000831753dd7087cac61ab5644b308642cc1c33dc13
v: 1
r: 0
s: 0
Intrinsic chainID: Optional(137)
Infered chainID: Optional(1)
sender: nil
`

// Polygon Mainnet
let web333 = web3(provider: Web3HttpProvider(URL(string: "https://polygon-mainnet.g.alchemy.com/v2/X7YSnkDc6on7md1Tabt2ECssPYtJ4wCm")!, network: Networks.Custom(networkID: BigUInt(137)))!)

let options = TransactionOptions.fromJSON(dic)
var transaction = EthereumTransaction.fromJSON(dic)
let pendingNonce = try web333.eth.getTransactionCount(address: walletAdd, onBlock: "pending")
let latestNonce = try web333.eth.getTransactionCount(address: walletAdd, onBlock: "latest")
let selectedNonce = max(pendingNonce, latestNonce)
transaction.nonce = selectedNonce
transaction.UNSAFE_setChainID(BigUInt(137))
let result = try web333.eth.sendTransaction(transaction, transactionOptions: options, password: password)

@skywinder @BaldyAsh

@ichikmarev ichikmarev added the bug Something isn't working label Mar 20, 2022
@AlleniCode
Copy link
Author

Hello?

@mloit
Copy link
Contributor

mloit commented Apr 29, 2022

A number of changes have been made around Transactions since this was posted. Unfortunately the fromJSON functions were prematurely removed from the API along the way. (Though I've now restored them in #558)

Can you try testing now using #558 as your base, to see if the issue has been resolved? Barring any issues, the PR should be merged in early next week with the next 2.x release.

If you use SPM you can repoint it to use the PR temporarily for testing:
.package(url: "https://github.com/skywinder/web3swift.git", branch: "pull/558/head")

@Kristenlike1234 Kristenlike1234 added the FAQ common questions tend to recur about web3 infra label Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working FAQ common questions tend to recur about web3 infra
Projects
None yet
Development

No branches or pull requests

4 participants