Open vnxz opened 2 years ago
It seems your contract is deployed to the BSC, so you need a provider on that blockchain.
localhost:8545 is a local address in cas you use a local node (hardhat, truffle, ganache, ...)
You need to use a provider uri for that blockchain (see: https://docs.binance.org/smart-chain/developer/create-wallet.html#connect-to-bsc-network)
Something like this to connect to the BSC mainnet :
$contract = new Contract('https://bsc-dataseed1.binance.org:443', $abi);
An other example for the BSC testnet and with a timeout for the provider (default is 1s and this is short sometimes):
$providerUri='https://data-seed-prebsc-1-s1.binance.org:8545';
$timeout = 30;
$provider = new HttpProvider(new HttpRequestManager($providerUri, $timeout));
$contract = new Contract($provider, $abi)
It seems your contract is deployed to the BSC, so you need a provider on that blockchain.
localhost:8545 is a local address in cas you use a local node (hardhat, truffle, ganache, ...)
You need to use a provider uri for that blockchain (see: https://docs.binance.org/smart-chain/developer/create-wallet.html#connect-to-bsc-network)
Something like this to connect to the BSC mainnet :
$contract = new Contract('https://bsc-dataseed1.binance.org:443', $abi);
An other example for the BSC testnet and with a timeout for the provider (default is 1s and this is short sometimes):
$providerUri='https://data-seed-prebsc-1-s1.binance.org:8545'; $timeout = 30; $provider = new HttpProvider(new HttpRequestManager($providerUri, $timeout)); $contract = new Contract($provider, $abi)
thanks bro, can you also show me process of sending token in web3.php. it need to sign in transaction first and then send token. cannot call directly transfer method . do you have some example for this . I try to send token on web3.php by laravel.
Please see my response here: https://github.com/web3p/web3.php/issues/251#issuecomment-1063884215
Thinks
I try to interact with smart contract in laravel using web3.php.
my contract is
error is
why this happen? plz someone help