Skip to content

Commit 3c07fd5

Browse files
authored
Merge branch 'master' into beta
2 parents 1a57f3a + 46e1ae2 commit 3c07fd5

File tree

4 files changed

+43
-25
lines changed

4 files changed

+43
-25
lines changed

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
## [8.0.2-beta.1](https://github.com/hirosystems/stacks-blockchain-api/compare/v8.0.1...v8.0.2-beta.1) (2024-09-26)
1+
## [8.0.3](https://github.com/hirosystems/stacks-blockchain-api/compare/v8.0.2...v8.0.3) (2024-10-01)
2+
3+
4+
### Bug Fixes
5+
6+
* query param `until_block` not working in several endpoints ([#2101](https://github.com/hirosystems/stacks-blockchain-api/issues/2101)) ([fce15d6](https://github.com/hirosystems/stacks-blockchain-api/commit/fce15d68377b6fe5fabeab65b34bd4e7a8d3bef6))
7+
8+
## [8.0.2](https://github.com/hirosystems/stacks-blockchain-api/compare/v8.0.1...v8.0.2) (2024-09-27)
29

310

11+
### Bug Fixes
12+
13+
* tests ([689ff18](https://github.com/hirosystems/stacks-blockchain-api/commit/689ff183dd0bdd1779f0220835123a0cc99e37c6))
14+
15+
16+
## [8.0.2-beta.1](https://github.com/hirosystems/stacks-blockchain-api/compare/v8.0.1...v8.0.2-beta.1) (2024-09-26)
17+
418
### Bug Fixes
519

620
* use current circulating STX tokens for `stx_supply` endpoint, year 2050 estimate in new field ([b3e08e7](https://github.com/hirosystems/stacks-blockchain-api/commit/b3e08e7872c4a6b5a076d8bbcc22eb388ecef5ab))

src/api/query-helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ export function parseUntilBlockQuery(
4141
): undefined | number | string {
4242
if (!untilBlock) return;
4343
if (typeof untilBlock === 'string') {
44-
if (unanchored !== undefined) {
44+
if (unanchored) {
4545
// if mutually exclusive unachored is also specified, throw bad request error
4646
throw new InvalidRequestError(
47-
`can't handle both 'unanchored' and 'until_block' in the same request`,
47+
`can't handle both 'unanchored=true' and 'until_block' in the same request`,
4848
InvalidRequestErrorType.bad_request
4949
);
5050
}

src/tests/address-tests.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,12 @@ describe('address tests', () => {
15701570
};
15711571
expect(JSON.parse(fetchAddrBalance1.text)).toEqual(expectedResp1);
15721572

1573+
const fetchAddrBalance1AtBlock = await supertest(api.server).get(
1574+
`/extended/v1/address/${testAddr2}/balances?until_block=1`
1575+
);
1576+
expect(fetchAddrBalance1AtBlock.status).toBe(200);
1577+
expect(fetchAddrBalance1AtBlock.type).toBe('application/json');
1578+
15731579
const fetchAddrBalance2 = await supertest(api.server).get(
15741580
`/extended/v1/address/${testContractAddr}/balances`
15751581
);
@@ -2608,16 +2614,6 @@ describe('address tests', () => {
26082614
);
26092615
expect(response.status).toBe(400);
26102616
}
2611-
2612-
const addressEndpoints1 = ['/transactions', '/transactions_with_transfers', '/stx_inbound'];
2613-
2614-
/// check for mutually exclusive until_block adn height params
2615-
for (const path of addressEndpoints1) {
2616-
const response1 = await supertest(api.server).get(
2617-
`/extended/v1/address/STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6${path}?until_block=5&height=0`
2618-
);
2619-
expect(response1.status).toBe(400);
2620-
}
26212617
});
26222618

26232619
test('/transactions materialized view separates anchored and unanchored counts correctly', async () => {

src/tests/other-tests.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,13 @@ describe('other tests', () => {
141141
expect(result1.status).toBe(200);
142142
expect(result1.type).toBe('application/json');
143143
const expectedResp1 = {
144-
unlocked_percent: '12.93',
145-
total_stx: '1818000000.000000',
146-
unlocked_stx: microStxToStx(expectedTotalStx1),
147-
block_height: dbBlock1.block_height,
144+
unlocked_percent: '100.00',
145+
total_stx: '235000000.000000',
146+
total_stx_year_2050: '1818000000.000000',
147+
unlocked_stx: '235000000.000000',
148+
block_height: 1,
148149
};
150+
149151
expect(JSON.parse(result1.text)).toEqual(expectedResp1);
150152

151153
// ensure burned STX reduce the unlocked stx supply
@@ -166,9 +168,10 @@ describe('other tests', () => {
166168
expect(result2.status).toBe(200);
167169
expect(result2.type).toBe('application/json');
168170
const expectedResp2 = {
169-
unlocked_percent: '12.38',
170-
total_stx: '1818000000.000000',
171+
unlocked_percent: '100.00',
172+
total_stx: microStxToStx(expectedTotalStx2),
171173
unlocked_stx: microStxToStx(expectedTotalStx2),
174+
total_stx_year_2050: '1818000000.000000',
172175
block_height: dbBlock1.block_height,
173176
};
174177
expect(JSON.parse(result2.text)).toEqual(expectedResp2);
@@ -197,8 +200,9 @@ describe('other tests', () => {
197200
expect(result3.status).toBe(200);
198201
expect(result3.type).toBe('application/json');
199202
const expectedResp3 = {
200-
unlocked_percent: '13.20',
201-
total_stx: '1818000000.000000',
203+
unlocked_percent: '100.00',
204+
total_stx: microStxToStx(expectedTotalStx3),
205+
total_stx_year_2050: '1818000000.000000',
202206
unlocked_stx: microStxToStx(expectedTotalStx3),
203207
block_height: dbBlock1.block_height,
204208
};
@@ -207,7 +211,7 @@ describe('other tests', () => {
207211
const result4 = await supertest(api.server).get(`/extended/v1/stx_supply/total/plain`);
208212
expect(result4.status).toBe(200);
209213
expect(result4.type).toBe('text/plain');
210-
expect(result4.text).toEqual('1818000000.000000');
214+
expect(result4.text).toEqual('240000000.000000');
211215

212216
const result5 = await supertest(api.server).get(`/extended/v1/stx_supply/circulating/plain`);
213217
expect(result5.status).toBe(200);
@@ -219,13 +223,17 @@ describe('other tests', () => {
219223
expect(result6.status).toBe(200);
220224
expect(result6.type).toBe('application/json');
221225
const expectedResp6 = {
222-
unlockedPercent: '13.20',
223-
totalStacks: '1818000000.000000',
224-
totalStacksFormatted: '1,818,000,000.000000',
226+
unlockedPercent: '100.00',
227+
totalStacks: microStxToStx(expectedTotalStx3),
228+
totalStacksFormatted: new Intl.NumberFormat('en', {
229+
minimumFractionDigits: STACKS_DECIMAL_PLACES,
230+
}).format(parseInt(microStxToStx(expectedTotalStx3))),
225231
unlockedSupply: microStxToStx(expectedTotalStx3),
226232
unlockedSupplyFormatted: new Intl.NumberFormat('en', {
227233
minimumFractionDigits: STACKS_DECIMAL_PLACES,
228234
}).format(parseInt(microStxToStx(expectedTotalStx3))),
235+
totalStacksYear2050: '1818000000.000000',
236+
totalStacksYear2050Formatted: '1,818,000,000.000000',
229237
blockHeight: dbBlock1.block_height.toString(),
230238
};
231239
expect(JSON.parse(result6.text)).toEqual(expectedResp6);

0 commit comments

Comments
 (0)