Irys-xyz / arweave-js-sdk

JS SDK for Irys on Arweave
110 stars 95 forks source link

Error when funding account in $MATIC #9

Closed romanlv closed 2 years ago

romanlv commented 2 years ago
npx bundlr fund -h https://node1.bundlr.network -c matic -w $PRIVATE_KEY  500000000000000000

produces

assuming raw key instead of keyfile path
Loaded address: 0x....
? Confirmation: send 500000000000000000 wei (0.5 matic) to node1.bundlr.network (0x....)?
 Y / N y
0xed66902deab4....
(node:74180) UnhandledPromiseRejectionWarning: Error: HTTP Error: Posting transaction information to the bundler: 400 "Invalid tx"
    at Function.checkAndThrow (.../contracts/node_modules/@bundlr-network/client/build/src/utils.js:20:19)
    at Fund.<anonymous> (.../contracts/node_modules/@bundlr-network/client/build/src/fund.js:29:29)
    at Generator.next (<anonymous>)
    at fulfilled (.../contracts/node_modules/@bundlr-network/client/node_modules/tslib/tslib.js:114:62)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:74180) UnhandledPromiseRejectionWarning: Unhandled promise rejection...

using "version": "0.3.0"

romanlv commented 2 years ago

checking balance npx bundlr balance 0x11382... -c matic -h https://node1.bundlr.network Balance: 0 wei (0 matic)

romanlv commented 2 years ago

it seems a to be a problem with backend, POST https://node1.bundlr.network/account/balance/matic always returns Invalid tx for valid polygon transaction id

JesseTheRobot commented 2 years ago

Fixed by dd70e72 Thanks for the report!

romanlv commented 2 years ago

@JesseTheRobot, thanks for the quick response. Unfortunately, the issue isn't fixed with 0.3.1, I'm getting the same error about Invalid tx from the node.

https://github.com/Bundlr-Network/js-client/commit/dd70e729c6ecb3999c426a6d01ab10c8e1ae90f6 makes it to wait for transaction to be confirmed, but it looks like node does not accept any Matic transactions

e.g. here is a transaction of my failed attempt to fund https://polygonscan.com/tx/0xbaf9f38a6669de410afc5667198af7a40c4adfe523d1ec6414a825b00fed8440

when trying to post it manually, the same error is returned

curl -i -X POST https://node1.bundlr.network/account/balance/matic \
   -H 'Content-Type: application/json' \
   -d '{ "tx_id": "0xbaf9f38a6669de410afc5667198af7a40c4adfe523d1ec6414a825b00fed8440" }'

returns

HTTP/2 400 ... Invalid tx

JesseTheRobot commented 2 years ago

We haven't deployed the node-side fix just yet - once that's done the issue should resolve itself. I'll keep this issue open until that happens.

joshbenaron commented 2 years ago

All nodes are running the new version

romanlv commented 2 years ago

Hi, there is still an issue with funding in MATIC on mainnet

npx bundlr fund 30000000000000000 -h https://node1.bundlr.network -c matic -w ${MY_MATIC_PK}
assuming raw key instead of keyfile path
Loaded address: 0x11382c88e24e650dbbef5632ea75464c15bfd66b
? Confirmation: send 30000000000000000 wei (0.03 matic) to node1.bundlr.network (0xb4DE0833771eae55040b698aF5eB06d59E142C82)?
 Y / N Y
0x3f4270d497c8167dde096f6c188ccfe653a4fede58444c761ad010b8e370b571
(node:69042) UnhandledPromiseRejectionWarning: Error: HTTP Error: Posting transaction information to the bundler: 400 "Bad Request"
....

it did transfer 0.03 matic from my account, but looks like it got failed waiting for the transaction and didn't post txId (with POST {[node}}/account/balance/matic)

It may work on testnet, but it takes longer on mainnet ...

joshbenaron commented 2 years ago

What version of the client are you on?

romanlv commented 2 years ago

Sorry, I was testing with 0.3.1 and just realized that latest is on 0.5.1, it seems to work with latest.

joshbenaron commented 2 years ago

Awesome thanks @romanlv!