Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/API/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ public function crypto(): ?array
/**
* Get the node fee statistics.
*
* @param int|null $days
* @param array $query
*
* @return array
*/
public function fees(?int $days = null): ?array
public function fees(array $query = []): ?array
{
return $this->requestGet('node/fees', ['days' => $days]);
return $this->requestGet('node/fees', $query);
}
}
6 changes: 4 additions & 2 deletions src/API/Transactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ public function get(string $id): ?array
/**
* Get all unconfirmed transactions.
*
* @param array $query
*
* @return array
*/
public function allUnconfirmed(): ?array
public function allUnconfirmed(array $query = []): ?array
{
return $this->withApi('transactions')->requestGet('transactions/unconfirmed');
return $this->withApi('transactions')->requestGet('transactions/unconfirmed', $query);
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/API/Wallets.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ public function votes(string $id, array $query = []): ?array
/**
* Get all wallets sorted by balance in descending order.
*
* @param array $query
*
* @return array
*/
public function top(): ?array
public function top(array $query = []): ?array
{
return $this->requestGet('wallets/top');
return $this->requestGet('wallets/top', $query);
}

/**
Expand Down
6 changes: 6 additions & 0 deletions tests/API/NodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,9 @@
return $client->node()->fees();
});
});

it('calls the correct url for fees with query', function () {
$this->assertResponse('GET', 'node/fees?days=7', function (ArkClient $client) {
return $client->node()->fees(['days' => 7]);
});
});
11 changes: 11 additions & 0 deletions tests/API/TransactionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@
);
});

it('calls correct url for all unconfirmed with query', function () {
$this->assertResponse(
method: 'GET',
path: 'transactions/unconfirmed?limit=50',
callback: function (ArkClient $client) {
return $client->transactions()->allUnconfirmed(['limit' => 50]);
},
expectedApi: 'transactions'
);
});

it('calls correct url for get unconfirmed', function () {
$this->assertResponse(
method: 'GET',
Expand Down
36 changes: 36 additions & 0 deletions tests/API/WalletsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
});
});

it('calls correct url for top with query', function () {
$this->assertResponse('GET', 'wallets/top?limit=10', function (ArkClient $client) {
return $client->wallets()->top(['limit' => 10]);
});
});

it('calls correct url for get', function () {
$this->assertResponse('GET', 'wallets/dummy', function (ArkClient $client) {
return $client->wallets()->get('dummy');
Expand Down Expand Up @@ -75,3 +81,33 @@
]);
});
});

it('calls correct url for a wallet tokens with whitelist', function () {
$this->assertResponse(
'POST',
'wallets/dummy/tokens',
function (ArkClient $client) {
return $client->wallets()->tokensFor('dummy', [
'whitelist' => ['0x1234567890abcdef1234567890abcdef12345678'],
]);
},
expectedRequestBody: [
'whitelist' => ['0x1234567890abcdef1234567890abcdef12345678'],
]
);
});

it('calls correct url for all wallet tokens with whitelist', function () {
$this->assertResponse(
'POST',
'wallets/tokens',
function (ArkClient $client) {
return $client->wallets()->tokens([
'whitelist' => ['0x1234567890abcdef1234567890abcdef12345678'],
]);
},
expectedRequestBody: [
'whitelist' => ['0x1234567890abcdef1234567890abcdef12345678'],
]
);
});
Loading