Skip to content

Commit

Permalink
Remove decoder migration fix
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocustodio committed Sep 10, 2024
1 parent 6f5d8f7 commit dc05bfb
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/Services/Processor/Substrate/Codec/Decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Enjin\Platform\Models\Substrate\MintPolicyParams;
use Enjin\Platform\Models\Substrate\RoyaltyPolicyParams;
use Illuminate\Support\Arr;
use PHPUnit\Exception;

class Decoder
{
Expand Down Expand Up @@ -193,11 +192,7 @@ public function getValue(array $data, array $keys, ?string $prefix = null, ?stri

public function collectionStorageData(string $data): array
{
try {
$decoded = $this->codec->process('CollectionStorageDataV1010', new ScaleBytes($data));
} catch (\Exception $e) {
$decoded = $this->codec->process('CollectionStorageData', new ScaleBytes($data));
}
$decoded = $this->codec->process('CollectionStorageDataV1010', new ScaleBytes($data));

return [
'owner' => ($owner = Arr::get($decoded, 'owner')) !== null ? HexConverter::prefix($owner) : null,
Expand Down Expand Up @@ -228,11 +223,7 @@ public function tokenStorageKey(string $data): array

public function tokenStorageData(string $data): array
{
try {
$decoded = $this->codec->process('TokenStorageDataV1010', new ScaleBytes($data));
} catch (Exception $e) {
$decoded = $this->codec->process('TokenStorageData', new ScaleBytes($data));
}
$decoded = $this->codec->process('TokenStorageDataV1010', new ScaleBytes($data));

$cap = TokenMintCapType::tryFrom(collect(Arr::get($decoded, 'cap'))->keys()->first()) ?? TokenMintCapType::INFINITE;
$capSupply = Arr::get($decoded, 'cap.Supply') ?? Arr::get($decoded, 'cap.CollapsingSupply');
Expand Down

0 comments on commit dc05bfb

Please sign in to comment.