Skip to content

Commit

Permalink
Check wallet deamon approval
Browse files Browse the repository at this point in the history
  • Loading branch information
enjinabner committed Sep 22, 2024
1 parent 3adb120 commit fa32589
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Commands/BatchProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -153,15 +154,18 @@ protected function processBatch(BeamType $type): int
$params[$collectionId]['beamId'] = $claim->beam_id;

if ($type == BeamType::TRANSFER_TOKEN) {
$daemon = Account::daemonPublicKey();
$params[$collectionId]['recipients'][] = [
'accountId' => $claim->wallet_public_key,
'params' => $this->substrate->getTransferParams([
'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, $daemon) => $daemon,
$daemon !== $claim->collection->owner->public_key => $claim->collection->owner->public_key,
default => null
},
])->toEncodable(),
];
} else {
Expand Down

0 comments on commit fa32589

Please sign in to comment.