| Code Coverage
| Lines | Functions and Methods | Classes and Traits
Total | 100.00% covered (success) | 100.00% | 1 / 1 | 100.00% covered (success) | 100.00% | 1 / 1 | CRAP | 100.00% covered (success) | 100.00% | 1 / 1
Metadata | 100.00% covered (success) | 100.00% | 1 / 1 | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 1 / 1
fromBuffer | 100.00% covered (success) | 100.00% | 1 / 1 | 100.00% covered (success) | 100.00% | 1 / 1 | 1 |

1 | <?php
2 |
3 | namespace Attestto\SolanaPhpSdk\Accounts;
4 |
5 | use Attestto\SolanaPhpSdk\Borsh\Borsh;
6 | use Attestto\SolanaPhpSdk\Borsh\BorshDeserializable;
7 | use Attestto\SolanaPhpSdk\Borsh\BorshObject;
8 |
9 | class Metadata
10 | {
11 | use BorshObject;
12 |
13 | public const SCHEMA = [
14 | Creator::class => Creator::SCHEMA[Creator::class],
15 | MetadataData::class => MetadataData::SCHEMA[MetadataData::class],
16 | self::class => [
17 | 'kind' => 'struct',
18 | 'fields' => [
19 | ['key', 'u8'],
20 | ['updateAuthority', 'pubkeyAsString'],
21 | ['mint', 'pubkeyAsString'],
22 | ['data', MetadataData::class],
23 | ['primarySaleHappened', 'u8'], // bool
24 | ['isMutable', 'u8'], // bool
25 | ],
26 | ],
27 | ];
28 |
29 | public static function fromBuffer(array $buffer): self
30 | {
31 | return Borsh::deserialize(self::SCHEMA, self::class, $buffer);
32 | }
33 | }