Create TON API

This commit is contained in:
Daniil Gentili 2019-12-14 16:47:04 +01:00
parent 45d12b6a9d
commit 4917fafd3a
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
14 changed files with 2182 additions and 172 deletions

View File

@ -19,9 +19,7 @@
namespace danog\MadelineProto; namespace danog\MadelineProto;
use danog\MadelineProto\Async\AsyncConstruct; class APIFactory extends AbstractAPIFactory
class APIFactory extends AsyncConstruct
{ {
/** /**
* @internal this is a internal property generated by build_docs.php, don't change manually * @internal this is a internal property generated by build_docs.php, don't change manually
@ -119,134 +117,4 @@ class APIFactory extends AsyncConstruct
* @var auth * @var auth
*/ */
public $auth; public $auth;
public $namespace = '';
public $API;
public $lua = false;
public $async = false;
public $asyncAPIPromise;
protected $methods = [];
public function __construct($namespace, &$API, &$async)
{
$this->namespace = $namespace.'.';
$this->API = &$API;
$this->async = &$async;
}
public function __call($name, $arguments)
{
$yielded = Tools::call($this->__call_async($name, $arguments));
$async = $this->lua === false && (\is_array(\end($arguments)) && isset(\end($arguments)['async']) ? \end($arguments)['async'] : ($this->async && $name !== 'loop'));
if ($async) {
return $yielded;
}
if (!$this->lua) {
return Tools::wait($yielded);
}
try {
$yielded = Tools::wait($yielded);
Lua::convertObjects($yielded);
return $yielded;
} catch (\Throwable $e) {
return ['error_code' => $e->getCode(), 'error' => $e->getMessage()];
}
}
public function __call_async($name, $arguments)
{
if ($this->asyncInitPromise) {
yield $this->initAsynchronously();
$this->API->logger->logger('Finished init asynchronously');
}
if (Magic::isFork() && !Magic::$processed_fork) {
throw new Exception('Forking not supported, use async logic, instead: https://docs.madelineproto.xyz/docs/ASYNC.html');
}
if (!$this->API) {
throw new Exception('API did not init!');
}
if ($this->API->asyncInitPromise) {
yield $this->API->initAsynchronously();
$this->API->logger->logger('Finished init asynchronously');
}
if (isset($this->session) && !\is_null($this->session) && \time() - $this->serialized > $this->API->settings['serialization']['serialization_interval']) {
Logger::log("Didn't serialize in a while, doing that now...");
$this->serialize($this->session);
}
if ($this->API->flushSettings) {
$this->API->flushSettings = false;
$this->API->__construct($this->API->settings);
yield $this->API->initAsynchronously();
}
if ($this->API->asyncInitPromise) {
yield $this->API->initAsynchronously();
$this->API->logger->logger('Finished init asynchronously');
}
$lower_name = \strtolower($name);
if ($this->namespace !== '' || !isset($this->methods[$lower_name])) {
$name = $this->namespace.$name;
$aargs = isset($arguments[1]) && \is_array($arguments[1]) ? $arguments[1] : [];
$aargs['apifactory'] = true;
$aargs['datacenter'] = $this->API->datacenter->curdc;
$args = isset($arguments[0]) && \is_array($arguments[0]) ? $arguments[0] : [];
return yield $this->API->methodCallAsyncRead($name, $args, $aargs);
}
return yield $this->methods[$lower_name](...$arguments);
}
public function &__get($name)
{
if ($this->asyncAPIPromise) {
Tools::wait($this->asyncAPIPromise);
}
if ($name === 'settings') {
$this->API->flushSettings = true;
return $this->API->settings;
}
if ($name === 'logger') {
return $this->API->logger;
}
return $this->API->storage[$name];
}
public function __set($name, $value)
{
if ($this->asyncAPIPromise) {
Tools::wait($this->asyncAPIPromise);
}
if ($name === 'settings') {
if ($this->API->asyncInitPromise) {
$this->API->init();
}
return $this->API->__construct(\array_replace_recursive($this->API->settings, $value));
}
return $this->API->storage[$name] = $value;
}
public function __isset($name)
{
if ($this->asyncAPIPromise) {
Tools::wait($this->asyncAPIPromise);
}
return isset($this->API->storage[$name]);
}
public function __unset($name)
{
if ($this->asyncAPIPromise) {
Tools::wait($this->asyncAPIPromise);
}
unset($this->API->storage[$name]);
}
} }

View File

@ -0,0 +1,155 @@
<?php
/**
* APIFactory module.
*
* This file is part of MadelineProto.
* MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU General Public License along with MadelineProto.
* If not, see <http://www.gnu.org/licenses/>.
*
* @author Daniil Gentili <daniil@daniil.it>
* @copyright 2016-2019 Daniil Gentili <daniil@daniil.it>
* @license https://opensource.org/licenses/AGPL-3.0 AGPLv3
*
* @link https://docs.madelineproto.xyz MadelineProto documentation
*/
namespace danog\MadelineProto;
use danog\MadelineProto\Async\AsyncConstruct;
abstract class AbstractAPIFactory extends AsyncConstruct
{
public $namespace = '';
public $API;
public $lua = false;
public $async = false;
public $asyncAPIPromise;
protected $methods = [];
public function __construct($namespace, &$API, &$async)
{
$this->namespace = $namespace.'.';
$this->API = &$API;
$this->async = &$async;
}
public function __call($name, $arguments)
{
$yielded = Tools::call($this->__call_async($name, $arguments));
$async = $this->lua === false && (\is_array(\end($arguments)) && isset(\end($arguments)['async']) ? \end($arguments)['async'] : ($this->async && $name !== 'loop'));
if ($async) {
return $yielded;
}
if (!$this->lua) {
return Tools::wait($yielded);
}
try {
$yielded = Tools::wait($yielded);
Lua::convertObjects($yielded);
return $yielded;
} catch (\Throwable $e) {
return ['error_code' => $e->getCode(), 'error' => $e->getMessage()];
}
}
public function __call_async($name, $arguments)
{
if ($this->asyncInitPromise) {
yield $this->initAsynchronously();
$this->API->logger->logger('Finished init asynchronously');
}
if (Magic::isFork() && !Magic::$processed_fork) {
throw new Exception('Forking not supported, use async logic, instead: https://docs.madelineproto.xyz/docs/ASYNC.html');
}
if (!$this->API) {
throw new Exception('API did not init!');
}
if ($this->API->asyncInitPromise) {
yield $this->API->initAsynchronously();
$this->API->logger->logger('Finished init asynchronously');
}
if (isset($this->session) && !\is_null($this->session) && \time() - $this->serialized > $this->API->settings['serialization']['serialization_interval']) {
Logger::log("Didn't serialize in a while, doing that now...");
$this->serialize($this->session);
}
if ($this->API->flushSettings) {
$this->API->flushSettings = false;
$this->API->__construct($this->API->settings);
yield $this->API->initAsynchronously();
}
if ($this->API->asyncInitPromise) {
yield $this->API->initAsynchronously();
$this->API->logger->logger('Finished init asynchronously');
}
$lower_name = \strtolower($name);
if ($this->namespace !== '' || !isset($this->methods[$lower_name])) {
$name = $this->namespace.$name;
$aargs = isset($arguments[1]) && \is_array($arguments[1]) ? $arguments[1] : [];
$aargs['apifactory'] = true;
$aargs['datacenter'] = $this->API->datacenter->curdc;
$args = isset($arguments[0]) && \is_array($arguments[0]) ? $arguments[0] : [];
return yield $this->API->methodCallAsyncRead($name, $args, $aargs);
}
return yield $this->methods[$lower_name](...$arguments);
}
public function &__get($name)
{
if ($this->asyncAPIPromise) {
Tools::wait($this->asyncAPIPromise);
}
if ($name === 'settings') {
$this->API->flushSettings = true;
return $this->API->settings;
}
if ($name === 'logger') {
return $this->API->logger;
}
return $this->API->storage[$name];
}
public function __set($name, $value)
{
if ($this->asyncAPIPromise) {
Tools::wait($this->asyncAPIPromise);
}
if ($name === 'settings') {
if ($this->API->asyncInitPromise) {
$this->API->init();
}
return $this->API->__construct(\array_replace_recursive($this->API->settings, $value));
}
return $this->API->storage[$name] = $value;
}
public function __isset($name)
{
if ($this->asyncAPIPromise) {
Tools::wait($this->asyncAPIPromise);
}
return isset($this->API->storage[$name]);
}
public function __unset($name)
{
if ($this->asyncAPIPromise) {
Tools::wait($this->asyncAPIPromise);
}
unset($this->API->storage[$name]);
}
}

View File

@ -27,9 +27,11 @@ class AnnotationsBuilder
{ {
use Tools; use Tools;
public function __construct($logger, $settings) public function __construct(Logger $logger, array $settings, string $output, array $reflectionClasses, string $namespace)
{ {
$this->reflectionClasses = $reflectionClasses;
$this->logger = $logger; $this->logger = $logger;
$this->namespace = $namespace;
$this->TL = new TL(new class($logger) { $this->TL = new TL(new class($logger) {
public function __construct($logger) public function __construct($logger)
{ {
@ -38,6 +40,7 @@ class AnnotationsBuilder
}); });
$this->TL->init($settings['tl_schema']); $this->TL->init($settings['tl_schema']);
$this->settings = $settings; $this->settings = $settings;
$this->output = $output;
} }
public function mkAnnotations() public function mkAnnotations()
@ -58,7 +61,7 @@ class AnnotationsBuilder
{ {
\danog\MadelineProto\Logger::log('Generating properties...', \danog\MadelineProto\Logger::NOTICE); \danog\MadelineProto\Logger::log('Generating properties...', \danog\MadelineProto\Logger::NOTICE);
$fixture = DocBlockFactory::createInstance(); $fixture = DocBlockFactory::createInstance();
$class = new \ReflectionClass(APIFactory::class); $class = new \ReflectionClass($this->reflectionClasses['APIFactory']);
$content = \file_get_contents($filename = $class->getFileName()); $content = \file_get_contents($filename = $class->getFileName());
foreach ($class->getProperties() as $property) { foreach ($class->getProperties() as $property) {
if ($raw_docblock = $property->getDocComment()) { if ($raw_docblock = $property->getDocComment()) {
@ -80,17 +83,17 @@ class AnnotationsBuilder
private function createInternalClasses() private function createInternalClasses()
{ {
\danog\MadelineProto\Logger::log('Creating internal classes...', \danog\MadelineProto\Logger::NOTICE); \danog\MadelineProto\Logger::log('Creating internal classes...', \danog\MadelineProto\Logger::NOTICE);
$handle = \fopen(\dirname(__FILE__).'/InternalDoc.php', 'w'); $handle = \fopen($this->output, 'w');
\fwrite($handle, "<?php namespace danog\\MadelineProto; class InternalDoc extends APIFactory {}"); \fwrite($handle, "<?php namespace {$this->namespace}; class InternalDoc extends APIFactory {}");
$class = new \ReflectionClass(API::class); $class = new \ReflectionClass($this->reflectionClasses['API']);
$methods = $class->getMethods(\ReflectionMethod::IS_STATIC | \ReflectionMethod::IS_PUBLIC); $methods = $class->getMethods(\ReflectionMethod::IS_STATIC | \ReflectionMethod::IS_PUBLIC);
$ignoreMethods = []; $ignoreMethods = [];
foreach ($methods as $method) { foreach ($methods as $method) {
$ignoreMethods[$method->getName()] = $method->getName(); $ignoreMethods[$method->getName()] = $method->getName();
} }
\fclose($handle); \fclose($handle);
$handle = \fopen(\dirname(__FILE__).'/InternalDoc.php', 'w'); $handle = \fopen($this->output, 'w');
$internalDoc = []; $internalDoc = [];
foreach ($this->TL->getMethods()->by_id as $id => $data) { foreach ($this->TL->getMethods()->by_id as $id => $data) {
@ -103,7 +106,7 @@ class AnnotationsBuilder
} }
$internalDoc[$namespace][$method]['title'] = Lang::$current_lang["method_{$data['method']}"] ?? ''; $internalDoc[$namespace][$method]['title'] = Lang::$current_lang["method_{$data['method']}"] ?? '';
$type = \str_ireplace(['vector<', '>'], ['_of_', '[]'], $data['type']); $type = \str_ireplace(['vector<', '>'], [' of ', '[]'], $data['type']);
foreach ($data['params'] as $param) { foreach ($data['params'] as $param) {
if (\in_array($param['name'], ['flags', 'random_id', 'random_bytes'])) { if (\in_array($param['name'], ['flags', 'random_id', 'random_bytes'])) {
continue; continue;
@ -126,7 +129,7 @@ class AnnotationsBuilder
$stype = 'subtype'; $stype = 'subtype';
} }
$ptype = \str_replace('.', '_', $param[$stype]); $ptype = $param[$stype];
switch ($ptype) { switch ($ptype) {
case 'true': case 'true':
case 'false': case 'false':
@ -136,7 +139,7 @@ class AnnotationsBuilder
$opt = ($param['pow'] ?? false) ? 'Optional: ' : ''; $opt = ($param['pow'] ?? false) ? 'Optional: ' : '';
$internalDoc[$namespace][$method]['attr'][$param['name']] = [ $internalDoc[$namespace][$method]['attr'][$param['name']] = [
'type' => $ptype, 'type' => $ptype,
'description' => $opt.Lang::$current_lang["method_{$data['method']}_param_{$param['name']}_type_{$param['type']}"] 'description' => $opt.(Lang::$current_lang["method_{$data['method']}_param_{$param['name']}_type_{$param['type']}"] ?? '')
]; ];
} }
if ($type === 'Bool') { if ($type === 'Bool') {
@ -145,7 +148,7 @@ class AnnotationsBuilder
$internalDoc[$namespace][$method]['return'] = $type; $internalDoc[$namespace][$method]['return'] = $type;
} }
$class = new \ReflectionClass(MTProto::class); $class = new \ReflectionClass($this->reflectionClasses['MTProto']);
$methods = $class->getMethods(\ReflectionMethod::IS_STATIC | \ReflectionMethod::IS_PUBLIC); $methods = $class->getMethods(\ReflectionMethod::IS_STATIC | \ReflectionMethod::IS_PUBLIC);
foreach ($methods as $key => $method) { foreach ($methods as $key => $method) {
$name = $method->getName(); $name = $method->getName();
@ -254,7 +257,7 @@ class AnnotationsBuilder
\fwrite($handle, " * and is used only for autocomplete in multiple IDE\n"); \fwrite($handle, " * and is used only for autocomplete in multiple IDE\n");
\fwrite($handle, " * don't modify manually.\n"); \fwrite($handle, " * don't modify manually.\n");
\fwrite($handle, " */\n\n"); \fwrite($handle, " */\n\n");
\fwrite($handle, "namespace danog\\MadelineProto;\n"); \fwrite($handle, "namespace {$this->namespace};\n");
foreach ($internalDoc as $namespace => $methods) { foreach ($internalDoc as $namespace => $methods) {
if ($namespace === 'InternalDoc') { if ($namespace === 'InternalDoc') {
\fwrite($handle, "\nclass {$namespace} extends APIFactory\n{\n"); \fwrite($handle, "\nclass {$namespace} extends APIFactory\n{\n");

View File

@ -469,7 +469,7 @@ interface account
* *
* Parameters: * Parameters:
* * `InputCheckPasswordSRP` **password** - You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info) * * `InputCheckPasswordSRP` **password** - You cannot use this method directly; use $MadelineProto->update_2fa($params), instead (see https://docs.madelineproto.xyz for more info)
* * `account_PasswordInputSettings` **new_settings** - New 2FA settings * * `account.PasswordInputSettings` **new_settings** - New 2FA settings
* *
* @param array $params Parameters * @param array $params Parameters
* *
@ -545,7 +545,7 @@ interface account
/** /**
* Get all secure telegram passport values. * Get all secure telegram passport values.
* *
* @return _of_SecureValue[] * @return of SecureValue[]
*/ */
public function getAllSecureValues(); public function getAllSecureValues();
@ -557,7 +557,7 @@ interface account
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_SecureValue[] * @return of SecureValue[]
*/ */
public function getSecureValue($params); public function getSecureValue($params);
@ -947,7 +947,7 @@ interface users
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_User[] * @return of User[]
*/ */
public function getUsers($params); public function getUsers($params);
@ -987,14 +987,14 @@ interface contacts
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_int[] * @return of int[]
*/ */
public function getContactIDs($params); public function getContactIDs($params);
/** /**
* Get online status of all users. * Get online status of all users.
* *
* @return _of_ContactStatus[] * @return of ContactStatus[]
*/ */
public function getStatuses(); public function getStatuses();
@ -1153,7 +1153,7 @@ interface contacts
/** /**
* Get saved contacts. * Get saved contacts.
* *
* @return _of_SavedContact[] * @return of SavedContact[]
*/ */
public function getSaved(); public function getSaved();
@ -1333,7 +1333,7 @@ interface messages
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_ReceivedNotifyMessage[] * @return of ReceivedNotifyMessage[]
*/ */
public function receivedMessages($params); public function receivedMessages($params);
@ -1665,7 +1665,7 @@ interface messages
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_long[] * @return of long[]
*/ */
public function receivedQueue($params); public function receivedQueue($params);
@ -1828,7 +1828,7 @@ interface messages
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_int[] * @return of int[]
*/ */
public function getMessagesViews($params); public function getMessagesViews($params);
@ -2206,7 +2206,7 @@ interface messages
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_StickerSetCovered[] * @return of StickerSetCovered[]
*/ */
public function getAttachedStickers($params); public function getAttachedStickers($params);
@ -2518,7 +2518,7 @@ interface messages
/** /**
* Get message ranges to fetch. * Get message ranges to fetch.
* *
* @return _of_MessageRange[] * @return of MessageRange[]
*/ */
public function getSplitRanges(); public function getSplitRanges();
@ -2538,7 +2538,7 @@ interface messages
/** /**
* Get dialogs marked as unread manually. * Get dialogs marked as unread manually.
* *
* @return _of_DialogPeer[] * @return of DialogPeer[]
*/ */
public function getDialogUnreadMarks(); public function getDialogUnreadMarks();
@ -2675,7 +2675,7 @@ interface messages
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_EmojiLanguage[] * @return of EmojiLanguage[]
*/ */
public function getEmojiKeywordsLanguages($params); public function getEmojiKeywordsLanguages($params);
@ -2700,7 +2700,7 @@ interface messages
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_messages.SearchCounter[] * @return of messages.SearchCounter[]
*/ */
public function getSearchCounters($params); public function getSearchCounters($params);
@ -2873,7 +2873,7 @@ interface photos
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_long[] * @return of long[]
*/ */
public function deletePhotos($params); public function deletePhotos($params);
@ -2976,7 +2976,7 @@ interface upload
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_FileHash[] * @return of FileHash[]
*/ */
public function reuploadCdnFile($params); public function reuploadCdnFile($params);
@ -2989,7 +2989,7 @@ interface upload
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_FileHash[] * @return of FileHash[]
*/ */
public function getCdnFileHashes($params); public function getCdnFileHashes($params);
@ -3002,7 +3002,7 @@ interface upload
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_FileHash[] * @return of FileHash[]
*/ */
public function getFileHashes($params); public function getFileHashes($params);
} }
@ -3945,7 +3945,7 @@ interface langpack
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_LangPackString[] * @return of LangPackString[]
*/ */
public function getStrings($params); public function getStrings($params);
@ -3971,7 +3971,7 @@ interface langpack
* *
* @param array $params Parameters * @param array $params Parameters
* *
* @return _of_LangPackLanguage[] * @return of LangPackLanguage[]
*/ */
public function getLanguages($params); public function getLanguages($params);

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* TCP Intermediate stream wrapper. * ADNL stream wrapper.
* *
* This file is part of MadelineProto. * This file is part of MadelineProto.
* MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
@ -16,7 +16,7 @@
* @link https://docs.madelineproto.xyz MadelineProto documentation * @link https://docs.madelineproto.xyz MadelineProto documentation
*/ */
namespace danog\MadelineProto\Stream\MTProtoTransport; namespace danog\MadelineProto\Stream\ADNLTransport;
use Amp\Promise; use Amp\Promise;
use Amp\Socket\EncryptableSocket; use Amp\Socket\EncryptableSocket;
@ -29,9 +29,9 @@ use danog\MadelineProto\Stream\RawStreamInterface;
use danog\MadelineProto\Tools; use danog\MadelineProto\Tools;
/** /**
* TCP Intermediate stream wrapper. * ADNL stream wrapper.
* *
* Manages obfuscated2 encryption/decryption * Manages ADNL envelope
* *
* @author Daniil Gentili <daniil@daniil.it> * @author Daniil Gentili <daniil@daniil.it>
*/ */

View File

@ -158,6 +158,7 @@ class TL
$e = null; $e = null;
$class = null; $class = null;
$dparams = []; $dparams = [];
$lineBuf = '';
foreach ($tl_file as $line_number => $line) { foreach ($tl_file as $line_number => $line) {
$line = \rtrim($line); $line = \rtrim($line);
if (\preg_match('|^//@|', $line)) { if (\preg_match('|^//@|', $line)) {
@ -211,10 +212,21 @@ class TL
continue; continue;
} }
$name = \preg_replace(['/#.*/', '/\\s.*/'], '', $line); $name = \preg_replace(['/#.*/', '/\\s.*/'], '', $line);
if (\in_array($name, ['bytes', 'int128', 'int256', 'int512'])) { if (\in_array($name, ['bytes', 'int128', 'int256', 'int512', 'int', 'long', 'double', 'string', 'bytes', 'object', 'function'])) {
continue; continue;
} }
$clean = \preg_replace(['/:bytes /', '/;/', '/#[a-f0-9]+ /', '/ [a-zA-Z0-9_]+\\:flags\\.[0-9]+\\?true/', '/[<]/', '/[>]/', '/ /', '/^ /', '/ $/', '/\\?bytes /', '/{/', '/}/'], [':string ', '', ' ', '', ' ', ' ', ' ', '', '', '?string ', '', ''], $line); $line = \preg_replace('/[(]([\w\.]+) ([\w\.]+)[)]/', '$1<$2>', $line);
if (\strpos($line, ';') === false) {
$lineBuf .= $line;
continue;
} elseif ($lineBuf) {
$lineBuf .= $line;
$line = $lineBuf;
$lineBuf = '';
}
$clean = \preg_replace(['/:bytes /', '/;/', '/#[a-f0-9]+ /', '/ [a-zA-Z0-9_]+\\:flags\\.[0-9]+\\?true/', '/[<]/', '/[>]/', '/ /', '/^ /', '/ $/', '/\\?bytes /', '/{/', '/}/', '/\s+/'], [':string ', '', ' ', '', ' ', ' ', ' ', '', '', '?string ', '', '', ' '], $line);
$id = \hash('crc32b', $clean); $id = \hash('crc32b', $clean);
if (\preg_match('/^[^\s]+#([a-f0-9]*)/i', $line, $matches)) { if (\preg_match('/^[^\s]+#([a-f0-9]*)/i', $line, $matches)) {
$nid = \str_pad($matches[1], 8, '0', \STR_PAD_LEFT); $nid = \str_pad($matches[1], 8, '0', \STR_PAD_LEFT);

View File

@ -0,0 +1,30 @@
<?php
/**
* TON API module.
*
* This file is part of MadelineProto.
* MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU General Public License along with MadelineProto.
* If not, see <http://www.gnu.org/licenses/>.
*
* @author Daniil Gentili <daniil@daniil.it>
* @copyright 2016-2019 Daniil Gentili <daniil@daniil.it>
* @license https://opensource.org/licenses/AGPL-3.0 AGPLv3
*
* @link https://docs.madelineproto.xyz MadelineProto documentation
*/
namespace danog\MadelineProto\TON;
/**
* TON API.
*/
class ADNL
{
public function test()
{
}
}

View File

@ -0,0 +1,31 @@
<?php
/**
* TON API module.
*
* This file is part of MadelineProto.
* MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU General Public License along with MadelineProto.
* If not, see <http://www.gnu.org/licenses/>.
*
* @author Daniil Gentili <daniil@daniil.it>
* @copyright 2016-2019 Daniil Gentili <daniil@daniil.it>
* @license https://opensource.org/licenses/AGPL-3.0 AGPLv3
*
* @link https://docs.madelineproto.xyz MadelineProto documentation
*/
namespace danog\MadelineProto\TON;
/**
* TON API.
*/
class API extends InternalDoc
{
public function __construct()
{
Magic::classExists();
}
}

View File

@ -0,0 +1,80 @@
<?php
/**
* APIFactory module.
*
* This file is part of MadelineProto.
* MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* MadelineProto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU General Public License along with MadelineProto.
* If not, see <http://www.gnu.org/licenses/>.
*
* @author Daniil Gentili <daniil@daniil.it>
* @copyright 2016-2019 Daniil Gentili <daniil@daniil.it>
* @license https://opensource.org/licenses/AGPL-3.0 AGPLv3
*
* @link https://docs.madelineproto.xyz MadelineProto documentation
*/
namespace danog\MadelineProto\TON;
use danog\MadelineProto\AbstractAPIFactory;
class APIFactory extends AbstractAPIFactory
{
/**
* @internal this is a internal property generated by build_docs.php, don't change manually
*
* @var engine
*/
public $engine;
/**
* @internal this is a internal property generated by build_docs.php, don't change manually
*
* @var adnl
*/
public $adnl;
/**
* @internal this is a internal property generated by build_docs.php, don't change manually
*
* @var tonNode
*/
public $tonNode;
/**
* @internal this is a internal property generated by build_docs.php, don't change manually
*
* @var validatorSession
*/
public $validatorSession;
/**
* @internal this is a internal property generated by build_docs.php, don't change manually
*
* @var catchain
*/
public $catchain;
/**
* @internal this is a internal property generated by build_docs.php, don't change manually
*
* @var overlay
*/
public $overlay;
/**
* @internal this is a internal property generated by build_docs.php, don't change manually
*
* @var dht
*/
public $dht;
/**
* @internal this is a internal property generated by build_docs.php, don't change manually
*
* @var tcp
*/
public $tcp;
/**
* @internal this is a internal property generated by build_docs.php, don't change manually
*
* @var liteServer
*/
public $liteServer;
}

View File

@ -0,0 +1,870 @@
<?php
/**
* This file is automatic generated by build_docs.php file
* and is used only for autocomplete in multiple IDE
* don't modify manually.
*/
namespace danog\MadelineProto\TON;
interface liteServer
{
/**
*
*
* @return liteServer.MasterchainInfo
*/
public function getMasterchainInfo();
/**
*
*
* Parameters:
* * `#` **mode** -.
*
* @param array $params Parameters
*
* @return liteServer.MasterchainInfoExt
*/
public function getMasterchainInfoExt($params);
/**
*
*
* @return liteServer.CurrentTime
*/
public function getTime();
/**
*
*
* @return liteServer.Version
*/
public function getVersion();
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **id** -.
*
* @param array $params Parameters
*
* @return liteServer.BlockData
*/
public function getBlock($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **id** -.
*
* @param array $params Parameters
*
* @return liteServer.BlockState
*/
public function getState($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **id** -
* * `#` **mode** -.
*
* @param array $params Parameters
*
* @return liteServer.BlockHeader
*/
public function getBlockHeader($params);
/**
*
*
* Parameters:
* * `bytes` **body** -.
*
* @param array $params Parameters
*
* @return liteServer.SendMsgStatus
*/
public function sendMessage($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **id** -
* * `liteServer.accountId` **account** -.
*
* @param array $params Parameters
*
* @return liteServer.AccountState
*/
public function getAccountState($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **id** -
* * `int` **workchain** -
* * `long` **shard** -
* * `Bool` **exact** -.
*
* @param array $params Parameters
*
* @return liteServer.ShardInfo
*/
public function getShardInfo($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **id** -.
*
* @param array $params Parameters
*
* @return liteServer.AllShardsInfo
*/
public function getAllShardsInfo($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **id** -
* * `liteServer.accountId` **account** -
* * `long` **lt** -.
*
* @param array $params Parameters
*
* @return liteServer.TransactionInfo
*/
public function getOneTransaction($params);
/**
*
*
* Parameters:
* * `#` **count** -
* * `liteServer.accountId` **account** -
* * `long` **lt** -
* * `int256` **hash** -.
*
* @param array $params Parameters
*
* @return liteServer.TransactionList
*/
public function getTransactions($params);
/**
*
*
* Parameters:
* * `#` **mode** -
* * `tonNode.blockId` **id** -
* * `long` **lt** - Optional:
* * `int` **utime** - Optional:.
*
* @param array $params Parameters
*
* @return liteServer.BlockHeader
*/
public function lookupBlock($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **id** -
* * `#` **mode** -
* * `#` **count** -
* * `liteServer.transactionId3` **after** - Optional:
* * `boolean` **reverse_order** - Optional:
* * `boolean` **want_proof** - Optional:.
*
* @param array $params Parameters
*
* @return liteServer.BlockTransactions
*/
public function listBlockTransactions($params);
/**
*
*
* Parameters:
* * `#` **mode** -
* * `tonNode.blockIdExt` **known_block** -
* * `tonNode.blockIdExt` **target_block** - Optional:.
*
* @param array $params Parameters
*
* @return liteServer.PartialBlockProof
*/
public function getBlockProof($params);
/**
*
*
* Parameters:
* * `#` **mode** -
* * `tonNode.blockIdExt` **id** -.
*
* @param array $params Parameters
*
* @return liteServer.ConfigInfo
*/
public function getConfigAll($params);
/**
*
*
* Parameters:
* * `#` **mode** -
* * `tonNode.blockIdExt` **id** -
* * `[int]` **param_list** -.
*
* @param array $params Parameters
*
* @return liteServer.ConfigInfo
*/
public function getConfigParams($params);
/**
*
*
* Parameters:
* * `#` **mode** -
* * `tonNode.blockIdExt` **id** -
* * `int` **limit** -
* * `int256` **start_after** - Optional:
* * `int` **modified_after** - Optional:.
*
* @param array $params Parameters
*
* @return liteServer.ValidatorStats
*/
public function getValidatorStats($params);
/**
*
*
* @return object
*/
public function queryPrefix();
/**
*
*
* Parameters:
* * `bytes` **data** -.
*
* @param array $params Parameters
*
* @return object
*/
public function query($params);
/**
*
*
* Parameters:
* * `int` **seqno** -
* * `int` **timeout_ms** -.
*
* @param array $params Parameters
*
* @return object
*/
public function waitMasterchainSeqno($params);
}
interface tcp
{
/**
*
*
* @return tcp.Pong
*/
public function ping();
}
interface dht
{
/**
*
*
* @return dht.Pong
*/
public function ping();
/**
*
*
* Parameters:
* * `dht.value` **value** -.
*
* @param array $params Parameters
*
* @return dht.Stored
*/
public function store($params);
/**
*
*
* Parameters:
* * `int256` **key** -
* * `int` **k** -.
*
* @param array $params Parameters
*
* @return dht.Nodes
*/
public function findNode($params);
/**
*
*
* Parameters:
* * `int256` **key** -
* * `int` **k** -.
*
* @param array $params Parameters
*
* @return dht.ValueResult
*/
public function findValue($params);
/**
*
*
* @return dht.Node
*/
public function getSignedAddressList();
/**
*
*
* Parameters:
* * `dht.node` **node** -.
*
* @param array $params Parameters
*
* @return true
*/
public function query($params);
}
interface overlay
{
/**
*
*
* Parameters:
* * `overlay.nodes` **peers** -.
*
* @param array $params Parameters
*
* @return overlay.Nodes
*/
public function getRandomPeers($params);
/**
*
*
* Parameters:
* * `int256` **overlay** -.
*
* @param array $params Parameters
*
* @return true
*/
public function query($params);
/**
*
*
* Parameters:
* * `int256` **hash** -.
*
* @param array $params Parameters
*
* @return overlay.Broadcast
*/
public function getBroadcast($params);
/**
*
*
* Parameters:
* * `overlay.broadcastList` **list** -.
*
* @param array $params Parameters
*
* @return overlay.BroadcastList
*/
public function getBroadcastList($params);
}
interface catchain
{
/**
*
*
* Parameters:
* * `int256` **block** -.
*
* @param array $params Parameters
*
* @return catchain.BlockResult
*/
public function getBlock($params);
/**
*
*
* Parameters:
* * `[int256]` **blocks** -.
*
* @param array $params Parameters
*
* @return catchain.Sent
*/
public function getBlocks($params);
/**
*
*
* Parameters:
* * `[int]` **rt** -.
*
* @param array $params Parameters
*
* @return catchain.Difference
*/
public function getDifference($params);
/**
*
*
* Parameters:
* * `int256` **block** -
* * `long` **height** -
* * `[int256]` **stop_if** -.
*
* @param array $params Parameters
*
* @return catchain.Sent
*/
public function getBlockHistory($params);
}
interface validatorSession
{
/**
*
*
* Parameters:
* * `long` **hash** -.
*
* @param array $params Parameters
*
* @return validatorSession.Pong
*/
public function ping($params);
/**
*
*
* Parameters:
* * `int` **round** -
* * `validatorSession.candidateId` **id** -.
*
* @param array $params Parameters
*
* @return validatorSession.Candidate
*/
public function downloadCandidate($params);
}
interface tonNode
{
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **prev_block** -.
*
* @param array $params Parameters
*
* @return tonNode.BlockDescription
*/
public function getNextBlockDescription($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **prev_block** -
* * `int` **limit** -.
*
* @param array $params Parameters
*
* @return tonNode.BlocksDescription
*/
public function getNextBlocksDescription($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **next_block** -
* * `int` **limit** -
* * `int` **cutoff_seqno** -.
*
* @param array $params Parameters
*
* @return tonNode.BlocksDescription
*/
public function getPrevBlocksDescription($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **block** -
* * `Bool` **allow_partial** -.
*
* @param array $params Parameters
*
* @return tonNode.PreparedProof
*/
public function prepareBlockProof($params);
/**
*
*
* Parameters:
* * `[tonNode.blockIdExt]` **blocks** -
* * `Bool` **allow_partial** -.
*
* @param array $params Parameters
*
* @return tonNode.PreparedProof
*/
public function prepareBlockProofs($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **block** -.
*
* @param array $params Parameters
*
* @return tonNode.Prepared
*/
public function prepareBlock($params);
/**
*
*
* Parameters:
* * `[tonNode.blockIdExt]` **blocks** -.
*
* @param array $params Parameters
*
* @return tonNode.Prepared
*/
public function prepareBlocks($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **block** -
* * `tonNode.blockIdExt` **masterchain_block** -.
*
* @param array $params Parameters
*
* @return tonNode.PreparedState
*/
public function preparePersistentState($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **block** -.
*
* @param array $params Parameters
*
* @return tonNode.PreparedState
*/
public function prepareZeroState($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **block** -
* * `int` **max_size** -.
*
* @param array $params Parameters
*
* @return tonNode.KeyBlocks
*/
public function getNextKeyBlockIds($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **prev_block** -.
*
* @param array $params Parameters
*
* @return tonNode.DataFull
*/
public function downloadNextBlockFull($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **block** -.
*
* @param array $params Parameters
*
* @return tonNode.DataFull
*/
public function downloadBlockFull($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **block** -.
*
* @param array $params Parameters
*
* @return tonNode.Data
*/
public function downloadBlock($params);
/**
*
*
* Parameters:
* * `[tonNode.blockIdExt]` **blocks** -.
*
* @param array $params Parameters
*
* @return tonNode.DataList
*/
public function downloadBlocks($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **block** -
* * `tonNode.blockIdExt` **masterchain_block** -.
*
* @param array $params Parameters
*
* @return tonNode.Data
*/
public function downloadPersistentState($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **block** -
* * `tonNode.blockIdExt` **masterchain_block** -
* * `long` **offset** -
* * `long` **max_size** -.
*
* @param array $params Parameters
*
* @return tonNode.Data
*/
public function downloadPersistentStateSlice($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **block** -.
*
* @param array $params Parameters
*
* @return tonNode.Data
*/
public function downloadZeroState($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **block** -.
*
* @param array $params Parameters
*
* @return tonNode.Data
*/
public function downloadBlockProof($params);
/**
*
*
* Parameters:
* * `[tonNode.blockIdExt]` **blocks** -.
*
* @param array $params Parameters
*
* @return tonNode.DataList
*/
public function downloadBlockProofs($params);
/**
*
*
* Parameters:
* * `tonNode.blockIdExt` **block** -.
*
* @param array $params Parameters
*
* @return tonNode.Data
*/
public function downloadBlockProofLink($params);
/**
*
*
* Parameters:
* * `[tonNode.blockIdExt]` **blocks** -.
*
* @param array $params Parameters
*
* @return tonNode.DataList
*/
public function downloadBlockProofLinks($params);
/**
*
*
* Parameters:
* * `int` **masterchain_seqno** -.
*
* @param array $params Parameters
*
* @return tonNode.ArchiveInfo
*/
public function getArchiveInfo($params);
/**
*
*
* Parameters:
* * `long` **archive_id** -
* * `long` **offset** -
* * `int` **max_size** -.
*
* @param array $params Parameters
*
* @return tonNode.Data
*/
public function getArchiveSlice($params);
/**
*
*
* @return tonNode.Capabilities
*/
public function getCapabilities();
/**
*
*
* Parameters:
* * `tonNode.externalMessage` **message** -.
*
* @param array $params Parameters
*
* @return tonNode.Success
*/
public function slave($params);
/**
*
*
* @return object
*/
public function query();
}
interface adnl
{
/**
*
*
* Parameters:
* * `long` **value** -.
*
* @param array $params Parameters
*
* @return adnl.Pong
*/
public function ping($params);
}
interface engine
{
/**
*
*
* Parameters:
* * `PrivateKey` **key** -
* * `int256` **key_hash** -
* * `int` **category** -
* * `int` **election_date** -
* * `int` **ttl** -
* * `int256` **permanent_key_hash** -
* * `int256` **adnl_id** -
* * `int` **port** -
* * `int256` **peer_key** -
* * `int` **permissions** -
* * `int` **ip** -
* * `[int]` **categories** -
* * `[int]` **priority_categories** -
* * `int` **in_ip** -
* * `int` **in_port** -
* * `int` **out_ip** -
* * `int` **out_port** -
* * `adnl.Proxy` **proxy** -
* * `bytes` **data** -
* * `int` **verbosity** -
* * `string` **election_addr** -
* * `string` **wallet** -
* * `int256` **id** -.
*
* @param array $params Parameters
*
* @return object
*/
public function validator($params);
}
class InternalDoc extends APIFactory
{
public function test(array $extra = [])
{
return $this->__call(__FUNCTION__, [$extra]);
}
}

View File

@ -0,0 +1,79 @@
int ? = Int;
long ? = Long;
double ? = Double;
string ? = String;
object ? = Object;
function ? = Function;
bytes data:string = Bytes;
true = True;
boolTrue = Bool;
boolFalse = Bool;
vector {t:Type} # [ t ] = Vector t;
int128 4*[ int ] = Int128;
int256 8*[ int ] = Int256;
tonNode.blockId workchain:int shard:long seqno:int = tonNode.BlockId;
tonNode.blockIdExt workchain:int shard:long seqno:int root_hash:int256 file_hash:int256 = tonNode.BlockIdExt;
tonNode.zeroStateIdExt workchain:int root_hash:int256 file_hash:int256 = tonNode.ZeroStateIdExt;
adnl.message.query query_id:int256 query:bytes = adnl.Message;
adnl.message.answer query_id:int256 answer:bytes = adnl.Message;
liteServer.error code:int message:string = liteServer.Error;
liteServer.accountId workchain:int id:int256 = liteServer.AccountId;
liteServer.masterchainInfo last:tonNode.blockIdExt state_root_hash:int256 init:tonNode.zeroStateIdExt = liteServer.MasterchainInfo;
liteServer.masterchainInfoExt mode:# version:int capabilities:long last:tonNode.blockIdExt last_utime:int now:int state_root_hash:int256 init:tonNode.zeroStateIdExt = liteServer.MasterchainInfoExt;
liteServer.currentTime now:int = liteServer.CurrentTime;
liteServer.version mode:# version:int capabilities:long now:int = liteServer.Version;
liteServer.blockData id:tonNode.blockIdExt data:bytes = liteServer.BlockData;
liteServer.blockState id:tonNode.blockIdExt root_hash:int256 file_hash:int256 data:bytes = liteServer.BlockState;
liteServer.blockHeader id:tonNode.blockIdExt mode:# header_proof:bytes = liteServer.BlockHeader;
liteServer.sendMsgStatus status:int = liteServer.SendMsgStatus;
liteServer.accountState id:tonNode.blockIdExt shardblk:tonNode.blockIdExt shard_proof:bytes proof:bytes state:bytes = liteServer.AccountState;
liteServer.shardInfo id:tonNode.blockIdExt shardblk:tonNode.blockIdExt shard_proof:bytes shard_descr:bytes = liteServer.ShardInfo;
liteServer.allShardsInfo id:tonNode.blockIdExt proof:bytes data:bytes = liteServer.AllShardsInfo;
liteServer.transactionInfo id:tonNode.blockIdExt proof:bytes transaction:bytes = liteServer.TransactionInfo;
liteServer.transactionList ids:(vector tonNode.blockIdExt) transactions:bytes = liteServer.TransactionList;
liteServer.transactionId mode:# account:mode.0?int256 lt:mode.1?long hash:mode.2?int256 = liteServer.TransactionId;
liteServer.transactionId3 account:int256 lt:long = liteServer.TransactionId3;
liteServer.blockTransactions id:tonNode.blockIdExt req_count:# incomplete:Bool ids:(vector liteServer.transactionId) proof:bytes = liteServer.BlockTransactions;
liteServer.signature node_id_short:int256 signature:bytes = liteServer.Signature;
liteServer.signatureSet validator_set_hash:int catchain_seqno:int signatures:(vector liteServer.signature) = liteServer.SignatureSet;
liteServer.blockLinkBack to_key_block:Bool from:tonNode.blockIdExt to:tonNode.blockIdExt dest_proof:bytes proof:bytes state_proof:bytes = liteServer.BlockLink;
liteServer.blockLinkForward to_key_block:Bool from:tonNode.blockIdExt to:tonNode.blockIdExt dest_proof:bytes config_proof:bytes signatures:liteServer.SignatureSet = liteServer.BlockLink;
liteServer.partialBlockProof complete:Bool from:tonNode.blockIdExt to:tonNode.blockIdExt steps:(vector liteServer.BlockLink) = liteServer.PartialBlockProof;
liteServer.configInfo mode:# id:tonNode.blockIdExt state_proof:bytes config_proof:bytes = liteServer.ConfigInfo;
liteServer.validatorStats mode:# id:tonNode.blockIdExt count:int complete:Bool state_proof:bytes data_proof:bytes = liteServer.ValidatorStats;
liteServer.debug.verbosity value:int = liteServer.debug.Verbosity;
---functions---
liteServer.getMasterchainInfo = liteServer.MasterchainInfo;
liteServer.getMasterchainInfoExt mode:# = liteServer.MasterchainInfoExt;
liteServer.getTime = liteServer.CurrentTime;
liteServer.getVersion = liteServer.Version;
liteServer.getBlock id:tonNode.blockIdExt = liteServer.BlockData;
liteServer.getState id:tonNode.blockIdExt = liteServer.BlockState;
liteServer.getBlockHeader id:tonNode.blockIdExt mode:# = liteServer.BlockHeader;
liteServer.sendMessage body:bytes = liteServer.SendMsgStatus;
liteServer.getAccountState id:tonNode.blockIdExt account:liteServer.accountId = liteServer.AccountState;
liteServer.getShardInfo id:tonNode.blockIdExt workchain:int shard:long exact:Bool = liteServer.ShardInfo;
liteServer.getAllShardsInfo id:tonNode.blockIdExt = liteServer.AllShardsInfo;
liteServer.getOneTransaction id:tonNode.blockIdExt account:liteServer.accountId lt:long = liteServer.TransactionInfo;
liteServer.getTransactions count:# account:liteServer.accountId lt:long hash:int256 = liteServer.TransactionList;
liteServer.lookupBlock mode:# id:tonNode.blockId lt:mode.1?long utime:mode.2?int = liteServer.BlockHeader;
liteServer.listBlockTransactions id:tonNode.blockIdExt mode:# count:# after:mode.7?liteServer.transactionId3 reverse_order:mode.6?true want_proof:mode.5?true = liteServer.BlockTransactions;
liteServer.getBlockProof mode:# known_block:tonNode.blockIdExt target_block:mode.0?tonNode.blockIdExt = liteServer.PartialBlockProof;
liteServer.getConfigAll mode:# id:tonNode.blockIdExt = liteServer.ConfigInfo;
liteServer.getConfigParams mode:# id:tonNode.blockIdExt param_list:(vector int) = liteServer.ConfigInfo;
liteServer.getValidatorStats#091a58bc mode:# id:tonNode.blockIdExt limit:int start_after:mode.0?int256 modified_after:mode.2?int = liteServer.ValidatorStats;
liteServer.queryPrefix = Object;
liteServer.query data:bytes = Object;
liteServer.waitMasterchainSeqno seqno:int timeout_ms:int = Object; // query prefix

View File

@ -0,0 +1,616 @@
int ? = Int;
long ? = Long;
double ? = Double;
string ? = String;
object ? = Object;
function ? = Function;
bytes data:string = Bytes;
true = True;
boolTrue = Bool;
boolFalse = Bool;
vector {t:Type} # [ t ] = Vector t;
int128 4*[ int ] = Int128;
int256 8*[ int ] = Int256;
testObject value:int o:object f:function = TestObject;
testString value:string = TestObject;
testInt value:int = TestObject;
testVectorBytes value:(vector bytes) = TestObject;
tcp.pong random_id:long = tcp.Pong;
tcp.authentificate nonce:bytes = tcp.Message;
tcp.authentificationNonce nonce:bytes = tcp.Message;
tcp.authentificationComplete key:PublicKey signature:bytes = tcp.Message;
fec.raptorQ data_size:int symbol_size:int symbols_count:int = fec.Type;
fec.roundRobin data_size:int symbol_size:int symbols_count:int = fec.Type;
fec.online data_size:int symbol_size:int symbols_count:int = fec.Type;
---functions---
tcp.ping random_id:long = tcp.Pong;
getTestObject = TestObject;
---types---
pk.unenc data:bytes = PrivateKey;
pk.ed25519 key:int256 = PrivateKey;
pk.aes key:int256 = PrivateKey;
pk.overlay name:bytes = PrivateKey;
pub.unenc data:bytes = PublicKey;
pub.ed25519 key:int256 = PublicKey;
pub.aes key:int256 = PublicKey;
pub.overlay name:bytes = PublicKey;
---functions---
---types---
adnl.id.short id:int256 = adnl.id.Short;
adnl.proxyToFastHash ip:int port:int date:int data_hash:int256 shared_secret:int256 = adnl.ProxyTo;
adnl.proxyToFast ip:int port:int date:int signature:int256 = adnl.ProxyToSign;
adnl.proxy.none = adnl.Proxy;
adnl.proxy.fast shared_secret:bytes = adnl.Proxy;
adnl.address.udp ip:int port:int = adnl.Address;
adnl.address.udp6 ip:int128 port:int = adnl.Address;
//adnl.address.tcp ip:int port:int = adnl.Address;
//adnl.address.tcp6 ip:int128 port:int = adnl.Address;
//adnl.address.tunnel to:adnl.Address tunid: = adnl.Address;
adnl.addressList addrs:(vector adnl.Address) version:int reinit_date:int priority:int expire_at:int = adnl.AddressList;
adnl.node id:PublicKey addr_list:adnl.addressList = adnl.Node;
adnl.nodes nodes:(vector adnl.node) = adnl.Nodes;
---functions---
---types---
adnl.packetContents
rand1:bytes
flags:#
from:flags.0?PublicKey
from_short:flags.1?adnl.id.short
message:flags.2?adnl.Message
messages:flags.3?(vector adnl.Message)
address:flags.4?adnl.addressList
priority_address:flags.5?adnl.addressList
seqno:flags.6?long
confirm_seqno:flags.7?long
recv_addr_list_version:flags.8?int
recv_priority_addr_list_version:flags.9?int
reinit_date:flags.10?int
dst_reinit_date:flags.10?int
signature:flags.11?bytes
rand2:bytes
= adnl.PacketContents;
adnl.message.createChannel key:int256 date:int = adnl.Message;
adnl.message.confirmChannel key:int256 peer_key:int256 date:int = adnl.Message;
adnl.message.custom data:bytes = adnl.Message;
adnl.message.nop = adnl.Message;
adnl.message.reinit date:int = adnl.Message;
adnl.message.query query_id:int256 query:bytes = adnl.Message;
adnl.message.answer query_id:int256 answer:bytes = adnl.Message;
adnl.message.part hash:int256 total_size:int offset:int data:bytes = adnl.Message;
---functions---
---types---
adnl.db.node.key local_id:int256 peer_id:int256 = adnl.db.Key;
adnl.db.node.value date:int id:PublicKey addr_list:adnl.addressList priority_addr_list:adnl.addressList = adnl.db.node.Value;
---functions---
---types---
rldp.messagePart transfer_id:int256 fec_type:fec.Type part:int total_size:long seqno:int data:bytes = rldp.MessagePart;
rldp.confirm transfer_id:int256 part:int seqno:int = rldp.MessagePart;
rldp.complete transfer_id:int256 part:int = rldp.MessagePart;
rldp.message id:int256 data:bytes = rldp.Message;
rldp.query query_id:int256 max_answer_size:long timeout:int data:bytes = rldp.Message;
rldp.answer query_id:int256 data:bytes = rldp.Message;
---functions---
---types---
dht.node id:PublicKey addr_list:adnl.addressList version:int signature:bytes = dht.Node;
dht.nodes nodes:(vector dht.node) = dht.Nodes;
dht.key id:int256 name:bytes idx:int = dht.Key;
dht.updateRule.signature = dht.UpdateRule;
dht.updateRule.anybody = dht.UpdateRule;
dht.updateRule.overlayNodes = dht.UpdateRule;
dht.keyDescription key:dht.key id:PublicKey update_rule:dht.UpdateRule signature:bytes = dht.KeyDescription;
dht.value key:dht.keyDescription value:bytes ttl:int signature:bytes = dht.Value;
dht.pong random_id:long = dht.Pong;
dht.valueNotFound nodes:dht.nodes = dht.ValueResult;
dht.valueFound value:dht.Value = dht.ValueResult;
dht.stored = dht.Stored;
dht.message node:dht.node = dht.Message;
dht.db.bucket nodes:dht.nodes = dht.db.Bucket;
dht.db.key.bucket id:int = dht.db.Key;
---functions---
dht.ping random_id:long = dht.Pong;
dht.store value:dht.value = dht.Stored;
dht.findNode key:int256 k:int = dht.Nodes;
dht.findValue key:int256 k:int = dht.ValueResult;
dht.getSignedAddressList = dht.Node;
dht.query node:dht.node = True;
---types---
overlay.node.toSign id:adnl.id.short overlay:int256 version:int = overlay.node.ToSign;
overlay.node id:PublicKey overlay:int256 version:int signature:bytes = overlay.Node;
overlay.nodes nodes:(vector overlay.node) = overlay.Nodes;
overlay.message overlay:int256 = overlay.Message;
//overlay.randomPeers peers:(vector adnl.node) = overlay.RandomPeers;
overlay.broadcastList hashes:(vector int256) = overlay.BroadcastList;
overlay.fec.received hash:int256 = overlay.Broadcast;
overlay.fec.completed hash:int256 = overlay.Broadcast;
overlay.broadcast.id src:int256 data_hash:int256 flags:int = overlay.broadcast.Id;
overlay.broadcastFec.id src:int256 type:int256 data_hash:int256 size:int flags:int = overlay.broadcastFec.Id;
overlay.broadcastFec.partId broadcast_hash:int256 data_hash:int256 seqno:int = overlay.broadcastFec.PartId;
overlay.broadcast.toSign hash:int256 date:int = overlay.broadcast.ToSign;
overlay.certificate issued_by:PublicKey expire_at:int max_size:int signature:bytes = overlay.Certificate;
overlay.emptyCertificate = overlay.Certificate;
overlay.certificateId overlay_id:int256 node:int256 expire_at:int max_size:int = overlay.CertificateId;
overlay.unicast data:bytes = overlay.Broadcast;
overlay.broadcast src:PublicKey certificate:overlay.Certificate flags:int data:bytes date:int signature:bytes = overlay.Broadcast;
overlay.broadcastFec src:PublicKey certificate:overlay.Certificate data_hash:int256 data_size:int flags:int
data:bytes seqno:int fec:fec.Type date:int signature:bytes = overlay.Broadcast;
overlay.broadcastFecShort src:PublicKey certificate:overlay.Certificate broadcast_hash:int256 part_data_hash:int256 seqno:int signature:bytes = overlay.Broadcast;
overlay.broadcastNotFound = overlay.Broadcast;
---functions---
overlay.getRandomPeers peers:overlay.nodes = overlay.Nodes;
overlay.query overlay:int256 = True;
overlay.getBroadcast hash:int256 = overlay.Broadcast;
overlay.getBroadcastList list:overlay.broadcastList = overlay.BroadcastList;
---types---
overlay.db.nodes nodes:overlay.nodes = overlay.db.Nodes;
overlay.db.key.nodes local_id:int256 overlay:int256 = overlay.db.Key;
---functions---
---types---
catchain.block.id incarnation:int256 src:int256 height:int data_hash:int256 = catchain.block.Id;
catchain.block.dep src:int height:int data_hash:int256 signature:bytes = catchain.block.Dep;
catchain.block.data prev:catchain.block.dep deps:(vector catchain.block.dep) = catchain.block.Data;
catchain.block incarnation:int256 src:int height:int data:catchain.block.data signature:bytes = catchain.Block;
catchain.blocks blocks:(vector catchain.block) = catchain.Blocks;
catchain.blockUpdate block:catchain.block = catchain.Update;
catchain.block.data.badBlock block:catchain.block = catchain.block.inner.Data;
catchain.block.data.fork left:catchain.block.Dep right:catchain.block.Dep = catchain.block.inner.Data;
catchain.block.data.nop = catchain.block.inner.Data;
catchain.block.data.vector msgs:(vector bytes) = catchain.block.inner.Data;
//catchain.block.data.custom = catchain.block.inner.Data;
catchain.firstblock unique_hash:int256 nodes:(vector int256) = catchain.FirstBlock;
catchain.difference sent_upto:(vector int) = catchain.Difference;
catchain.differenceFork left:catchain.block.dep right:catchain.block.dep = catchain.Difference;
catchain.blockNotFound = catchain.BlockResult;
catchain.blockResult block:catchain.block = catchain.BlockResult;
catchain.sent cnt:int = catchain.Sent;
---functions---
catchain.getBlock block:int256 = catchain.BlockResult;
catchain.getBlocks blocks:(vector int256) = catchain.Sent;
catchain.getDifference rt:(vector int) = catchain.Difference;
catchain.getBlockHistory block:int256 height:long stop_if:(vector int256) = catchain.Sent;
//catchain.getForkDifference src:int fork:catchain.fork = catchain.ForkDifference;
---types---
validatorSession.round.id session:int256 height:long prev_block:int256 seqno:int = validatorSession.round.Id;
validatorSession.candidate.id round:int256 block_hash:int256 = validatorSession.tempBlock.Id;
validatorSession.message.startSession = validatorSession.Message;
validatorSession.message.finishSession = validatorSession.Message;
validatorSession.message.submittedBlock round:int root_hash:int256 file_hash:int256
collated_data_file_hash:int256 = validatorSession.round.Message;
validatorSession.message.approvedBlock round:int candidate:int256 signature:bytes = validatorSession.round.Message;
validatorSession.message.rejectedBlock round:int candidate:int256 reason:bytes = validatorSession.round.Message;
validatorSession.message.commit round:int candidate:int256 signature:bytes = validatorSession.round.Message;
validatorSession.message.vote round:int attempt:int candidate:int256 = validatorSession.round.Message;
validatorSession.message.voteFor round:int attempt:int candidate:int256 = validatorSession.round.Message;
validatorSession.message.precommit round:int attempt:int candidate:int256 = validatorSession.round.Message;
validatorSession.message.empty round:int attempt:int = validatorSession.round.Message;
validatorSession.pong hash:long = validatorSession.Pong;
validatorSession.candidateId src:int256 root_hash:int256 file_hash:int256 collated_data_file_hash:int256 = validatorSession.CandidateId;
validatorSession.blockUpdate ts:long actions:(vector validatorSession.round.Message) state:int = validatorSession.BlockUpdate;
validatorSession.candidate src:int256 round:int root_hash:int256 data:bytes collated_data:bytes = validatorSession.Candidate;
validatorSession.config catchain_idle_timeout:double catchain_max_deps:int round_candidates:int next_candidate_delay:double round_attempt_duration:int
max_round_attempts:int max_block_size:int max_collated_data_size:int = validatorSession.Config;
---functions---
validatorSession.ping hash:long = validatorSession.Pong;
validatorSession.downloadCandidate round:int id:validatorSession.candidateId = validatorSession.Candidate;
---types---
hashable.bool value:Bool = Hashable;
hashable.int32 value:int = Hashable;
hashable.int64 value:long = Hashable;
hashable.int256 value:int256 = Hashable;
hashable.bytes value:bytes = Hashable;
hashable.pair left:int right:int = Hashable;
hashable.vector value:(vector int) = Hashable;
hashable.validatorSessionOldRound seqno:int block:int signatures:int approve_signatures:int = Hashable;
hashable.validatorSessionRoundAttempt seqno:int votes:int precommitted:int vote_for_inited:int vote_for:int = Hashable;
hashable.validatorSessionRound locked_round:int locked_block:int seqno:int precommitted:Bool
first_attempt:int approved_blocks:int signatures:int attempts:int = Hashable;
hashable.blockSignature signature:int = Hashable;
hashable.sentBlock src:int root_hash:int file_hash:int collated_data_file_hash:int = Hashable;
hashable.sentBlockEmpty = Hashable;
hashable.vote block:int node:int = Hashable;
hashable.blockCandidate block:int approved:int = Hashable;
hashable.blockVoteCandidate block:int approved:int = Hashable;
hashable.blockCandidateAttempt block:int votes:int = Hashable;
hashable.cntVector data:int = Hashable;
hashable.cntSortedVector data:int = Hashable;
hashable.validatorSession ts:int old_rounds:int cur_round:int = Hashable;
---functions---
---types---
tonNode.sessionId workchain:int shard:long cc_seqno:int opts_hash:int256 = tonNode.SessionId;
tonNode.blockSignature who:int256 signature:bytes = tonNode.BlockSignature;
tonNode.blockId workchain:int shard:long seqno:int = tonNode.BlockId;
tonNode.blockIdExt workchain:int shard:long seqno:int root_hash:int256 file_hash:int256 = tonNode.BlockIdExt;
tonNode.zeroStateIdExt workchain:int root_hash:int256 file_hash:int256 = tonNode.ZeroStateIdExt;
tonNode.blockDescriptionEmpty = tonNode.BlockDescription;
tonNode.blockDescription id:tonNode.blockIdExt = tonNode.BlockDescription;
tonNode.blocksDescription ids:(vector tonNode.blockIdExt) incomplete:Bool = tonNode.BlocksDescription;
tonNode.preparedProofEmpty = tonNode.PreparedProof;
tonNode.preparedProof = tonNode.PreparedProof;
tonNode.preparedProofLink = tonNode.PreparedProof;
tonNode.preparedState = tonNode.PreparedState;
tonNode.notFoundState = tonNode.PreparedState;
tonNode.prepared = tonNode.Prepared;
tonNode.notFound = tonNode.Prepared;
tonNode.data data:bytes = tonNode.Data;
//tonNode.preparedKeyBlockProofEmpty = tonNode.PreparedKeyBlockProof;
//tonNode.preparedKeyBlockProof block_id:tonNode.blockIdExt = tonNode.PreparedKeyBlockProof;
tonNode.ihrMessage data:bytes = tonNode.IhrMessage;
tonNode.externalMessage data:bytes = tonNode.ExternalMessage;
tonNode.newShardBlock block:tonNode.blockIdExt cc_seqno:int data:bytes = tonNode.NewShardBlock;
tonNode.blockBroadcast id:tonNode.blockIdExt catchain_seqno:int validator_set_hash:int
signatures:(vector tonNode.blockSignature)
proof:bytes data:bytes = tonNode.Broadcast;
tonNode.ihrMessageBroadcast message:tonNode.ihrMessage = tonNode.Broadcast;
tonNode.externalMessageBroadcast message:tonNode.externalMessage = tonNode.Broadcast;
tonNode.newShardBlockBroadcast block:tonNode.newShardBlock = tonNode.Broadcast;
tonNode.shardPublicOverlayId workchain:int shard:long zero_state_file_hash:int256 = tonNode.ShardPublicOverlayId;
tonNode.keyBlocks blocks:(vector tonNode.blockIdExt) incomplete:Bool error:Bool = tonNode.KeyBlocks;
ton.blockId root_cell_hash:int256 file_hash:int256 = ton.BlockId;
ton.blockIdApprove root_cell_hash:int256 file_hash:int256 = ton.BlockId;
tonNode.dataList data:(vector bytes) = tonNode.DataList;
tonNode.dataFull id:tonNode.blockIdExt proof:bytes block:bytes is_link:Bool = tonNode.DataFull;
tonNode.dataFullEmpty = tonNode.DataFull;
tonNode.capabilities version:int capabilities:long = tonNode.Capabilities;
tonNode.success = tonNode.Success;
tonNode.archiveNotFound = tonNode.ArchiveInfo;
tonNode.archiveInfo id:long = tonNode.ArchiveInfo;
---functions---
tonNode.getNextBlockDescription prev_block:tonNode.blockIdExt = tonNode.BlockDescription;
tonNode.getNextBlocksDescription prev_block:tonNode.blockIdExt limit:int = tonNode.BlocksDescription;
tonNode.getPrevBlocksDescription next_block:tonNode.blockIdExt limit:int cutoff_seqno:int = tonNode.BlocksDescription;
tonNode.prepareBlockProof block:tonNode.blockIdExt allow_partial:Bool = tonNode.PreparedProof;
tonNode.prepareBlockProofs blocks:(vector tonNode.blockIdExt) allow_partial:Bool = tonNode.PreparedProof;
tonNode.prepareBlock block:tonNode.blockIdExt = tonNode.Prepared;
tonNode.prepareBlocks blocks:(vector tonNode.blockIdExt) = tonNode.Prepared;
tonNode.preparePersistentState block:tonNode.blockIdExt masterchain_block:tonNode.blockIdExt = tonNode.PreparedState;
tonNode.prepareZeroState block:tonNode.blockIdExt = tonNode.PreparedState;
tonNode.getNextKeyBlockIds block:tonNode.blockIdExt max_size:int = tonNode.KeyBlocks;
tonNode.downloadNextBlockFull prev_block:tonNode.blockIdExt = tonNode.DataFull;
tonNode.downloadBlockFull block:tonNode.blockIdExt = tonNode.DataFull;
tonNode.downloadBlock block:tonNode.blockIdExt = tonNode.Data;
tonNode.downloadBlocks blocks:(vector tonNode.blockIdExt) = tonNode.DataList;
tonNode.downloadPersistentState block:tonNode.blockIdExt masterchain_block:tonNode.blockIdExt = tonNode.Data;
tonNode.downloadPersistentStateSlice block:tonNode.blockIdExt masterchain_block:tonNode.blockIdExt offset:long max_size:long = tonNode.Data;
tonNode.downloadZeroState block:tonNode.blockIdExt = tonNode.Data;
tonNode.downloadBlockProof block:tonNode.blockIdExt = tonNode.Data;
tonNode.downloadBlockProofs blocks:(vector tonNode.blockIdExt) = tonNode.DataList;
tonNode.downloadBlockProofLink block:tonNode.blockIdExt = tonNode.Data;
tonNode.downloadBlockProofLinks blocks:(vector tonNode.blockIdExt) = tonNode.DataList;
tonNode.getArchiveInfo masterchain_seqno:int = tonNode.ArchiveInfo;
tonNode.getArchiveSlice archive_id:long offset:long max_size:int = tonNode.Data;
tonNode.getCapabilities = tonNode.Capabilities;
tonNode.slave.sendExtMessage message:tonNode.externalMessage = tonNode.Success;
tonNode.query = Object;
---types---
// bit 0 - started
// bit 1 - ready to switch
// bit 2 - switched from
// bit 3 - archived
// bit 4 - disabled
db.root.dbDescription version:int first_masterchain_block_id:tonNode.blockIdExt flags:int = db.root.DbDescription;
db.root.key.cellDb version:int = db.root.Key;
db.root.key.blockDb version:int = db.root.Key;
db.root.config celldb_version:int blockdb_version:int = db.root.Config;
db.root.key.config = db.root.Key;
db.celldb.value block_id:tonNode.blockIdExt prev:int256 next:int256 root_hash:int256 = db.celldb.Value;
db.celldb.key.value hash:int256 = db.celldb.key.Value;
db.block.info#4ac6e727 id:tonNode.blockIdExt flags:# prev_left:flags.1?tonNode.blockIdExt
prev_right:flags.2?tonNode.blockIdExt
next_left:flags.3?tonNode.blockIdExt
next_right:flags.4?tonNode.blockIdExt
lt:flags.13?long
ts:flags.14?int
state:flags.17?int256
masterchain_ref_seqno:flags.23?int = db.block.Info;
db.block.packedInfo id:tonNode.blockIdExt unixtime:int offset:long = db.block.Info;
db.block.archivedInfo id:tonNode.blockIdExt flags:# next:flags.0?tonNode.blockIdExt = db.block.Info;
db.blockdb.value next:tonNode.blockIdExt data:bytes = db.blockdb.Value;
db.blockdb.lru id:tonNode.blockIdExt prev:int256 next:int256 = db.blockdb.Lru;
db.blockdb.key.lru id:tonNode.blockIdExt = db.blockdb.Key;
db.blockdb.key.value id:tonNode.blockIdExt = db.blockdb.Key;
db.candidate source:PublicKey id:tonNode.blockIdExt data:bytes collated_data:bytes = db.Candidate;
db.candidate.id source:PublicKey id:tonNode.blockIdExt collated_data_file_hash:int256 = db.candidate.Id;
db.filedb.key.empty = db.filedb.Key;
db.filedb.key.blockFile block_id:tonNode.blockIdExt = db.filedb.Key;
db.filedb.key.zeroStateFile block_id:tonNode.blockIdExt = db.filedb.Key;
db.filedb.key.persistentStateFile block_id:tonNode.blockIdExt masterchain_block_id:tonNode.blockIdExt = db.filedb.Key;
db.filedb.key.proof block_id:tonNode.blockIdExt = db.filedb.Key;
db.filedb.key.proofLink block_id:tonNode.blockIdExt = db.filedb.Key;
db.filedb.key.signatures block_id:tonNode.blockIdExt = db.filedb.Key;
db.filedb.key.candidate id:db.candidate.id = db.filedb.Key;
db.filedb.key.blockInfo block_id:tonNode.blockIdExt = db.filedb.Key;
db.filedb.value key:db.filedb.Key prev:int256 next:int256 file_hash:int256 = db.filedb.Value;
db.state.destroyedSessions sessions:(vector int256) = db.state.DestroyedSessions;
db.state.initBlockId block:tonNode.blockIdExt = db.state.InitBlockId;
db.state.gcBlockId block:tonNode.blockIdExt = db.state.GcBlockId;
db.state.shardClient block:tonNode.blockIdExt = db.state.ShardClient;
db.state.asyncSerializer block:tonNode.blockIdExt last:tonNode.blockIdExt last_ts:int = db.state.AsyncSerializer;
db.state.hardforks blocks:(vector tonNode.blockIdExt) = db.state.Hardforks;
db.state.dbVersion version:int = db.state.DbVersion;
db.state.key.destroyedSessions = db.state.Key;
db.state.key.initBlockId = db.state.Key;
db.state.key.gcBlockId = db.state.Key;
db.state.key.shardClient = db.state.Key;
db.state.key.asyncSerializer = db.state.Key;
db.state.key.hardforks = db.state.Key;
db.state.key.dbVersion = db.state.Key;
db.lt.el.key workchain:int shard:long idx:int = db.lt.Key;
db.lt.desc.key workchain:int shard:long = db.lt.Key;
db.lt.shard.key idx:int = db.lt.Key;
db.lt.status.key = db.lt.Key;
db.lt.el.value id:tonNode.blockIdExt lt:long ts:int = db.lt.el.Value;
db.lt.desc.value first_idx:int last_idx:int last_seqno:int last_lt:long last_ts:int = db.lt.desc.Value;
db.lt.shard.value workchain:int shard:long = db.lt.shard.Value;
db.lt.status.value total_shards:int = db.lt.status.Value;
db.files.index.key = db.files.Key;
db.files.package.key package_id:int key:Bool temp:Bool = db.files.Key;
db.files.index.value packages:(vector int) key_packages:(vector int) temp_packages:(vector int) = db.files.index.Value;
db.files.package.firstBlock workchain:int shard:long seqno:int unixtime:int lt:long = db.files.package.FirstBlock;
db.files.package.value package_id:int key:Bool temp:Bool firstblocks:(vector db.files.package.firstBlock) deleted:Bool
= db.files.package.Value;
---functions---
---types---
validator.groupMember public_key_hash:int256 adnl:int256 weight:long = engine.validator.GroupMember;
validator.group workchain:int shard:long catchain_seqno:int config_hash:int256 members:(vector validator.groupMember) = validator.Group;
validator.groupEx workchain:int shard:long vertical_seqno:int catchain_seqno:int config_hash:int256 members:(vector validator.groupMember) = validator.Group;
---functions---
---types---
id.config.local id:PrivateKey = id.config.Local;
dht.config.local id:adnl.id.short = dht.config.Local;
dht.config.random.local cnt:int = dht.config.Local;
liteserver.config.local id:PrivateKey port:int = liteserver.config.Local;
liteserver.config.random.local port:int = liteserver.config.Local;
validator.config.local id:adnl.id.short = validator.config.Local;
validator.config.random.local addr_list:adnl.addressList = validator.config.Local;
control.config.local priv:PrivateKey pub:int256 port:int = control.config.Local;
config.local local_ids:(vector id.config.local) dht:(vector dht.config.Local) validators:(vector validator.config.Local) liteservers:(vector liteserver.config.Local) control:(vector control.config.local) = config.Local;
dht.config.global static_nodes:dht.nodes k:int a:int = dht.config.Global;
adnl.config.global static_nodes:adnl.nodes = adnl.config.Global;
catchain.config.global tag:int256 nodes:(vector PublicKey) = catchain.config.Global;
dummyworkchain0.config.global zero_state_hash:int256 = dummyworkchain0.config.Global;
validator.config.global zero_state:tonNode.blockIdExt init_block:tonNode.blockIdExt hardforks:(vector tonNode.blockIdExt) = validator.config.Global;
config.global adnl:adnl.config.global dht:dht.config.global validator:validator.config.global = config.Global;
liteserver.desc id:PublicKey ip:int port:int = liteserver.Desc;
liteclient.config.global liteservers:(vector liteserver.desc) validator:validator.config.global = liteclient.config.Global;
engine.adnl id:int256 category:int = engine.Adnl;
engine.addr ip:int port:int categories:(vector int) priority_categories:(vector int) = engine.Addr;
engine.addrProxy in_ip:int in_port:int out_ip:int out_port:int
proxy_type:adnl.Proxy categories:(vector int) priority_categories:(vector int) = engine.Addr;
engine.dht id:int256 = engine.Dht;
engine.validatorTempKey key:int256 expire_at:int = engine.ValidatorTempKey;
engine.validatorAdnlAddress id:int256 expire_at:int = engine.ValidatorAdnlAddress;
engine.validator id:int256 temp_keys:(vector engine.validatorTempKey) adnl_addrs:(vector engine.validatorAdnlAddress) election_date:int expire_at:int = engine.Validator;
engine.liteServer id:int256 port:int = engine.LiteServer;
engine.controlProcess id:int256 permissions:int = engine.ControlProcess;
engine.controlInterface id:int256 port:int allowed:(vector engine.controlProcess) = engine.ControlInterface;
engine.gc ids:(vector int256) = engine.Gc;
engine.dht.config dht:(vector engine.dht) gc:engine.gc = engine.dht.Config;
engine.validator.fullNodeMaster port:int adnl:int256 = engine.validator.FullNodeMaster;
engine.validator.fullNodeSlave ip:int port:int adnl:PublicKey = engine.validator.FullNodeSlave;
engine.validator.config out_port:int addrs:(vector engine.Addr) adnl:(vector engine.adnl)
dht:(vector engine.dht)
validators:(vector engine.validator) fullnode:int256 fullnodeslaves:(vector engine.validator.fullNodeSlave)
fullnodemasters:(vector engine.validator.fullNodeMaster)
liteservers:(vector engine.liteServer) control:(vector engine.controlInterface)
gc:engine.gc = engine.validator.Config;
---functions---
---types---
engine.adnlProxy.port in_port:int out_port:int dst_ip:int dst_port:int proxy_type:adnl.Proxy = engine.adnlProxy.Port;
engine.adnlProxy.config ports:(vector engine.adnlProxy.port) = engine.adnlProxy.Config;
---functions---
---types---
adnl.pong value:long = adnl.Pong;
---functions---
adnl.ping value:long = adnl.Pong;
---types---
engine.validator.keyHash key_hash:int256 = engine.validator.KeyHash;
engine.validator.signature signature:bytes = engine.validator.Signature;
engine.validator.oneStat key:string value:string = engine.validator.OneStat;
engine.validator.stats stats:(vector engine.validator.oneStat) = engine.validator.Stats;
engine.validator.controlQueryError code:int message:string = engine.validator.ControlQueryError;
engine.validator.time time:int = engine.validator.Time;
engine.validator.success = engine.validator.Success;
engine.validator.jsonConfig data:string = engine.validator.JsonConfig;
engine.validator.electionBid election_date:int perm_key:int256 adnl_addr:int256 to_send_payload:bytes = engine.validator.ElectionBid;
engine.validator.dhtServerStatus id:int256 status:int = engine.validator.DhtServerStatus;
engine.validator.dhtServersStatus servers:(vector engine.validator.dhtServerStatus) = engine.validator.DhtServersStatus;
---functions---
engine.validator.getTime = engine.validator.Time;
engine.validator.importPrivateKey key:PrivateKey = engine.validator.KeyHash;
engine.validator.exportPrivateKey key_hash:int256 = PrivateKey;
engine.validator.exportPublicKey key_hash:int256 = PublicKey;
engine.validator.generateKeyPair = engine.validator.KeyHash;
engine.validator.addAdnlId key_hash:int256 category:int = engine.validator.Success;
engine.validator.addDhtId key_hash:int256 = engine.validator.Success;
engine.validator.addValidatorPermanentKey key_hash:int256 election_date:int ttl:int = engine.validator.Success;
engine.validator.addValidatorTempKey permanent_key_hash:int256 key_hash:int256 ttl:int = engine.validator.Success;
engine.validator.addValidatorAdnlAddress permanent_key_hash:int256 key_hash:int256 ttl:int = engine.validator.Success;
engine.validator.changeFullNodeAdnlAddress adnl_id:int256 = engine.validator.Success;
engine.validator.addLiteserver key_hash:int256 port:int = engine.validator.Success;
engine.validator.addControlInterface key_hash:int256 port:int = engine.validator.Success;
engine.validator.addControlProcess key_hash:int256 port:int peer_key:int256 permissions:int = engine.validator.Success;
engine.validator.delAdnlId key_hash:int256 = engine.validator.Success;
engine.validator.delDhtId key_hash:int256 = engine.validator.Success;
engine.validator.delValidatorPermanentKey key_hash:int256 = engine.validator.Success;
engine.validator.delValidatorTempKey permanent_key_hash:int256 key_hash:int256 = engine.validator.Success;
engine.validator.delValidatorAdnlAddress permanent_key_hash:int256 key_hash:int256 = engine.validator.Success;
engine.validator.addListeningPort ip:int port:int categories:(vector int) priority_categories:(vector int) = engine.validator.Success;
engine.validator.addProxy in_ip:int in_port:int out_ip:int out_port:int proxy:adnl.Proxy categories:(vector int) priority_categories:(vector int) = engine.validator.Success;
engine.validator.delListeningPort ip:int port:int categories:(vector int) priority_categories:(vector int) = engine.validator.Success;
engine.validator.delProxy out_ip:int out_port:int categories:(vector int) priority_categories:(vector int) = engine.validator.Success;
engine.validator.sign key_hash:int256 data:bytes = engine.validator.Signature;
engine.validator.getStats = engine.validator.Stats;
engine.validator.getConfig = engine.validator.JsonConfig;
engine.validator.setVerbosity verbosity:int = engine.validator.Success;
engine.validator.createElectionBid election_date:int election_addr:string wallet:string = engine.validator.ElectionBid;
engine.validator.checkDhtServers id:int256 = engine.validator.DhtServersStatus;
engine.validator.controlQuery data:bytes = Object;

View File

@ -0,0 +1,229 @@
double ? = Double;
string ? = String;
int32 = Int32;
int53 = Int53;
int64 = Int64;
bytes = Bytes;
secureString = SecureString;
secureBytes = SecureBytes;
boolFalse = Bool;
boolTrue = Bool;
vector {t:Type} # [ t ] = Vector t;
error code:int32 message:string = Error;
ok = Ok;
keyStoreTypeDirectory directory:string = KeyStoreType;
keyStoreTypeInMemory = KeyStoreType;
config config:string blockchain_name:string use_callbacks_for_network:Bool ignore_cache:Bool = Config;
options config:config keystore_type:KeyStoreType = Options;
options.configInfo default_wallet_id:int53 = options.ConfigInfo;
options.info config_info:options.configInfo = options.Info;
key public_key:string secret:secureBytes = Key;
inputKeyRegular key:key local_password:secureBytes = InputKey;
inputKeyFake = InputKey;
exportedKey word_list:vector<secureString> = ExportedKey;
exportedPemKey pem:secureString = ExportedPemKey;
exportedEncryptedKey data:secureBytes = ExportedEncryptedKey;
bip39Hints words:vector<string> = Bip39Hints;
accountAddress account_address:string = AccountAddress;
unpackedAccountAddress workchain_id:int32 bounceable:Bool testnet:Bool addr:bytes = UnpackedAccountAddress;
internal.transactionId lt:int64 hash:bytes = internal.TransactionId;
raw.initialAccountState code:bytes data:bytes = raw.InitialAccountState;
raw.accountState balance:int64 code:bytes data:bytes last_transaction_id:internal.transactionId frozen_hash:bytes sync_utime:int53 = raw.AccountState;
raw.message source:string destination:string value:int64 fwd_fee:int64 ihr_fee:int64 created_lt:int64 body_hash:bytes message:bytes = raw.Message;
raw.transaction utime:int53 data:bytes transaction_id:internal.transactionId fee:int64 storage_fee:int64 other_fee:int64 in_msg:raw.message out_msgs:vector<raw.message> = raw.Transaction;
raw.transactions transactions:vector<raw.transaction> previous_transaction_id:internal.transactionId = raw.Transactions;
testWallet.initialAccountState public_key:string = testWallet.InitialAccountState;
testWallet.accountState balance:int64 seqno:int32 last_transaction_id:internal.transactionId sync_utime:int53 = testWallet.AccountState;
wallet.initialAccountState public_key:string = wallet.InitialAccountState;
wallet.accountState balance:int64 seqno:int32 last_transaction_id:internal.transactionId sync_utime:int53 = wallet.AccountState;
wallet.v3.initialAccountState public_key:string wallet_id:int53 = wallet.v3.InitialAccountState;
wallet.v3.accountState balance:int64 wallet_id:int53 seqno:int32 last_transaction_id:internal.transactionId sync_utime:int53 = wallet.v3.AccountState;
testGiver.accountState balance:int64 seqno:int32 last_transaction_id:internal.transactionId sync_utime:int53= testGiver.AccountState;
uninited.accountState balance:int64 last_transaction_id:internal.transactionId frozen_hash:bytes sync_utime:int53 = uninited.AccountState;
//generic.initialAccountStateRaw initital_account_state:raw.initialAccountState = generic.InitialAccountState;
//generic.initialAccountStateTestWallet initital_account_state:testWallet.initialAccountState = generic.InitialAccountState;
//generic.initialAccountStateWallet initital_account_state:wallet.initialAccountState = generic.InitialAccountState;
generic.accountStateRaw account_state:raw.accountState = generic.AccountState;
generic.accountStateTestWallet account_state:testWallet.accountState = generic.AccountState;
generic.accountStateWallet account_state:wallet.accountState = generic.AccountState;
generic.accountStateWalletV3 account_state:wallet.v3.accountState = generic.AccountState;
generic.accountStateTestGiver account_state:testGiver.accountState = generic.AccountState;
generic.accountStateUninited account_state:uninited.accountState = generic.AccountState;
sendGramsResult sent_until:int53 body_hash:bytes = SendGramsResult;
syncStateDone = SyncState;
syncStateInProgress from_seqno:int32 to_seqno:int32 current_seqno:int32 = SyncState;
fees in_fwd_fee:int53 storage_fee:int53 gas_fee:int53 fwd_fee:int53= Fees;
query.fees source_fees:fees destination_fees:fees = query.Fees;
query.info id:int53 valid_until:int53 body_hash:bytes = query.Info;
tvm.slice bytes:string = tvm.Slice;
tvm.cell bytes:string = tvm.Cell;
tvm.numberDecimal number:string = tvm.Number;
tvm.tuple elements:vector<tvm.StackEntry> = tvm.Tuple;
tvm.list elements:vector<tvm.StackEntry> = tvm.List;
tvm.stackEntrySlice slice:tvm.slice = tvm.StackEntry;
tvm.stackEntryCell cell:tvm.cell = tvm.StackEntry;
tvm.stackEntryNumber number:tvm.Number = tvm.StackEntry;
tvm.stackEntryTuple tuple:tvm.Tuple = tvm.StackEntry;
tvm.stackEntryList list:tvm.List = tvm.StackEntry;
tvm.stackEntryUnsupported = tvm.StackEntry;
smc.info id:int53 = smc.Info;
smc.methodIdNumber number:int32 = smc.MethodId;
smc.methodIdName name:string = smc.MethodId;
smc.runResult gas_used:int53 stack:vector<tvm.StackEntry> exit_code:int32 = smc.RunResult;
updateSendLiteServerQuery id:int64 data:bytes = Update;
updateSyncState sync_state:SyncState = Update;
//@class LogStream @description Describes a stream to which tonlib internal log is written
//@description The log is written to stderr or an OS specific log
logStreamDefault = LogStream;
//@description The log is written to a file @path Path to the file to where the internal tonlib log will be written @max_file_size Maximum size of the file to where the internal tonlib log is written before the file will be auto-rotated
logStreamFile path:string max_file_size:int53 = LogStream;
//@description The log is written nowhere
logStreamEmpty = LogStream;
//@description Contains a tonlib internal log verbosity level @verbosity_level Log verbosity level
logVerbosityLevel verbosity_level:int32 = LogVerbosityLevel;
//@description Contains a list of available tonlib internal log tags @tags List of log tags
logTags tags:vector<string> = LogTags;
data bytes:secureBytes = Data;
liteServer.info now:int53 version:int32 capabilities:int64 = liteServer.Info;
---functions---
init options:options = options.Info;
close = Ok;
options.setConfig config:config = options.ConfigInfo;
options.validateConfig config:config = options.ConfigInfo;
createNewKey local_password:secureBytes mnemonic_password:secureBytes random_extra_seed:secureBytes = Key;
deleteKey key:key = Ok;
deleteAllKeys = Ok;
exportKey input_key:InputKey = ExportedKey;
exportPemKey input_key:InputKey key_password:secureBytes = ExportedPemKey;
exportEncryptedKey input_key:InputKey key_password:secureBytes = ExportedEncryptedKey;
importKey local_password:secureBytes mnemonic_password:secureBytes exported_key:exportedKey = Key;
importPemKey local_password:secureBytes key_password:secureBytes exported_key:exportedPemKey = Key;
importEncryptedKey local_password:secureBytes key_password:secureBytes exported_encrypted_key:exportedEncryptedKey = Key;
changeLocalPassword input_key:InputKey new_local_password:secureBytes = Key;
encrypt decrypted_data:secureBytes secret:secureBytes = Data;
decrypt encrypted_data:secureBytes secret:secureBytes = Data;
kdf password:secureBytes salt:secureBytes iterations:int32 = Data;
unpackAccountAddress account_address:string = UnpackedAccountAddress;
packAccountAddress account_address:unpackedAccountAddress = AccountAddress;
getBip39Hints prefix:string = Bip39Hints;
//raw.init initial_account_state:raw.initialAccountState = Ok;
raw.getAccountAddress initital_account_state:raw.initialAccountState = AccountAddress;
raw.getAccountState account_address:accountAddress = raw.AccountState;
raw.getTransactions account_address:accountAddress from_transaction_id:internal.transactionId = raw.Transactions;
raw.sendMessage body:bytes = Ok;
raw.createAndSendMessage destination:accountAddress initial_account_state:bytes data:bytes = Ok;
raw.createQuery destination:accountAddress init_code:bytes init_data:bytes body:bytes = query.Info;
testWallet.init private_key:InputKey = Ok;
testWallet.getAccountAddress initital_account_state:testWallet.initialAccountState = AccountAddress;
testWallet.getAccountState account_address:accountAddress = testWallet.AccountState;
testWallet.sendGrams private_key:InputKey destination:accountAddress seqno:int32 amount:int64 message:bytes = SendGramsResult;
wallet.init private_key:InputKey = Ok;
wallet.getAccountAddress initital_account_state:wallet.initialAccountState = AccountAddress;
wallet.getAccountState account_address:accountAddress = wallet.AccountState;
wallet.sendGrams private_key:InputKey destination:accountAddress seqno:int32 valid_until:int53 amount:int64 message:bytes = SendGramsResult;
wallet.v3.getAccountAddress initital_account_state:wallet.v3.initialAccountState = AccountAddress;
testGiver.getAccountState = testGiver.AccountState;
testGiver.getAccountAddress = AccountAddress;
testGiver.sendGrams destination:accountAddress seqno:int32 amount:int64 message:bytes = SendGramsResult;
sync = Ok;
//generic.getAccountAddress initital_account_state:generic.InitialAccountState = AccountAddress;
generic.getAccountState account_address:accountAddress = generic.AccountState;
generic.sendGrams private_key:InputKey source:accountAddress destination:accountAddress amount:int64 timeout:int32 allow_send_to_uninited:Bool message:bytes = SendGramsResult;
generic.createSendGramsQuery private_key:InputKey source:accountAddress destination:accountAddress amount:int64 timeout:int32 allow_send_to_uninited:Bool message:bytes = query.Info;
query.send id:int53 = Ok;
query.forget id:int53 = Ok;
query.estimateFees id:int53 ignore_chksig:Bool = query.Fees;
query.getInfo id:int53 = query.Info;
smc.load account_address:accountAddress = smc.Info;
smc.getCode id:int53 = tvm.Cell;
smc.getData id:int53 = tvm.Cell;
smc.getState id:int53 = tvm.Cell;
smc.runGetMethod id:int53 method:smc.MethodId stack:vector<tvm.StackEntry> = smc.RunResult;
onLiteServerQueryResult id:int64 bytes:bytes = Ok;
onLiteServerQueryError id:int64 error:error = Ok;
runTests dir:string = Ok;
liteServer.getInfo = liteServer.Info;
//@description Sets new log stream for internal logging of tonlib. This is an offline method. Can be called before authorization. Can be called synchronously @log_stream New log stream
setLogStream log_stream:LogStream = Ok;
//@description Returns information about currently used log stream for internal logging of tonlib. This is an offline method. Can be called before authorization. Can be called synchronously
getLogStream = LogStream;
//@description Sets the verbosity level of the internal logging of tonlib. This is an offline method. Can be called before authorization. Can be called synchronously
//@new_verbosity_level New value of the verbosity level for logging. Value 0 corresponds to fatal errors, value 1 corresponds to errors, value 2 corresponds to warnings and debug warnings, value 3 corresponds to informational, value 4 corresponds to debug, value 5 corresponds to verbose debug, value greater than 5 and up to 1023 can be used to enable even more logging
setLogVerbosityLevel new_verbosity_level:int32 = Ok;
//@description Returns current verbosity level of the internal logging of tonlib. This is an offline method. Can be called before authorization. Can be called synchronously
getLogVerbosityLevel = LogVerbosityLevel;
//@description Returns list of available tonlib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. This is an offline method. Can be called before authorization. Can be called synchronously
getLogTags = LogTags;
//@description Sets the verbosity level for a specified tonlib internal log tag. This is an offline method. Can be called before authorization. Can be called synchronously
//@tag Logging tag to change verbosity level @new_verbosity_level New verbosity level; 1-1024
setLogTagVerbosityLevel tag:string new_verbosity_level:int32 = Ok;
//@description Returns current verbosity level for a specified tonlib internal log tag. This is an offline method. Can be called before authorization. Can be called synchronously @tag Logging tag to change verbosity level
getLogTagVerbosityLevel tag:string = LogVerbosityLevel;
//@description Adds a message to tonlib internal log. This is an offline method. Can be called before authorization. Can be called synchronously
//@verbosity_level Minimum verbosity level needed for the message to be logged, 0-1023 @text Text of a message to log
addLogMessage verbosity_level:int32 text:string = Ok;

View File

@ -11,6 +11,13 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
use danog\MadelineProto\API;
use danog\MadelineProto\APIFactory;
use danog\MadelineProto\MTProto;
use danog\MadelineProto\TON\ADNL;
use danog\MadelineProto\TON\API as TONAPI;
use danog\MadelineProto\TON\APIFactory as TONAPIFactory;
\chdir($d=__DIR__.'/..'); \chdir($d=__DIR__.'/..');
require 'vendor/autoload.php'; require 'vendor/autoload.php';
@ -78,9 +85,39 @@ description: Documentation of old mtproto layers
'.$layer_list); '.$layer_list);
$doc = new \danog\MadelineProto\AnnotationsBuilder($logger, $docs[1]); $doc = new \danog\MadelineProto\AnnotationsBuilder(
$logger,
$docs[1],
\dirname(__FILE__).'/../src/danog/MadelineProto/InternalDoc.php',
[
'API' => API::class,
'APIFactory' => APIFactory::class,
'MTProto' => MTProto::class
],
'danog\\MadelineProto'
);
$doc->mkAnnotations(); $doc->mkAnnotations();
$ton = [
'tl_schema' => [
'lite_api' => "$d/src/danog/MadelineProto/TON/lite_api.tl",
'ton_api' => "$d/src/danog/MadelineProto/TON/ton_api.tl",
//'tonlib_api' => "$d/src/danog/MadelineProto/TON/tonlib_api.tl",
]
];
$doc = new \danog\MadelineProto\AnnotationsBuilder(
$logger,
$ton,
\dirname(__FILE__).'/../src/danog/MadelineProto/TON/InternalDoc.php',
[
'API' => TONAPI::class,
'APIFactory' => TONAPIFactory::class,
'MTProto' => ADNL::class
],
'danog\\MadelineProto\\TON'
);
$doc->mkAnnotations();
foreach ($docs as $settings) { foreach ($docs as $settings) {
$doc = new \danog\MadelineProto\DocsBuilder($logger, $settings); $doc = new \danog\MadelineProto\DocsBuilder($logger, $settings);
$doc->mkDocs(); $doc->mkDocs();