Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Sync improvement #192

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
.*.cache
coverage.xml
composer.lock
cachegrind.out.**
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"kevinrob/guzzle-cache-middleware": "^5.0",
"laravel/pail": "^1.1",
"mll-lab/laravel-graphiql": "^3.0",
"phrity/websocket": "^1.0",
"phrity/websocket": "^3.0",
"rebing/graphql-laravel": "^9.0",
"revolt/event-loop": "^1.0",
"simplesoftwareio/simple-qrcode": "^4.0",
Expand All @@ -51,11 +51,12 @@
"tuupola/base58": "^2.0"
},
"require-dev": {
"fakerphp/faker": "^1.0",
"dms/phpunit-arraysubset-asserts": "dev-master",
"fakerphp/faker": "^1.0",
"larastan/larastan": "^2.0",
"laravel/pint": "^1.0",
"maantje/xhprof-buggregator-laravel": "^0.4.0",
"nunomaduro/collision": "^8.0",
"larastan/larastan": "^2.0",
"orchestra/testbench": "^9.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
Expand Down Expand Up @@ -85,6 +86,7 @@
"scripts": {
"build-sr25519": "cd vendor/gmajor/sr25519-bindings/go && go build -buildmode=c-shared -o sr25519.so . && mv sr25519.so ../src/Crypto/sr25519.so",
"analyse": "vendor/bin/phpstan analyse",
"profile-sync": "XHPROF_ENABLED=true vendor/bin/testbench platform:sync",
"fix": "vendor/bin/pint --config ./pint.json",
"test": "vendor/bin/phpunit",
"test-coverage": "vendor/bin/phpunit --coverage-html ../../temp/coverage",
Expand Down
10 changes: 5 additions & 5 deletions config/enjin-platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
'network-id' => 2000,
'testnet' => false,
'platform-id' => env('SUBSTRATE_ENJIN_PLATFORM_ID', 0),
'node' => env('SUBSTRATE_ENJIN_RPC', 'wss://rpc.matrix.blockchain.enjin.io'),
'node' => env('SUBSTRATE_ENJIN_RPC', 'wss://archive.matrix.blockchain.enjin.io'),
'ss58-prefix' => env('SUBSTRATE_ENJIN_SS58_PREFIX', 1110),
'genesis-hash' => env('SUBSTRATE_ENJIN_GENESIS_HASH', '0x3af4ff48ec76d2efc8476730f423ac07e25ad48f5f4c9dc39c778b164d808615'),
'spec-version' => env('SUBSTRATE_ENJIN_SPEC_VERSION', 1006),
Expand All @@ -111,11 +111,11 @@
'network-id' => 2010,
'testnet' => true,
'platform-id' => env('SUBSTRATE_CANARY_PLATFORM_ID', 0),
'node' => env('SUBSTRATE_CANARY_RPC', 'wss://rpc.matrix.canary.enjin.io'),
'node' => env('SUBSTRATE_CANARY_RPC', 'ws://127.0.0.1:35063'),
'ss58-prefix' => env('SUBSTRATE_CANARY_SS58_PREFIX', 9030),
'genesis-hash' => env('SUBSTRATE_CANARY_GENESIS_HASH', '0xa37725fd8943d2a524cb7ecc65da438f9fa644db78ba24dcd0003e2f95645e8f'),
'spec-version' => env('SUBSTRATE_CANARY_SPEC_VERSION', 1006),
'transaction-version' => env('SUBSTRATE_CANARY_TRANSACTION_VERSION', 7),
'genesis-hash' => env('SUBSTRATE_CANARY_GENESIS_HASH', '0xecf982216c8413c4194c7810bf8bf78199907cc1c46ac15292ad31348173b89c'),
'spec-version' => env('SUBSTRATE_CANARY_SPEC_VERSION', 1010),
'transaction-version' => env('SUBSTRATE_CANARY_TRANSACTION_VERSION', 8),
],
'canary' => $canary,
NetworkType::LOCAL_MATRIX->value => $local = [
Expand Down
9 changes: 3 additions & 6 deletions src/Clients/Abstracts/WebsocketAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function send(string $method, array $params = [], bool $rawResponse = fal
*/
public function sendRaw(string $payload): ?array
{
$this->client()->send($payload);
$this->client()->text($payload);

return JSON::decode($this->client->receive(), true);
}
Expand Down Expand Up @@ -73,7 +73,7 @@ public function setHost(string $host): self
/**
* Get data from the websocket server.
*/
public function receive(): mixed
public function receive(): \WebSocket\Message\Message
{
return $this->client()->receive();
}
Expand All @@ -97,10 +97,7 @@ public function close(): void
protected function client(): Client
{
if (!$this->client || !$this->client->isConnected()) {
$this->client = app(Client::class, [
'uri' => $this->host,
'options' => ['timeout' => 20],
]);
$this->client = new Client($this->host);
}

return $this->client;
Expand Down
Loading
Loading