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

Post transaction returning 410 Error when token balance is greater than transaction fee #144

Closed
rellyvalentine opened this issue Jul 6, 2023 · 2 comments

Comments

@rellyvalentine
Copy link

Hello,
I recently started using Arlocal and when going to post a transaction, Arlocal returns a 410 error that says "You don't have enough tokens."
Before calling this method, I fund the wallet and confirm that the transaction completes successfully
let arWallet
arweave.wallets.generate().then((t) => { arWallet = t arweave.api.get('mint/${arWallet.n}/10000000000000000000').then((t) => console.log(t)) console.log(arWallet) })
...
const check = await fetch('http://localhost:1984/wallet/${arWallet.n}/balance') console.log(await check.json())

After creating and signing the transaction, I check the price of the transaction to ensure that it's less than the current wallet balance
console.log(JSON.stringify(courseDesc)) const cost = await fetch('http://localhost:1984/price/${tx.data_size}') console.log(await cost.json())

Upon running arweave.post(tx), I receive the following
Screenshot_2023-07-06_14-05-27

I'm quite new to Arlocal so I'm hoping to receive some insight on why this behavior is occurring.
Thanks!

@jim-toth
Copy link
Contributor

jim-toth commented Jul 7, 2023

You're minting to the n value of the JWK (I am assuming this is the public key?) when instead you need to be minting to and using the wallet's address. You should be able to get the address using arweave.wallets.jwkToAddress(arWallet)

@rellyvalentine
Copy link
Author

thank you!! that fixed the problem.

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

2 participants