From 097e639a29a9229b83607e1724691db43198e327 Mon Sep 17 00:00:00 2001 From: Abner Tudtud Date: Fri, 20 Sep 2024 14:16:21 +0800 Subject: [PATCH] Fix source for batch transfer --- src/Commands/BatchProcess.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Commands/BatchProcess.php b/src/Commands/BatchProcess.php index ff785e2..2133946 100644 --- a/src/Commands/BatchProcess.php +++ b/src/Commands/BatchProcess.php @@ -13,6 +13,7 @@ use Enjin\Platform\GraphQL\Schemas\Primary\Substrate\Mutations\BatchMintMutation; use Enjin\Platform\Models\Token; use Enjin\Platform\Services\Blockchain\Implementations\Substrate; +use Enjin\Platform\Services\Database\CollectionService; use Enjin\Platform\Services\Database\TransactionService; use Enjin\Platform\Services\Serialization\Interfaces\SerializationServiceInterface; use Enjin\Platform\Support\Account; @@ -159,9 +160,14 @@ protected function processBatch(BeamType $type): int 'tokenId' => ['integer' => $claim->token_chain_id], 'amount' => $claim->quantity, 'keepAlive' => false, - 'source' => Account::daemonPublicKey() !== $claim->collection->owner->public_key - ? $claim->collection->owner->public_key - : null, + 'source' => match(true) { + resolve(CollectionService::class)->approvalExistsInCollection( + $collectionId, + Account::daemonPublicKey() + ) => Account::daemonPublicKey(), + Account::daemonPublicKey() !== $claim->collection->owner->public_key => $claim->collection->owner->public_key, + default => null + }, ])->toEncodable(), ]; } else {