Closed matrix543 closed 1 year ago
Problem 1
Same here for me ...
I have this problem too. You can install it with --ignore-platform-reqs
I did a solution where I fork the repo edited it to work with php8 uploaded it so I could install the package with composer from my own repo
composer require matrix543/erc20-php
@matrix543 How to get balance of token with this package? Can you give me example?
i did it in laravel so install wih composer v2
in your laravel controller
use EthereumRPC\EthereumRPC; use ERC20\ERC20;
public static function getbalance($address){
$id = Auth::id();
$geth = new EthereumRPC('127.0.0.1', '8545');
$token_contract = <ETH token contract addr>
$erc20 = new ERC20($geth);
$token = $erc20->token($token_contract);
$balance = $token->balanceOf($address);
return $balance;
}
in composer json
"matrix543/erc20-php": "^0.1.4", "matrix543/ethereum-rpc": "^0.1.5",
Does it work with metamask open nodes?
it talks to a geth node that you run on your lokal pc or a vps you can connect metamask to a lokal geth node to
I want to use metamask RPCs to get balance of address in php without running full node.
it depends if metamask let you connect to an ip and port the php package will work otherwise you have to run geth with lightmode on a server so it dosent eat up your hard drive
geth --syncmode "light"
Composer fail if you run php 8.05