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

having errror raw transaction failed with contract evm transaction #24

Open
webexpert979 opened this issue Jan 28, 2023 · 1 comment
Open

Comments

@webexpert979
Copy link

Hi, I am working on velas account using sponsor host. I am using the following code `const web3 = new Web3(vaclient.provider)
const nonce = await web3.eth.getTransactionCount(userInfo.account_key_evm) // userinfo object from prev step;
const from = userInfo.account_key_evm;
console.log(from);
const contract = new web3.eth.Contract(MEMBER_ABI, "0xd4faA4a9cA8879E48aED6635e6f77eEaeE568Bad");
const contract1 = new web3.eth.Contract(CONTACT_ABI, nft.contractAddress);
const member = await contract.methods.walletOfOwner(from).call();
console.log(member);
let csrf_token = null;

try {
    const response = await fetch("http://localhost:3002/csrf/");
    const { token } = await response.json();
    csrf_token = token;
	const raw = {
    nonce:    nonce,
    from:     from,
    gas:      '500000',
    gasPrice: '20000000001',
	value:'0',
    broadcast: true,
    csrf_token,
}
contract.methods.transfer().send(raw) 
.on('error', function(error){ 
    console.log(error.message)
})
.on('receipt', function(receipt){
   console.log(receipt.transactionHash)
})

} catch (error) {
    console.log("csrf host is not available");
};

return;`

and I am gettint the following error on running the code
image

@webexpert979
Copy link
Author

Now I have funded the logged in velas account the evm transaction is happening but it still gives error Raw transaction failed and custom instruction error is invalid rent paying account. the code for evm transaction is as below
`try {
const response = await fetch("http://localhost:3002/csrf/");
const { token } = await response.json();
csrf_token = token;
const raw = {
nonce: nonce,
from: from,
gas: '500000',
gasPrice: '20000000001',
value:'0',
broadcast: true,
csrf_token,
}
contract.methods.transfer().send(raw)
.on('error', function(error){
console.log(error.message)
})
.on('receipt', function(receipt){
console.log(receipt.transactionHash)
})

} catch (error) {
console.log("csrf host is not available");
};`

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

1 participant