Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocustodio committed Sep 11, 2024
1 parent da66074 commit 9f1a42e
Show file tree
Hide file tree
Showing 20 changed files with 52 additions and 30 deletions.
4 changes: 3 additions & 1 deletion src/Enums/Substrate/StorageKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

class StorageKey
{
public function __construct(public StorageType $type, public string $value) {}
public function __construct(public StorageType $type, public string $value)
{
}

public static function tanks(?string $value = null): self
{
Expand Down
4 changes: 3 additions & 1 deletion src/Models/FuelTank.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

use Enjin\Platform\Models\ModelResolver;

class FuelTank extends ModelResolver {}
class FuelTank extends ModelResolver
{
}
4 changes: 3 additions & 1 deletion src/Models/FuelTankAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

use Enjin\Platform\Models\ModelResolver;

class FuelTankAccount extends ModelResolver {}
class FuelTankAccount extends ModelResolver
{
}
3 changes: 2 additions & 1 deletion src/Models/Substrate/AccountRulesParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class AccountRulesParams
public function __construct(
public ?WhitelistedCallersParams $whitelistedCallers = null,
public ?RequireTokenParams $requireToken = null,
) {}
) {
}

/**
* Create a new instance from the given parameters.
Expand Down
3 changes: 2 additions & 1 deletion src/Models/Substrate/DispatchRulesParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public function __construct(
public ?WhitelistedPalletsParams $whitelistedPallets = null,
public ?RequireSignatureParams $requireSignature = null,
public ?bool $isFrozen = false,
) {}
) {
}

/**
* Create a new instance from the given parameters.
Expand Down
4 changes: 3 additions & 1 deletion src/Models/Substrate/MaxFuelBurnPerTransactionParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ class MaxFuelBurnPerTransactionParams extends FuelTankRules
/**
* Creates a new instance.
*/
public function __construct(public string $max) {}
public function __construct(public string $max)
{
}

/**
* Creates a new instance from the given array.
Expand Down
3 changes: 2 additions & 1 deletion src/Models/Substrate/RequireSignatureParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class RequireSignatureParams extends FuelTankRules
*/
public function __construct(
public string $signature,
) {}
) {
}

/**
* Creates a new instance from the given array.
Expand Down
3 changes: 2 additions & 1 deletion src/Models/Substrate/RequireTokenParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class RequireTokenParams extends FuelTankRules
public function __construct(
public string $collectionId,
public string $tokenId,
) {}
) {
}

/**
* Creates a new instance from the given array.
Expand Down
3 changes: 2 additions & 1 deletion src/Models/Substrate/TankFuelBudgetParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public function __construct(
public string $resetPeriod,
public ?string $totalConsumed = '0',
public ?string $lastResetBlock = '0',
) {}
) {
}

/**
* Creates a new instance from the given array.
Expand Down
3 changes: 2 additions & 1 deletion src/Models/Substrate/UserAccountManagementParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class UserAccountManagementParams
public function __construct(
public bool $tankReservesExistentialDeposit = false,
public bool $tankReservesAccountCreationDeposit = false,
) {}
) {
}

/**
* Returns the encodable representation of this instance.
Expand Down
3 changes: 2 additions & 1 deletion src/Models/Substrate/UserFuelBudgetParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public function __construct(
public string $amount,
public string $resetPeriod,
public ?string $userCount = '0',
) {}
) {
}

/**
* Creates a new instance from the given array.
Expand Down
3 changes: 2 additions & 1 deletion src/Models/Substrate/WhitelistedCollectionsParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class WhitelistedCollectionsParams extends FuelTankRules
*/
public function __construct(
public ?array $collections = [],
) {}
) {
}

/**
* Creates a new instance from the given array.
Expand Down
3 changes: 2 additions & 1 deletion src/Models/Substrate/WhitelistedPalletsParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class WhitelistedPalletsParams extends FuelTankRules
*/
public function __construct(
public ?array $pallets = [],
) {}
) {
}

/**
* Creates a new instance from the given array.
Expand Down
4 changes: 3 additions & 1 deletion src/Models/Wallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

use Enjin\Platform\Models\ModelResolver;

class Wallet extends ModelResolver {}
class Wallet extends ModelResolver
{
}
4 changes: 3 additions & 1 deletion src/Rules/AccountsExistsInFuelTank.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ class AccountsExistsInFuelTank implements ValidationRule
/**
* Create a new rule instance.
*/
public function __construct(protected ?string $account) {}
public function __construct(protected ?string $account)
{
}

/**
* Run the validation rule.
Expand Down
4 changes: 3 additions & 1 deletion src/Rules/AccountsNotInFuelTank.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ class AccountsNotInFuelTank implements ValidationRule
/**
* Create a new rule instance.
*/
public function __construct(protected ?string $account) {}
public function __construct(protected ?string $account)
{
}

/**
* Run the validation rule.
Expand Down
4 changes: 3 additions & 1 deletion src/Rules/TokenExistsInCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class TokenExistsInCollection implements ValidationRule
/**
* Create a new rule instance.
*/
public function __construct(protected ?string $collectionId) {}
public function __construct(protected ?string $collectionId)
{
}

/**
* Run the validation rule.
Expand Down
12 changes: 2 additions & 10 deletions src/Services/Processor/Substrate/Codec/Decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ public function tankStorageKey(string $data): array
*/
public function tankStorageData(string $data): array
{
try {
$decoded = $this->codec->process('TankStorageDataV1010', new ScaleBytes($data));
} catch (\Exception) {
$decoded = $this->codec->process('TankStorageData', new ScaleBytes($data));
}
$decoded = $this->codec->process('TankStorageDataV1010', new ScaleBytes($data));

return [
'owner' => ($owner = Arr::get($decoded, 'owner')) !== null ? HexConverter::prefix($owner) : null,
Expand Down Expand Up @@ -68,11 +64,7 @@ public function fuelTankAccountStorageKey(string $data): array
*/
public function fuelTankAccountStorageData(string $data): array
{
try {
$decoded = $this->codec->process('FuelTankAccountStorageDataV1010', new ScaleBytes($data));
} catch (\Exception) {
$decoded = $this->codec->process('FuelTankAccountStorageData', new ScaleBytes($data));
}
$decoded = $this->codec->process('FuelTankAccountStorageDataV1010', new ScaleBytes($data));

return [
'tankDeposit' => gmp_strval(Arr::get($decoded, 'tankDeposit')),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ public function run(): void
// Maybe we should query the storage for this one? That would make it slower though
}

public function log(): void {}
public function log(): void
{
}

public function broadcast(): void {}
public function broadcast(): void
{
}
}
3 changes: 2 additions & 1 deletion src/Services/TransactionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ class TransactionService extends DatabaseTransactionService
public function __construct(
public readonly Codec $codec,
public readonly WalletService $wallet
) {}
) {
}
}

0 comments on commit 9f1a42e

Please sign in to comment.