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

Issue while transfering Native Matic token (Status Pending - This txn hash was found in our secondary node and should be picked up by our indexer in a short while) #5

Open
savannahar68 opened this issue Jan 27, 2022 · 5 comments

Comments

@savannahar68
Copy link
Contributor

savannahar68 commented Jan 27, 2022

I'm running transfer_matic.js code given in example dir of this repository to transfer Native Matic token from one account to other account. Whenever I run the code the transaction is successful but the Matic is not transferred, and this is what I see on polygonscan

transaction hash - 0xcacf05fbcc7b32817e4ddc5c6cf6f19e9fdbb13a56826e6784b73a1f1e4e7bc5

image

I'm doing this on

network - testnet
version - mumbai
From Private key -
From address - https://mumbai.polygonscan.com/address/0x89A7D20d87146c36dfD72cB0B85C728E0C57E778
To address - https://mumbai.polygonscan.com/address/0xde55899b7f9091ef0db6ffd38ddd976493e17092
Root RPC - Goreli RPC
Child RPC - MATIC mumbai RPC

Have tried multiple RPC and wallet key combination and the RPC and wallet are on testnet (mumbai). I've also tried with multiple Gas Limit starting from the highest which gives error for high txn fees than cap, till low, getting same error for all the combinations.

I've enough MATIC in my wallet. (Do i also need ETH in my wallet ?)

@ujjwalgupta94 can you help here. Have been scratching my head since 2 days on this issue.
Let me know if you need any other information which will help in resolving the issue.

@ujjwalgupta94
Copy link
Contributor

Your transaction is in pending state, it might be due to low gas or wrong nonce. Try sending the tx with higher gas fee.

@savannahar68
Copy link
Contributor Author

@ujjwalgupta94 is there a way to estimate gas price using maticjs api ?

Ethers.js has a way to do it which resolved the issue - https://docs.ethers.io/v5/api/providers/provider/#Provider-estimateGas
If there's a way to do it using Matic.js then let me know, I can try it and update the code in example folder

@ujjwalgupta94
Copy link
Contributor

@savannahar68 estimateGas calculates amount of the gas required not the gas price right ?

from the ether docs -

Returns an estimate of the amount of gas that would be required to submit transaction to the network.

@savannahar68
Copy link
Contributor Author

@ujjwalgupta94 that's right
Do we have similar function in maticjs library ?

@ujjwalgupta94
Copy link
Contributor

yes that is already calculated for each transaction, you can see for yourself by using returnTransaction:true in the transaction send option object.

like this -

const result = await erc20Token.transfer(amount, to, { returnTransaction:true });
console.log('result',result);

this is how the result will look like -

 {
  from: '0xbBca830ee5dCABde33DB24496b5524b9C5A69fe6',
  returnTransaction: true,
  gasLimit: 112590,
  nonce: 84,
  chainId: 5,
  data: '0xe3dec8fb000000000000000000000000bbca830ee5dcabde33db24496b5524b9c5a69fe60000000000000000000000002e3ef7931f2d0e4a7da3dea950ff3f19269d906300000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000007b0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000',
  to: '0xBbD7cBFA79faee899Eaf900F13C9065bF03B1A74'
}

The gasLimit is the one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@savannahar68 @ujjwalgupta94 and others