Skip to content

Commit

Permalink
remove v2 prefix from api
Browse files Browse the repository at this point in the history
  • Loading branch information
grkamil committed Oct 19, 2020
1 parent e595f97 commit 38c6108
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Create MinterAPI instance
```php
use Minter\MinterAPI;

$nodeUrl = 'https://minter-node-1.testnet.minter.network:8843'; // example of a node url
$nodeUrl = 'https://minter-node-1.testnet.minter.network:8843/v2/'; // example of a node url

$api = new MinterAPI($nodeUrl);
```
Expand Down
52 changes: 26 additions & 26 deletions src/Minter/MinterAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function createDefaultHttpClient(string $baseUri): Client
*/
public function getStatus(): \stdClass
{
return $this->get('v2/status');
return $this->get('/status');
}

/**
Expand All @@ -79,7 +79,7 @@ public function getCandidate(string $publicKey, ?int $height = null): \stdClass
$params = ['height' => $height];
}

return $this->get('v2/candidate/' . $publicKey, $params ?? null);
return $this->get('/candidate/' . $publicKey, $params ?? null);
}

/**
Expand All @@ -103,7 +103,7 @@ public function getValidators(?int $height = null, ?int $page = 1, ?int $perPage
$params['per_page'] = $perPage;
}

return $this->get('v2/validators', $params);
return $this->get('/validators', $params);
}

/**
Expand All @@ -122,7 +122,7 @@ public function getBalance(string $address, ?int $height = null, bool $delegated
$params['height'] = $height;
}

return $this->get('v2/address/' . $address, $params);
return $this->get('address/' . $address, $params);
}

/**
Expand All @@ -142,7 +142,7 @@ public function getAddresses(array $addresses, ?int $height = null, bool $delega
$params['height'] = $height;
}

return $this->get('v2/addresses', $params);
return $this->get('/addresses', $params);
}

/**
Expand All @@ -168,7 +168,7 @@ public function getNonce(string $address): int
*/
public function send(string $tx): \stdClass
{
return $this->post('v2/send_transaction', ['tx' => $tx]);
return $this->post('/send_transaction', ['tx' => $tx]);
}

/**
Expand All @@ -181,7 +181,7 @@ public function send(string $tx): \stdClass
*/
public function getTransaction(string $hash): \stdClass
{
return $this->get('v2/transaction/' . $hash);
return $this->get('/transaction/' . $hash);
}

/**
Expand All @@ -194,7 +194,7 @@ public function getTransaction(string $hash): \stdClass
*/
public function getBlock(int $height): \stdClass
{
return $this->get('v2/block/' . $height);
return $this->get('/block/' . $height);
}

/**
Expand All @@ -207,7 +207,7 @@ public function getBlock(int $height): \stdClass
*/
public function getEvents(int $height): \stdClass
{
return $this->get('v2/events/' . $height);
return $this->get('/events/' . $height);
}

/**
Expand All @@ -231,7 +231,7 @@ public function getCandidates(?int $height = null, ?bool $includeStakes = false,
$params['height'] = $height;
}

return $this->get('v2/candidates', $params);
return $this->get('/candidates', $params);
}

/**
Expand All @@ -250,7 +250,7 @@ public function getCoinInfo(string $symbol, ?int $height = null): \stdClass
$params['height'] = $height;
}

return $this->get('v2/coin_info/' . $symbol, $params ?? null);
return $this->get('/coin_info/' . $symbol, $params ?? null);
}

/**
Expand Down Expand Up @@ -280,7 +280,7 @@ public function estimateCoinSell(
$params['height'] = $height;
}

return $this->get('v2/estimate_coin_sell', $params);
return $this->get('/estimate_coin_sell', $params);
}

/**
Expand Down Expand Up @@ -309,7 +309,7 @@ public function estimateCoinSellAll(
$params['height'] = $height;
}

return $this->get('v2/estimate_coin_sell_all', $params);
return $this->get('/estimate_coin_sell_all', $params);
}

/**
Expand Down Expand Up @@ -339,7 +339,7 @@ public function estimateCoinBuy(
$params['height'] = $height;
}

return $this->get('v2/estimate_coin_buy', $params);
return $this->get('/estimate_coin_buy', $params);
}

/**
Expand All @@ -358,7 +358,7 @@ public function estimateTxCommission(string $tx, ?int $height = null): \stdClass
$params['height'] = $height;
}

return $this->get('v2/estimate_tx_commission', $params);
return $this->get('/estimate_tx_commission', $params);
}

/**
Expand All @@ -384,7 +384,7 @@ public function getTransactions(string $query, ?int $page = null, ?int $perPage
}


return $this->get('v2/transactions', $params);
return $this->get('/transactions', $params);
}

/**
Expand All @@ -397,7 +397,7 @@ public function getTransactions(string $query, ?int $page = null, ?int $perPage
*/
public function getUnconfirmedTxs(?int $limit = null): \stdClass
{
return $this->get('v2/unconfirmed_txs', ($limit ? ['limit' => $limit] : null));
return $this->get('/unconfirmed_txs', ($limit ? ['limit' => $limit] : null));
}

/**
Expand All @@ -410,7 +410,7 @@ public function getUnconfirmedTxs(?int $limit = null): \stdClass
*/
public function getMaxGasPrice(?int $height = null): \stdClass
{
return $this->get('v2/max_gas', ($height ? ['height' => $height] : null));
return $this->get('/max_gas', ($height ? ['height' => $height] : null));
}

/**
Expand All @@ -422,7 +422,7 @@ public function getMaxGasPrice(?int $height = null): \stdClass
*/
public function getMinGasPrice(): \stdClass
{
return $this->get('v2/min_gas_price');
return $this->get('/min_gas_price');
}

/**
Expand All @@ -436,7 +436,7 @@ public function getMinGasPrice(): \stdClass
*/
public function getMissedBlocks(string $pubKey, ?int $height = null): \stdClass
{
return $this->get('v2/missed_blocks/' . $pubKey, ($height ? ['height' => $height] : null));
return $this->get('/missed_blocks/' . $pubKey, ($height ? ['height' => $height] : null));
}

/**
Expand All @@ -447,7 +447,7 @@ public function getMissedBlocks(string $pubKey, ?int $height = null): \stdClass
*/
public function getGenesis(): \stdClass
{
return $this->get('v2/genesis');
return $this->get('/genesis');
}

/**
Expand All @@ -458,7 +458,7 @@ public function getGenesis(): \stdClass
*/
public function getNetworkInfo(): \stdClass
{
return $this->get('v2/net_info');
return $this->get('/net_info');
}

/**
Expand All @@ -469,7 +469,7 @@ public function getNetworkInfo(): \stdClass
*/
public function getCoinInfoByID(int $id, ?int $height = null):\ stdClass
{
return $this->get('v2/coin_info_by_id/' . $id, ($height ? ['height' => $height] : null));
return $this->get('/coin_info_by_id/' . $id, ($height ? ['height' => $height] : null));
}

/**
Expand All @@ -479,7 +479,7 @@ public function getCoinInfoByID(int $id, ?int $height = null):\ stdClass
*/
public function getHalts(?int $height = null): \stdClass
{
return $this->get('v2/halts', ($height ? ['height' => $height] : null));
return $this->get('/halts', ($height ? ['height' => $height] : null));
}

/**
Expand All @@ -499,7 +499,7 @@ public function getFrozen(?string $address = null, ?string $coin = null): \stdCl
$params['coin'] = $coin;
}

return $this->get('v2/frozen', $params);
return $this->get('/frozen', $params);
}

/**
Expand All @@ -510,6 +510,6 @@ public function getFrozen(?string $address = null, ?string $coin = null): \stdCl
*/
public function getWaitlist(string $publicKey, string $address, ?int $height = null): \stdClass
{
return $this->get('v2/waitlist/' . $publicKey . '/' . $address, ($height ? ['height' => $height] : null));
return $this->get('/waitlist/' . $publicKey . '/' . $address, ($height ? ['height' => $height] : null));
}
}

0 comments on commit 38c6108

Please sign in to comment.