Conditions | 1 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
19 | protected function connect(): LndGrpcClient |
||
20 | { |
||
21 | //@todo support node selection |
||
22 | putenv('GRPC_SSL_CIPHER_SUITES=HIGH+ECDSA'); |
||
23 | $endpoint = sprintf('%s:%s', $this->settings['host'], $this->settings['port']); |
||
24 | $sslCert = file_get_contents($this->settings['tlscertpath']); |
||
25 | $macaroon = file_get_contents($this->settings['macaroonpath']); |
||
26 | $metadataCallaback = function (array $metadata) use ($macaroon): array { |
||
27 | return array_merge($metadata, ['macaroon' => [bin2hex($macaroon)]]); |
||
28 | }; |
||
29 | |||
30 | /** @psalm-suppress UndefinedClass */ |
||
31 | return new LndGrpcClient($endpoint, [ |
||
32 | 'credentials' => ChannelCredentials::createSsl($sslCert), |
||
33 | 'update_metadata' => $metadataCallaback |
||
34 | ]); |
||
37 |