solana-php-sdk
solana-php-sdk copied to clipboard
ErrorException during error handling
Hi, I tried to transfer funds from empty account on devnet and received an error. I expected the error, but it wasn't handled properly.
Please, change https://github.com/Attestto-com/solana-php-sdk/blob/7e0118fa6e34d66e574d65da627b07136cddbd42/src/SolanaRpcClient.php#L150
to
$error = $body['params']['error'] ?? $body['error'];
The original JSON response was
{"jsonrpc":"2.0","error":{"code":-32002,"message":"Transaction simulation failed: Attempt to debit an account but found no record of a prior credit.","data":{"accounts":null,"err":"AccountNotFound","innerInstructions":null,"logs":[],"returnData":null,"unitsConsumed":0}},"id":80411175}