From 2373725318f0173834ccfa148d03e47e729d5504 Mon Sep 17 00:00:00 2001 From: Eduardo Chongkan Date: Wed, 8 May 2024 22:02:09 -0600 Subject: [PATCH 1/4] SNS Program WIP --- .gitignore | 3 + build/html-coverage/Account.php.html | 10 +- 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 +- .../Accounts/Sns/NtfRecordAccount.php.html | 2 +- .../html-coverage/Accounts/Sns/dashboard.html | 15 +- build/html-coverage/Accounts/Sns/index.html | 34 +- build/html-coverage/Accounts/dashboard.html | 15 +- build/html-coverage/Accounts/index.html | 32 +- .../html-coverage/Borsh/BinaryReader.php.html | 32 +- .../html-coverage/Borsh/BinaryWriter.php.html | 26 +- build/html-coverage/Borsh/Borsh.php.html | 50 +- .../Borsh/BorshDeserializable.php.html | 16 +- .../Borsh/BorshException.php.html | 2 +- .../html-coverage/Borsh/BorshObject.php.html | 2 +- .../Borsh/BorshSerializable.php.html | 6 +- build/html-coverage/Borsh/dashboard.html | 2 +- build/html-coverage/Borsh/index.html | 2 +- build/html-coverage/Connection.php.html | 98 ++- .../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 | 36 +- build/html-coverage/Message.php.html | 74 +- build/html-coverage/Program.php.html | 6 +- .../Programs/DidSolProgram.php.html | 2 +- .../Programs/MetaplexProgram.php.html | 2 +- .../html-coverage/Programs/SNS/Utils.php.html | 457 ++++++------ .../html-coverage/Programs/SNS/dashboard.html | 92 +-- build/html-coverage/Programs/SNS/index.html | 271 ++------ .../SplToken/Actions/SPLTokenActions.php.html | 205 +++--- .../Programs/SplToken/Actions/dashboard.html | 6 +- .../Programs/SplToken/Actions/index.html | 2 +- .../SPLTokenInstructions.php.html | 213 +++--- .../Instructions/TokenInstruction.php.html | 2 +- .../SplToken/Instructions/dashboard.html | 10 +- .../Programs/SplToken/Instructions/index.html | 2 +- .../Programs/SplToken/dashboard.html | 16 +- .../Programs/SplToken/index.html | 56 +- .../Programs/SplTokenProgram.php.html | 2 +- .../Programs/SystemProgram.php.html | 8 +- build/html-coverage/Programs/dashboard.html | 40 +- build/html-coverage/Programs/index.html | 102 ++- build/html-coverage/PublicKey.php.html | 193 +++--- build/html-coverage/SolanaRpcClient.php.html | 174 ++--- build/html-coverage/State/Account.php.html | 142 ++-- build/html-coverage/State/dashboard.html | 15 +- build/html-coverage/State/index.html | 64 +- build/html-coverage/State/mint.php.html | 2 +- build/html-coverage/Transaction.php.html | 240 +++---- .../TransactionInstruction.php.html | 8 +- build/html-coverage/Util/AccountMeta.php.html | 10 +- build/html-coverage/Util/Buffer.php.html | 653 ++++++++++-------- build/html-coverage/Util/Commitment.php.html | 2 +- .../Util/CompiledInstruction.php.html | 8 +- .../Util/ConfirmOptions.php.html | 2 +- .../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 | 26 +- build/html-coverage/Util/index.html | 34 +- build/html-coverage/dashboard.html | 74 +- build/html-coverage/index.html | 151 ++-- docs/SPL-Token-Program.md | 4 + docs/SplToken/SplTokenTest.php | 59 -- docs/Web3-js.md | 11 + src/Accounts/README.md | 1 + src/Accounts/Sns/NameRegistryStateAccount.php | 69 -- src/Connection.php | 22 + src/Interfaces/AccountKeyInterface.php | 11 - src/Programs/SNS/Bindings.php | 69 ++ .../Programs}/SNS/Constants/config.json | 0 .../Programs}/SNS/Constants/record.json | 0 .../SNS/Instructions}/Instructions.php | 141 ++-- .../SNS/State/NameRegistryStateAccount.php | 69 ++ .../Deprecated => src/Programs/SNS}/Utils.php | 40 +- src/Programs/SnsProgram.php | 40 ++ .../SplToken/Actions/SPLTokenActions.php | 3 +- .../Instructions/SPLTokenInstructions.php | 21 +- src/{ => Programs/SplToken}/State/Account.php | 2 +- src/{ => Programs/SplToken}/State/Mint.php | 2 +- src/PublicKey.php | 3 +- src/SolanaRpcClient.php | 2 + src/Transaction.php | 2 +- src/Util/Buffer.php | 37 +- temp/SNS/Constants/config.json | 92 +++ temp/SNS/Constants/record.json | 42 ++ {config => temp}/SNS/InstructionBurn.php | 2 +- .../SNS/InstructionRegisterFavorite.php | 2 +- {config => temp}/SNS/InstructionReverse.php | 2 +- {config => temp}/SNS/InstructionV2.php | 2 +- {config => temp}/SNS/InstructionV3.php | 2 +- {config => temp}/SNS/InstructionWithNft.php | 2 +- {config => temp}/SNS/Nft/NameTokenizer.php | 2 +- tests/.DS_Store | Bin 0 -> 6148 bytes tests/Unit/.DS_Store | Bin 6148 -> 6148 bytes tests/Unit/BufferTest.php | 28 +- tests/Unit/Programs/.DS_Store | Bin 0 -> 6148 bytes tests/Unit/Programs/MetaPlexProgramTest.php | 38 + tests/Unit/Programs/Sns/DerivationTest.php | 74 ++ tests/Unit/Programs/Sns/InstructionsTest.php | 163 +++++ .../Programs/Sns/NameRegistryStateTest.php | 68 ++ tests/Unit/Programs/SplProgramTest.php | 4 +- 127 files changed, 2757 insertions(+), 2217 deletions(-) create mode 100644 docs/SPL-Token-Program.md delete mode 100644 docs/SplToken/SplTokenTest.php create mode 100644 docs/Web3-js.md create mode 100644 src/Accounts/README.md delete mode 100644 src/Accounts/Sns/NameRegistryStateAccount.php delete mode 100644 src/Interfaces/AccountKeyInterface.php create mode 100644 src/Programs/SNS/Bindings.php rename {config => src/Programs}/SNS/Constants/config.json (100%) rename {config => src/Programs}/SNS/Constants/record.json (100%) rename {config/SNS => src/Programs/SNS/Instructions}/Instructions.php (73%) create mode 100644 src/Programs/SNS/State/NameRegistryStateAccount.php rename {config/SNS/Deprecated => src/Programs/SNS}/Utils.php (79%) create mode 100644 src/Programs/SnsProgram.php rename src/{ => Programs/SplToken}/State/Account.php (97%) rename src/{ => Programs/SplToken}/State/Mint.php (95%) create mode 100644 temp/SNS/Constants/config.json create mode 100644 temp/SNS/Constants/record.json rename {config => temp}/SNS/InstructionBurn.php (98%) rename {config => temp}/SNS/InstructionRegisterFavorite.php (98%) rename {config => temp}/SNS/InstructionReverse.php (98%) rename {config => temp}/SNS/InstructionV2.php (99%) rename {config => temp}/SNS/InstructionV3.php (99%) rename {config => temp}/SNS/InstructionWithNft.php (99%) rename {config => temp}/SNS/Nft/NameTokenizer.php (98%) create mode 100644 tests/.DS_Store create mode 100644 tests/Unit/Programs/.DS_Store create mode 100644 tests/Unit/Programs/MetaPlexProgramTest.php create mode 100644 tests/Unit/Programs/Sns/DerivationTest.php create mode 100644 tests/Unit/Programs/Sns/InstructionsTest.php create mode 100644 tests/Unit/Programs/Sns/NameRegistryStateTest.php diff --git a/.gitignore b/.gitignore index c32a2fa..580d676 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /vendor/ +/temp/ node_modules/ npm-debug.log yarn-error.log @@ -27,3 +28,5 @@ Homestead.json .phpunit.cache .run/ /.run/ +/build/ + diff --git a/build/html-coverage/Account.php.html b/build/html-coverage/Account.php.html index fceac93..9d95c4a 100644 --- a/build/html-coverage/Account.php.html +++ b/build/html-coverage/Account.php.html @@ -188,10 +188,10 @@ 15     */ 16    public function __construct($secretKey = null) 17    { - 18        if ($secretKey) { - 19            $secretKeyString = Buffer::from($secretKey)->toString(); + 18        if ($secretKey) { + 19            $secretKeyString = Buffer::from($secretKey)->toString(); 20 - 21            $this->keypair = Keypair::fromSecretKey($secretKeyString); + 21            $this->keypair = Keypair::fromSecretKey($secretKeyString); 22        } else { 23            $this->keypair = Keypair::generate(); 24        } @@ -202,7 +202,7 @@ 29     */ 30    public function getPublicKey(): PublicKey 31    { - 32        return $this->keypair->getPublicKey(); + 32        return $this->keypair->getPublicKey(); 33    } 34 35    /** @@ -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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Accounts/Creator.php.html b/build/html-coverage/Accounts/Creator.php.html index c4ee9a3..a27333c 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Accounts/Did/ServiceStruct.php.html b/build/html-coverage/Accounts/Did/ServiceStruct.php.html index ec6cc81..01b68a1 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Accounts/Did/VerificationMethodStruct.php.html b/build/html-coverage/Accounts/Did/VerificationMethodStruct.php.html index dc1a672..f80901f 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Accounts/Did/dashboard.html b/build/html-coverage/Accounts/Did/dashboard.html index 7560186..3ccecc9 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 a1c849e..489442a 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Accounts/DidData.php.html b/build/html-coverage/Accounts/DidData.php.html index 9eb9ca7..a7da7d6 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Accounts/Metadata.php.html b/build/html-coverage/Accounts/Metadata.php.html index d19601f..67fe61f 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Accounts/MetadataData.php.html b/build/html-coverage/Accounts/MetadataData.php.html index 05a89fe..cc57471 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Accounts/Sns/NtfRecordAccount.php.html b/build/html-coverage/Accounts/Sns/NtfRecordAccount.php.html index 2224f8c..e06c47a 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Accounts/Sns/dashboard.html b/build/html-coverage/Accounts/Sns/dashboard.html index c40d238..03b2fb5 100644 --- a/build/html-coverage/Accounts/Sns/dashboard.html +++ b/build/html-coverage/Accounts/Sns/dashboard.html @@ -59,7 +59,6 @@

Insufficient Coverage

-
Attestto\SolanaPhpSdk\Accounts\NameRegistryStateAccount0% Attestto\SolanaPhpSdk\Accounts\NtfRecordAccount0% @@ -78,7 +77,6 @@

Project Risks

Attestto\SolanaPhpSdk\Accounts\NtfRecordAccount30 - Attestto\SolanaPhpSdk\Accounts\NameRegistryStateAccount12 @@ -116,8 +114,6 @@

Insufficient Coverage

- retrieve0% - deserialize0% deserialize0% retrieve0% findKey0% @@ -138,7 +134,6 @@

Project Risks

retrieve12 - retrieve6 @@ -148,7 +143,7 @@

Project Risks

@@ -167,7 +162,7 @@

Project Risks

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

Project Risks

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

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[0,3,"Attestto\\SolanaPhpSdk\\Accounts\\NameRegistryStateAccount<\/a>"],[0,5,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[0,5,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -259,7 +254,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[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>"]], 'Method Complexity')) + .datum(getComplexityData([[0,1,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount::deserialize<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount::retrieve<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount::findKey<\/a>"]], 'Method Complexity')) .transition() .duration(500) .call(chart); diff --git a/build/html-coverage/Accounts/Sns/index.html b/build/html-coverage/Accounts/Sns/index.html index e6a7a6e..705e5e8 100644 --- a/build/html-coverage/Accounts/Sns/index.html +++ b/build/html-coverage/Accounts/Sns/index.html @@ -52,35 +52,7 @@
0.00%
-
0 / 20
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 5
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 2
- - - -
NameRegistryStateAccount.php -
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 9
+
0 / 11
0.00% covered (danger) @@ -88,7 +60,7 @@
0.00%
-
0 / 2
+
0 / 3
0.00% covered (danger) @@ -140,7 +112,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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Accounts/dashboard.html b/build/html-coverage/Accounts/dashboard.html index 750d672..dcf135f 100644 --- a/build/html-coverage/Accounts/dashboard.html +++ b/build/html-coverage/Accounts/dashboard.html @@ -58,7 +58,6 @@

Insufficient Coverage

- Attestto\SolanaPhpSdk\Accounts\NameRegistryStateAccount0% Attestto\SolanaPhpSdk\Accounts\NtfRecordAccount0% @@ -77,7 +76,6 @@

Project Risks

Attestto\SolanaPhpSdk\Accounts\NtfRecordAccount30 - Attestto\SolanaPhpSdk\Accounts\NameRegistryStateAccount12 @@ -115,8 +113,6 @@

Insufficient Coverage

- retrieve0% - deserialize0% deserialize0% retrieve0% findKey0% @@ -137,7 +133,6 @@

Project Risks

retrieve12 - retrieve6 @@ -147,7 +142,7 @@

Project Risks

@@ -166,7 +161,7 @@

Project Risks

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

Project Risks

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

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[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>"]], 'Class Complexity')) + .datum(getComplexityData([[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,5,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -258,7 +253,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[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>"]], 'Method Complexity')) + .datum(getComplexityData([[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,1,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount::deserialize<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount::retrieve<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Accounts\\NtfRecordAccount::findKey<\/a>"]], 'Method Complexity')) .transition() .duration(500) .call(chart); diff --git a/build/html-coverage/Accounts/index.html b/build/html-coverage/Accounts/index.html index 73d58ae..14effe6 100644 --- a/build/html-coverage/Accounts/index.html +++ b/build/html-coverage/Accounts/index.html @@ -45,29 +45,29 @@ Total
-
- 13.04% covered (danger) +
+ 21.43% covered (danger)
-
13.04%
-
3 / 23
+
21.43%
+
3 / 14
-
- 37.50% covered (danger) +
+ 50.00% covered (danger)
-
37.50%
-
3 / 8
+
50.00%
+
3 / 6
-
- 60.00% covered (warning) +
+ 75.00% covered (warning)
-
60.00%
-
3 / 5
+
75.00%
+
3 / 4
@@ -92,7 +92,7 @@
0.00%
-
0 / 20
+
0 / 11
0.00% covered (danger) @@ -100,7 +100,7 @@
0.00%
-
0 / 5
+
0 / 3
diff --git a/build/html-coverage/Borsh/BinaryReader.php.html b/build/html-coverage/Borsh/BinaryReader.php.html index 67d182c..8f36025 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    /** @@ -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    /** @@ -656,8 +656,8 @@ 130     */ 131    public function readString(): string 132    { - 133        $length = $this->readU32(); - 134        return $this->readBuffer($length); + 133        $length = $this->readU32(); + 134        return $this->readBuffer($length); 135    } 136 137    /** @@ -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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Borsh/BinaryWriter.php.html b/build/html-coverage/Borsh/BinaryWriter.php.html index b8faab2..ab83407 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    /** @@ -501,7 +501,7 @@ 41     */ 42    public function writeU32(int $value) 43    { - 44        return $this->writeBuffer(Buffer::from($value, Buffer::TYPE_INT, false)); + 44        return $this->writeBuffer(Buffer::from($value, Buffer::TYPE_INT, false)); 45    } 46 47    /** @@ -573,10 +573,10 @@ 113     */ 114    public function writeString(string $value) 115    { - 116        $valueBuffer = Buffer::from($value); - 117        $this->writeU32(sizeof($valueBuffer)); - 118        $this->writeBuffer($valueBuffer); - 119        return $this; + 116        $valueBuffer = Buffer::from($value); + 117        $this->writeU32(sizeof($valueBuffer)); + 118        $this->writeBuffer($valueBuffer); + 119        return $this; 120    } 121 122    /** @@ -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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Borsh/Borsh.php.html b/build/html-coverage/Borsh/Borsh.php.html index d9aed32..5b1eca9 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,9 +305,9 @@ 65        $fieldType, 66        BinaryWriter $writer 67    ) { - 68        if (is_string($fieldType)) { - 69            $writer->{'write' . ucfirst($fieldType)}($value); - 70        } elseif (is_array($fieldType) && isset($fieldType[0])) { // sequential array + 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]) { 73                    $sizeOf = sizeof($value); @@ -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,11 +409,11 @@ 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 + 176        if (is_array($fieldType) && isset($fieldType[0])) { // sequential array 177            if (is_int($fieldType[0])) { 178                return $reader->readFixedArray($fieldType[0]); 179            } elseif (sizeof($fieldType) === 2 && is_int($fieldType[1])) { @@ -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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Borsh/BorshDeserializable.php.html b/build/html-coverage/Borsh/BorshDeserializable.php.html index f0946ed..319fa0e 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,12 +242,12 @@ 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); @@ -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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Borsh/BorshException.php.html b/build/html-coverage/Borsh/BorshException.php.html index a25c6f3..fa284bb 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Borsh/BorshObject.php.html b/build/html-coverage/Borsh/BorshObject.php.html index adae088..0878c9e 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Borsh/BorshSerializable.php.html b/build/html-coverage/Borsh/BorshSerializable.php.html index 2deae34..6460b69 100644 --- a/build/html-coverage/Borsh/BorshSerializable.php.html +++ b/build/html-coverage/Borsh/BorshSerializable.php.html @@ -147,8 +147,8 @@ 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)) { - 21            return $this->fields[$name]; + 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 @@ -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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Borsh/dashboard.html b/build/html-coverage/Borsh/dashboard.html index 27535a0..ed4cafd 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 0026b4f..f1b2269 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Connection.php.html b/build/html-coverage/Connection.php.html index 38454dc..bf54f45 100644 --- a/build/html-coverage/Connection.php.html +++ b/build/html-coverage/Connection.php.html @@ -42,23 +42,23 @@ - Total -
-
- 92.31% covered (success) + Total +
+
+ 63.16% covered (warning)
-
92.31%
-
24 / 26
+
63.16%
+
24 / 38
-
- 77.78% covered (warning) +
+ 70.00% covered (warning)
-
77.78%
-
7 / 9
+
70.00%
+
7 / 10
CRAP
@@ -71,24 +71,24 @@ - Connection -
-
- 92.31% covered (success) + Connection +
+
+ 63.16% covered (warning)
-
92.31%
-
24 / 26
+
63.16%
+
24 / 38
-
- 77.78% covered (warning) +
+ 70.00% covered (warning)
-
77.78%
-
7 / 9
- 13.08 +
70.00%
+
7 / 10
+ 23.80
0.00% covered (danger) @@ -297,6 +297,28 @@ + +  getProgramAccounts +
+
+ 0.00% covered (danger) +
+
+ +
0.00%
+
0 / 12
+
+
+ 0.00% covered (danger) +
+
+ +
0.00%
+
0 / 1
+ 2 + + + @@ -329,13 +351,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) { + 29        if (! $accountResponse) { 30            throw new AccountNotFoundException("API Error: Account {$pubKey} not found."); 31        } 32 - 33        return $accountResponse; + 33        return $accountResponse; 34    } 35 36    /** @@ -454,8 +476,30 @@ 149        return $response = $this->client->call('requestAirdrop', $params ); 150 151    } - 152 - 153} + 152    // https://solana.com/docs/rpc/http/getprogramaccounts + 153    // https://sns.guide/domain-name/all-domains.html + 154    public function getProgramAccounts(string $programIdBs58, $dataSlice, $filters) + 155    { + 156        $params = [ + 157                $programIdBs58, + 158                [ + 159                    'dataSlice' => $dataSlice, + 160                    'filters' => $filters, + 161                    'dataSize' => 108, // 'dataSize' => 108 + 162                    'encoding' => 'base64', + 163                    'page' => 1, + 164                    'limit' => 1000 + 165 + 166                ], + 167 + 168 + 169        ]; + 170        return $this->client->call('getProgramAccounts', $params ); + 171        //return $this->client->call('getAssetsByOwner', $params ); + 172 + 173    } + 174 + 175} @@ -466,7 +510,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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Exceptions/AccountNotFoundException.php.html b/build/html-coverage/Exceptions/AccountNotFoundException.php.html index 8a7d928..83ec877 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Exceptions/BaseSolanaPhpSdkException.php.html b/build/html-coverage/Exceptions/BaseSolanaPhpSdkException.php.html index a9460f5..41707ba 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Exceptions/GenericException.php.html b/build/html-coverage/Exceptions/GenericException.php.html index be21933..42c230f 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Exceptions/InputValidationException.php.html b/build/html-coverage/Exceptions/InputValidationException.php.html index de02a19..d8872b1 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Exceptions/InvalidIdResponseException.php.html b/build/html-coverage/Exceptions/InvalidIdResponseException.php.html index 8f4efe3..f52163c 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Exceptions/MethodNotFoundException.php.html b/build/html-coverage/Exceptions/MethodNotFoundException.php.html index e584fd9..3eda931 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Exceptions/SNSError.php.html b/build/html-coverage/Exceptions/SNSError.php.html index 063cb6a..c667e9a 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TodoException.php.html b/build/html-coverage/Exceptions/TodoException.php.html index 6cccc9c..058bea9 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TokenAccountNotFoundError.php.html b/build/html-coverage/Exceptions/TokenAccountNotFoundError.php.html index 4864cea..7f3eab1 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TokenInvalidAccountOwnerError.php.html b/build/html-coverage/Exceptions/TokenInvalidAccountOwnerError.php.html index 9da2886..0e79054 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TokenInvalidMintError.php.html b/build/html-coverage/Exceptions/TokenInvalidMintError.php.html index b269191..bd0b533 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TokenOwnerOffCurveError.php.html b/build/html-coverage/Exceptions/TokenOwnerOffCurveError.php.html index 20d5417..a5453cd 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Exceptions/dashboard.html b/build/html-coverage/Exceptions/dashboard.html index 43091e3..5a90f3d 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 7ea3711..4df152e 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Interfaces/AccountKeyInterface.php.html b/build/html-coverage/Interfaces/AccountKeyInterface.php.html index 9a95475..eaeff67 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 1:49:12 UTC 2024.

diff --git a/build/html-coverage/Interfaces/dashboard.html b/build/html-coverage/Interfaces/dashboard.html index acbdfeb..50d8c29 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 071ef3e..0eb0153 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 1:49:12 UTC 2024.

diff --git a/build/html-coverage/Keypair.php.html b/build/html-coverage/Keypair.php.html index 3e4a4f5..5be021f 100644 --- a/build/html-coverage/Keypair.php.html +++ b/build/html-coverage/Keypair.php.html @@ -282,7 +282,7 @@ 21 22    public function __construct($publicKey = null, $secretKey = null) 23    { - 24        if ($publicKey == null && $secretKey == null) { + 24        if ($publicKey == null && $secretKey == null) { 25            $keypair = sodium_crypto_sign_keypair(); 26 27            $publicKey = sodium_crypto_sign_publickey($keypair); @@ -291,8 +291,8 @@ 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Message.php.html b/build/html-coverage/Message.php.html index dbfa189..83b713d 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Program.php.html b/build/html-coverage/Program.php.html index 7d4ab9f..4240620 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Programs/DidSolProgram.php.html b/build/html-coverage/Programs/DidSolProgram.php.html index d2c1e93..5c76311 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Programs/MetaplexProgram.php.html b/build/html-coverage/Programs/MetaplexProgram.php.html index 14136eb..8b5d564 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Programs/SNS/Utils.php.html b/build/html-coverage/Programs/SNS/Utils.php.html index c0f42e4..ec9d9bc 100644 --- a/build/html-coverage/Programs/SNS/Utils.php.html +++ b/build/html-coverage/Programs/SNS/Utils.php.html @@ -44,23 +44,23 @@ - Total -
-
- 0.00% covered (danger) + Total +
+
+ 66.67% covered (warning)
-
0.00%
-
0 / 58
+
66.67%
+
34 / 51
-
- 0.00% covered (danger) +
+ 42.86% covered (danger)
-
0.00%
-
0 / 8
+
42.86%
+
3 / 7
CRAP
@@ -73,24 +73,24 @@ - Utils -
-
- 0.00% covered (danger) + Utils +
+
+ 66.67% covered (warning)
-
0.00%
-
0 / 58
+
66.67%
+
34 / 51
-
- 0.00% covered (danger) +
+ 42.86% covered (danger)
-
0.00%
-
0 / 8
- 506 +
42.86%
+
3 / 7
+ 34.81
0.00% covered (danger) @@ -102,81 +102,59 @@ -  __construct -
-
- 0.00% covered (danger) +  loadConstants +
+
+ 100.00% covered (success)
-
0.00%
-
0 / 8
-
-
- 0.00% covered (danger) +
100.00%
+
2 / 2
+
+
+ 100.00% covered (success)
-
0.00%
-
0 / 1
- 6 - +
100.00%
+
1 / 1
+ 1 + -  loadConstants -
-
- 0.00% covered (danger) +  getHashedNameSync +
+
+ 100.00% covered (success)
-
0.00%
-
0 / 2
-
-
- 0.00% covered (danger) +
100.00%
+
3 / 3
+
+
+ 100.00% covered (success)
-
0.00%
-
0 / 1
- 2 - +
100.00%
+
1 / 1
+ 1 + -  getHashedNameSync -
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 3
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 1
- 2 - - - - -  getNameAccountKeySync -
-
- 0.00% covered (danger) +  getNameAccountKeySync +
+
+ 92.31% covered (success)
-
0.00%
-
0 / 12
+
92.31%
+
12 / 13
0.00% covered (danger) @@ -185,12 +163,12 @@
0.00%
0 / 1
- 12 + 3.00 -  reverseLookup +  reverseLookup
0.00% covered (danger) @@ -212,7 +190,7 @@ -  deserializeReverse +  deserializeReverse
0.00% covered (danger) @@ -234,15 +212,15 @@ -  getDomainKeySync -
-
- 0.00% covered (danger) +  getDomainKeySync +
+
+ 70.00% covered (warning)
-
0.00%
-
0 / 20
+
70.00%
+
14 / 20
0.00% covered (danger) @@ -251,30 +229,30 @@
0.00%
0 / 1
- 90 + 11.19 -  _deriveSync -
-
- 0.00% covered (danger) +  _deriveSync +
+
+ 100.00% covered (success)
-
0.00%
-
0 / 3
-
-
- 0.00% covered (danger) +
100.00%
+
3 / 3
+
+
+ 100.00% covered (success)
-
0.00%
-
0 / 1
- 6 - +
100.00%
+
1 / 1
+ 2 + @@ -287,157 +265,142 @@ 2 3namespace Attestto\SolanaPhpSdk\Programs\SNS; 4 - 5use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; - 6use Attestto\SolanaPhpSdk\PublicKey; - 7use Attestto\SolanaPhpSdk\Connection; - 8use Attestto\SolanaPhpSdk\Exceptions\GenericException; - 9use Attestto\SolanaPhpSdk\Accounts\NameRegistryStateAccount; - 10use Attestto\SolanaPhpSdk\Exceptions\SNSError; - 11use Attestto\SolanaPhpSdk\Util\Buffer; - 12 - 13class Utils - 14{ - 15 - 16    // config.json file should be in the same directory as this file - 17    public mixed $config; - 18    public $centralStateSNSRecords; - 19     - 20 - 21    // Constructor - 22    public function __construct($config = null) + 5use Attestto\SolanaPhpSdk\Accounts\NameRegistryStateAccount; + 6use Attestto\SolanaPhpSdk\Connection; + 7use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; + 8use Attestto\SolanaPhpSdk\Exceptions\SNSError; + 9use Attestto\SolanaPhpSdk\PublicKey; + 10use Attestto\SolanaPhpSdk\Util\Buffer; + 11 + 12trait Utils + 13{ + 14 + 15    // config.json file should be in the same directory as this file + 16    public mixed $config; + 17    public $centralStateSNSRecords; + 18 + 19 + 20    // Constructor + 21 + 22    private function loadConstants() 23    { - 24        if ($config) { - 25            $this->config = $config; - 26        } else { - 27            $this->config = $this->loadConstants(); - 28        } - 29        $sns_records_id = new PublicKey($this->config['BONFIDA_SNS_RECORDS_ID']); - 30 - 31        $this->centralStateSNSRecords = PublicKey::findProgramAddressSync( - 32            [$sns_records_id], - 33             $sns_records_id); + 24        $jsonFilePath = dirname(__DIR__) . '/SNS/Constants/config.json'; + 25        return json_decode(file_get_contents($jsonFilePath), true); + 26    } + 27 + 28    public function getHashedNameSync(string $name): Buffer + 29    { + 30        $input = $this->config['HASH_PREFIX'] . $name; + 31        $hashed = hash('sha256', Buffer::from($input), true); + 32        return Buffer::from($hashed); + 33    } 34 - 35        return $this; - 36    } - 37 - 38    private function loadConstants() - 39    { - 40        $jsonFilePath = dirname(__DIR__) . '/SNS/Constants/config.json'; - 41        return json_decode(file_get_contents($jsonFilePath), true); - 42    } - 43 - 44    public function getHashedNameSync(string $name): Buffer - 45    { - 46        $input = $this->config['HASH_PREFIX'] . $name; - 47        $hashed = hash('sha256', Buffer::from($input)); - 48        return Buffer::from($hashed); - 49    } - 50 - 51    /** - 52     * @param Buffer $hashed_name - 53     * @param PublicKey|null $nameClass The name class public key - 54     * @param PublicKey|null $nameParent The name parent public key - 55     * @return PublicKey The public key of the name account - 56     * @throws InputValidationException - 57     * @deprecated Use {@link getNameAccountKeySync} instead - 58     */ - 59    public function getNameAccountKeySync( - 60        Buffer $hashed_name, - 61        PublicKey $nameClass = null, - 62        PublicKey $nameParent = null - 63    ): PublicKey { - 64        $seeds = [$hashed_name]; - 65        if ($nameClass) { - 66            $seeds[] = $nameClass->toBuffer(); - 67        } else { - 68            $seeds[] = str_repeat("\0", 32); - 69        } - 70        if ($nameParent) { - 71            $seeds[] = $nameParent->toBuffer(); - 72        } else { - 73            $seeds[] = str_repeat("\0", 32); - 74        } - 75        [$nameAccountKey] = PublicKey::findProgramAddressSync( - 76            $seeds, - 77            new PublicKey($this->config['NAME_PROGRAM_ID']) - 78        ); - 79        return $nameAccountKey; - 80    } - 81 - 82 - 83    /** - 84     * This function can be used to perform a reverse look up - 85     * @param connection The Solana RPC connection - 86     * @param nameAccount The public key of the domain to look up - 87     * @returns The human readable domain name - 88     */ - 89    public function reverseLookup(Connection $connection, PublicKey $nameAccount): string - 90    { - 91        $hashedReverseLookup = $this->getHashedNameSync($nameAccount->toBase58()); - 92        $reverseLookupAccount = $this->getNameAccountKeySync($hashedReverseLookup, $this->config->REVERSE_LOOKUP_CLASS); - 93 - 94        $registry = NameRegistryStateAccount::retrieve($connection, $reverseLookupAccount); - 95        if (!$registry['data']) { - 96            throw new SNSError(SNSError::NoAccountData); - 97        } - 98 - 99        return $this->deserializeReverse($registry['data']); - 100    } - 101 - 102    public function deserializeReverse( - 103        $data - 104    ): ?string { - 105        if (!$data) { - 106            return null; + 35    /** + 36     * @param Buffer $hashed_name + 37     * @param PublicKey|null $nameClass The name class public key + 38     * @param PublicKey|null $nameParent The name parent public key + 39     * @return PublicKey The public key of the name account + 40     * @throws InputValidationException + 41     * + 42     */ + 43    public function getNameAccountKeySync( + 44        Buffer $hashed_name, + 45        PublicKey $nameClass = null, + 46        PublicKey $nameParent = null + 47    ): PublicKey { + 48        $seeds = [$hashed_name]; + 49        $programIdPublicKey = new PublicKey($this->config['NAME_PROGRAM_ID']); + 50        if ($nameClass) { + 51            $seeds[] = $nameClass->toBuffer(); + 52        } else { + 53            $seeds[] = Buffer::alloc(32); + 54        } + 55        if ($nameParent) { + 56            $seeds[] = $nameParent->toBuffer(); + 57        } else { + 58            $seeds[] = Buffer::alloc(32); + 59        } + 60        [$nameAccountKey] = PublicKey::findProgramAddressSync( + 61            $seeds, + 62            $programIdPublicKey + 63        ); + 64        return $nameAccountKey; + 65    } + 66 + 67 + 68    /** + 69     * This function can be used to perform a reverse look up + 70     * @param connection The Solana RPC connection + 71     * @param nameAccount The public key of the domain to look up + 72     * @returns The human readable domain name + 73     */ + 74    public function reverseLookup(Connection $connection, PublicKey $nameAccount): string + 75    { + 76        $hashedReverseLookup = $this->getHashedNameSync($nameAccount->toBase58()); + 77        $reverseLookupAccount = $this->getNameAccountKeySync($hashedReverseLookup, $this->config->REVERSE_LOOKUP_CLASS); + 78 + 79        $registry = NameRegistryStateAccount::retrieve($connection, $reverseLookupAccount); + 80        if (!$registry['data']) { + 81            throw new SNSError(SNSError::NoAccountData); + 82        } + 83 + 84        return $this->deserializeReverse($registry['data']); + 85    } + 86 + 87    public function deserializeReverse( + 88        $data + 89    ): ?string { + 90        if (!$data) { + 91            return null; + 92        } + 93        $nameLength = unpack('V', substr($data, 0, 4))[1]; + 94        return substr($data, 4, $nameLength); + 95    } + 96 + 97 + 98    /** + 99     * This function can be used to compute the public key of a domain or subdomain + 100     * @param string $domain The domain to compute the public key for (e.g `bonfida.sol`, `dex.bonfida.sol`) + 101     * @param string|null $record Optional parameter: If the domain being resolved is a record + 102     * @return array + 103     */ + 104    function getDomainKeySync(string $domain, ?string $record = null): array { + 105        if (substr($domain, -4) === ".sol") { + 106            $domain = substr($domain, 0, -4); 107        } - 108        $nameLength = unpack('V', substr($data, 0, 4))[1]; - 109        return substr($data, 4, $nameLength); - 110    } - 111 - 112 - 113    /** - 114     * This function can be used to compute the public key of a domain or subdomain - 115     * @param string $domain The domain to compute the public key for (e.g `bonfida.sol`, `dex.bonfida.sol`) - 116     * @param string|null $record Optional parameter: If the domain being resolved is a record - 117     * @return array - 118     */ - 119    function getDomainKeySync(string $domain, ?string $record = null): array { - 120        if (substr($domain, -4) === ".sol") { - 121            $domain = substr($domain, 0, -4); - 122        } - 123        $recordClass = $record === 'V2' ? $this->centralStateSNSRecords : null; - 124        $splitted = explode(".", $domain); - 125        if (count($splitted) === 2) { - 126            $prefix = $record ? $record : "\x00"; - 127            $sub = $prefix . $splitted[0]; - 128            $parentKey = $this->_deriveSync($splitted[1])['pubkey']; - 129            $result = $this->_deriveSync($sub, new PublicKey($parentKey), new PublicKey($recordClass)); - 130            return array_merge($result, ['isSub' => true, 'parent' => $parentKey]); - 131        } else if (count($splitted) === 3 && $record) { - 132            // Parent key - 133            $parentKey = $this->_deriveSync($splitted[2])['pubkey']; - 134            // Sub domain - 135            $subKey = $this->_deriveSync("\0" . $splitted[1], new PublicKey($parentKey))['pubkey']; - 136            // Sub record - 137            $recordPrefix = $record === 'V2' ? "\x02" : "\x01"; - 138            $result = $this->_deriveSync($recordPrefix . $splitted[0], new PublicKey($subKey), new PublicKey($recordClass)); - 139            return array_merge($result, ['isSub' => true, 'parent' => $parentKey, 'isSubRecord' => true]); - 140        } else if (count($splitted) >= 3) { - 141            throw new SNSError(SNSError::InvalidInput); - 142        } - 143        $result = $this->_deriveSync($domain, new PublicKey($this->config['ROOT_DOMAIN_ACCOUNT'])); - 144        return array_merge($result, ['isSub' => false, 'parent' => null]); - 145    } - 146 - 147    function _deriveSync(string $name, PublicKey $parent = null, PublicKey $classKey = null): array - 148    { - 149        // Assuming these functions exist elsewhere in your codebase - 150        $hashedDomainName = $this->getHashedNameSync($name); - 151        $pubkey = $this->getNameAccountKeySync($hashedDomainName, $classKey, $parent ?: new PublicKey($this->config['ROOT_DOMAIN_ACCOUNT'])); - 152        return ['pubkey' => $pubkey, 'hashed' => $hashed]; - 153    } - 154 - 155} + 108        $recordClass = $record === 'V2' ? $this->centralStateSNSRecords : null; + 109        $splitted = explode(".", $domain); + 110        if (count($splitted) === 2) { + 111            $prefix = $record ? $record : "\x00"; + 112            $sub = $prefix . $splitted[0]; + 113            $parentKey = $this->_deriveSync($splitted[1])['pubkey']; + 114            $result = $this->_deriveSync($sub, $parentKey, $recordClass); + 115            return array_merge($result, ['isSub' => true, 'parent' => $parentKey]); + 116        } else if (count($splitted) === 3 && $record) { + 117            // Parent key + 118            $parentKey = $this->_deriveSync($splitted[2])['pubkey']; + 119            // Sub domain + 120            $subKey = $this->_deriveSync("\0" . $splitted[1], new PublicKey($parentKey))['pubkey']; + 121            // Sub record + 122            $recordPrefix = $record === 'V2' ? "\x02" : "\x01"; + 123            $result = $this->_deriveSync($recordPrefix . $splitted[0], new PublicKey($subKey), new PublicKey($recordClass)); + 124            return array_merge($result, ['isSub' => true, 'parent' => $parentKey, 'isSubRecord' => true]); + 125        } else if (count($splitted) >= 3) { + 126            throw new SNSError(SNSError::InvalidInput); + 127        } + 128        $result = $this->_deriveSync($domain, new PublicKey($this->config['ROOT_DOMAIN_ACCOUNT'])); + 129        return array_merge($result, ['isSub' => false, 'parent' => null]); + 130    } + 131 + 132    function _deriveSync(string $name, PublicKey $parent = null, PublicKey $classKey = null): array + 133    { + 134        // Assuming these functions exist elsewhere in your codebase + 135        $hashedDomainName = $this->getHashedNameSync($name); + 136        $pubkey = $this->getNameAccountKeySync($hashedDomainName, $classKey, $parent ?: new PublicKey($this->config['ROOT_DOMAIN_ACCOUNT'])); + 137        return ['pubkey' => $pubkey, 'hashed' => $hashedDomainName]; + 138    } + 139 + 140} @@ -448,7 +411,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 Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Programs/SNS/dashboard.html b/build/html-coverage/Programs/SNS/dashboard.html index 10ea77c..33cbd68 100644 --- a/build/html-coverage/Programs/SNS/dashboard.html +++ b/build/html-coverage/Programs/SNS/dashboard.html @@ -59,15 +59,9 @@

Insufficient Coverage

-
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\SNS\Bindings0% + Attestto\SolanaPhpSdk\Programs\SNS\Utils66% + Attestto\SolanaPhpSdk\Programs\SNS\Instructions\Instructions85% @@ -84,11 +78,9 @@

Project Risks

- Attestto\SolanaPhpSdk\Programs\SNS\Utils506 - Attestto\SolanaPhpSdk\Programs\SNS\SnsInstruction182 - Attestto\SolanaPhpSdk\Programs\SNS\NftRecord72 - Attestto\SolanaPhpSdk\Programs\CreateReverseInstruction30 - CreateInstructionV320 + Attestto\SolanaPhpSdk\Programs\SNS\Utils34 + Attestto\SolanaPhpSdk\Programs\SNS\Instructions\Instructions13 + Attestto\SolanaPhpSdk\Programs\SNS\Bindings12 @@ -126,43 +118,13 @@

Insufficient Coverage

- __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% + createSubdomain0% + reverseLookup0% + deserializeReverse0% + transferInstruction60% + getDomainKeySync70% + createInstruction84% + retrieve88% @@ -179,17 +141,13 @@

Project Risks

- getDomainKeySync90 - transferInstruction42 - createInstruction20 - getNameAccountKeySync12 - getInstruction12 - retrieve12 - __construct6 - reverseLookup6 - deserializeReverse6 - _deriveSync6 - getInstruction6 + createSubdomain12 + getDomainKeySync11 + transferInstruction8 + reverseLookup6 + deserializeReverse6 + createInstruction4 + retrieve2 @@ -199,7 +157,7 @@

Project Risks

@@ -218,7 +176,7 @@

Project Risks

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

Project Risks

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

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[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>"]], 'Class Complexity')) + .datum(getComplexityData([[90,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings<\/a>"],[85.94594594594595,13,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions<\/a>"],[66.66666666666666,20,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -310,7 +268,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[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>"]], 'Method Complexity')) + .datum(getComplexityData([[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::retrieve<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::deserialize<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createSubdomain<\/a>"],[84.12698412698413,4,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::createInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::updateInstruction<\/a>"],[60,6,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::transferInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::reallocInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::deleteInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::loadConstants<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getHashedNameSync<\/a>"],[92.3076923076923,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>"],[70,9,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getDomainKeySync<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::_deriveSync<\/a>"]], 'Method Complexity')) .transition() .duration(500) .call(chart); diff --git a/build/html-coverage/Programs/SNS/index.html b/build/html-coverage/Programs/SNS/index.html index d5a55ae..525607a 100644 --- a/build/html-coverage/Programs/SNS/index.html +++ b/build/html-coverage/Programs/SNS/index.html @@ -44,79 +44,23 @@ - Total -
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 732
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 46
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 10
- - - -
Deprecated -
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 54
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 9
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 1
- - - - Nft -
-
- 0.00% covered (danger) + Total +
+
+ 72.40% covered (warning)
-
0.00%
-
0 / 33
+
72.40%
+
202 / 279
-
- 0.00% covered (danger) +
+ 46.67% covered (danger)
-
0.00%
-
0 / 6
+
46.67%
+
7 / 15
0.00% covered (danger) @@ -124,27 +68,27 @@
0.00%
-
0 / 1
+
0 / 4
- InstructionBurn.php -
-
- 0.00% covered (danger) + Instructions +
+
+ 85.95% covered (warning)
-
0.00%
-
0 / 56
-
-
- 0.00% covered (danger) +
85.95%
+
159 / 185
+
+
+ 60.00% covered (warning)
-
0.00%
-
0 / 3
+
60.00%
+
3 / 5
0.00% covered (danger) @@ -156,23 +100,23 @@ - InstructionRegisterFavorite.php -
-
- 0.00% covered (danger) + State +
+
+ 90.00% covered (success)
-
0.00%
-
0 / 30
+
90.00%
+
9 / 10
-
- 0.00% covered (danger) +
+ 50.00% covered (danger)
-
0.00%
-
0 / 3
+
50.00%
+
1 / 2
0.00% covered (danger) @@ -184,15 +128,7 @@ - InstructionReverse.php -
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 58
+ Bindings.php
0.00% covered (danger) @@ -200,91 +136,7 @@
0.00%
-
0 / 3
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 1
- - - - InstructionV2.php -
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 72
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 3
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 1
- - - - InstructionV3.php -
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 94
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 3
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 1
- - - - InstructionWithNft.php -
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 92
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 3
+
0 / 33
0.00% covered (danger) @@ -293,26 +145,6 @@
0.00%
0 / 1
- - - - Instructions.php -
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 185
-
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 5
0.00% covered (danger) @@ -324,36 +156,23 @@ - Resolve.php - -
n/a
-
0 / 0
- -
n/a
-
0 / 0
- -
n/a
-
0 / 0
- - - - Utils.php -
-
- 0.00% covered (danger) + Utils.php +
+
+ 66.67% covered (warning)
-
0.00%
-
0 / 58
+
66.67%
+
34 / 51
-
- 0.00% covered (danger) +
+ 42.86% covered (danger)
-
0.00%
-
0 / 8
+
42.86%
+
3 / 7
0.00% covered (danger) @@ -377,7 +196,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 Thu May 9 3:59:51 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 2341d96..785915c 100644 --- a/build/html-coverage/Programs/SplToken/Actions/SPLTokenActions.php.html +++ b/build/html-coverage/Programs/SplToken/Actions/SPLTokenActions.php.html @@ -103,7 +103,7 @@ -  getOrCreateAssociatedTokenAccount +  getOrCreateAssociatedTokenAccount
94.44% covered (success) @@ -140,112 +140,111 @@ 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; + 11use Attestto\SolanaPhpSdk\Exceptions\TokenInvalidAccountOwnerError; + 12use Attestto\SolanaPhpSdk\Exceptions\TokenInvalidMintError; + 13use Attestto\SolanaPhpSdk\Exceptions\TokenOwnerOffCurveError; + 14use Attestto\SolanaPhpSdk\Keypair; + 15use Attestto\SolanaPhpSdk\Programs\SplToken\State\Account; 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                $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    } + 17use Attestto\SolanaPhpSdk\Transaction; + 18use Attestto\SolanaPhpSdk\Util\Commitment; + 19use Attestto\SolanaPhpSdk\Util\ConfirmOptions; + 20use Attestto\SolanaPhpSdk\Util\Signer; + 21use Exception; + 22use Psr\Http\Client\ClientExceptionInterface; + 23use function Attestto\SolanaPhpSdk\Programs\SplToken\getAccount; + 24 + 25trait SPLTokenActions { + 26 + 27    /** + 28     * @param Connection $connection + 29     * @param Signer|Keypair $payer + 30     * @param PublicKey $mint + 31     * @param PublicKey $owner + 32     * @param boolean $allowOwnerOffCurve + 33     * @param Commitment|null $commitment + 34     * @param ConfirmOptions $confirmOptions + 35     * @param PublicKey $programId + 36     * @param PublicKey $associatedTokenProgramId + 37     * @return mixed + 38     * @throws AccountNotFoundException + 39     * @throws ClientExceptionInterface + 40     * @throws InputValidationException + 41     * @throws TokenInvalidAccountOwnerError + 42     * @throws TokenInvalidMintError + 43     * @throws TokenOwnerOffCurveError + 44     * @throws GenericException + 45     * @throws InvalidIdResponseException + 46     * @throws MethodNotFoundException + 47     * @throws \SodiumException + 48     */ + 49    public function getOrCreateAssociatedTokenAccount( + 50        Connection     $connection, + 51        mixed          $payer, + 52        PublicKey      $mint, + 53        PublicKey      $owner, + 54        bool           $allowOwnerOffCurve = true, + 55        Commitment     $commitment = null, + 56        ConfirmOptions $confirmOptions = null, + 57        PublicKey      $programId = new PublicKey(self::TOKEN_PROGRAM_ID), + 58        PublicKey      $associatedTokenProgramId = new PublicKey(self::ASSOCIATED_TOKEN_PROGRAM_ID) + 59    ): Account + 60    { + 61 + 62        $associatedToken = $this->getAssociatedTokenAddressSync( + 63            $mint, + 64            $owner, + 65            $allowOwnerOffCurve, + 66            $programId, + 67            $associatedTokenProgramId + 68        ); + 69        $ata = $associatedToken->toBase58(); + 70        try { + 71            $account = Account::getAccount($connection, $associatedToken, $commitment, $programId); + 72        } catch (Exception $error) { + 73            if ($error instanceof AccountNotFoundException || $error instanceof TokenInvalidAccountOwnerError) { + 74                try { + 75                    $transaction = new Transaction(); + 76                    $transaction->add( + 77                        $this->createAssociatedTokenAccountInstruction( + 78                            $payer->getPublicKey(), + 79                            $associatedToken, + 80                            $owner, + 81                            $mint, + 82                            $programId, + 83                            $associatedTokenProgramId + 84                        ) + 85                    ); + 86                    if (!$confirmOptions) $confirmOptions = new ConfirmOptions(); + 87                    $transaction->feePayer = $payer->getPublicKey(); + 88                    $txnHash = $connection->sendTransaction( $transaction, [$payer]); + 89                } catch (Exception $error) { + 90                    // Ignore all errors + 91                    // Account Exists but is not funded + 92                    throw $error; + 93                } + 94 + 95                $account = Account::getAccount($connection, $associatedToken, $commitment, $programId); + 96            } else { + 97                throw $error; + 98            } + 99        } + 100 + 101        if ($account->mint != $mint) throw new TokenInvalidMintError( + 102            $account->mint->toBase58() . ' != ' . $mint->toBase58() + 103        ); + 104        if ($account->owner != $owner) throw new TokenInvalidAccountOwnerError( + 105            $account->owner->toBase58() . ' != ' . $owner->toBase58() + 106        ); + 107 + 108        return $account; + 109    } + 110 111 112 113 114 - 115 - 116} + 115} @@ -256,7 +255,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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

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

Project Risks

@@ -225,7 +225,7 @@

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[94.44444444444444,8,"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); @@ -249,7 +249,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[94.44444444444444,8,"
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 6d46c3c..792df00 100644 --- a/build/html-coverage/Programs/SplToken/Actions/index.html +++ b/build/html-coverage/Programs/SplToken/Actions/index.html @@ -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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 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 9bbb0a2..09ad088 100644 --- a/build/html-coverage/Programs/SplToken/Instructions/SPLTokenInstructions.php.html +++ b/build/html-coverage/Programs/SplToken/Instructions/SPLTokenInstructions.php.html @@ -103,7 +103,7 @@ -  createAssociatedTokenAccountInstruction +  createAssociatedTokenAccountInstruction
84.62% covered (warning) @@ -125,7 +125,7 @@ -  buildAssociatedTokenAccountInstruction +  buildAssociatedTokenAccountInstruction
100.00% covered (success) @@ -147,7 +147,7 @@ -  createSyncNativeInstruction +  createSyncNativeInstruction
100.00% covered (success) @@ -179,110 +179,107 @@ 3namespace Attestto\SolanaPhpSdk\Programs\SplToken\Instructions; 4 5use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; - 6use Attestto\SolanaPhpSdk\Programs\SplTokenProgram; - 7use Attestto\SolanaPhpSdk\Programs\SystemProgram; - 8use Attestto\SolanaPhpSdk\PublicKey; - 9use Attestto\SolanaPhpSdk\TransactionInstruction; - 10use Attestto\SolanaPhpSdk\Util\AccountMeta; - 11use Attestto\SolanaPhpSdk\Util\Buffer; - 12use Attestto\SolanaPhpSdk\Programs\SplToken\Instructions\TokenInstruction; - 13 - 14trait SPLTokenInstructions - 15{ - 16 - 17    /** - 18     * @param PublicKey $payer - 19     * @param PublicKey $associatedToken - 20     * @param PublicKey $owner - 21     * @param PublicKey $mint - 22     * @param null $programId - 23     * @param null $associatedTokenProgramId - 24     * @return TransactionInstruction - 25     * @throws InputValidationException - 26     */ - 27    public function createAssociatedTokenAccountInstruction( - 28        PublicKey $payer, - 29        PublicKey $associatedToken, - 30        PublicKey $owner, - 31        PublicKey $mint, - 32                  $programId = null, - 33                  $associatedTokenProgramId = null - 34    ): TransactionInstruction - 35    { - 36        if (!$programId) { - 37            $programId = $this->SOLANA_TOKEN_PROGRAM_ID; - 38        } - 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        ); - 52    } - 53 - 54    /** - 55     * @param PublicKey $payer - 56     * @param PublicKey $associatedToken - 57     * @param PublicKey $owner - 58     * @param PublicKey $mint - 59     * @param Buffer $instructionData - 60     * @param string|null $programId - 61     * @param string|null $associatedTokenProgramId - 62     * @return TransactionInstruction - 63     */ - 64    public function buildAssociatedTokenAccountInstruction( - 65        PublicKey $payer, - 66        PublicKey $associatedToken, - 67        PublicKey $owner, - 68        PublicKey $mint, - 69        Buffer    $instructionData, - 70                  $programId = new PublicKey(self::TOKEN_PROGRAM_ID), - 71                  $associatedTokenProgramId = new PublicKey(self::ASSOCIATED_TOKEN_PROGRAM_ID) - 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        ]; - 83 - 84 - 85        return new TransactionInstruction( - 86            $associatedTokenProgramId, - 87            $keys, - 88            $instructionData - 89        ); - 90    } - 91 - 92 - 93    /** - 94     * @throws InputValidationException - 95     */ - 96    function createSyncNativeInstruction(PublicKey $owner, string $programId = self::TOKEN_PROGRAM_ID): TransactionInstruction - 97    { - 98 - 99        $keys = [ - 100            new AccountMeta($owner, false, true), - 101        ]; - 102        $data = str_repeat("\0", TokenInstruction::SyncNative); - 103        return new TransactionInstruction( - 104            new PublicKey($programId), - 105            $keys, - 106            $data - 107        ); - 108    } - 109} + 6use Attestto\SolanaPhpSdk\Programs\SystemProgram; + 7use Attestto\SolanaPhpSdk\PublicKey; + 8use Attestto\SolanaPhpSdk\TransactionInstruction; + 9use Attestto\SolanaPhpSdk\Util\AccountMeta; + 10use Attestto\SolanaPhpSdk\Util\Buffer; + 11 + 12trait SPLTokenInstructions + 13{ + 14 + 15    /** + 16     * @param PublicKey $payer + 17     * @param PublicKey $associatedToken + 18     * @param PublicKey $owner + 19     * @param PublicKey $mint + 20     * @param null $programId + 21     * @param null $associatedTokenProgramId + 22     * @return TransactionInstruction + 23     * @throws InputValidationException + 24     */ + 25    public function createAssociatedTokenAccountInstruction( + 26        PublicKey $payer, + 27        PublicKey $associatedToken, + 28        PublicKey $owner, + 29        PublicKey $mint, + 30                  $programId = null, + 31                  $associatedTokenProgramId = null + 32    ): TransactionInstruction + 33    { + 34        if (!$programId) { + 35            $programId = $this->SOLANA_TOKEN_PROGRAM_ID; + 36        } + 37        if (!$associatedTokenProgramId) { + 38            $associatedTokenProgramId = $this->SOLANA_TOKEN_PROGRAM_ID; + 39        } + 40 + 41        return $this->buildAssociatedTokenAccountInstruction( + 42            $payer, + 43            $associatedToken, + 44            $owner, + 45            $mint, + 46            new Buffer([]), + 47            $programId, + 48            $associatedTokenProgramId + 49        ); + 50    } + 51 + 52    /** + 53     * @param PublicKey $payer + 54     * @param PublicKey $associatedToken + 55     * @param PublicKey $owner + 56     * @param PublicKey $mint + 57     * @param Buffer $instructionData + 58     * @param string|PublicKey|null $programId + 59     * @param string|PublicKey|null $associatedTokenProgramId + 60     * @return TransactionInstruction + 61     */ + 62    public function buildAssociatedTokenAccountInstruction( + 63        PublicKey             $payer, + 64        PublicKey             $associatedToken, + 65        PublicKey             $owner, + 66        PublicKey             $mint, + 67        Buffer                $instructionData, + 68        string|PublicKey|null $programId = new PublicKey(self::TOKEN_PROGRAM_ID), + 69        string|PublicKey|null $associatedTokenProgramId = new PublicKey(self::ASSOCIATED_TOKEN_PROGRAM_ID) + 70    ): TransactionInstruction + 71    { + 72 + 73        $keys = [ + 74            new AccountMeta($payer, true, true), + 75            new AccountMeta($associatedToken, false, true), + 76            new AccountMeta($owner, false, false), + 77            new AccountMeta($mint, false, false), + 78            new AccountMeta(SystemProgram::programId(), false, false), + 79            new AccountMeta($programId, false, false), + 80        ]; + 81 + 82 + 83        return new TransactionInstruction( + 84            $associatedTokenProgramId, + 85            $keys, + 86            $instructionData + 87        ); + 88    } + 89 + 90 + 91    /** + 92     * @throws InputValidationException + 93     */ + 94    function createSyncNativeInstruction(PublicKey $owner, string $programId = self::TOKEN_PROGRAM_ID): TransactionInstruction + 95    { + 96        $keys = [ + 97            new AccountMeta($owner, false, true), + 98        ]; + 99        $data = str_repeat("\0", TokenInstruction::SyncNative); + 100        return new TransactionInstruction( + 101            new PublicKey($programId), + 102            $keys, + 103            $data + 104        ); + 105    } + 106} @@ -293,7 +290,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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 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 0a23585..b65704f 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Programs/SplToken/Instructions/dashboard.html b/build/html-coverage/Programs/SplToken/Instructions/dashboard.html index ec48f1e..2db8f62 100644 --- a/build/html-coverage/Programs/SplToken/Instructions/dashboard.html +++ b/build/html-coverage/Programs/SplToken/Instructions/dashboard.html @@ -113,7 +113,7 @@

Insufficient Coverage

-
createAssociatedTokenAccountInstruction84% + createAssociatedTokenAccountInstruction84% @@ -130,7 +130,7 @@

Project Risks

- createAssociatedTokenAccountInstruction3 + createAssociatedTokenAccountInstruction3 @@ -140,7 +140,7 @@

Project Risks

@@ -227,7 +227,7 @@

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/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.28571428571428,5,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\SPLTokenInstructions<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -251,7 +251,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[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([[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/Instructions/index.html b/build/html-coverage/Programs/SplToken/Instructions/index.html index f68d218..e00806f 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

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

Insufficient Coverage

+ Attestto\SolanaPhpSdk\Programs\SplToken\State\Mint0% @@ -112,7 +113,8 @@

Insufficient Coverage

- createAssociatedTokenAccountInstruction84% + fromBuffer0% + createAssociatedTokenAccountInstruction84% @@ -129,7 +131,7 @@

Project Risks

- createAssociatedTokenAccountInstruction3 + createAssociatedTokenAccountInstruction3 @@ -139,7 +141,7 @@

Project Risks

@@ -158,7 +160,7 @@

Project Risks

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

Project Risks

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

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .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')) + .datum(getComplexityData([[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint<\/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); @@ -250,7 +252,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .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')) + .datum(getComplexityData([[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::fromBuffer<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::getAccount<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint::fromBuffer<\/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/SplToken/index.html b/build/html-coverage/Programs/SplToken/index.html index 892a29c..7a74ddb 100644 --- a/build/html-coverage/Programs/SplToken/index.html +++ b/build/html-coverage/Programs/SplToken/index.html @@ -46,29 +46,29 @@ Total
-
- 94.37% covered (success) +
+ 93.90% covered (success)
-
94.37%
-
67 / 71
-
-
- 50.00% covered (danger) +
93.90%
+
77 / 82
+
+
+ 57.14% covered (warning)
-
50.00%
-
2 / 4
+
57.14%
+
4 / 7
-
- 0.00% covered (danger) +
+ 25.00% covered (danger)
-
0.00%
-
0 / 2
+
25.00%
+
1 / 4
@@ -127,6 +127,34 @@
0 / 1
+ +
State +
+
+ 90.91% covered (success) +
+
+ +
90.91%
+
10 / 11
+
+
+ 66.67% covered (warning) +
+
+ +
66.67%
+
2 / 3
+
+
+ 50.00% covered (danger) +
+
+ +
50.00%
+
1 / 2
+ + @@ -140,7 +168,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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Programs/SplTokenProgram.php.html b/build/html-coverage/Programs/SplTokenProgram.php.html index 84d6c87..58c0657 100644 --- a/build/html-coverage/Programs/SplTokenProgram.php.html +++ b/build/html-coverage/Programs/SplTokenProgram.php.html @@ -239,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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Programs/SystemProgram.php.html b/build/html-coverage/Programs/SystemProgram.php.html index febb440..0c798c7 100644 --- a/build/html-coverage/Programs/SystemProgram.php.html +++ b/build/html-coverage/Programs/SystemProgram.php.html @@ -292,10 +292,10 @@ 30     */ 31    public function getAccountInfo(string $pubKey): array 32    { - 33        $accountResponse = $this->client->call('getAccountInfo', [$pubKey, ["encoding" => "jsonParsed"]])['value']; + 33        $accountResponse = $this->client->call('getAccountInfo', [$pubKey, ["encoding" => "jsonParsed"]])['value']; 34 - 35        if (! $accountResponse) { - 36            throw new AccountNotFoundException("API Error: Account {$pubKey} not found."); + 35        if (! $accountResponse) { + 36            throw new AccountNotFoundException("API Error: Account {$pubKey} not found."); 37        } 38 39        return $accountResponse; @@ -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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Programs/dashboard.html b/build/html-coverage/Programs/dashboard.html index 0dd39f2..08cb221 100644 --- a/build/html-coverage/Programs/dashboard.html +++ b/build/html-coverage/Programs/dashboard.html @@ -59,8 +59,13 @@

Insufficient Coverage

Attestto\SolanaPhpSdk\Programs\MetaplexProgram0% + Attestto\SolanaPhpSdk\Programs\SplToken\State\Mint0% + Attestto\SolanaPhpSdk\Programs\SNS\Bindings0% Attestto\SolanaPhpSdk\Programs\DidSolProgram31% Attestto\SolanaPhpSdk\Programs\SystemProgram47% + Attestto\SolanaPhpSdk\Programs\SNS\Utils66% + Attestto\SolanaPhpSdk\Programs\SNS\Instructions\Instructions85% + Attestto\SolanaPhpSdk\Programs\SnsProgram88% @@ -78,7 +83,11 @@

Project Risks

Attestto\SolanaPhpSdk\Programs\DidSolProgram78 + Attestto\SolanaPhpSdk\Programs\SNS\Utils34 Attestto\SolanaPhpSdk\Programs\SystemProgram17 + Attestto\SolanaPhpSdk\Programs\SNS\Instructions\Instructions13 + Attestto\SolanaPhpSdk\Programs\SNS\Bindings12 + Attestto\SolanaPhpSdk\Programs\SnsProgram2 @@ -120,13 +129,22 @@

Insufficient Coverage

parse0% getRpcEndpointFromShortcut0% getProgramAccounts0% + fromBuffer0% getBalance0% getConfirmedTransaction0% getTransaction0% createAccount0% + createSubdomain0% + reverseLookup0% + deserializeReverse0% + transferInstruction60% + getDomainKeySync70% getAccountInfo75% - createAssociatedTokenAccountInstruction84% + createInstruction84% + createAssociatedTokenAccountInstruction84% getAssociatedTokenAddressSync85% + retrieve88% + __construct88% @@ -145,9 +163,17 @@

Project Risks

parse42 getRpcEndpointFromShortcut30 + createSubdomain12 + getDomainKeySync11 + transferInstruction8 + reverseLookup6 + deserializeReverse6 + createInstruction4 getAssociatedTokenAddressSync3 - createAssociatedTokenAccountInstruction3 + createAssociatedTokenAccountInstruction3 getAccountInfo2 + retrieve2 + __construct2 @@ -157,7 +183,7 @@

Project Risks

@@ -176,7 +202,7 @@

Project Risks

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

Project Risks

.yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([8,0,0,0,0,0,0,0,1,2,1,7], "Method Coverage")) + .datum(getCoverageDistributionData([12,0,0,0,0,0,0,1,2,5,2,16], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -244,7 +270,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>"],[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')) + .datum(getComplexityData([[31.11111111111111,14,"Attestto\\SolanaPhpSdk\\Programs\\DidSolProgram<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\MetaplexProgram<\/a>"],[90,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount<\/a>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SnsProgram<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint<\/a>"],[93.75,4,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram<\/a>"],[47.22222222222222,8,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings<\/a>"],[85.94594594594595,13,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions<\/a>"],[66.66666666666666,20,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils<\/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); @@ -268,7 +294,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>"],[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')) + .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>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::retrieve<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::deserialize<\/a>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SnsProgram::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::fromBuffer<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::getAccount<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint::fromBuffer<\/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>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createSubdomain<\/a>"],[84.12698412698413,4,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::createInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::updateInstruction<\/a>"],[60,6,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::transferInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::reallocInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::deleteInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::loadConstants<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getHashedNameSync<\/a>"],[92.3076923076923,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>"],[70,9,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getDomainKeySync<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::_deriveSync<\/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 9279d36..418d0b6 100644 --- a/build/html-coverage/Programs/index.html +++ b/build/html-coverage/Programs/index.html @@ -45,21 +45,49 @@ Total
-
- 61.75% covered (warning) +
+ 69.09% covered (warning)
-
61.75%
-
113 / 183
+
69.09%
+
333 / 482
-
- 36.84% covered (danger) +
+ 42.11% covered (danger)
-
36.84%
-
7 / 19
+
42.11%
+
16 / 38
+
+
+ 7.69% covered (danger) +
+
+ +
7.69%
+
1 / 13
+ + + +
SNS +
+
+ 72.40% covered (warning) +
+
+ +
72.40%
+
202 / 279
+
+
+ 46.67% covered (danger) +
+
+ +
46.67%
+
7 / 15
0.00% covered (danger) @@ -67,35 +95,35 @@
0.00%
-
0 / 6
+
0 / 4
SplToken
-
- 94.37% covered (success) +
+ 93.90% covered (success)
-
94.37%
-
67 / 71
-
-
- 50.00% covered (danger) +
93.90%
+
77 / 82
+
+
+ 57.14% covered (warning)
-
50.00%
-
2 / 4
+
57.14%
+
4 / 7
-
- 0.00% covered (danger) +
+ 25.00% covered (danger)
-
0.00%
-
0 / 2
+
25.00%
+
1 / 4
@@ -154,6 +182,34 @@
0 / 1
+ + SnsProgram.php +
+
+ 88.89% covered (warning) +
+
+ +
88.89%
+
8 / 9
+
+
+ 0.00% covered (danger) +
+
+ +
0.00%
+
0 / 1
+
+
+ 0.00% covered (danger) +
+
+ +
0.00%
+
0 / 1
+ + SplTokenProgram.php
@@ -223,7 +279,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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/PublicKey.php.html b/build/html-coverage/PublicKey.php.html index 59c721c..879e765 100644 --- a/build/html-coverage/PublicKey.php.html +++ b/build/html-coverage/PublicKey.php.html @@ -320,7 +320,7 @@ -  findProgramAddress +  findProgramAddress
90.00% covered (success) @@ -342,7 +342,7 @@ -  findProgramAddressSync +  findProgramAddressSync
100.00% covered (success) @@ -364,7 +364,7 @@ -  isOnCurve +  isOnCurve
100.00% covered (success) @@ -386,7 +386,7 @@ -  base58 +  base58
100.00% covered (success) @@ -408,7 +408,7 @@ -  getPublicKey +  getPublicKey
100.00% covered (success) @@ -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    /** @@ -574,99 +574,100 @@ 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)) { - 155            throw new InputValidationException('Invalid seeds, address must fall off the curve.'); + 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    /** 162     * @param array $seeds 163     * @param PublicKey $programId 164     * @return array 2 elements, [0] = PublicKey, [1] = integer - 165     */ - 166    static function findProgramAddress(array $seeds, PublicKey $programId): array - 167    { - 168        $nonce = 255; - 169 - 170        while ($nonce != 0) { - 171            try { - 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]; - 180        } - 181 - 182        throw new BaseSolanaPhpSdkException('Unable to find a viable program address nonce.'); - 183    } - 184 - 185    /** - 186     * - 187     * @param array $seeds - 188     * @param PublicKey $programId - 189     * @return array 2 elements, [0] = PublicKey, [1] = integer - 190     */ - 191    static function findProgramAddressSync(array $seeds, PublicKey $programId): array - 192    { - 193        return static::findProgramAddress($seeds, $programId); - 194    } - 195 - 196    /** - 197     * Check that a pubkey is on the ed25519 curve. - 198     */ - 199    static function isOnCurve(mixed $publicKey): bool - 200    { - 201        try { - 202            $binaryString = $publicKey instanceof PublicKey - 203                ? $publicKey->toBinaryString() - 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); - 211 - 212            return true; - 213        } catch (RangeException|\SodiumException $exception) { - 214            return false; - 215        } - 216    } - 217 - 218    /** - 219     * Convenience. - 220     * - 221     * @return Base58 - 222     */ - 223    public static function base58(): Base58 - 224    { - 225        return new Base58(); - 226    } - 227 - 228    public function getPublicKey(): PublicKey - 229    { - 230        return $this; - 231    } - 232} + 165     * @throws BaseSolanaPhpSdkException + 166     */ + 167    static function findProgramAddress(array $seeds, PublicKey $programId): array + 168    { + 169        $nonce = 255; + 170 + 171        while ($nonce != 0) { + 172            try { + 173                $copyOfSeedsWithNonce = $seeds; + 174                $copyOfSeedsWithNonce[] = [$nonce]; + 175                $address = static::createProgramAddress($copyOfSeedsWithNonce, $programId); + 176            } catch (\Exception $exception) { + 177                $nonce--; + 178                continue; + 179            } + 180            return [$address, $nonce]; + 181        } + 182 + 183        throw new BaseSolanaPhpSdkException('Unable to find a viable program address nonce.'); + 184    } + 185 + 186    /** + 187     * + 188     * @param array $seeds + 189     * @param PublicKey $programId + 190     * @return array 2 elements, [0] = PublicKey, [1] = integer + 191     */ + 192    static function findProgramAddressSync(array $seeds, PublicKey $programId): array + 193    { + 194        return static::findProgramAddress($seeds, $programId); + 195    } + 196 + 197    /** + 198     * Check that a pubkey is on the ed25519 curve. + 199     */ + 200    static function isOnCurve(mixed $publicKey): bool + 201    { + 202        try { + 203            $binaryString = $publicKey instanceof PublicKey + 204                ? $publicKey->toBinaryString() + 205                : $publicKey; + 206 + 207            /** + 208             * Sodium extension method sometimes returns "conversion failed" exception. + 209             * $_ = sodium_crypto_sign_ed25519_pk_to_curve25519($binaryString); + 210             */ + 211            $_ = ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519($binaryString); + 212 + 213            return true; + 214        } catch (RangeException|\SodiumException $exception) { + 215            return false; + 216        } + 217    } + 218 + 219    /** + 220     * Convenience. + 221     * + 222     * @return Base58 + 223     */ + 224    public static function base58(): Base58 + 225    { + 226        return new Base58(); + 227    } + 228 + 229    public function getPublicKey(): PublicKey + 230    { + 231        return $this; + 232    } + 233} @@ -677,7 +678,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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/SolanaRpcClient.php.html b/build/html-coverage/SolanaRpcClient.php.html index c2d67e7..6460eab 100644 --- a/build/html-coverage/SolanaRpcClient.php.html +++ b/build/html-coverage/SolanaRpcClient.php.html @@ -144,7 +144,7 @@ -  buildRpc +  buildRpc
100.00% covered (success) @@ -166,7 +166,7 @@ -  validateResponse +  validateResponse
77.78% covered (warning) @@ -188,7 +188,7 @@ -  getRandomKey +  getRandomKey
0.00% covered (danger) @@ -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,87 +305,89 @@ 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); - 100 - 101        $resp_body = $response->getBody()->getContents(); - 102        $resp_object = json_decode($resp_body, true); - 103 - 104        $this->validateResponse($resp_object, $method); - 105 + 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        ]; + 100        $response = $this->httpClient->request('POST', $this->endpoint, $options); + 101 + 102        $resp_body = $response->getBody()->getContents(); + 103        $resp_object = json_decode($resp_body, true); + 104 + 105        $this->validateResponse($resp_object, $method); 106 - 107        return $resp_object['result'] ?? null; - 108    } - 109    /** - 110     * @param string $method - 111     * @param array $params - 112     * @return array - 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        ]; - 122    } - 123 - 124    /** - 125     * @param mixed $response - 126     * @param string $method - 127     * @throws GenericException - 128     * @throws InvalidIdResponseException - 129     * @throws MethodNotFoundException - 130     */ - 131    protected function validateResponse(array $body, string $method): void - 132    { - 133 - 134        // Get response body as string - 135        //$body = $response->getBody()->getContents(); - 136 - 137        // Decode JSON response body - 138        //$resp = json_decode($body, true); - 139 - 140 + 107 + 108        return $resp_object['result'] ?? null; + 109    } + 110    /** + 111     * @param string $method + 112     * @param array $params + 113     * @return array + 114     */ + 115    public function buildRpc(string $method, array $params): array + 116    { + 117        return [ + 118            'jsonrpc' => '2.0', + 119            'id' => $this->randomKey, + 120            'method' => $method, + 121            'params' => $params, + 122 + 123        ]; + 124    } + 125 + 126    /** + 127     * @param mixed $response + 128     * @param string $method + 129     * @throws GenericException + 130     * @throws InvalidIdResponseException + 131     * @throws MethodNotFoundException + 132     */ + 133    protected function validateResponse(array $body, string $method): void + 134    { + 135 + 136        // Get response body as string + 137        //$body = $response->getBody()->getContents(); + 138 + 139        // Decode JSON response body + 140        //$resp = json_decode($body, true); 141 - 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) { - 150                throw new MethodNotFoundException("API Error: Method $method not found."); - 151            } else { - 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) { - 158            throw new InvalidIdResponseException($this->randomKey); - 159        } - 160 - 161 - 162    } + 142 + 143 + 144        if ($body == null) { + 145            throw new GenericException('Invalid JSON response'); + 146        } + 147 + 148        // If response contains an 'error' key, handle it + 149        if (isset($body['params']['error']) || isset($body['error'])) { + 150            $error = $body['params']['error']? : $body['error']; + 151            if ($error['code'] === self::ERROR_CODE_METHOD_NOT_FOUND) { + 152                throw new MethodNotFoundException("API Error: Method $method not found."); + 153            } else { + 154                throw new GenericException($error['message']); + 155            } + 156        } + 157 + 158        // If 'id' doesn't match the expected value, throw an exception + 159        if ($body['id'] !== $this->randomKey) { + 160            throw new InvalidIdResponseException($this->randomKey); + 161        } + 162 163 - 164    /** - 165     * @return int - 166     */ - 167    public function getRandomKey(): int - 168    { - 169        return $this->randomKey; - 170    } - 171} + 164    } + 165 + 166    /** + 167     * @return int + 168     */ + 169    public function getRandomKey(): int + 170    { + 171        return $this->randomKey; + 172    } + 173} @@ -396,7 +398,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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/State/Account.php.html b/build/html-coverage/State/Account.php.html index e0811dd..965ae9c 100644 --- a/build/html-coverage/State/Account.php.html +++ b/build/html-coverage/State/Account.php.html @@ -43,105 +43,105 @@ - Total -
-
- 100.00% covered (success) + Total +
+
+ 0.00% covered (danger)
-
100.00%
-
10 / 10
-
-
- 100.00% covered (success) +
0.00%
+
0 / 10
+
+
+ 0.00% covered (danger)
-
100.00%
-
2 / 2
- CRAP -
-
- 100.00% covered (success) +
0.00%
+
0 / 2
+ CRAP +
+
+ 0.00% covered (danger)
-
100.00%
-
1 / 1
+
0.00%
+
0 / 1
- Account -
-
- 100.00% covered (success) + Account +
+
+ 0.00% covered (danger)
-
100.00%
-
10 / 10
-
-
- 100.00% covered (success) +
0.00%
+
0 / 10
+
+
+ 0.00% covered (danger)
-
100.00%
-
2 / 2
- 3 -
-
- 100.00% covered (success) +
0.00%
+
0 / 2
+ 12 +
+
+ 0.00% covered (danger)
-
100.00%
-
1 / 1
+
0.00%
+
0 / 1
-  fromBuffer -
-
- 100.00% covered (success) +  fromBuffer +
+
+ 0.00% covered (danger)
-
100.00%
-
1 / 1
-
-
- 100.00% covered (success) +
0.00%
+
0 / 1
+
+
+ 0.00% covered (danger)
-
100.00%
-
1 / 1
- 1 - +
0.00%
+
0 / 1
+ 2 + -  getAccount -
-
- 100.00% covered (success) +  getAccount +
+
+ 0.00% covered (danger)
-
100.00%
-
9 / 9
-
-
- 100.00% covered (success) +
0.00%
+
0 / 9
+
+
+ 0.00% covered (danger)
-
100.00%
-
1 / 1
- 2 - +
0.00%
+
0 / 1
+ 6 + @@ -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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 1:49:12 UTC 2024.

diff --git a/build/html-coverage/State/dashboard.html b/build/html-coverage/State/dashboard.html index 6a7255e..507f3ac 100644 --- a/build/html-coverage/State/dashboard.html +++ b/build/html-coverage/State/dashboard.html @@ -58,6 +58,7 @@

Insufficient Coverage

+
Attestto\SolanaPhpSdk\State\Account0% Attestto\SolanaPhpSdk\State\Mint0% @@ -75,6 +76,7 @@

Project Risks

+ Attestto\SolanaPhpSdk\State\Account12 @@ -112,6 +114,8 @@

Insufficient Coverage

+ fromBuffer0% + getAccount0% fromBuffer0% @@ -129,6 +133,7 @@

Project Risks

+ getAccount6 @@ -138,7 +143,7 @@

Project Risks

@@ -157,7 +162,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,1], "Class Coverage")) + .datum(getCoverageDistributionData([2,0,0,0,0,0,0,0,0,0,0,0], "Class Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -175,7 +180,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,2], "Method Coverage")) + .datum(getCoverageDistributionData([3,0,0,0,0,0,0,0,0,0,0,0], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -225,7 +230,7 @@

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[100,3,"Attestto\\SolanaPhpSdk\\State\\Account<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\State\\Mint<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[0,3,"Attestto\\SolanaPhpSdk\\State\\Account<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\State\\Mint<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -249,7 +254,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[100,1,"
Attestto\\SolanaPhpSdk\\State\\Account::fromBuffer<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\State\\Account::getAccount<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\State\\Mint::fromBuffer<\/a>"]], 'Method Complexity')) + .datum(getComplexityData([[0,1,"Attestto\\SolanaPhpSdk\\State\\Account::fromBuffer<\/a>"],[0,2,"Attestto\\SolanaPhpSdk\\State\\Account::getAccount<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\State\\Mint::fromBuffer<\/a>"]], 'Method Complexity')) .transition() .duration(500) .call(chart); diff --git a/build/html-coverage/State/index.html b/build/html-coverage/State/index.html index 052fd8e..335fdb2 100644 --- a/build/html-coverage/State/index.html +++ b/build/html-coverage/State/index.html @@ -43,59 +43,59 @@ - Total -
-
- 90.91% covered (success) + Total +
+
+ 0.00% covered (danger)
-
90.91%
-
10 / 11
-
-
- 66.67% covered (warning) +
0.00%
+
0 / 11
+
+
+ 0.00% covered (danger)
-
66.67%
-
2 / 3
+
0.00%
+
0 / 3
-
- 50.00% covered (danger) +
+ 0.00% covered (danger)
-
50.00%
-
1 / 2
+
0.00%
+
0 / 2
-
Account.php -
-
- 100.00% covered (success) + Account.php +
+
+ 0.00% covered (danger)
-
100.00%
-
10 / 10
-
-
- 100.00% covered (success) +
0.00%
+
0 / 10
+
+
+ 0.00% covered (danger)
-
100.00%
-
2 / 2
-
-
- 100.00% covered (success) +
0.00%
+
0 / 2
+
+
+ 0.00% covered (danger)
-
100.00%
-
1 / 1
+
0.00%
+
0 / 1
@@ -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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 1:49:12 UTC 2024.

diff --git a/build/html-coverage/State/mint.php.html b/build/html-coverage/State/mint.php.html index dda64df..a6b1213 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 1:49:12 UTC 2024.

diff --git a/build/html-coverage/Transaction.php.html b/build/html-coverage/Transaction.php.html index 61ded1f..459cdde 100644 --- a/build/html-coverage/Transaction.php.html +++ b/build/html-coverage/Transaction.php.html @@ -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                $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) { + 123        if ($this->feePayer) { 124            $feePayer = $this->feePayer; - 125        } elseif (sizeof($this->signatures) && $this->signatures[0]->getPublicKey()) { - 126            $feePayer = $this->signatures[0]->getPublicKey(); + 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) { + 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    /** @@ -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    /** @@ -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,9 +1209,9 @@ 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); @@ -1229,8 +1229,8 @@ 660     */ 661    protected function toSecretKey($source): string 662    { - 663        if ($source instanceof HasSecretKey) { - 664            return $source->getSecretKey(); + 663        if ($source instanceof HasSecretKey) { + 664            return $source->getSecretKey(); 665        } else { 666            throw new InputValidationException('Unsupported input: ' . get_class($source)); 667        } @@ -1246,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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/TransactionInstruction.php.html b/build/html-coverage/TransactionInstruction.php.html index edf4bc5..73c45b1 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Util/AccountMeta.php.html b/build/html-coverage/Util/AccountMeta.php.html index 60d9f74..3a7f175 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Util/Buffer.php.html b/build/html-coverage/Util/Buffer.php.html index f542af6..a868292 100644 --- a/build/html-coverage/Util/Buffer.php.html +++ b/build/html-coverage/Util/Buffer.php.html @@ -45,21 +45,21 @@ Total
-
- 84.48% covered (warning) +
+ 85.94% covered (warning)
-
84.48%
-
49 / 58
+
85.94%
+
55 / 64
-
- 75.00% covered (warning) +
+ 78.95% covered (warning)
-
75.00%
-
12 / 16
+
78.95%
+
15 / 19
CRAP
@@ -74,22 +74,22 @@ Buffer
-
- 84.48% covered (warning) +
+ 85.94% covered (warning)
-
84.48%
-
49 / 58
+
85.94%
+
55 / 64
-
- 75.00% covered (warning) +
+ 78.95% covered (warning)
-
75.00%
-
12 / 16
- 43.40 +
78.95%
+
15 / 19
+ 46.91
0.00% covered (danger) @@ -101,7 +101,7 @@ -  __construct +  __construct
86.96% covered (warning) @@ -123,7 +123,51 @@ -  from +  concat +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
4 / 4
+
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+ 2 + + + + +  fromArray +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+ 1 + + + + +  from
100.00% covered (success) @@ -145,7 +189,7 @@ -  fromBase58 +  fromBase58
100.00% covered (success) @@ -167,7 +211,7 @@ -  pad +  pad
100.00% covered (success) @@ -189,7 +233,7 @@ -  push +  push
100.00% covered (success) @@ -211,7 +255,7 @@ -  slice +  slice
100.00% covered (success) @@ -233,7 +277,7 @@ -  splice +  splice
0.00% covered (danger) @@ -255,7 +299,7 @@ -  shift +  shift
100.00% covered (success) @@ -277,7 +321,7 @@ -  fixed +  fixed
100.00% covered (success) @@ -299,7 +343,7 @@ -  toArray +  toArray
100.00% covered (success) @@ -321,7 +365,7 @@ -  toString +  toString
100.00% covered (success) @@ -343,7 +387,7 @@ -  toBase58String +  toBase58String
100.00% covered (success) @@ -365,7 +409,7 @@ -  count +  count
100.00% covered (success) @@ -387,7 +431,7 @@ -  __toString +  __toString
100.00% covered (success) @@ -409,7 +453,7 @@ -  value +  value
60.00% covered (warning) @@ -431,7 +475,7 @@ -  computedFormat +  computedFormat
70.00% covered (warning) @@ -452,6 +496,28 @@ + +  alloc +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+ 1 + + + @@ -470,253 +536,288 @@ 10 11/** 12 * A convenient wrapper class around an array of bytes (int's). - 13 */ - 14class Buffer implements Countable - 15{ - 16    const TYPE_STRING = 'string'; - 17    const TYPE_BYTE = 'byte'; - 18    const TYPE_SHORT = 'short'; - 19    const TYPE_INT = 'int'; - 20    const TYPE_LONG = 'long'; - 21    const TYPE_FLOAT = 'float'; - 22 - 23    const FORMAT_CHAR_SIGNED = 'c'; - 24    const FORMAT_CHAR_UNSIGNED = 'C'; - 25    const FORMAT_SHORT_16_SIGNED = 's'; - 26    const FORMAT_SHORT_16_UNSIGNED = 'v'; - 27    const FORMAT_LONG_32_SIGNED = 'l'; - 28    const FORMAT_LONG_32_UNSIGNED = 'V'; - 29    const FORMAT_LONG_LONG_64_SIGNED = 'q'; - 30    const FORMAT_LONG_LONG_64_UNSIGNED = 'P'; - 31    const FORMAT_FLOAT = 'e'; - 32 - 33    /** - 34     * @var array<int> - 35     */ - 36    protected array $data; - 37 - 38    /** - 39     * @var bool is this a signed or unsigned value? - 40     */ - 41    protected ?bool $signed = null; - 42 - 43    /** - 44     * @var ?string $datatype - 45     */ - 46    protected ?string $datatype = null; - 47 - 48    /** - 49     * @param mixed $value - 50     */ - 51    public function __construct($value = null, ?string $datatype = null, ?bool $signed = null) - 52    { - 53        $this->datatype = $datatype; - 54        $this->signed = $signed; - 55 - 56        $isString = is_string($value); - 57        $isNumeric = is_numeric($value); - 58 - 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 = []; - 77        } elseif (method_exists($value, 'toArray')) { - 78            $this->data = $value->toArray(); - 79        } else { - 80            throw new InputValidationException('Unsupported $value for Buffer: ' . get_class($value)); - 81        } - 82    } - 83 - 84    /** - 85     * For convenience. - 86     * - 87     * @param $value - 88     * @return Buffer - 89     */ - 90    public static function from($value = null, ?string $format = null, ?bool $signed = null): Buffer - 91    { - 92        return new static($value, $format, $signed); - 93    } - 94 - 95    /** - 96     * For convenience. - 97     * - 98     * @param string $value - 99     * @return Buffer - 100     */ - 101    public static function fromBase58(string $value): Buffer - 102    { - 103        $value = PublicKey::base58()->decode($value); - 104 - 105        return new static($value); - 106    } - 107 - 108    /** - 109     * @param $len - 110     * @param int $val - 111     * @return $this - 112     */ - 113    public function pad($len, int $val = 0): Buffer - 114    { - 115        $this->data = array_pad($this->data, $len, $val); - 116 - 117        return $this; - 118    } - 119 - 120    /** - 121     * @param $source - 122     * @return $this - 123     */ - 124    public function push($source): Buffer - 125    { - 126        $sourceAsBuffer = Buffer::from($source); - 127 - 128        array_push($this->data, ...$sourceAsBuffer->toArray()); + 13 * + 14 */ + 15class Buffer implements Countable + 16{ + 17    const TYPE_STRING = 'string'; + 18    const TYPE_BYTE = 'byte'; + 19    const TYPE_SHORT = 'short'; + 20    const TYPE_INT = 'int'; + 21    const TYPE_LONG = 'long'; + 22    const TYPE_FLOAT = 'float'; + 23 + 24    const FORMAT_CHAR_SIGNED = 'c'; + 25    const FORMAT_CHAR_UNSIGNED = 'C'; + 26    const FORMAT_SHORT_16_SIGNED = 's'; + 27    const FORMAT_SHORT_16_UNSIGNED = 'v'; + 28    const FORMAT_LONG_32_SIGNED = 'l'; + 29    const FORMAT_LONG_32_UNSIGNED = 'V'; + 30    const FORMAT_LONG_LONG_64_SIGNED = 'q'; + 31    const FORMAT_LONG_LONG_64_UNSIGNED = 'P'; + 32    const FORMAT_FLOAT = 'e'; + 33 + 34    /** + 35     * @var array<int> + 36     */ + 37    protected array $data; + 38 + 39    /** + 40     * @var bool is this a signed or unsigned value? + 41     */ + 42    protected ?bool $signed = null; + 43 + 44    /** + 45     * @var ?string $datatype + 46     */ + 47    protected ?string $datatype = null; + 48 + 49 + 50    /** + 51     * @param mixed $value + 52     */ + 53    public function __construct($value = null, ?string $datatype = null, ?bool $signed = null) + 54    { + 55        $this->datatype = $datatype; + 56        $this->signed = $signed; + 57 + 58        $isString = is_string($value); + 59        $isNumeric = is_numeric($value); + 60 + 61        if ($isString || $isNumeric) { + 62            $this->datatype = $datatype; + 63            $this->signed = $signed; + 64 + 65            // unpack returns an array indexed at 1. + 66            $this->data = $isString + 67                ? array_values(unpack("C*", $value)) + 68                : array_values(unpack("C*", pack($this->computedFormat(), $value))); + 69        } elseif (is_array($value)) { + 70            $this->data = $value; + 71        } elseif ($value instanceof PublicKey) { + 72            $this->data = $value->toBytes(); + 73        } elseif ($value instanceof Buffer) { + 74            $this->data = $value->toArray(); + 75            $this->datatype = $value->datatype; + 76            $this->signed = $value->signed; + 77        } elseif ($value == null) { + 78            $this->data = []; + 79        } elseif (method_exists($value, 'toArray')) { + 80            $this->data = $value->toArray(); + 81        } else { + 82            throw new InputValidationException('Unsupported $value for Buffer: ' . get_class($value)); + 83        } + 84    } + 85 + 86    /** + 87     * @throws InputValidationException + 88     */ + 89    public static function concat(array $buffers): static + 90    { + 91        $data = []; + 92        foreach ($buffers as $buffer) { + 93            $data = array_merge($data, $buffer->toArray()); + 94        } + 95 + 96        return new static($data); + 97    } + 98 + 99    /** + 100     * @throws InputValidationException + 101     */ + 102    public static function fromArray(array $array): static + 103    { + 104        return new static($array); + 105    } + 106 + 107    /** + 108     * For convenience. + 109     * + 110     * @param $value + 111     * @return Buffer + 112     * @throws InputValidationException + 113     */ + 114    public static function from($value = null, ?string $format = null, ?bool $signed = null): Buffer + 115    { + 116        return new static($value, $format, $signed); + 117    } + 118 + 119    /** + 120     * For convenience. + 121     * + 122     * @param string $value + 123     * @return Buffer + 124     * @throws InputValidationException + 125     */ + 126    public static function fromBase58(string $value): Buffer + 127    { + 128        $value = PublicKey::base58()->decode($value); 129 - 130        return $this; + 130        return new static($value); 131    } 132 133    /** - 134     * @return Buffer - 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); - 139    } - 140 - 141    /** - 142     * @return Buffer - 143     */ - 144    public function splice(int $offset, ?int $length = null): Buffer - 145    { - 146        return static::from(array_splice($this->data, $offset, $length)); - 147    } - 148 - 149    /** - 150     * @return ?int - 151     */ - 152    public function shift(): ?int - 153    { - 154        return array_shift($this->data); - 155    } - 156 - 157    /** - 158     * @return $this - 159     */ - 160    public function fixed(int $size): Buffer - 161    { - 162        $fixedSizeData = SplFixedArray::fromArray($this->data); - 163        $fixedSizeData->setSize($size); - 164        $this->data = $fixedSizeData->toArray(); + 134     * @param $len + 135     * @param int $val + 136     * @return $this + 137     */ + 138    public function pad($len, int $val = 0): Buffer + 139    { + 140        $this->data = array_pad($this->data, $len, $val); + 141 + 142        return $this; + 143    } + 144 + 145    /** + 146     * @param $source + 147     * @return $this + 148     */ + 149    public function push($source): Buffer + 150    { + 151        $sourceAsBuffer = Buffer::from($source); + 152 + 153        array_push($this->data, ...$sourceAsBuffer->toArray()); + 154 + 155        return $this; + 156    } + 157 + 158    /** + 159     * @return Buffer + 160     */ + 161    public function slice(int $offset, ?int $length = null, ?string $format = null, ?bool $signed = null): Buffer + 162    { + 163        return static::from(array_slice($this->data, $offset, $length), $format, $signed); + 164    } 165 - 166        return $this; - 167    } - 168 - 169    /** - 170     * Return binary representation of $value. - 171     * - 172     * @return array - 173     */ - 174    public function toArray(): array - 175    { - 176        return $this->data; - 177    } - 178 - 179    /** - 180     * Return binary string representation of $value. - 181     * - 182     * @return string - 183     */ - 184    public function toString(): string - 185    { - 186        return $this; - 187    } - 188 - 189    /** - 190     * Return string representation of $value. - 191     * - 192     * @return string - 193     */ - 194    public function toBase58String(): string - 195    { - 196        return PublicKey::base58()->encode($this->toString()); - 197    } - 198 - 199    /** - 200     * @return int - 201     * @throws InputValidationException - 202     */ - 203    #[\ReturnTypeWillChange] - 204    public function count() - 205    { - 206        return count($this->toArray()); - 207    } - 208 - 209    /** - 210     * @return string - 211     * @throws InputValidationException - 212     */ - 213    public function __toString() - 214    { - 215        return pack('C*', ...$this->toArray()); - 216    } - 217 - 218    /** - 219     * Convert the binary array to its corresponding value derived from $datatype, $signed, and sizeof($data). - 220     * - 221     * Note: it is expected that the ->fixed($length) method has already been called. - 222     * - 223     * @return mixed - 224     */ - 225    public function value(?int $length = null) - 226    { - 227        if ($length) { - 228            $this->fixed($length); - 229        } - 230 - 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]; - 235        } - 236    } - 237 - 238    /** - 239     * @return string - 240     * @throws InputValidationException - 241     */ - 242    protected function computedFormat() - 243    { - 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) { - 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; - 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; - 254            case self::TYPE_FLOAT: return self::FORMAT_FLOAT; - 255            default: throw new InputValidationException("Unsupported datatype."); - 256        } - 257    } - 258 - 259} + 166    /** + 167     * @return Buffer + 168     */ + 169    public function splice(int $offset, ?int $length = null): Buffer + 170    { + 171        return static::from(array_splice($this->data, $offset, $length)); + 172    } + 173 + 174    /** + 175     * @return ?int + 176     */ + 177    public function shift(): ?int + 178    { + 179        return array_shift($this->data); + 180    } + 181 + 182    /** + 183     * @return $this + 184     */ + 185    public function fixed(int $size): Buffer + 186    { + 187        $fixedSizeData = SplFixedArray::fromArray($this->data); + 188        $fixedSizeData->setSize($size); + 189        $this->data = $fixedSizeData->toArray(); + 190 + 191        return $this; + 192    } + 193 + 194    /** + 195     * Return binary representation of $value. + 196     * + 197     * @return array + 198     */ + 199    public function toArray(): array + 200    { + 201        return $this->data; + 202    } + 203 + 204    /** + 205     * Return binary string representation of $value. + 206     * + 207     * @return string + 208     */ + 209    public function toString(): string + 210    { + 211        return $this; + 212    } + 213 + 214    /** + 215     * Return string representation of $value. + 216     * + 217     * @return string + 218     */ + 219    public function toBase58String(): string + 220    { + 221        return PublicKey::base58()->encode($this->toString()); + 222    } + 223 + 224    /** + 225     * @return int + 226     * @throws InputValidationException + 227     */ + 228    #[\ReturnTypeWillChange] + 229    public function count() + 230    { + 231        return count($this->toArray()); + 232    } + 233 + 234    /** + 235     * @return string + 236     * @throws InputValidationException + 237     */ + 238    public function __toString() + 239    { + 240        return pack('C*', ...$this->toArray()); + 241    } + 242 + 243    /** + 244     * Convert the binary array to its corresponding value derived from $datatype, $signed, and sizeof($data). + 245     * + 246     * Note: it is expected that the ->fixed($length) method has already been called. + 247     * + 248     * @return mixed + 249     */ + 250    public function value(?int $length = null) + 251    { + 252        if ($length) { + 253            $this->fixed($length); + 254        } + 255 + 256        if ($this->datatype === self::TYPE_STRING) { + 257            return ord(pack("C*", ...$this->toArray())); + 258        } else { + 259            return unpack($this->computedFormat(), pack("C*", ...$this->toArray()))[1]; + 260        } + 261    } + 262 + 263    /** + 264     * @return string + 265     * @throws InputValidationException + 266     */ + 267    protected function computedFormat(): string + 268    { + 269        if (! $this->datatype) { + 270            throw new InputValidationException('Trying to calculate format of unspecified buffer. Please specify a datatype.'); + 271        } + 272 + 273        switch ($this->datatype) { + 274            case self::TYPE_STRING: return self::FORMAT_CHAR_UNSIGNED; + 275            case self::TYPE_BYTE: return $this->signed ? self::FORMAT_CHAR_SIGNED : self::FORMAT_CHAR_UNSIGNED; + 276            case self::TYPE_SHORT: return $this->signed ? self::FORMAT_SHORT_16_SIGNED : self::FORMAT_SHORT_16_UNSIGNED; + 277            case self::TYPE_INT: return $this->signed ? self::FORMAT_LONG_32_SIGNED : self::FORMAT_LONG_32_UNSIGNED; + 278            case self::TYPE_LONG: return $this->signed ? self::FORMAT_LONG_LONG_64_SIGNED : self::FORMAT_LONG_LONG_64_UNSIGNED; + 279            case self::TYPE_FLOAT: return self::FORMAT_FLOAT; + 280            default: throw new InputValidationException("Unsupported datatype."); + 281        } + 282    } + 283 + 284    /** + 285     * @return Buffer + 286     * @throws InputValidationException + 287     */ + 288    public static function alloc(int $size): Buffer + 289    { + 290        return new static(array_fill(0, $size, 0)); + 291 + 292    } + 293 + 294} @@ -727,7 +828,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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Util/Commitment.php.html b/build/html-coverage/Util/Commitment.php.html index ef2741e..cfa4b32 100644 --- a/build/html-coverage/Util/Commitment.php.html +++ b/build/html-coverage/Util/Commitment.php.html @@ -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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Util/CompiledInstruction.php.html b/build/html-coverage/Util/CompiledInstruction.php.html index 5ccb8a8..f8db69e 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Util/ConfirmOptions.php.html b/build/html-coverage/Util/ConfirmOptions.php.html index 03b7420..b342d4a 100644 --- a/build/html-coverage/Util/ConfirmOptions.php.html +++ b/build/html-coverage/Util/ConfirmOptions.php.html @@ -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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Util/HasPublicKey.php.html b/build/html-coverage/Util/HasPublicKey.php.html index 2a6aa2d..2423d51 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Util/HasSecretKey.php.html b/build/html-coverage/Util/HasSecretKey.php.html index 01afad5..9d2ec78 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Util/MessageHeader.php.html b/build/html-coverage/Util/MessageHeader.php.html index 62dab1d..c111f02 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Util/NonceInformation.php.html b/build/html-coverage/Util/NonceInformation.php.html index ad0df6a..a84a729 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Util/ShortVec.php.html b/build/html-coverage/Util/ShortVec.php.html index bc017c1..50d2e4f 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Util/SignaturePubkeyPair.php.html b/build/html-coverage/Util/SignaturePubkeyPair.php.html index 096ecf8..7c9493b 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Util/Signer.php.html b/build/html-coverage/Util/Signer.php.html index 7c932a2..d0da068 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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/Util/dashboard.html b/build/html-coverage/Util/dashboard.html index d7dffeb..02fdaa1 100644 --- a/build/html-coverage/Util/dashboard.html +++ b/build/html-coverage/Util/dashboard.html @@ -61,7 +61,7 @@

Insufficient Coverage

Attestto\SolanaPhpSdk\Util\NonceInformation0% Attestto\SolanaPhpSdk\Util\Signer0% Attestto\SolanaPhpSdk\Util\Commitment63% - Attestto\SolanaPhpSdk\Util\Buffer84% + Attestto\SolanaPhpSdk\Util\Buffer85% @@ -78,7 +78,7 @@

Project Risks

- Attestto\SolanaPhpSdk\Util\Buffer43 + Attestto\SolanaPhpSdk\Util\Buffer46 Attestto\SolanaPhpSdk\Util\Commitment7 @@ -117,7 +117,7 @@

Insufficient Coverage

- splice0% + splice0% confirmed0% processed0% __toString0% @@ -125,10 +125,10 @@

Insufficient Coverage

__construct0% getPublicKey0% getSecretKey0% - value60% - computedFormat70% + value60% + computedFormat70% __construct85% - __construct86% + __construct86% @@ -145,9 +145,9 @@

Project Risks

- computedFormat17 - __construct9 - value3 + computedFormat17 + __construct9 + value3 __construct2 @@ -158,7 +158,7 @@

Project Risks

@@ -195,7 +195,7 @@

Project Risks

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

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[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>"]], 'Class Complexity')) + .datum(getComplexityData([[100,2,"Attestto\\SolanaPhpSdk\\Util\\AccountMeta<\/a>"],[85.9375,42,"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>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -269,7 +269,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[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>"]], 'Method Complexity')) + .datum(getComplexityData([[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,2,"Attestto\\SolanaPhpSdk\\Util\\Buffer::concat<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::fromArray<\/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>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::alloc<\/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>"]], 'Method Complexity')) .transition() .duration(500) .call(chart); diff --git a/build/html-coverage/Util/index.html b/build/html-coverage/Util/index.html index 2bf795a..e6aa7d5 100644 --- a/build/html-coverage/Util/index.html +++ b/build/html-coverage/Util/index.html @@ -45,21 +45,21 @@ Total
-
- 83.19% covered (warning) +
+ 84.03% covered (warning)
-
83.19%
-
94 / 113
+
84.03%
+
100 / 119
-
- 64.71% covered (warning) +
+ 67.57% covered (warning)
-
64.71%
-
22 / 34
+
67.57%
+
25 / 37
60.00% covered (warning) @@ -101,21 +101,21 @@ Buffer.php
-
- 84.48% covered (warning) +
+ 85.94% covered (warning)
-
84.48%
-
49 / 58
+
85.94%
+
55 / 64
-
- 75.00% covered (warning) +
+ 78.95% covered (warning)
-
75.00%
-
12 / 16
+
78.95%
+
15 / 19
0.00% covered (danger) @@ -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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/build/html-coverage/dashboard.html b/build/html-coverage/dashboard.html index fe241cc..e71531c 100644 --- a/build/html-coverage/dashboard.html +++ b/build/html-coverage/dashboard.html @@ -57,24 +57,28 @@

Insufficient Coverage

- Attestto\SolanaPhpSdk\Accounts\NameRegistryStateAccount0% Attestto\SolanaPhpSdk\Accounts\NtfRecordAccount0% Attestto\SolanaPhpSdk\Exceptions\SNSError0% Attestto\SolanaPhpSdk\Exceptions\TodoException0% Attestto\SolanaPhpSdk\Programs\MetaplexProgram0% - Attestto\SolanaPhpSdk\State\Mint0% + Attestto\SolanaPhpSdk\Programs\SplToken\State\Mint0% Attestto\SolanaPhpSdk\Util\NonceInformation0% Attestto\SolanaPhpSdk\Util\Signer0% + Attestto\SolanaPhpSdk\Programs\SNS\Bindings0% Attestto\SolanaPhpSdk\Programs\DidSolProgram31% Attestto\SolanaPhpSdk\Programs\SystemProgram47% + Attestto\SolanaPhpSdk\Connection63% Attestto\SolanaPhpSdk\Util\Commitment63% + Attestto\SolanaPhpSdk\Programs\SNS\Utils66% Attestto\SolanaPhpSdk\Borsh\BorshDeserializable68% Attestto\SolanaPhpSdk\Borsh\BinaryWriter69% Attestto\SolanaPhpSdk\Borsh\Borsh72% Attestto\SolanaPhpSdk\Borsh\BinaryReader83% - Attestto\SolanaPhpSdk\Util\Buffer84% + Attestto\SolanaPhpSdk\Util\Buffer85% + Attestto\SolanaPhpSdk\Programs\SNS\Instructions\Instructions85% Attestto\SolanaPhpSdk\Transaction85% Attestto\SolanaPhpSdk\Borsh\BorshSerializable87% + Attestto\SolanaPhpSdk\Programs\SnsProgram88% Attestto\SolanaPhpSdk\PublicKey89% @@ -95,16 +99,20 @@

Project Risks

Attestto\SolanaPhpSdk\Transaction100 Attestto\SolanaPhpSdk\Programs\DidSolProgram78 Attestto\SolanaPhpSdk\Borsh\Borsh70 - Attestto\SolanaPhpSdk\Util\Buffer43 + Attestto\SolanaPhpSdk\Util\Buffer46 + Attestto\SolanaPhpSdk\Programs\SNS\Utils34 Attestto\SolanaPhpSdk\Accounts\NtfRecordAccount30 Attestto\SolanaPhpSdk\PublicKey27 Attestto\SolanaPhpSdk\Borsh\BinaryWriter25 + Attestto\SolanaPhpSdk\Connection23 Attestto\SolanaPhpSdk\Borsh\BinaryReader22 Attestto\SolanaPhpSdk\Programs\SystemProgram17 Attestto\SolanaPhpSdk\Borsh\BorshDeserializable14 - Attestto\SolanaPhpSdk\Accounts\NameRegistryStateAccount12 + Attestto\SolanaPhpSdk\Programs\SNS\Instructions\Instructions13 + Attestto\SolanaPhpSdk\Programs\SNS\Bindings12 Attestto\SolanaPhpSdk\Util\Commitment7 Attestto\SolanaPhpSdk\Borsh\BorshSerializable3 + Attestto\SolanaPhpSdk\Programs\SnsProgram2 @@ -142,8 +150,6 @@

Insufficient Coverage

- retrieve0% - deserialize0% deserialize0% retrieve0% findKey0% @@ -156,6 +162,7 @@

Insufficient Coverage

writeF320% writeArray0% requestAirdrop0% + getProgramAccounts0% __construct0% __construct0% isProgramId0% @@ -165,17 +172,17 @@

Insufficient Coverage

parse0% getRpcEndpointFromShortcut0% getProgramAccounts0% + fromBuffer0% getBalance0% getConfirmedTransaction0% getTransaction0% createAccount0% default0% equals0% - getRandomKey0% - fromBuffer0% + getRandomKey0% addSignature0% verifySignatures0% - splice0% + splice0% confirmed0% processed0% __toString0% @@ -185,29 +192,37 @@

Insufficient Coverage

getSecretKey0% __isset0% __unset0% + createSubdomain0% + reverseLookup0% + deserializeReverse0% toPublicKey40% serializeObject41% deserializeObject57% add57% - value60% + value60% + transferInstruction60% signature66% toSecretKey66% - computedFormat70% + computedFormat70% + getDomainKeySync70% _serialize70% _verifySignature71% serializeField72% getAccountInfo75% _addSignature75% serialize75% - validateResponse77% + validateResponse77% readBuffer80% __construct81% - createAssociatedTokenAccountInstruction84% + createInstruction84% + createAssociatedTokenAccountInstruction84% simulateTransaction85% getAssociatedTokenAddressSync85% __construct85% - __construct86% + __construct86% __get87% + retrieve88% + __construct88% @@ -227,27 +242,32 @@

Project Risks

parse42 getRpcEndpointFromShortcut30 serializeField18 - computedFormat17 + computedFormat17 retrieve12 __unset12 + createSubdomain12 + getDomainKeySync11 serializeObject9 - __construct9 + __construct9 deserializeObject8 + transferInstruction8 _serialize8 - validateResponse7 - retrieve6 + validateResponse7 writeArray6 equals6 addSignature6 __isset6 + reverseLookup6 + deserializeReverse6 _verifySignature5 add5 __construct5 toPublicKey4 - value3 + createInstruction4 + value3 serialize3 getAssociatedTokenAddressSync3 - createAssociatedTokenAccountInstruction3 + createAssociatedTokenAccountInstruction3 __get3 signature2 toSecretKey2 @@ -255,6 +275,8 @@

Project Risks

_addSignature2 readBuffer2 simulateTransaction2 + retrieve2 + __construct2 __construct2 @@ -265,7 +287,7 @@

Project Risks

@@ -284,7 +306,7 @@

Project Risks

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

Project Risks

.yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([43,0,0,0,0,2,2,3,8,8,7,113], "Method Coverage")) + .datum(getCoverageDistributionData([45,0,0,0,0,2,2,4,9,11,8,123], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -352,7 +374,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>"],[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')) + .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,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>"],[63.1578947368421,14,"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>"],[90,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount<\/a>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SnsProgram<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint<\/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>"],[85.97285067873304,82,"Attestto\\SolanaPhpSdk\\Transaction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\TransactionInstruction<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Util\\AccountMeta<\/a>"],[85.9375,42,"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,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings<\/a>"],[85.94594594594595,13,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions<\/a>"],[66.66666666666666,20,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils<\/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); @@ -376,7 +398,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>"],[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')) + .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,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\\Connection::getProgramAccounts<\/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>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::retrieve<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::deserialize<\/a>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SnsProgram::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::fromBuffer<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::getAccount<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint::fromBuffer<\/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\\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,2,"Attestto\\SolanaPhpSdk\\Util\\Buffer::concat<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::fromArray<\/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>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::alloc<\/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,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createSubdomain<\/a>"],[84.12698412698413,4,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::createInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::updateInstruction<\/a>"],[60,6,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::transferInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::reallocInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::deleteInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::loadConstants<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getHashedNameSync<\/a>"],[92.3076923076923,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>"],[70,9,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getDomainKeySync<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::_deriveSync<\/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 2b140ca..b4484b9 100644 --- a/build/html-coverage/index.html +++ b/build/html-coverage/index.html @@ -44,57 +44,57 @@ Total
-
- 78.69% covered (warning) +
+ 77.27% covered (warning)
-
78.69%
-
746 / 948
+
77.27%
+
962 / 1245
-
- 60.75% covered (warning) +
+ 60.29% covered (warning)
-
60.75%
-
113 / 186
+
60.29%
+
123 / 204
-
- 35.90% covered (danger) +
+ 32.56% covered (danger)
-
35.90%
-
14 / 39
+
32.56%
+
14 / 43
Accounts
-
- 13.04% covered (danger) +
+ 21.43% covered (danger)
-
13.04%
-
3 / 23
+
21.43%
+
3 / 14
-
- 37.50% covered (danger) +
+ 50.00% covered (danger)
-
37.50%
-
3 / 8
+
50.00%
+
3 / 6
-
- 60.00% covered (warning) +
+ 75.00% covered (warning)
-
60.00%
-
3 / 5
+
75.00%
+
3 / 4
@@ -153,93 +153,52 @@
0 / 2
- - Interfaces - -
n/a
-
0 / 0
- -
n/a
-
0 / 0
- -
n/a
-
0 / 0
- - Programs
-
- 61.75% covered (warning) -
-
- -
61.75%
-
113 / 183
-
-
- 36.84% covered (danger) +
+ 69.09% covered (warning)
-
36.84%
-
7 / 19
+
69.09%
+
333 / 482
-
- 0.00% covered (danger) -
-
- -
0.00%
-
0 / 6
- - - - State -
-
- 90.91% covered (success) +
+ 42.11% covered (danger)
-
90.91%
-
10 / 11
-
-
- 66.67% covered (warning) -
-
- -
66.67%
-
2 / 3
+
42.11%
+
16 / 38
-
- 50.00% covered (danger) +
+ 7.69% covered (danger)
-
50.00%
-
1 / 2
+
7.69%
+
1 / 13
Util
-
- 83.19% covered (warning) +
+ 84.03% covered (warning)
-
83.19%
-
94 / 113
+
84.03%
+
100 / 119
-
- 64.71% covered (warning) +
+ 67.57% covered (warning)
-
64.71%
-
22 / 34
+
67.57%
+
25 / 37
60.00% covered (warning) @@ -279,23 +238,23 @@ - Connection.php -
-
- 92.31% covered (success) + Connection.php +
+
+ 63.16% covered (warning)
-
92.31%
-
24 / 26
+
63.16%
+
24 / 38
-
- 77.78% covered (warning) +
+ 70.00% covered (warning)
-
77.78%
-
7 / 9
+
70.00%
+
7 / 10
0.00% covered (danger) @@ -515,7 +474,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:31:53 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 3:59:51 UTC 2024.

diff --git a/docs/SPL-Token-Program.md b/docs/SPL-Token-Program.md new file mode 100644 index 0000000..c049d28 --- /dev/null +++ b/docs/SPL-Token-Program.md @@ -0,0 +1,4 @@ +# SPL-Token Program PHP-SDK Annotations & Usage + +## Instructions + diff --git a/docs/SplToken/SplTokenTest.php b/docs/SplToken/SplTokenTest.php deleted file mode 100644 index 8383dc5..0000000 --- a/docs/SplToken/SplTokenTest.php +++ /dev/null @@ -1,59 +0,0 @@ -assembleClient('POST', []); - $this->splTokenProgram = new SplTokenProgram($client); - } - -// public function testGetAssociatedTokenAddressSync() -// { -// $mockMint = $this->createMock(PublicKey::class); -// $mockOwner = $this->createMock(PublicKey::class); -// $mockOwner->method('toBuffer')->willReturn('buffer'); -// $mockOwner->method('isOnCurve')->willReturn(true); -// -// $mockProgramId = 'programId'; -// $mockAssociatedTokenProgramId = 'associatedTokenProgramId'; -// -// $result = $this->splToken->getAssociatedTokenAddressSync( -// $mockMint, -// $mockOwner, -// false, -// $mockProgramId, -// $mockAssociatedTokenProgramId -// ); -// -// $this->assertInstanceOf(PublicKey::class, $result); -// } -// -// public function testGetAssociatedTokenAddressSyncThrowsException() -// { -// $this->expectException(TokenOwnerOffCurveError::class); -// -// $mockMint = $this->createMock(PublicKey::class); -// $mockOwner = $this->createMock(PublicKey::class); -// $mockOwner->method('toBuffer')->willReturn('buffer'); -// $mockOwner->method('isOnCurve')->willReturn(false); -// -// $mockProgramId = 'programId'; -// $mockAssociatedTokenProgramId = 'associatedTokenProgramId'; -// -// $this->splToken->getAssociatedTokenAddressSync( -// $mockMint, -// $mockOwner, -// false, -// $mockProgramId, -// $mockAssociatedTokenProgramId -// ); -// } -} \ No newline at end of file diff --git a/docs/Web3-js.md b/docs/Web3-js.md new file mode 100644 index 0000000..d16fd4a --- /dev/null +++ b/docs/Web3-js.md @@ -0,0 +1,11 @@ +# Web3.js Solana SDK Annotations & Usage +--------------- + +## SPL Token Program + + -- getOrCreateAssociatedTokenAccount (BE) + +## Vite Configuration + + + diff --git a/src/Accounts/README.md b/src/Accounts/README.md new file mode 100644 index 0000000..6766fb1 --- /dev/null +++ b/src/Accounts/README.md @@ -0,0 +1 @@ +# Accounts == State diff --git a/src/Accounts/Sns/NameRegistryStateAccount.php b/src/Accounts/Sns/NameRegistryStateAccount.php deleted file mode 100644 index 9304ebb..0000000 --- a/src/Accounts/Sns/NameRegistryStateAccount.php +++ /dev/null @@ -1,69 +0,0 @@ - [ - 'kind' => 'struct', - 'fields' => [ - ['parentName', ['u8']], - ['owner', ['u8']], - ['class', ['u8']] - ], - ], - ]; - - public static function retrieve(Connection $connection, PublicKey $nameAccountKey) - { - $nameAccount = $connection->getAccountInfo($nameAccountKey); - if (!$nameAccount) { - throw new SNSError(SNSError::AccountDoesNotExist); - } - - $res = new NameRegistryStateAccount( - self::deserialize($nameAccount['data']) - ); - //$res->data = $nameAccount->data->slice($this->config->SOL_RECORD_SIG_LEN); - - $nftOwner = retrieveNftOwner($connection, $nameAccountKey); - - return ['registry' => $res, 'nftOwner' => $nftOwner]; - } - - public static function deserialize(array $buffer): self - { - return Borsh::deserialize(self::SCHEMA, self::class, $buffer); - } -} - - - diff --git a/src/Connection.php b/src/Connection.php index 41457f5..e36daf6 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -149,5 +149,27 @@ public function requestAirdrop(array $params = []): string return $response = $this->client->call('requestAirdrop', $params ); } + // https://solana.com/docs/rpc/http/getprogramaccounts + // https://sns.guide/domain-name/all-domains.html + public function getProgramAccounts(string $programIdBs58, $dataSlice, $filters) + { + $params = [ + $programIdBs58, + [ + 'dataSlice' => $dataSlice, + 'filters' => $filters, + 'dataSize' => 108, // 'dataSize' => 108 + 'encoding' => 'base64', + 'page' => 1, + 'limit' => 1000 + + ], + + + ]; + return $this->client->call('getProgramAccounts', $params ); + //return $this->client->call('getAssetsByOwner', $params ); + + } } diff --git a/src/Interfaces/AccountKeyInterface.php b/src/Interfaces/AccountKeyInterface.php deleted file mode 100644 index fe4e7e1..0000000 --- a/src/Interfaces/AccountKeyInterface.php +++ /dev/null @@ -1,11 +0,0 @@ -getDomainKeySync($subdomain); + $parent = $domainKeySync['parent']; + $pubkey = $domainKeySync['pubkey']; + + $lamports = $connection->getMinimumBalanceForRentExemption( + $space + NameRegistryStateAccount::SOL_RECORD_SIG_LEN + ); + + $ix_create = $this->createNameRegistry( + $connection, + "\0" . $sub, + $space, + $feePayer ?? $owner, + $owner, + $lamports, + null, + $parent + ); + $ixs[] = $ix_create; + + $reverseKey = $this->getReverseKeySync($subdomain, true); + $info = $connection->getAccountInfo($reverseKey); + if (!$info['data']) { + $reverseName = $this->createReverseName( + $pubkey, + "\0" . $sub, + $feePayer ?? $owner, + $parent, + $owner + ); + $ixs = array_merge($ixs, $reverseName[1]); + } + + return [[], $ixs]; + } +} diff --git a/config/SNS/Constants/config.json b/src/Programs/SNS/Constants/config.json similarity index 100% rename from config/SNS/Constants/config.json rename to src/Programs/SNS/Constants/config.json diff --git a/config/SNS/Constants/record.json b/src/Programs/SNS/Constants/record.json similarity index 100% rename from config/SNS/Constants/record.json rename to src/Programs/SNS/Constants/record.json diff --git a/config/SNS/Instructions.php b/src/Programs/SNS/Instructions/Instructions.php similarity index 73% rename from config/SNS/Instructions.php rename to src/Programs/SNS/Instructions/Instructions.php index 60cd87b..64d23a6 100644 --- a/config/SNS/Instructions.php +++ b/src/Programs/SNS/Instructions/Instructions.php @@ -1,59 +1,55 @@ length))->toBuffer(), + Buffer::fromArray([0]), // Create Instruction code 0 + new Buffer(count($hashed_name), Buffer::TYPE_INT, false), $hashed_name, - $lamports->toBuffer(), - $space->toBuffer() + $lamports, + $space ]; $data = Buffer::concat($buffers); @@ -117,11 +113,11 @@ function createInstruction( ]; } - return new TransactionInstruction([ - 'keys' => $keys, - 'programId' => $nameProgramId, - 'data' => $data - ]); + return new TransactionInstruction( + new PublicKey($nameProgramId), + $keys, + $data + ); } @@ -130,22 +126,23 @@ function createInstruction( * * @param PublicKey $nameProgramId The public key of the name program. * @param PublicKey $nameAccountKey The public key of the name account. - * @param Numberu32 $offset The offset. + * @param $offset The offset. * @param Buffer $input_data The input data. * @param PublicKey $nameUpdateSigner The public key of the name update signer. * @return TransactionInstruction The created transaction instruction. + * @throws InputValidationException */ function updateInstruction( PublicKey $nameProgramId, PublicKey $nameAccountKey, - Numberu32 $offset, + Buffer $offset, Buffer $input_data, PublicKey $nameUpdateSigner ): TransactionInstruction { $buffers = [ Buffer::fromArray([1]), - $offset->toBuffer(), - (new Numberu32($input_data->length))->toBuffer(), + $offset, + new Buffer(count($input_data), Buffer::TYPE_INT, false), $input_data ]; @@ -163,11 +160,11 @@ function updateInstruction( ] ]; - return new TransactionInstruction([ - 'keys' => $keys, - 'programId' => $nameProgramId, - 'data' => $data - ]); + return new TransactionInstruction( + new PublicKey($nameProgramId), + $keys, + $data + ); } @@ -182,6 +179,7 @@ function updateInstruction( * @param PublicKey|null $nameParent The public key of the name parent. * @param PublicKey|null $parentOwner The public key of the parent owner. * @return TransactionInstruction The created transaction instruction. + * @throws InputValidationException */ function transferInstruction( PublicKey $nameProgramId, @@ -234,11 +232,11 @@ function transferInstruction( ]; } - return new TransactionInstruction([ - 'keys' => $keys, - 'programId' => $nameProgramId, - 'data' => $data - ]); + return new TransactionInstruction( + new PublicKey($nameProgramId), + $keys, + $data + ); } @@ -250,8 +248,9 @@ function transferInstruction( * @param PublicKey $payerKey The public key of the payer. * @param PublicKey $nameAccountKey The public key of the name account. * @param PublicKey $nameOwnerKey The public key of the name owner. - * @param Numberu32 $space The amount of space. + * @param Buffer $space A Buffer instance that should represent a 32-bit unsigned integer. * @return TransactionInstruction The created transaction instruction. + * @throws InputValidationException */ function reallocInstruction( PublicKey $nameProgramId, @@ -259,11 +258,11 @@ function reallocInstruction( PublicKey $payerKey, PublicKey $nameAccountKey, PublicKey $nameOwnerKey, - Numberu32 $space + Buffer $space ): TransactionInstruction { $buffers = [ Buffer::fromArray([4]), - $space->toBuffer() + $space ]; $data = Buffer::concat($buffers); @@ -290,11 +289,11 @@ function reallocInstruction( ] ]; - return new TransactionInstruction([ - 'keys' => $keys, - 'programId' => $nameProgramId, - 'data' => $data - ]); + return new TransactionInstruction( + new PublicKey($nameProgramId), + $keys, + $data + ); } /** @@ -335,11 +334,11 @@ function deleteInstruction( ] ]; - return new TransactionInstruction([ - 'keys' => $keys, - 'programId' => $nameProgramId, - 'data' => $data - ]); + return new TransactionInstruction( + new PublicKey($nameProgramId), + $keys, + $data + ); } diff --git a/src/Programs/SNS/State/NameRegistryStateAccount.php b/src/Programs/SNS/State/NameRegistryStateAccount.php new file mode 100644 index 0000000..2b124a2 --- /dev/null +++ b/src/Programs/SNS/State/NameRegistryStateAccount.php @@ -0,0 +1,69 @@ + [ + 'kind' => 'struct', + 'fields' => [ + ['parentName', 'pubkey'], + ['owner', 'pubkey'], + ['class', 'pubkey'] + ], + ], + ]; + const SOL_RECORD_SIG_LEN = 96; // HEADER_LEN + + /** + * @throws SNSError + * @throws AccountNotFoundException + */ + public static function retrieve(Connection $connection, string $nameAccountKey): array + { + $nameAccount = $connection->getAccountInfo($nameAccountKey); + if (!$nameAccount) { + throw new SNSError(SNSError::AccountDoesNotExist); + } + + $base64String = base64_decode($nameAccount['data'][0]); + $uint8Array = array_values(unpack('C*', $base64String)); + $dataBuffer = Buffer::from($base64String); + + $res = NameRegistryStateAccount::deserialize($dataBuffer->toArray()); + + $res->data = $dataBuffer->slice(self::SOL_RECORD_SIG_LEN); + // TODO: Implement retrieveNftOwner + //$nftOwner = retrieveNftOwner($connection, $nameAccountKey); + + return ['registry' => $res, 'nftOwner' => false]; + } + + public static function deserialize(array $buffer): self + { + return Borsh::deserialize(self::SCHEMA, self::class, $buffer); + } +} + + + diff --git a/config/SNS/Deprecated/Utils.php b/src/Programs/SNS/Utils.php similarity index 79% rename from config/SNS/Deprecated/Utils.php rename to src/Programs/SNS/Utils.php index fbdc22e..e6344ba 100644 --- a/config/SNS/Deprecated/Utils.php +++ b/src/Programs/SNS/Utils.php @@ -1,21 +1,15 @@ config = $config; - } else { - $this->config = $this->loadConstants(); - } - $sns_records_id = new PublicKey($this->config['BONFIDA_SNS_RECORDS_ID']); - - $this->centralStateSNSRecords = PublicKey::findProgramAddressSync( - [$sns_records_id], - $sns_records_id); - - return $this; - } private function loadConstants() { @@ -49,7 +28,7 @@ private function loadConstants() public function getHashedNameSync(string $name): Buffer { $input = $this->config['HASH_PREFIX'] . $name; - $hashed = hash('sha256', Buffer::from($input)); + $hashed = hash('sha256', Buffer::from($input), true); return Buffer::from($hashed); } @@ -59,7 +38,7 @@ public function getHashedNameSync(string $name): Buffer * @param PublicKey|null $nameParent The name parent public key * @return PublicKey The public key of the name account * @throws InputValidationException - * @deprecated Use {@link getNameAccountKeySync} instead + * */ public function getNameAccountKeySync( Buffer $hashed_name, @@ -67,19 +46,20 @@ public function getNameAccountKeySync( PublicKey $nameParent = null ): PublicKey { $seeds = [$hashed_name]; + $programIdPublicKey = new PublicKey($this->config['NAME_PROGRAM_ID']); if ($nameClass) { $seeds[] = $nameClass->toBuffer(); } else { - $seeds[] = str_repeat("\0", 32); + $seeds[] = Buffer::alloc(32); } if ($nameParent) { $seeds[] = $nameParent->toBuffer(); } else { - $seeds[] = str_repeat("\0", 32); + $seeds[] = Buffer::alloc(32); } [$nameAccountKey] = PublicKey::findProgramAddressSync( $seeds, - new PublicKey($this->config['NAME_PROGRAM_ID']) + $programIdPublicKey ); return $nameAccountKey; } @@ -131,7 +111,7 @@ function getDomainKeySync(string $domain, ?string $record = null): array { $prefix = $record ? $record : "\x00"; $sub = $prefix . $splitted[0]; $parentKey = $this->_deriveSync($splitted[1])['pubkey']; - $result = $this->_deriveSync($sub, new PublicKey($parentKey), new PublicKey($recordClass)); + $result = $this->_deriveSync($sub, $parentKey, $recordClass); return array_merge($result, ['isSub' => true, 'parent' => $parentKey]); } else if (count($splitted) === 3 && $record) { // Parent key @@ -154,7 +134,7 @@ function _deriveSync(string $name, PublicKey $parent = null, PublicKey $classKey // Assuming these functions exist elsewhere in your codebase $hashedDomainName = $this->getHashedNameSync($name); $pubkey = $this->getNameAccountKeySync($hashedDomainName, $classKey, $parent ?: new PublicKey($this->config['ROOT_DOMAIN_ACCOUNT'])); - return ['pubkey' => $pubkey, 'hashed' => $hashed]; + return ['pubkey' => $pubkey, 'hashed' => $hashedDomainName]; } } diff --git a/src/Programs/SnsProgram.php b/src/Programs/SnsProgram.php new file mode 100644 index 0000000..be4df0c --- /dev/null +++ b/src/Programs/SnsProgram.php @@ -0,0 +1,40 @@ +config = $config; + } else { + $this->config = $this->loadConstants(); + } + $sns_records_id = new PublicKey($this->config['BONFIDA_SNS_RECORDS_ID']); + + $this->centralStateSNSRecords = PublicKey::findProgramAddressSync( + [$sns_records_id], + $sns_records_id); + + return $this; + } + + +} diff --git a/src/Programs/SplToken/Actions/SPLTokenActions.php b/src/Programs/SplToken/Actions/SPLTokenActions.php index 467ca19..f945aec 100644 --- a/src/Programs/SplToken/Actions/SPLTokenActions.php +++ b/src/Programs/SplToken/Actions/SPLTokenActions.php @@ -8,13 +8,12 @@ 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\Programs\SplToken\State\Account; use Attestto\SolanaPhpSdk\PublicKey; -use Attestto\SolanaPhpSdk\State\Account; use Attestto\SolanaPhpSdk\Transaction; use Attestto\SolanaPhpSdk\Util\Commitment; use Attestto\SolanaPhpSdk\Util\ConfirmOptions; diff --git a/src/Programs/SplToken/Instructions/SPLTokenInstructions.php b/src/Programs/SplToken/Instructions/SPLTokenInstructions.php index 2fa88a8..911c390 100644 --- a/src/Programs/SplToken/Instructions/SPLTokenInstructions.php +++ b/src/Programs/SplToken/Instructions/SPLTokenInstructions.php @@ -3,13 +3,11 @@ namespace Attestto\SolanaPhpSdk\Programs\SplToken\Instructions; use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; -use Attestto\SolanaPhpSdk\Programs\SplTokenProgram; use Attestto\SolanaPhpSdk\Programs\SystemProgram; use Attestto\SolanaPhpSdk\PublicKey; use Attestto\SolanaPhpSdk\TransactionInstruction; use Attestto\SolanaPhpSdk\Util\AccountMeta; use Attestto\SolanaPhpSdk\Util\Buffer; -use Attestto\SolanaPhpSdk\Programs\SplToken\Instructions\TokenInstruction; trait SPLTokenInstructions { @@ -57,18 +55,18 @@ public function createAssociatedTokenAccountInstruction( * @param PublicKey $owner * @param PublicKey $mint * @param Buffer $instructionData - * @param string|null $programId - * @param string|null $associatedTokenProgramId + * @param string|PublicKey|null $programId + * @param string|PublicKey|null $associatedTokenProgramId * @return TransactionInstruction */ public function buildAssociatedTokenAccountInstruction( - PublicKey $payer, - PublicKey $associatedToken, - PublicKey $owner, - PublicKey $mint, - Buffer $instructionData, - $programId = new PublicKey(self::TOKEN_PROGRAM_ID), - $associatedTokenProgramId = new PublicKey(self::ASSOCIATED_TOKEN_PROGRAM_ID) + PublicKey $payer, + PublicKey $associatedToken, + PublicKey $owner, + PublicKey $mint, + Buffer $instructionData, + string|PublicKey|null $programId = new PublicKey(self::TOKEN_PROGRAM_ID), + string|PublicKey|null $associatedTokenProgramId = new PublicKey(self::ASSOCIATED_TOKEN_PROGRAM_ID) ): TransactionInstruction { @@ -95,7 +93,6 @@ public function buildAssociatedTokenAccountInstruction( */ function createSyncNativeInstruction(PublicKey $owner, string $programId = self::TOKEN_PROGRAM_ID): TransactionInstruction { - $keys = [ new AccountMeta($owner, false, true), ]; diff --git a/src/State/Account.php b/src/Programs/SplToken/State/Account.php similarity index 97% rename from src/State/Account.php rename to src/Programs/SplToken/State/Account.php index 653420c..41a8aee 100644 --- a/src/State/Account.php +++ b/src/Programs/SplToken/State/Account.php @@ -1,6 +1,6 @@ 'application/json', ], 'body' => $body, + ]; $response = $this->httpClient->request('POST', $this->endpoint, $options); @@ -118,6 +119,7 @@ public function buildRpc(string $method, array $params): array 'id' => $this->randomKey, 'method' => $method, 'params' => $params, + ]; } diff --git a/src/Transaction.php b/src/Transaction.php index cd7cbe2..4182ce7 100644 --- a/src/Transaction.php +++ b/src/Transaction.php @@ -87,7 +87,7 @@ public function add(...$items): Transaction { foreach ($items as $item) { if ($item instanceof TransactionInstruction) { - array_push($this->instructions, $item); + $this->instructions[] = $item; } elseif ($item instanceof Transaction) { array_push($this->instructions, ...$item->instructions); } else { diff --git a/src/Util/Buffer.php b/src/Util/Buffer.php index 8c71062..a23b3e7 100644 --- a/src/Util/Buffer.php +++ b/src/Util/Buffer.php @@ -10,6 +10,7 @@ /** * A convenient wrapper class around an array of bytes (int's). + * */ class Buffer implements Countable { @@ -45,6 +46,7 @@ class Buffer implements Countable */ protected ?string $datatype = null; + /** * @param mixed $value */ @@ -81,11 +83,33 @@ public function __construct($value = null, ?string $datatype = null, ?bool $sign } } + /** + * @throws InputValidationException + */ + public static function concat(array $buffers): static + { + $data = []; + foreach ($buffers as $buffer) { + $data = array_merge($data, $buffer->toArray()); + } + + return new static($data); + } + + /** + * @throws InputValidationException + */ + public static function fromArray(array $array): static + { + return new static($array); + } + /** * For convenience. * * @param $value * @return Buffer + * @throws InputValidationException */ public static function from($value = null, ?string $format = null, ?bool $signed = null): Buffer { @@ -97,6 +121,7 @@ public static function from($value = null, ?string $format = null, ?bool $signed * * @param string $value * @return Buffer + * @throws InputValidationException */ public static function fromBase58(string $value): Buffer { @@ -239,7 +264,7 @@ public function value(?int $length = null) * @return string * @throws InputValidationException */ - protected function computedFormat() + protected function computedFormat(): string { if (! $this->datatype) { throw new InputValidationException('Trying to calculate format of unspecified buffer. Please specify a datatype.'); @@ -256,4 +281,14 @@ protected function computedFormat() } } + /** + * @return Buffer + * @throws InputValidationException + */ + public static function alloc(int $size): Buffer + { + return new static(array_fill(0, $size, 0)); + + } + } diff --git a/temp/SNS/Constants/config.json b/temp/SNS/Constants/config.json new file mode 100644 index 0000000..a1005a7 --- /dev/null +++ b/temp/SNS/Constants/config.json @@ -0,0 +1,92 @@ +{ + "SYSTEM_PROGRAM_ID": "11111111111111111111111111111111", + "NAME_PROGRAM_ID": "namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX", + "HASH_PREFIX": "SPL Name Service", + "ROOT_DOMAIN_ACCOUNT": "58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx", + "REGISTER_PROGRAM_ID": "jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR", + "PYTH_FIDA_PRICE_ACC": "ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF", + "BONFIDA_FIDA_BNB": "AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc", + "REVERSE_LOOKUP_CLASS": "33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z", + "TWITTER_VERIFICATION_AUTHORITY": "FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi", + "TWITTER_ROOT_PARENT_REGISTRY_KEY": "4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv", + "SOL_RECORD_SIG_LEN": 96, + "BONFIDA_USDC_BNB": "DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7", + "USDC_MINT": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", + "REFERRERS": { + "test_wallet": "3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1", + "4everland": "DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs", + "bandit_network": "ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW", + "altoscan": "2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP", + "solscan": "5PwNeqQPiygQks9R17jUAodZQNuhvCqqkrxSaeNE8qTR", + "domain_labs": "8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF", + "solflare": "HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u", + "solnames": "7hMiiUtkH4StMPJxyAtvzXTUjecTniQ8czkCPusf5eSW", + "brave": "DGpjHo4yYA3NgHvhHTp3XfBFrESsx1DnhfTr8D881ZBM", + "585_eth": "7vWSqSw1eCXZXXUubuHWssXELNQ8MLaDgAs2ErEfCKxn", + "wdotsol": "5F6gcdzpw7wUjNEugdsD4aLJdEQ4Wt8d6E85vaQXZQSJ", + "godid": "XEy9o73JBN2pEuN7aspe8mVLaWbL4ozjJs1tNRxx8bL" + }, + "TOKENS_SYM_MINT": { + "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v": "USDC", + "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB": "USDT", + "So11111111111111111111111111111111111111112": "SOL", + "EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp": "FIDA", + "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So": "MSOL", + "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263": "BONK", + "EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz": "BAT", + "HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3": "PYTH", + "bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1": "BSOL", + "6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB": "INJ" + }, + "PYTH_FEEDS": { + "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v": { + "price": "Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD", + "product": "8GWTTbNiXdmyZREXbjsZBmCRuzdPrW55dnZGDkTRjWvb" + }, + "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB": { + "price": "3vxLXJqLqF3JG5TCbYycbKWRBbCJQLxQmBGCkyqEEefL", + "product": "Av6XyAMJnyi68FdsKSPYgzfXGjYrrt6jcAMwtvzLCqaM" + }, + "So11111111111111111111111111111111111111112": { + "price": "H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG", + "product": "ALP8SdU9oARYVLgLR7LrqMNCYBnhtnQz1cj6bwgwQmgj" + }, + "EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp": { + "price": "ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF", + "product": "HyEB4Goiv7QyfFStaBn49JqQzSTV1ybtVikwsMLH1f2M" + }, + "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So": { + "price": "E4v1BBgoso9s64TQvmyownAVJbhbEPGyzA3qn4n46qj9", + "product": "BS2iAqT67j8hA9Jji4B8UpL3Nfw9kwPfU5s4qeaf1e7r" + }, + "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263": { + "price": "8ihFLu5FimgTQ1Unh4dVyEHUGodJ5gJQCrQf4KUVB9bN", + "product": "FerFD54J6RgmQVCR5oNgpzXmz8BW2eBNhhirb1d5oifo" + }, + "EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz": { + "price": "AbMTYZ82Xfv9PtTQ5e1fJXemXjzqEEFHP3oDLRTae6yz", + "product": "8xTEctXKo6Xo3EzNhSNp4TUe8mgfwWFbDUXJhuubvrKx" + }, + "HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3": { + "price": "nrYkQQQur7z8rYTST3G9GqATviK5SxTDkrqd21MW6Ue", + "product": "AiQB4WngNPKDe3iWAwZmMzbULDAAfUD6Sr1knfZNJj3y" + }, + "bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1": { + "price": "AFrYBhb5wKQtxRS9UA9YRS4V3dwFm7SqmS6DHKq6YVgo", + "product": "3RtUHQR2LQ7su5R4zWwjupx72sWRGvLA4cFmnbHnT9M7" + }, + "6McPRfPV6bY1e9hLxWyG54W9i9Epq75QBvXg2oetBVTB": { + "price": "9EdtbaivHQYA4Nh3XzGR6DwRaoorqXYnmpfsnFhvwuVj", + "product": "5Q5kyCVzssrGMd2BniSdVeRwjNWrGGrFhMrgGt4zURyA" + } + }, + "PYTH_MAPPING_ACC": "AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J", + "VAULT_OWNER_DEPRECATED": "GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi", + "VAULT_OWNER": "5D2zKog251d6KPCyFyLMt3KroWwXXPWSgTPyhV22K2gR", + "CUSTOM_BG_TLD": "BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz", + "WOLVES_COLLECTION_METADATA": "72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT", + "METAPLEX_ID": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", + "NAME_TOKENIZER_ID" : "nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk", + "MINT_PREFIX": "tokenized_name", + "BONFIDA_SNS_RECORDS_ID": "HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ" +} \ No newline at end of file diff --git a/temp/SNS/Constants/record.json b/temp/SNS/Constants/record.json new file mode 100644 index 0000000..5d6d777 --- /dev/null +++ b/temp/SNS/Constants/record.json @@ -0,0 +1,42 @@ +{ + "Record": { + "IPFS": "IPFS", + "ARWV": "ARWV", + "SOL": "SOL", + "ETH": "ETH", + "BTC": "BTC", + "LTC": "LTC", + "DOGE": "DOGE", + "Email": "email", + "Url": "url", + "Discord": "discord", + "Github": "github", + "Reddit": "reddit", + "Twitter": "twitter", + "Telegram": "telegram", + "Pic": "pic", + "SHDW": "SHDW", + "POINT": "POINT", + "BSC": "BSC", + "Injective": "INJ", + "Backpack": "backpack", + "A": "A", + "AAAA": "AAAA", + "CNAME": "CNAME", + "TXT": "TXT", + "Background": "background" + }, + "RECORD_V1_SIZE": { + "SOL": 96, + "ETH": 20, + "BSC": 20, + "Injective": 20, + "A": 4, + "AAAA": 16, + "Background": 32 + }, + "RecordVersion": { + "V1": 1, + "V2": 2 + } +} diff --git a/config/SNS/InstructionBurn.php b/temp/SNS/InstructionBurn.php similarity index 98% rename from config/SNS/InstructionBurn.php rename to temp/SNS/InstructionBurn.php index 592bdd6..18e3a32 100644 --- a/config/SNS/InstructionBurn.php +++ b/temp/SNS/InstructionBurn.php @@ -1,6 +1,6 @@ 0pQvfE-v3<2q&uvUq{4$=1mV&2oCM zY_%9eydLdj$?Iyeb@p~x4j-0xHlJc>*4tr)3C(IiK?+ELi2^S@AN~A)r$3tiCoM{) zfE0K#1#H-UY&U$VJX`;~p4Y#!>gz@)<8p>yKLJeqD1N1faliP2tjX5N3Qa!(A%lVx H_*Vt)uJaO^ literal 0 HcmV?d00001 diff --git a/tests/Unit/.DS_Store b/tests/Unit/.DS_Store index 2dc1b518f3243146cd67162358550fb5012cd953..a2a5d62eef95f0a2a4ed6fdd3b8228a7f3b0351b 100644 GIT binary patch delta 98 zcmZoMXfc=|&e%S&P;8=}q9_vs0|O%ig8&0V5kn$FE<assertEquals($rawCreateAccountBinary, $bufferable->toArray()); } -} \ No newline at end of file + + /** + * @throws InputValidationException + */ + #[Test] + public function test_concat() + { + $buffer1 = Buffer::from(1, Buffer::TYPE_INT, false); + $buffer2 = Buffer::from(2, Buffer::TYPE_INT, false); + $buffer3 = Buffer::from(3, Buffer::TYPE_INT, false); + + $buffer = Buffer::concat([$buffer1, $buffer2, $buffer3]); + + $this->assertEquals([1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0], $buffer->toArray()); + } + + /** + * @throws InputValidationException + */ + #[Test] + public function test_fromArray() + { + $buffer = Buffer::fromArray([1, 2, 3, 4]); + $this->assertEquals([1, 2, 3, 4], $buffer->toArray()); + } +} diff --git a/tests/Unit/Programs/.DS_Store b/tests/Unit/Programs/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5aa9872c84d5e60422502a2b061ace1922a8e9dd GIT binary patch literal 6148 zcmeHKO>fgc5S?uTai~BMY6TpSEOCuWC3``7-t2CHGzEc>5Q=uB*|#4vv);G%te1$yU>w~c>JX6wWo%wTagOjf>w>J9 zo)%E37?M)jrGg~ATd=krmI2Ga|Hc4+yX!Qhgd+0s-G2Xm3kv9f_9&*3D%zl&_9=gy z%C})ELwIq@cmUn_q69UfYxD&66+CwlDW;F#vcc~}`*bE+15fmn{P{V>&GW6oNtv4` z`yA$JQdYg*u~=y|FI;RnEoaqv?eEKpUj@~;90bKnZtY2#hNtx)e4fOUQD^O;%&H*C z;zBtjQ4Et;FOn>hlYty(QK@`=J>ayR_Na4XI^FDVZFSxLc7N7&r`wyou6yt9{n@PT ztlzr5^KA4!J;>xCbA()pWU1t`!BaRw#Vq=RUu3DwIE}LP6|*@3Wgz#Ln<99YA2;PH zeDgosSaEVD2AWoujREr-I;+dJFuNYhfMwvX8Q}cjLK!`SwMLaXP^c>au!(LZsPm5j z`?v-@gSAGCK!kP$YFA;d7(%s%4By+YdERN4w7y1Uu!gjSr<$}T-$Ew0d d@pY&YjJaF^dIoEa=z-WD0Y!r?ECc_Pfv?kAm=pj2 literal 0 HcmV?d00001 diff --git a/tests/Unit/Programs/MetaPlexProgramTest.php b/tests/Unit/Programs/MetaPlexProgramTest.php new file mode 100644 index 0000000..701c86a --- /dev/null +++ b/tests/Unit/Programs/MetaPlexProgramTest.php @@ -0,0 +1,38 @@ +assembleClient('POST', []); + + $solana = new SystemProgram($client); + + $this->expectException(AccountNotFoundException::class); + $solana->getAccountInfo('abc123'); + } + + + +} diff --git a/tests/Unit/Programs/Sns/DerivationTest.php b/tests/Unit/Programs/Sns/DerivationTest.php new file mode 100644 index 0000000..50eb382 --- /dev/null +++ b/tests/Unit/Programs/Sns/DerivationTest.php @@ -0,0 +1,74 @@ + 'bonfida', + 'address' => 'Crf8hzfthWGbGbLTVCiqRqV5MVnbpHB1L9KQMd6gsinb', + ], + [ + 'domain' => 'bonfida.sol', + 'address' => 'Crf8hzfthWGbGbLTVCiqRqV5MVnbpHB1L9KQMd6gsinb', + ], + [ + 'domain' => 'dex.bonfida', + 'address' => 'HoFfFXqFHAC8RP3duuQNzag1ieUwJRBv1HtRNiWFq4Qu', + ], + [ + 'domain' => 'dex.bonfida.sol', + 'address' => 'HoFfFXqFHAC8RP3duuQNzag1ieUwJRBv1HtRNiWFq4Qu', + ], + ]; + + public function setUp(): void + { + parent::setUp(); + } + + #[Test] + public function test_getHashedNameSync(){ + $client = $this->createMock(SolanaRpcClient::class); + $sns = new SnsProgram($client); + $hashedName = $sns->getHashedNameSync('bonfida'); + $bs58HashedName = $hashedName->toBase58String(); + $this->assertEquals('AcmVjPtaDyNboWGSKjYHxea1QDgN648T4Je3HUpkHecf', $bs58HashedName); + } + + /** + * @throws InputValidationException + */ + #[Test] + public function test_deriveSynch(){ + $client = $this->createMock(SolanaRpcClient::class); + $sns = new SnsProgram($client); + $hashedName = $sns->_deriveSync('bonfida'); + $nameAccountKey = $sns->getNameAccountKeySync($hashedName['hashed']); + $nameAccountKeyBs58 = $nameAccountKey->toBase58(); + $this->assertEquals('85v6oF1VnGNeT4oV2fH8HpVBj3k3U4m6uNnWYT8AcA5H',$nameAccountKeyBs58 ); + } + + #[Test] + public function test_getDomainKeySync() + { + $client = $this->createMock(SolanaRpcClient::class); + $sns = new SnsProgram($client); + foreach ($this->items as $item) { + $result = $sns->getDomainKeySync($item['domain']); + $this->assertInstanceOf(PublicKey::class, $result['pubkey']); + $this->assertEquals($item['address'], $result['pubkey']->toBase58()); + } + } + +} diff --git a/tests/Unit/Programs/Sns/InstructionsTest.php b/tests/Unit/Programs/Sns/InstructionsTest.php new file mode 100644 index 0000000..f25f04a --- /dev/null +++ b/tests/Unit/Programs/Sns/InstructionsTest.php @@ -0,0 +1,163 @@ +createMock(SolanaRpcClient::class); + + $sns = new SnsProgram($client); + $instruction = $sns->createInstruction( + $nameProgramId, + $systemProgramId, + $nameKey, + $nameOwnerKey, + $payerKey, + $hashed_name, + $lamports, + $space, + $nameClassKey, + $nameParent, + $nameParentOwner + ); + + // Assert + $this->assertInstanceOf(TransactionInstruction::class, $instruction); + $this->assertEquals(0, $instruction->data->toArray()[0]); + + // TODO: Add more assertions here to verify the properties of the returned TransactionInstruction + } + + #[Test] + public function test_updateInstruction() + { + // Arrange + $nameProgramId = new PublicKey(Buffer::alloc(32)); + $nameAccountKey = new PublicKey(Buffer::alloc(32)); + $offset = new Buffer(96, Buffer::TYPE_INT, false); + $inputData = new Buffer('INPUT DATA', ); + $nameUpdateSigner = new PublicKey(Buffer::alloc(32)); + + $client = $this->createMock(SolanaRpcClient::class); + + $sns = new SnsProgram($client); + $instruction = $sns->updateInstruction( + $nameProgramId, + $nameAccountKey, + $offset, + $inputData, + $nameUpdateSigner + ); + + // Assert + $this->assertInstanceOf(TransactionInstruction::class, $instruction); + $this->assertEquals(1, $instruction->data->toArray()[0]); + } + + #[Test] + public function test_transferInstruction() + { + // Arrange + $nameProgramId = new PublicKey(Buffer::alloc(32)); + $nameAccountKey = new PublicKey(Buffer::alloc(32)); + $newOwnerKey = new PublicKey(Buffer::alloc(32)); + $currentNameOwnerKey = new PublicKey(Buffer::alloc(32)); + + + $client = $this->createMock(SolanaRpcClient::class); + + $sns = new SnsProgram($client); + $instruction = $sns->transferInstruction( + $nameProgramId, + $nameAccountKey, + $newOwnerKey, + $currentNameOwnerKey, + null, null, null + ); + + // Assert + $this->assertInstanceOf(TransactionInstruction::class, $instruction); + $this->assertEquals(2, $instruction->data->toArray()[0]); + } + + #[Test] + public function test_reallocInstruction() + { + // Arrange + $nameProgramId = new PublicKey(Buffer::alloc(32)); + $systemProgramId = new PublicKey(Buffer::alloc(32)); + $nameAccountKey = new PublicKey(Buffer::alloc(32)); + $currentNameOwnerKey = new PublicKey(Buffer::alloc(32)); + $space = new Buffer(2000, Buffer::TYPE_INT, false); + + $client = $this->createMock(SolanaRpcClient::class); + + $sns = new SnsProgram($client); + $instruction = $sns->reallocInstruction( + $nameProgramId, + $systemProgramId, + $currentNameOwnerKey, // Payer + $nameAccountKey, + $currentNameOwnerKey, + $space + ); + + // Assert + $this->assertInstanceOf(TransactionInstruction::class, $instruction); + $this->assertEquals(4, $instruction->data->toArray()[0]); + } + + #[Test] + public function test_deleteInstruction() + { + // Arrange + $nameProgramId = new PublicKey(Buffer::alloc(32)); + + $nameAccountKey = new PublicKey(Buffer::alloc(32)); + $currentNameOwnerKey = new PublicKey(Buffer::alloc(32)); + + + $client = $this->createMock(SolanaRpcClient::class); + + $sns = new SnsProgram($client); + $instruction = $sns->deleteInstruction( + $nameProgramId, + $nameAccountKey, + $currentNameOwnerKey, // Refund Target + $currentNameOwnerKey + ); + + // Assert + $this->assertInstanceOf(TransactionInstruction::class, $instruction); + $this->assertEquals(3, $instruction->data->toArray()[0]); + } + +} diff --git a/tests/Unit/Programs/Sns/NameRegistryStateTest.php b/tests/Unit/Programs/Sns/NameRegistryStateTest.php new file mode 100644 index 0000000..ea0d260 --- /dev/null +++ b/tests/Unit/Programs/Sns/NameRegistryStateTest.php @@ -0,0 +1,68 @@ + 'bonfida', + 'address' => 'Crf8hzfthWGbGbLTVCiqRqV5MVnbpHB1L9KQMd6gsinb', + ], + [ + 'domain' => 'bonfida.sol', + 'address' => 'Crf8hzfthWGbGbLTVCiqRqV5MVnbpHB1L9KQMd6gsinb', + ], + [ + 'domain' => 'dex.bonfida', + 'address' => 'HoFfFXqFHAC8RP3duuQNzag1ieUwJRBv1HtRNiWFq4Qu', + ], + [ + 'domain' => 'dex.bonfida.sol', + 'address' => 'HoFfFXqFHAC8RP3duuQNzag1ieUwJRBv1HtRNiWFq4Qu', + ], + ]; + + public function setUp(): void + { + parent::setUp(); + } + + #[Test] + public function test_deserialize(){ + $accountData = 'PVPCSzg2DtOBOiPfst/YIKtYIct5KaONLqqyUug4JZXybLcicCAgnC2mdJSPjzwzDuT5o4Yla9FPN6bgxWdUKwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY2x1ZTIuc29sAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=='; + $dataBuffer = Buffer::from(base64_decode($accountData)); + // $accountData = $dataBuffer->slice(96); + $nameRegistryState = NameRegistryStateAccount::deserialize($dataBuffer->toArray()); + $this->assertEquals('58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx', $nameRegistryState->parentName->toBase58()); + $this->assertEquals('HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA', $nameRegistryState->owner->toBase58()); + $this->assertEquals('11111111111111111111111111111111', $nameRegistryState->class->toBase58()); + } + + #[Test] + public function test_retrieve(){ + + $rpcClient = new SolanaRpcClient('https://api.mainnet-beta.solana.com'); + $connection = new Connection($rpcClient); + $nameRegistryState = NameRegistryStateAccount::retrieve($connection, 'Crf8hzfthWGbGbLTVCiqRqV5MVnbpHB1L9KQMd6gsinb'); + $this->assertEquals('HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA', $nameRegistryState['registry']->owner->toBase58()); + $this->assertEquals('58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx', $nameRegistryState['registry']->parentName->toBase58()); + $this->assertEquals('11111111111111111111111111111111', $nameRegistryState['registry']->class->toBase58()); + } + + + + + +} diff --git a/tests/Unit/Programs/SplProgramTest.php b/tests/Unit/Programs/SplProgramTest.php index 290ccf7..e8ee718 100644 --- a/tests/Unit/Programs/SplProgramTest.php +++ b/tests/Unit/Programs/SplProgramTest.php @@ -7,13 +7,13 @@ use Attestto\SolanaPhpSdk\Exceptions\GenericException; use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; use Attestto\SolanaPhpSdk\Keypair; +use Attestto\SolanaPhpSdk\Programs\SplToken\State\Account; use Attestto\SolanaPhpSdk\Programs\SplTokenProgram; use Attestto\SolanaPhpSdk\Programs\SystemProgram; +use Attestto\SolanaPhpSdk\PublicKey; use Attestto\SolanaPhpSdk\SolanaRpcClient; use Attestto\SolanaPhpSdk\Tests\TestCase; use PHPUnit\Framework\Attributes\Test; -use Attestto\SolanaPhpSdk\PublicKey; -use Attestto\SolanaPhpSdk\State\Account; class SplProgramTest extends TestCase From d95c43c8c719211c1d5da0afb740621c4a12fc18 Mon Sep 17 00:00:00 2001 From: Eduardo Chongkan Date: Wed, 8 May 2024 22:28:27 -0600 Subject: [PATCH 2/4] add connection->getMinimumBalanceForRentExcemption() --- src/Connection.php | 4 ++++ tests/Feature/ConnectionFeatureTest.php | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/Connection.php b/src/Connection.php index e36daf6..39bbc52 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -172,4 +172,8 @@ public function getProgramAccounts(string $programIdBs58, $dataSlice, $filters) } + public function getMinimumBalanceForRentExemption(array $params = [1024]){ + return $this->client->call('getMinimumBalanceForRentExemption', $params ); + } + } diff --git a/tests/Feature/ConnectionFeatureTest.php b/tests/Feature/ConnectionFeatureTest.php index efff2b6..07db390 100644 --- a/tests/Feature/ConnectionFeatureTest.php +++ b/tests/Feature/ConnectionFeatureTest.php @@ -185,6 +185,15 @@ public function testGetBalance() $this->assertIsFloat($result); } + #[Test] + public function test_getMinimumBalanceForRentExemption(){ + $client = new SolanaRpcClient($this->endpoint); + $connection = new Connection($client); + $result = $connection->getMinimumBalanceForRentExemption([2000]); + $this->assertIsInt($result); + + } + } From 158897718a64e874377f79c80971b25bf039c2d6 Mon Sep 17 00:00:00 2001 From: Eduardo Chongkan Date: Wed, 8 May 2024 23:36:56 -0600 Subject: [PATCH 3/4] Add test_getReverseKeySync --- src/Connection.php | 4 +- src/Programs/SNS/Bindings.php | 126 ++++++++++++++++++++- src/Programs/SNS/Utils.php | 23 ++++ src/Programs/SnsProgram.php | 2 + tests/Feature/ConnectionFeatureTest.php | 3 +- tests/Unit/Programs/Sns/BindingsTest.php | 77 +++++++++++++ tests/Unit/Programs/Sns/DerivationTest.php | 22 ++++ 7 files changed, 251 insertions(+), 6 deletions(-) create mode 100644 tests/Unit/Programs/Sns/BindingsTest.php diff --git a/src/Connection.php b/src/Connection.php index 39bbc52..821b35c 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -172,8 +172,8 @@ public function getProgramAccounts(string $programIdBs58, $dataSlice, $filters) } - public function getMinimumBalanceForRentExemption(array $params = [1024]){ - return $this->client->call('getMinimumBalanceForRentExemption', $params ); + public function getMinimumBalanceForRentExemption(int $space = 1024){ + return $this->client->call('getMinimumBalanceForRentExemption', [$space] ); } } diff --git a/src/Programs/SNS/Bindings.php b/src/Programs/SNS/Bindings.php index 05a9295..c0f920f 100644 --- a/src/Programs/SNS/Bindings.php +++ b/src/Programs/SNS/Bindings.php @@ -7,15 +7,29 @@ use Attestto\SolanaPhpSdk\Exceptions\AccountNotFoundException; use Attestto\SolanaPhpSdk\Exceptions\SNSError; use Attestto\SolanaPhpSdk\Programs\SNS\State\NameRegistryStateAccount; +use Attestto\SolanaPhpSdk\Programs\SystemProgram; use Attestto\SolanaPhpSdk\PublicKey; +use Attestto\SolanaPhpSdk\TransactionInstruction; +use Attestto\SolanaPhpSdk\Util\Buffer; +use Exception; - +/** + * @method createInstruction($NAME_PROGRAM_ID, $programId, PublicKey $nameAccountKey, PublicKey $nameOwner, PublicKey $payerKey, Buffer $hashed_name, Buffer $param, Buffer $param1, PublicKey|null $nameClass, PublicKey|null $parentName, $nameParentOwner) + * @method getReverseKeySync(string $subdomain, true $true) + * @method createReverseName(mixed $pubkey, string $string, PublicKey $param, mixed $parent, PublicKey $owner) + * @method getNameOwner(Connection $connection, PublicKey $parentName) + * @method retrieve(Connection $connection, mixed $parent) + * @method transferInstruction(mixed $NAME_PROGRAM_ID, mixed $pubkey, PublicKey $newOwner, PublicKey|null $owner, $null, mixed $nameParent, $nameParentOwner) + */ trait Bindings { - use Utils; +// use Utils; +// use Instructions; + /** * @throws SNSError * @throws AccountNotFoundException + * @throws Exception */ public function createSubdomain( Connection $connection, @@ -66,4 +80,112 @@ public function createSubdomain( return [[], $ixs]; } + + /** + * Creates a name account with the given rent budget, allocated space, owner and class. + * + * @param Connection $connection The solana connection object to the RPC node + * @param string $name The name of the new account + * @param int $space The space in bytes allocated to the account + * @param PublicKey $payerKey The allocation cost payer + * @param PublicKey $nameOwner The pubkey to be set as owner of the new name account + * @param int|null $lamports The budget to be set for the name account. If not specified, it'll be the minimum for rent exemption + * @param PublicKey|null $nameClass The class of this new name + * @param PublicKey|null $parentName The parent name of the new name. If specified its owner needs to sign + * @return TransactionInstruction + * @throws Exception + */ + public function createNameRegistry( + Connection $connection, + string $name, + int $space, + PublicKey $payerKey, + PublicKey $nameOwner, + int $lamports = null, + PublicKey $nameClass = null, + PublicKey $parentName = null + ): TransactionInstruction + { + $hashed_name = $this->getHashedNameSync($name); + $nameAccountKey = $this->getNameAccountKeySync($hashed_name, $nameClass, $parentName); + + $balance = $lamports ?: $connection->getMinimumBalanceForRentExemption($space); + + $nameParentOwner = null; + if ($parentName) { + $parentAccount = $this->getNameOwner($connection, $parentName); + $nameParentOwner = $parentAccount['registry']->owner; + } + + return $this->createInstruction( + new PublicKey($this->config['NAME_PROGRAM_ID']), + SystemProgram::programId(), + $nameAccountKey, + $nameOwner, + $payerKey, + $hashed_name, + new Buffer($balance, Buffer::TYPE_LONG, false), + new Buffer($space, Buffer::TYPE_INT, false), + $nameClass, + $parentName, + $nameParentOwner + ); + } + + + + /** + * This function is used to transfer the ownership of a subdomain in the Solana Name Service. + * + * @param Connection $connection The Solana RPC connection object. + * @param string $subdomain The subdomain to transfer. It can be with or without .sol suffix (e.g., 'something.bonfida.sol' or 'something.bonfida'). + * @param PublicKey $newOwner The public key of the new owner of the subdomain. + * @param bool $isParentOwnerSigner A flag indicating whether the parent name owner is signing this transfer. + * @param PublicKey|null $owner The public key of the current owner of the subdomain. This is an optional parameter. If not provided, the owner will be resolved automatically. This can be helpful to build transactions when the subdomain does not exist yet. + * + * @return TransactionInstruction + * @throws Exception + */ + public function transferSubdomain( + Connection $connection, + string $subdomain, + PublicKey $newOwner, + bool $isParentOwnerSigner = false, + PublicKey $owner = null + ): TransactionInstruction + { + $domainKeySync = $this->getDomainKeySync($subdomain); + $pubkey = $domainKeySync['pubkey']; + $isSub = $domainKeySync['isSub']; + $parent = $domainKeySync['parent']; + + if (!$parent || !$isSub) { + throw new SNSError(SNSError::InvalidSubdomain); + } + + if (!$owner) { + $registry = $this->retrieve($connection, $pubkey); + $owner = $registry['registry']->owner; + } + + $nameParent = null; + $nameParentOwner = null; + + if ($isParentOwnerSigner) { + $nameParent = $parent; + $parentAccount = $this->retrieve($connection, $parent); + $nameParentOwner = $parentAccount['registry']->owner; + } + + return $this->transferInstruction( + $this->config['NAME_PROGRAM_ID'], + $pubkey, + $newOwner, + $owner, + null, + $nameParent, + $nameParentOwner + ); + } + } diff --git a/src/Programs/SNS/Utils.php b/src/Programs/SNS/Utils.php index e6344ba..aff2b3d 100644 --- a/src/Programs/SNS/Utils.php +++ b/src/Programs/SNS/Utils.php @@ -137,4 +137,27 @@ function _deriveSync(string $name, PublicKey $parent = null, PublicKey $classKey return ['pubkey' => $pubkey, 'hashed' => $hashedDomainName]; } + + /** + * This function can be used to get the key of the reverse account + * + * @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 + * @throws Exception + * @throws SNSError + * @throws InputValidationException + */ + public function getReverseKeySync(string $domain, bool $isSub = null): PublicKey { + $domainKeySync = $this->getDomainKeySync($domain); + $pubkey = $domainKeySync['pubkey']; + $parent = $domainKeySync['parent']; + $hashedReverseLookup = $this->getHashedNameSync($pubkey->toBase58()); + return $this->getNameAccountKeySync( + $hashedReverseLookup, + new PublicKey($this->config['REVERSE_LOOKUP_CLASS']), + $isSub ? $parent : null + ); + } + } diff --git a/src/Programs/SnsProgram.php b/src/Programs/SnsProgram.php index be4df0c..5002851 100644 --- a/src/Programs/SnsProgram.php +++ b/src/Programs/SnsProgram.php @@ -4,6 +4,7 @@ use Attestto\SolanaPhpSdk\Exceptions\BaseSolanaPhpSdkException; use Attestto\SolanaPhpSdk\Program; +use Attestto\SolanaPhpSdk\Programs\SNS\Bindings; use Attestto\SolanaPhpSdk\Programs\SNS\Utils; use Attestto\SolanaPhpSdk\Programs\SNS\Instructions\Instructions; use Attestto\SolanaPhpSdk\PublicKey; @@ -15,6 +16,7 @@ class SnsProgram extends Program use Instructions; use Utils; + use Bindings; public mixed $config; diff --git a/tests/Feature/ConnectionFeatureTest.php b/tests/Feature/ConnectionFeatureTest.php index 07db390..48e23d1 100644 --- a/tests/Feature/ConnectionFeatureTest.php +++ b/tests/Feature/ConnectionFeatureTest.php @@ -189,9 +189,8 @@ public function testGetBalance() public function test_getMinimumBalanceForRentExemption(){ $client = new SolanaRpcClient($this->endpoint); $connection = new Connection($client); - $result = $connection->getMinimumBalanceForRentExemption([2000]); + $result = $connection->getMinimumBalanceForRentExemption(2000); $this->assertIsInt($result); - } diff --git a/tests/Unit/Programs/Sns/BindingsTest.php b/tests/Unit/Programs/Sns/BindingsTest.php new file mode 100644 index 0000000..31a2489 --- /dev/null +++ b/tests/Unit/Programs/Sns/BindingsTest.php @@ -0,0 +1,77 @@ +createMock(SolanaRpcClient::class); + $connection = $this->createMock(Connection::class); + $sns = new SnsProgram($client); + try { + $instruction = $sns->createSubdomain( + $connection, + 'subdomain', + $nameOwnerKey, + 2000, + $nameOwnerKey + ); + } catch (AccountNotFoundException|SNSError $e) { + $this->fail($e->getMessage()); + } + + // Assert + $this->assertInstanceOf(TransactionInstruction::class, $instruction); + $this->assertEquals(0, $instruction->data->toArray()[0]); + + } + + #[Test] + public function test_createNameRegistry() + { + // Arrange + $nameOwnerSigner = new PublicKey(Buffer::alloc(32)); + + $client = $this->createMock(SolanaRpcClient::class); + $connection = $this->createMock(Connection::class); + $sns = new SnsProgram($client); + + + $instruction = $sns->createNameRegistry( + $connection, + 'domain', + 2000, + $nameOwnerSigner, + $nameOwnerSigner, // could be someone else + null, null, null + ); + + // Assert + $this->assertInstanceOf(TransactionInstruction::class, $instruction); + $this->assertEquals(0, $instruction->data->toArray()[0]); + } + + +} diff --git a/tests/Unit/Programs/Sns/DerivationTest.php b/tests/Unit/Programs/Sns/DerivationTest.php index 50eb382..9317aad 100644 --- a/tests/Unit/Programs/Sns/DerivationTest.php +++ b/tests/Unit/Programs/Sns/DerivationTest.php @@ -5,10 +5,12 @@ use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; +use Attestto\SolanaPhpSdk\Exceptions\SNSError; use Attestto\SolanaPhpSdk\Programs\SnsProgram; use Attestto\SolanaPhpSdk\PublicKey; use Attestto\SolanaPhpSdk\Tests\TestCase; use Attestto\SolanaPhpSdk\SolanaRpcClient; +use PHPUnit\Framework\MockObject\Exception; class DerivationTest extends TestCase { @@ -71,4 +73,24 @@ public function test_getDomainKeySync() } } + /** + * @throws SNSError + * @throws Exception + * @throws InputValidationException + */ + #[Test] + public function test_getReverseKeySync() + { + $client = $this->createMock(SolanaRpcClient::class); + $sns = new SnsProgram($client); + foreach ($this->items as $item) { + $result = $sns->getReverseKeySync($item['domain']); + $this->assertInstanceOf(PublicKey::class, $result); + $this->assertTrue( + $result->toBase58() === 'DqgmWxe2PPrfy45Ja3UPyFGwcbRzkRuwXt3NyxjX8krg' || + $result->toBase58() === 'BrRErziYEA9oBoDyYrdVF9p6Gs1QtdpaZ6AQpaybeZgf' + ); + } + } + } From 6f1208317567f14a131eb75b8b2d93031da49940 Mon Sep 17 00:00:00 2001 From: Eduardo Chongkan Date: Thu, 9 May 2024 03:23:02 -0600 Subject: [PATCH 4/4] Test Bindings + Utils -- createSubdomain --- build/html-coverage/Account.php.html | 10 +- 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 +- .../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 | 32 +- .../html-coverage/Borsh/BinaryWriter.php.html | 26 +- build/html-coverage/Borsh/Borsh.php.html | 54 +-- .../Borsh/BorshDeserializable.php.html | 24 +- .../Borsh/BorshException.php.html | 2 +- .../html-coverage/Borsh/BorshObject.php.html | 2 +- .../Borsh/BorshSerializable.php.html | 16 +- build/html-coverage/Borsh/dashboard.html | 2 +- build/html-coverage/Borsh/index.html | 2 +- build/html-coverage/Connection.php.html | 70 ++- .../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 +- build/html-coverage/Keypair.php.html | 36 +- build/html-coverage/Message.php.html | 74 +-- build/html-coverage/Program.php.html | 6 +- .../Programs/DidSolProgram.php.html | 2 +- .../Programs/MetaplexProgram.php.html | 2 +- .../html-coverage/Programs/SNS/Utils.php.html | 425 +++++++++++------- .../html-coverage/Programs/SNS/dashboard.html | 41 +- build/html-coverage/Programs/SNS/index.html | 100 ++--- .../SplToken/Actions/SPLTokenActions.php.html | 36 +- .../Programs/SplToken/Actions/dashboard.html | 6 +- .../Programs/SplToken/Actions/index.html | 18 +- .../SPLTokenInstructions.php.html | 2 +- .../Instructions/TokenInstruction.php.html | 2 +- .../SplToken/Instructions/dashboard.html | 2 +- .../Programs/SplToken/Instructions/index.html | 2 +- .../Programs/SplToken/dashboard.html | 6 +- .../Programs/SplToken/index.html | 18 +- .../Programs/SplTokenProgram.php.html | 2 +- .../Programs/SystemProgram.php.html | 4 +- build/html-coverage/Programs/dashboard.html | 49 +- build/html-coverage/Programs/index.html | 56 +-- build/html-coverage/PublicKey.php.html | 84 ++-- build/html-coverage/SolanaRpcClient.php.html | 96 ++-- build/html-coverage/Transaction.php.html | 252 +++++------ .../TransactionInstruction.php.html | 8 +- build/html-coverage/Util/AccountMeta.php.html | 10 +- build/html-coverage/Util/Buffer.php.html | 92 ++-- build/html-coverage/Util/Commitment.php.html | 2 +- .../Util/CompiledInstruction.php.html | 8 +- .../Util/ConfirmOptions.php.html | 2 +- .../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 | 59 +-- build/html-coverage/index.html | 80 ++-- src/Programs/SNS/Bindings.php | 122 ++++- src/Programs/SNS/Constants/config.json | 5 +- .../SNS/Instructions/Instructions.php | 1 + .../SNS/State/NameRegistryStateAccount.php | 2 +- .../SNS/State/ReverseInstructionAccount.php | 100 +++++ src/Programs/SNS/Utils.php | 16 +- src/Programs/SnsProgram.php | 11 +- src/PublicKey.php | 2 +- tests/Feature/ConnectionFeatureTest.php | 2 +- tests/Unit/Programs/Sns/BindingsTest.php | 28 +- tests/Unit/Programs/Sns/DerivationTest.php | 16 + 90 files changed, 1287 insertions(+), 942 deletions(-) create mode 100644 src/Programs/SNS/State/ReverseInstructionAccount.php diff --git a/build/html-coverage/Account.php.html b/build/html-coverage/Account.php.html index 9d95c4a..56cc752 100644 --- a/build/html-coverage/Account.php.html +++ b/build/html-coverage/Account.php.html @@ -188,10 +188,10 @@ 15     */ 16    public function __construct($secretKey = null) 17    { - 18        if ($secretKey) { - 19            $secretKeyString = Buffer::from($secretKey)->toString(); + 18        if ($secretKey) { + 19            $secretKeyString = Buffer::from($secretKey)->toString(); 20 - 21            $this->keypair = Keypair::fromSecretKey($secretKeyString); + 21            $this->keypair = Keypair::fromSecretKey($secretKeyString); 22        } else { 23            $this->keypair = Keypair::generate(); 24        } @@ -202,7 +202,7 @@ 29     */ 30    public function getPublicKey(): PublicKey 31    { - 32        return $this->keypair->getPublicKey(); + 32        return $this->keypair->getPublicKey(); 33    } 34 35    /** @@ -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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Accounts/Creator.php.html b/build/html-coverage/Accounts/Creator.php.html index a27333c..abc8849 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Accounts/Did/ServiceStruct.php.html b/build/html-coverage/Accounts/Did/ServiceStruct.php.html index 01b68a1..2cd40ca 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Accounts/Did/VerificationMethodStruct.php.html b/build/html-coverage/Accounts/Did/VerificationMethodStruct.php.html index f80901f..3d9f0ee 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Accounts/Did/dashboard.html b/build/html-coverage/Accounts/Did/dashboard.html index 3ccecc9..11238a9 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 489442a..fa605b8 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Accounts/DidData.php.html b/build/html-coverage/Accounts/DidData.php.html index a7da7d6..7680e32 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Accounts/Metadata.php.html b/build/html-coverage/Accounts/Metadata.php.html index 67fe61f..5e34777 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Accounts/MetadataData.php.html b/build/html-coverage/Accounts/MetadataData.php.html index cc57471..f9268f8 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Accounts/Sns/NtfRecordAccount.php.html b/build/html-coverage/Accounts/Sns/NtfRecordAccount.php.html index e06c47a..73b6ff8 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Accounts/Sns/dashboard.html b/build/html-coverage/Accounts/Sns/dashboard.html index 03b2fb5..56f7c6c 100644 --- a/build/html-coverage/Accounts/Sns/dashboard.html +++ b/build/html-coverage/Accounts/Sns/dashboard.html @@ -143,7 +143,7 @@

Project Risks

diff --git a/build/html-coverage/Accounts/Sns/index.html b/build/html-coverage/Accounts/Sns/index.html index 705e5e8..b5779d7 100644 --- a/build/html-coverage/Accounts/Sns/index.html +++ b/build/html-coverage/Accounts/Sns/index.html @@ -112,7 +112,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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Accounts/dashboard.html b/build/html-coverage/Accounts/dashboard.html index dcf135f..bc6ba83 100644 --- a/build/html-coverage/Accounts/dashboard.html +++ b/build/html-coverage/Accounts/dashboard.html @@ -142,7 +142,7 @@

Project Risks

diff --git a/build/html-coverage/Accounts/index.html b/build/html-coverage/Accounts/index.html index 14effe6..90a17cc 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Borsh/BinaryReader.php.html b/build/html-coverage/Borsh/BinaryReader.php.html index 8f36025..e33c385 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    /** @@ -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    /** @@ -656,8 +656,8 @@ 130     */ 131    public function readString(): string 132    { - 133        $length = $this->readU32(); - 134        return $this->readBuffer($length); + 133        $length = $this->readU32(); + 134        return $this->readBuffer($length); 135    } 136 137    /** @@ -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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Borsh/BinaryWriter.php.html b/build/html-coverage/Borsh/BinaryWriter.php.html index ab83407..b39f88f 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    /** @@ -501,7 +501,7 @@ 41     */ 42    public function writeU32(int $value) 43    { - 44        return $this->writeBuffer(Buffer::from($value, Buffer::TYPE_INT, false)); + 44        return $this->writeBuffer(Buffer::from($value, Buffer::TYPE_INT, false)); 45    } 46 47    /** @@ -573,10 +573,10 @@ 113     */ 114    public function writeString(string $value) 115    { - 116        $valueBuffer = Buffer::from($value); - 117        $this->writeU32(sizeof($valueBuffer)); - 118        $this->writeBuffer($valueBuffer); - 119        return $this; + 116        $valueBuffer = Buffer::from($value); + 117        $this->writeU32(sizeof($valueBuffer)); + 118        $this->writeBuffer($valueBuffer); + 119        return $this; 120    } 121 122    /** @@ -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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Borsh/Borsh.php.html b/build/html-coverage/Borsh/Borsh.php.html index 5b1eca9..ebbc5e6 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,10 +305,10 @@ 65        $fieldType, 66        BinaryWriter $writer 67    ) { - 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])) { + 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]) { 73                    $sizeOf = sizeof($value); 74                    throw new BorshException("Expecting byte array of length {{$fieldType[0]}}, but got {{$sizeOf}} bytes"); @@ -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,12 +409,12 @@ 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 - 177            if (is_int($fieldType[0])) { + 176        if (is_array($fieldType) && isset($fieldType[0])) { // sequential array + 177            if (is_int($fieldType[0])) { 178                return $reader->readFixedArray($fieldType[0]); 179            } elseif (sizeof($fieldType) === 2 && is_int($fieldType[1])) { 180                $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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Borsh/BorshDeserializable.php.html b/build/html-coverage/Borsh/BorshDeserializable.php.html index 319fa0e..461f43e 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Borsh/BorshException.php.html b/build/html-coverage/Borsh/BorshException.php.html index fa284bb..3548ba2 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Borsh/BorshObject.php.html b/build/html-coverage/Borsh/BorshObject.php.html index 0878c9e..f077a76 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Borsh/BorshSerializable.php.html b/build/html-coverage/Borsh/BorshSerializable.php.html index 6460b69..ebf9661 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)) { - 21            return $this->fields[$name]; + 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Borsh/dashboard.html b/build/html-coverage/Borsh/dashboard.html index ed4cafd..9704ef7 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 f1b2269..ea91b5a 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Connection.php.html b/build/html-coverage/Connection.php.html index bf54f45..03646c8 100644 --- a/build/html-coverage/Connection.php.html +++ b/build/html-coverage/Connection.php.html @@ -44,21 +44,21 @@ Total
-
- 63.16% covered (warning) +
+ 64.10% covered (warning)
-
63.16%
-
24 / 38
+
64.10%
+
25 / 39
-
- 70.00% covered (warning) +
+ 72.73% covered (warning)
-
70.00%
-
7 / 10
+
72.73%
+
8 / 11
CRAP
@@ -73,22 +73,22 @@ Connection
-
- 63.16% covered (warning) +
+ 64.10% covered (warning)
-
63.16%
-
24 / 38
+
64.10%
+
25 / 39
-
- 70.00% covered (warning) +
+ 72.73% covered (warning)
-
70.00%
-
7 / 10
- 23.80 +
72.73%
+
8 / 11
+ 25.41
0.00% covered (danger) @@ -319,6 +319,28 @@ + +  getMinimumBalanceForRentExemption +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+ 1 + + + @@ -351,13 +373,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) { + 29        if (! $accountResponse) { 30            throw new AccountNotFoundException("API Error: Account {$pubKey} not found."); 31        } 32 - 33        return $accountResponse; + 33        return $accountResponse; 34    } 35 36    /** @@ -499,7 +521,11 @@ 172 173    } 174 - 175} + 175    public function getMinimumBalanceForRentExemption(int $space = 1024){ + 176        return $this->client->call('getMinimumBalanceForRentExemption', [$space] ); + 177    } + 178 + 179} @@ -510,7 +536,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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Exceptions/AccountNotFoundException.php.html b/build/html-coverage/Exceptions/AccountNotFoundException.php.html index 83ec877..4e19d18 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Exceptions/BaseSolanaPhpSdkException.php.html b/build/html-coverage/Exceptions/BaseSolanaPhpSdkException.php.html index 41707ba..7311e2b 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Exceptions/GenericException.php.html b/build/html-coverage/Exceptions/GenericException.php.html index 42c230f..4dd102c 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Exceptions/InputValidationException.php.html b/build/html-coverage/Exceptions/InputValidationException.php.html index d8872b1..4bb54dc 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Exceptions/InvalidIdResponseException.php.html b/build/html-coverage/Exceptions/InvalidIdResponseException.php.html index f52163c..330001f 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Exceptions/MethodNotFoundException.php.html b/build/html-coverage/Exceptions/MethodNotFoundException.php.html index 3eda931..ff60cd1 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Exceptions/SNSError.php.html b/build/html-coverage/Exceptions/SNSError.php.html index c667e9a..86e3292 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TodoException.php.html b/build/html-coverage/Exceptions/TodoException.php.html index 058bea9..2b58dac 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TokenAccountNotFoundError.php.html b/build/html-coverage/Exceptions/TokenAccountNotFoundError.php.html index 7f3eab1..242b328 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TokenInvalidAccountOwnerError.php.html b/build/html-coverage/Exceptions/TokenInvalidAccountOwnerError.php.html index 0e79054..876b67f 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TokenInvalidMintError.php.html b/build/html-coverage/Exceptions/TokenInvalidMintError.php.html index bd0b533..c44c90f 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Exceptions/TokenOwnerOffCurveError.php.html b/build/html-coverage/Exceptions/TokenOwnerOffCurveError.php.html index a5453cd..b8c45a7 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Exceptions/dashboard.html b/build/html-coverage/Exceptions/dashboard.html index 5a90f3d..46b0c94 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 4df152e..cbcd7d8 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Keypair.php.html b/build/html-coverage/Keypair.php.html index 5be021f..cda0459 100644 --- a/build/html-coverage/Keypair.php.html +++ b/build/html-coverage/Keypair.php.html @@ -282,7 +282,7 @@ 21 22    public function __construct($publicKey = null, $secretKey = null) 23    { - 24        if ($publicKey == null && $secretKey == null) { + 24        if ($publicKey == null && $secretKey == null) { 25            $keypair = sodium_crypto_sign_keypair(); 26 27            $publicKey = sodium_crypto_sign_publickey($keypair); @@ -291,8 +291,8 @@ 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Message.php.html b/build/html-coverage/Message.php.html index 83b713d..90bcd33 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Program.php.html b/build/html-coverage/Program.php.html index 4240620..537f6a9 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Programs/DidSolProgram.php.html b/build/html-coverage/Programs/DidSolProgram.php.html index 5c76311..16fd47e 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Programs/MetaplexProgram.php.html b/build/html-coverage/Programs/MetaplexProgram.php.html index 8b5d564..4ef0dab 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Programs/SNS/Utils.php.html b/build/html-coverage/Programs/SNS/Utils.php.html index ec9d9bc..5cf4700 100644 --- a/build/html-coverage/Programs/SNS/Utils.php.html +++ b/build/html-coverage/Programs/SNS/Utils.php.html @@ -46,22 +46,22 @@ Total
-
- 66.67% covered (warning) +
+ 73.77% covered (warning)
-
66.67%
-
34 / 51
-
-
- 42.86% covered (danger) +
73.77%
+
45 / 61
+
+
+ 66.67% covered (warning)
-
42.86%
-
3 / 7
- CRAP +
66.67%
+
6 / 9
+ CRAP
0.00% covered (danger) @@ -75,22 +75,22 @@ Utils
-
- 66.67% covered (warning) +
+ 73.77% covered (warning)
-
66.67%
-
34 / 51
-
-
- 42.86% covered (danger) +
73.77%
+
45 / 61
+
+
+ 66.67% covered (warning)
-
42.86%
-
3 / 7
- 34.81 +
66.67%
+
6 / 9
+ 32.55
0.00% covered (danger) @@ -102,7 +102,7 @@ -  loadConstants +  loadConstants
100.00% covered (success) @@ -124,7 +124,7 @@ -  getHashedNameSync +  getHashedNameSync
100.00% covered (success) @@ -146,29 +146,29 @@ -  getNameAccountKeySync +  getNameAccountKeySync
-
- 92.31% covered (success) +
+ 100.00% covered (success)
-
92.31%
-
12 / 13
-
-
- 0.00% covered (danger) +
100.00%
+
13 / 13
+
+
+ 100.00% covered (success)
-
0.00%
-
0 / 1
- 3.00 - +
100.00%
+
1 / 1
+ 3 + -  reverseLookup +  reverseLookup
0.00% covered (danger) @@ -190,7 +190,7 @@ -  deserializeReverse +  deserializeReverse
0.00% covered (danger) @@ -212,7 +212,7 @@ -  getDomainKeySync +  getDomainKeySync
70.00% covered (warning) @@ -234,7 +234,7 @@ -  _deriveSync +  _deriveSync
100.00% covered (success) @@ -255,6 +255,50 @@ + +  getReverseKeySync +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
9 / 9
+
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+ 2 + + + + +  getNameOwner +
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+
+
+ 100.00% covered (success) +
+
+ +
100.00%
+
1 / 1
+ 1 + + + @@ -265,142 +309,177 @@ 2 3namespace Attestto\SolanaPhpSdk\Programs\SNS; 4 - 5use Attestto\SolanaPhpSdk\Accounts\NameRegistryStateAccount; - 6use Attestto\SolanaPhpSdk\Connection; - 7use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; - 8use Attestto\SolanaPhpSdk\Exceptions\SNSError; - 9use Attestto\SolanaPhpSdk\PublicKey; - 10use Attestto\SolanaPhpSdk\Util\Buffer; - 11 - 12trait Utils - 13{ - 14 - 15    // config.json file should be in the same directory as this file - 16    public mixed $config; - 17    public $centralStateSNSRecords; - 18 + 5use Attestto\SolanaPhpSdk\Exceptions\AccountNotFoundException; + 6use Attestto\SolanaPhpSdk\Programs\SNS\State\NameRegistryStateAccount; + 7use Attestto\SolanaPhpSdk\Connection; + 8use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; + 9use Attestto\SolanaPhpSdk\Exceptions\SNSError; + 10 + 11use Attestto\SolanaPhpSdk\PublicKey; + 12use Attestto\SolanaPhpSdk\Util\Buffer; + 13 + 14trait Utils + 15{ + 16 + 17    // config.json file should be in the same directory as this file + 18    public mixed $config; 19 - 20    // Constructor + 20 21 - 22    private function loadConstants() - 23    { - 24        $jsonFilePath = dirname(__DIR__) . '/SNS/Constants/config.json'; - 25        return json_decode(file_get_contents($jsonFilePath), true); - 26    } - 27 - 28    public function getHashedNameSync(string $name): Buffer - 29    { - 30        $input = $this->config['HASH_PREFIX'] . $name; - 31        $hashed = hash('sha256', Buffer::from($input), true); - 32        return Buffer::from($hashed); - 33    } - 34 - 35    /** - 36     * @param Buffer $hashed_name - 37     * @param PublicKey|null $nameClass The name class public key - 38     * @param PublicKey|null $nameParent The name parent public key - 39     * @return PublicKey The public key of the name account - 40     * @throws InputValidationException - 41     * - 42     */ - 43    public function getNameAccountKeySync( - 44        Buffer $hashed_name, - 45        PublicKey $nameClass = null, - 46        PublicKey $nameParent = null - 47    ): PublicKey { - 48        $seeds = [$hashed_name]; - 49        $programIdPublicKey = new PublicKey($this->config['NAME_PROGRAM_ID']); - 50        if ($nameClass) { - 51            $seeds[] = $nameClass->toBuffer(); - 52        } else { - 53            $seeds[] = Buffer::alloc(32); - 54        } - 55        if ($nameParent) { - 56            $seeds[] = $nameParent->toBuffer(); - 57        } else { - 58            $seeds[] = Buffer::alloc(32); - 59        } - 60        [$nameAccountKey] = PublicKey::findProgramAddressSync( - 61            $seeds, - 62            $programIdPublicKey - 63        ); - 64        return $nameAccountKey; - 65    } - 66 - 67 - 68    /** - 69     * This function can be used to perform a reverse look up - 70     * @param connection The Solana RPC connection - 71     * @param nameAccount The public key of the domain to look up - 72     * @returns The human readable domain name - 73     */ - 74    public function reverseLookup(Connection $connection, PublicKey $nameAccount): string - 75    { - 76        $hashedReverseLookup = $this->getHashedNameSync($nameAccount->toBase58()); - 77        $reverseLookupAccount = $this->getNameAccountKeySync($hashedReverseLookup, $this->config->REVERSE_LOOKUP_CLASS); - 78 - 79        $registry = NameRegistryStateAccount::retrieve($connection, $reverseLookupAccount); - 80        if (!$registry['data']) { - 81            throw new SNSError(SNSError::NoAccountData); - 82        } - 83 - 84        return $this->deserializeReverse($registry['data']); - 85    } - 86 - 87    public function deserializeReverse( - 88        $data - 89    ): ?string { - 90        if (!$data) { - 91            return null; - 92        } - 93        $nameLength = unpack('V', substr($data, 0, 4))[1]; - 94        return substr($data, 4, $nameLength); - 95    } - 96 - 97 - 98    /** - 99     * This function can be used to compute the public key of a domain or subdomain - 100     * @param string $domain The domain to compute the public key for (e.g `bonfida.sol`, `dex.bonfida.sol`) - 101     * @param string|null $record Optional parameter: If the domain being resolved is a record - 102     * @return array - 103     */ - 104    function getDomainKeySync(string $domain, ?string $record = null): array { - 105        if (substr($domain, -4) === ".sol") { - 106            $domain = substr($domain, 0, -4); - 107        } - 108        $recordClass = $record === 'V2' ? $this->centralStateSNSRecords : null; - 109        $splitted = explode(".", $domain); - 110        if (count($splitted) === 2) { - 111            $prefix = $record ? $record : "\x00"; - 112            $sub = $prefix . $splitted[0]; - 113            $parentKey = $this->_deriveSync($splitted[1])['pubkey']; - 114            $result = $this->_deriveSync($sub, $parentKey, $recordClass); - 115            return array_merge($result, ['isSub' => true, 'parent' => $parentKey]); - 116        } else if (count($splitted) === 3 && $record) { - 117            // Parent key - 118            $parentKey = $this->_deriveSync($splitted[2])['pubkey']; - 119            // Sub domain - 120            $subKey = $this->_deriveSync("\0" . $splitted[1], new PublicKey($parentKey))['pubkey']; - 121            // Sub record - 122            $recordPrefix = $record === 'V2' ? "\x02" : "\x01"; - 123            $result = $this->_deriveSync($recordPrefix . $splitted[0], new PublicKey($subKey), new PublicKey($recordClass)); - 124            return array_merge($result, ['isSub' => true, 'parent' => $parentKey, 'isSubRecord' => true]); - 125        } else if (count($splitted) >= 3) { - 126            throw new SNSError(SNSError::InvalidInput); - 127        } - 128        $result = $this->_deriveSync($domain, new PublicKey($this->config['ROOT_DOMAIN_ACCOUNT'])); - 129        return array_merge($result, ['isSub' => false, 'parent' => null]); - 130    } - 131 - 132    function _deriveSync(string $name, PublicKey $parent = null, PublicKey $classKey = null): array - 133    { - 134        // Assuming these functions exist elsewhere in your codebase - 135        $hashedDomainName = $this->getHashedNameSync($name); - 136        $pubkey = $this->getNameAccountKeySync($hashedDomainName, $classKey, $parent ?: new PublicKey($this->config['ROOT_DOMAIN_ACCOUNT'])); - 137        return ['pubkey' => $pubkey, 'hashed' => $hashedDomainName]; - 138    } - 139 - 140} + 22    // Constructor + 23 + 24    private function loadConstants() + 25    { + 26        $jsonFilePath = dirname(__DIR__) . '/SNS/Constants/config.json'; + 27        return json_decode(file_get_contents($jsonFilePath), true); + 28    } + 29 + 30    public function getHashedNameSync(string $name): Buffer + 31    { + 32        $input = $this->config['HASH_PREFIX'] . $name; + 33        $hashed = hash('sha256', Buffer::from($input), true); + 34        return Buffer::from($hashed); + 35    } + 36 + 37    /** + 38     * @param Buffer $hashed_name + 39     * @param PublicKey|null $nameClass The name class public key + 40     * @param PublicKey|null $nameParent The name parent public key + 41     * @return PublicKey The public key of the name account + 42     * @throws InputValidationException + 43     * + 44     */ + 45    public function getNameAccountKeySync( + 46        Buffer $hashed_name, + 47        PublicKey $nameClass = null, + 48        PublicKey $nameParent = null + 49    ): PublicKey { + 50        $seeds = [$hashed_name]; + 51        $programIdPublicKey = new PublicKey($this->config['NAME_PROGRAM_ID']); + 52        if ($nameClass) { + 53            $seeds[] = $nameClass->toBuffer(); + 54        } else { + 55            $seeds[] = Buffer::alloc(32); + 56        } + 57        if ($nameParent) { + 58            $seeds[] = $nameParent->toBuffer(); + 59        } else { + 60            $seeds[] = Buffer::alloc(32); + 61        } + 62        [$nameAccountKey] = PublicKey::findProgramAddressSync( + 63            $seeds, + 64            $programIdPublicKey + 65        ); + 66        return $nameAccountKey; + 67    } + 68 + 69 + 70    /** + 71     * This function can be used to perform a reverse look up + 72     * @param connection The Solana RPC connection + 73     * @param nameAccount The public key of the domain to look up + 74     * @returns The human readable domain name + 75     */ + 76    public function reverseLookup(Connection $connection, PublicKey $nameAccount): string + 77    { + 78        $hashedReverseLookup = $this->getHashedNameSync($nameAccount->toBase58()); + 79        $reverseLookupAccount = $this->getNameAccountKeySync($hashedReverseLookup, $this->config->REVERSE_LOOKUP_CLASS); + 80 + 81        $registry = NameRegistryStateAccount::retrieve($connection, $reverseLookupAccount); + 82        if (!$registry['data']) { + 83            throw new SNSError(SNSError::NoAccountData); + 84        } + 85 + 86        return $this->deserializeReverse($registry['data']); + 87    } + 88 + 89    public function deserializeReverse( + 90        $data + 91    ): ?string { + 92        if (!$data) { + 93            return null; + 94        } + 95        $nameLength = unpack('V', substr($data, 0, 4))[1]; + 96        return substr($data, 4, $nameLength); + 97    } + 98 + 99 + 100    /** + 101     * This function can be used to compute the public key of a domain or subdomain + 102     * @param string $domain The domain to compute the public key for (e.g `bonfida.sol`, `dex.bonfida.sol`) + 103     * @param string|null $record Optional parameter: If the domain being resolved is a record + 104     * @return array + 105     */ + 106    function getDomainKeySync(string $domain, ?string $record = null): array { + 107        if (substr($domain, -4) === ".sol") { + 108            $domain = substr($domain, 0, -4); + 109        } + 110        $recordClass = $record === 'V2' ? $this->centralStateSNSRecords : null; + 111        $splitted = explode(".", $domain); + 112        if (count($splitted) === 2) { + 113            $prefix = $record ? $record : "\x00"; + 114            $sub = $prefix . $splitted[0]; + 115            $parentKey = $this->_deriveSync($splitted[1])['pubkey']; + 116            $result = $this->_deriveSync($sub, $parentKey, $recordClass); + 117            return array_merge($result, ['isSub' => true, 'parent' => $parentKey]); + 118        } else if (count($splitted) === 3 && $record) { + 119            // Parent key + 120            $parentKey = $this->_deriveSync($splitted[2])['pubkey']; + 121            // Sub domain + 122            $subKey = $this->_deriveSync("\0" . $splitted[1], new PublicKey($parentKey))['pubkey']; + 123            // Sub record + 124            $recordPrefix = $record === 'V2' ? "\x02" : "\x01"; + 125            $result = $this->_deriveSync($recordPrefix . $splitted[0], new PublicKey($subKey), new PublicKey($recordClass)); + 126            return array_merge($result, ['isSub' => true, 'parent' => $parentKey, 'isSubRecord' => true]); + 127        } else if (count($splitted) >= 3) { + 128            throw new SNSError(SNSError::InvalidInput); + 129        } + 130        $result = $this->_deriveSync($domain, new PublicKey($this->config['ROOT_DOMAIN_ACCOUNT'])); + 131        return array_merge($result, ['isSub' => false, 'parent' => null]); + 132    } + 133 + 134    function _deriveSync(string $name, PublicKey $parent = null, PublicKey $classKey = null): array + 135    { + 136        // Assuming these functions exist elsewhere in your codebase + 137        $hashedDomainName = $this->getHashedNameSync($name); + 138        $pubkey = $this->getNameAccountKeySync($hashedDomainName, $classKey, $parent ?: new PublicKey($this->config['ROOT_DOMAIN_ACCOUNT'])); + 139        return ['pubkey' => $pubkey, 'hashed' => $hashedDomainName]; + 140    } + 141 + 142 + 143    /** + 144     * This function can be used to get the key of the reverse account + 145     * + 146     * @param string $domain The domain to compute the reverse for + 147     * @param bool|null $isSub Whether the domain is a subdomain or not + 148     * @return PublicKey The public key of the reverse account + 149     * @throws Exception + 150     * @throws SNSError + 151     * @throws InputValidationException + 152     */ + 153    public function getReverseKeySync(string $domain, bool $isSub = null): PublicKey { + 154        $domainKeySync = $this->getDomainKeySync($domain); + 155        $pubkey = $domainKeySync['pubkey']; + 156        $parent = $domainKeySync['parent']; + 157        $hashedReverseLookup = $this->getHashedNameSync($pubkey->toBase58()); + 158        return $this->getNameAccountKeySync( + 159            $hashedReverseLookup, + 160            new PublicKey($this->config['REVERSE_LOOKUP_CLASS']), + 161            $isSub ? $parent : null + 162        ); + 163    } + 164 + 165    /** + 166     * @throws SNSError + 167     * @throws AccountNotFoundException + 168     */ + 169    public function getNameOwner(Connection $connection, string $parentNameKey): array + 170    { + 171        return NameRegistryStateAccount::retrieve($connection, $parentNameKey); + 172 + 173    } + 174 + 175} @@ -411,7 +490,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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Programs/SNS/dashboard.html b/build/html-coverage/Programs/SNS/dashboard.html index 33cbd68..e928358 100644 --- a/build/html-coverage/Programs/SNS/dashboard.html +++ b/build/html-coverage/Programs/SNS/dashboard.html @@ -59,9 +59,8 @@

Insufficient Coverage

-
Attestto\SolanaPhpSdk\Programs\SNS\Bindings0% - Attestto\SolanaPhpSdk\Programs\SNS\Utils66% - Attestto\SolanaPhpSdk\Programs\SNS\Instructions\Instructions85% + Attestto\SolanaPhpSdk\Programs\SNS\Bindings52% + Attestto\SolanaPhpSdk\Programs\SNS\Utils73% @@ -78,9 +77,8 @@

Project Risks

- Attestto\SolanaPhpSdk\Programs\SNS\Utils34 - Attestto\SolanaPhpSdk\Programs\SNS\Instructions\Instructions13 - Attestto\SolanaPhpSdk\Programs\SNS\Bindings12 + Attestto\SolanaPhpSdk\Programs\SNS\Bindings34 + Attestto\SolanaPhpSdk\Programs\SNS\Utils32 @@ -118,12 +116,13 @@

Insufficient Coverage

- createSubdomain0% - reverseLookup0% - deserializeReverse0% + deserialize0% + createSubdomain0% + transferSubdomain0% + reverseLookup0% + deserializeReverse0% transferInstruction60% - getDomainKeySync70% - createInstruction84% + getDomainKeySync70% retrieve88% @@ -141,12 +140,12 @@

Project Risks

- createSubdomain12 - getDomainKeySync11 + transferSubdomain30 + createSubdomain12 + getDomainKeySync11 transferInstruction8 - reverseLookup6 - deserializeReverse6 - createInstruction4 + reverseLookup6 + deserializeReverse6 retrieve2 @@ -157,7 +156,7 @@

Project Risks

@@ -176,7 +175,7 @@

Project Risks

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

Project Risks

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

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[90,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings<\/a>"],[85.94594594594595,13,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions<\/a>"],[66.66666666666666,20,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils<\/a>"]], 'Class Complexity')) + .datum(getComplexityData([[90,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount<\/a>"],[95.83333333333334,6,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount<\/a>"],[52.84552845528455,14,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings<\/a>"],[91.35135135135135,13,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions<\/a>"],[73.77049180327869,23,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils<\/a>"]], 'Class Complexity')) .transition() .duration(500) .call(chart); @@ -268,7 +267,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[88.88888888888889,2,"
Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::retrieve<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::deserialize<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createSubdomain<\/a>"],[84.12698412698413,4,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::createInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::updateInstruction<\/a>"],[60,6,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::transferInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::reallocInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::deleteInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::loadConstants<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getHashedNameSync<\/a>"],[92.3076923076923,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>"],[70,9,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getDomainKeySync<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::_deriveSync<\/a>"]], 'Method Complexity')) + .datum(getComplexityData([[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::retrieve<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::deserialize<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount::__construct<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount::getInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount::deserialize<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount::serialize<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createSubdomain<\/a>"],[96,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createSubdomainFast<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createNameRegistry<\/a>"],[0,5,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::transferSubdomain<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createReverseName<\/a>"],[100,4,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::createInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::updateInstruction<\/a>"],[60,6,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::transferInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::reallocInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::deleteInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::loadConstants<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getHashedNameSync<\/a>"],[100,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>"],[70,9,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getDomainKeySync<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::_deriveSync<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getReverseKeySync<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getNameOwner<\/a>"]], 'Method Complexity')) .transition() .duration(500) .call(chart); diff --git a/build/html-coverage/Programs/SNS/index.html b/build/html-coverage/Programs/SNS/index.html index 525607a..3b69b89 100644 --- a/build/html-coverage/Programs/SNS/index.html +++ b/build/html-coverage/Programs/SNS/index.html @@ -46,21 +46,21 @@ Total
-
- 72.40% covered (warning) +
+ 77.17% covered (warning)
-
72.40%
-
202 / 279
-
-
- 46.67% covered (danger) +
77.17%
+
311 / 403
+
+
+ 64.00% covered (warning)
-
46.67%
-
7 / 15
+
64.00%
+
16 / 25
0.00% covered (danger) @@ -68,27 +68,27 @@
0.00%
-
0 / 4
+
0 / 5
-
Instructions -
-
- 85.95% covered (warning) + Instructions +
+
+ 91.35% covered (success)
-
85.95%
-
159 / 185
+
91.35%
+
169 / 185
-
- 60.00% covered (warning) +
+ 80.00% covered (warning)
-
60.00%
-
3 / 5
+
80.00%
+
4 / 5
0.00% covered (danger) @@ -102,21 +102,21 @@ State
-
- 90.00% covered (success) +
+ 94.12% covered (success)
-
90.00%
-
9 / 10
-
-
- 50.00% covered (danger) +
94.12%
+
32 / 34
+
+
+ 66.67% covered (warning)
-
50.00%
-
1 / 2
+
66.67%
+
4 / 6
0.00% covered (danger) @@ -124,27 +124,27 @@
0.00%
-
0 / 1
+
0 / 2
- Bindings.php -
-
- 0.00% covered (danger) + Bindings.php +
+
+ 52.85% covered (warning)
-
0.00%
-
0 / 33
+
52.85%
+
65 / 123
-
- 0.00% covered (danger) +
+ 40.00% covered (danger)
-
0.00%
-
0 / 1
+
40.00%
+
2 / 5
0.00% covered (danger) @@ -158,21 +158,21 @@ Utils.php
-
- 66.67% covered (warning) +
+ 73.77% covered (warning)
-
66.67%
-
34 / 51
-
-
- 42.86% covered (danger) +
73.77%
+
45 / 61
+
+
+ 66.67% covered (warning)
-
42.86%
-
3 / 7
+
66.67%
+
6 / 9
0.00% covered (danger) @@ -196,7 +196,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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 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 785915c..ab8ce6f 100644 --- a/build/html-coverage/Programs/SplToken/Actions/SPLTokenActions.php.html +++ b/build/html-coverage/Programs/SplToken/Actions/SPLTokenActions.php.html @@ -47,13 +47,13 @@ Total
-
- 94.44% covered (success) +
+ 91.67% covered (success)
-
94.44%
-
34 / 36
+
91.67%
+
33 / 36
0.00% covered (danger) @@ -76,13 +76,13 @@ SPLTokenActions
-
- 94.44% covered (success) +
+ 91.67% covered (success)
-
94.44%
-
34 / 36
+
91.67%
+
33 / 36
0.00% covered (danger) @@ -91,7 +91,7 @@
0.00%
0 / 1
- 8.01 + 8.04
0.00% covered (danger) @@ -105,13 +105,13 @@  getOrCreateAssociatedTokenAccount
-
- 94.44% covered (success) +
+ 91.67% covered (success)
-
94.44%
-
34 / 36
+
91.67%
+
33 / 36
0.00% covered (danger) @@ -120,7 +120,7 @@
0.00%
0 / 1
- 8.01 + 8.04 @@ -218,13 +218,13 @@ 86                    if (!$confirmOptions) $confirmOptions = new ConfirmOptions(); 87                    $transaction->feePayer = $payer->getPublicKey(); 88                    $txnHash = $connection->sendTransaction( $transaction, [$payer]); - 89                } catch (Exception $error) { + 89                } catch (Exception $error) { 90                    // Ignore all errors 91                    // Account Exists but is not funded - 92                    throw $error; + 92                    throw $error; 93                } 94 - 95                $account = Account::getAccount($connection, $associatedToken, $commitment, $programId); + 95                $account = Account::getAccount($connection, $associatedToken, $commitment, $programId); 96            } else { 97                throw $error; 98            } @@ -255,7 +255,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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Programs/SplToken/Actions/dashboard.html b/build/html-coverage/Programs/SplToken/Actions/dashboard.html index c71a100..8a5346a 100644 --- a/build/html-coverage/Programs/SplToken/Actions/dashboard.html +++ b/build/html-coverage/Programs/SplToken/Actions/dashboard.html @@ -138,7 +138,7 @@

Project Risks

@@ -225,7 +225,7 @@

Project Risks

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

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[94.44444444444444,8,"
Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Actions\\SPLTokenActions::getOrCreateAssociatedTokenAccount<\/a>"]], 'Method Complexity')) + .datum(getComplexityData([[91.66666666666666,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 792df00..2008c0c 100644 --- a/build/html-coverage/Programs/SplToken/Actions/index.html +++ b/build/html-coverage/Programs/SplToken/Actions/index.html @@ -47,13 +47,13 @@ Total
-
- 94.44% covered (success) +
+ 91.67% covered (success)
-
94.44%
-
34 / 36
+
91.67%
+
33 / 36
0.00% covered (danger) @@ -75,13 +75,13 @@ SPLTokenActions.php
-
- 94.44% covered (success) +
+ 91.67% covered (success)
-
94.44%
-
34 / 36
+
91.67%
+
33 / 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 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 09ad088..816cb0b 100644 --- a/build/html-coverage/Programs/SplToken/Instructions/SPLTokenInstructions.php.html +++ b/build/html-coverage/Programs/SplToken/Instructions/SPLTokenInstructions.php.html @@ -290,7 +290,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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 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 b65704f..1514933 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Programs/SplToken/Instructions/dashboard.html b/build/html-coverage/Programs/SplToken/Instructions/dashboard.html index 2db8f62..6eed7e5 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 e00806f..db318f4 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Programs/SplToken/dashboard.html b/build/html-coverage/Programs/SplToken/dashboard.html index 0c2353b..f8634c2 100644 --- a/build/html-coverage/Programs/SplToken/dashboard.html +++ b/build/html-coverage/Programs/SplToken/dashboard.html @@ -141,7 +141,7 @@

Project Risks

@@ -228,7 +228,7 @@

Project Risks

chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') - .datum(getComplexityData([[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint<\/a>"],[94.44444444444444,8,"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>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint<\/a>"],[91.66666666666666,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); @@ -252,7 +252,7 @@

Project Risks

chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') - .datum(getComplexityData([[100,1,"
Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::fromBuffer<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::getAccount<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint::fromBuffer<\/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')) + .datum(getComplexityData([[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::fromBuffer<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::getAccount<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint::fromBuffer<\/a>"],[91.66666666666666,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 7a74ddb..15a75d0 100644 --- a/build/html-coverage/Programs/SplToken/index.html +++ b/build/html-coverage/Programs/SplToken/index.html @@ -46,13 +46,13 @@ Total
-
- 93.90% covered (success) +
+ 92.68% covered (success)
-
93.90%
-
77 / 82
+
92.68%
+
76 / 82
57.14% covered (warning) @@ -74,13 +74,13 @@ Actions
-
- 94.44% covered (success) +
+ 91.67% covered (success)
-
94.44%
-
34 / 36
+
91.67%
+
33 / 36
0.00% covered (danger) @@ -168,7 +168,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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Programs/SplTokenProgram.php.html b/build/html-coverage/Programs/SplTokenProgram.php.html index 58c0657..4184684 100644 --- a/build/html-coverage/Programs/SplTokenProgram.php.html +++ b/build/html-coverage/Programs/SplTokenProgram.php.html @@ -239,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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Programs/SystemProgram.php.html b/build/html-coverage/Programs/SystemProgram.php.html index 0c798c7..83e162b 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Programs/dashboard.html b/build/html-coverage/Programs/dashboard.html index 08cb221..4d8e45c 100644 --- a/build/html-coverage/Programs/dashboard.html +++ b/build/html-coverage/Programs/dashboard.html @@ -60,12 +60,11 @@

Insufficient Coverage

Attestto\SolanaPhpSdk\Programs\MetaplexProgram0% Attestto\SolanaPhpSdk\Programs\SplToken\State\Mint0% - Attestto\SolanaPhpSdk\Programs\SNS\Bindings0% Attestto\SolanaPhpSdk\Programs\DidSolProgram31% Attestto\SolanaPhpSdk\Programs\SystemProgram47% - Attestto\SolanaPhpSdk\Programs\SNS\Utils66% - Attestto\SolanaPhpSdk\Programs\SNS\Instructions\Instructions85% - Attestto\SolanaPhpSdk\Programs\SnsProgram88% + Attestto\SolanaPhpSdk\Programs\SNS\Bindings52% + Attestto\SolanaPhpSdk\Programs\SNS\Utils73% + Attestto\SolanaPhpSdk\Programs\SnsProgram88% @@ -83,11 +82,10 @@

Project Risks

Attestto\SolanaPhpSdk\Programs\DidSolProgram78 - Attestto\SolanaPhpSdk\Programs\SNS\Utils34 + Attestto\SolanaPhpSdk\Programs\SNS\Bindings34 + Attestto\SolanaPhpSdk\Programs\SNS\Utils32 Attestto\SolanaPhpSdk\Programs\SystemProgram17 - Attestto\SolanaPhpSdk\Programs\SNS\Instructions\Instructions13 - Attestto\SolanaPhpSdk\Programs\SNS\Bindings12 - Attestto\SolanaPhpSdk\Programs\SnsProgram2 + Attestto\SolanaPhpSdk\Programs\SnsProgram2 @@ -129,22 +127,23 @@

Insufficient Coverage

parse0% getRpcEndpointFromShortcut0% getProgramAccounts0% + deserialize0% fromBuffer0% getBalance0% getConfirmedTransaction0% getTransaction0% createAccount0% - createSubdomain0% - reverseLookup0% - deserializeReverse0% + createSubdomain0% + transferSubdomain0% + reverseLookup0% + deserializeReverse0% transferInstruction60% - getDomainKeySync70% + getDomainKeySync70% getAccountInfo75% - createInstruction84% createAssociatedTokenAccountInstruction84% getAssociatedTokenAddressSync85% retrieve88% - __construct88% + __construct88% @@ -163,17 +162,17 @@

Project Risks

parse42 getRpcEndpointFromShortcut30 - createSubdomain12 - getDomainKeySync11 + transferSubdomain30 + createSubdomain12 + getDomainKeySync11 transferInstruction8 - reverseLookup6 - deserializeReverse6 - createInstruction4 + reverseLookup6 + deserializeReverse6 getAssociatedTokenAddressSync3 createAssociatedTokenAccountInstruction3 getAccountInfo2 retrieve2 - __construct2 + __construct2 @@ -183,7 +182,7 @@

Project Risks

@@ -202,7 +201,7 @@

Project Risks

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

Project Risks

.yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([12,0,0,0,0,0,0,1,2,5,2,16], "Method Coverage")) + .datum(getCoverageDistributionData([14,0,0,0,0,0,0,1,2,4,2,25], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -270,7 +269,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>"],[90,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount<\/a>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SnsProgram<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint<\/a>"],[93.75,4,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram<\/a>"],[47.22222222222222,8,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram<\/a>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings<\/a>"],[85.94594594594595,13,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions<\/a>"],[66.66666666666666,20,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils<\/a>"],[94.44444444444444,8,"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>"],[90,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount<\/a>"],[95.83333333333334,6,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount<\/a>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SnsProgram<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint<\/a>"],[93.75,4,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram<\/a>"],[47.22222222222222,8,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram<\/a>"],[52.84552845528455,14,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings<\/a>"],[91.35135135135135,13,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions<\/a>"],[73.77049180327869,23,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils<\/a>"],[91.66666666666666,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); @@ -294,7 +293,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>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::retrieve<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::deserialize<\/a>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SnsProgram::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::fromBuffer<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::getAccount<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint::fromBuffer<\/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>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createSubdomain<\/a>"],[84.12698412698413,4,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::createInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::updateInstruction<\/a>"],[60,6,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::transferInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::reallocInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::deleteInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::loadConstants<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getHashedNameSync<\/a>"],[92.3076923076923,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>"],[70,9,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getDomainKeySync<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::_deriveSync<\/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')) + .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>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::retrieve<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::deserialize<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount::__construct<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount::getInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount::deserialize<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount::serialize<\/a>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SnsProgram::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::fromBuffer<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::getAccount<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint::fromBuffer<\/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>"],[0,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createSubdomain<\/a>"],[96,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createSubdomainFast<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createNameRegistry<\/a>"],[0,5,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::transferSubdomain<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createReverseName<\/a>"],[100,4,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::createInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::updateInstruction<\/a>"],[60,6,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::transferInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::reallocInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::deleteInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::loadConstants<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getHashedNameSync<\/a>"],[100,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>"],[70,9,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getDomainKeySync<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::_deriveSync<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getReverseKeySync<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getNameOwner<\/a>"],[91.66666666666666,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 418d0b6..645da90 100644 --- a/build/html-coverage/Programs/index.html +++ b/build/html-coverage/Programs/index.html @@ -45,49 +45,49 @@ Total
-
- 69.09% covered (warning) +
+ 72.77% covered (warning)
-
69.09%
-
333 / 482
-
-
- 42.11% covered (danger) +
72.77%
+
441 / 606
+
+
+ 52.08% covered (warning)
-
42.11%
-
16 / 38
+
52.08%
+
25 / 48
-
- 7.69% covered (danger) +
+ 7.14% covered (danger)
-
7.69%
-
1 / 13
+
7.14%
+
1 / 14
SNS
-
- 72.40% covered (warning) +
+ 77.17% covered (warning)
-
72.40%
-
202 / 279
-
-
- 46.67% covered (danger) +
77.17%
+
311 / 403
+
+
+ 64.00% covered (warning)
-
46.67%
-
7 / 15
+
64.00%
+
16 / 25
0.00% covered (danger) @@ -95,19 +95,19 @@
0.00%
-
0 / 4
+
0 / 5
SplToken
-
- 93.90% covered (success) +
+ 92.68% covered (success)
-
93.90%
-
77 / 82
+
92.68%
+
76 / 82
57.14% covered (warning) @@ -279,7 +279,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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/PublicKey.php.html b/build/html-coverage/PublicKey.php.html index 879e765..a250be0 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    /** @@ -574,47 +574,47 @@ 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)) { - 155            throw new InputValidationException('Invalid seeds, address must fall off the curve.'); + 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    /** 162     * @param array $seeds 163     * @param PublicKey $programId - 164     * @return array 2 elements, [0] = PublicKey, [1] = integer + 164     * @return array 2 elements, [0] = PublicKey, [1] = nonce 165     * @throws BaseSolanaPhpSdkException 166     */ 167    static function findProgramAddress(array $seeds, PublicKey $programId): array 168    { - 169        $nonce = 255; + 169        $nonce = 255; 170 - 171        while ($nonce != 0) { + 171        while ($nonce != 0) { 172            try { - 173                $copyOfSeedsWithNonce = $seeds; - 174                $copyOfSeedsWithNonce[] = [$nonce]; - 175                $address = static::createProgramAddress($copyOfSeedsWithNonce, $programId); - 176            } catch (\Exception $exception) { - 177                $nonce--; - 178                continue; + 173                $copyOfSeedsWithNonce = $seeds; + 174                $copyOfSeedsWithNonce[] = [$nonce]; + 175                $address = static::createProgramAddress($copyOfSeedsWithNonce, $programId); + 176            } catch (\Exception $exception) { + 177                $nonce--; + 178                continue; 179            } - 180            return [$address, $nonce]; + 180            return [$address, $nonce]; 181        } 182 183        throw new BaseSolanaPhpSdkException('Unable to find a viable program address nonce.'); @@ -628,7 +628,7 @@ 191     */ 192    static function findProgramAddressSync(array $seeds, PublicKey $programId): array 193    { - 194        return static::findProgramAddress($seeds, $programId); + 194        return static::findProgramAddress($seeds, $programId); 195    } 196 197    /** @@ -637,19 +637,19 @@ 200    static function isOnCurve(mixed $publicKey): bool 201    { 202        try { - 203            $binaryString = $publicKey instanceof PublicKey + 203            $binaryString = $publicKey instanceof PublicKey 204                ? $publicKey->toBinaryString() - 205                : $publicKey; + 205                : $publicKey; 206 207            /** 208             * Sodium extension method sometimes returns "conversion failed" exception. 209             * $_ = sodium_crypto_sign_ed25519_pk_to_curve25519($binaryString); 210             */ - 211            $_ = ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519($binaryString); + 211            $_ = ParagonIE_Sodium_Compat::crypto_sign_ed25519_pk_to_curve25519($binaryString); 212 - 213            return true; - 214        } catch (RangeException|\SodiumException $exception) { - 215            return false; + 213            return true; + 214        } catch (RangeException|\SodiumException $exception) { + 215            return false; 216        } 217    } 218 @@ -660,12 +660,12 @@ 223     */ 224    public static function base58(): Base58 225    { - 226        return new Base58(); + 226        return new Base58(); 227    } 228 229    public function getPublicKey(): PublicKey 230    { - 231        return $this; + 231        return $this; 232    } 233} @@ -678,7 +678,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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/SolanaRpcClient.php.html b/build/html-coverage/SolanaRpcClient.php.html index 6460eab..ec883e4 100644 --- a/build/html-coverage/SolanaRpcClient.php.html +++ b/build/html-coverage/SolanaRpcClient.php.html @@ -42,15 +42,15 @@ - Total -
-
- 90.91% covered (success) + Total +
+
+ 87.88% covered (warning)
-
90.91%
-
30 / 33
+
87.88%
+
29 / 33
60.00% covered (warning) @@ -71,15 +71,15 @@ - SolanaRpcClient -
-
- 90.91% covered (success) + SolanaRpcClient +
+
+ 87.88% covered (warning)
-
90.91%
-
30 / 33
+
87.88%
+
29 / 33
60.00% covered (warning) @@ -88,7 +88,7 @@
60.00%
3 / 5
- 14.15 + 14.35
0.00% covered (danger) @@ -168,13 +168,13 @@  validateResponse
-
- 77.78% covered (warning) +
+ 66.67% covered (warning)
-
77.78%
-
7 / 9
+
66.67%
+
6 / 9
0.00% covered (danger) @@ -183,7 +183,7 @@
0.00%
0 / 1
- 7.54 + 8.81 @@ -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,24 +305,24 @@ 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, + 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        ]; - 100        $response = $this->httpClient->request('POST', $this->endpoint, $options); + 99        ]; + 100        $response = $this->httpClient->request('POST', $this->endpoint, $options); 101 - 102        $resp_body = $response->getBody()->getContents(); - 103        $resp_object = json_decode($resp_body, true); + 102        $resp_body = $response->getBody()->getContents(); + 103        $resp_object = json_decode($resp_body, true); 104 - 105        $this->validateResponse($resp_object, $method); + 105        $this->validateResponse($resp_object, $method); 106 107 - 108        return $resp_object['result'] ?? null; + 108        return $resp_object['result'] ?? null; 109    } 110    /** 111     * @param string $method @@ -331,13 +331,13 @@ 114     */ 115    public function buildRpc(string $method, array $params): array 116    { - 117        return [ - 118            'jsonrpc' => '2.0', - 119            'id' => $this->randomKey, - 120            'method' => $method, - 121            'params' => $params, + 117        return [ + 118            'jsonrpc' => '2.0', + 119            'id' => $this->randomKey, + 120            'method' => $method, + 121            'params' => $params, 122 - 123        ]; + 123        ]; 124    } 125 126    /** @@ -358,22 +358,22 @@ 141 142 143 - 144        if ($body == null) { + 144        if ($body == null) { 145            throw new GenericException('Invalid JSON response'); 146        } 147 148        // If response contains an 'error' key, handle it - 149        if (isset($body['params']['error']) || isset($body['error'])) { - 150            $error = $body['params']['error']? : $body['error']; - 151            if ($error['code'] === self::ERROR_CODE_METHOD_NOT_FOUND) { + 149        if (isset($body['params']['error']) || isset($body['error'])) { + 150            $error = $body['params']['error']? : $body['error']; + 151            if ($error['code'] === self::ERROR_CODE_METHOD_NOT_FOUND) { 152                throw new MethodNotFoundException("API Error: Method $method not found."); 153            } else { - 154                throw new GenericException($error['message']); + 154                throw new GenericException($error['message']); 155            } 156        } 157 158        // If 'id' doesn't match the expected value, throw an exception - 159        if ($body['id'] !== $this->randomKey) { + 159        if ($body['id'] !== $this->randomKey) { 160            throw new InvalidIdResponseException($this->randomKey); 161        } 162 @@ -398,7 +398,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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Transaction.php.html b/build/html-coverage/Transaction.php.html index 459cdde..34ddb1f 100644 --- a/build/html-coverage/Transaction.php.html +++ b/build/html-coverage/Transaction.php.html @@ -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                $this->instructions[] = $item; + 88        foreach ($items as $item) { + 89            if ($item instanceof TransactionInstruction) { + 90                $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) { + 123        if ($this->feePayer) { 124            $feePayer = $this->feePayer; - 125        } elseif (sizeof($this->signatures) && $this->signatures[0]->getPublicKey()) { - 126            $feePayer = $this->signatures[0]->getPublicKey(); + 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) { - 186                $uniqueMetas[$uniqueIndex]->isWritable = $uniqueMetas[$uniqueIndex]->isWritable || $accountMeta->isWritable; + 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    /** @@ -893,11 +893,11 @@ 324     */ 325    public function setSigners(...$signers) 326    { - 327        $uniqueSigners = $this->arrayUnique($signers); + 327        $uniqueSigners = $this->arrayUnique($signers); 328 - 329        $this->signatures = array_map(function(PublicKey $signer) { - 330            return new SignaturePubkeyPair($signer, null); - 331        }, $uniqueSigners); + 329        $this->signatures = array_map(function(PublicKey $signer) { + 330            return new SignaturePubkeyPair($signer, null); + 331        }, $uniqueSigners); 332    } 333 334    /** @@ -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    /** @@ -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,9 +1209,9 @@ 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); @@ -1229,8 +1229,8 @@ 660     */ 661    protected function toSecretKey($source): string 662    { - 663        if ($source instanceof HasSecretKey) { - 664            return $source->getSecretKey(); + 663        if ($source instanceof HasSecretKey) { + 664            return $source->getSecretKey(); 665        } else { 666            throw new InputValidationException('Unsupported input: ' . get_class($source)); 667        } @@ -1246,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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/TransactionInstruction.php.html b/build/html-coverage/TransactionInstruction.php.html index 73c45b1..ee3edaf 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Util/AccountMeta.php.html b/build/html-coverage/Util/AccountMeta.php.html index 3a7f175..924d92a 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Util/Buffer.php.html b/build/html-coverage/Util/Buffer.php.html index a868292..e78986c 100644 --- a/build/html-coverage/Util/Buffer.php.html +++ b/build/html-coverage/Util/Buffer.php.html @@ -578,30 +578,30 @@ 52     */ 53    public function __construct($value = null, ?string $datatype = null, ?bool $signed = null) 54    { - 55        $this->datatype = $datatype; - 56        $this->signed = $signed; + 55        $this->datatype = $datatype; + 56        $this->signed = $signed; 57 - 58        $isString = is_string($value); - 59        $isNumeric = is_numeric($value); + 58        $isString = is_string($value); + 59        $isNumeric = is_numeric($value); 60 - 61        if ($isString || $isNumeric) { - 62            $this->datatype = $datatype; - 63            $this->signed = $signed; + 61        if ($isString || $isNumeric) { + 62            $this->datatype = $datatype; + 63            $this->signed = $signed; 64 65            // unpack returns an array indexed at 1. - 66            $this->data = $isString - 67                ? array_values(unpack("C*", $value)) - 68                : array_values(unpack("C*", pack($this->computedFormat(), $value))); - 69        } elseif (is_array($value)) { - 70            $this->data = $value; - 71        } elseif ($value instanceof PublicKey) { - 72            $this->data = $value->toBytes(); - 73        } elseif ($value instanceof Buffer) { - 74            $this->data = $value->toArray(); - 75            $this->datatype = $value->datatype; - 76            $this->signed = $value->signed; - 77        } elseif ($value == null) { - 78            $this->data = []; + 66            $this->data = $isString + 67                ? array_values(unpack("C*", $value)) + 68                : array_values(unpack("C*", pack($this->computedFormat(), $value))); + 69        } elseif (is_array($value)) { + 70            $this->data = $value; + 71        } elseif ($value instanceof PublicKey) { + 72            $this->data = $value->toBytes(); + 73        } elseif ($value instanceof Buffer) { + 74            $this->data = $value->toArray(); + 75            $this->datatype = $value->datatype; + 76            $this->signed = $value->signed; + 77        } elseif ($value == null) { + 78            $this->data = []; 79        } elseif (method_exists($value, 'toArray')) { 80            $this->data = $value->toArray(); 81        } else { @@ -614,12 +614,12 @@ 88     */ 89    public static function concat(array $buffers): static 90    { - 91        $data = []; - 92        foreach ($buffers as $buffer) { - 93            $data = array_merge($data, $buffer->toArray()); + 91        $data = []; + 92        foreach ($buffers as $buffer) { + 93            $data = array_merge($data, $buffer->toArray()); 94        } 95 - 96        return new static($data); + 96        return new static($data); 97    } 98 99    /** @@ -627,7 +627,7 @@ 101     */ 102    public static function fromArray(array $array): static 103    { - 104        return new static($array); + 104        return new static($array); 105    } 106 107    /** @@ -639,7 +639,7 @@ 113     */ 114    public static function from($value = null, ?string $format = null, ?bool $signed = null): Buffer 115    { - 116        return new static($value, $format, $signed); + 116        return new static($value, $format, $signed); 117    } 118 119    /** @@ -651,9 +651,9 @@ 125     */ 126    public static function fromBase58(string $value): Buffer 127    { - 128        $value = PublicKey::base58()->decode($value); + 128        $value = PublicKey::base58()->decode($value); 129 - 130        return new static($value); + 130        return new static($value); 131    } 132 133    /** @@ -674,11 +674,11 @@ 148     */ 149    public function push($source): Buffer 150    { - 151        $sourceAsBuffer = Buffer::from($source); + 151        $sourceAsBuffer = Buffer::from($source); 152 - 153        array_push($this->data, ...$sourceAsBuffer->toArray()); + 153        array_push($this->data, ...$sourceAsBuffer->toArray()); 154 - 155        return $this; + 155        return $this; 156    } 157 158    /** @@ -686,7 +686,7 @@ 160     */ 161    public function slice(int $offset, ?int $length = null, ?string $format = null, ?bool $signed = null): Buffer 162    { - 163        return static::from(array_slice($this->data, $offset, $length), $format, $signed); + 163        return static::from(array_slice($this->data, $offset, $length), $format, $signed); 164    } 165 166    /** @@ -724,7 +724,7 @@ 198     */ 199    public function toArray(): array 200    { - 201        return $this->data; + 201        return $this->data; 202    } 203 204    /** @@ -734,7 +734,7 @@ 208     */ 209    public function toString(): string 210    { - 211        return $this; + 211        return $this; 212    } 213 214    /** @@ -754,7 +754,7 @@ 228    #[\ReturnTypeWillChange] 229    public function count() 230    { - 231        return count($this->toArray()); + 231        return count($this->toArray()); 232    } 233 234    /** @@ -763,7 +763,7 @@ 237     */ 238    public function __toString() 239    { - 240        return pack('C*', ...$this->toArray()); + 240        return pack('C*', ...$this->toArray()); 241    } 242 243    /** @@ -775,14 +775,14 @@ 249     */ 250    public function value(?int $length = null) 251    { - 252        if ($length) { + 252        if ($length) { 253            $this->fixed($length); 254        } 255 - 256        if ($this->datatype === self::TYPE_STRING) { + 256        if ($this->datatype === self::TYPE_STRING) { 257            return ord(pack("C*", ...$this->toArray())); 258        } else { - 259            return unpack($this->computedFormat(), pack("C*", ...$this->toArray()))[1]; + 259            return unpack($this->computedFormat(), pack("C*", ...$this->toArray()))[1]; 260        } 261    } 262 @@ -792,16 +792,16 @@ 266     */ 267    protected function computedFormat(): string 268    { - 269        if (! $this->datatype) { + 269        if (! $this->datatype) { 270            throw new InputValidationException('Trying to calculate format of unspecified buffer. Please specify a datatype.'); 271        } 272 - 273        switch ($this->datatype) { + 273        switch ($this->datatype) { 274            case self::TYPE_STRING: return self::FORMAT_CHAR_UNSIGNED; - 275            case self::TYPE_BYTE: return $this->signed ? self::FORMAT_CHAR_SIGNED : self::FORMAT_CHAR_UNSIGNED; + 275            case self::TYPE_BYTE: return $this->signed ? self::FORMAT_CHAR_SIGNED : self::FORMAT_CHAR_UNSIGNED; 276            case self::TYPE_SHORT: return $this->signed ? self::FORMAT_SHORT_16_SIGNED : self::FORMAT_SHORT_16_UNSIGNED; - 277            case self::TYPE_INT: return $this->signed ? self::FORMAT_LONG_32_SIGNED : self::FORMAT_LONG_32_UNSIGNED; - 278            case self::TYPE_LONG: return $this->signed ? self::FORMAT_LONG_LONG_64_SIGNED : self::FORMAT_LONG_LONG_64_UNSIGNED; + 277            case self::TYPE_INT: return $this->signed ? self::FORMAT_LONG_32_SIGNED : self::FORMAT_LONG_32_UNSIGNED; + 278            case self::TYPE_LONG: return $this->signed ? self::FORMAT_LONG_LONG_64_SIGNED : self::FORMAT_LONG_LONG_64_UNSIGNED; 279            case self::TYPE_FLOAT: return self::FORMAT_FLOAT; 280            default: throw new InputValidationException("Unsupported datatype."); 281        } @@ -813,7 +813,7 @@ 287     */ 288    public static function alloc(int $size): Buffer 289    { - 290        return new static(array_fill(0, $size, 0)); + 290        return new static(array_fill(0, $size, 0)); 291 292    } 293 @@ -828,7 +828,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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Util/Commitment.php.html b/build/html-coverage/Util/Commitment.php.html index cfa4b32..69b219a 100644 --- a/build/html-coverage/Util/Commitment.php.html +++ b/build/html-coverage/Util/Commitment.php.html @@ -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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Util/CompiledInstruction.php.html b/build/html-coverage/Util/CompiledInstruction.php.html index f8db69e..8f4f62d 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Util/ConfirmOptions.php.html b/build/html-coverage/Util/ConfirmOptions.php.html index b342d4a..f78ebf4 100644 --- a/build/html-coverage/Util/ConfirmOptions.php.html +++ b/build/html-coverage/Util/ConfirmOptions.php.html @@ -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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Util/HasPublicKey.php.html b/build/html-coverage/Util/HasPublicKey.php.html index 2423d51..cd61f43 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Util/HasSecretKey.php.html b/build/html-coverage/Util/HasSecretKey.php.html index 9d2ec78..65464b5 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Util/MessageHeader.php.html b/build/html-coverage/Util/MessageHeader.php.html index c111f02..01c000f 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Util/NonceInformation.php.html b/build/html-coverage/Util/NonceInformation.php.html index a84a729..9ee058e 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Util/ShortVec.php.html b/build/html-coverage/Util/ShortVec.php.html index 50d2e4f..5cad03b 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Util/SignaturePubkeyPair.php.html b/build/html-coverage/Util/SignaturePubkeyPair.php.html index 7c9493b..4b055d0 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Util/Signer.php.html b/build/html-coverage/Util/Signer.php.html index d0da068..0fa1174 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/Util/dashboard.html b/build/html-coverage/Util/dashboard.html index 02fdaa1..5ada73f 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 e6aa7d5..e5ec700 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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/build/html-coverage/dashboard.html b/build/html-coverage/dashboard.html index e71531c..2259f9f 100644 --- a/build/html-coverage/dashboard.html +++ b/build/html-coverage/dashboard.html @@ -64,21 +64,21 @@

Insufficient Coverage

Attestto\SolanaPhpSdk\Programs\SplToken\State\Mint0% Attestto\SolanaPhpSdk\Util\NonceInformation0% Attestto\SolanaPhpSdk\Util\Signer0% - Attestto\SolanaPhpSdk\Programs\SNS\Bindings0% Attestto\SolanaPhpSdk\Programs\DidSolProgram31% Attestto\SolanaPhpSdk\Programs\SystemProgram47% - Attestto\SolanaPhpSdk\Connection63% + Attestto\SolanaPhpSdk\Programs\SNS\Bindings52% Attestto\SolanaPhpSdk\Util\Commitment63% - Attestto\SolanaPhpSdk\Programs\SNS\Utils66% + Attestto\SolanaPhpSdk\Connection64% Attestto\SolanaPhpSdk\Borsh\BorshDeserializable68% Attestto\SolanaPhpSdk\Borsh\BinaryWriter69% Attestto\SolanaPhpSdk\Borsh\Borsh72% + Attestto\SolanaPhpSdk\Programs\SNS\Utils73% Attestto\SolanaPhpSdk\Borsh\BinaryReader83% Attestto\SolanaPhpSdk\Util\Buffer85% - Attestto\SolanaPhpSdk\Programs\SNS\Instructions\Instructions85% Attestto\SolanaPhpSdk\Transaction85% Attestto\SolanaPhpSdk\Borsh\BorshSerializable87% - Attestto\SolanaPhpSdk\Programs\SnsProgram88% + Attestto\SolanaPhpSdk\SolanaRpcClient87% + Attestto\SolanaPhpSdk\Programs\SnsProgram88% Attestto\SolanaPhpSdk\PublicKey89% @@ -100,19 +100,19 @@

Project Risks

Attestto\SolanaPhpSdk\Programs\DidSolProgram78 Attestto\SolanaPhpSdk\Borsh\Borsh70 Attestto\SolanaPhpSdk\Util\Buffer46 - Attestto\SolanaPhpSdk\Programs\SNS\Utils34 + Attestto\SolanaPhpSdk\Programs\SNS\Bindings34 + Attestto\SolanaPhpSdk\Programs\SNS\Utils32 Attestto\SolanaPhpSdk\Accounts\NtfRecordAccount30 Attestto\SolanaPhpSdk\PublicKey27 Attestto\SolanaPhpSdk\Borsh\BinaryWriter25 - Attestto\SolanaPhpSdk\Connection23 + Attestto\SolanaPhpSdk\Connection25 Attestto\SolanaPhpSdk\Borsh\BinaryReader22 Attestto\SolanaPhpSdk\Programs\SystemProgram17 Attestto\SolanaPhpSdk\Borsh\BorshDeserializable14 - Attestto\SolanaPhpSdk\Programs\SNS\Instructions\Instructions13 - Attestto\SolanaPhpSdk\Programs\SNS\Bindings12 + Attestto\SolanaPhpSdk\SolanaRpcClient14 Attestto\SolanaPhpSdk\Util\Commitment7 Attestto\SolanaPhpSdk\Borsh\BorshSerializable3 - Attestto\SolanaPhpSdk\Programs\SnsProgram2 + Attestto\SolanaPhpSdk\Programs\SnsProgram2 @@ -172,6 +172,7 @@

Insufficient Coverage

parse0% getRpcEndpointFromShortcut0% getProgramAccounts0% + deserialize0% fromBuffer0% getBalance0% getConfirmedTransaction0% @@ -192,29 +193,29 @@

Insufficient Coverage

getSecretKey0% __isset0% __unset0% - createSubdomain0% - reverseLookup0% - deserializeReverse0% + createSubdomain0% + transferSubdomain0% + reverseLookup0% + deserializeReverse0% toPublicKey40% serializeObject41% deserializeObject57% add57% value60% transferInstruction60% + validateResponse66% signature66% toSecretKey66% computedFormat70% - getDomainKeySync70% + getDomainKeySync70% _serialize70% _verifySignature71% serializeField72% getAccountInfo75% _addSignature75% serialize75% - validateResponse77% readBuffer80% __construct81% - createInstruction84% createAssociatedTokenAccountInstruction84% simulateTransaction85% getAssociatedTokenAddressSync85% @@ -222,7 +223,7 @@

Insufficient Coverage

__construct86% __get87% retrieve88% - __construct88% + __construct88% @@ -241,29 +242,29 @@

Project Risks

parse42 getRpcEndpointFromShortcut30 + transferSubdomain30 serializeField18 computedFormat17 retrieve12 __unset12 - createSubdomain12 - getDomainKeySync11 + createSubdomain12 + getDomainKeySync11 serializeObject9 __construct9 deserializeObject8 + validateResponse8 transferInstruction8 _serialize8 - validateResponse7 writeArray6 equals6 addSignature6 __isset6 - reverseLookup6 - deserializeReverse6 + reverseLookup6 + deserializeReverse6 _verifySignature5 add5 __construct5 toPublicKey4 - createInstruction4 value3 serialize3 getAssociatedTokenAddressSync3 @@ -276,7 +277,7 @@

Project Risks

readBuffer2 simulateTransaction2 retrieve2 - __construct2 + __construct2 __construct2 @@ -287,7 +288,7 @@

Project Risks

@@ -306,7 +307,7 @@

Project Risks

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

Project Risks

.yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') - .datum(getCoverageDistributionData([45,0,0,0,0,2,2,4,9,11,8,123], "Method Coverage")) + .datum(getCoverageDistributionData([47,0,0,0,0,2,2,5,8,10,8,133], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); @@ -374,7 +375,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,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>"],[63.1578947368421,14,"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>"],[90,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount<\/a>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SnsProgram<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint<\/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>"],[85.97285067873304,82,"Attestto\\SolanaPhpSdk\\Transaction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\TransactionInstruction<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Util\\AccountMeta<\/a>"],[85.9375,42,"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,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings<\/a>"],[85.94594594594595,13,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions<\/a>"],[66.66666666666666,20,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils<\/a>"],[94.44444444444444,8,"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,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>"],[64.1025641025641,15,"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>"],[90,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount<\/a>"],[95.83333333333334,6,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount<\/a>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SnsProgram<\/a>"],[100,0,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\Instructions\\TokenInstruction<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint<\/a>"],[93.75,4,"Attestto\\SolanaPhpSdk\\Programs\\SplTokenProgram<\/a>"],[47.22222222222222,8,"Attestto\\SolanaPhpSdk\\Programs\\SystemProgram<\/a>"],[89.65517241379311,27,"Attestto\\SolanaPhpSdk\\PublicKey<\/a>"],[87.87878787878788,14,"Attestto\\SolanaPhpSdk\\SolanaRpcClient<\/a>"],[85.97285067873304,82,"Attestto\\SolanaPhpSdk\\Transaction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\TransactionInstruction<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Util\\AccountMeta<\/a>"],[85.9375,42,"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>"],[52.84552845528455,14,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings<\/a>"],[91.35135135135135,13,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions<\/a>"],[73.77049180327869,23,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils<\/a>"],[91.66666666666666,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); @@ -398,7 +399,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,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\\Connection::getProgramAccounts<\/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>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::retrieve<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::deserialize<\/a>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SnsProgram::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::fromBuffer<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::getAccount<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint::fromBuffer<\/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\\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,2,"Attestto\\SolanaPhpSdk\\Util\\Buffer::concat<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::fromArray<\/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>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::alloc<\/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,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createSubdomain<\/a>"],[84.12698412698413,4,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::createInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::updateInstruction<\/a>"],[60,6,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::transferInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::reallocInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::deleteInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::loadConstants<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getHashedNameSync<\/a>"],[92.3076923076923,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>"],[70,9,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getDomainKeySync<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::_deriveSync<\/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')) + .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,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\\Connection::getProgramAccounts<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Connection::getMinimumBalanceForRentExemption<\/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>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::retrieve<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\NameRegistryStateAccount::deserialize<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount::__construct<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount::getInstruction<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount::deserialize<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\State\\ReverseInstructionAccount::serialize<\/a>"],[88.88888888888889,2,"Attestto\\SolanaPhpSdk\\Programs\\SnsProgram::__construct<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::fromBuffer<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Account::getAccount<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\Programs\\SplToken\\State\\Mint::fromBuffer<\/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>"],[66.66666666666666,7,"Attestto\\SolanaPhpSdk\\SolanaRpcClient::validateResponse<\/a>"],[0,1,"Attestto\\SolanaPhpSdk\\SolanaRpcClient::getRandomKey<\/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,2,"Attestto\\SolanaPhpSdk\\Util\\Buffer::concat<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::fromArray<\/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>"],[100,1,"Attestto\\SolanaPhpSdk\\Util\\Buffer::alloc<\/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,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createSubdomain<\/a>"],[96,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createSubdomainFast<\/a>"],[100,3,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createNameRegistry<\/a>"],[0,5,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::transferSubdomain<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Bindings::createReverseName<\/a>"],[100,4,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::createInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::updateInstruction<\/a>"],[60,6,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::transferInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::reallocInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Instructions\\Instructions::deleteInstruction<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::loadConstants<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getHashedNameSync<\/a>"],[100,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>"],[70,9,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getDomainKeySync<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::_deriveSync<\/a>"],[100,2,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getReverseKeySync<\/a>"],[100,1,"Attestto\\SolanaPhpSdk\\Programs\\SNS\\Utils::getNameOwner<\/a>"],[91.66666666666666,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 b4484b9..4acff01 100644 --- a/build/html-coverage/index.html +++ b/build/html-coverage/index.html @@ -44,29 +44,29 @@ Total
-
- 77.27% covered (warning) +
+ 78.10% covered (warning)
-
77.27%
-
962 / 1245
+
78.10%
+
1070 / 1370
-
- 60.29% covered (warning) +
+ 61.86% covered (warning)
-
60.29%
-
123 / 204
+
61.86%
+
133 / 215
-
- 32.56% covered (danger) +
+ 31.82% covered (danger)
-
32.56%
-
14 / 43
+
31.82%
+
14 / 44
@@ -156,29 +156,29 @@
Programs
-
- 69.09% covered (warning) +
+ 72.77% covered (warning)
-
69.09%
-
333 / 482
-
-
- 42.11% covered (danger) +
72.77%
+
441 / 606
+
+
+ 52.08% covered (warning)
-
42.11%
-
16 / 38
+
52.08%
+
25 / 48
-
- 7.69% covered (danger) +
+ 7.14% covered (danger)
-
7.69%
-
1 / 13
+
7.14%
+
1 / 14
@@ -240,21 +240,21 @@ Connection.php
-
- 63.16% covered (warning) +
+ 64.10% covered (warning)
-
63.16%
-
24 / 38
+
64.10%
+
25 / 39
-
- 70.00% covered (warning) +
+ 72.73% covered (warning)
-
70.00%
-
7 / 10
+
72.73%
+
8 / 11
0.00% covered (danger) @@ -378,15 +378,15 @@ - SolanaRpcClient.php -
-
- 90.91% covered (success) + SolanaRpcClient.php +
+
+ 87.88% covered (warning)
-
90.91%
-
30 / 33
+
87.88%
+
29 / 33
60.00% covered (warning) @@ -474,7 +474,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 Thu May 9 3:59:51 UTC 2024. + Generated by php-code-coverage 10.1.14 using PHP 8.3.2 and PHPUnit 10.5.20 at Thu May 9 9:22:33 UTC 2024.

diff --git a/src/Programs/SNS/Bindings.php b/src/Programs/SNS/Bindings.php index c0f920f..22ec674 100644 --- a/src/Programs/SNS/Bindings.php +++ b/src/Programs/SNS/Bindings.php @@ -7,16 +7,18 @@ use Attestto\SolanaPhpSdk\Exceptions\AccountNotFoundException; use Attestto\SolanaPhpSdk\Exceptions\SNSError; use Attestto\SolanaPhpSdk\Programs\SNS\State\NameRegistryStateAccount; +use Attestto\SolanaPhpSdk\Programs\SNS\State\ReverseInstructionAccount; use Attestto\SolanaPhpSdk\Programs\SystemProgram; use Attestto\SolanaPhpSdk\PublicKey; use Attestto\SolanaPhpSdk\TransactionInstruction; use Attestto\SolanaPhpSdk\Util\Buffer; use Exception; +use function PHPUnit\Framework\isInstanceOf; /** * @method createInstruction($NAME_PROGRAM_ID, $programId, PublicKey $nameAccountKey, PublicKey $nameOwner, PublicKey $payerKey, Buffer $hashed_name, Buffer $param, Buffer $param1, PublicKey|null $nameClass, PublicKey|null $parentName, $nameParentOwner) * @method getReverseKeySync(string $subdomain, true $true) - * @method createReverseName(mixed $pubkey, string $string, PublicKey $param, mixed $parent, PublicKey $owner) + * @method getNameOwner(Connection $connection, PublicKey $parentName) * @method retrieve(Connection $connection, mixed $parent) * @method transferInstruction(mixed $NAME_PROGRAM_ID, mixed $pubkey, PublicKey $newOwner, PublicKey|null $owner, $null, mixed $nameParent, $nameParentOwner) @@ -26,11 +28,7 @@ trait Bindings // use Utils; // use Instructions; - /** - * @throws SNSError - * @throws AccountNotFoundException - * @throws Exception - */ + public function createSubdomain( Connection $connection, string $subdomain, @@ -80,6 +78,60 @@ public function createSubdomain( return [[], $ixs]; } + /** + * @throws SNSError + * @throws AccountNotFoundException + * @throws Exception + */ + public function createSubdomainFast( + Connection $connection, + string $subdomain, + PublicKey $subdomainPk, + PublicKey $parentPk, + PublicKey $owner, + int $space = 1000, + PublicKey $feePayer = null + ): array + { + $ixs = []; + $sub = explode(".", $subdomain)[0]; + if (!$sub) { + throw new SNSError(SNSError::InvalidSubdomain); + } + +// $domainKeySync = $this->getDomainKeySync($subdomain); +// $parent = $domainKeySync['parent']; +// $pubkey = $domainKeySync['pubkey']; + + $lamports = 0.01 * 10 ** 9; // 0.01 SOL + + $ix_create = $this->createNameRegistry( + $connection, + "\0" . $sub, + $space + NameRegistryStateAccount::SOL_RECORD_SIG_LEN, + $feePayer ?? $owner, + $owner, + $lamports, + null, + $parentPk + ); + $ixs[] = $ix_create; + + //$reverseKey = $this->getReverseKeySync($subdomain, true); + // $info = $connection->getAccountInfo($reverseKey); + //if (!$info['data']) { + $reverseName = $this->createReverseName( + $subdomainPk, + "\0" . $sub, + $feePayer ?? $owner, + $parentPk, + $owner + ); + $ixs = array_merge($ixs, $reverseName[1]); + // } + + return [[], $ixs]; + } /** * Creates a name account with the given rent budget, allocated space, owner and class. @@ -111,9 +163,9 @@ public function createNameRegistry( $balance = $lamports ?: $connection->getMinimumBalanceForRentExemption($space); - $nameParentOwner = null; - if ($parentName) { - $parentAccount = $this->getNameOwner($connection, $parentName); + $nameParentOwner = $parentName; + if ($parentName) { // TODO review logic + $parentAccount = $this->getNameOwner($connection, $parentName->toBase58()); $nameParentOwner = $parentAccount['registry']->owner; } @@ -188,4 +240,56 @@ public function transferSubdomain( ); } + /** + * This function is used to create a reverse name. + * + * @param PublicKey $nameAccount The name account to create the reverse account for + * @param string $name The name of the domain + * @param PublicKey $feePayer The fee payer of the transaction + * @param PublicKey|null $parentName The parent name account + * @param PublicKey|null $parentNameOwner The parent name owner + * @return array + * @throws Exception + */ + public function createReverseName( + PublicKey $nameAccount, + string $name, + PublicKey $feePayer, + PublicKey $parentName = null, + PublicKey $parentNameOwner = null + ): array { +// $centralState = $this->findProgramAddress( +// [$this->config['REGISTER_PROGRAM_ID']->toBuffer()], +// $this->config['REGISTER_PROGRAM_ID'] +// )[0]; + + $hashedReverseLookup = $this->getHashedNameSync($nameAccount->toBase58()); + $reverseLookupAccount = $this->getNameAccountKeySync( + $hashedReverseLookup, + $this->centralStateSNSRecords, + $parentName + ); + + $initCentralStateInstruction = new ReverseInstructionAccount($name); + $initCentralStateInstruction->getInstruction( + new PublicKey($this->config['REGISTER_PROGRAM_ID']), + new PublicKey($this->config['NAME_PROGRAM_ID']), + new PublicKey($this->config['ROOT_DOMAIN_ACCOUNT']), + + $reverseLookupAccount, + SystemProgram::programId(), + $this->centralStateSNSRecords, + $feePayer, + new PublicKey($this->config['SYSVAR_RENT_PUBKEY']), + $parentName, + $parentNameOwner + ); + + $instructions = [$initCentralStateInstruction]; + + return [[], $instructions]; + } + + + } diff --git a/src/Programs/SNS/Constants/config.json b/src/Programs/SNS/Constants/config.json index a1005a7..f3a9c64 100644 --- a/src/Programs/SNS/Constants/config.json +++ b/src/Programs/SNS/Constants/config.json @@ -12,6 +12,7 @@ "SOL_RECORD_SIG_LEN": 96, "BONFIDA_USDC_BNB": "DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7", "USDC_MINT": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", + "SYSVAR_RENT_PUBKEY" : "SysvarRent111111111111111111111111111111111", "REFERRERS": { "test_wallet": "3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1", "4everland": "DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs", @@ -85,8 +86,8 @@ "VAULT_OWNER": "5D2zKog251d6KPCyFyLMt3KroWwXXPWSgTPyhV22K2gR", "CUSTOM_BG_TLD": "BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz", "WOLVES_COLLECTION_METADATA": "72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT", - "METAPLEX_ID": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", + "METAPLEX_ID": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", "NAME_TOKENIZER_ID" : "nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk", "MINT_PREFIX": "tokenized_name", "BONFIDA_SNS_RECORDS_ID": "HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ" -} \ No newline at end of file +} diff --git a/src/Programs/SNS/Instructions/Instructions.php b/src/Programs/SNS/Instructions/Instructions.php index 64d23a6..d43da04 100644 --- a/src/Programs/SNS/Instructions/Instructions.php +++ b/src/Programs/SNS/Instructions/Instructions.php @@ -304,6 +304,7 @@ function reallocInstruction( * @param PublicKey $refundTargetKey The public key of the refund target. * @param PublicKey $nameOwnerKey The public key of the name owner. * @return TransactionInstruction The created transaction instruction. + * @throws InputValidationException */ function deleteInstruction( PublicKey $nameProgramId, diff --git a/src/Programs/SNS/State/NameRegistryStateAccount.php b/src/Programs/SNS/State/NameRegistryStateAccount.php index 2b124a2..a55db77 100644 --- a/src/Programs/SNS/State/NameRegistryStateAccount.php +++ b/src/Programs/SNS/State/NameRegistryStateAccount.php @@ -56,7 +56,7 @@ public static function retrieve(Connection $connection, string $nameAccountKey): // TODO: Implement retrieveNftOwner //$nftOwner = retrieveNftOwner($connection, $nameAccountKey); - return ['registry' => $res, 'nftOwner' => false]; + return ['registry' => $res, 'nftOwner' => false, 'nameAccountKey' => $nameAccountKey]; } public static function deserialize(array $buffer): self diff --git a/src/Programs/SNS/State/ReverseInstructionAccount.php b/src/Programs/SNS/State/ReverseInstructionAccount.php new file mode 100644 index 0000000..0fda94b --- /dev/null +++ b/src/Programs/SNS/State/ReverseInstructionAccount.php @@ -0,0 +1,100 @@ + [ + 'kind' => 'struct', + 'fields' => [ + ['tag', 'u8'], + ['name', 'string'], + ], + ], + ]; + + + public function __construct(string $name) + { + $this->tag = 12; + $this->name = $name; + } + + /** + * @throws InputValidationException + */ + public function getInstruction( + PublicKey $programId, + PublicKey $namingServiceProgram, + PublicKey $rootDomain, + PublicKey $reverseLookup, + PublicKey $systemProgram, + PublicKey $centralState, + PublicKey $feePayer, + PublicKey $rentSysvar, + PublicKey $parentName = null, + PublicKey $parentNameOwner = null + ): TransactionInstruction { + $data = Buffer::from($this->serialize()); + $keys = [ + new AccountMeta($programId, false, false), + new AccountMeta($namingServiceProgram, false, false), + new AccountMeta($rootDomain, false, false), + new AccountMeta($reverseLookup, false, true), + new AccountMeta($systemProgram, false, false), + new AccountMeta($centralState, false, false), + new AccountMeta($feePayer, true, true), + new AccountMeta($rentSysvar, false, false), + ]; + + if ($parentName !== null) { + $keys[] = ['pubkey' => $parentName, 'isSigner' => false, 'isWritable' => true]; + } + + if ($parentNameOwner !== null) { + $keys[] = ['pubkey' => $parentNameOwner, 'isSigner' => true, 'isWritable' => true]; + } + + return new TransactionInstruction( + $programId, + $keys, + $data + ); + } + + public static function deserialize(array $buffer): self + { + return Borsh::deserialize(self::SCHEMA, self::class, $buffer); + } + public function serialize(): array + { + return Borsh::serialize(self::SCHEMA, $this); + } +} + + + diff --git a/src/Programs/SNS/Utils.php b/src/Programs/SNS/Utils.php index aff2b3d..587fd6d 100644 --- a/src/Programs/SNS/Utils.php +++ b/src/Programs/SNS/Utils.php @@ -2,10 +2,12 @@ namespace Attestto\SolanaPhpSdk\Programs\SNS; -use Attestto\SolanaPhpSdk\Accounts\NameRegistryStateAccount; +use Attestto\SolanaPhpSdk\Exceptions\AccountNotFoundException; +use Attestto\SolanaPhpSdk\Programs\SNS\State\NameRegistryStateAccount; use Attestto\SolanaPhpSdk\Connection; use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; use Attestto\SolanaPhpSdk\Exceptions\SNSError; + use Attestto\SolanaPhpSdk\PublicKey; use Attestto\SolanaPhpSdk\Util\Buffer; @@ -14,7 +16,7 @@ trait Utils // config.json file should be in the same directory as this file public mixed $config; - public $centralStateSNSRecords; + // Constructor @@ -160,4 +162,14 @@ public function getReverseKeySync(string $domain, bool $isSub = null): PublicKey ); } + /** + * @throws SNSError + * @throws AccountNotFoundException + */ + public function getNameOwner(Connection $connection, string $parentNameKey): array + { + return NameRegistryStateAccount::retrieve($connection, $parentNameKey); + + } + } diff --git a/src/Programs/SnsProgram.php b/src/Programs/SnsProgram.php index 5002851..87b7cd1 100644 --- a/src/Programs/SnsProgram.php +++ b/src/Programs/SnsProgram.php @@ -2,7 +2,8 @@ namespace Attestto\SolanaPhpSdk\Programs; -use Attestto\SolanaPhpSdk\Exceptions\BaseSolanaPhpSdkException; + +use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; use Attestto\SolanaPhpSdk\Program; use Attestto\SolanaPhpSdk\Programs\SNS\Bindings; use Attestto\SolanaPhpSdk\Programs\SNS\Utils; @@ -11,6 +12,7 @@ use Attestto\SolanaPhpSdk\SolanaRpcClient; + class SnsProgram extends Program { @@ -19,8 +21,13 @@ class SnsProgram extends Program use Bindings; public mixed $config; + public PublicKey $centralStateSNSRecords; + public const SYSVAR_RENT_PUBKEY = 'SysvarRent111111111111111111111111111111111'; + /** + * @throws InputValidationException + */ public function __construct(SolanaRpcClient $client, $config = null) { parent::__construct($client); @@ -33,7 +40,7 @@ public function __construct(SolanaRpcClient $client, $config = null) $this->centralStateSNSRecords = PublicKey::findProgramAddressSync( [$sns_records_id], - $sns_records_id); + $sns_records_id)[0]; return $this; } diff --git a/src/PublicKey.php b/src/PublicKey.php index e3b24e8..099c8d2 100644 --- a/src/PublicKey.php +++ b/src/PublicKey.php @@ -161,7 +161,7 @@ public static function createProgramAddress(array $seeds, PublicKey $programId): /** * @param array $seeds * @param PublicKey $programId - * @return array 2 elements, [0] = PublicKey, [1] = integer + * @return array 2 elements, [0] = PublicKey, [1] = nonce * @throws BaseSolanaPhpSdkException */ static function findProgramAddress(array $seeds, PublicKey $programId): array diff --git a/tests/Feature/ConnectionFeatureTest.php b/tests/Feature/ConnectionFeatureTest.php index 48e23d1..9149723 100644 --- a/tests/Feature/ConnectionFeatureTest.php +++ b/tests/Feature/ConnectionFeatureTest.php @@ -146,7 +146,7 @@ public function testSendTransaction() $account1 = Keypair::fromSecretKey($secretKey); $account2 = new PublicKey('BURNKKWBSaXmUFQPaABzWWtQ97U2oByNtPiXz3cCAMpq'); - $transfer1 = SystemProgram::transfer($account1->getPublicKey(), $account2->getPublicKey(), 12345); + $transfer1 = SystemProgram::transfer($account1->getPublicKey(), $account2->getPublicKey(), 123); $orgTransaction = new Transaction(); diff --git a/tests/Unit/Programs/Sns/BindingsTest.php b/tests/Unit/Programs/Sns/BindingsTest.php index 31a2489..21095b7 100644 --- a/tests/Unit/Programs/Sns/BindingsTest.php +++ b/tests/Unit/Programs/Sns/BindingsTest.php @@ -20,31 +20,31 @@ class BindingsTest extends TestCase * @throws Exception */ #[Test] - public function testCreateSubDomain() + public function testCreateSubDomainFast() { // Arrange - $nameOwnerKey = new PublicKey(Buffer::alloc(32)); + $nameOwnerKey = new PublicKey('6V3DAZhWgATw8hrmMh7DnvLgaVpHLuMafZZPTVnyUs6Y'); - $client = $this->createMock(SolanaRpcClient::class); - $connection = $this->createMock(Connection::class); - $sns = new SnsProgram($client); - try { - $instruction = $sns->createSubdomain( + $rpcClient = new SolanaRpcClient('https://api.mainnet-beta.solana.com'); + $connection = new Connection($rpcClient); + $sns = new SnsProgram($rpcClient); + + $instruction = $sns->createSubdomainFast( $connection, - 'subdomain', + 'subdomain.chongkan.sol', + new PublicKey('57vj6H1omWUvrQypM8esx4q67WNRZhTW3ZHZ97unkSTb'), // f.chongkan.sol + new PublicKey('34MxBdMJYgugd9ZzmZN338kL1vMqkhPqtnZG5qmWnfn1'), $nameOwnerKey, - 2000, + 1_000, $nameOwnerKey ); - } catch (AccountNotFoundException|SNSError $e) { - $this->fail($e->getMessage()); - } + // Assert - $this->assertInstanceOf(TransactionInstruction::class, $instruction); - $this->assertEquals(0, $instruction->data->toArray()[0]); + $this->assertInstanceOf(TransactionInstruction::class, $instruction[1][0]); + // TODO Assert IX keys and data } diff --git a/tests/Unit/Programs/Sns/DerivationTest.php b/tests/Unit/Programs/Sns/DerivationTest.php index 9317aad..030efa9 100644 --- a/tests/Unit/Programs/Sns/DerivationTest.php +++ b/tests/Unit/Programs/Sns/DerivationTest.php @@ -3,6 +3,7 @@ namespace Attestto\SolanaPhpSdk\Tests\Unit\Programs\SNS; +use Attestto\SolanaPhpSdk\Connection; use Attestto\SolanaPhpSdk\Exceptions\InputValidationException; use Attestto\SolanaPhpSdk\Exceptions\SNSError; @@ -93,4 +94,19 @@ public function test_getReverseKeySync() } } + #[Test] + public function test_getNameOwner() + { + $client = new SolanaRpcClient('https://api.mainnet-beta.solana.com'); + $connection = new Connection($client); + $sns = new SnsProgram($client); + $nameAccountKey = 'HoFfFXqFHAC8RP3duuQNzag1ieUwJRBv1HtRNiWFq4Qu'; + $result = $sns->getNameOwner($connection, $nameAccountKey); + $owner = $result['registry']->owner; + $parent = $result['registry']->parentName; + $this->assertInstanceOf(PublicKey::class, $owner); + $this->assertEquals('CnNHzcp7L4jKiA2Rsca3hZyVwSmoqXaT8wGwzS8WvvB2', $owner->toBase58()); + $this->assertEquals('Crf8hzfthWGbGbLTVCiqRqV5MVnbpHB1L9KQMd6gsinb', $parent->toBase58()); + } + }