dappuniversity / eth_swap Goto Github PK
View Code? Open in Web Editor NEWInstant Cryptocurrency Exchange Tutorial
Instant Cryptocurrency Exchange Tutorial
await token.methods.balanceOf(this.state.account).call()
this is returning null value.
please update it.
Subject kinda says it all :)
But what need to be changed inorder for me to accept USDT instead of ETH?
const networkId = await web3.eth.net.getId()
const tokenData = Token.networks[networkId]
if(tokenData) {
const token = new web3.eth.Contract(Token.abi, tokenData.address)
this.setState({ token })
let tokenBalance = await token.methods.balanceOf(this.state.account).call()
this.setState({ tokenBalance: tokenBalance.toString() })
} else {
window.alert('Token contract not deployed to detected network.')
}
`
const networkId = await web3.eth.net.getId()
const tokenData = Token.networks[networkId]
if(tokenData) {
const token = new web3.eth.Contract(Token.abi, tokenData.address)
this.setState({ token })
let tokenBalance = await token.methods.balanceOf(this.state.account).call()
this.setState({ tokenBalance: tokenBalance.toString() })
} else {
window.alert('Token contract not deployed to detected network.')
}`
Hi Everyone
Would you be able to help me find why i am getting this error below when i try to swap Dapp to Eth?
I Finish the 3 hours course from the link below and I managed to swap Eth to Dapp however cannot do the opposite
https://www.dappuniversity.com/articles/learn-blockchain#dependencies
Thank you
Error: invalid address (argument="address", value=undefined, code=INVALID_ARGUMENT, version=address/5.1.0) (argument="_spender", value=undefined, code=INVALID_ARGUMENT, version=abi/5.0.7)
Logger.makeError
C:/Program Files/Git/eth_swap/node_modules/@ethersproject/logger/lib.esm/index.js:219
Logger.throwError
C:/Program Files/Git/eth_swap/node_modules/@ethersproject/logger/lib.esm/index.js:230
Logger.throwArgumentError
C:/Program Files/Git/eth_swap/node_modules/@ethersproject/logger/lib.esm/index.js:235
AddressCoder._throwError
C:/Program Files/Git/eth_swap/node_modules/web3/node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js:54
AddressCoder.encode
C:/Program Files/Git/eth_swap/node_modules/web3/node_modules/@ethersproject/abi/lib.esm/coders/address.js:28
(anonymous function)
C:/Program Files/Git/eth_swap/node_modules/web3/node_modules/@ethersproject/abi/lib.esm/coders/array.js:67
pack
C:/Program Files/Git/eth_swap/node_modules/web3/node_modules/@ethersproject/abi/lib.esm/coders/array.js:53
TupleCoder.encode
C:/Program Files/Git/eth_swap/node_modules/web3/node_modules/@ethersproject/abi/lib.esm/coders/tuple.js:38
AbiCoder.encode
C:/Program Files/Git/eth_swap/node_modules/web3/node_modules/@ethersproject/abi/lib.esm/abi-coder.js:131
ABICoder.push../node_modules/web3/node_modules/web3-eth-abi/lib/index.js.ABICoder.encodeParameters
C:/Program Files/Git/eth_swap/node_modules/web3/node_modules/web3-eth-abi/lib/index.js:145
(anonymous function)
C:/Program Files/Git/eth_swap/node_modules/web3/node_modules/web3-eth-contract/lib/index.js:498
_encodeMethodABI
C:/Program Files/Git/eth_swap/node_modules/web3/node_modules/web3-eth-contract/lib/index.js:497
_processExecuteArguments
C:/Program Files/Git/eth_swap/node_modules/web3/node_modules/web3-eth-contract/lib/index.js:806
_executeMethod
C:/Program Files/Git/eth_swap/node_modules/web3/node_modules/web3-eth-contract/lib/index.js:825
App._this.sellTokens
C:/Program Files/Git/eth_swap/src/components/App.js:71
onSubmit
C:/Program Files/Git/eth_swap/src/components/SellForm.js:20
HTMLUnknownElement.callCallback
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:147
invokeGuardedCallbackDev
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:196
invokeGuardedCallback
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:250
invokeGuardedCallbackAndCatchFirstError
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:265
executeDispatch
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:571
executeDispatchesInOrder
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:596
executeDispatchesAndRelease
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:695
executeDispatchesAndReleaseTopLevel
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:704
forEachAccumulated
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:676
runEventsInBatch
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:844
runExtractedEventsInBatch
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:852
handleTopLevel
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:5030
batchedUpdates$1
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:21425
batchedUpdates
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:2247
dispatchEvent
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:5110
(anonymous function)
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:21482
unstable_runWithPriority
C:/Program Files/Git/eth_swap/node_modules/scheduler/cjs/scheduler.development.js:255
interactiveUpdates$1
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:21481
interactiveUpdates
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:2268
dispatchInteractiveEvent
C:/Program Files/Git/eth_swap/node_modules/react-dom/cjs/react-dom.development.js:5086
▲ 36 stack frames were expanded.
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.
eth_swap/src/components/App.js
Line 71 in eb4a135
eth_swap/src/components/SellForm.js
Line 20 in eb4a135
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.