| Code Coverage
| Lines | Functions and Methods | Classes and Traits
Total | 0.00% covered (danger) | 0.00% | 0 / 56 | 0.00% covered (danger) | 0.00% | 0 / 3 | CRAP | 0.00% covered (danger) | 0.00% | 0 / 1
InstructionBurn | 0.00% covered (danger) | 0.00% | 0 / 56 | 0.00% covered (danger) | 0.00% | 0 / 3 | 12 | 0.00% covered (danger) | 0.00% | 0 / 1
__construct | 0.00% covered (danger) | 0.00% | 0 / 1 | 0.00% covered (danger) | 0.00% | 0 / 1 | 2 |
serialize | 0.00% covered (danger) | 0.00% | 0 / 2 | 0.00% covered (danger) | 0.00% | 0 / 1 | 2 |
getInstruction | 0.00% covered (danger) | 0.00% | 0 / 53 | 0.00% covered (danger) | 0.00% | 0 / 1 | 2 |

1 | <?php
2 |
3 | namespace Attestto\SolanaPhpSdk\Programs\SNS;
4 |
5 | use Attestto\SolanaPhpSdk\Util\Buffer;
6 | use Attestto\SolanaPhpSdk\PublicKey;
7 | use Attestto\SolanaPhpSdk\TransactionInstruction;
8 | use Attestto\SolanaPhpSdk\Borsh\Borsh;
9 |
10 |
11 | class InstructionBurn {
12 | public $tag;
13 |
14 | public const SCHEMA = [
15 |
16 | self::class => [
17 | 'kind' => 'struct',
18 | 'fields' => [
19 | ['tag', 'u8']
20 | ],
21 | ],
22 | ];
23 |
24 | public function __construct() {
25 | $this->tag = 16;
26 | }
27 |
28 | public function serialize(): Buffer {
29 | $array = Borsh::serialize(self::SCHEMA, $this);
30 | return Buffer::from($array);
31 | }
32 |
33 | public function getInstruction(
34 | PublicKey $programId,
35 | PublicKey $nameServiceId,
36 | PublicKey $systemProgram,
37 | PublicKey $domain,
38 | PublicKey $reverse,
39 | PublicKey $resellingState,
40 | PublicKey $state,
41 | PublicKey $centralState,
42 | PublicKey $owner,
43 | PublicKey $target
44 | ): TransactionInstruction {
45 | $data = $this->serialize();
46 | $keys = [
47 | [
48 | 'pubkey' => $nameServiceId,
49 | 'isSigner' => false,
50 | 'isWritable' => false,
51 | ],
52 | [
53 | 'pubkey' => $systemProgram,
54 | 'isSigner' => false,
55 | 'isWritable' => false,
56 | ],
57 | [
58 | 'pubkey' => $domain,
59 | 'isSigner' => false,
60 | 'isWritable' => true,
61 | ],
62 | [
63 | 'pubkey' => $reverse,
64 | 'isSigner' => false,
65 | 'isWritable' => true,
66 | ],
67 | [
68 | 'pubkey' => $resellingState,
69 | 'isSigner' => false,
70 | 'isWritable' => true,
71 | ],
72 | [
73 | 'pubkey' => $state,
74 | 'isSigner' => false,
75 | 'isWritable' => true,
76 | ],
77 | [
78 | 'pubkey' => $centralState,
79 | 'isSigner' => false,
80 | 'isWritable' => false,
81 | ],
82 | [
83 | 'pubkey' => $owner,
84 | 'isSigner' => true,
85 | 'isWritable' => false,
86 | ],
87 | [
88 | 'pubkey' => $target,
89 | 'isSigner' => false,
90 | 'isWritable' => true,
91 | ],
92 | ];
93 |
94 | return new TransactionInstruction([
95 | 'keys' => $keys,
96 | 'programId' => $programId,
97 | 'data' => $data,
98 | ]);
99 | }
100 | }
101 |
102 | ?>