verze-app / solana-php-sdk

Simple PHP SDK for Solana JSON RPC endpoints
MIT License
88 stars 45 forks source link

Updating README.md to reflect 0.2.0 changes #11

Closed neverything closed 2 years ago

neverything commented 2 years ago

I wanted to update the README.md file to reflect the breaking changes in 0.2.0, but I'm not sure what the best way is to update the following portion: https://github.com/tighten/solana-php-sdk/blob/main/README.md?plain=1#L20-L42

When trying to use:

$sdk = new Program(new SolanaRpcClient(SolanaRpcClient::MAINNET_ENDPOINT));
$accountInfo = $sdk->getAccountInfo('4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA');
var_dump($accountInfo);

It throws an error, which makes sense:

TypeError
Tighten\SolanaPhpSdk\SolanaRpcClient::call(): Argument #2 ($params) must be of type array, string given, called in /Users/neverything/Sites/.../vendor/tightenco/solana-php-sdk/src/Program.php on line 19

Not sure if the intention is to use the classes individually like so @exzachlyvv and @mattstauffer?

$sdk = new Connection(new SolanaRpcClient(SolanaRpcClient::MAINNET_ENDPOINT));
$accountInfo = $sdk->getAccountInfo('4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA');
var_dump($accountInfo);

Let me know how I can assist with updating the docs accordingly.

exzachlyvv commented 2 years ago

Ahh yes, please use the new Connection class for now. That one will be built out more as I find the time. The goal is to better match with other Solana SDKs.

It would be awesome if you can add that to the CHANGELOG.

neverything commented 2 years ago

@exzachlyvv will get to it probably this weekend.