Skip to content

Commit e50d284

Browse files
committed
fix: small fixes
1 parent a5d7922 commit e50d284

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/Clients/RpcHttpClient.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,17 @@ public function callRaw(string $method, array $params = []): array
128128
* Convenience wrapper returning the result field
129129
* Throws when the RPC response carries an error
130130
*/
131-
public function call(string $method, array $params = []): array
131+
public function call(string $method, array $params = []): false|string
132132
{
133133
$json = $this->callRaw($method, $params);
134134

135135
if (isset($json['error'])) {
136136
throw new RpcException(is_array($json['error']) ? json_encode($json['error']) : (string) $json['error']);
137137
}
138138

139+
139140
// Some providers return already unwrapped arrays for simple calls
140-
return $json['result'] ?? $json;
141+
return isset($json['result']) && is_array($json['result']) ? json_encode($json['result']) : (string) ($json['result'] ?? $json);
141142
}
142143

143144
/**

src/Commands/EvmCallCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Farbcode\LaravelEvm\Commands;
66

7+
use Farbcode\LaravelEvm\LaravelEvm;
78
use Illuminate\Console\Command;
89

910
// Facade Alias
@@ -21,7 +22,7 @@ public function handle(): int
2122
$fn = $this->argument('function');
2223
$args = $this->argument('args');
2324

24-
$res = Evm::at($addr, $abi)->call($fn, $args);
25+
$res = LaravelEvm::at($addr, $abi)->call($fn, $args);
2526
$this->line(json_encode($res, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
2627

2728
return self::SUCCESS;

src/Commands/EvmSendCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Farbcode\LaravelEvm\Commands;
66

7+
use Farbcode\LaravelEvm\LaravelEvm;
78
use Illuminate\Console\Command;
89

910
// Facade Alias
@@ -22,7 +23,7 @@ public function handle(): int
2223
$args = $this->argument('args');
2324
$timeout = (int) $this->option('timeout');
2425

25-
$jobId = Evm::at($addr, $abi)->sendAsync($fn, $args, ['timeout' => $timeout]);
26+
$jobId = LaravelEvm::at($addr, $abi)->sendAsync($fn, $args, ['timeout' => $timeout]);
2627
$this->info('Queued job id '.$jobId);
2728
$this->info('Queue '.config('evm.tx.queue'));
2829

0 commit comments

Comments
 (0)