diff --git a/README.md b/README.md index 02ab712..d5c31da 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,6 @@ use Metahash\MetaHash; use Metahash\MetaHashCrypto; $metaHash = new MetaHash(); -$metaHash->setNetwork('main'); - $balance = $metaHash->fetchBalance('0x00fa2a5279f8f0fd2f0f9d3280ad70403f01f9d62f52373833'); print_r($balance); ``` diff --git a/examples/index.php b/examples/index.php index aea22f5..965dd53 100644 --- a/examples/index.php +++ b/examples/index.php @@ -7,7 +7,6 @@ // !!! very bad if (isset($_GET['address'])) { $crypto = new MetaHash(); - $crypto->setNetwork('main'); $balance = \json_encode($crypto->fetchBalance($_GET['address']), JSON_PRETTY_PRINT); } else { $balance = false; diff --git a/examples/wallets.php b/examples/wallets.php index cf0b42c..f490625 100644 --- a/examples/wallets.php +++ b/examples/wallets.php @@ -5,7 +5,6 @@ use Metahash\MetaHash; $crypto = new MetaHash(); -$crypto->setNetwork('main'); $wallets = [ '0x00fa2a5279f8f0fd2f0f9d3280ad70403f01f9d62f52373833' => 'MetaWat.ch', diff --git a/src/MetaHash.php b/src/MetaHash.php index d826fa2..6dec136 100644 --- a/src/MetaHash.php +++ b/src/MetaHash.php @@ -27,6 +27,10 @@ class MetaHash public const NODE_PROXY = 'PROXY'; public const NODE_TORRENT = 'TORRENT'; + public const NETWORK_MAIN = 'main'; + public const NETWORK_TEST = 'test'; + public const NETWORK_DEV = 'dev'; + /** * @var string */ @@ -63,7 +67,9 @@ public function __construct() 'connect_timeout' => self::CONNECT_TIMEOUT, 'debug' => self::DEBUG, ]; - $this->client = new GuzzleClient($guzzleOptions); + $this->setClient(new GuzzleClient($guzzleOptions)); + + $this->setNetwork(self::NETWORK_MAIN); } /**