Skip to content

Commit

Permalink
Check wallet daemon approval (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
enjinabner authored Sep 23, 2024
1 parent 3adb120 commit 5521d60
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 5521d60

Please sign in to comment.