From cf36822154a200b6a5511a4f66af8c6f9fdf13d2 Mon Sep 17 00:00:00 2001 From: Abner Tudtud <114082473+enjinabner@users.noreply.github.com> Date: Tue, 7 Nov 2023 23:15:24 +0800 Subject: [PATCH] Support null transaction wallet (#43) --- src/Commands/BatchProcess.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Commands/BatchProcess.php b/src/Commands/BatchProcess.php index 06061f5..4f8b178 100644 --- a/src/Commands/BatchProcess.php +++ b/src/Commands/BatchProcess.php @@ -160,7 +160,7 @@ protected function processBatch(BeamType $type): int 'source' => Account::daemonPublicKey() !== $claim->collection->owner->public_key ? $claim->collection->owner->public_key : null, - ]), + ])->toEncodable(), ]; } else { $key = $claim->token_chain_id . '|' . $claim->collection_id; @@ -191,7 +191,7 @@ protected function processBatch(BeamType $type): int 'behaviour' => null, 'unitPrice' => config('enjin-platform-beam.unit_price'), 'attributes' => $claim->attributes ?: [], - ]), + ])->toEncodable(), ]; if (!$this->tokenCreatedCache[$key]) { @@ -203,11 +203,6 @@ protected function processBatch(BeamType $type): int $method = BeamType::MINT_ON_DEMAND == $type ? 'BatchMint' : 'BatchTransfer'; foreach ($params as $param) { - if (!$signingAccount = $this->resolveSigningAccount($param['beamId'])) { - $this->error("Signing account not found for beam ID: {$param['beamId']}, batch ID: {$batchId}"); - - continue; - } $transaction = $this->transaction->store([ 'method' => $method, 'encoded_data' => $this->serialize->encode($method, [ @@ -215,7 +210,7 @@ protected function processBatch(BeamType $type): int 'recipients' => $param['recipients'], ]), 'idempotency_key' => Str::uuid()->toString(), - ], $signingAccount); + ]); BeamBatch::where('id', $batchId)->update(['transaction_id' => $transaction->id]); BeamBatchTransactionCreated::safeBroadcast($param['beamId'], $param['collectionId'], $transaction->id); } @@ -236,6 +231,6 @@ protected function resolveSigningAccount(string $beamId): ?Model return call_user_func(static::$signingAccountResolver, $beamId); } - return Account::daemon(); + return null; } }