Skip to content

Commit

Permalink
Crypto Currency Magento 2 Extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Alekseenko committed Feb 5, 2024
0 parents commit 8d19460
Show file tree
Hide file tree
Showing 63 changed files with 3,342 additions and 0 deletions.
51 changes: 51 additions & 0 deletions Api/BlockchainRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
/**
* Copyright © Ihor Oleksiienko (https://github.com/torys877)
* See LICENSE for license details.
*/
declare(strict_types=1);

namespace Crypto\CryptoCurrency\Api;

use Crypto\CryptoCurrency\Api\Data\BlockchainInterface;
use Crypto\CryptoCurrency\Model\ResourceModel\Blockchain\Collection;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Framework\Exception\NoSuchEntityException;

interface BlockchainRepositoryInterface
{
/**
* @param int $blockchainId
* @return BlockchainInterface
* @throws NoSuchEntityException
*/
public function getById(int $blockchainId): BlockchainInterface;

/**
* @param string $blockchainCode
* @return BlockchainInterface
* @throws NoSuchEntityException
*/
public function getByCode(string $blockchainCode): BlockchainInterface;

/**
* @param SearchCriteriaInterface $searchCriteria
* @return Collection
*/
public function getList(SearchCriteriaInterface $searchCriteria): Collection;

/**
* Save blockchain
*
* @param BlockchainInterface $blockchain
* @return BlockchainInterface
* @throws CouldNotSaveException
*/
public function save(BlockchainInterface $blockchain): BlockchainInterface;

/**
* @return Collection
*/
public function getAll(): Collection;
}
48 changes: 48 additions & 0 deletions Api/CryptoCurrencyRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Copyright © Ihor Oleksiienko (https://github.com/torys877)
* See LICENSE for license details.
*/
declare(strict_types=1);

namespace Crypto\CryptoCurrency\Api;

use Crypto\CryptoCurrency\Api\Data\CurrencyAddressInterface;
use Crypto\CryptoCurrency\Model\ResourceModel\Blockchain\Collection as BlockchainCollection;
use Crypto\CryptoCurrency\Model\ResourceModel\CurrencyAddress\Collection as CurrencyAddressCollection;
use Crypto\Currency\Api\CurrencyRepositoryInterface;

interface CryptoCurrencyRepositoryInterface extends CurrencyRepositoryInterface
{
/**
* @param string $currencyCode
* @return BlockchainCollection
*/
public function getAllCurrencyBlockchainsByCode(string $currencyCode): BlockchainCollection;

/**
* @param string $currencyCode
* @return bool
*/
public function isCurrencyActive(string $currencyCode): bool;

/**
* @param string $currencyCode
* @return CurrencyAddressCollection
*/
public function getAllCurrencyAddressesByCode(string $currencyCode): CurrencyAddressCollection;

/**
* @param int $currencyId
* @param int $blockchainNetworkId
* @return CurrencyAddressInterface
*/
public function getCurrencyAddress(int $currencyId, int $blockchainNetworkId): CurrencyAddressInterface;

/**
* @param string $blockchainCode
* @param string $currencyCode
* @return CurrencyAddressInterface
*/
public function getCurrencyAddressByBlockchainCode(string $blockchainCode, string $currencyCode): CurrencyAddressInterface;
}
39 changes: 39 additions & 0 deletions Api/CurrencyAddressRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* Copyright © Ihor Oleksiienko (https://github.com/torys877)
* See LICENSE for license details.
*/
declare(strict_types=1);

namespace Crypto\CryptoCurrency\Api;

use Crypto\CryptoCurrency\Api\Data\CurrencyAddressInterface;
use Crypto\CryptoCurrency\Model\ResourceModel\CurrencyAddress\Collection;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Framework\Exception\NoSuchEntityException;

interface CurrencyAddressRepositoryInterface
{
/**
* @param int $currencyAddressId
* @return CurrencyAddressInterface
* @throws NoSuchEntityException
*/
public function getById(int $currencyAddressId): CurrencyAddressInterface;

/**
* @param SearchCriteriaInterface $searchCriteria
* @return Collection
*/
public function getList(SearchCriteriaInterface $searchCriteria): Collection;

/**
* Save currency address entity
*
* @param CurrencyAddressInterface $currencyAddress
* @return CurrencyAddressInterface
* @throws CouldNotSaveException
*/
public function save(CurrencyAddressInterface $currencyAddress): CurrencyAddressInterface;
}
147 changes: 147 additions & 0 deletions Api/Data/BlockchainInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<?php
/*
* Copyright © Ihor Oleksiienko (https://github.com/torys877)
* See LICENSE for license details.
*/

namespace Crypto\CryptoCurrency\Api\Data;

interface BlockchainInterface
{
/**
* String constants for property names
*/
public const ENTITY_ID = "entity_id";
public const NETWORK_ID = "network_id";
public const CODE = "code";
public const NAME = "name";
public const BLOCK_EXPLORER_URL = "block_explorer_url";
public const IS_BLOCK_EXPLORER_CHECK = "is_block_explorer_check";
public const BLOCK_EXPLORER_API_URL = "block_explorer_api_url";
public const BLOCK_EXPLORER_API_KEY = "block_explorer_api_key";

/**
* Retrieve entity id
*
* @return mixed
*/
public function getEntityId();

/**
* @param int $entityId
* @return mixed
*/
public function setEntityId($entityId);

/**
* Getter for NetworkId.
*
* @return int|null
*/
public function getNetworkId(): ?int;

/**
* Setter for NetworkId.
*
* @param int|null $networkId
*
* @return void
*/
public function setNetworkId(?int $networkId): self;

/**
* Getter for Name.
*
* @return string|null
*/
public function getName(): ?string;

/**
* Setter for Name.
*
* @param string|null $name
*
* @return void
*/
public function setName(?string $name): self;

/**
* Getter for Code.
*
* @return string|null
*/
public function getCode(): ?string;

/**
* Setter for Code.
*
* @param string|null $code
*
* @return void
*/
public function setCode(?string $code): self;

/**
* Getter for BlockExplorerUrl.
*
* @return string|null
*/
public function getBlockExplorerUrl(): ?string;

/**
* Setter for BlockExplorerUrl.
*
* @param string|null $blockExplorerUrl
*
* @return void
*/
public function setBlockExplorerUrl(?string $blockExplorerUrl): self;

/**
* Getter for block explorer check.
*
* @return bool|null
*/
public function getIsBlockExplorerCheck(): ?bool;

/**
* Setter for block explorer check.
*
* @param bool|null $isCheck
*
* @return void
*/
public function setIsBlockExplorerCheck(?bool $isCheck): self;

/**
* Getter for block explorer api url.
*
* @return string|null
*/
public function getBlockExplorerApiUrl(): ?string;

/**
* Setter for block explorer api url.
*
* @param string|null $blockExplorerApiUrl
*
* @return void
*/
public function setBlockExplorerApiUrl(?string $blockExplorerApiUrl): self;

/**
* Getter for block explorer api key.
*
* @return string|null
*/
public function getBlockExplorerApiKey(): ?string;

/**
* Setter for block explorer api key.
*
* @param string|null $blockExplorerApiKey
*
* @return void
*/
public function setBlockExplorerApiKey(?string $blockExplorerApiKey): self;
}
78 changes: 78 additions & 0 deletions Api/Data/CryptoCurrencyInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php
/*
* Copyright © Ihor Oleksiienko (https://github.com/torys877)
* See LICENSE for license details.
*/
declare(strict_types=1);

namespace Crypto\CryptoCurrency\Api\Data;

use Crypto\Currency\Api\Data\CurrencyInterface;

interface CryptoCurrencyInterface extends CurrencyInterface
{
const IS_CRYPTO = "is_crypto";
const IS_TOKEN = "is_token";
const CRYPTO_CODE = "crypto_code";
const ABI = "contract_abi";

/**
* Getter for Is Crypto.
*
* @return bool|null
*/
public function getIsCrypto(): ?bool;

/**
* Setter for Is Crypto.
*
* @param bool|null $isCrypto
*
* @return void
*/
public function setIsCrypto(?bool $isCrypto): self;

/**
* Getter for IsToken.
*
* @return bool|null
*/
public function getIsToken(): ?bool;

/**
* Setter for IsToken.
*
* @param bool|null $isToken
*
* @return void
*/
public function setIsToken(?bool $isToken): self;

/**
* Getter for Crypto Code.
* @return string|null
*/
public function getCryptoCode(): ?string;

/**
* Setter for Crypto Code.
*
* @param string $cryptoCode
* @return self
*/
public function setCryptoCode(string $cryptoCode): self;

/**
* Getter for Token ABI.
* @return string|null
*/
public function getAbi(): ?string;

/**
* Setter for Token ABI.
*
* @param string $abi
* @return self
*/
public function setAbi(string $abi): self;
}
Loading

0 comments on commit 8d19460

Please sign in to comment.