You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I already composer it (composer require attestto/solana-php-sdk) and make a test PHP file
<?php
ini_set('display_errors', 'on');
require_once('sub_api/libs/solana-php-sdk/vendor/autoload.php');
use Attestto\SolanaPhpSdk\Connection;
use Attestto\SolanaPhpSdk\SolanaRpcClient;
// Using a defined method
$client = new SolanaRpcClient(SolanaRpcClient::DEVNET_ENDPOINT);
$connection = new Connection($client); // MAINNET_ENDPOINT
$accountInfo = $connection->getBalance('B7dwR8DSLzwEYzyPKtX5MHhoe2XzfvBHkP759Q5zzM4h');
$getBalance = $accountInfo/1000000000;
echo "<pre>";
print_r("balance = ". $getBalance);
echo "</pre>";
$fromPublicKey = KeyPair::fromSecretKey(['nKsCgMmf9SPMKUFP6GgaSFik7W1BZyfWSGJqCF4itjdpbwiuxdqSsRvV6dzWZDXe7CdoHh5npS3D7v1Qjm6rAow']);
$toPublicKey = new PublicKey('2aGoKx41dPRU6L7HrX33Az6VdFU7C9u7qnE8yF56bqKA');
$instruction = SystemProgram::transfer(
$fromPublicKey->getPublicKey(),
$toPublicKey,
1
);
$transaction = new Transaction(null, null, $fromPublicKey->getPublicKey());
$transaction->add($instruction);
$txHash = $connection->sendTransaction($transaction, $fromPublicKey);
echo "<pre>";
print_r($txHash);
echo "</pre>";
And got this result
10
Fatal error: Uncaught Error: Class "KeyPair" not found in C:\xampp\htdocs\pro.ject\sol.php:16 Stack trace: #0 {main} thrown in C:\xampp\htdocs\pro.ject\sol.php on line 16
Do I miss anything?
The text was updated successfully, but these errors were encountered:
I already composer it (composer require attestto/solana-php-sdk) and make a test PHP file
And got this result
10
Fatal error: Uncaught Error: Class "KeyPair" not found in C:\xampp\htdocs\pro.ject\sol.php:16 Stack trace: #0 {main} thrown in C:\xampp\htdocs\pro.ject\sol.php on line 16
Do I miss anything?
The text was updated successfully, but these errors were encountered: