From f36d22393a3288ff2c7cb6206470485e91773790 Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 18 Feb 2024 17:33:19 +0200 Subject: [PATCH] add accountAddress filter --- src/Twig/AppExtension.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Twig/AppExtension.php b/src/Twig/AppExtension.php index 631bed5..bba94f1 100644 --- a/src/Twig/AppExtension.php +++ b/src/Twig/AppExtension.php @@ -59,6 +59,13 @@ class AppExtension extends AbstractExtension 'accountBalance' ] ), + new TwigFilter( + 'account_address', + [ + $this, + 'accountAddress' + ] + ), new TwigFilter( 'message_to_markdown', [ @@ -297,6 +304,24 @@ class AppExtension extends AbstractExtension ); } + public function accountAddress( + string $account + ): ?string + { + // Connect kevacoin + $client = new \Kevachat\Kevacoin\Client( + $this->container->getParameter('app.kevacoin.protocol'), + $this->container->getParameter('app.kevacoin.host'), + $this->container->getParameter('app.kevacoin.port'), + $this->container->getParameter('app.kevacoin.username'), + $this->container->getParameter('app.kevacoin.password') + ); + + return $client->getAccountAddress( + $account + ); + } + public function messageToMarkdown( string $text ): string