diff --git a/README.md b/README.md index 1fa2405..a661316 100755 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ composer require neha0921/substrate-interface-package ## Usage (Just Like) ```php -$testClass = new ApiHandler("http_url"); +$testClass = new SubstrateInterface("http_url"); echo $testClass->rpc->system->name(); ``` diff --git a/public/CallHandler.php b/public/CallHandler.php index 08e2e85..2503c83 100755 --- a/public/CallHandler.php +++ b/public/CallHandler.php @@ -7,7 +7,7 @@ require __DIR__ . '/../vendor/autoload.php'; -// $obj = new ApiHandler("http://127.0.0.1:8000"); +// $obj = new SubstrateInterface("http://127.0.0.1:8000"); // echo $obj->rpc->rpc->methods(); /*Call selected method with input parameter */ @@ -16,7 +16,7 @@ $params = isset($_POST['params']) ? $_POST['params'] : []; $id = isset($_POST['id']) ? $_POST['id'] : 1; - $obj = new ApiHandler("http://127.0.0.1:8000"); + $obj = new SubstrateInterface("http://127.0.0.1:8000"); switch ($methodName) { diff --git a/public/example.php b/public/example.php index 7064e61..8d8441c 100755 --- a/public/example.php +++ b/public/example.php @@ -60,7 +60,7 @@ rpc->system->name().'
'; diff --git a/src/ApiHandler.php b/src/ApiHandler.php index b31f40a..8161559 100755 --- a/src/ApiHandler.php +++ b/src/ApiHandler.php @@ -4,7 +4,7 @@ use neha0921\SubstrateInterfacePackage\Rpc\Rpc; -class ApiHandler +class SubstrateInterface { const API_URL = "http://127.0.0.1:8000"; diff --git a/src/Rpc/Author.php b/src/Rpc/Author.php index a95ca1f..d114459 100755 --- a/src/Rpc/Author.php +++ b/src/Rpc/Author.php @@ -2,7 +2,7 @@ namespace neha0921\SubstrateInterfacePackage\Rpc; -use neha0921\SubstrateInterfacePackage\ApiHandler; +use neha0921\SubstrateInterfacePackage\SubstrateInterface; class Author { @@ -10,7 +10,7 @@ class Author public $apiHandler; - public function __construct(ApiHandler $apiHandler) + public function __construct(SubstrateInterface $apiHandler) { $this->apiHandler = $apiHandler; } diff --git a/src/Rpc/Chain.php b/src/Rpc/Chain.php index f9720fe..7f963e9 100755 --- a/src/Rpc/Chain.php +++ b/src/Rpc/Chain.php @@ -2,7 +2,7 @@ namespace neha0921\SubstrateInterfacePackage\Rpc; -use neha0921\SubstrateInterfacePackage\ApiHandler; +use neha0921\SubstrateInterfacePackage\SubstrateInterface; class Chain { @@ -10,7 +10,7 @@ class Chain public $apiHandler; - public function __construct(ApiHandler $apiHandler) + public function __construct(SubstrateInterface $apiHandler) { $this->apiHandler = $apiHandler; } diff --git a/src/Rpc/Grandpa.php b/src/Rpc/Grandpa.php index 66cefd9..c4aefe5 100755 --- a/src/Rpc/Grandpa.php +++ b/src/Rpc/Grandpa.php @@ -2,7 +2,7 @@ namespace neha0921\SubstrateInterfacePackage\Rpc; -use neha0921\SubstrateInterfacePackage\ApiHandler; +use neha0921\SubstrateInterfacePackage\SubstrateInterface; class Grandpa { @@ -10,7 +10,7 @@ class Grandpa public $apiHandler; - public function __construct(ApiHandler $apiHandler) + public function __construct(SubstrateInterface $apiHandler) { $this->apiHandler = $apiHandler; } diff --git a/src/Rpc/Keypair.php b/src/Rpc/Keypair.php index ec0cdf1..4f534db 100755 --- a/src/Rpc/Keypair.php +++ b/src/Rpc/Keypair.php @@ -2,7 +2,7 @@ namespace neha0921\SubstrateInterfacePackage\Rpc; -use neha0921\SubstrateInterfacePackage\ApiHandler; +use neha0921\SubstrateInterfacePackage\SubstrateInterface; class Keypair { @@ -10,7 +10,7 @@ class Keypair public $apiHandler; - public function __construct(ApiHandler $apiHandler) + public function __construct(SubstrateInterface $apiHandler) { $this->apiHandler = $apiHandler; } diff --git a/src/Rpc/Rpc.php b/src/Rpc/Rpc.php index 99df62b..39ec8f8 100755 --- a/src/Rpc/Rpc.php +++ b/src/Rpc/Rpc.php @@ -2,14 +2,14 @@ namespace neha0921\SubstrateInterfacePackage\Rpc; -use neha0921\SubstrateInterfacePackage\ApiHandler; +use neha0921\SubstrateInterfacePackage\SubstrateInterface; class Rpc { const RPC_PREFIX = 'rpc_'; public $system; private $apiHandler; - public function __construct(ApiHandler $apiHandler) + public function __construct(SubstrateInterface $apiHandler) { $this->apiHandler = $apiHandler; $this->system = new System($apiHandler); diff --git a/src/Rpc/State.php b/src/Rpc/State.php index 980aba0..add1bd6 100755 --- a/src/Rpc/State.php +++ b/src/Rpc/State.php @@ -2,7 +2,7 @@ namespace neha0921\SubstrateInterfacePackage\Rpc; -use neha0921\SubstrateInterfacePackage\ApiHandler; +use neha0921\SubstrateInterfacePackage\SubstrateInterface; class State { @@ -10,7 +10,7 @@ class State public $apiHandler; - public function __construct(ApiHandler $apiHandler) + public function __construct(SubstrateInterface $apiHandler) { $this->apiHandler = $apiHandler; } diff --git a/src/Rpc/System.php b/src/Rpc/System.php index e43720a..37e6f9d 100755 --- a/src/Rpc/System.php +++ b/src/Rpc/System.php @@ -2,7 +2,7 @@ namespace neha0921\SubstrateInterfacePackage\Rpc; -use neha0921\SubstrateInterfacePackage\ApiHandler; +use neha0921\SubstrateInterfacePackage\SubstrateInterface; class System { @@ -11,7 +11,7 @@ class System public $apiHandler; private $a; - public function __construct(ApiHandler $apiHandler) + public function __construct(SubstrateInterface $apiHandler) { $this->apiHandler = $apiHandler; } diff --git a/tests/ApiHandlerTest.php b/tests/ApiHandlerTest.php index 8f46397..6b7ddbc 100755 --- a/tests/ApiHandlerTest.php +++ b/tests/ApiHandlerTest.php @@ -2,16 +2,16 @@ namespace TheTestCoder\PhpPackageStructure\Tests; -use neha0921\SubstrateInterfacePackage\ApiHandler; +use neha0921\SubstrateInterfacePackage\SubstrateInterface; use PHPUnit\Framework\TestCase; -class ApiHandlerTest extends TestCase +class SubstrateInterfaceTest extends TestCase { /** @test */ public function testSystemName() { - $obj = new ApiHandler("http://127.0.0.1:8000"); + $obj = new SubstrateInterface("http://127.0.0.1:8000"); $expectedResultContainsPartial = 'Parity Polkadot'; $actualResult = $obj->rpc->system->name();