Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 72 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| CreateV2Instruction | |
0.00% |
0 / 72 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| serialize | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getInstruction | |
0.00% |
0 / 68 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Attestto\SolanaPhpSdk\Programs; |
| 4 | |
| 5 | use Attestto\SolanaPhpSdk\Buffer; |
| 6 | use Attestto\SolanaPhpSdk\PublicKey; |
| 7 | use Attestto\SolanaPhpSdk\SystemProgram; |
| 8 | use Attestto\SolanaPhpSdk\TransactionInstruction; |
| 9 | use Attestto\SolanaPhpSdk\TokenProgramId; |
| 10 | |
| 11 | class CreateV2Instruction { |
| 12 | public $tag; |
| 13 | public $name; |
| 14 | public $space; |
| 15 | |
| 16 | public static $schema = [ |
| 17 | 'struct' => [ |
| 18 | 'tag' => 'u8', |
| 19 | 'name' => 'string', |
| 20 | 'space' => 'u32', |
| 21 | ], |
| 22 | ]; |
| 23 | |
| 24 | public function __construct(array $obj) { |
| 25 | $this->tag = 9; |
| 26 | $this->name = $obj['name']; |
| 27 | $this->space = $obj['space']; |
| 28 | } |
| 29 | |
| 30 | public function serialize(): Buffer { |
| 31 | // Implement serialization logic |
| 32 | } |
| 33 | |
| 34 | public function getInstruction( |
| 35 | PublicKey $programId, |
| 36 | PublicKey $rentSysvarAccount, |
| 37 | PublicKey $nameProgramId, |
| 38 | PublicKey $rootDomain, |
| 39 | PublicKey $nameAccount, |
| 40 | PublicKey $reverseLookupAccount, |
| 41 | PublicKey $centralState, |
| 42 | PublicKey $buyer, |
| 43 | PublicKey $buyerTokenAccount, |
| 44 | PublicKey $usdcVault, |
| 45 | PublicKey $state |
| 46 | ): TransactionInstruction { |
| 47 | $data = $this->serialize(); |
| 48 | $keys = [ |
| 49 | [ |
| 50 | 'pubkey' => $rentSysvarAccount, |
| 51 | 'isSigner' => false, |
| 52 | 'isWritable' => false, |
| 53 | ], |
| 54 | [ |
| 55 | 'pubkey' => $nameProgramId, |
| 56 | 'isSigner' => false, |
| 57 | 'isWritable' => false, |
| 58 | ], |
| 59 | [ |
| 60 | 'pubkey' => $rootDomain, |
| 61 | 'isSigner' => false, |
| 62 | 'isWritable' => false, |
| 63 | ], |
| 64 | [ |
| 65 | 'pubkey' => $nameAccount, |
| 66 | 'isSigner' => false, |
| 67 | 'isWritable' => true, |
| 68 | ], |
| 69 | [ |
| 70 | 'pubkey' => $reverseLookupAccount, |
| 71 | 'isSigner' => false, |
| 72 | 'isWritable' => true, |
| 73 | ], |
| 74 | [ |
| 75 | 'pubkey' => SystemProgram::programId(), |
| 76 | 'isSigner' => false, |
| 77 | 'isWritable' => false, |
| 78 | ], |
| 79 | [ |
| 80 | 'pubkey' => $centralState, |
| 81 | 'isSigner' => false, |
| 82 | 'isWritable' => false, |
| 83 | ], |
| 84 | [ |
| 85 | 'pubkey' => $buyer, |
| 86 | 'isSigner' => true, |
| 87 | 'isWritable' => true, |
| 88 | ], |
| 89 | [ |
| 90 | 'pubkey' => $buyerTokenAccount, |
| 91 | 'isSigner' => false, |
| 92 | 'isWritable' => true, |
| 93 | ], |
| 94 | [ |
| 95 | 'pubkey' => $usdcVault, |
| 96 | 'isSigner' => false, |
| 97 | 'isWritable' => true, |
| 98 | ], |
| 99 | [ |
| 100 | 'pubkey' => TokenProgramId::programId(), |
| 101 | 'isSigner' => false, |
| 102 | 'isWritable' => false, |
| 103 | ], |
| 104 | [ |
| 105 | 'pubkey' => $state, |
| 106 | 'isSigner' => false, |
| 107 | 'isWritable' => false, |
| 108 | ], |
| 109 | ]; |
| 110 | |
| 111 | return new TransactionInstruction([ |
| 112 | 'keys' => $keys, |
| 113 | 'programId' => $programId, |
| 114 | 'data' => $data, |
| 115 | ]); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | ?> |