Irys-xyz / arweave-js-sdk

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

[demo app] Can not fund my test account in local #59

Closed shixin-guo closed 2 years ago

shixin-guo commented 2 years ago

I want to try Bundlr in testnet, but the balance is always equal to 0, even though I have added some test eth from faucets

const bundlerHttpAddress = 'https://devnet.bundlr.network'

const currency = 'ethereum'
const privateKey =
  'my-private-key'
const bundlr = new Bundlr(bundlerHttpAddress, currency, privateKey, {
  providerUrl: 'https://rinkeby.infura.io/v3/',
  contractAddress: '0x11D634457F99595aBE7B582739fd52b7ed48995A',   // https://rinkeby.etherscan.io/address/0x11D634457F99595aBE7B582739fd52b7ed48995A
})

const address = await bundlr.address const converted = bundlr.utils.unitConverter(balance)

converted === 0

image image
shixin-guo commented 2 years ago

I try to follow this document and use chainlink https://docs.bundlr.network/docs/devnet

// const currency = 'ethereum'
const currency = 'chainlink'
// todo how to remove privateKey from code and env file
const privateKey =
  'my-test-privateKey'
const bundlr = new Bundlr(bundlerHttpAddress, currency, privateKey, {
  providerUrl: 'https://rinkeby.infura.io/v3/',
  //   contractAddress: '0x11D634457F99595aBE7B582739fd52b7ed48995A',
  contractAddress: '0x01BE23585060835E02B77ef475b0Cc51aA1e0709',
})

I test Chainlink , also failed

shixin-guo commented 2 years ago

Oh I got ,,,,

image
shixin-guo commented 2 years ago

but I try to use the demo project to fund my account in my local, but there are some error

'https://main-light.eth.linkpool.io/' CORS

image image
JesseTheRobot commented 2 years ago

Hey there @shixin-guo , thanks for the report Quick note, we have transitioned to the Goerli testnet - as such the Goerli Chainlink contract address has changed to 0x326C977E6efc84E512bB9C30f76E30c160eD06FB - you will also need to find and use a Goerli testnet RPC to continue using the Devnet node

shixin-guo commented 2 years ago

Thank you very much, @JesseTheRobot . However, I have another question about CORS , do you know how to fix it? I'd like to test my account on my local, but I'm receiving CORS errors. https://github.com/Bundlr-Network/demo-app

but I try to use the demo project to fund my account in my local, but there are some error

'https://main-light.eth.linkpool.io/' CORS

image image
JesseTheRobot commented 2 years ago

You probably need to use a local CORS proxy, I haven't encountered this issue when tested the demo application locally, but my Dev environment is pretty unique so that's probably why.

shixin-guo commented 2 years ago

OK thank you, I will try to find a walkaround

shixin-guo commented 2 years ago

sorry to bother you again, but I try again but still meet the error

image

this is my test repo https://github.com/shixin-guo/demo-app vercel preview url : https://bundlrtest.vercel.app/

image

can you help figure out the root cause?
@JesseTheRobot

JesseTheRobot commented 2 years ago

Ah right, so you need to update the client. - you seem to be using an old version that is using a post merge defunct RPC

shixin-guo commented 2 years ago

thanks, I updated to the newest code, but meet another issue

I want to fund 0.5eth , but in this demo code, it will multiply by 1000000000000000000, so Metamask will alert "insufficient funds for intrinsic transaction cost"

if I delete this part and use 0.5eth directly, js-SDK will alert "must use an integer for funding amount"

image image

@JesseTheRobot

JesseTheRobot commented 2 years ago

yes, this is because MetaMask expects (or did expect anyway) the funding amount to be in wei, rather than decimals - can you show me the value MetaMask shows for the transfer?

shixin-guo commented 2 years ago

@JesseTheRobot

image

this is my test repo https://github.com/shixin-guo/demo-app vercel preview url : https://bundlrtest.vercel.app/

select Ethereum and like this:

image
JesseTheRobot commented 2 years ago

did you change the RPC url? you need to set a goerli eth RPC under "advanced options"

JesseTheRobot commented 2 years ago

you also need to disable chain changing and manually set it to Goerli

shixin-guo commented 2 years ago
image image

eth contract address https://goerli.etherscan.io/address/0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6

same issue

even I try to use hardcode

 const bundlr = new WebBundlr(bundlerHttpAddress, currency, provider, { providerUrl: 'https://rpc.goerli.mudit.blog/', contractAddress: '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6' });

still tell me 'insufficient funds for intrinsic transaction cost' but My balance has 0.3eth @JesseTheRobot are there some wrong config? 😭

shixin-guo commented 2 years ago

I use a new RPC , now it is fine , Thank you very much for your response. 🚀