radianceteam / everscale-client-php Goto Github PK
View Code? Open in Web Editor NEWPHP library for Everscale Client SDK
License: Apache License 2.0
PHP library for Everscale Client SDK
License: Apache License 2.0
PHP code:
$message = 'Hello, Kitty!';
$client = new TonClient(new ClientConfig([
'network' => [
'endpoints' => ['net1.ton.dev', 'net5.ton.dev'],
'message_retries_count' => 3,
],
'abi' => [
'message_expiration_timeout' => 30000,
]
]));
$abiData = json_decode(file_get_contents('data/FreeTON/EmptyContract.abi.json'), true);
$keyData = json_decode(file_get_contents('data/FreeTON/keyfile.json'), true);
$messageConfig = new ParamsOfProcessMessage([
'send_events' => false,
'message_encode_params' => [
'address' => '0:072e03ec094f8bfeef322996e59ca69a478a6847cbddb91d96032818b9cb8524',
'abi' => $abiData,
'call_set' => [
'function_name' => 'acceptTextMessage',
'input' => [
'comment' => bin2hex($message)
]
],
'signer' => [
'type' => 'Keys',
'keys' => $keyData,
]
]
]);
$trx = $client->processing()
->async()
->processMessageAsync($messageConfig);
var_dump($trx->await());
Error trace:
File:
/var/www/udiar/server-app/vendor/radianceteam/ton-client-php/src/TON/TonClientException.php:30
Message:
Invalid parameters: missing field `abi` at line 1 column 389
params: {"message_encode_params":{"address":"0:072e03ec094f8bfeef322996e59ca69a478a6847cbddb91d96032818b9cb8524","call_set":{"function_name":"acceptTextMessage","input":{"comment":"48656c6c6f2c204b6974747921"}},"signer":{"type":"Keys","keys":{"public":"f6c27c577f7dc792989b2ad83aa683ea285412ac45f4e74e1abdd39c9e8173f9","secret":""63c044cf..." (64 chars)"}}},"send_events":false}
Tip: Field "abi" value is expected, but not provided.
Stack trace:
#0 /var/www/udiar/server-app/vendor/radianceteam/ton-client-php/src/TON/TonClientException.php(21): TON\TonClientException::fromErrorDto()
#1 /var/www/udiar/server-app/vendor/radianceteam/ton-client-php/src/TON/TonRequest.php(313): TON\TonClientException::fromJson()
#2 /var/www/udiar/server-app/vendor/radianceteam/ton-client-php/src/TON/TonRequest.php(220): TON\TonRequest->_processEvent()
#3 /var/www/udiar/server-app/vendor/radianceteam/ton-client-php/src/TON/TonRequest.php(114): TON\TonRequest->_readNextEvent()
#4 /var/www/udiar/server-app/vendor/radianceteam/ton-client-php/src/TON/Processing/Async/AsyncResultOfProcessMessage.php(40): TON\TonRequest->await()
#5 /var/www/udiar/server-app/module/Api/src/Controller/AuthController.php(77): TON\Processing\Async\AsyncResultOfProcessMessage->await()
#6 /var/www/udiar/server-app/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(78): Api\Controller\AuthController->qweAction()
#7 /var/www/udiar/server-app/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\Controller\AbstractActionController->onDispatch()
#8 /var/www/udiar/server-app/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners()
#9 /var/www/udiar/server-app/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(104): Zend\EventManager\EventManager->triggerEventUntil()
#10 /var/www/udiar/server-app/vendor/zendframework/zend-mvc/src/DispatchListener.php(138): Zend\Mvc\Controller\AbstractController->dispatch()
#11 /var/www/udiar/server-app/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\DispatchListener->onDispatch()
#12 /var/www/udiar/server-app/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners()
#13 /var/www/udiar/server-app/vendor/zendframework/zend-mvc/src/Application.php(332): Zend\EventManager\EventManager->triggerEventUntil()
#14 /var/www/udiar/server-app/public/index.php(49): Zend\Mvc\Application->run()
#15 {main}
Variable $messageConfig
is:
object(TON\Processing\ParamsOfProcessMessage)[264]
private ?TON\Abi\ParamsOfEncodeMessage '_messageEncodeParams' =>
object(TON\Abi\ParamsOfEncodeMessage)[266]
private ?TON\Abi\Abi '_abi' => null
private ?string '_address' => string '0:072e03ec094f8bfeef322996e59ca69a478a6847cbddb91d96032818b9cb8524' (length=66)
private ?TON\Abi\DeploySet '_deploySet' => null
private ?TON\Abi\CallSet '_callSet' =>
object(TON\Abi\CallSet)[265]
private string '_functionName' => string 'acceptTextMessage' (length=17)
private ?TON\Abi\FunctionHeader '_header' => null
private '_input' =>
array (size=1)
...
private ?TON\Abi\Signer '_signer' =>
object(TON\Abi\Signer_Keys)[278]
private ?TON\Crypto\KeyPair '_keys' =>
object(TON\Crypto\KeyPair)[279]
...
private ?int '_processingTryIndex' => null
private bool '_sendEvents' => boolean false
As you can see private property _abi
is null
. It seems because of Abi::create implementation. It looks for type
property of input array, but *.abi.json-file has no type
within.
Env:
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
# php -v
PHP Warning: Module 'ton_client' already loaded in Unknown on line 0
PHP 7.4.3 (cli) (built: Jul 5 2021 15:13:35) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
with Xdebug v2.9.2, Copyright (c) 2002-2020, by Derick Rethans
TON SDK Version: 1.21.5
Contract code:
pragma ton-solidity >= 0.35.0;
pragma AbiHeader expire;
contract EmptyContract {
constructor() public {
// Check that contract's public key is set
require(tvm.pubkey() != 0, 101);
// Check that message has signature (msg.pubkey() is not zero) and
// message is signed with the owner's private key
require(msg.pubkey() == tvm.pubkey(), 102);
// The current smart contract agrees to buy some gas to finish the
// current transaction. This actions required to process external
// messages, which bring no value (henceno gas) with themselves.
tvm.accept();
}
// Accept message with comment.
function acceptTextMessage(bytes comment) external {
// Each function that accepts external message must check that
// message is correctly signed.
require(msg.pubkey() == tvm.pubkey(), 102);
// Tells to the TVM that we accept this message.
tvm.accept();
}
}
Compiler version:
$ tondev sol version
Component Version Available
--------- ------- ---------------------------------------------------------------------------------------------
compiler 0.48.0 0.49.0, 0.48.0, 0.47.0, 0.46.0, 0.45.0, 0.44.0, 0.43.0, 0.42.0, 0.41.0, 0.40.0, ...
linker 0.13.8 0.13.42, 0.13.40, 0.13.36, 0.13.34, 0.13.33, 0.13.32, 0.13.31, 0.13.30, 0.13.29, 0.13.28, ...
stdlib 0.48.0 0.49.0, 0.48.0, 0.47.0, 0.46.0, 0.45.0, 0.44.0, 0.43.0, 0.42.0, 0.41.0, 0.40.0, ...
Contract compilation:
tondev sol compile --output-dir bin src/EmptyContract.sol
Abi file content:
$ cat bin/EmptyContract.abi.json
{
"ABI version": 2,
"version": "2.1",
"header": ["time", "expire"],
"functions": [
{
"name": "constructor",
"inputs": [
],
"outputs": [
]
},
{
"name": "acceptTextMessage",
"inputs": [
{"name":"comment","type":"bytes"}
],
"outputs": [
]
}
],
"data": [
],
"events": [
],
"fields": [
{"name":"_pubkey","type":"uint256"},
{"name":"_timestamp","type":"uint64"},
{"name":"_constructorFlag","type":"bool"}
]
}
Create Dockerfile based on php-fpm
, with extension installed.
Здравствуйте!
Я только начинаю осваивать ваш проект и everscale, так что прошу не пинать за глупые вопросы. :)
В проекте Broxus в Tip3 контракте https://github.com/broxus/tip3/blob/master/contracts/abstract/TokenRootBase.sol
имеется функция mint. Подскажите, пожалуйста, как я могу вызвать эту функцию, используя ваш проект? В частности, как я могу получить и передать аргумент TvmCell payload?
Заранее благодарен. Павел
Dockerfile + matrix build
Segmentation fault at the end of test run causes the whole test run being marked as FAILED:
https://github.com/radianceteam/ton-client-php/actions/runs/454418160
Reason: probaly in the ton_client
extension, when module is freeing its resources, some callback is called using the aleady-freed pointer data.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.