From 6f7765d0aec6fa8708c655c98855184664be997c Mon Sep 17 00:00:00 2001 From: Eduardo Chongkan Date: Sat, 4 May 2024 13:32:59 -0600 Subject: [PATCH] Remove Uncovered SNS WIP to get a more accurate coverage report --- build/html-coverage/Account.php.html | 8 +- build/html-coverage/Accounts/Creator.php.html | 2 +- .../Accounts/Did/ServiceStruct.php.html | 2 +- .../Did/VerificationMethodStruct.php.html | 2 +- .../html-coverage/Accounts/Did/dashboard.html | 2 +- build/html-coverage/Accounts/Did/index.html | 2 +- build/html-coverage/Accounts/DidData.php.html | 2 +- .../html-coverage/Accounts/Metadata.php.html | 2 +- .../Accounts/MetadataData.php.html | 2 +- .../Sns/NameRegistryStateAccount.php.html | 2 +- .../Accounts/Sns/NtfRecordAccount.php.html | 2 +- .../html-coverage/Accounts/Sns/dashboard.html | 2 +- build/html-coverage/Accounts/Sns/index.html | 2 +- build/html-coverage/Accounts/dashboard.html | 2 +- build/html-coverage/Accounts/index.html | 2 +- .../html-coverage/Borsh/BinaryReader.php.html | 30 +- .../html-coverage/Borsh/BinaryWriter.php.html | 16 +- build/html-coverage/Borsh/Borsh.php.html | 46 +-- .../Borsh/BorshDeserializable.php.html | 24 +- .../Borsh/BorshException.php.html | 2 +- .../html-coverage/Borsh/BorshObject.php.html | 2 +- .../Borsh/BorshSerializable.php.html | 14 +- build/html-coverage/Borsh/dashboard.html | 2 +- build/html-coverage/Borsh/index.html | 2 +- build/html-coverage/Connection.php.html | 28 +- .../AccountNotFoundException.php.html | 2 +- .../BaseSolanaPhpSdkException.php.html | 2 +- .../Exceptions/GenericException.php.html | 2 +- .../InputValidationException.php.html | 2 +- .../InvalidIdResponseException.php.html | 2 +- .../MethodNotFoundException.php.html | 2 +- .../Exceptions/SNSError.php.html | 2 +- .../Exceptions/TodoException.php.html | 2 +- .../TokenAccountNotFoundError.php.html | 2 +- .../TokenInvalidAccountOwnerError.php.html | 2 +- .../Exceptions/TokenInvalidMintError.php.html | 2 +- .../TokenOwnerOffCurveError.php.html | 2 +- build/html-coverage/Exceptions/dashboard.html | 2 +- build/html-coverage/Exceptions/index.html | 2 +- .../Interfaces/AccountKeyInterface.php.html | 2 +- build/html-coverage/Interfaces/dashboard.html | 2 +- build/html-coverage/Interfaces/index.html | 2 +- build/html-coverage/Keypair.php.html | 42 +-- build/html-coverage/Message.php.html | 74 ++-- build/html-coverage/Program.php.html | 6 +- .../Programs/DidSolProgram.php.html | 2 +- .../Programs/MetaplexProgram.php.html | 2 +- .../SplToken/Actions/SPLTokenActions.php.html | 245 ++++++------ .../Programs/SplToken/Actions/dashboard.html | 14 +- .../Programs/SplToken/Actions/index.html | 26 +- .../SPLTokenInstructions.php.html | 50 +-- .../Instructions/TokenInstruction.php.html | 2 +- .../SplToken/Instructions/dashboard.html | 2 +- .../Programs/SplToken/Instructions/index.html | 2 +- .../Programs/SplToken/dashboard.html | 14 +- .../Programs/SplToken/index.html | 26 +- .../Programs/SplTokenProgram.php.html | 310 +++++----------- .../Programs/SystemProgram.php.html | 4 +- build/html-coverage/Programs/dashboard.html | 82 +--- build/html-coverage/Programs/index.html | 108 ++---- build/html-coverage/PublicKey.php.html | 76 ++-- build/html-coverage/SolanaRpcClient.php.html | 60 +-- build/html-coverage/State/Account.php.html | 22 +- build/html-coverage/State/dashboard.html | 2 +- build/html-coverage/State/index.html | 2 +- build/html-coverage/State/mint.php.html | 2 +- build/html-coverage/Transaction.php.html | 349 +++++++++--------- .../TransactionInstruction.php.html | 8 +- build/html-coverage/Util/AccountMeta.php.html | 10 +- build/html-coverage/Util/Buffer.php.html | 80 ++-- build/html-coverage/Util/Commitment.php.html | 14 +- .../Util/CompiledInstruction.php.html | 8 +- .../Util/ConfirmOptions.php.html | 12 +- .../html-coverage/Util/HasPublicKey.php.html | 2 +- .../html-coverage/Util/HasSecretKey.php.html | 2 +- .../html-coverage/Util/MessageHeader.php.html | 8 +- .../Util/NonceInformation.php.html | 2 +- build/html-coverage/Util/ShortVec.php.html | 20 +- .../Util/SignaturePubkeyPair.php.html | 8 +- build/html-coverage/Util/Signer.php.html | 2 +- build/html-coverage/Util/dashboard.html | 2 +- build/html-coverage/Util/index.html | 2 +- build/html-coverage/dashboard.html | 92 +---- build/html-coverage/index.html | 62 ++-- .../SNS/Constants/config.json | 0 .../SNS/Constants/record.json | 0 .../SNS => config/SNS/Deprecated}/Utils.php | 17 +- .../SNS/InstructionBurn.php | 8 +- .../SNS/InstructionRegisterFavorite.php | 16 +- .../SNS/InstructionReverse.php | 4 +- .../Programs => config}/SNS/InstructionV2.php | 4 +- .../Programs => config}/SNS/InstructionV3.php | 48 +-- .../SNS/InstructionWithNft.php | 16 +- {src/Programs => config}/SNS/Instructions.php | 9 +- .../SNS/Nft/NameTokenizer.php | 12 +- src/Programs/SNS/Deprecated/Utils.php | 156 -------- src/Programs/SNS/Nft/Nft.php | 0 src/Programs/SNS/Resolve.php | 0 src/Programs/SplSnsProgram.php | 91 ----- .../SplToken/Actions/SPLTokenActions.php | 67 ++-- src/Programs/SplTokenProgram.php | 102 +---- tests/Unit/Programs/SplProgramTest.php | 1 - 102 files changed, 1021 insertions(+), 1624 deletions(-) rename {src/Programs => config}/SNS/Constants/config.json (100%) rename {src/Programs => config}/SNS/Constants/record.json (100%) rename {src/Programs/SNS => config/SNS/Deprecated}/Utils.php (93%) rename {src/Programs => config}/SNS/InstructionBurn.php (98%) rename {src/Programs => config}/SNS/InstructionRegisterFavorite.php (87%) rename {src/Programs => config}/SNS/InstructionReverse.php (98%) rename {src/Programs => config}/SNS/InstructionV2.php (98%) rename {src/Programs => config}/SNS/InstructionV3.php (82%) rename {src/Programs => config}/SNS/InstructionWithNft.php (94%) rename {src/Programs => config}/SNS/Instructions.php (97%) rename {src/Programs => config}/SNS/Nft/NameTokenizer.php (85%) delete mode 100644 src/Programs/SNS/Deprecated/Utils.php delete mode 100644 src/Programs/SNS/Nft/Nft.php delete mode 100644 src/Programs/SNS/Resolve.php delete mode 100644 src/Programs/SplSnsProgram.php diff --git a/build/html-coverage/Account.php.html b/build/html-coverage/Account.php.html index 168fa23..fceac93 100644 --- a/build/html-coverage/Account.php.html +++ b/build/html-coverage/Account.php.html @@ -188,12 +188,12 @@ 15     */ 16    public function __construct($secretKey = null) 17    { - 18        if ($secretKey) { + 18        if ($secretKey) { 19            $secretKeyString = Buffer::from($secretKey)->toString(); 20 21            $this->keypair = Keypair::fromSecretKey($secretKeyString); 22        } else { - 23            $this->keypair = Keypair::generate(); + 23            $this->keypair = Keypair::generate(); 24        } 25    } 26 @@ -210,7 +210,7 @@ 37     */ 38    public function getSecretKey(): Buffer 39    { - 40        return $this->keypair->getSecretKey(); + 40        return $this->keypair->getSecretKey(); 41    } 42 43 @@ -225,7 +225,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Accounts/Creator.php.html b/build/html-coverage/Accounts/Creator.php.html index 440d91b..c4ee9a3 100644 --- a/build/html-coverage/Accounts/Creator.php.html +++ b/build/html-coverage/Accounts/Creator.php.html @@ -107,7 +107,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Accounts/Did/ServiceStruct.php.html b/build/html-coverage/Accounts/Did/ServiceStruct.php.html index 2eb9313..ec6cc81 100644 --- a/build/html-coverage/Accounts/Did/ServiceStruct.php.html +++ b/build/html-coverage/Accounts/Did/ServiceStruct.php.html @@ -122,7 +122,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Accounts/Did/VerificationMethodStruct.php.html b/build/html-coverage/Accounts/Did/VerificationMethodStruct.php.html index b4993c2..dc1a672 100644 --- a/build/html-coverage/Accounts/Did/VerificationMethodStruct.php.html +++ b/build/html-coverage/Accounts/Did/VerificationMethodStruct.php.html @@ -122,7 +122,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Accounts/Did/dashboard.html b/build/html-coverage/Accounts/Did/dashboard.html index 323da3d..7560186 100644 --- a/build/html-coverage/Accounts/Did/dashboard.html +++ b/build/html-coverage/Accounts/Did/dashboard.html @@ -137,7 +137,7 @@

Project Risks

diff --git a/build/html-coverage/Accounts/Did/index.html b/build/html-coverage/Accounts/Did/index.html index 045838d..a1c849e 100644 --- a/build/html-coverage/Accounts/Did/index.html +++ b/build/html-coverage/Accounts/Did/index.html @@ -95,7 +95,7 @@

Legend

High: 90% to 100%

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Accounts/DidData.php.html b/build/html-coverage/Accounts/DidData.php.html index a153cbc..9eb9ca7 100644 --- a/build/html-coverage/Accounts/DidData.php.html +++ b/build/html-coverage/Accounts/DidData.php.html @@ -195,7 +195,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Accounts/Metadata.php.html b/build/html-coverage/Accounts/Metadata.php.html index 91850ac..d19601f 100644 --- a/build/html-coverage/Accounts/Metadata.php.html +++ b/build/html-coverage/Accounts/Metadata.php.html @@ -171,7 +171,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Accounts/MetadataData.php.html b/build/html-coverage/Accounts/MetadataData.php.html index ddd262a..05a89fe 100644 --- a/build/html-coverage/Accounts/MetadataData.php.html +++ b/build/html-coverage/Accounts/MetadataData.php.html @@ -170,7 +170,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Accounts/Sns/NameRegistryStateAccount.php.html b/build/html-coverage/Accounts/Sns/NameRegistryStateAccount.php.html index 366f505..df592ee 100644 --- a/build/html-coverage/Accounts/Sns/NameRegistryStateAccount.php.html +++ b/build/html-coverage/Accounts/Sns/NameRegistryStateAccount.php.html @@ -230,7 +230,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Accounts/Sns/NtfRecordAccount.php.html b/build/html-coverage/Accounts/Sns/NtfRecordAccount.php.html index 9316c17..2224f8c 100644 --- a/build/html-coverage/Accounts/Sns/NtfRecordAccount.php.html +++ b/build/html-coverage/Accounts/Sns/NtfRecordAccount.php.html @@ -242,7 +242,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Accounts/Sns/dashboard.html b/build/html-coverage/Accounts/Sns/dashboard.html index 926f0c0..c40d238 100644 --- a/build/html-coverage/Accounts/Sns/dashboard.html +++ b/build/html-coverage/Accounts/Sns/dashboard.html @@ -148,7 +148,7 @@

Project Risks

diff --git a/build/html-coverage/Accounts/Sns/index.html b/build/html-coverage/Accounts/Sns/index.html index a0db3ba..e6a7a6e 100644 --- a/build/html-coverage/Accounts/Sns/index.html +++ b/build/html-coverage/Accounts/Sns/index.html @@ -140,7 +140,7 @@

Legend

High: 90% to 100%

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Accounts/dashboard.html b/build/html-coverage/Accounts/dashboard.html index 79c9593..750d672 100644 --- a/build/html-coverage/Accounts/dashboard.html +++ b/build/html-coverage/Accounts/dashboard.html @@ -147,7 +147,7 @@

Project Risks

diff --git a/build/html-coverage/Accounts/index.html b/build/html-coverage/Accounts/index.html index 38f2bea..73d58ae 100644 --- a/build/html-coverage/Accounts/index.html +++ b/build/html-coverage/Accounts/index.html @@ -221,7 +221,7 @@

Legend

High: 90% to 100%

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Borsh/BinaryReader.php.html b/build/html-coverage/Borsh/BinaryReader.php.html index 0618755..67d182c 100644 --- a/build/html-coverage/Borsh/BinaryReader.php.html +++ b/build/html-coverage/Borsh/BinaryReader.php.html @@ -540,8 +540,8 @@ 14 15    public function __construct(Buffer $buffer) 16    { - 17        $this->buffer = $buffer; - 18        $this->offset = 0; + 17        $this->buffer = $buffer; + 18        $this->offset = 0; 19    } 20 21    /** @@ -549,7 +549,7 @@ 23     */ 24    public function readU8(): int 25    { - 26        return $this->readUnsignedInt(1, Buffer::TYPE_BYTE); + 26        return $this->readUnsignedInt(1, Buffer::TYPE_BYTE); 27    } 28 29    /** @@ -565,7 +565,7 @@ 39     */ 40    public function readU32(): int 41    { - 42        return $this->readUnsignedInt(4, Buffer::TYPE_INT); + 42        return $this->readUnsignedInt(4, Buffer::TYPE_INT); 43    } 44 45    /** @@ -573,7 +573,7 @@ 47     */ 48    public function readU64(): int 49    { - 50        return $this->readUnsignedInt(8, Buffer::TYPE_LONG); + 50        return $this->readUnsignedInt(8, Buffer::TYPE_LONG); 51    } 52 53    /** @@ -614,9 +614,9 @@ 88     */ 89    protected function readUnsignedInt($length, $datatype): int 90    { - 91        $value = $this->buffer->slice($this->offset, $length, $datatype, false)->value(); - 92        $this->offset += $length; - 93        return $value; + 91        $value = $this->buffer->slice($this->offset, $length, $datatype, false)->value(); + 92        $this->offset += $length; + 93        return $value; 94    } 95 96    /** @@ -666,12 +666,12 @@ 140     */ 141    public function readFixedArray(int $length): array 142    { - 143        return $this->readBuffer($length)->toArray(); + 143        return $this->readBuffer($length)->toArray(); 144    } 145 146    public function readPubKey(): PublicKey 147    { - 148        return new PublicKey($this->readFixedArray(32)); + 148        return new PublicKey($this->readFixedArray(32)); 149    } 150 151    public function readPubKeyAsString(): string @@ -699,13 +699,13 @@ 173     */ 174    protected function readBuffer($length): Buffer 175    { - 176        if ($this->offset + $length > sizeof($this->buffer)) { + 176        if ($this->offset + $length > sizeof($this->buffer)) { 177            throw new BorshException("Expected buffer length {$length} isn't within bounds"); 178        } 179 - 180        $buffer = $this->buffer->slice($this->offset, $length); - 181        $this->offset += $length; - 182        return $buffer; + 180        $buffer = $this->buffer->slice($this->offset, $length); + 181        $this->offset += $length; + 182        return $buffer; 183    } 184 185} @@ -719,7 +719,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Borsh/BinaryWriter.php.html b/build/html-coverage/Borsh/BinaryWriter.php.html index 620d2a1..b8faab2 100644 --- a/build/html-coverage/Borsh/BinaryWriter.php.html +++ b/build/html-coverage/Borsh/BinaryWriter.php.html @@ -473,8 +473,8 @@ 13 14    public function __construct() 15    { - 16        $this->buffer = Buffer::from(); - 17        $this->length = 0; + 16        $this->buffer = Buffer::from(); + 17        $this->length = 0; 18    } 19 20    /** @@ -483,7 +483,7 @@ 23     */ 24    public function writeU8(int $value) 25    { - 26        return $this->writeBuffer(Buffer::from($value, Buffer::TYPE_BYTE, false)); + 26        return $this->writeBuffer(Buffer::from($value, Buffer::TYPE_BYTE, false)); 27    } 28 29    /** @@ -608,9 +608,9 @@ 148     */ 149    protected function writeBuffer(Buffer $buffer) 150    { - 151        $this->buffer->push($buffer); - 152        $this->length += sizeof($buffer); - 153        return $this; + 151        $this->buffer->push($buffer); + 152        $this->length += sizeof($buffer); + 153        return $this; 154    } 155 156    /** @@ -618,7 +618,7 @@ 158     */ 159    public function toArray() 160    { - 161        return $this->buffer->slice(0, $this->length)->toArray(); + 161        return $this->buffer->slice(0, $this->length)->toArray(); 162    } 163} @@ -631,7 +631,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Borsh/Borsh.php.html b/build/html-coverage/Borsh/Borsh.php.html index 9dbde15..d9aed32 100644 --- a/build/html-coverage/Borsh/Borsh.php.html +++ b/build/html-coverage/Borsh/Borsh.php.html @@ -257,9 +257,9 @@ 17        $object 18    ) : array 19    { - 20        $writer = new BinaryWriter(); - 21        static::serializeObject($schema, $object, $writer); - 22        return $writer->toArray(); + 20        $writer = new BinaryWriter(); + 21        static::serializeObject($schema, $object, $writer); + 22        return $writer->toArray(); 23    } 24 25    /** @@ -272,15 +272,15 @@ 32        $object, 33        BinaryWriter $writer 34    ) { - 35        $objectSchema = $schema[get_class($object)] ?? null; - 36        if (! $objectSchema) { + 35        $objectSchema = $schema[get_class($object)] ?? null; + 36        if (! $objectSchema) { 37            $class = get_class($object); 38            throw new BorshException("Class {$class} is missing in schema"); 39        } 40 - 41        if ($objectSchema['kind'] === 'struct') { - 42            foreach ($objectSchema['fields'] as list($fieldName, $fieldType)) { - 43                static::serializeField($schema, $fieldName, $object->{$fieldName}, $fieldType, $writer); + 41        if ($objectSchema['kind'] === 'struct') { + 42            foreach ($objectSchema['fields'] as list($fieldName, $fieldType)) { + 43                static::serializeField($schema, $fieldName, $object->{$fieldName}, $fieldType, $writer); 44            } 45        } elseif ($objectSchema['kind'] === 'enum') { 46            throw new TodoException("TODO: Enums don't exist in PHP yet???"); @@ -305,8 +305,8 @@ 65        $fieldType, 66        BinaryWriter $writer 67    ) { - 68        if (is_string($fieldType)) { - 69            $writer->{'write' . ucfirst($fieldType)}($value); + 68        if (is_string($fieldType)) { + 69            $writer->{'write' . ucfirst($fieldType)}($value); 70        } elseif (is_array($fieldType) && isset($fieldType[0])) { // sequential array 71            if (is_int($fieldType[0])) { 72                if (sizeof($value) !== $fieldType[0]) { @@ -357,8 +357,8 @@ 117        array $buffer 118    ) 119    { - 120        $reader = new BinaryReader(Buffer::from($buffer)); - 121        return static::deserializeObject($schema, $class, $reader); + 120        $reader = new BinaryReader(Buffer::from($buffer)); + 121        return static::deserializeObject($schema, $class, $reader); 122    } 123 124    /** @@ -371,22 +371,22 @@ 131        string $class, 132        BinaryReader $reader 133    ) { - 134        $objectSchema = $schema[$class] ?? null; - 135        if (! $objectSchema) { + 134        $objectSchema = $schema[$class] ?? null; + 135        if (! $objectSchema) { 136            throw new BorshException("Class {$class} is missing in schema"); 137        } 138 - 139        if ($objectSchema['kind'] === 'struct') { - 140            if (! method_exists($class, 'borshConstructor')) { + 139        if ($objectSchema['kind'] === 'struct') { + 140            if (! method_exists($class, 'borshConstructor')) { 141                throw new BorshException("Class {{$class}} does not implement borshConstructor. Please use the BorshDeserialize trait."); 142            } 143 - 144            $result = $class::borshConstructor(); - 145            foreach ($objectSchema['fields'] as list($fieldName, $fieldType)) { - 146                $result->{$fieldName} = static::deserializeField($schema, $fieldName, $fieldType, $reader); + 144            $result = $class::borshConstructor(); + 145            foreach ($objectSchema['fields'] as list($fieldName, $fieldType)) { + 146                $result->{$fieldName} = static::deserializeField($schema, $fieldName, $fieldType, $reader); 147                //$result->fields[$fieldName] = static::deserializeField($schema, $fieldName, $fieldType, $reader); 148            } - 149            return $result; + 149            return $result; 150        } 151 152        if ($objectSchema['kind'] === 'enum') { @@ -409,8 +409,8 @@ 169        $fieldType, 170        BinaryReader $reader 171    ) { - 172        if (is_string($fieldType) && ! class_exists($fieldType)) { - 173            return $reader->{'read' . ucfirst($fieldType)}(); + 172        if (is_string($fieldType) && ! class_exists($fieldType)) { + 173            return $reader->{'read' . ucfirst($fieldType)}(); 174        } 175 176        if (is_array($fieldType) && isset($fieldType[0])) { // sequential array @@ -449,7 +449,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Borsh/BorshDeserializable.php.html b/build/html-coverage/Borsh/BorshDeserializable.php.html index a2f8204..f0946ed 100644 --- a/build/html-coverage/Borsh/BorshDeserializable.php.html +++ b/build/html-coverage/Borsh/BorshDeserializable.php.html @@ -230,7 +230,7 @@ 12     */ 13    public static function borshConstructor() 14    { - 15        return new static(); + 15        return new static(); 16    } 17 18    /** @@ -242,17 +242,17 @@ 24    public function __set(string $name, mixed $value) 25    { 26        // Set the value in the dynamic properties if it's not private - 27        if (!$this->isPrivateProperty($name)) { - 28            $this->fields[$name] = $value; + 27        if (!$this->isPrivateProperty($name)) { + 28            $this->fields[$name] = $value; 29        } 30 31        // Check if the property exists as a private property - 32        if ($this->isPrivateProperty($name)) { + 32        if ($this->isPrivateProperty($name)) { 33            // Use reflection to set the value of the private property - 34            $reflectionClass = new ReflectionClass($this); - 35            $property = $reflectionClass->getProperty($name); - 36            $property->setAccessible(true); - 37            $property->setValue($this, $value); + 34            $reflectionClass = new ReflectionClass($this); + 35            $property = $reflectionClass->getProperty($name); + 36            $property->setAccessible(true); + 37            $property->setValue($this, $value); 38        } 39    } 40 @@ -292,13 +292,13 @@ 74    private function isPrivateProperty(string $name): bool 75    { 76        // Get the class name ( whatever class is implementing this trait, e.g. Any Schema/Struct based object - 77        $className = static::class; + 77        $className = static::class; 78 79        // Create a ReflectionClass instance for the class - 80        $reflectionClass = new ReflectionClass($className); + 80        $reflectionClass = new ReflectionClass($className); 81 82        // Check if the property is declared in the class and is private - 83        return $reflectionClass->hasProperty($name) && $reflectionClass->getProperty($name)->isPrivate(); + 83        return $reflectionClass->hasProperty($name) && $reflectionClass->getProperty($name)->isPrivate(); 84    } 85} @@ -311,7 +311,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Borsh/BorshException.php.html b/build/html-coverage/Borsh/BorshException.php.html index 6fc4c9f..a25c6f3 100644 --- a/build/html-coverage/Borsh/BorshException.php.html +++ b/build/html-coverage/Borsh/BorshException.php.html @@ -96,7 +96,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Borsh/BorshObject.php.html b/build/html-coverage/Borsh/BorshObject.php.html index d179c28..adae088 100644 --- a/build/html-coverage/Borsh/BorshObject.php.html +++ b/build/html-coverage/Borsh/BorshObject.php.html @@ -102,7 +102,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Borsh/BorshSerializable.php.html b/build/html-coverage/Borsh/BorshSerializable.php.html index 786f2ad..2deae34 100644 --- a/build/html-coverage/Borsh/BorshSerializable.php.html +++ b/build/html-coverage/Borsh/BorshSerializable.php.html @@ -147,17 +147,17 @@ 17    public function __get(string $name) 18    { 19        // Check if the property exists in the dynamic properties - 20        if (array_key_exists($name, $this->fields)) { + 20        if (array_key_exists($name, $this->fields)) { 21            return $this->fields[$name]; 22        } 23 24        // Check if the property exists as a private property - 25        if ($this->isPrivateProperty($name)) { + 25        if ($this->isPrivateProperty($name)) { 26            // Use reflection to access the private property - 27            $reflectionClass = new ReflectionClass($this); - 28            $property = $reflectionClass->getProperty($name); - 29            $property->setAccessible(true); - 30            return $property->getValue($this); + 27            $reflectionClass = new ReflectionClass($this); + 28            $property = $reflectionClass->getProperty($name); + 29            $property->setAccessible(true); + 30            return $property->getValue($this); 31        } 32 33        // Property not found @@ -174,7 +174,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Borsh/dashboard.html b/build/html-coverage/Borsh/dashboard.html index bc27df3..27535a0 100644 --- a/build/html-coverage/Borsh/dashboard.html +++ b/build/html-coverage/Borsh/dashboard.html @@ -169,7 +169,7 @@

Project Risks

diff --git a/build/html-coverage/Borsh/index.html b/build/html-coverage/Borsh/index.html index c3d2c6c..0026b4f 100644 --- a/build/html-coverage/Borsh/index.html +++ b/build/html-coverage/Borsh/index.html @@ -249,7 +249,7 @@

Legend

High: 90% to 100%

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Connection.php.html b/build/html-coverage/Connection.php.html index 9ea4497..38454dc 100644 --- a/build/html-coverage/Connection.php.html +++ b/build/html-coverage/Connection.php.html @@ -329,13 +329,13 @@ 24     */ 25    public function getAccountInfo(string $pubKey): array 26    { - 27        $accountResponse = $this->client->call('getAccountInfo', [$pubKey, ["encoding" => "base64"]])['value']; + 27        $accountResponse = $this->client->call('getAccountInfo', [$pubKey, ["encoding" => "base64"]])['value']; 28 - 29        if (! $accountResponse) { - 30            throw new AccountNotFoundException("API Error: Account {$pubKey} not found."); + 29        if (! $accountResponse) { + 30            throw new AccountNotFoundException("API Error: Account {$pubKey} not found."); 31        } 32 - 33        return $accountResponse; + 33        return $accountResponse; 34    } 35 36    /** @@ -385,7 +385,7 @@ 80     */ 81    public function getLatestBlockhash(?Commitment $commitment = null): array 82    { - 83        return $this->client->call('getLatestBlockhash', array_filter([$commitment]))['value']; + 83        return $this->client->call('getLatestBlockhash', array_filter([$commitment]))['value']; 84    } 85 86    /** @@ -402,21 +402,21 @@ 97     */ 98    public function sendTransaction(Transaction $transaction, array $signers, array $params = []) 99    { - 100        if (! $transaction->recentBlockhash) { - 101            $transaction->recentBlockhash = $this->getLatestBlockhash()['blockhash']; + 100        if (! $transaction->recentBlockhash) { + 101            $transaction->recentBlockhash = $this->getLatestBlockhash()['blockhash']; 102        } - 103        $transaction->sign(...$signers); + 103        $transaction->sign(...$signers); 104 - 105        $rawBinaryString = $transaction->serialize(false); + 105        $rawBinaryString = $transaction->serialize(false); 106 - 107        $hashString = sodium_bin2base64($rawBinaryString, SODIUM_BASE64_VARIANT_ORIGINAL); + 107        $hashString = sodium_bin2base64($rawBinaryString, SODIUM_BASE64_VARIANT_ORIGINAL); 108 - 109        $send_params = ['encoding' => 'base64', 'preflightCommitment' => 'confirmed']; + 109        $send_params = ['encoding' => 'base64', 'preflightCommitment' => 'confirmed']; 110 - 111        foreach ($params as $k=>$v) + 111        foreach ($params as $k=>$v) 112            $send_params[$k] = $v; 113 - 114        return $this->client->call('sendTransaction', [$hashString, $send_params]); + 114        return $this->client->call('sendTransaction', [$hashString, $send_params]); 115    } 116 117    /** @@ -466,7 +466,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Exceptions/AccountNotFoundException.php.html b/build/html-coverage/Exceptions/AccountNotFoundException.php.html index bef0e4b..8a7d928 100644 --- a/build/html-coverage/Exceptions/AccountNotFoundException.php.html +++ b/build/html-coverage/Exceptions/AccountNotFoundException.php.html @@ -96,7 +96,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Exceptions/BaseSolanaPhpSdkException.php.html b/build/html-coverage/Exceptions/BaseSolanaPhpSdkException.php.html index 21e2345..a9460f5 100644 --- a/build/html-coverage/Exceptions/BaseSolanaPhpSdkException.php.html +++ b/build/html-coverage/Exceptions/BaseSolanaPhpSdkException.php.html @@ -96,7 +96,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Exceptions/GenericException.php.html b/build/html-coverage/Exceptions/GenericException.php.html index 533d836..be21933 100644 --- a/build/html-coverage/Exceptions/GenericException.php.html +++ b/build/html-coverage/Exceptions/GenericException.php.html @@ -96,7 +96,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Exceptions/InputValidationException.php.html b/build/html-coverage/Exceptions/InputValidationException.php.html index 49d3247..de02a19 100644 --- a/build/html-coverage/Exceptions/InputValidationException.php.html +++ b/build/html-coverage/Exceptions/InputValidationException.php.html @@ -94,7 +94,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Exceptions/InvalidIdResponseException.php.html b/build/html-coverage/Exceptions/InvalidIdResponseException.php.html index 862e5f8..8f4efe3 100644 --- a/build/html-coverage/Exceptions/InvalidIdResponseException.php.html +++ b/build/html-coverage/Exceptions/InvalidIdResponseException.php.html @@ -96,7 +96,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Exceptions/MethodNotFoundException.php.html b/build/html-coverage/Exceptions/MethodNotFoundException.php.html index e0ad57f..e584fd9 100644 --- a/build/html-coverage/Exceptions/MethodNotFoundException.php.html +++ b/build/html-coverage/Exceptions/MethodNotFoundException.php.html @@ -96,7 +96,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Exceptions/SNSError.php.html b/build/html-coverage/Exceptions/SNSError.php.html index c0b90fd..063cb6a 100644 --- a/build/html-coverage/Exceptions/SNSError.php.html +++ b/build/html-coverage/Exceptions/SNSError.php.html @@ -187,7 +187,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TodoException.php.html b/build/html-coverage/Exceptions/TodoException.php.html index e1defa5..6cccc9c 100644 --- a/build/html-coverage/Exceptions/TodoException.php.html +++ b/build/html-coverage/Exceptions/TodoException.php.html @@ -152,7 +152,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TokenAccountNotFoundError.php.html b/build/html-coverage/Exceptions/TokenAccountNotFoundError.php.html index a1af8f4..4864cea 100644 --- a/build/html-coverage/Exceptions/TokenAccountNotFoundError.php.html +++ b/build/html-coverage/Exceptions/TokenAccountNotFoundError.php.html @@ -95,7 +95,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TokenInvalidAccountOwnerError.php.html b/build/html-coverage/Exceptions/TokenInvalidAccountOwnerError.php.html index 243949c..9da2886 100644 --- a/build/html-coverage/Exceptions/TokenInvalidAccountOwnerError.php.html +++ b/build/html-coverage/Exceptions/TokenInvalidAccountOwnerError.php.html @@ -95,7 +95,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TokenInvalidMintError.php.html b/build/html-coverage/Exceptions/TokenInvalidMintError.php.html index 063d69b..b269191 100644 --- a/build/html-coverage/Exceptions/TokenInvalidMintError.php.html +++ b/build/html-coverage/Exceptions/TokenInvalidMintError.php.html @@ -96,7 +96,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TokenOwnerOffCurveError.php.html b/build/html-coverage/Exceptions/TokenOwnerOffCurveError.php.html index 353cff8..20d5417 100644 --- a/build/html-coverage/Exceptions/TokenOwnerOffCurveError.php.html +++ b/build/html-coverage/Exceptions/TokenOwnerOffCurveError.php.html @@ -95,7 +95,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Exceptions/dashboard.html b/build/html-coverage/Exceptions/dashboard.html index b8b8e4b..43091e3 100644 --- a/build/html-coverage/Exceptions/dashboard.html +++ b/build/html-coverage/Exceptions/dashboard.html @@ -140,7 +140,7 @@

Project Risks

diff --git a/build/html-coverage/Exceptions/index.html b/build/html-coverage/Exceptions/index.html index 12328bc..7ea3711 100644 --- a/build/html-coverage/Exceptions/index.html +++ b/build/html-coverage/Exceptions/index.html @@ -269,7 +269,7 @@

Legend

High: 90% to 100%

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Interfaces/AccountKeyInterface.php.html b/build/html-coverage/Interfaces/AccountKeyInterface.php.html index 71d2300..9a95475 100644 --- a/build/html-coverage/Interfaces/AccountKeyInterface.php.html +++ b/build/html-coverage/Interfaces/AccountKeyInterface.php.html @@ -83,7 +83,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Interfaces/dashboard.html b/build/html-coverage/Interfaces/dashboard.html index 71ad7fd..acbdfeb 100644 --- a/build/html-coverage/Interfaces/dashboard.html +++ b/build/html-coverage/Interfaces/dashboard.html @@ -136,7 +136,7 @@

Project Risks

diff --git a/build/html-coverage/Interfaces/index.html b/build/html-coverage/Interfaces/index.html index 94468aa..071ef3e 100644 --- a/build/html-coverage/Interfaces/index.html +++ b/build/html-coverage/Interfaces/index.html @@ -81,7 +81,7 @@

Legend

High: 90% to 100%

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Keypair.php.html b/build/html-coverage/Keypair.php.html index 7574893..3e4a4f5 100644 --- a/build/html-coverage/Keypair.php.html +++ b/build/html-coverage/Keypair.php.html @@ -282,17 +282,17 @@ 21 22    public function __construct($publicKey = null, $secretKey = null) 23    { - 24        if ($publicKey == null && $secretKey == null) { - 25            $keypair = sodium_crypto_sign_keypair(); + 24        if ($publicKey == null && $secretKey == null) { + 25            $keypair = sodium_crypto_sign_keypair(); 26 - 27            $publicKey = sodium_crypto_sign_publickey($keypair); - 28            $secretKey = sodium_crypto_sign_secretkey($keypair); + 27            $publicKey = sodium_crypto_sign_publickey($keypair); + 28            $secretKey = sodium_crypto_sign_secretkey($keypair); 29        } 30 31        // $this->publicKey = Buffer::from($publicKey); 32        // $this->secretKey = Buffer::from($secretKey); - 33        $this->publicKey = new PublicKey($publicKey); - 34        $this->secretKey = new Buffer($secretKey); + 33        $this->publicKey = new PublicKey($publicKey); + 34        $this->secretKey = new Buffer($secretKey); 35    } 36 37    /** @@ -301,9 +301,9 @@ 40     */ 41    public static function generate(): Keypair 42    { - 43        $keypair = sodium_crypto_sign_keypair(); + 43        $keypair = sodium_crypto_sign_keypair(); 44 - 45        return static::from($keypair); + 45        return static::from($keypair); 46    } 47 48    /** @@ -313,10 +313,10 @@ 52     */ 53    public static function from(string $keypair): Keypair 54    { - 55        return new static( - 56            sodium_crypto_sign_publickey($keypair), - 57            sodium_crypto_sign_secretkey($keypair) - 58        ); + 55        return new static( + 56            sodium_crypto_sign_publickey($keypair), + 57            sodium_crypto_sign_secretkey($keypair) + 58        ); 59    } 60 61    /** @@ -331,14 +331,14 @@ 70     */ 71    static public function fromSecretKey($secretKey, $skipValidation = null): Keypair 72    { - 73        $secretKey = Buffer::from($secretKey)->toString(); + 73        $secretKey = Buffer::from($secretKey)->toString(); 74 - 75        $publicKey = sodium_crypto_sign_publickey_from_secretkey($secretKey); + 75        $publicKey = sodium_crypto_sign_publickey_from_secretkey($secretKey); 76 - 77        return new static( - 78            $publicKey, - 79            $secretKey - 80        ); + 77        return new static( + 78            $publicKey, + 79            $secretKey + 80        ); 81    } 82 83    /** @@ -364,7 +364,7 @@ 103     */ 104    public function getPublicKey(): PublicKey 105    { - 106        return $this->publicKey; + 106        return $this->publicKey; 107    } 108 109    /** @@ -374,7 +374,7 @@ 113     */ 114    public function getSecretKey(): Buffer 115    { - 116        return Buffer::from($this->secretKey); + 116        return Buffer::from($this->secretKey); 117    } 118} @@ -387,7 +387,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Message.php.html b/build/html-coverage/Message.php.html index b958343..dbfa189 100644 --- a/build/html-coverage/Message.php.html +++ b/build/html-coverage/Message.php.html @@ -368,17 +368,17 @@ 41        array $instructions 42    ) 43    { - 44        $this->header = $header; - 45        $this->accountKeys = array_map(function (string $accountKey) { - 46            return new PublicKey($accountKey); - 47        }, $accountKeys); - 48        $this->recentBlockhash = $recentBlockhash; - 49        $this->instructions = $instructions; + 44        $this->header = $header; + 45        $this->accountKeys = array_map(function (string $accountKey) { + 46            return new PublicKey($accountKey); + 47        }, $accountKeys); + 48        $this->recentBlockhash = $recentBlockhash; + 49        $this->instructions = $instructions; 50 - 51        $this->indexToProgramIds = []; + 51        $this->indexToProgramIds = []; 52 - 53        foreach ($instructions as $instruction) { - 54            $this->indexToProgramIds[$instruction->programIdIndex] = $this->accountKeys[$instruction->programIdIndex]; + 53        foreach ($instructions as $instruction) { + 54            $this->indexToProgramIds[$instruction->programIdIndex] = $this->accountKeys[$instruction->programIdIndex]; 55        } 56    } 57 @@ -433,17 +433,17 @@ 106     */ 107    public function serialize(): string 108    { - 109        $out = new Buffer(); + 109        $out = new Buffer(); 110 - 111        $out->push($this->encodeMessage()) - 112            ->push(ShortVec::encodeLength(sizeof($this->instructions))) - 113        ; + 111        $out->push($this->encodeMessage()) + 112            ->push(ShortVec::encodeLength(sizeof($this->instructions))) + 113        ; 114 - 115        foreach ($this->instructions as $instruction) { - 116            $out->push($this->encodeInstruction($instruction)); + 115        foreach ($this->instructions as $instruction) { + 116            $out->push($this->encodeInstruction($instruction)); 117        } 118 - 119        return $out; + 119        return $out; 120    } 121 122    /** @@ -451,42 +451,42 @@ 124     */ 125    protected function encodeMessage(): array 126    { - 127        $publicKeys = []; + 127        $publicKeys = []; 128 - 129        foreach ($this->accountKeys as $publicKey) { - 130            array_push($publicKeys, ...$publicKey->toBytes()); + 129        foreach ($this->accountKeys as $publicKey) { + 130            array_push($publicKeys, ...$publicKey->toBytes()); 131        } 132 - 133        return [ + 133        return [ 134            // uint8 - 135            ...unpack("C*", pack("C", $this->header->numRequiredSignature)), + 135            ...unpack("C*", pack("C", $this->header->numRequiredSignature)), 136            // uint8 - 137            ...unpack("C*", pack("C", $this->header->numReadonlySignedAccounts)), + 137            ...unpack("C*", pack("C", $this->header->numReadonlySignedAccounts)), 138            // uint8 - 139            ...unpack("C*", pack("C", $this->header->numReadonlyUnsignedAccounts)), + 139            ...unpack("C*", pack("C", $this->header->numReadonlyUnsignedAccounts)), 140 - 141            ...ShortVec::encodeLength(sizeof($this->accountKeys)), - 142            ...$publicKeys, - 143            ...Buffer::fromBase58($this->recentBlockhash)->toArray(), - 144        ]; + 141            ...ShortVec::encodeLength(sizeof($this->accountKeys)), + 142            ...$publicKeys, + 143            ...Buffer::fromBase58($this->recentBlockhash)->toArray(), + 144        ]; 145    } 146 147    protected function encodeInstruction(CompiledInstruction $instruction): array 148    { - 149        $data = $instruction->data; + 149        $data = $instruction->data; 150 - 151        $accounts = $instruction->accounts;; + 151        $accounts = $instruction->accounts;; 152 - 153        return [ + 153        return [ 154            // uint8 - 155            ...unpack("C*", pack("C", $instruction->programIdIndex)), + 155            ...unpack("C*", pack("C", $instruction->programIdIndex)), 156 - 157            ...ShortVec::encodeLength(sizeof($accounts)), - 158            ...$accounts, + 157            ...ShortVec::encodeLength(sizeof($accounts)), + 158            ...$accounts, 159 - 160            ...ShortVec::encodeLength(sizeof($data)), - 161            ...$data->toArray(), - 162        ]; + 160            ...ShortVec::encodeLength(sizeof($data)), + 161            ...$data->toArray(), + 162        ]; 163    } 164 165    /** @@ -556,7 +556,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Program.php.html b/build/html-coverage/Program.php.html index 701c529..7d4ab9f 100644 --- a/build/html-coverage/Program.php.html +++ b/build/html-coverage/Program.php.html @@ -163,8 +163,8 @@ 12 13    public function __construct(SolanaRpcClient $client) 14    { - 15        $this->client = $client; - 16        $this->config = require __DIR__ . '/../config/solana-sdk.php'; + 15        $this->client = $client; + 16        $this->config = require __DIR__ . '/../config/solana-sdk.php'; 17    } 18 19//    public function __call($method, $params = []) @@ -187,7 +187,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Programs/DidSolProgram.php.html b/build/html-coverage/Programs/DidSolProgram.php.html index 8955f3a..d2c1e93 100644 --- a/build/html-coverage/Programs/DidSolProgram.php.html +++ b/build/html-coverage/Programs/DidSolProgram.php.html @@ -361,7 +361,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Programs/MetaplexProgram.php.html b/build/html-coverage/Programs/MetaplexProgram.php.html index b6b3716..14136eb 100644 --- a/build/html-coverage/Programs/MetaplexProgram.php.html +++ b/build/html-coverage/Programs/MetaplexProgram.php.html @@ -172,7 +172,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Programs/SplToken/Actions/SPLTokenActions.php.html b/build/html-coverage/Programs/SplToken/Actions/SPLTokenActions.php.html index c32dfc3..2341d96 100644 --- a/build/html-coverage/Programs/SplToken/Actions/SPLTokenActions.php.html +++ b/build/html-coverage/Programs/SplToken/Actions/SPLTokenActions.php.html @@ -45,15 +45,15 @@ - Total -
-
- 0.00% covered (danger) + Total +
+
+ 94.44% covered (success)
-
0.00%
-
0 / 31
+
94.44%
+
34 / 36
0.00% covered (danger) @@ -74,15 +74,15 @@ - SPLTokenActions -
-
- 0.00% covered (danger) + SPLTokenActions +
+
+ 94.44% covered (success)
-
0.00%
-
0 / 31
+
94.44%
+
34 / 36
0.00% covered (danger) @@ -91,7 +91,7 @@
0.00%
0 / 1
- 90 + 8.01
0.00% covered (danger) @@ -103,15 +103,15 @@ -  getOrCreateAssociatedTokenAccount -
-
- 0.00% covered (danger) +  getOrCreateAssociatedTokenAccount +
+
+ 94.44% covered (success)
-
0.00%
-
0 / 31
+
94.44%
+
34 / 36
0.00% covered (danger) @@ -120,7 +120,7 @@
0.00%
0 / 1
- 90 + 8.01 @@ -135,100 +135,117 @@ 3namespace Attestto\SolanaPhpSdk\Programs\SplToken\Actions; 4 5use Attestto\SolanaPhpSdk\Connection; - 6use Attestto\SolanaPhpSdk\Exceptions\TokenAccountNotFoundError; - 7use Attestto\SolanaPhpSdk\Exceptions\TokenInvalidAccountOwnerError; - 8use Attestto\SolanaPhpSdk\Exceptions\TokenInvalidMintError; - 9use Attestto\SolanaPhpSdk\PublicKey; - 10use Attestto\SolanaPhpSdk\State\Account; - 11use Attestto\SolanaPhpSdk\Transaction; - 12use Attestto\SolanaPhpSdk\Util\Commitment; - 13use Attestto\SolanaPhpSdk\Util\ConfirmOptions; - 14use Attestto\SolanaPhpSdk\Util\Signer; - 15use Exception; - 16use function Attestto\SolanaPhpSdk\Programs\SplToken\getAccount; - 17 - 18trait SPLTokenActions { - 19 - 20    /** - 21     * @param Connection $connection - 22     * @param Signer $payer - 23     * @param PublicKey $mint - 24     * @param PublicKey $owner - 25     * @param false $allowOwnerOffCurve - 26     * @param Commitment|null $commitment - 27     * @param ConfirmOptions|null $confirmOptions - 28     * @param $programId - 29     * @param $associatedTokenProgramId - 30     * @return mixed - 31     * @throws Exception - 32     */ - 33    public function getOrCreateAssociatedTokenAccount( - 34        Connection     $connection, - 35        Signer         $payer, - 36        PublicKey      $mint, - 37        PublicKey      $owner, - 38        false          $allowOwnerOffCurve = false, - 39        Commitment     $commitment = null, - 40        ConfirmOptions $confirmOptions = null, - 41                       $programId = null, - 42                       $associatedTokenProgramId = null - 43    ): mixed - 44    { - 45        if (!$programId){ - 46            $programId = $this->SOLANA_TOKEN_PROGRAM_ID; - 47        } - 48        if (!$associatedTokenProgramId){ - 49            $associatedTokenProgramId = $this->SOLANA_TOKEN_PROGRAM_ID; - 50        } - 51 - 52 - 53        $associatedToken = $this->getAssociatedTokenAddressSync( - 54            $mint, - 55            $owner, - 56            $allowOwnerOffCurve, - 57            $programId, - 58            $associatedTokenProgramId - 59        ); - 60 - 61        try { - 62            $account = Account::getAccount($connection, $associatedToken, $commitment, $programId); - 63        } catch (Exception $error) { - 64            if ($error instanceof TokenAccountNotFoundError || $error instanceof TokenInvalidAccountOwnerError) { - 65                try { - 66                    $transaction = new Transaction(); - 67                    $transaction->add( - 68                        $this->createAssociatedTokenAccountInstruction( - 69                            $payer->publicKey, - 70                            $associatedToken, - 71                            $owner, - 72                            $mint, - 73                            $programId, - 74                            $associatedTokenProgramId - 75                        ) - 76                    ); - 77                    // TODO Send and confirm transaction - 78                    //sendAndConfirmTransaction($connection, $transaction, [$payer], $confirmOptions); - 79                } catch (Exception $error) { - 80                    // Ignore all errors - 81                } - 82 - 83                $account = Account::getAccount($connection, $associatedToken, $commitment, $programId); - 84            } else { - 85                throw $error; - 86            } - 87        } - 88 - 89        if (!$account->mint->equals($mint)) throw new TokenInvalidMintError(); - 90        if (!$account->owner->equals($owner)) throw new TokenInvalidAccountOwnerError(); - 91 - 92        return $account; - 93    } - 94 + 6use Attestto\SolanaPhpSdk\Exceptions\AccountNotFoundException; + 7use Attestto\SolanaPhpSdk\Exceptions\GenericException; + 8use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; + 9use Attestto\SolanaPhpSdk\Exceptions\InvalidIdResponseException; + 10use Attestto\SolanaPhpSdk\Exceptions\MethodNotFoundException; + 11use Attestto\SolanaPhpSdk\Exceptions\TokenAccountNotFoundError; + 12use Attestto\SolanaPhpSdk\Exceptions\TokenInvalidAccountOwnerError; + 13use Attestto\SolanaPhpSdk\Exceptions\TokenInvalidMintError; + 14use Attestto\SolanaPhpSdk\Exceptions\TokenOwnerOffCurveError; + 15use Attestto\SolanaPhpSdk\Keypair; + 16use Attestto\SolanaPhpSdk\PublicKey; + 17use Attestto\SolanaPhpSdk\State\Account; + 18use Attestto\SolanaPhpSdk\Transaction; + 19use Attestto\SolanaPhpSdk\Util\Commitment; + 20use Attestto\SolanaPhpSdk\Util\ConfirmOptions; + 21use Attestto\SolanaPhpSdk\Util\Signer; + 22use Exception; + 23use Psr\Http\Client\ClientExceptionInterface; + 24use function Attestto\SolanaPhpSdk\Programs\SplToken\getAccount; + 25 + 26trait SPLTokenActions { + 27 + 28    /** + 29     * @param Connection $connection + 30     * @param Signer|Keypair $payer + 31     * @param PublicKey $mint + 32     * @param PublicKey $owner + 33     * @param boolean $allowOwnerOffCurve + 34     * @param Commitment|null $commitment + 35     * @param ConfirmOptions $confirmOptions + 36     * @param PublicKey $programId + 37     * @param PublicKey $associatedTokenProgramId + 38     * @return mixed + 39     * @throws AccountNotFoundException + 40     * @throws ClientExceptionInterface + 41     * @throws InputValidationException + 42     * @throws TokenInvalidAccountOwnerError + 43     * @throws TokenInvalidMintError + 44     * @throws TokenOwnerOffCurveError + 45     * @throws GenericException + 46     * @throws InvalidIdResponseException + 47     * @throws MethodNotFoundException + 48     * @throws \SodiumException + 49     */ + 50    public function getOrCreateAssociatedTokenAccount( + 51        Connection     $connection, + 52        mixed          $payer, + 53        PublicKey      $mint, + 54        PublicKey      $owner, + 55        bool           $allowOwnerOffCurve = true, + 56        Commitment     $commitment = null, + 57        ConfirmOptions $confirmOptions = null, + 58        PublicKey      $programId = new PublicKey(self::TOKEN_PROGRAM_ID), + 59        PublicKey      $associatedTokenProgramId = new PublicKey(self::ASSOCIATED_TOKEN_PROGRAM_ID) + 60    ): Account + 61    { + 62 + 63        $associatedToken = $this->getAssociatedTokenAddressSync( + 64            $mint, + 65            $owner, + 66            $allowOwnerOffCurve, + 67            $programId, + 68            $associatedTokenProgramId + 69        ); + 70        $ata = $associatedToken->toBase58(); + 71        try { + 72            $account = Account::getAccount($connection, $associatedToken, $commitment, $programId); + 73        } catch (Exception $error) { + 74            if ($error instanceof AccountNotFoundException || $error instanceof TokenInvalidAccountOwnerError) { + 75                try { + 76                    $transaction = new Transaction(); + 77                    $transaction->add( + 78                        $this->createAssociatedTokenAccountInstruction( + 79                            $payer->getPublicKey(), + 80                            $associatedToken, + 81                            $owner, + 82                            $mint, + 83                            $programId, + 84                            $associatedTokenProgramId + 85                        ) + 86                    ); + 87                    if (!$confirmOptions) $confirmOptions = new ConfirmOptions(); + 88                    $transaction->feePayer = $payer->getPublicKey(); + 89                    $txnHash = $connection->sendTransaction( $transaction, [$payer]); + 90                } catch (Exception $error) { + 91                    // Ignore all errors + 92                    // Account Exists but is not funded + 93                    throw $error; + 94                } 95 - 96 - 97 - 98 - 99} + 96                $account = Account::getAccount($connection, $associatedToken, $commitment, $programId); + 97            } else { + 98                throw $error; + 99            } + 100        } + 101 + 102        if ($account->mint != $mint) throw new TokenInvalidMintError( + 103            $account->mint->toBase58() . ' != ' . $mint->toBase58() + 104        ); + 105        if ($account->owner != $owner) throw new TokenInvalidAccountOwnerError( + 106            $account->owner->toBase58() . ' != ' . $owner->toBase58() + 107        ); + 108 + 109        return $account; + 110    } + 111 + 112 + 113 + 114 + 115 + 116} @@ -239,7 +256,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Programs/SplToken/Actions/dashboard.html b/build/html-coverage/Programs/SplToken/Actions/dashboard.html index a343c78..44cd12c 100644 --- a/build/html-coverage/Programs/SplToken/Actions/dashboard.html +++ b/build/html-coverage/Programs/SplToken/Actions/dashboard.html @@ -60,7 +60,6 @@

Insufficient Coverage

-
Attestto\SolanaPhpSdk\Programs\SplToken\Actions\SPLTokenActions0% @@ -77,7 +76,6 @@

Project Risks

- Attestto\SolanaPhpSdk\Programs\SplToken\Actions\SPLTokenActions90 @@ -115,7 +113,6 @@

Insufficient Coverage

- getOrCreateAssociatedTokenAccount0% @@ -132,7 +129,6 @@

Project Risks

- getOrCreateAssociatedTokenAccount90 @@ -142,7 +138,7 @@

Project Risks

@@ -161,7 +157,7 @@

Project Risks

.yAxis.tickFormat(d3.format('d')); d3.select('#classCoverageDistribution svg') - .datum(getCoverageDistributionData([1,0,0,0,0,0,0,0,0,0,0,0], "Class Coverage")) + .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,1,0], "Class Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -179,7 +175,7 @@

Project Risks

.yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([1,0,0,0,0,0,0,0,0,0,0,0], "Method Coverage")) + .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,1,0], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -229,7 +225,7 @@

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[0,9,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[94.44444444444444,8,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -253,7 +249,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[0,9,"
Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions::getOrCreateAssociatedTokenAccount<\/a>"]], 'Method Complexity')) + .datum(getComplexityData([[94.44444444444444,8,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions::getOrCreateAssociatedTokenAccount<\/a>"]], 'Method Complexity')) .transition() .duration(500) .call(chart); diff --git a/build/html-coverage/Programs/SplToken/Actions/index.html b/build/html-coverage/Programs/SplToken/Actions/index.html index faff53b..6d46c3c 100644 --- a/build/html-coverage/Programs/SplToken/Actions/index.html +++ b/build/html-coverage/Programs/SplToken/Actions/index.html @@ -45,15 +45,15 @@ - Total -
-
- 0.00% covered (danger) + Total +
+
+ 94.44% covered (success)
-
0.00%
-
0 / 31
+
94.44%
+
34 / 36
0.00% covered (danger) @@ -73,15 +73,15 @@ - SPLTokenActions.php -
-
- 0.00% covered (danger) + SPLTokenActions.php +
+
+ 94.44% covered (success)
-
0.00%
-
0 / 31
+
94.44%
+
34 / 36
0.00% covered (danger) @@ -113,7 +113,7 @@

Legend

High: 90% to 100%

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Programs/SplToken/Instructions/SPLTokenInstructions.php.html b/build/html-coverage/Programs/SplToken/Instructions/SPLTokenInstructions.php.html index 27ff3e4..9bbb0a2 100644 --- a/build/html-coverage/Programs/SplToken/Instructions/SPLTokenInstructions.php.html +++ b/build/html-coverage/Programs/SplToken/Instructions/SPLTokenInstructions.php.html @@ -209,22 +209,22 @@ 33                  $associatedTokenProgramId = null 34    ): TransactionInstruction 35    { - 36        if (!$programId) { + 36        if (!$programId) { 37            $programId = $this->SOLANA_TOKEN_PROGRAM_ID; 38        } - 39        if (!$associatedTokenProgramId) { + 39        if (!$associatedTokenProgramId) { 40            $associatedTokenProgramId = $this->SOLANA_TOKEN_PROGRAM_ID; 41        } 42 - 43        return $this->buildAssociatedTokenAccountInstruction( - 44            $payer, - 45            $associatedToken, - 46            $owner, - 47            $mint, - 48            new Buffer([]), - 49            $programId, - 50            $associatedTokenProgramId - 51        ); + 43        return $this->buildAssociatedTokenAccountInstruction( + 44            $payer, + 45            $associatedToken, + 46            $owner, + 47            $mint, + 48            new Buffer([]), + 49            $programId, + 50            $associatedTokenProgramId + 51        ); 52    } 53 54    /** @@ -248,21 +248,21 @@ 72    ): TransactionInstruction 73    { 74 - 75        $keys = [ - 76            new AccountMeta($payer, true, true), - 77            new AccountMeta($associatedToken, false, true), - 78            new AccountMeta($owner, false, false), - 79            new AccountMeta($mint, false, false), - 80            new AccountMeta(SystemProgram::programId(), false, false), - 81            new AccountMeta($programId, false, false), - 82        ]; + 75        $keys = [ + 76            new AccountMeta($payer, true, true), + 77            new AccountMeta($associatedToken, false, true), + 78            new AccountMeta($owner, false, false), + 79            new AccountMeta($mint, false, false), + 80            new AccountMeta(SystemProgram::programId(), false, false), + 81            new AccountMeta($programId, false, false), + 82        ]; 83 84 - 85        return new TransactionInstruction( - 86            $associatedTokenProgramId, - 87            $keys, - 88            $instructionData - 89        ); + 85        return new TransactionInstruction( + 86            $associatedTokenProgramId, + 87            $keys, + 88            $instructionData + 89        ); 90    } 91 92 @@ -293,7 +293,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Programs/SplToken/Instructions/TokenInstruction.php.html b/build/html-coverage/Programs/SplToken/Instructions/TokenInstruction.php.html index 05bdecb..0a23585 100644 --- a/build/html-coverage/Programs/SplToken/Instructions/TokenInstruction.php.html +++ b/build/html-coverage/Programs/SplToken/Instructions/TokenInstruction.php.html @@ -134,7 +134,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Programs/SplToken/Instructions/dashboard.html b/build/html-coverage/Programs/SplToken/Instructions/dashboard.html index 8203e68..ec48f1e 100644 --- a/build/html-coverage/Programs/SplToken/Instructions/dashboard.html +++ b/build/html-coverage/Programs/SplToken/Instructions/dashboard.html @@ -140,7 +140,7 @@

Project Risks

diff --git a/build/html-coverage/Programs/SplToken/Instructions/index.html b/build/html-coverage/Programs/SplToken/Instructions/index.html index 2740c81..f68d218 100644 --- a/build/html-coverage/Programs/SplToken/Instructions/index.html +++ b/build/html-coverage/Programs/SplToken/Instructions/index.html @@ -126,7 +126,7 @@

Legend

High: 90% to 100%

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Programs/SplToken/dashboard.html b/build/html-coverage/Programs/SplToken/dashboard.html index d168638..7d3b6d2 100644 --- a/build/html-coverage/Programs/SplToken/dashboard.html +++ b/build/html-coverage/Programs/SplToken/dashboard.html @@ -59,7 +59,6 @@

Insufficient Coverage

- Attestto\SolanaPhpSdk\Programs\SplToken\Actions\SPLTokenActions0% @@ -76,7 +75,6 @@

Project Risks

- Attestto\SolanaPhpSdk\Programs\SplToken\Actions\SPLTokenActions90 @@ -114,7 +112,6 @@

Insufficient Coverage

- getOrCreateAssociatedTokenAccount0% createAssociatedTokenAccountInstruction84% @@ -132,7 +129,6 @@

Project Risks

- getOrCreateAssociatedTokenAccount90 createAssociatedTokenAccountInstruction3 @@ -143,7 +139,7 @@

Project Risks

@@ -162,7 +158,7 @@

Project Risks

.yAxis.tickFormat(d3.format('d')); d3.select('#classCoverageDistribution svg') - .datum(getCoverageDistributionData([1,0,0,0,0,0,0,0,0,0,1,1], "Class Coverage")) + .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,2,1], "Class Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -180,7 +176,7 @@

Project Risks

.yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([1,0,0,0,0,0,0,0,0,1,0,2], "Method Coverage")) + .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,1,1,2], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -230,7 +226,7 @@

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/a>"],[0,9,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions<\/a>"],[94.28571428571428,5,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/a>"],[94.44444444444444,8,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions<\/a>"],[94.28571428571428,5,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -254,7 +250,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[0,9,"
Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions::getOrCreateAssociatedTokenAccount<\/a>"],[84.61538461538461,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::createAssociatedTokenAccountInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::buildAssociatedTokenAccountInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::createSyncNativeInstruction<\/a>"]], 'Method Complexity')) + .datum(getComplexityData([[94.44444444444444,8,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions::getOrCreateAssociatedTokenAccount<\/a>"],[84.61538461538461,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::createAssociatedTokenAccountInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::buildAssociatedTokenAccountInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::createSyncNativeInstruction<\/a>"]], 'Method Complexity')) .transition() .duration(500) .call(chart); diff --git a/build/html-coverage/Programs/SplToken/index.html b/build/html-coverage/Programs/SplToken/index.html index e34b300..892a29c 100644 --- a/build/html-coverage/Programs/SplToken/index.html +++ b/build/html-coverage/Programs/SplToken/index.html @@ -44,15 +44,15 @@ - Total -
-
- 50.00% covered (danger) + Total +
+
+ 94.37% covered (success)
-
50.00%
-
33 / 66
+
94.37%
+
67 / 71
50.00% covered (danger) @@ -72,15 +72,15 @@ - Actions -
-
- 0.00% covered (danger) + Actions +
+
+ 94.44% covered (success)
-
0.00%
-
0 / 31
+
94.44%
+
34 / 36
0.00% covered (danger) @@ -140,7 +140,7 @@

Legend

High: 90% to 100%

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Programs/SplTokenProgram.php.html b/build/html-coverage/Programs/SplTokenProgram.php.html index b45d9e2..84d6c87 100644 --- a/build/html-coverage/Programs/SplTokenProgram.php.html +++ b/build/html-coverage/Programs/SplTokenProgram.php.html @@ -45,21 +45,21 @@ Total
-
- 94.23% covered (success) +
+ 93.75% covered (success)
-
94.23%
-
49 / 52
+
93.75%
+
15 / 16
-
- 33.33% covered (danger) +
+ 50.00% covered (danger)
-
33.33%
-
1 / 3
+
50.00%
+
1 / 2
CRAP
@@ -74,22 +74,22 @@ SplTokenProgram
-
- 94.23% covered (success) +
+ 93.75% covered (success)
-
94.23%
-
49 / 52
+
93.75%
+
15 / 16
-
- 33.33% covered (danger) +
+ 50.00% covered (danger)
-
33.33%
-
1 / 3
- 12.03 +
50.00%
+
1 / 2
+ 4.00
0.00% covered (danger) @@ -101,7 +101,7 @@ -  getTokenAccountsByOwner +  getTokenAccountsByOwner
100.00% covered (success) @@ -123,7 +123,7 @@ -  getAssociatedTokenAddressSync +  getAssociatedTokenAddressSync
85.71% covered (warning) @@ -144,28 +144,6 @@ - -  getOrCreateAssociatedTokenAccount -
-
- 94.44% covered (success) -
-
- -
94.44%
-
34 / 36
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 1
- 8.01 - - - @@ -176,179 +154,81 @@ 2 3namespace Attestto\SolanaPhpSdk\Programs; 4 - 5use Attestto\SolanaPhpSdk\Connection; - 6use Attestto\SolanaPhpSdk\Exceptions\AccountNotFoundException; - 7use Attestto\SolanaPhpSdk\Exceptions\GenericException; - 8use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; - 9use Attestto\SolanaPhpSdk\Exceptions\InvalidIdResponseException; - 10use Attestto\SolanaPhpSdk\Exceptions\MethodNotFoundException; - 11use Attestto\SolanaPhpSdk\Exceptions\TokenAccountNotFoundError; - 12use Attestto\SolanaPhpSdk\Exceptions\TokenInvalidAccountOwnerError; - 13use Attestto\SolanaPhpSdk\Exceptions\TokenInvalidMintError; - 14use Attestto\SolanaPhpSdk\Exceptions\TokenOwnerOffCurveError; - 15use Attestto\SolanaPhpSdk\Keypair; - 16use Attestto\SolanaPhpSdk\Program; - 17use Attestto\SolanaPhpSdk\Programs\SplToken\Actions\SPLTokenActions; - 18use Attestto\SolanaPhpSdk\Programs\SplToken\Instructions\SPLTokenInstructions; - 19use Attestto\SolanaPhpSdk\PublicKey; - 20use Attestto\SolanaPhpSdk\State\Account; - 21use Attestto\SolanaPhpSdk\Transaction; - 22use Attestto\SolanaPhpSdk\TransactionInstruction; - 23use Attestto\SolanaPhpSdk\Util\Buffer; - 24use Attestto\SolanaPhpSdk\Util\Commitment; - 25use Attestto\SolanaPhpSdk\Util\ConfirmOptions; - 26use Attestto\SolanaPhpSdk\Util\Signer; - 27use Exception; - 28use Psr\Http\Client\ClientExceptionInterface; - 29 - 30/** - 31 * @property $SOLANA_TOKEN_PROGRAM_ID - 32 */ - 33class SplTokenProgram extends Program - 34{ - 35    public const TOKEN_PROGRAM_ID = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'; - 36    public const NATIVE_MINT = 'So11111111111111111111111111111111111111112'; - 37    public const ASSOCIATED_TOKEN_PROGRAM_ID = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'; - 38    public const TOKEN_2022_PROGRAM_ID ='TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'; - 39    public const TOKEN_2022_MINT = '9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP'; - 40 - 41    use SPLTokenActions; - 42    use SPLTokenInstructions; - 43 - 44    /** - 45     * @param string $pubKey - 46     * @return mixed - 47     */ - 48    public function getTokenAccountsByOwner(string $pubKey) - 49    { - 50        return $this->client->call('getTokenAccountsByOwner', [ - 51            $pubKey, - 52            [ - 53                'programId' => self::TOKEN_PROGRAM_ID, - 54            ], - 55            [ - 56                'encoding' => 'jsonParsed', - 57            ], - 58        ]); - 59    } - 60 - 61    /** - 62     * @param PublicKey $mint - 63     * @param PublicKey $owner - 64     * @param bool $allowOwnerOffCurve - 65     * @param string|null $programId - 66     * @param null $associatedTokenProgramId - 67     * @return PublicKey - 68     * @throws TokenOwnerOffCurveError - 69     * @throws InputValidationException - 70     */ - 71    public function getAssociatedTokenAddressSync( - 72        PublicKey $mint, - 73        PublicKey $owner, - 74        bool      $allowOwnerOffCurve = false, - 75        PublicKey    $programId = new PublicKey(self::TOKEN_PROGRAM_ID), - 76                  PublicKey $atPid = new PublicKey(self::ASSOCIATED_TOKEN_PROGRAM_ID) - 77    ): PublicKey { - 78        if (!$allowOwnerOffCurve && !PublicKey::isOnCurve($owner->toBinaryString())) { - 79            throw new TokenOwnerOffCurveError(); - 80        } - 81 - 82 - 83 - 84        $address = PublicKey::findProgramAddressSync( - 85            [$owner->toBuffer(), $programId->toBuffer(), $mint->toBuffer()], - 86            $atPid - 87        ); - 88 - 89        return $address[0]; - 90    } - 91 - 92    /** - 93     * @param Connection $connection - 94     * @param Signer|Keypair $payer - 95     * @param PublicKey $mint - 96     * @param PublicKey $owner - 97     * @param boolean $allowOwnerOffCurve - 98     * @param Commitment|null $commitment - 99     * @param ConfirmOptions $confirmOptions - 100     * @param PublicKey $programId - 101     * @param PublicKey $associatedTokenProgramId - 102     * @return mixed - 103     * @throws AccountNotFoundException - 104     * @throws ClientExceptionInterface - 105     * @throws InputValidationException - 106     * @throws TokenInvalidAccountOwnerError - 107     * @throws TokenInvalidMintError - 108     * @throws TokenOwnerOffCurveError - 109     * @throws GenericException - 110     * @throws InvalidIdResponseException - 111     * @throws MethodNotFoundException - 112     * @throws \SodiumException - 113     */ - 114    public function getOrCreateAssociatedTokenAccount( - 115        Connection     $connection, - 116        mixed          $payer, - 117        PublicKey      $mint, - 118        PublicKey      $owner, - 119        bool           $allowOwnerOffCurve = true, - 120        Commitment     $commitment = null, - 121        ConfirmOptions $confirmOptions = null, - 122        PublicKey      $programId = new PublicKey(self::TOKEN_PROGRAM_ID), - 123        PublicKey      $associatedTokenProgramId = new PublicKey(self::ASSOCIATED_TOKEN_PROGRAM_ID) - 124    ): Account - 125    { - 126 - 127        $associatedToken = $this->getAssociatedTokenAddressSync( - 128            $mint, - 129            $owner, - 130            $allowOwnerOffCurve, - 131            $programId, - 132            $associatedTokenProgramId - 133        ); - 134        $ata = $associatedToken->toBase58(); - 135        try { - 136            $account = Account::getAccount($connection, $associatedToken, $commitment, $programId); - 137        } catch (Exception $error) { - 138            if ($error instanceof AccountNotFoundException || $error instanceof TokenInvalidAccountOwnerError) { - 139                try { - 140                    $transaction = new Transaction(); - 141                    $transaction->add( - 142                        $this->createAssociatedTokenAccountInstruction( - 143                            $payer->getPublicKey(), - 144                            $associatedToken, - 145                            $owner, - 146                            $mint, - 147                            $programId, - 148                            $associatedTokenProgramId - 149                        ) - 150                    ); - 151                    if (!$confirmOptions) $confirmOptions = new ConfirmOptions(); - 152                    $transaction->feePayer = $payer->getPublicKey(); - 153                    $txnHash = $connection->sendTransaction( $transaction, [$payer]); - 154                } catch (Exception $error) { - 155                    // Ignore all errors - 156                    // Account Exists but is not funded - 157                    throw $error; - 158                } - 159 - 160                $account = Account::getAccount($connection, $associatedToken, $commitment, $programId); - 161            } else { - 162                throw $error; - 163            } - 164        } - 165 - 166        if ($account->mint != $mint) throw new TokenInvalidMintError( - 167            $account->mint->toBase58() . ' != ' . $mint->toBase58() - 168        ); - 169        if ($account->owner != $owner) throw new TokenInvalidAccountOwnerError( - 170            $account->owner->toBase58() . ' != ' . $owner->toBase58() - 171        ); - 172 - 173        return $account; - 174    } - 175 - 176 - 177} + 5 + 6use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; + 7use Attestto\SolanaPhpSdk\Exceptions\TokenOwnerOffCurveError; + 8use Attestto\SolanaPhpSdk\Program; + 9use Attestto\SolanaPhpSdk\Programs\SplToken\Actions\SPLTokenActions; + 10use Attestto\SolanaPhpSdk\Programs\SplToken\Instructions\SPLTokenInstructions; + 11use Attestto\SolanaPhpSdk\PublicKey; + 12 + 13 + 14/** + 15 * @property $SOLANA_TOKEN_PROGRAM_ID + 16 */ + 17class SplTokenProgram extends Program + 18{ + 19    public const TOKEN_PROGRAM_ID = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'; + 20    public const NATIVE_MINT = 'So11111111111111111111111111111111111111112'; + 21    public const ASSOCIATED_TOKEN_PROGRAM_ID = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'; + 22    public const TOKEN_2022_PROGRAM_ID ='TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'; + 23    public const TOKEN_2022_MINT = '9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP'; + 24 + 25    use SPLTokenActions; + 26    use SPLTokenInstructions; + 27 + 28    /** + 29     * @param string $pubKey + 30     * @return mixed + 31     */ + 32    public function getTokenAccountsByOwner(string $pubKey) + 33    { + 34        return $this->client->call('getTokenAccountsByOwner', [ + 35            $pubKey, + 36            [ + 37                'programId' => self::TOKEN_PROGRAM_ID, + 38            ], + 39            [ + 40                'encoding' => 'jsonParsed', + 41            ], + 42        ]); + 43    } + 44 + 45    /** + 46     * @param PublicKey $mint + 47     * @param PublicKey $owner + 48     * @param bool $allowOwnerOffCurve + 49     * @param string|null $programId + 50     * @param null $associatedTokenProgramId + 51     * @return PublicKey + 52     * @throws TokenOwnerOffCurveError + 53     * @throws InputValidationException + 54     */ + 55    public function getAssociatedTokenAddressSync( + 56        PublicKey $mint, + 57        PublicKey $owner, + 58        bool      $allowOwnerOffCurve = false, + 59        PublicKey    $programId = new PublicKey(self::TOKEN_PROGRAM_ID), + 60                  PublicKey $atPid = new PublicKey(self::ASSOCIATED_TOKEN_PROGRAM_ID) + 61    ): PublicKey { + 62        if (!$allowOwnerOffCurve && !PublicKey::isOnCurve($owner->toBinaryString())) { + 63            throw new TokenOwnerOffCurveError(); + 64        } + 65 + 66 + 67 + 68        $address = PublicKey::findProgramAddressSync( + 69            [$owner->toBuffer(), $programId->toBuffer(), $mint->toBuffer()], + 70            $atPid + 71        ); + 72 + 73        return $address[0]; + 74    } + 75 + 76 + 77 + 78 + 79} @@ -359,7 +239,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Programs/SystemProgram.php.html b/build/html-coverage/Programs/SystemProgram.php.html index d5196ec..febb440 100644 --- a/build/html-coverage/Programs/SystemProgram.php.html +++ b/build/html-coverage/Programs/SystemProgram.php.html @@ -283,7 +283,7 @@ 21     */ 22    static function programId(): PublicKey 23    { - 24        return new PublicKey('11111111111111111111111111111111'); + 24        return new PublicKey('11111111111111111111111111111111'); 25    } 26 27    /** @@ -405,7 +405,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Programs/dashboard.html b/build/html-coverage/Programs/dashboard.html index c2eba35..0dd39f2 100644 --- a/build/html-coverage/Programs/dashboard.html +++ b/build/html-coverage/Programs/dashboard.html @@ -59,17 +59,6 @@

Insufficient Coverage

Attestto\SolanaPhpSdk\Programs\MetaplexProgram0% - Attestto\SolanaPhpSdk\Programs\SNS\Utils0% - Attestto\SolanaPhpSdk\Programs\SNS\InstructionBurn0% - RegisterFavoriteInstruction0% - Attestto\SolanaPhpSdk\Programs\CreateReverseInstruction0% - Attestto\SolanaPhpSdk\Programs\CreateV2Instruction0% - CreateInstructionV30% - CreateWithNftInstruction0% - Attestto\SolanaPhpSdk\Programs\SNS\SnsInstruction0% - Attestto\SolanaPhpSdk\Programs\SNS\NftRecord0% - Attestto\SolanaPhpSdk\Programs\SplSnsProgram0% - Attestto\SolanaPhpSdk\Programs\SplToken\Actions\SPLTokenActions0% Attestto\SolanaPhpSdk\Programs\DidSolProgram31% Attestto\SolanaPhpSdk\Programs\SystemProgram47% @@ -88,13 +77,7 @@

Project Risks

- Attestto\SolanaPhpSdk\Programs\SNS\Utils506 - Attestto\SolanaPhpSdk\Programs\SNS\SnsInstruction182 - Attestto\SolanaPhpSdk\Programs\SplToken\Actions\SPLTokenActions90 Attestto\SolanaPhpSdk\Programs\DidSolProgram78 - Attestto\SolanaPhpSdk\Programs\SNS\NftRecord72 - Attestto\SolanaPhpSdk\Programs\CreateReverseInstruction30 - CreateInstructionV320 Attestto\SolanaPhpSdk\Programs\SystemProgram17 @@ -137,52 +120,13 @@

Insufficient Coverage

parse0% getRpcEndpointFromShortcut0% getProgramAccounts0% - __construct0% - loadConstants0% - getHashedNameSync0% - getNameAccountKeySync0% - reverseLookup0% - deserializeReverse0% - getDomainKeySync0% - _deriveSync0% - __construct0% - serialize0% - getInstruction0% - __construct0% - serialize0% - getInstruction0% - __construct0% - serialize0% - getInstruction0% - __construct0% - serialize0% - getInstruction0% - __construct0% - serialize0% - getInstruction0% - __construct0% - serialize0% - getInstruction0% - createInstruction0% - updateInstruction0% - transferInstruction0% - reallocInstruction0% - deleteInstruction0% - __construct0% - deserialize0% - retrieve0% - findKey0% - getRecordFromMint0% - getDomainMint0% - getRecordFromMint0% getBalance0% getConfirmedTransaction0% getTransaction0% createAccount0% - getOrCreateAssociatedTokenAccount0% getAccountInfo75% createAssociatedTokenAccountInstruction84% - getAssociatedTokenAddressSync85% + getAssociatedTokenAddressSync85% @@ -199,21 +143,9 @@

Project Risks

- getDomainKeySync90 - getOrCreateAssociatedTokenAccount90 parse42 - transferInstruction42 getRpcEndpointFromShortcut30 - createInstruction20 - getNameAccountKeySync12 - getInstruction12 - retrieve12 - __construct6 - reverseLookup6 - deserializeReverse6 - _deriveSync6 - getInstruction6 - getAssociatedTokenAddressSync3 + getAssociatedTokenAddressSync3 createAssociatedTokenAccountInstruction3 getAccountInfo2 @@ -225,7 +157,7 @@

Project Risks

@@ -244,7 +176,7 @@

Project Risks

.yAxis.tickFormat(d3.format('d')); d3.select('#classCoverageDistribution svg') - .datum(getCoverageDistributionData([12,0,0,0,1,1,0,0,0,0,2,1], "Class Coverage")) + .datum(getCoverageDistributionData([1,0,0,0,1,1,0,0,0,0,3,1], "Class Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -262,7 +194,7 @@

Project Risks

.yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([47,0,0,0,0,0,0,0,1,2,1,7], "Method Coverage")) + .datum(getCoverageDistributionData([8,0,0,0,0,0,0,0,1,2,1,7], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -312,7 +244,7 @@

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[31.11111111111111,14,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\MetaplexProgram<\/a>"],[0,22,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\InstructionBurn<\/a>"],[0,3,"RegisterFavoriteInstruction<\/a>"],[0,5,"Attestto\\SolanaPhpSdk\\Programs\\CreateReverseInstruction<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\CreateV2Instruction<\/a>"],[0,4,"CreateInstructionV3<\/a>"],[0,3,"CreateWithNftInstruction<\/a>"],[0,13,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\SnsInstruction<\/a>"],[0,8,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\NftRecord<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplSnsProgram<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/a>"],[94.23076923076923,12,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram<\/a>"],[47.22222222222222,8,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram<\/a>"],[0,9,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions<\/a>"],[94.28571428571428,5,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[31.11111111111111,14,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\MetaplexProgram<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/a>"],[93.75,4,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram<\/a>"],[47.22222222222222,8,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram<\/a>"],[94.44444444444444,8,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions<\/a>"],[94.28571428571428,5,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -336,7 +268,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[0,1,"
Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::getDidDataAcccountInfo<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::getDidDataAccountId<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::deserializeDidData<\/a>"],[0,6,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::parse<\/a>"],[0,5,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::getRpcEndpointFromShortcut<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\MetaplexProgram::getProgramAccounts<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::loadConstants<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getHashedNameSync<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getNameAccountKeySync<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::reverseLookup<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::deserializeReverse<\/a>"],[0,9,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getDomainKeySync<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::_deriveSync<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\InstructionBurn::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\InstructionBurn::serialize<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\InstructionBurn::getInstruction<\/a>"],[0,1,"RegisterFavoriteInstruction::__construct<\/a>"],[0,1,"RegisterFavoriteInstruction::serialize<\/a>"],[0,1,"RegisterFavoriteInstruction::getInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\CreateReverseInstruction::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\CreateReverseInstruction::serialize<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\CreateReverseInstruction::getInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\CreateV2Instruction::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\CreateV2Instruction::serialize<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\CreateV2Instruction::getInstruction<\/a>"],[0,1,"CreateInstructionV3::__construct<\/a>"],[0,1,"CreateInstructionV3::serialize<\/a>"],[0,2,"CreateInstructionV3::getInstruction<\/a>"],[0,1,"CreateWithNftInstruction::__construct<\/a>"],[0,1,"CreateWithNftInstruction::serialize<\/a>"],[0,1,"CreateWithNftInstruction::getInstruction<\/a>"],[0,4,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\SnsInstruction::createInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\SnsInstruction::updateInstruction<\/a>"],[0,6,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\SnsInstruction::transferInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\SnsInstruction::reallocInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\SnsInstruction::deleteInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\NftRecord::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\NftRecord::deserialize<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\NftRecord::retrieve<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\NftRecord::findKey<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\NftRecord::getRecordFromMint<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\NftRecord::getDomainMint<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplSnsProgram::getRecordFromMint<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram::getTokenAccountsByOwner<\/a>"],[85.71428571428571,3,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram::getAssociatedTokenAddressSync<\/a>"],[94.44444444444444,8,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram::getOrCreateAssociatedTokenAccount<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::programId<\/a>"],[75,2,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getAccountInfo<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getBalance<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getConfirmedTransaction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getTransaction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::transfer<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::createAccount<\/a>"],[0,9,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions::getOrCreateAssociatedTokenAccount<\/a>"],[84.61538461538461,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::createAssociatedTokenAccountInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::buildAssociatedTokenAccountInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::createSyncNativeInstruction<\/a>"]], 'Method Complexity')) + .datum(getComplexityData([[0,1,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::getDidDataAcccountInfo<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::getDidDataAccountId<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::deserializeDidData<\/a>"],[0,6,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::parse<\/a>"],[0,5,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::getRpcEndpointFromShortcut<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\MetaplexProgram::getProgramAccounts<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram::getTokenAccountsByOwner<\/a>"],[85.71428571428571,3,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram::getAssociatedTokenAddressSync<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::programId<\/a>"],[75,2,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getAccountInfo<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getBalance<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getConfirmedTransaction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getTransaction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::transfer<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::createAccount<\/a>"],[94.44444444444444,8,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions::getOrCreateAssociatedTokenAccount<\/a>"],[84.61538461538461,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::createAssociatedTokenAccountInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::buildAssociatedTokenAccountInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::createSyncNativeInstruction<\/a>"]], 'Method Complexity')) .transition() .duration(500) .call(chart); diff --git a/build/html-coverage/Programs/index.html b/build/html-coverage/Programs/index.html index 235bf32..9279d36 100644 --- a/build/html-coverage/Programs/index.html +++ b/build/html-coverage/Programs/index.html @@ -43,51 +43,23 @@ - Total -
-
- 11.69% covered (danger) -
-
- -
11.69%
-
113 / 967
-
-
- 10.45% covered (danger) -
-
- -
10.45%
-
7 / 67
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 17
- - - -
SNS -
-
- 0.00% covered (danger) + Total +
+
+ 61.75% covered (warning)
-
0.00%
-
0 / 732
+
61.75%
+
113 / 183
-
- 0.00% covered (danger) +
+ 36.84% covered (danger)
-
0.00%
-
0 / 46
+
36.84%
+
7 / 19
0.00% covered (danger) @@ -95,19 +67,19 @@
0.00%
-
0 / 10
+
0 / 6
- SplToken -
-
- 50.00% covered (danger) + SplToken +
+
+ 94.37% covered (success)
-
50.00%
-
33 / 66
+
94.37%
+
67 / 71
50.00% covered (danger) @@ -182,52 +154,24 @@
0 / 1
- - SplSnsProgram.php -
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 21
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 1
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 1
- - SplTokenProgram.php
-
- 94.23% covered (success) +
+ 93.75% covered (success)
-
94.23%
-
49 / 52
+
93.75%
+
15 / 16
-
- 33.33% covered (danger) +
+ 50.00% covered (danger)
-
33.33%
-
1 / 3
+
50.00%
+
1 / 2
0.00% covered (danger) @@ -279,7 +223,7 @@

Legend

High: 90% to 100%

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/PublicKey.php.html b/build/html-coverage/PublicKey.php.html index dc97b51..59c721c 100644 --- a/build/html-coverage/PublicKey.php.html +++ b/build/html-coverage/PublicKey.php.html @@ -462,24 +462,24 @@ 25     */ 26    public function __construct($bnORBase58String) 27    { - 28        if (is_integer($bnORBase58String)) { + 28        if (is_integer($bnORBase58String)) { 29            $this->buffer = Buffer::from()->pad(self::LENGTH, $bnORBase58String); - 30        } elseif (is_string($bnORBase58String)) { + 30        } elseif (is_string($bnORBase58String)) { 31            // https://stackoverflow.com/questions/25343508/detect-if-string-is-binary - 32            $isBinaryString = preg_match('~[^\x20-\x7E\t\r\n]~', $bnORBase58String) > 0; + 32            $isBinaryString = preg_match('~[^\x20-\x7E\t\r\n]~', $bnORBase58String) > 0; 33 34            // if not binary string already, assumed to be a base58 string. - 35            if ($isBinaryString) { - 36                $this->buffer = Buffer::from($bnORBase58String); + 35            if ($isBinaryString) { + 36                $this->buffer = Buffer::from($bnORBase58String); 37            } else { - 38                $this->buffer = Buffer::fromBase58($bnORBase58String); + 38                $this->buffer = Buffer::fromBase58($bnORBase58String); 39            } 40 41        } else { - 42            $this->buffer = Buffer::from($bnORBase58String); + 42            $this->buffer = Buffer::from($bnORBase58String); 43        } 44 - 45        if (sizeof($this->buffer) !== self::LENGTH) { + 45        if (sizeof($this->buffer) !== self::LENGTH) { 46            $len = sizeof($this->buffer); 47            throw new InputValidationException("Invalid public key input. Expected length 32. Found: {$len}"); 48        } @@ -506,7 +506,7 @@ 69     */ 70    public function toBase58(): string 71    { - 72        return $this->base58()->encode($this->buffer->toString()); + 72        return $this->base58()->encode($this->buffer->toString()); 73    } 74 75    /** @@ -514,7 +514,7 @@ 77     */ 78    public function toBytes(): array 79    { - 80        return $this->buffer->toArray(); + 80        return $this->buffer->toArray(); 81    } 82 83    /** @@ -522,7 +522,7 @@ 85     */ 86    public function toBuffer(): Buffer 87    { - 88        return $this->buffer; + 88        return $this->buffer; 89    } 90 91    /** @@ -530,7 +530,7 @@ 93     */ 94    public function toBinaryString(): string 95    { - 96        return $this->buffer; + 96        return $this->buffer; 97    } 98 99    /** @@ -538,7 +538,7 @@ 101     */ 102    public function __toString() 103    { - 104        return $this->toBase58(); + 104        return $this->toBase58(); 105    } 106 107    /** @@ -574,25 +574,25 @@ 137     */ 138    public static function createProgramAddress(array $seeds, PublicKey $programId): PublicKey 139    { - 140        $buffer = new Buffer(); - 141        foreach ($seeds as $seed) { - 142            $seed = Buffer::from($seed); - 143            if (sizeof($seed) > self::MAX_SEED_LENGTH) { + 140        $buffer = new Buffer(); + 141        foreach ($seeds as $seed) { + 142            $seed = Buffer::from($seed); + 143            if (sizeof($seed) > self::MAX_SEED_LENGTH) { 144                throw new InputValidationException("Max seed length exceeded."); 145            } - 146            $buffer->push($seed); + 146            $buffer->push($seed); 147        } 148 - 149        $buffer->push($programId)->push('ProgramDerivedAddress'); + 149        $buffer->push($programId)->push('ProgramDerivedAddress'); 150 - 151        $hash = hash('sha256', $buffer); - 152        $binaryString = sodium_hex2bin($hash); + 151        $hash = hash('sha256', $buffer); + 152        $binaryString = sodium_hex2bin($hash); 153 - 154        if (static::isOnCurve($binaryString)) { + 154        if (static::isOnCurve($binaryString)) { 155            throw new InputValidationException('Invalid seeds, address must fall off the curve.'); 156        } 157 - 158        return new PublicKey($binaryString); + 158        return new PublicKey($binaryString); 159    } 160 161    /** @@ -602,18 +602,18 @@ 165     */ 166    static function findProgramAddress(array $seeds, PublicKey $programId): array 167    { - 168        $nonce = 255; + 168        $nonce = 255; 169 - 170        while ($nonce != 0) { + 170        while ($nonce != 0) { 171            try { - 172                $copyOfSeedsWithNonce = $seeds; - 173                array_push($copyOfSeedsWithNonce, [$nonce]); - 174                $address = static::createProgramAddress($copyOfSeedsWithNonce, $programId); + 172                $copyOfSeedsWithNonce = $seeds; + 173                array_push($copyOfSeedsWithNonce, [$nonce]); + 174                $address = static::createProgramAddress($copyOfSeedsWithNonce, $programId); 175            } catch (\Exception $exception) { 176                $nonce--; 177                continue; 178            } - 179            return [$address, $nonce]; + 179            return [$address, $nonce]; 180        } 181 182        throw new BaseSolanaPhpSdkException('Unable to find a viable program address nonce.'); @@ -627,7 +627,7 @@ 190     */ 191    static function findProgramAddressSync(array $seeds, PublicKey $programId): array 192    { - 193        return static::findProgramAddress($seeds, $programId); + 193        return static::findProgramAddress($seeds, $programId); 194    } 195 196    /** @@ -636,19 +636,19 @@ 199    static function isOnCurve(mixed $publicKey): bool 200    { 201        try { - 202            $binaryString = $publicKey instanceof PublicKey + 202            $binaryString = $publicKey instanceof PublicKey 203                ? $publicKey->toBinaryString() - 204                : $publicKey; + 204                : $publicKey; 205 206            /** 207             * Sodium extension method sometimes returns "conversion failed" exception. 208             * $_ = sodium_crypto_sign_ed25519_pk_to_curve25519($binaryString); 209             */ - 210            $_ = ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519($binaryString); + 210            $_ = ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519($binaryString); 211 212            return true; - 213        } catch (RangeException|\SodiumException $exception) { - 214            return false; + 213        } catch (RangeException|\SodiumException $exception) { + 214            return false; 215        } 216    } 217 @@ -659,12 +659,12 @@ 222     */ 223    public static function base58(): Base58 224    { - 225        return new Base58(); + 225        return new Base58(); 226    } 227 228    public function getPublicKey(): PublicKey 229    { - 230        return $this; + 230        return $this; 231    } 232} @@ -677,7 +677,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/SolanaRpcClient.php.html b/build/html-coverage/SolanaRpcClient.php.html index 84074d8..c2d67e7 100644 --- a/build/html-coverage/SolanaRpcClient.php.html +++ b/build/html-coverage/SolanaRpcClient.php.html @@ -286,10 +286,10 @@ 69        StreamFactoryInterface|Message $streamFactory= null , 70        UriFactoryInterface $uriFactory= null 71    ) { - 72        $this->endpoint = $endpoint ? : self::DEVNET_ENDPOINT; - 73        $this->randomKey = random_int(0, 99999999); - 74        $this->httpClient = $httpClient?: new GuzzleClient(); - 75        $this->requestFactory = $requestFactory?: new HttpFactory(); + 72        $this->endpoint = $endpoint ? : self::DEVNET_ENDPOINT; + 73        $this->randomKey = random_int(0, 99999999); + 74        $this->httpClient = $httpClient?: new GuzzleClient(); + 75        $this->requestFactory = $requestFactory?: new HttpFactory(); 76 77    } 78 @@ -305,23 +305,23 @@ 88    public function call(string $method, array $params = [], array $headers = []): mixed 89    { 90 - 91        $body = json_encode($this->buildRpc($method, $params)); - 92        $options = [ - 93            'headers' => [ - 94                'Content-Type' => 'application/json', - 95                'Accept' => 'application/json', - 96            ], - 97            'body' => $body, - 98        ]; - 99        $response = $this->httpClient->request('POST', $this->endpoint, $options); + 91        $body = json_encode($this->buildRpc($method, $params)); + 92        $options = [ + 93            'headers' => [ + 94                'Content-Type' => 'application/json', + 95                'Accept' => 'application/json', + 96            ], + 97            'body' => $body, + 98        ]; + 99        $response = $this->httpClient->request('POST', $this->endpoint, $options); 100 - 101        $resp_body = $response->getBody()->getContents(); - 102        $resp_object = json_decode($resp_body, true); + 101        $resp_body = $response->getBody()->getContents(); + 102        $resp_object = json_decode($resp_body, true); 103 - 104        $this->validateResponse($resp_object, $method); + 104        $this->validateResponse($resp_object, $method); 105 106 - 107        return $resp_object['result'] ?? null; + 107        return $resp_object['result'] ?? null; 108    } 109    /** 110     * @param string $method @@ -330,12 +330,12 @@ 113     */ 114    public function buildRpc(string $method, array $params): array 115    { - 116        return [ - 117            'jsonrpc' => '2.0', - 118            'id' => $this->randomKey, - 119            'method' => $method, - 120            'params' => $params, - 121        ]; + 116        return [ + 117            'jsonrpc' => '2.0', + 118            'id' => $this->randomKey, + 119            'method' => $method, + 120            'params' => $params, + 121        ]; 122    } 123 124    /** @@ -356,22 +356,22 @@ 139 140 141 - 142        if ($body == null) { + 142        if ($body == null) { 143            throw new GenericException('Invalid JSON response'); 144        } 145 146        // If response contains an 'error' key, handle it - 147        if (isset($body['params']['error']) || isset($body['error'])) { - 148            $error = $body['params']['error']? : $body['error']; - 149            if ($error['code'] === self::ERROR_CODE_METHOD_NOT_FOUND) { + 147        if (isset($body['params']['error']) || isset($body['error'])) { + 148            $error = $body['params']['error']? : $body['error']; + 149            if ($error['code'] === self::ERROR_CODE_METHOD_NOT_FOUND) { 150                throw new MethodNotFoundException("API Error: Method $method not found."); 151            } else { - 152                throw new GenericException($error['message']); + 152                throw new GenericException($error['message']); 153            } 154        } 155 156        // If 'id' doesn't match the expected value, throw an exception - 157        if ($body['id'] !== $this->randomKey) { + 157        if ($body['id'] !== $this->randomKey) { 158            throw new InvalidIdResponseException($this->randomKey); 159        } 160 @@ -396,7 +396,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/State/Account.php.html b/build/html-coverage/State/Account.php.html index 69d5bba..e0811dd 100644 --- a/build/html-coverage/State/Account.php.html +++ b/build/html-coverage/State/Account.php.html @@ -195,7 +195,7 @@ 43 44    public static function fromBuffer(array $buffer): self 45    { - 46        return Borsh::deserialize(self::SCHEMA, self::class, $buffer); + 46        return Borsh::deserialize(self::SCHEMA, self::class, $buffer); 47    } 48 49    /** @@ -209,15 +209,15 @@ 57    ): Account 58    { 59        try { - 60            $info = $connection->getAccountInfo($accountPublicKeyOnbject, $commitment); - 61            self::$address = $accountPublicKeyOnbject; - 62            self::$tlvData = $info['data']; - 63            $base64Data = $info['data']['0']; - 64            $base64String = base64_decode($base64Data); - 65            $uint8Array = array_values(unpack('C*', $base64String)); - 66            return self::fromBuffer($uint8Array); - 67        } catch (AccountNotFoundException $e) { - 68            throw new AccountNotFoundException(); + 60            $info = $connection->getAccountInfo($accountPublicKeyOnbject, $commitment); + 61            self::$address = $accountPublicKeyOnbject; + 62            self::$tlvData = $info['data']; + 63            $base64Data = $info['data']['0']; + 64            $base64String = base64_decode($base64Data); + 65            $uint8Array = array_values(unpack('C*', $base64String)); + 66            return self::fromBuffer($uint8Array); + 67        } catch (AccountNotFoundException $e) { + 68            throw new AccountNotFoundException(); 69        } 70    } 71} @@ -231,7 +231,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/State/dashboard.html b/build/html-coverage/State/dashboard.html index 067ba6f..6a7255e 100644 --- a/build/html-coverage/State/dashboard.html +++ b/build/html-coverage/State/dashboard.html @@ -138,7 +138,7 @@

Project Risks

diff --git a/build/html-coverage/State/index.html b/build/html-coverage/State/index.html index 6e85d40..052fd8e 100644 --- a/build/html-coverage/State/index.html +++ b/build/html-coverage/State/index.html @@ -139,7 +139,7 @@

Legend

High: 90% to 100%

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/State/mint.php.html b/build/html-coverage/State/mint.php.html index ab2412b..dda64df 100644 --- a/build/html-coverage/State/mint.php.html +++ b/build/html-coverage/State/mint.php.html @@ -184,7 +184,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Transaction.php.html b/build/html-coverage/Transaction.php.html index 0ab43c9..61ded1f 100644 --- a/build/html-coverage/Transaction.php.html +++ b/build/html-coverage/Transaction.php.html @@ -44,13 +44,13 @@ Total
-
- 85.59% covered (warning) +
+ 85.97% covered (warning)
-
85.59%
-
190 / 222
+
85.97%
+
190 / 221
38.10% covered (danger) @@ -73,13 +73,13 @@ Transaction
-
- 85.59% covered (warning) +
+ 85.97% covered (warning)
-
85.59%
-
190 / 222
+
85.97%
+
190 / 221
38.10% covered (danger) @@ -88,7 +88,7 @@
38.10%
8 / 21
- 102.14 + 100.56
0.00% covered (danger) @@ -520,13 +520,13 @@  toPublicKey
-
- 33.33% covered (danger) +
+ 40.00% covered (danger)
-
33.33%
-
2 / 6
+
40.00%
+
2 / 5
0.00% covered (danger) @@ -535,12 +535,12 @@
0.00%
0 / 1
- 5.67 + 4.94 -  
toSecretKey +  toSecretKey
66.67% covered (warning) @@ -627,10 +627,10 @@ 58        ?array $signatures = [] 59    ) 60    { - 61        $this->recentBlockhash = $recentBlockhash; - 62        $this->nonceInformation = $nonceInformation; - 63        $this->feePayer = $feePayer; - 64        $this->signatures = $signatures; + 61        $this->recentBlockhash = $recentBlockhash; + 62        $this->nonceInformation = $nonceInformation; + 63        $this->feePayer = $feePayer; + 64        $this->signatures = $signatures; 65    } 66 67    /** @@ -654,9 +654,9 @@ 85     */ 86    public function add(...$items): Transaction 87    { - 88        foreach ($items as $item) { - 89            if ($item instanceof TransactionInstruction) { - 90                array_push($this->instructions, $item); + 88        foreach ($items as $item) { + 89            if ($item instanceof TransactionInstruction) { + 90                array_push($this->instructions, $item); 91            } elseif ($item instanceof Transaction) { 92                array_push($this->instructions, ...$item->instructions); 93            } else { @@ -664,7 +664,7 @@ 95            } 96        } 97 - 98        return $this; + 98        return $this; 99    } 100 101    /** @@ -675,24 +675,24 @@ 106     */ 107    public function compileMessage(): Message 108    { - 109        $nonceInfo = $this->nonceInformation; + 109        $nonceInfo = $this->nonceInformation; 110 - 111        if ($nonceInfo && sizeof($this->instructions) && $this->instructions[0] !== $nonceInfo->nonceInstruction) { + 111        if ($nonceInfo && sizeof($this->instructions) && $this->instructions[0] !== $nonceInfo->nonceInstruction) { 112            $this->recentBlockhash = $nonceInfo->nonce; 113            array_unshift($this->instructions, $nonceInfo->nonceInstruction); 114        } 115 - 116        $recentBlockhash = $this->recentBlockhash; - 117        if (! $recentBlockhash) { + 116        $recentBlockhash = $this->recentBlockhash; + 117        if (! $recentBlockhash) { 118            throw new InputValidationException('Transaction recentBlockhash required.'); - 119        } elseif (! sizeof($this->instructions)) { + 119        } elseif (! sizeof($this->instructions)) { 120            throw new InputValidationException('No instructions provided.'); 121        } 122 - 123        if ($this->feePayer) { - 124            $feePayer = $this->feePayer; - 125        } elseif (sizeof($this->signatures) && $this->signatures[0]->getPublicKey()) { - 126            $feePayer = $this->signatures[0]->getPublicKey(); + 123        if ($this->feePayer) { + 124            $feePayer = $this->feePayer; + 125        } elseif (sizeof($this->signatures) && $this->signatures[0]->getPublicKey()) { + 126            $feePayer = $this->signatures[0]->getPublicKey(); 127        } else { 128            throw new InputValidationException('Transaction fee payer required.'); 129        } @@ -701,147 +701,147 @@ 132        /** 133         * @var array<string> $programIds 134         */ - 135        $programIds = []; + 135        $programIds = []; 136        /** 137         * @var array<AccountMeta> $accountMetas 138         */ - 139        $accountMetas = []; + 139        $accountMetas = []; 140 - 141        foreach ($this->instructions as $i => $instruction) { - 142            if (! $instruction->programId) { + 141        foreach ($this->instructions as $i => $instruction) { + 142            if (! $instruction->programId) { 143                throw new InputValidationException("Transaction instruction index {$i} has undefined program id."); 144            } 145 - 146            array_push($accountMetas, ...$instruction->keys); + 146            array_push($accountMetas, ...$instruction->keys); 147 - 148            $programId = $instruction->programId->toBase58(); - 149            if (! in_array($programId, $programIds)) { - 150                array_push($programIds, $programId); + 148            $programId = $instruction->programId->toBase58(); + 149            if (! in_array($programId, $programIds)) { + 150                array_push($programIds, $programId); 151            } 152        } 153 154        // Append programID account metas - 155        foreach ($programIds as $programId) { - 156            array_push($accountMetas, new AccountMeta( - 157                new PublicKey($programId), - 158                false, - 159                false - 160            )); + 155        foreach ($programIds as $programId) { + 156            array_push($accountMetas, new AccountMeta( + 157                new PublicKey($programId), + 158                false, + 159                false + 160            )); 161        } 162 163        // Sort. Prioritizing first by signer, then by writable - 164        usort($accountMetas, function (AccountMeta $x, AccountMeta $y) { - 165            if ($x->isSigner !== $y->isSigner) { - 166                return $x->isSigner ? -1 : 1; + 164        usort($accountMetas, function (AccountMeta $x, AccountMeta $y) { + 165            if ($x->isSigner !== $y->isSigner) { + 166                return $x->isSigner ? -1 : 1; 167            } 168 - 169            if ($x->isWritable !== $y->isWritable) { - 170                return $x->isWritable ? -1 : 1; + 169            if ($x->isWritable !== $y->isWritable) { + 170                return $x->isWritable ? -1 : 1; 171            } 172 - 173            return 0; - 174        }); + 173            return 0; + 174        }); 175 176        // Cull duplicate account metas 177        /** 178         * @var array<AccountMeta> $uniqueMetas 179         */ - 180        $uniqueMetas = []; - 181        foreach ($accountMetas as $accountMeta) { - 182            $eachPublicKey = $accountMeta->getPublicKey(); - 183            $uniqueIndex = $this->arraySearchAccountMetaForPublicKey($uniqueMetas, $eachPublicKey); + 180        $uniqueMetas = []; + 181        foreach ($accountMetas as $accountMeta) { + 182            $eachPublicKey = $accountMeta->getPublicKey(); + 183            $uniqueIndex = $this->arraySearchAccountMetaForPublicKey($uniqueMetas, $eachPublicKey); 184 - 185            if ($uniqueIndex > -1) { + 185            if ($uniqueIndex > -1) { 186                $uniqueMetas[$uniqueIndex]->isWritable = $uniqueMetas[$uniqueIndex]->isWritable || $accountMeta->isWritable; 187            } else { - 188                array_push($uniqueMetas, $accountMeta); + 188                array_push($uniqueMetas, $accountMeta); 189            } 190        } 191 192        // Move fee payer to the front - 193        $feePayerIndex = $this->arraySearchAccountMetaForPublicKey($uniqueMetas, $feePayer); - 194        if ($feePayerIndex > -1) { - 195            list($payerMeta) = array_splice($uniqueMetas, $feePayerIndex, 1); - 196            $payerMeta->isSigner = true; - 197            $payerMeta->isWritable = true; - 198            array_unshift($uniqueMetas, $payerMeta); + 193        $feePayerIndex = $this->arraySearchAccountMetaForPublicKey($uniqueMetas, $feePayer); + 194        if ($feePayerIndex > -1) { + 195            list($payerMeta) = array_splice($uniqueMetas, $feePayerIndex, 1); + 196            $payerMeta->isSigner = true; + 197            $payerMeta->isWritable = true; + 198            array_unshift($uniqueMetas, $payerMeta); 199        } else { 200            array_unshift($uniqueMetas, new AccountMeta($feePayer, true, true)); 201        } 202 203        // Disallow unknown signers - 204        foreach ($this->signatures as $signature) { - 205            $uniqueIndex = $this->arraySearchAccountMetaForPublicKey($uniqueMetas, $signature); - 206            if ($uniqueIndex > -1) { - 207                $uniqueMetas[$uniqueIndex]->isSigner = true; + 204        foreach ($this->signatures as $signature) { + 205            $uniqueIndex = $this->arraySearchAccountMetaForPublicKey($uniqueMetas, $signature); + 206            if ($uniqueIndex > -1) { + 207                $uniqueMetas[$uniqueIndex]->isSigner = true; 208            } else { 209                throw new InputValidationException("Unknown signer: {$signature->getPublicKey()->toBase58()}"); 210            } 211        } 212 - 213        $numRequiredSignatures = 0; - 214        $numReadonlySignedAccounts = 0; - 215        $numReadonlyUnsignedAccounts = 0; + 213        $numRequiredSignatures = 0; + 214        $numReadonlySignedAccounts = 0; + 215        $numReadonlyUnsignedAccounts = 0; 216 217        // Split out signing from non-signing keys and count header values 218        /** 219         * @var array<string> $signedKeys 220         */ - 221        $signedKeys = []; + 221        $signedKeys = []; 222        /** 223         * @var array<string> $unsignedKeys 224         */ - 225        $unsignedKeys = []; + 225        $unsignedKeys = []; 226 - 227        foreach ($uniqueMetas as $accountMeta) { - 228            if ($accountMeta->isSigner) { - 229                array_push($signedKeys, $accountMeta->getPublicKey()->toBase58()); - 230                $numRequiredSignatures++; - 231                if (! $accountMeta->isWritable) { + 227        foreach ($uniqueMetas as $accountMeta) { + 228            if ($accountMeta->isSigner) { + 229                array_push($signedKeys, $accountMeta->getPublicKey()->toBase58()); + 230                $numRequiredSignatures++; + 231                if (! $accountMeta->isWritable) { 232                    $numReadonlySignedAccounts++; 233                } 234            } else { - 235                array_push($unsignedKeys, $accountMeta->getPublicKey()->toBase58()); - 236                if (! $accountMeta->isWritable) { - 237                    $numReadonlyUnsignedAccounts++; + 235                array_push($unsignedKeys, $accountMeta->getPublicKey()->toBase58()); + 236                if (! $accountMeta->isWritable) { + 237                    $numReadonlyUnsignedAccounts++; 238                } 239            } 240        } 241 242        // Initialize signature array, if needed - 243        if (! $this->signatures) { + 243        if (! $this->signatures) { 244            $this->signatures = array_map(function($signedKey) { 245                return new SignaturePubkeyPair(new PublicKey($signedKey), null); 246            }, $signedKeys); 247        } 248 - 249        $accountKeys = array_merge($signedKeys, $unsignedKeys); + 249        $accountKeys = array_merge($signedKeys, $unsignedKeys); 250        /** 251         * @var array<CompiledInstruction> $instructions 252         */ - 253        $instructions = array_map(function (TransactionInstruction $instruction) use ($accountKeys) { - 254            $programIdIndex = array_search($instruction->programId->toBase58(), $accountKeys); - 255            $encodedData = $instruction->data; - 256            $accounts = array_map(function (AccountMeta $meta) use ($accountKeys) { - 257                return array_search($meta->getPublicKey()->toBase58(), $accountKeys); - 258            }, $instruction->keys); - 259            return new CompiledInstruction( - 260                $programIdIndex, - 261                $accounts, - 262                $encodedData - 263            ); - 264        }, $this->instructions); + 253        $instructions = array_map(function (TransactionInstruction $instruction) use ($accountKeys) { + 254            $programIdIndex = array_search($instruction->programId->toBase58(), $accountKeys); + 255            $encodedData = $instruction->data; + 256            $accounts = array_map(function (AccountMeta $meta) use ($accountKeys) { + 257                return array_search($meta->getPublicKey()->toBase58(), $accountKeys); + 258            }, $instruction->keys); + 259            return new CompiledInstruction( + 260                $programIdIndex, + 261                $accounts, + 262                $encodedData + 263            ); + 264        }, $this->instructions); 265 - 266        return new Message( - 267            new MessageHeader( - 268                $numRequiredSignatures, - 269                $numReadonlySignedAccounts, - 270                $numReadonlyUnsignedAccounts - 271            ), - 272            $accountKeys, - 273            $recentBlockhash, - 274            $instructions - 275        ); + 266        return new Message( + 267            new MessageHeader( + 268                $numRequiredSignatures, + 269                $numReadonlySignedAccounts, + 270                $numReadonlyUnsignedAccounts + 271            ), + 272            $accountKeys, + 273            $recentBlockhash, + 274            $instructions + 275        ); 276    } 277 278    /** @@ -876,7 +876,7 @@ 307     */ 308    public function serializeMessage(): string 309    { - 310        return $this->compileMessage()->serialize(); + 310        return $this->compileMessage()->serialize(); 311    } 312 313    /** @@ -934,7 +934,7 @@ 365     */ 366    public function sign(...$signers): void 367    { - 368        $this->partialSign(...$signers); + 368        $this->partialSign(...$signers); 369    } 370 371    /** @@ -952,22 +952,22 @@ 383    public function partialSign(...$signers): void 384    { 385        // Dedupe signers - 386        $uniqueSigners = $this->arrayUnique($signers); + 386        $uniqueSigners = $this->arrayUnique($signers); 387 - 388        $this->signatures = array_map(function ($signer) { - 389            return new SignaturePubkeyPair($this->toPublicKey($signer), null); - 390        }, $uniqueSigners); + 388        $this->signatures = array_map(function ($signer) { + 389            return new SignaturePubkeyPair($this->toPublicKey($signer), null); + 390        }, $uniqueSigners); 391 - 392        $message = $this->compileMessage(); - 393        $signData = $message->serialize(); + 392        $message = $this->compileMessage(); + 393        $signData = $message->serialize(); 394 - 395        foreach ($uniqueSigners as $signer) { - 396            if ($signer instanceof Keypair) { - 397                $signature = sodium_crypto_sign_detached($signData, $this->toSecretKey($signer)); - 398                if (strlen($signature) != self::SIGNATURE_LENGTH) { + 395        foreach ($uniqueSigners as $signer) { + 396            if ($signer instanceof Keypair) { + 397                $signature = sodium_crypto_sign_detached($signData, $this->toSecretKey($signer)); + 398                if (strlen($signature) != self::SIGNATURE_LENGTH) { 399                    throw new InputValidationException('Signature has invalid length.'); 400                } - 401                $this->_addSignature($this->toPublicKey($signer), $signature); + 401                $this->_addSignature($this->toPublicKey($signer), $signature); 402            } 403        } 404    } @@ -999,13 +999,13 @@ 430     */ 431    protected function _addSignature(PublicKey $publicKey, string $signature): void 432    { - 433        $indexOfPublicKey = $this->arraySearchAccountMetaForPublicKey($this->signatures, $publicKey); + 433        $indexOfPublicKey = $this->arraySearchAccountMetaForPublicKey($this->signatures, $publicKey); 434 - 435        if ($indexOfPublicKey === -1) { + 435        if ($indexOfPublicKey === -1) { 436            throw new InputValidationException("Unknown signer: {$publicKey->toBase58()}"); 437        } 438 - 439        $this->signatures[$indexOfPublicKey]->signature = $signature; + 439        $this->signatures[$indexOfPublicKey]->signature = $signature; 440    } 441 442    /** @@ -1023,19 +1023,19 @@ 454     */ 455    protected function _verifySignature(string $signData, bool $requireAllSignatures): bool 456    { - 457        foreach ($this->signatures as $signature) { - 458            if (! $signature->signature) { + 457        foreach ($this->signatures as $signature) { + 458            if (! $signature->signature) { 459                if ($requireAllSignatures) { 460                    return false; 461                } 462            } else { - 463                if (! sodium_crypto_sign_verify_detached($signature->signature, $signData, $signature->getPublicKey()->toBinaryString())) { + 463                if (! sodium_crypto_sign_verify_detached($signature->signature, $signData, $signature->getPublicKey()->toBinaryString())) { 464                    return false; 465                } 466            } 467        } 468 - 469        return true; + 469        return true; 470    } 471 472    /** @@ -1046,13 +1046,13 @@ 477     */ 478    public function serialize(bool $requireAllSignature = true, bool $verifySignatures = true) 479    { - 480        $signData = $this->serializeMessage(); + 480        $signData = $this->serializeMessage(); 481 - 482        if ($verifySignatures && ! $this->_verifySignature($signData, $requireAllSignature)) { + 482        if ($verifySignatures && ! $this->_verifySignature($signData, $requireAllSignature)) { 483            throw new GenericException('Signature verification failed'); 484        } 485 - 486        return $this->_serialize($signData); + 486        return $this->_serialize($signData); 487    } 488 489    /** @@ -1061,40 +1061,40 @@ 492     */ 493    protected function _serialize(string $signData): string 494    { - 495        if (sizeof($this->signatures) >= self::SIGNATURE_LENGTH * 4) { + 495        if (sizeof($this->signatures) >= self::SIGNATURE_LENGTH * 4) { 496            throw new InputValidationException('Too many signatures to encode.'); 497        } 498 - 499        $wireTransaction = new Buffer(); + 499        $wireTransaction = new Buffer(); 500 - 501        $signatureCount = ShortVec::encodeLength(sizeof($this->signatures)); + 501        $signatureCount = ShortVec::encodeLength(sizeof($this->signatures)); 502 503        // Encode signature count - 504        $wireTransaction->push($signatureCount); + 504        $wireTransaction->push($signatureCount); 505 506        // Encode signatures - 507        foreach ($this->signatures as $signature) { - 508            if ($signature->signature && strlen($signature->signature) != self::SIGNATURE_LENGTH) { + 507        foreach ($this->signatures as $signature) { + 508            if ($signature->signature && strlen($signature->signature) != self::SIGNATURE_LENGTH) { 509                throw new GenericException("signature has invalid length: {$signature->signature}"); 510            } 511 - 512            if ($sig = $signature->signature) { - 513                $wireTransaction->push($sig); + 512            if ($sig = $signature->signature) { + 513                $wireTransaction->push($sig); 514            } else { 515                $wireTransaction->push(array_pad([], self::SIGNATURE_LENGTH, 0)); 516            } 517        } 518 519        // Encode signed data - 520        $wireTransaction->push($signData); + 520        $wireTransaction->push($signData); 521 - 522        if (sizeof($wireTransaction) > self::PACKET_DATA_SIZE) { + 522        if (sizeof($wireTransaction) > self::PACKET_DATA_SIZE) { 523            $actualSize = sizeof($wireTransaction); 524            $maxSize = self::PACKET_DATA_SIZE; 525            throw new GenericException("transaction too large: {$actualSize} > {$maxSize}"); 526        } 527 - 528        return $wireTransaction; + 528        return $wireTransaction; 529    } 530 531    /** @@ -1171,15 +1171,15 @@ 602     */ 603    static protected function arraySearchAccountMetaForPublicKey(array $haystack, $needle) 604    { - 605        $publicKeyToSearchFor = static::toPublicKey($needle); + 605        $publicKeyToSearchFor = static::toPublicKey($needle); 606 - 607        foreach ($haystack as $i => $item) { - 608            if (static::toPublicKey($item) == $publicKeyToSearchFor) { - 609                return $i; + 607        foreach ($haystack as $i => $item) { + 608            if (static::toPublicKey($item) == $publicKeyToSearchFor) { + 609                return $i; 610            } 611        } 612 - 613        return -1; + 613        return -1; 614    } 615 616    /** @@ -1189,16 +1189,16 @@ 620     */ 621    static protected function arrayUnique(array $haystack) 622    { - 623        $unique = []; - 624        foreach ($haystack as $item) { - 625            $indexOfSigner = static::arraySearchAccountMetaForPublicKey($unique, $item); + 623        $unique = []; + 624        foreach ($haystack as $item) { + 625            $indexOfSigner = static::arraySearchAccountMetaForPublicKey($unique, $item); 626 - 627            if ($indexOfSigner === -1) { - 628                array_push($unique, $item); + 627            if ($indexOfSigner === -1) { + 628                array_push($unique, $item); 629            } 630        } 631 - 632        return $unique; + 632        return $unique; 633    } 634 635    /** @@ -1209,34 +1209,33 @@ 640    static protected function toPublicKey($fromKeypair): PublicKey 641    { 642        //dd($base58String); - 643        if ($fromKeypair instanceof HasPublicKey) { + 643        if ($fromKeypair instanceof HasPublicKey) { 644 - 645            return $fromKeypair->getPublicKey(); + 645            return $fromKeypair->getPublicKey(); 646        } elseif (is_string($fromKeypair)) { 647 648            return new PublicKey($fromKeypair); 649        } else { - 650            dd($fromKeypair); - 651            throw new InputValidationException('Unsupported input: ' . get_class($fromKeypair)); - 652        } - 653    } - 654 - 655    /** - 656     * Pulls out the secret key and casts it to a string. - 657     * - 658     * @param $source - 659     * @return string - 660     * @throws InputValidationException - 661     */ - 662    protected function toSecretKey($source): string - 663    { - 664        if ($source instanceof HasSecretKey) { - 665            return $source->getSecretKey(); - 666        } else { - 667            throw new InputValidationException('Unsupported input: ' . get_class($source)); - 668        } - 669    } - 670} + 650            throw new InputValidationException('Unsupported input: ' . get_class($fromKeypair)); + 651        } + 652    } + 653 + 654    /** + 655     * Pulls out the secret key and casts it to a string. + 656     * + 657     * @param $source + 658     * @return string + 659     * @throws InputValidationException + 660     */ + 661    protected function toSecretKey($source): string + 662    { + 663        if ($source instanceof HasSecretKey) { + 664            return $source->getSecretKey(); + 665        } else { + 666            throw new InputValidationException('Unsupported input: ' . get_class($source)); + 667        } + 668    } + 669} @@ -1247,7 +1246,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/TransactionInstruction.php.html b/build/html-coverage/TransactionInstruction.php.html index cdfbd9e..edf4bc5 100644 --- a/build/html-coverage/TransactionInstruction.php.html +++ b/build/html-coverage/TransactionInstruction.php.html @@ -145,9 +145,9 @@ 16 17    public function __construct(PublicKey $programId, array $keys, $data = null) 18    { - 19        $this->programId = $programId; - 20        $this->keys = $keys; - 21        $this->data = Buffer::from($data); + 19        $this->programId = $programId; + 20        $this->keys = $keys; + 21        $this->data = Buffer::from($data); 22    } 23} @@ -160,7 +160,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Util/AccountMeta.php.html b/build/html-coverage/Util/AccountMeta.php.html index e7fcdfa..60d9f74 100644 --- a/build/html-coverage/Util/AccountMeta.php.html +++ b/build/html-coverage/Util/AccountMeta.php.html @@ -164,14 +164,14 @@ 12 13    public function __construct($publicKey, $isSigner, $isWritable) 14    { - 15        $this->publicKey = $publicKey; - 16        $this->isSigner = $isSigner; - 17        $this->isWritable = $isWritable; + 15        $this->publicKey = $publicKey; + 16        $this->isSigner = $isSigner; + 17        $this->isWritable = $isWritable; 18    } 19 20    public function getPublicKey(): PublicKey 21    { - 22        return $this->publicKey; + 22        return $this->publicKey; 23    } 24} @@ -184,7 +184,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Util/Buffer.php.html b/build/html-coverage/Util/Buffer.php.html index d9d3f53..f542af6 100644 --- a/build/html-coverage/Util/Buffer.php.html +++ b/build/html-coverage/Util/Buffer.php.html @@ -510,30 +510,30 @@ 50     */ 51    public function __construct($value = null, ?string $datatype = null, ?bool $signed = null) 52    { - 53        $this->datatype = $datatype; - 54        $this->signed = $signed; + 53        $this->datatype = $datatype; + 54        $this->signed = $signed; 55 - 56        $isString = is_string($value); - 57        $isNumeric = is_numeric($value); + 56        $isString = is_string($value); + 57        $isNumeric = is_numeric($value); 58 - 59        if ($isString || $isNumeric) { - 60            $this->datatype = $datatype; - 61            $this->signed = $signed; + 59        if ($isString || $isNumeric) { + 60            $this->datatype = $datatype; + 61            $this->signed = $signed; 62 63            // unpack returns an array indexed at 1. - 64            $this->data = $isString - 65                ? array_values(unpack("C*", $value)) - 66                : array_values(unpack("C*", pack($this->computedFormat(), $value))); - 67        } elseif (is_array($value)) { - 68            $this->data = $value; - 69        } elseif ($value instanceof PublicKey) { - 70            $this->data = $value->toBytes(); - 71        } elseif ($value instanceof Buffer) { - 72            $this->data = $value->toArray(); - 73            $this->datatype = $value->datatype; - 74            $this->signed = $value->signed; - 75        } elseif ($value == null) { - 76            $this->data = []; + 64            $this->data = $isString + 65                ? array_values(unpack("C*", $value)) + 66                : array_values(unpack("C*", pack($this->computedFormat(), $value))); + 67        } elseif (is_array($value)) { + 68            $this->data = $value; + 69        } elseif ($value instanceof PublicKey) { + 70            $this->data = $value->toBytes(); + 71        } elseif ($value instanceof Buffer) { + 72            $this->data = $value->toArray(); + 73            $this->datatype = $value->datatype; + 74            $this->signed = $value->signed; + 75        } elseif ($value == null) { + 76            $this->data = []; 77        } elseif (method_exists($value, 'toArray')) { 78            $this->data = $value->toArray(); 79        } else { @@ -549,7 +549,7 @@ 89     */ 90    public static function from($value = null, ?string $format = null, ?bool $signed = null): Buffer 91    { - 92        return new static($value, $format, $signed); + 92        return new static($value, $format, $signed); 93    } 94 95    /** @@ -560,9 +560,9 @@ 100     */ 101    public static function fromBase58(string $value): Buffer 102    { - 103        $value = PublicKey::base58()->decode($value); + 103        $value = PublicKey::base58()->decode($value); 104 - 105        return new static($value); + 105        return new static($value); 106    } 107 108    /** @@ -583,11 +583,11 @@ 123     */ 124    public function push($source): Buffer 125    { - 126        $sourceAsBuffer = Buffer::from($source); + 126        $sourceAsBuffer = Buffer::from($source); 127 - 128        array_push($this->data, ...$sourceAsBuffer->toArray()); + 128        array_push($this->data, ...$sourceAsBuffer->toArray()); 129 - 130        return $this; + 130        return $this; 131    } 132 133    /** @@ -595,7 +595,7 @@ 135     */ 136    public function slice(int $offset, ?int $length = null, ?string $format = null, ?bool $signed = null): Buffer 137    { - 138        return static::from(array_slice($this->data, $offset, $length), $format, $signed); + 138        return static::from(array_slice($this->data, $offset, $length), $format, $signed); 139    } 140 141    /** @@ -633,7 +633,7 @@ 173     */ 174    public function toArray(): array 175    { - 176        return $this->data; + 176        return $this->data; 177    } 178 179    /** @@ -643,7 +643,7 @@ 183     */ 184    public function toString(): string 185    { - 186        return $this; + 186        return $this; 187    } 188 189    /** @@ -663,7 +663,7 @@ 203    #[\ReturnTypeWillChange] 204    public function count() 205    { - 206        return count($this->toArray()); + 206        return count($this->toArray()); 207    } 208 209    /** @@ -672,7 +672,7 @@ 212     */ 213    public function __toString() 214    { - 215        return pack('C*', ...$this->toArray()); + 215        return pack('C*', ...$this->toArray()); 216    } 217 218    /** @@ -684,14 +684,14 @@ 224     */ 225    public function value(?int $length = null) 226    { - 227        if ($length) { + 227        if ($length) { 228            $this->fixed($length); 229        } 230 - 231        if ($this->datatype === self::TYPE_STRING) { + 231        if ($this->datatype === self::TYPE_STRING) { 232            return ord(pack("C*", ...$this->toArray())); 233        } else { - 234            return unpack($this->computedFormat(), pack("C*", ...$this->toArray()))[1]; + 234            return unpack($this->computedFormat(), pack("C*", ...$this->toArray()))[1]; 235        } 236    } 237 @@ -701,16 +701,16 @@ 241     */ 242    protected function computedFormat() 243    { - 244        if (! $this->datatype) { + 244        if (! $this->datatype) { 245            throw new InputValidationException('Trying to calculate format of unspecified buffer. Please specify a datatype.'); 246        } 247 - 248        switch ($this->datatype) { + 248        switch ($this->datatype) { 249            case self::TYPE_STRING: return self::FORMAT_CHAR_UNSIGNED; - 250            case self::TYPE_BYTE: return $this->signed ? self::FORMAT_CHAR_SIGNED : self::FORMAT_CHAR_UNSIGNED; + 250            case self::TYPE_BYTE: return $this->signed ? self::FORMAT_CHAR_SIGNED : self::FORMAT_CHAR_UNSIGNED; 251            case self::TYPE_SHORT: return $this->signed ? self::FORMAT_SHORT_16_SIGNED : self::FORMAT_SHORT_16_UNSIGNED; - 252            case self::TYPE_INT: return $this->signed ? self::FORMAT_LONG_32_SIGNED : self::FORMAT_LONG_32_UNSIGNED; - 253            case self::TYPE_LONG: return $this->signed ? self::FORMAT_LONG_LONG_64_SIGNED : self::FORMAT_LONG_LONG_64_UNSIGNED; + 252            case self::TYPE_INT: return $this->signed ? self::FORMAT_LONG_32_SIGNED : self::FORMAT_LONG_32_UNSIGNED; + 253            case self::TYPE_LONG: return $this->signed ? self::FORMAT_LONG_LONG_64_SIGNED : self::FORMAT_LONG_LONG_64_UNSIGNED; 254            case self::TYPE_FLOAT: return self::FORMAT_FLOAT; 255            default: throw new InputValidationException("Unsupported datatype."); 256        } @@ -727,7 +727,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Util/Commitment.php.html b/build/html-coverage/Util/Commitment.php.html index e43b6fb..ef2741e 100644 --- a/build/html-coverage/Util/Commitment.php.html +++ b/build/html-coverage/Util/Commitment.php.html @@ -235,15 +235,15 @@ 17     */ 18    public function __construct(string $commitmentLevel) 19    { - 20        if (! in_array($commitmentLevel, [ - 21            self::FINALIZED, - 22            self::CONFIRMED, - 23            self::PROCESSED, - 24        ])) { + 20        if (! in_array($commitmentLevel, [ + 21            self::FINALIZED, + 22            self::CONFIRMED, + 23            self::PROCESSED, + 24        ])) { 25            throw new InputValidationException('Invalid commitment level.'); 26        } 27 - 28        $this->commitmentLevel = $commitmentLevel; + 28        $this->commitmentLevel = $commitmentLevel; 29    } 30 31    /** @@ -288,7 +288,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Util/CompiledInstruction.php.html b/build/html-coverage/Util/CompiledInstruction.php.html index 2d2c435..5ccb8a8 100644 --- a/build/html-coverage/Util/CompiledInstruction.php.html +++ b/build/html-coverage/Util/CompiledInstruction.php.html @@ -149,9 +149,9 @@ 19        $data 20    ) 21    { - 22        $this->programIdIndex = $programIdIndex; - 23        $this->accounts = $accounts; - 24        $this->data = Buffer::from($data); + 22        $this->programIdIndex = $programIdIndex; + 23        $this->accounts = $accounts; + 24        $this->data = Buffer::from($data); 25    } 26} @@ -164,7 +164,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Util/ConfirmOptions.php.html b/build/html-coverage/Util/ConfirmOptions.php.html index e129034..03b7420 100644 --- a/build/html-coverage/Util/ConfirmOptions.php.html +++ b/build/html-coverage/Util/ConfirmOptions.php.html @@ -161,11 +161,11 @@ 31        int $maxRetries = 0, 32        int $minContextSlot = 0 33    ) { - 34        $this->skipPreflight = $skipPreflight; - 35        $this->commitment = $commitment; - 36        $this->preflightCommitment = $preflightCommitment; - 37        $this->maxRetries = $maxRetries; - 38        $this->minContextSlot = $minContextSlot; + 34        $this->skipPreflight = $skipPreflight; + 35        $this->commitment = $commitment; + 36        $this->preflightCommitment = $preflightCommitment; + 37        $this->maxRetries = $maxRetries; + 38        $this->minContextSlot = $minContextSlot; 39    } 40} @@ -178,7 +178,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Util/HasPublicKey.php.html b/build/html-coverage/Util/HasPublicKey.php.html index 8f3f6ba..2a6aa2d 100644 --- a/build/html-coverage/Util/HasPublicKey.php.html +++ b/build/html-coverage/Util/HasPublicKey.php.html @@ -82,7 +82,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Util/HasSecretKey.php.html b/build/html-coverage/Util/HasSecretKey.php.html index 65cd1b7..01afad5 100644 --- a/build/html-coverage/Util/HasSecretKey.php.html +++ b/build/html-coverage/Util/HasSecretKey.php.html @@ -80,7 +80,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Util/MessageHeader.php.html b/build/html-coverage/Util/MessageHeader.php.html index f3ea97b..62dab1d 100644 --- a/build/html-coverage/Util/MessageHeader.php.html +++ b/build/html-coverage/Util/MessageHeader.php.html @@ -144,9 +144,9 @@ 14        int $numReadonlyUnsignedAccounts 15    ) 16    { - 17        $this->numRequiredSignature = $numRequiredSignature; - 18        $this->numReadonlySignedAccounts = $numReadonlySignedAccounts; - 19        $this->numReadonlyUnsignedAccounts = $numReadonlyUnsignedAccounts; + 17        $this->numRequiredSignature = $numRequiredSignature; + 18        $this->numReadonlySignedAccounts = $numReadonlySignedAccounts; + 19        $this->numReadonlyUnsignedAccounts = $numReadonlyUnsignedAccounts; 20    } 21} @@ -159,7 +159,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Util/NonceInformation.php.html b/build/html-coverage/Util/NonceInformation.php.html index b94365e..ad0df6a 100644 --- a/build/html-coverage/Util/NonceInformation.php.html +++ b/build/html-coverage/Util/NonceInformation.php.html @@ -155,7 +155,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Util/ShortVec.php.html b/build/html-coverage/Util/ShortVec.php.html index 14ca641..bc017c1 100644 --- a/build/html-coverage/Util/ShortVec.php.html +++ b/build/html-coverage/Util/ShortVec.php.html @@ -179,21 +179,21 @@ 27 28    public static function encodeLength(int $length): array 29    { - 30        $elems = []; - 31        $rem_len = $length; + 30        $elems = []; + 31        $rem_len = $length; 32 33        for (;;) { - 34            $elem = $rem_len & 0x7f; - 35            $rem_len >>= 7; - 36            if (! $rem_len) { - 37                array_push($elems, $elem); - 38                break; + 34            $elem = $rem_len & 0x7f; + 35            $rem_len >>= 7; + 36            if (! $rem_len) { + 37                array_push($elems, $elem); + 38                break; 39            } 40            $elem |= 0x80; - 41            array_push($elems, $elem); + 41            array_push($elems, $elem); 42        } 43 - 44        return $elems; + 44        return $elems; 45    } 46} @@ -206,7 +206,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Util/SignaturePubkeyPair.php.html b/build/html-coverage/Util/SignaturePubkeyPair.php.html index e07e8d1..096ecf8 100644 --- a/build/html-coverage/Util/SignaturePubkeyPair.php.html +++ b/build/html-coverage/Util/SignaturePubkeyPair.php.html @@ -163,13 +163,13 @@ 11 12    public function __construct(PublicKey $publicKey, ?string $signature = null) 13    { - 14        $this->publicKey = $publicKey; - 15        $this->signature = $signature; + 14        $this->publicKey = $publicKey; + 15        $this->signature = $signature; 16    } 17 18    public function getPublicKey(): PublicKey 19    { - 20        return $this->publicKey; + 20        return $this->publicKey; 21    } 22} @@ -182,7 +182,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Util/Signer.php.html b/build/html-coverage/Util/Signer.php.html index 232e258..7c932a2 100644 --- a/build/html-coverage/Util/Signer.php.html +++ b/build/html-coverage/Util/Signer.php.html @@ -209,7 +209,7 @@

Legend

Covered by small (and larger) testsCovered by medium (and large) testsCovered by large tests (and tests of unknown size)Not coveredNot coverable

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/Util/dashboard.html b/build/html-coverage/Util/dashboard.html index 5c3ea27..d7dffeb 100644 --- a/build/html-coverage/Util/dashboard.html +++ b/build/html-coverage/Util/dashboard.html @@ -158,7 +158,7 @@

Project Risks

diff --git a/build/html-coverage/Util/index.html b/build/html-coverage/Util/index.html index 376c392..2bf795a 100644 --- a/build/html-coverage/Util/index.html +++ b/build/html-coverage/Util/index.html @@ -389,7 +389,7 @@

Legend

High: 90% to 100%

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/build/html-coverage/dashboard.html b/build/html-coverage/dashboard.html index 5a5dfc3..fe241cc 100644 --- a/build/html-coverage/dashboard.html +++ b/build/html-coverage/dashboard.html @@ -62,20 +62,9 @@

Insufficient Coverage

Attestto\SolanaPhpSdk\Exceptions\SNSError0% Attestto\SolanaPhpSdk\Exceptions\TodoException0% Attestto\SolanaPhpSdk\Programs\MetaplexProgram0% - Attestto\SolanaPhpSdk\Programs\SNS\Utils0% - Attestto\SolanaPhpSdk\Programs\SNS\InstructionBurn0% - RegisterFavoriteInstruction0% - Attestto\SolanaPhpSdk\Programs\CreateReverseInstruction0% - Attestto\SolanaPhpSdk\Programs\CreateV2Instruction0% - CreateInstructionV30% - CreateWithNftInstruction0% - Attestto\SolanaPhpSdk\Programs\SNS\SnsInstruction0% - Attestto\SolanaPhpSdk\Programs\SNS\NftRecord0% - Attestto\SolanaPhpSdk\Programs\SplSnsProgram0% Attestto\SolanaPhpSdk\State\Mint0% Attestto\SolanaPhpSdk\Util\NonceInformation0% Attestto\SolanaPhpSdk\Util\Signer0% - Attestto\SolanaPhpSdk\Programs\SplToken\Actions\SPLTokenActions0% Attestto\SolanaPhpSdk\Programs\DidSolProgram31% Attestto\SolanaPhpSdk\Programs\SystemProgram47% Attestto\SolanaPhpSdk\Util\Commitment63% @@ -103,20 +92,14 @@

Project Risks

- Attestto\SolanaPhpSdk\Programs\SNS\Utils506 - Attestto\SolanaPhpSdk\Programs\SNS\SnsInstruction182 - Attestto\SolanaPhpSdk\Transaction102 - Attestto\SolanaPhpSdk\Programs\SplToken\Actions\SPLTokenActions90 + Attestto\SolanaPhpSdk\Transaction100 Attestto\SolanaPhpSdk\Programs\DidSolProgram78 - Attestto\SolanaPhpSdk\Programs\SNS\NftRecord72 Attestto\SolanaPhpSdk\Borsh\Borsh70 Attestto\SolanaPhpSdk\Util\Buffer43 Attestto\SolanaPhpSdk\Accounts\NtfRecordAccount30 - Attestto\SolanaPhpSdk\Programs\CreateReverseInstruction30 Attestto\SolanaPhpSdk\PublicKey27 Attestto\SolanaPhpSdk\Borsh\BinaryWriter25 Attestto\SolanaPhpSdk\Borsh\BinaryReader22 - CreateInstructionV320 Attestto\SolanaPhpSdk\Programs\SystemProgram17 Attestto\SolanaPhpSdk\Borsh\BorshDeserializable14 Attestto\SolanaPhpSdk\Accounts\NameRegistryStateAccount12 @@ -182,44 +165,6 @@

Insufficient Coverage

parse0% getRpcEndpointFromShortcut0% getProgramAccounts0% - __construct0% - loadConstants0% - getHashedNameSync0% - getNameAccountKeySync0% - reverseLookup0% - deserializeReverse0% - getDomainKeySync0% - _deriveSync0% - __construct0% - serialize0% - getInstruction0% - __construct0% - serialize0% - getInstruction0% - __construct0% - serialize0% - getInstruction0% - __construct0% - serialize0% - getInstruction0% - __construct0% - serialize0% - getInstruction0% - __construct0% - serialize0% - getInstruction0% - createInstruction0% - updateInstruction0% - transferInstruction0% - reallocInstruction0% - deleteInstruction0% - __construct0% - deserialize0% - retrieve0% - findKey0% - getRecordFromMint0% - getDomainMint0% - getRecordFromMint0% getBalance0% getConfirmedTransaction0% getTransaction0% @@ -240,14 +185,13 @@

Insufficient Coverage

getSecretKey0% __isset0% __unset0% - getOrCreateAssociatedTokenAccount0% - toPublicKey33% + toPublicKey40% serializeObject41% deserializeObject57% add57% value60% signature66% - toSecretKey66% + toSecretKey66% computedFormat70% _serialize70% _verifySignature71% @@ -260,7 +204,7 @@

Insufficient Coverage

__construct81% createAssociatedTokenAccountInstruction84% simulateTransaction85% - getAssociatedTokenAddressSync85% + getAssociatedTokenAddressSync85% __construct85% __construct86% __get87% @@ -280,18 +224,11 @@

Project Risks

- getDomainKeySync90 - getOrCreateAssociatedTokenAccount90 parse42 - transferInstruction42 getRpcEndpointFromShortcut30 - createInstruction20 serializeField18 computedFormat17 retrieve12 - getNameAccountKeySync12 - getInstruction12 - retrieve12 __unset12 serializeObject9 __construct9 @@ -300,25 +237,20 @@

Project Risks

validateResponse7 retrieve6 writeArray6 - __construct6 - reverseLookup6 - deserializeReverse6 - _deriveSync6 - getInstruction6 equals6 addSignature6 __isset6 - toPublicKey5 _verifySignature5 add5 __construct5 + toPublicKey4 value3 serialize3 - getAssociatedTokenAddressSync3 + getAssociatedTokenAddressSync3 createAssociatedTokenAccountInstruction3 __get3 signature2 - toSecretKey2 + toSecretKey2 getAccountInfo2 _addSignature2 readBuffer2 @@ -333,7 +265,7 @@

Project Risks

@@ -352,7 +284,7 @@

Project Risks

.yAxis.tickFormat(d3.format('d')); d3.select('#classCoverageDistribution svg') - .datum(getCoverageDistributionData([19,0,0,0,1,1,0,3,1,5,5,30], "Class Coverage")) + .datum(getCoverageDistributionData([8,0,0,0,1,1,0,3,1,5,6,30], "Class Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -370,7 +302,7 @@

Project Risks

.yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([82,0,0,0,1,1,2,3,8,8,7,113], "Method Coverage")) + .datum(getCoverageDistributionData([43,0,0,0,0,2,2,3,8,8,7,113], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -420,7 +352,7 @@

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[100,4,"Attestto\\SolanaPhpSdk\\Account<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Accounts\\Creator<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Accounts\\Did\\ServiceStruct<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Accounts\\Did\\VerificationMethodStruct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Accounts\\DidData<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Accounts\\Metadata<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Accounts\\MetadataData<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Accounts\\NameRegistryStateAccount<\/a>"],[0,5,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount<\/a>"],[83.78378378378379,21,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader<\/a>"],[69.23076923076923,17,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter<\/a>"],[72.6027397260274,39,"Attestto\\SolanaPhpSdk\\Borsh\\Borsh<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Borsh\\BorshException<\/a>"],[92.3076923076923,13,"Attestto\\SolanaPhpSdk\\Connection<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\AccountNotFoundException<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\BaseSolanaPhpSdkException<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\GenericException<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\InputValidationException<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\InvalidIdResponseException<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\MethodNotFoundException<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Exceptions\\SNSError<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Exceptions\\TodoException<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\TokenAccountNotFoundError<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\TokenInvalidAccountOwnerError<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\TokenInvalidMintError<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\TokenOwnerOffCurveError<\/a>"],[100,9,"Attestto\\SolanaPhpSdk\\Keypair<\/a>"],[92.5925925925926,18,"Attestto\\SolanaPhpSdk\\Message<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Program<\/a>"],[31.11111111111111,14,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\MetaplexProgram<\/a>"],[0,22,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\InstructionBurn<\/a>"],[0,3,"RegisterFavoriteInstruction<\/a>"],[0,5,"Attestto\\SolanaPhpSdk\\Programs\\CreateReverseInstruction<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\CreateV2Instruction<\/a>"],[0,4,"CreateInstructionV3<\/a>"],[0,3,"CreateWithNftInstruction<\/a>"],[0,13,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\SnsInstruction<\/a>"],[0,8,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\NftRecord<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplSnsProgram<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/a>"],[94.23076923076923,12,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram<\/a>"],[47.22222222222222,8,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram<\/a>"],[89.65517241379311,27,"Attestto\\SolanaPhpSdk\\PublicKey<\/a>"],[90.9090909090909,14,"Attestto\\SolanaPhpSdk\\SolanaRpcClient<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\State\\Account<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\State\\Mint<\/a>"],[85.58558558558559,82,"Attestto\\SolanaPhpSdk\\Transaction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\TransactionInstruction<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Util\\AccountMeta<\/a>"],[84.48275862068965,38,"Attestto\\SolanaPhpSdk\\Util\\Buffer<\/a>"],[63.63636363636363,6,"Attestto\\SolanaPhpSdk\\Util\\Commitment<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\CompiledInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\ConfirmOptions<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\MessageHeader<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\NonceInformation<\/a>"],[100,6,"Attestto\\SolanaPhpSdk\\Util\\ShortVec<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Util\\SignaturePubkeyPair<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Util\\Signer<\/a>"],[68.75,11,"Attestto\\SolanaPhpSdk\\Borsh\\BorshDeserializable<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Borsh\\BorshObject<\/a>"],[87.5,3,"Attestto\\SolanaPhpSdk\\Borsh\\BorshSerializable<\/a>"],[0,9,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions<\/a>"],[94.28571428571428,5,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[100,4,"Attestto\\SolanaPhpSdk\\Account<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Accounts\\Creator<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Accounts\\Did\\ServiceStruct<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Accounts\\Did\\VerificationMethodStruct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Accounts\\DidData<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Accounts\\Metadata<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Accounts\\MetadataData<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Accounts\\NameRegistryStateAccount<\/a>"],[0,5,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount<\/a>"],[83.78378378378379,21,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader<\/a>"],[69.23076923076923,17,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter<\/a>"],[72.6027397260274,39,"Attestto\\SolanaPhpSdk\\Borsh\\Borsh<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Borsh\\BorshException<\/a>"],[92.3076923076923,13,"Attestto\\SolanaPhpSdk\\Connection<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\AccountNotFoundException<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\BaseSolanaPhpSdkException<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\GenericException<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\InputValidationException<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\InvalidIdResponseException<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\MethodNotFoundException<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Exceptions\\SNSError<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Exceptions\\TodoException<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\TokenAccountNotFoundError<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\TokenInvalidAccountOwnerError<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\TokenInvalidMintError<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Exceptions\\TokenOwnerOffCurveError<\/a>"],[100,9,"Attestto\\SolanaPhpSdk\\Keypair<\/a>"],[92.5925925925926,18,"Attestto\\SolanaPhpSdk\\Message<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Program<\/a>"],[31.11111111111111,14,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\MetaplexProgram<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/a>"],[93.75,4,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram<\/a>"],[47.22222222222222,8,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram<\/a>"],[89.65517241379311,27,"Attestto\\SolanaPhpSdk\\PublicKey<\/a>"],[90.9090909090909,14,"Attestto\\SolanaPhpSdk\\SolanaRpcClient<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\State\\Account<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\State\\Mint<\/a>"],[85.97285067873304,82,"Attestto\\SolanaPhpSdk\\Transaction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\TransactionInstruction<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Util\\AccountMeta<\/a>"],[84.48275862068965,38,"Attestto\\SolanaPhpSdk\\Util\\Buffer<\/a>"],[63.63636363636363,6,"Attestto\\SolanaPhpSdk\\Util\\Commitment<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\CompiledInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\ConfirmOptions<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\MessageHeader<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\NonceInformation<\/a>"],[100,6,"Attestto\\SolanaPhpSdk\\Util\\ShortVec<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Util\\SignaturePubkeyPair<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Util\\Signer<\/a>"],[68.75,11,"Attestto\\SolanaPhpSdk\\Borsh\\BorshDeserializable<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Borsh\\BorshObject<\/a>"],[87.5,3,"Attestto\\SolanaPhpSdk\\Borsh\\BorshSerializable<\/a>"],[94.44444444444444,8,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions<\/a>"],[94.28571428571428,5,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -444,7 +376,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[100,2,"
Attestto\\SolanaPhpSdk\\Account::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Account::getPublicKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Account::getSecretKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Accounts\\DidData::fromBuffer<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Accounts\\Metadata::fromBuffer<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Accounts\\MetadataData::__set<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Accounts\\NameRegistryStateAccount::retrieve<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Accounts\\NameRegistryStateAccount::deserialize<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount::deserialize<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount::retrieve<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount::findKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readU8<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readU16<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readU32<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readU64<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readI8<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readI16<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readI32<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readI64<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readUnsignedInt<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readSignedInt<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readF32<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readF64<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readString<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readFixedArray<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readPubKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readPubKeyAsString<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readArray<\/a>"],[80,2,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readBuffer<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeU8<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeU16<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeU32<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeU64<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeI8<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeI16<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeI32<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeI64<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeF32<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeF64<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeString<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeFixedArray<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeArray<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeBuffer<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::toArray<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\Borsh::serialize<\/a>"],[41.66666666666667,5,"Attestto\\SolanaPhpSdk\\Borsh\\Borsh::serializeObject<\/a>"],[72,14,"Attestto\\SolanaPhpSdk\\Borsh\\Borsh::serializeField<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\Borsh::deserialize<\/a>"],[57.14285714285714,6,"Attestto\\SolanaPhpSdk\\Borsh\\Borsh::deserializeObject<\/a>"],[100,12,"Attestto\\SolanaPhpSdk\\Borsh\\Borsh::deserializeField<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Connection::getAccountInfo<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Connection::getBalance<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Connection::getConfirmedTransaction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Connection::getTransaction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Connection::getRecentBlockhash<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Connection::getLatestBlockhash<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Connection::sendTransaction<\/a>"],[85.71428571428571,2,"Attestto\\SolanaPhpSdk\\Connection::simulateTransaction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Connection::requestAirdrop<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Exceptions\\SNSError::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Exceptions\\TodoException::__construct<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Keypair::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Keypair::generate<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Keypair::from<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Keypair::fromSecretKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Keypair::fromSeed<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Keypair::getPublicKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Keypair::getSecretKey<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Message::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Message::isAccountSigner<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Message::isAccountWritable<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Message::isProgramId<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Message::programIds<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Message::nonProgramIds<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Message::serialize<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Message::encodeMessage<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Message::encodeInstruction<\/a>"],[97.2972972972973,4,"Attestto\\SolanaPhpSdk\\Message::from<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Program::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Program::config<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::getDidDataAcccountInfo<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::getDidDataAccountId<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::deserializeDidData<\/a>"],[0,6,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::parse<\/a>"],[0,5,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::getRpcEndpointFromShortcut<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\MetaplexProgram::getProgramAccounts<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::loadConstants<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getHashedNameSync<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getNameAccountKeySync<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::reverseLookup<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::deserializeReverse<\/a>"],[0,9,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getDomainKeySync<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::_deriveSync<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\InstructionBurn::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\InstructionBurn::serialize<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\InstructionBurn::getInstruction<\/a>"],[0,1,"RegisterFavoriteInstruction::__construct<\/a>"],[0,1,"RegisterFavoriteInstruction::serialize<\/a>"],[0,1,"RegisterFavoriteInstruction::getInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\CreateReverseInstruction::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\CreateReverseInstruction::serialize<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\CreateReverseInstruction::getInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\CreateV2Instruction::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\CreateV2Instruction::serialize<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\CreateV2Instruction::getInstruction<\/a>"],[0,1,"CreateInstructionV3::__construct<\/a>"],[0,1,"CreateInstructionV3::serialize<\/a>"],[0,2,"CreateInstructionV3::getInstruction<\/a>"],[0,1,"CreateWithNftInstruction::__construct<\/a>"],[0,1,"CreateWithNftInstruction::serialize<\/a>"],[0,1,"CreateWithNftInstruction::getInstruction<\/a>"],[0,4,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\SnsInstruction::createInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\SnsInstruction::updateInstruction<\/a>"],[0,6,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\SnsInstruction::transferInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\SnsInstruction::reallocInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\SnsInstruction::deleteInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\NftRecord::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\NftRecord::deserialize<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\NftRecord::retrieve<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\NftRecord::findKey<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\NftRecord::getRecordFromMint<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\NftRecord::getDomainMint<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplSnsProgram::getRecordFromMint<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram::getTokenAccountsByOwner<\/a>"],[85.71428571428571,3,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram::getAssociatedTokenAddressSync<\/a>"],[94.44444444444444,8,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram::getOrCreateAssociatedTokenAccount<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::programId<\/a>"],[75,2,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getAccountInfo<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getBalance<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getConfirmedTransaction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getTransaction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::transfer<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::createAccount<\/a>"],[81.81818181818183,5,"Attestto\\SolanaPhpSdk\\PublicKey::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\PublicKey::default<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\PublicKey::equals<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::toBase58<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::toBytes<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::toBuffer<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::toBinaryString<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::__toString<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::createWithSeed<\/a>"],[91.66666666666666,4,"Attestto\\SolanaPhpSdk\\PublicKey::createProgramAddress<\/a>"],[90,3,"Attestto\\SolanaPhpSdk\\PublicKey::findProgramAddress<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::findProgramAddressSync<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\PublicKey::isOnCurve<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::base58<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::getPublicKey<\/a>"],[100,4,"Attestto\\SolanaPhpSdk\\SolanaRpcClient::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\SolanaRpcClient::call<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\SolanaRpcClient::buildRpc<\/a>"],[77.77777777777779,7,"Attestto\\SolanaPhpSdk\\SolanaRpcClient::validateResponse<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\SolanaRpcClient::getRandomKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\State\\Account::fromBuffer<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\State\\Account::getAccount<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\State\\Mint::fromBuffer<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Transaction::__construct<\/a>"],[66.66666666666666,2,"Attestto\\SolanaPhpSdk\\Transaction::signature<\/a>"],[57.14285714285714,4,"Attestto\\SolanaPhpSdk\\Transaction::add<\/a>"],[91.66666666666666,28,"Attestto\\SolanaPhpSdk\\Transaction::compileMessage<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Transaction::serializeMessage<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Transaction::setSigners<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Transaction::addSigner<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Transaction::sign<\/a>"],[91.66666666666666,4,"Attestto\\SolanaPhpSdk\\Transaction::partialSign<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Transaction::addSignature<\/a>"],[75,2,"Attestto\\SolanaPhpSdk\\Transaction::_addSignature<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Transaction::verifySignatures<\/a>"],[71.42857142857143,5,"Attestto\\SolanaPhpSdk\\Transaction::_verifySignature<\/a>"],[75,3,"Attestto\\SolanaPhpSdk\\Transaction::serialize<\/a>"],[70.58823529411765,7,"Attestto\\SolanaPhpSdk\\Transaction::_serialize<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Transaction::from<\/a>"],[96,6,"Attestto\\SolanaPhpSdk\\Transaction::populate<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Transaction::arraySearchAccountMetaForPublicKey<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Transaction::arrayUnique<\/a>"],[33.33333333333333,3,"Attestto\\SolanaPhpSdk\\Transaction::toPublicKey<\/a>"],[66.66666666666666,2,"Attestto\\SolanaPhpSdk\\Transaction::toSecretKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\TransactionInstruction::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\AccountMeta::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\AccountMeta::getPublicKey<\/a>"],[86.95652173913044,9,"Attestto\\SolanaPhpSdk\\Util\\Buffer::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::from<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::fromBase58<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::pad<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::push<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::slice<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::splice<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::shift<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::fixed<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::toArray<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::toString<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::toBase58String<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::count<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::__toString<\/a>"],[60,3,"Attestto\\SolanaPhpSdk\\Util\\Buffer::value<\/a>"],[70,13,"Attestto\\SolanaPhpSdk\\Util\\Buffer::computedFormat<\/a>"],[85.71428571428571,2,"Attestto\\SolanaPhpSdk\\Util\\Commitment::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Commitment::finalized<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\Commitment::confirmed<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\Commitment::processed<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\Commitment::__toString<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\CompiledInstruction::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\ConfirmOptions::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\MessageHeader::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\NonceInformation::__construct<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Util\\ShortVec::decodeLength<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Util\\ShortVec::encodeLength<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\SignaturePubkeyPair::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\SignaturePubkeyPair::getPublicKey<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\Signer::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\Signer::getPublicKey<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\Signer::getSecretKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BorshDeserializable::borshConstructor<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Borsh\\BorshDeserializable::__set<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Borsh\\BorshDeserializable::__isset<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Borsh\\BorshDeserializable::__unset<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Borsh\\BorshDeserializable::isPrivateProperty<\/a>"],[87.5,3,"Attestto\\SolanaPhpSdk\\Borsh\\BorshSerializable::__get<\/a>"],[0,9,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions::getOrCreateAssociatedTokenAccount<\/a>"],[84.61538461538461,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::createAssociatedTokenAccountInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::buildAssociatedTokenAccountInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::createSyncNativeInstruction<\/a>"]], 'Method Complexity')) + .datum(getComplexityData([[100,2,"Attestto\\SolanaPhpSdk\\Account::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Account::getPublicKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Account::getSecretKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Accounts\\DidData::fromBuffer<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Accounts\\Metadata::fromBuffer<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Accounts\\MetadataData::__set<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Accounts\\NameRegistryStateAccount::retrieve<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Accounts\\NameRegistryStateAccount::deserialize<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount::deserialize<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount::retrieve<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount::findKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readU8<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readU16<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readU32<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readU64<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readI8<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readI16<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readI32<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readI64<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readUnsignedInt<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readSignedInt<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readF32<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readF64<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readString<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readFixedArray<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readPubKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readPubKeyAsString<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readArray<\/a>"],[80,2,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryReader::readBuffer<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeU8<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeU16<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeU32<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeU64<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeI8<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeI16<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeI32<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeI64<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeF32<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeF64<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeString<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeFixedArray<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeArray<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::writeBuffer<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BinaryWriter::toArray<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\Borsh::serialize<\/a>"],[41.66666666666667,5,"Attestto\\SolanaPhpSdk\\Borsh\\Borsh::serializeObject<\/a>"],[72,14,"Attestto\\SolanaPhpSdk\\Borsh\\Borsh::serializeField<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\Borsh::deserialize<\/a>"],[57.14285714285714,6,"Attestto\\SolanaPhpSdk\\Borsh\\Borsh::deserializeObject<\/a>"],[100,12,"Attestto\\SolanaPhpSdk\\Borsh\\Borsh::deserializeField<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Connection::getAccountInfo<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Connection::getBalance<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Connection::getConfirmedTransaction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Connection::getTransaction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Connection::getRecentBlockhash<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Connection::getLatestBlockhash<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Connection::sendTransaction<\/a>"],[85.71428571428571,2,"Attestto\\SolanaPhpSdk\\Connection::simulateTransaction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Connection::requestAirdrop<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Exceptions\\SNSError::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Exceptions\\TodoException::__construct<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Keypair::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Keypair::generate<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Keypair::from<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Keypair::fromSecretKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Keypair::fromSeed<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Keypair::getPublicKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Keypair::getSecretKey<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Message::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Message::isAccountSigner<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Message::isAccountWritable<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Message::isProgramId<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Message::programIds<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Message::nonProgramIds<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Message::serialize<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Message::encodeMessage<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Message::encodeInstruction<\/a>"],[97.2972972972973,4,"Attestto\\SolanaPhpSdk\\Message::from<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Program::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Program::config<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::getDidDataAcccountInfo<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::getDidDataAccountId<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::deserializeDidData<\/a>"],[0,6,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::parse<\/a>"],[0,5,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram::getRpcEndpointFromShortcut<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\MetaplexProgram::getProgramAccounts<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram::getTokenAccountsByOwner<\/a>"],[85.71428571428571,3,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram::getAssociatedTokenAddressSync<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::programId<\/a>"],[75,2,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getAccountInfo<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getBalance<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getConfirmedTransaction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::getTransaction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::transfer<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram::createAccount<\/a>"],[81.81818181818183,5,"Attestto\\SolanaPhpSdk\\PublicKey::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\PublicKey::default<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\PublicKey::equals<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::toBase58<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::toBytes<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::toBuffer<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::toBinaryString<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::__toString<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::createWithSeed<\/a>"],[91.66666666666666,4,"Attestto\\SolanaPhpSdk\\PublicKey::createProgramAddress<\/a>"],[90,3,"Attestto\\SolanaPhpSdk\\PublicKey::findProgramAddress<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::findProgramAddressSync<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\PublicKey::isOnCurve<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::base58<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\PublicKey::getPublicKey<\/a>"],[100,4,"Attestto\\SolanaPhpSdk\\SolanaRpcClient::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\SolanaRpcClient::call<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\SolanaRpcClient::buildRpc<\/a>"],[77.77777777777779,7,"Attestto\\SolanaPhpSdk\\SolanaRpcClient::validateResponse<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\SolanaRpcClient::getRandomKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\State\\Account::fromBuffer<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\State\\Account::getAccount<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\State\\Mint::fromBuffer<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Transaction::__construct<\/a>"],[66.66666666666666,2,"Attestto\\SolanaPhpSdk\\Transaction::signature<\/a>"],[57.14285714285714,4,"Attestto\\SolanaPhpSdk\\Transaction::add<\/a>"],[91.66666666666666,28,"Attestto\\SolanaPhpSdk\\Transaction::compileMessage<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Transaction::serializeMessage<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Transaction::setSigners<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Transaction::addSigner<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Transaction::sign<\/a>"],[91.66666666666666,4,"Attestto\\SolanaPhpSdk\\Transaction::partialSign<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Transaction::addSignature<\/a>"],[75,2,"Attestto\\SolanaPhpSdk\\Transaction::_addSignature<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Transaction::verifySignatures<\/a>"],[71.42857142857143,5,"Attestto\\SolanaPhpSdk\\Transaction::_verifySignature<\/a>"],[75,3,"Attestto\\SolanaPhpSdk\\Transaction::serialize<\/a>"],[70.58823529411765,7,"Attestto\\SolanaPhpSdk\\Transaction::_serialize<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Transaction::from<\/a>"],[96,6,"Attestto\\SolanaPhpSdk\\Transaction::populate<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Transaction::arraySearchAccountMetaForPublicKey<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Transaction::arrayUnique<\/a>"],[40,3,"Attestto\\SolanaPhpSdk\\Transaction::toPublicKey<\/a>"],[66.66666666666666,2,"Attestto\\SolanaPhpSdk\\Transaction::toSecretKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\TransactionInstruction::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\AccountMeta::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\AccountMeta::getPublicKey<\/a>"],[86.95652173913044,9,"Attestto\\SolanaPhpSdk\\Util\\Buffer::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::from<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::fromBase58<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::pad<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::push<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::slice<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::splice<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::shift<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::fixed<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::toArray<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::toString<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::toBase58String<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::count<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::__toString<\/a>"],[60,3,"Attestto\\SolanaPhpSdk\\Util\\Buffer::value<\/a>"],[70,13,"Attestto\\SolanaPhpSdk\\Util\\Buffer::computedFormat<\/a>"],[85.71428571428571,2,"Attestto\\SolanaPhpSdk\\Util\\Commitment::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Commitment::finalized<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\Commitment::confirmed<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\Commitment::processed<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\Commitment::__toString<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\CompiledInstruction::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\ConfirmOptions::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\MessageHeader::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\NonceInformation::__construct<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Util\\ShortVec::decodeLength<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Util\\ShortVec::encodeLength<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\SignaturePubkeyPair::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\SignaturePubkeyPair::getPublicKey<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\Signer::__construct<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\Signer::getPublicKey<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Util\\Signer::getSecretKey<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Borsh\\BorshDeserializable::borshConstructor<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Borsh\\BorshDeserializable::__set<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\Borsh\\BorshDeserializable::__isset<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Borsh\\BorshDeserializable::__unset<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Borsh\\BorshDeserializable::isPrivateProperty<\/a>"],[87.5,3,"Attestto\\SolanaPhpSdk\\Borsh\\BorshSerializable::__get<\/a>"],[94.44444444444444,8,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions::getOrCreateAssociatedTokenAccount<\/a>"],[84.61538461538461,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::createAssociatedTokenAccountInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::buildAssociatedTokenAccountInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions::createSyncNativeInstruction<\/a>"]], 'Method Complexity')) .transition() .duration(500) .call(chart); diff --git a/build/html-coverage/index.html b/build/html-coverage/index.html index 8fcca45..2b140ca 100644 --- a/build/html-coverage/index.html +++ b/build/html-coverage/index.html @@ -42,31 +42,31 @@ - Total -
-
- 43.05% covered (danger) + Total +
+
+ 78.69% covered (warning)
-
43.05%
-
746 / 1733
-
-
- 48.29% covered (danger) +
78.69%
+
746 / 948
+
+
+ 60.75% covered (warning)
-
48.29%
-
113 / 234
+
60.75%
+
113 / 186
-
- 28.00% covered (danger) +
+ 35.90% covered (danger)
-
28.00%
-
14 / 50
+
35.90%
+
14 / 39
@@ -167,23 +167,23 @@ -
Programs -
-
- 11.69% covered (danger) + Programs +
+
+ 61.75% covered (warning)
-
11.69%
-
113 / 967
+
61.75%
+
113 / 183
-
- 10.45% covered (danger) +
+ 36.84% covered (danger)
-
10.45%
-
7 / 67
+
36.84%
+
7 / 19
0.00% covered (danger) @@ -191,7 +191,7 @@
0.00%
-
0 / 17
+
0 / 6
@@ -449,13 +449,13 @@ Transaction.php
-
- 85.59% covered (warning) +
+ 85.97% covered (warning)
-
85.59%
-
190 / 222
+
85.97%
+
190 / 221
38.10% covered (danger) @@ -515,7 +515,7 @@

Legend

High: 90% to 100%

- Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:11:19 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Sat May 4 19:31:53 UTC 2024.

diff --git a/src/Programs/SNS/Constants/config.json b/config/SNS/Constants/config.json similarity index 100% rename from src/Programs/SNS/Constants/config.json rename to config/SNS/Constants/config.json diff --git a/src/Programs/SNS/Constants/record.json b/config/SNS/Constants/record.json similarity index 100% rename from src/Programs/SNS/Constants/record.json rename to config/SNS/Constants/record.json diff --git a/src/Programs/SNS/Utils.php b/config/SNS/Deprecated/Utils.php similarity index 93% rename from src/Programs/SNS/Utils.php rename to config/SNS/Deprecated/Utils.php index edf99dd..fbdc22e 100644 --- a/src/Programs/SNS/Utils.php +++ b/config/SNS/Deprecated/Utils.php @@ -1,14 +1,19 @@ [ 'kind' => 'struct', 'fields' => [ diff --git a/src/Programs/SNS/InstructionRegisterFavorite.php b/config/SNS/InstructionRegisterFavorite.php similarity index 87% rename from src/Programs/SNS/InstructionRegisterFavorite.php rename to config/SNS/InstructionRegisterFavorite.php index bf7d640..1293e59 100644 --- a/src/Programs/SNS/InstructionRegisterFavorite.php +++ b/config/SNS/InstructionRegisterFavorite.php @@ -1,11 +1,14 @@ tag = 6; } - public function serialize(): Buffer { + public function serialize(): Buffer + { return Borsh::serialize(self::SCHEMA, $this); } @@ -28,7 +33,8 @@ public function getInstruction( PublicKey $favouriteAccount, PublicKey $owner, PublicKey $systemProgram - ): TransactionInstruction { + ): TransactionInstruction + { $data = $this->serialize(); $keys = [ [ diff --git a/src/Programs/SNS/InstructionReverse.php b/config/SNS/InstructionReverse.php similarity index 98% rename from src/Programs/SNS/InstructionReverse.php rename to config/SNS/InstructionReverse.php index 4b28b71..1c9546a 100644 --- a/src/Programs/SNS/InstructionReverse.php +++ b/config/SNS/InstructionReverse.php @@ -1,11 +1,11 @@ tag = 13; $this->name = $obj['name']; $this->space = $obj['space']; $this->referrerIdxOpt = $obj['referrerIdxOpt']; } - public function serialize(): Buffer { + public function serialize(): Buffer + { return Borsh::serialize(self::SCHEMA, $this); } public function getInstruction( - PublicKey $programId, - PublicKey $namingServiceProgram, - PublicKey $rootDomain, - PublicKey $name, - PublicKey $reverseLookup, - PublicKey $systemProgram, - PublicKey $centralState, - PublicKey $buyer, - PublicKey $buyerTokenSource, - PublicKey $pythMappingAcc, - PublicKey $pythProductAcc, - PublicKey $pythPriceAcc, - PublicKey $vault, - PublicKey $splTokenProgram, - PublicKey $rentSysvar, - PublicKey $state, + PublicKey $programId, + PublicKey $namingServiceProgram, + PublicKey $rootDomain, + PublicKey $name, + PublicKey $reverseLookup, + PublicKey $systemProgram, + PublicKey $centralState, + PublicKey $buyer, + PublicKey $buyerTokenSource, + PublicKey $pythMappingAcc, + PublicKey $pythProductAcc, + PublicKey $pythPriceAcc, + PublicKey $vault, + PublicKey $splTokenProgram, + PublicKey $rentSysvar, + PublicKey $state, ?PublicKey $referrerAccountOpt = null - ): TransactionInstruction { + ): TransactionInstruction + { $data = $this->serialize(); $keys = [ [ diff --git a/src/Programs/SNS/InstructionWithNft.php b/config/SNS/InstructionWithNft.php similarity index 94% rename from src/Programs/SNS/InstructionWithNft.php rename to config/SNS/InstructionWithNft.php index 5fc7d4d..c062bce 100644 --- a/src/Programs/SNS/InstructionWithNft.php +++ b/config/SNS/InstructionWithNft.php @@ -1,11 +1,14 @@ tag = 17; $this->name = $obj['name']; $this->space = $obj['space']; } - public function serialize(): Buffer { + public function serialize(): Buffer + { return Borsh::serialize(self::SCHEMA, $this); } @@ -46,7 +51,8 @@ public function getInstruction( PublicKey $rentSysvar, PublicKey $state, PublicKey $mplTokenMetadata - ): TransactionInstruction { + ): TransactionInstruction + { $data = $this->serialize(); $keys = [ [ diff --git a/src/Programs/SNS/Instructions.php b/config/SNS/Instructions.php similarity index 97% rename from src/Programs/SNS/Instructions.php rename to config/SNS/Instructions.php index e2726cf..60cd87b 100644 --- a/src/Programs/SNS/Instructions.php +++ b/config/SNS/Instructions.php @@ -1,11 +1,14 @@ config = $config; - } else { - $this->config = $this->loadConstants(); - } - return $this; - } - - private function loadConstants() - { - $jsonFilePath = dirname(__DIR__) . '/SNS/Constants/config.json'; - return json_decode(file_get_contents($jsonFilePath), true); - } - - public function getHashedNameSync(string $name): string - { - $input = $this->config['HASH_PREFIX'] . $name; - $hashed = hash('sha256', $input); - return $hashed; - } - - /** - * @deprecated Use {@link getNameAccountKeySync} instead - * @param string $hashedName The hashed name buffer - * @param PublicKey|null $nameClass The name class public key - * @param PublicKey|null $nameParent The name parent public key - * @return PublicKey The public key of the name account - */ - function getNameAccountKey(string $hashedName, ?PublicKey $nameClass = null, ?PublicKey $nameParent = null): PublicKey - { - $seeds = [$hashedName]; - if ($nameClass) { - $seeds[] = $nameClass->toBuffer(); - } else { - $seeds[] = str_repeat("\0", 32); // Buffer.alloc(32) - } - if ($nameParent) { - $seeds[] = $nameParent->toBuffer(); - } else { - $seeds[] = str_repeat("\0", 32); // Buffer.alloc(32) - } - $result = PublicKey::findProgramAddress($seeds, NAME_PROGRAM_ID); - return $result[0]; - } - - //-- - /** - * This function can be used to perform a reverse look up - * @param connection The Solana RPC connection - * @param nameAccount The public key of the domain to look up - * @returns The human readable domain name - */ - public function reverseLookup(Connection $connection, PublicKey $nameAccount): string - { - $hashedReverseLookup = $this->getHashedNameSync($nameAccount->toBase58()); - $reverseLookupAccount = $this->getNameAccountKeySync($hashedReverseLookup, $this->config->REVERSE_LOOKUP_CLASS); - - $registry = NameRegistryStateAccount::retrieve($connection, $reverseLookupAccount); - if (!$registry['data']) { - throw new SNSError(SNSError::NoAccountData); - } - - return $this->deserializeReverse($registry['data']); - } - - public function deserializeReverse( - $data - ): ?string { - if (!$data) { - return null; - } - $nameLength = unpack('V', substr($data, 0, 4))[1]; - return substr($data, 4, $nameLength); - } - - - /** - * This function can be used to compute the public key of a domain or subdomain - * @deprecated Use {@link getDomainKeySync} instead - * @param string $domain The domain to compute the public key for (e.g `bonfida.sol`, `dex.bonfida.sol`) - * @param bool $record Optional parameter: If the domain being resolved is a record - * @return array - * @throws SNSError - */ - function getDomainKey(string $domain, bool $record = false): array - { - if (substr($domain, -4) === '.sol') { - $domain = substr($domain, 0, -4); - } - $splitted = explode('.', $domain); - if (count($splitted) === 2) { - $prefix = $record ? "\x01" : "\x00"; - $sub = $prefix . $splitted[0]; - $parentKey = $this->_derive($splitted[1])['pubkey']; - $result = $this->_derive($sub, $parentKey); - return array_merge($result, ['isSub' => true, 'parent' => $parentKey]); - } elseif (count($splitted) === 3 && $record) { - // Parent key - $parentKey = $this->_derive($splitted[2])['pubkey']; - // Sub domain - $subKey = $this->_derive("\x00" . $splitted[1], $parentKey)['pubkey']; - // Sub record - $recordPrefix = "\x01"; - $result = $this->_derive($recordPrefix . $splitted[0], $subKey); - return array_merge($result, ['isSub' => true, 'parent' => $parentKey, 'isSubRecord' => true]); - } elseif (count($splitted) >= 3) { - throw new SNSError(ErrorType::InvalidInput); - } - $result = $this->_derive($domain, ROOT_DOMAIN_ACCOUNT); - return array_merge($result, ['isSub' => false, 'parent' => null]); - } - - private function _derive( - string $name, - PublicKey $parent = ROOT_DOMAIN_ACCOUNT - ): array { - $hashed = $this->getHashedNameSync($name); - $pubkey = $this->getNameAccountKeySync($hashed, null, $parent); - return ['pubkey' => $pubkey, 'hashed' => $hashed]; - } - - /** - * This function can be used to get the key of the reverse account - * @deprecated Use {@link getReverseKeySync} instead - * @param string $domain The domain to compute the reverse for - * @param bool|null $isSub Whether the domain is a subdomain or not - * @return PublicKey The public key of the reverse account - */ - function getReverseKey(string $domain, ?bool $isSub = false): PublicKey - { - $domainKey = $this->getDomainKey($domain); - $hashedReverseLookup = $this->getHashedName($domainKey['pubkey']->toBase58()); - $reverseLookupAccount = $this->getNameAccountKey($hashedReverseLookup, REVERSE_LOOKUP_CLASS, $isSub ? $domainKey['parent'] : null); - return $reverseLookupAccount; - } -} diff --git a/src/Programs/SNS/Nft/Nft.php b/src/Programs/SNS/Nft/Nft.php deleted file mode 100644 index e69de29..0000000 diff --git a/src/Programs/SNS/Resolve.php b/src/Programs/SNS/Resolve.php deleted file mode 100644 index e69de29..0000000 diff --git a/src/Programs/SplSnsProgram.php b/src/Programs/SplSnsProgram.php deleted file mode 100644 index c4c153d..0000000 --- a/src/Programs/SplSnsProgram.php +++ /dev/null @@ -1,91 +0,0 @@ -publicKey), true, true), - // new AccountMeta(new PublicKey($this->publicKey), false, true), - // ], - // $subdomain - // ); - // } - - // public static function retrieve(Connection $connection, PublicKey $key, $accountType): self - // { - // $accountInfo = $connection->getAccountInfo($key); - // if (!$accountInfo || !$accountInfo['data']) { - // throw new \Exception("NFT record not found"); - // } - // $base64String = base64_decode($accountInfo['data']); - // $uint8Array = array_values(unpack('C*', $base64String)); - // return self::deserialize($uint8Array); - // } - - /** - * This function can be used to retrieve a NFT Record given a mint - * - * @param connection A solana RPC connection - * @param mint The mint of the NFT Record - * @returns - */ - public function getRecordFromMint(string $pubKey) - { - $magicOffsetNumber = 0; - - return $this->client->call('getProgramAccounts', [ - self::NAME_TOKENIZER_ID, - [ - 'encoding' => 'base64', - 'filters' => [ - [ - 'memcmp' => [ - 'bytes' => '3', - 'offset' => $magicOffsetNumber, - ], - ], - [ - 'memcmp' => [ - 'bytes' => $pubKey, - 'offset' => 1 + 1 + 32 + 32, - ], - ], - ], - ], - ]); - } - - - -} diff --git a/src/Programs/SplToken/Actions/SPLTokenActions.php b/src/Programs/SplToken/Actions/SPLTokenActions.php index feaa753..467ca19 100644 --- a/src/Programs/SplToken/Actions/SPLTokenActions.php +++ b/src/Programs/SplToken/Actions/SPLTokenActions.php @@ -3,9 +3,16 @@ namespace Attestto\SolanaPhpSdk\Programs\SplToken\Actions; use Attestto\SolanaPhpSdk\Connection; +use Attestto\SolanaPhpSdk\Exceptions\AccountNotFoundException; +use Attestto\SolanaPhpSdk\Exceptions\GenericException; +use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; +use Attestto\SolanaPhpSdk\Exceptions\InvalidIdResponseException; +use Attestto\SolanaPhpSdk\Exceptions\MethodNotFoundException; use Attestto\SolanaPhpSdk\Exceptions\TokenAccountNotFoundError; use Attestto\SolanaPhpSdk\Exceptions\TokenInvalidAccountOwnerError; use Attestto\SolanaPhpSdk\Exceptions\TokenInvalidMintError; +use Attestto\SolanaPhpSdk\Exceptions\TokenOwnerOffCurveError; +use Attestto\SolanaPhpSdk\Keypair; use Attestto\SolanaPhpSdk\PublicKey; use Attestto\SolanaPhpSdk\State\Account; use Attestto\SolanaPhpSdk\Transaction; @@ -13,42 +20,45 @@ use Attestto\SolanaPhpSdk\Util\ConfirmOptions; use Attestto\SolanaPhpSdk\Util\Signer; use Exception; +use Psr\Http\Client\ClientExceptionInterface; use function Attestto\SolanaPhpSdk\Programs\SplToken\getAccount; trait SPLTokenActions { /** * @param Connection $connection - * @param Signer $payer + * @param Signer|Keypair $payer * @param PublicKey $mint * @param PublicKey $owner - * @param false $allowOwnerOffCurve + * @param boolean $allowOwnerOffCurve * @param Commitment|null $commitment - * @param ConfirmOptions|null $confirmOptions - * @param $programId - * @param $associatedTokenProgramId + * @param ConfirmOptions $confirmOptions + * @param PublicKey $programId + * @param PublicKey $associatedTokenProgramId * @return mixed - * @throws Exception + * @throws AccountNotFoundException + * @throws ClientExceptionInterface + * @throws InputValidationException + * @throws TokenInvalidAccountOwnerError + * @throws TokenInvalidMintError + * @throws TokenOwnerOffCurveError + * @throws GenericException + * @throws InvalidIdResponseException + * @throws MethodNotFoundException + * @throws \SodiumException */ public function getOrCreateAssociatedTokenAccount( Connection $connection, - Signer $payer, + mixed $payer, PublicKey $mint, PublicKey $owner, - false $allowOwnerOffCurve = false, + bool $allowOwnerOffCurve = true, Commitment $commitment = null, ConfirmOptions $confirmOptions = null, - $programId = null, - $associatedTokenProgramId = null - ): mixed + PublicKey $programId = new PublicKey(self::TOKEN_PROGRAM_ID), + PublicKey $associatedTokenProgramId = new PublicKey(self::ASSOCIATED_TOKEN_PROGRAM_ID) + ): Account { - if (!$programId){ - $programId = $this->SOLANA_TOKEN_PROGRAM_ID; - } - if (!$associatedTokenProgramId){ - $associatedTokenProgramId = $this->SOLANA_TOKEN_PROGRAM_ID; - } - $associatedToken = $this->getAssociatedTokenAddressSync( $mint, @@ -57,16 +67,16 @@ public function getOrCreateAssociatedTokenAccount( $programId, $associatedTokenProgramId ); - + $ata = $associatedToken->toBase58(); try { $account = Account::getAccount($connection, $associatedToken, $commitment, $programId); } catch (Exception $error) { - if ($error instanceof TokenAccountNotFoundError || $error instanceof TokenInvalidAccountOwnerError) { + if ($error instanceof AccountNotFoundException || $error instanceof TokenInvalidAccountOwnerError) { try { $transaction = new Transaction(); $transaction->add( $this->createAssociatedTokenAccountInstruction( - $payer->publicKey, + $payer->getPublicKey(), $associatedToken, $owner, $mint, @@ -74,10 +84,13 @@ public function getOrCreateAssociatedTokenAccount( $associatedTokenProgramId ) ); - // TODO Send and confirm transaction - //sendAndConfirmTransaction($connection, $transaction, [$payer], $confirmOptions); + if (!$confirmOptions) $confirmOptions = new ConfirmOptions(); + $transaction->feePayer = $payer->getPublicKey(); + $txnHash = $connection->sendTransaction( $transaction, [$payer]); } catch (Exception $error) { // Ignore all errors + // Account Exists but is not funded + throw $error; } $account = Account::getAccount($connection, $associatedToken, $commitment, $programId); @@ -86,8 +99,12 @@ public function getOrCreateAssociatedTokenAccount( } } - if (!$account->mint->equals($mint)) throw new TokenInvalidMintError(); - if (!$account->owner->equals($owner)) throw new TokenInvalidAccountOwnerError(); + if ($account->mint != $mint) throw new TokenInvalidMintError( + $account->mint->toBase58() . ' != ' . $mint->toBase58() + ); + if ($account->owner != $owner) throw new TokenInvalidAccountOwnerError( + $account->owner->toBase58() . ' != ' . $owner->toBase58() + ); return $account; } diff --git a/src/Programs/SplTokenProgram.php b/src/Programs/SplTokenProgram.php index e6e9999..9e64446 100644 --- a/src/Programs/SplTokenProgram.php +++ b/src/Programs/SplTokenProgram.php @@ -2,30 +2,14 @@ namespace Attestto\SolanaPhpSdk\Programs; -use Attestto\SolanaPhpSdk\Connection; -use Attestto\SolanaPhpSdk\Exceptions\AccountNotFoundException; -use Attestto\SolanaPhpSdk\Exceptions\GenericException; + use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; -use Attestto\SolanaPhpSdk\Exceptions\InvalidIdResponseException; -use Attestto\SolanaPhpSdk\Exceptions\MethodNotFoundException; -use Attestto\SolanaPhpSdk\Exceptions\TokenAccountNotFoundError; -use Attestto\SolanaPhpSdk\Exceptions\TokenInvalidAccountOwnerError; -use Attestto\SolanaPhpSdk\Exceptions\TokenInvalidMintError; use Attestto\SolanaPhpSdk\Exceptions\TokenOwnerOffCurveError; -use Attestto\SolanaPhpSdk\Keypair; use Attestto\SolanaPhpSdk\Program; use Attestto\SolanaPhpSdk\Programs\SplToken\Actions\SPLTokenActions; use Attestto\SolanaPhpSdk\Programs\SplToken\Instructions\SPLTokenInstructions; use Attestto\SolanaPhpSdk\PublicKey; -use Attestto\SolanaPhpSdk\State\Account; -use Attestto\SolanaPhpSdk\Transaction; -use Attestto\SolanaPhpSdk\TransactionInstruction; -use Attestto\SolanaPhpSdk\Util\Buffer; -use Attestto\SolanaPhpSdk\Util\Commitment; -use Attestto\SolanaPhpSdk\Util\ConfirmOptions; -use Attestto\SolanaPhpSdk\Util\Signer; -use Exception; -use Psr\Http\Client\ClientExceptionInterface; + /** * @property $SOLANA_TOKEN_PROGRAM_ID @@ -89,89 +73,7 @@ public function getAssociatedTokenAddressSync( return $address[0]; } - /** - * @param Connection $connection - * @param Signer|Keypair $payer - * @param PublicKey $mint - * @param PublicKey $owner - * @param boolean $allowOwnerOffCurve - * @param Commitment|null $commitment - * @param ConfirmOptions $confirmOptions - * @param PublicKey $programId - * @param PublicKey $associatedTokenProgramId - * @return mixed - * @throws AccountNotFoundException - * @throws ClientExceptionInterface - * @throws InputValidationException - * @throws TokenInvalidAccountOwnerError - * @throws TokenInvalidMintError - * @throws TokenOwnerOffCurveError - * @throws GenericException - * @throws InvalidIdResponseException - * @throws MethodNotFoundException - * @throws \SodiumException - */ - public function getOrCreateAssociatedTokenAccount( - Connection $connection, - mixed $payer, - PublicKey $mint, - PublicKey $owner, - bool $allowOwnerOffCurve = true, - Commitment $commitment = null, - ConfirmOptions $confirmOptions = null, - PublicKey $programId = new PublicKey(self::TOKEN_PROGRAM_ID), - PublicKey $associatedTokenProgramId = new PublicKey(self::ASSOCIATED_TOKEN_PROGRAM_ID) - ): Account - { - - $associatedToken = $this->getAssociatedTokenAddressSync( - $mint, - $owner, - $allowOwnerOffCurve, - $programId, - $associatedTokenProgramId - ); - $ata = $associatedToken->toBase58(); - try { - $account = Account::getAccount($connection, $associatedToken, $commitment, $programId); - } catch (Exception $error) { - if ($error instanceof AccountNotFoundException || $error instanceof TokenInvalidAccountOwnerError) { - try { - $transaction = new Transaction(); - $transaction->add( - $this->createAssociatedTokenAccountInstruction( - $payer->getPublicKey(), - $associatedToken, - $owner, - $mint, - $programId, - $associatedTokenProgramId - ) - ); - if (!$confirmOptions) $confirmOptions = new ConfirmOptions(); - $transaction->feePayer = $payer->getPublicKey(); - $txnHash = $connection->sendTransaction( $transaction, [$payer]); - } catch (Exception $error) { - // Ignore all errors - // Account Exists but is not funded - throw $error; - } - - $account = Account::getAccount($connection, $associatedToken, $commitment, $programId); - } else { - throw $error; - } - } - if ($account->mint != $mint) throw new TokenInvalidMintError( - $account->mint->toBase58() . ' != ' . $mint->toBase58() - ); - if ($account->owner != $owner) throw new TokenInvalidAccountOwnerError( - $account->owner->toBase58() . ' != ' . $owner->toBase58() - ); - - return $account; - } } diff --git a/tests/Unit/Programs/SplProgramTest.php b/tests/Unit/Programs/SplProgramTest.php index bda5adb..290ccf7 100644 --- a/tests/Unit/Programs/SplProgramTest.php +++ b/tests/Unit/Programs/SplProgramTest.php @@ -13,7 +13,6 @@ use Attestto\SolanaPhpSdk\Tests\TestCase; use PHPUnit\Framework\Attributes\Test; use Attestto\SolanaPhpSdk\PublicKey; -use Attestto\SolanaPhpSdk\Util\Signer; use Attestto\SolanaPhpSdk\State\Account;