Comments (9)
Huh that's interesting. Do help me investigate this, can you give me the ABI extract for the balanceOf
and decimals
function?
Also, do you have any chance to see the network requests? It would be interesting to see what was sent / returned when calling these functions.
from web3dart.
Huh that's interesting. Do help me investigate this, can you give me the ABI extract for the
balanceOf
anddecimals
function?
Also, do you have any chance to see the network requests? It would be interesting to see what was sent / returned when calling these functions.
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "spender",
"type": "address"
},
{
"name": "value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "balanceOfZero",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "spender",
"type": "address"
},
{
"name": "addedValue",
"type": "uint256"
}
],
"name": "increaseAllowance",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "acceptOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getRescueAddr",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "lostTokenContract",
"type": "address"
},
{
"name": "value",
"type": "uint256"
}
],
"name": "rescueLostTokenByThisTokenOwner",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "addr",
"type": "address"
}
],
"name": "setRescueAddr",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "addr",
"type": "address"
},
{
"name": "value",
"type": "uint256"
},
{
"name": "doFreeze",
"type": "bool"
}
],
"name": "distribute",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "unfreezeDateTime",
"type": "uint256"
}
],
"name": "setUnfreezeDateTime",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "addr",
"type": "address"
},
{
"name": "value",
"type": "uint256"
}
],
"name": "burn",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "value",
"type": "uint256"
}
],
"name": "mint",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "spender",
"type": "address"
},
{
"name": "subtractedValue",
"type": "uint256"
}
],
"name": "decreaseAllowance",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getUnfreezeDateTime",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "value",
"type": "uint256"
}
],
"name": "burnFromOwner",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "target",
"type": "address"
},
{
"name": "doFreeze",
"type": "bool"
}
],
"name": "freeze",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "newOwner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "owner",
"type": "address"
},
{
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "target",
"type": "address"
}
],
"name": "isAccountFrozen",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "_unfreezeDateTime",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "lostTokenContract",
"type": "address"
},
{
"name": "value",
"type": "uint256"
}
],
"name": "rescueLostTokensByOwn",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"payable": true,
"stateMutability": "payable",
"type": "fallback"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "",
"type": "uint256"
}
],
"name": "globalUnfreezeDatetimeModified",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "target",
"type": "address"
},
{
"indexed": false,
"name": "frozen",
"type": "bool"
}
],
"name": "FreezeFunds",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_from",
"type": "address"
},
{
"indexed": true,
"name": "_to",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "from",
"type": "address"
},
{
"indexed": true,
"name": "to",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": true,
"name": "spender",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
}
]
"Also, do you have any chance to see the network requests"
Uhm, how should I exactly do this? :)
from web3dart.
I guess the easiest way would be to temporarily add https://pub.dev/packages/http_logger, create a http client like
HttpWithMiddleware httpClient = HttpWithMiddleware.build(middlewares: [
HttpLogger(logLevel: LogLevel.BODY),
]);
and pass that httpClient
to the Web3Client
constructor. The requests that contain "method":"eth_call"
are interesting here. Be aware that these potentially contain sensitive information (contract address, your ethereum address and the data sent and received from the contract). If you're on a dev or testing network that's fine, but if you're uncomfortable posting them publicly you could also sent them to me via [email protected].
from web3dart.
Sorry, forget about http_logger
.
You can write one yourself with
import 'package:http/http.dart';
import 'package:web3dart/web3dart.dart';
class LoggingClient extends BaseClient {
final Client _inner;
LoggingClient(this._inner);
@override
Future<StreamedResponse> send(BaseRequest request) async {
if (request is Request) {
print('sending ${request.url} with ${request.body}');
} else {
print('sending ${request.url}');
}
final response = await _inner.send(request);
final read = await Response.fromStream(response);
print('response:\n${read.body}');
return StreamedResponse(
Stream.fromIterable([read.bodyBytes]), response.statusCode);
}
}
Then, you can create the client with Web3Client(rpcUrl, LoggingClient(Client()))
, it should log outgoing requests and their responses.
from web3dart.
Thanks for the email. It appears like this was a Dart (compiler?) bug that is fixed in the beta channel of Flutter.
from web3dart.
Well, I am having the same issue
How to fix?
from web3dart.
I can't use both web3dart, http and http_logger because of the versioning issues. See the logs below:
So, because fw depends on both http_logger ^1.0.0 and http ^0.12.0, version solving failed.
pub get failed (1)
exit code 1
[fw] flutter packages get
Running "flutter packages get" in fw...
Because web3dart >=0.4.2 depends on http ^0.12.0 and fw depends on http ^0.11.3+16, web3dart >=0.4.2 is forbidden.
So, because fw depends on web3dart ^1.0.0-rc.2, version solving failed.
pub get failed (1)
exit code 1
[fw] flutter packages get
Running "flutter packages get" in fw...
Because http_logger >=1.0.0 depends on http_middleware ^1.0.0 which depends on http ^0.11.3+16, http_logger >=1.0.0 requires http ^0.11.3+16.
So, because fw depends on both http_logger ^1.0.0 and http ^0.12.0+2, version solving failed.
pub get failed (1)
exit code 1
I use the following libraries, but http_logger is making a mess right now. I can't use all these libraries, so what should I do?
web3dart : ^1.0.0-rc.2
http : ^0.12.0+2
http_logger : ^1.0.0
from web3dart.
@thelazyindian Can you open another issue with a simple repro that behaves differently on debug and release builds? It would also be helpful to know which exact Flutter version you're using. Thanks.
from web3dart.
Nvm. This error also comes when the contract address is wrong. I messed the contract address earlier but fixed it now and so the error is also fixed. Sorry for incovenience.
from web3dart.
Related Issues (20)
- NFT dapp HOT 1
- How to set a timeout for Web3Client? HOT 1
- intToBytes mistake
- How to decodeParameters
- web3dart
- Ignore non_constant_identifier_names, camel_case_types in generated (.g.dart) files HOT 5
- Test Net HOT 2
- Support ethers.utils functionality HOT 1
- Bug: Zero address returned from contract call causes exception HOT 20
- web3dart: ^2.3.3
- private Api for centralized blockchain HOT 3
- How can i call smart contract functions through web3dart without private key in flutter HOT 2
- getBlockInformation() - Throws Error HOT 1
- Transaction Lists HOT 2
- How a new user can create an account without private key?
- Support for BEP20 Transfer?
- Value not in Range
- On Ganache V 7.0.0 I am receiving an rpc error "Unhandled Exception: RPCError: got code -32700 with msg "Invalid signature v value"." HOT 1
- Getting transactions with eth_getBlockByNumber
- Doesn't work after building project but works fine in debug
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web3dart.