File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace ArkEcosystem \Client \API ;
6
+
7
+ class Contracts extends AbstractAPI
8
+ {
9
+ /**
10
+ * Get all contracts.
11
+ *
12
+ * @return array
13
+ */
14
+ public function all (): ?array
15
+ {
16
+ return $ this ->requestGet ('contracts ' );
17
+ }
18
+
19
+ /**
20
+ * Get the node syncing status.
21
+ *
22
+ * @return array
23
+ */
24
+ public function abi (string $ name , string $ implementation ): ?array
25
+ {
26
+ return $ this ->requestGet (sprintf ('contracts/%s/%s/abi ' , $ name , $ implementation ));
27
+ }
28
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace ArkEcosystem \Tests \Client \API ;
6
+
7
+ use ArkEcosystem \Tests \Client \TestCase ;
8
+
9
+ /**
10
+ * @covers \ArkEcosystem\Client\API\Contracts
11
+ */
12
+ class ContractsTest extends TestCase
13
+ {
14
+ /** @test */
15
+ public function all_calls_correct_url ()
16
+ {
17
+ $ this ->assertResponse ('GET ' , 'contracts ' , function ($ client ) {
18
+ return $ client ->contracts ()->all ();
19
+ });
20
+ }
21
+
22
+ /** @test */
23
+ public function abi_calls_correct_url ()
24
+ {
25
+ $ this ->assertResponse ('GET ' , 'contracts/consensus/some-wallet/abi ' , function ($ client ) {
26
+ return $ client ->contracts ()->abi ('consensus ' , 'some-wallet ' );
27
+ });
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments