Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Move consts to real consts in Solana
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstauffer committed Sep 12, 2021
1 parent 6efc67f commit 39476cd
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Solana.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace Tighten\SolanaPhpSdk;

use Illuminate\Http\Client\Response;

class Solana
{
public const solanaTokenProgramId = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
public const metaplexPublicKey = 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s';

protected $client;

public function __construct(SolanaRpcClient $client)
Expand All @@ -30,11 +31,10 @@ public function getConfirmedTransaction(string $transactionSignature): array

public function getProgramAccounts(string $pubKey)
{
$probablyMetaPlexKey = 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s'; // 🤷‍♂️
$magicOffsetNumber = 326; // 🤷‍♂️

return $this->client->call('getProgramAccounts', [
$probablyMetaPlexKey,
self::metaplexPublicKey,
[
'encoding' => 'base64',
'filters' => [
Expand All @@ -51,12 +51,10 @@ public function getProgramAccounts(string $pubKey)

public function getTokenAccountsByOwner(string $pubKey)
{
$solanaTokenProgramId = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';

return $this->client->call('getTokenAccountsByOwner', [
$pubKey,
[
'programId' => $solanaTokenProgramId,
'programId' => self::solanaTokenProgramId,

This comment has been minimized.

Copy link
@wilburpowery

wilburpowery Sep 12, 2021

You should maybe accept a programId here and default to the constant if nothing is passed in. This endpoint can also be used to load tokens for a specific mint or a different programId @mattstauffer.

This comment has been minimized.

Copy link
@mattstauffer

mattstauffer Sep 12, 2021

Author Contributor

Good call!

],
[
'encoding' => 'jsonParsed',
Expand Down

0 comments on commit 39476cd

Please sign in to comment.