Skip to content

Commit b70e9f0

Browse files
mweinschenkgithub-actions[bot]
authored andcommitted
Fix styling
1 parent 67b2675 commit b70e9f0

14 files changed

+45
-40
lines changed

src/Clients/ContractClientGeneric.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
use Farbcode\LaravelEvm\Contracts\AbiCodec;
66
use Farbcode\LaravelEvm\Contracts\ContractClient;
7-
use Farbcode\LaravelEvm\Contracts\FeePolicy;
8-
use Farbcode\LaravelEvm\Contracts\NonceManager;
97
use Farbcode\LaravelEvm\Contracts\RpcClient;
108
use Farbcode\LaravelEvm\Contracts\Signer;
119
use Farbcode\LaravelEvm\Jobs\SendTransaction;
@@ -72,6 +70,7 @@ public function sendAsync(string $function, array $args = [], array $opts = []):
7270
chainId: $this->chainId,
7371
txCfg: $this->txCfg
7472
))->onQueue($queue);
73+
7574
return $requestId;
7675
}
7776

src/Clients/RpcHttpClient.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ public function call(string $method, array $params = []): false|string
136136
throw new RpcException(is_array($json['error']) ? json_encode($json['error']) : (string) $json['error']);
137137
}
138138

139-
140139
// Some providers return already unwrapped arrays for simple calls
141140
return isset($json['result']) && is_array($json['result']) ? json_encode($json['result']) : (string) ($json['result'] ?? $json);
142141
}

src/Codec/AbiCodecWeb3p.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace Farbcode\LaravelEvm\Codec;
66

77
use Farbcode\LaravelEvm\Contracts\AbiCodec;
8-
use Web3\Contract;
9-
use kornrunner\Keccak; // keccak256 helper
8+
use kornrunner\Keccak;
9+
use Web3\Contract; // keccak256 helper
1010

1111
class AbiCodecWeb3p implements AbiCodec
1212
{
@@ -15,23 +15,24 @@ public function encodeFunction(array|string $abi, string $fn, array $args): stri
1515
// web3p Contract::getData() returns void and fills internal state. To avoid dynamic property reliance
1616
// implement a lightweight encoder for common static call patterns.
1717
$abiArray = is_string($abi) ? json_decode($abi, true) : $abi;
18-
if (!is_array($abiArray)) {
18+
if (! is_array($abiArray)) {
1919
throw new \InvalidArgumentException('ABI must decode to array');
2020
}
2121
$item = null;
2222
foreach ($abiArray as $entry) {
2323
if (($entry['type'] ?? '') === 'function' && ($entry['name'] ?? '') === $fn) {
24-
$item = $entry; break;
24+
$item = $entry;
25+
break;
2526
}
2627
}
27-
if (!$item) {
28+
if (! $item) {
2829
throw new \RuntimeException('Function '.$fn.' not found in ABI');
2930
}
3031
$inputs = $item['inputs'] ?? [];
3132
// Build function selector
32-
$typesSig = implode(',', array_map(fn($i) => $i['type'], $inputs));
33+
$typesSig = implode(',', array_map(fn ($i) => $i['type'], $inputs));
3334
$signature = $fn.'('.$typesSig.')';
34-
$hash = Keccak::hash($signature, 256);
35+
$hash = Keccak::hash($signature, 256);
3536
$selector = '0x'.substr($hash, 0, 8);
3637
// Encode arguments (very simplified: handles address, uint256, bytes32, bool, string)
3738
$encodedArgs = '';
@@ -40,6 +41,7 @@ public function encodeFunction(array|string $abi, string $fn, array $args): stri
4041
$val = $args[$idx] ?? null;
4142
$encodedArgs .= $this->encodeValue($type, $val);
4243
}
44+
4345
return $selector.$encodedArgs;
4446
}
4547

@@ -51,10 +53,12 @@ private function encodeValue(string $type, mixed $val): string
5153
}
5254
if ($type === 'address') {
5355
$clean = strtolower(preg_replace('/^0x/', '', (string) $val));
56+
5457
return str_pad($clean, 64, '0', STR_PAD_LEFT);
5558
}
5659
if ($type === 'bytes32') {
5760
$clean = strtolower(preg_replace('/^0x/', '', (string) $val));
61+
5862
return str_pad(substr($clean, 0, 64), 64, '0', STR_PAD_RIGHT);
5963
}
6064
if ($type === 'bool') {
@@ -63,6 +67,7 @@ private function encodeValue(string $type, mixed $val): string
6367
if ($type === 'string') {
6468
// naive: hex of string truncated to 32 bytes
6569
$hex = bin2hex((string) $val);
70+
6671
return str_pad(substr($hex, 0, 64), 64, '0', STR_PAD_RIGHT);
6772
}
6873
throw new \RuntimeException('Unsupported ABI type '.$type);
@@ -71,6 +76,7 @@ private function encodeValue(string $type, mixed $val): string
7176
public function callStatic(array|string $abi, string $fn, array $args, callable $ethCall): mixed
7277
{
7378
$data = $this->encodeFunction($abi, $fn, $args);
79+
7480
return $ethCall($data);
7581
}
7682
}

src/Commands/EvmCallCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function handle(): int
2222
$fn = $this->argument('function');
2323
$args = $this->argument('args');
2424

25-
$res = LaravelEvmFacade::at($addr, $abi)->call($fn, $args);
25+
$res = LaravelEvmFacade::at($addr, $abi)->call($fn, $args);
2626
$this->line(json_encode($res, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
2727

2828
return self::SUCCESS;

src/Commands/EvmSendCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function handle(): int
2323
$args = $this->argument('args');
2424
$timeout = (int) $this->option('timeout');
2525

26-
$jobId = LaravelEvmFacade::at($addr, $abi)->sendAsync($fn, $args, ['timeout' => $timeout]);
26+
$jobId = LaravelEvmFacade::at($addr, $abi)->sendAsync($fn, $args, ['timeout' => $timeout]);
2727
$this->info('Queued job id '.$jobId);
2828
$this->info('Queue '.config('evm.tx.queue'));
2929

src/Crypto/TxBuilderEip1559.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ public function build(array $fields): string
1919
if (method_exists($serialized, '__toString')) {
2020
$serialized = (string) $serialized;
2121
}
22-
if (!is_string($serialized)) {
22+
if (! is_string($serialized)) {
2323
throw new \RuntimeException('Unexpected serialized type for transaction');
2424
}
25+
2526
return $serialized; // unsigned RLP hex
2627
}
2728

src/Facades/EvmContract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Farbcode\LaravelEvm\Facades;
44

5-
use Illuminate\Support\Facades\Facade;
65
use Farbcode\LaravelEvm\Contracts\ContractClient;
6+
use Illuminate\Support\Facades\Facade;
77

88
class EvmContract extends Facade
99
{

src/Facades/EvmFees.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Farbcode\LaravelEvm\Facades;
44

5-
use Illuminate\Support\Facades\Facade;
65
use Farbcode\LaravelEvm\Contracts\FeePolicy;
6+
use Illuminate\Support\Facades\Facade;
77

88
class EvmFees extends Facade
99
{

src/Facades/EvmNonce.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Farbcode\LaravelEvm\Facades;
44

5-
use Illuminate\Support\Facades\Facade;
65
use Farbcode\LaravelEvm\Contracts\NonceManager;
6+
use Illuminate\Support\Facades\Facade;
77

88
class EvmNonce extends Facade
99
{

src/Facades/EvmRpc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Farbcode\LaravelEvm\Facades;
44

5-
use Illuminate\Support\Facades\Facade;
65
use Farbcode\LaravelEvm\Contracts\RpcClient;
6+
use Illuminate\Support\Facades\Facade;
77

88
class EvmRpc extends Facade
99
{

0 commit comments

Comments
 (0)